cswap-bend-cli
Releases (1)
-
0.1.0.0 indexed
Definitions (4,210)
switch.bend
- def auto1
- def switch_auto`cswap switch [--strategy best|next-available] [--model NAMES]`: strategy "" rotates through `sequence`; "next-available" also skips accounts with no headroom; "best" moves to the account with strictly more headroom.
swlive.bend
- type Oracle
- type Opts
- type Live~/.claude.json and .credentials.json as they are right now.
- type PreThe live credential as read before the locks, and what the oracle said of it.
- def ActM
- def ActM.pure
- def ActM.bind
- def opts_delay
- def opts_oracle
- def file_prof
- def run_oracleAsk the oracle whose token this is.
- def read_text_opt2
- def read_text_optThe file's text, None when it does not exist.
- def parse_text2
- def parse_text
- def read_live
- def lv_cfg
- def lv_cfg_text
- def lv_cfg_ok
- def lv_creds_text
- def lv_credsThe live credential: the file, else a managed key in the config.
- def lv_email(email, organizationUuid) the config names; "" email means logged out.
- def lv_org
- def lv_slot2
- def lv_slotThe slot the live login belongs to, if it is managed.
- def sel_o
- def other_creds
- def archive_live
- def archive_if
- def write_live_creds2
- def write_live_credsPut the target's credential live.
- def write_cfg
- def restore_text
- def restoreUndo a half-done switch: the three files go back to their old text.
- def wrap_failure
- def config_home_of
- def with_locksClaude Code's lock directories and cswap's own flock, in the reference's order: .lock, then the credentials pair, then the config lock.
- def sel_prof
- def pre_prof
- def no_pre
- def need_lookup
- def prefetch2`_prefetch_live_identity`: before any lock is taken, look the diverged live credential up (the only network call of a switch).
- def lookup_need
- def backup_of
- def lookup_for
- def prefetch3
- def prefetch
swpick.bend
- type Cand
- type SelThe first candidate to switch to, with a warning for each one skipped on the way.
- type Pick
- type BestOut
- def skip_with
- def at_limit
- def sel_step2
- def sel_step
- def select_nextWalk `cs` (already in rotation order, current slot excluded) as switch() does.
- def sel_n
- def index_of
- def rotated2
- def rotatedThe other slots in rotation order after `anchor`: offsets 1..n-1 of the cyclic sequence.
- def better
- def sel_pick
- def best_known
- def any_unknown
- def best4
- def best3
- def best2
- def select_best`_select_best_switchable`: `others` are the switchable, enabled slots but the current one.
- def pct2
- def pct_hundredths"90.0" -> 9000, "12.34" -> 1234 (hundredths of a percent).
- def pct_of2
- def pct_of
- def push_pct
- def lower_all
- def mem
- def scoped_pick
- def scoped_pcts
- def window_pct2
- def window_pct
- def sel_l
- def pctsThe percentages `relevant_windows` looks at: 5h, 7d and, with models, the scoped windows named by them (or all of them for "all").
- def max_pct
- def min_u32
- def headroom2
- def headroom100 - the busiest relevant window, from a usage row's `lastGood`.
- def usage_rowusage.json -> the lastGood object of a slot.
- def sel_lc
swrun.bend
- def ActM
- def ActM.pure
- def ActM.bind
- def need
- def reinstruct
- def oauth_present
- def backup_outgoingThe outgoing account's backup, by what the live credential is.
- def salvage
- def new_configWhat ~/.claude.json becomes: the live one with the target's oauthAccount, or the target's whole config backup when there is no readable live one.
- def live_salvage
- def activate_files