~/bend-docscommunity

store.bend relies on unsafe/foreign

raw source on the hub · import cswap-bend-cli@0.1.0.0/store.bend as Store

12 imports
import Base
import ./json.bend as Json
import ./fs.bend as Fs
import ./act.bend as Act
import ./lock.bend as Lock
import ./clock.bend as Clock
import ./http.bend as Http
import ./store/base.bend as SBase
import ./store/seq.bend as SSeq
import ./store/plan.bend as SPlan
import ./store/io.bend as SIo
import ./store/ops.bend as SOps

Types

type Ident source · line 90 · raw

Data

Who the live ~/.claude.json says is logged in.

Definitions

def ActM source · line 15 · raw

@-A:Type -> Type

do ActM<A>: needs the monad defined in the file that uses it.

def ActM.pure source · line 18 · raw

@-A:Type -> @x:A -> 0x0717344745a30ebad1f19045228e8f18/act.of(A)

def ActM.bind source · line 21 · raw

@-A:Type -> @-B:Type -> @m:0x0717344745a30ebad1f19045228e8f18/act.of(A) -> @f:(@_:A -> 0x0717344745a30ebad1f19045228e8f18/act.of(B)) -> 0x0717344745a30ebad1f19045228e8f18/act.of(B)

def profile_url source · line 30 · raw

String

def prof_if_ok source · line 33 · raw

@+ok:Bool -> @+body:String -> 0x0717344745a30ebad1f19045228e8f18/store/plan.Prof

def prof_of_reply source · line 40 · raw

@r:Result<&2, &2, String, 0x0717344745a30ebad1f19045228e8f18/http.Reply> -> 0x0717344745a30ebad1f19045228e8f18/store/plan.Prof

def profile_http source · line 50 · raw

@+token:String -> IO(0x0717344745a30ebad1f19045228e8f18/store/plan.Prof)

GET /api/oauth/profile through Http.request (curl, the token on stdin, and the CSWAP_TEST_HTTP_BASE seam). Any failure is ProfNone: "unresolvable", never "wrong".

def alias_char source · line 55 · raw

@+c:Char -> Bool

def alias_chars source · line 58 · raw

@+s:String -> Bool

def alias_err2 source · line 65 · raw

@+a:String -> @+name:String -> String

def alias_err source · line 72 · raw

@+name:String -> String

models.normalize_alias: the message for a bad alias, "" for a good one.

def alias_norm source · line 75 · raw

@+name:String -> String

def alias_of source · line 79 · raw

@+m:Maybe<&2, String> -> String

The alias, normalized; "" when none was asked for.

def alias_check source · line 82 · raw

@+m:Maybe<&2, String> -> 0x0717344745a30ebad1f19045228e8f18/act.of(Unit)

def ident_of2 source · line 93 · raw

@+oa:0x0717344745a30ebad1f19045228e8f18/json.Json -> Ident

def ident_of source · line 96 · raw

@+cfg:0x0717344745a30ebad1f19045228e8f18/json.Json -> Ident

def notice_text source · line 99 · raw

@+email:String -> @+why:String -> String

def verdict_act source · line 104 · raw

@+v:0x0717344745a30ebad1f19045228e8f18/store/plan.Verdict -> @+email:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

Fail on an owner mismatch; a notice when it could not be checked.

def id_email source · line 113 · raw

@+id:Ident -> String

def id_org source · line 118 · raw

@+id:Ident -> String

def id_uuid source · line 123 · raw

@+id:Ident -> String

def verify_prof source · line 128 · raw

@+id:Ident -> @+prof:0x0717344745a30ebad1f19045228e8f18/store/plan.Prof -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def verify_plan source · line 131 · raw

@+p:0x0717344745a30ebad1f19045228e8f18/store/plan.Plan -> @+id:Ident -> @fetch:(@_:String -> IO(0x0717344745a30ebad1f19045228e8f18/store/plan.Prof)) -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def id_org_name source · line 140 · raw

@+id:Ident -> String

def capture2 source · line 146 · raw

@+ex:Bool -> @+path:String -> @+cfg:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

The credential of the live login: .credentials.json, else primaryApiKey.

def capture source · line 153 · raw

@+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+cfg:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def api_key_msg source · line 158 · raw

String

def alias_taken2 source · line 161 · raw

@+m:Maybe<&2, String> -> @+exclude:String -> Maybe<&2, String>

def alias_taken source · line 168 · raw

@+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+alias:String -> @+exclude:String -> Maybe<&2, String>

def alias_conflict2 source · line 171 · raw

@+none_asked:Bool -> @+taken:Maybe<&2, String> -> @+alias:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(Unit)

def alias_conflict source · line 180 · raw

@+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+alias:String -> @+exclude:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(Unit)

def same_alias source · line 183 · raw

@+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> @+id:Ident -> String

def existing_alias2 source · line 190 · raw

@+migrate:Maybe<&2, String> -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+num:String -> @+id:Ident -> String

def existing_alias source · line 197 · raw

@+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+num:String -> @+migrate:Maybe<&2, String> -> @+id:Ident -> String

def carried_alias source · line 200 · raw

@+alias:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+num:String -> @+migrate:Maybe<&2, String> -> @+id:Ident -> String

def sel.j source · line 203 · raw

@+c:Bool -> @+x:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+y:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/json.Json

def refresh_files source · line 210 · raw

@+root:String -> @+id:Ident -> @+creds:String -> @+cfg_text:String -> @+num:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(Unit)

def refresh_alias_seq source · line 215 · raw

@+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+alias:String -> @+num:String -> 0x0717344745a30ebad1f19045228e8f18/json.Json

def commit_active source · line 218 · raw

@+root:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+num:String -> @+ts:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(Unit)

def refresh_msg source · line 221 · raw

@+id:Ident -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+num:String -> String

def current_refresh source · line 224 · raw

@+root:String -> @+id:Ident -> @+creds:String -> @+cfg_text:String -> @+alias:String -> @+ts:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+num:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def account_record source · line 232 · raw

@+email:String -> @+uuid:String -> @+org:String -> @+org_name:String -> @+ts:String -> @+alias:String -> 0x0717344745a30ebad1f19045228e8f18/json.Json

def place_seq source · line 236 · raw

@+s2:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+id:Ident -> @+num:String -> @+ts:String -> @+alias:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+migrate:Maybe<&2, String> -> 0x0717344745a30ebad1f19045228e8f18/json.Json

def place_log source · line 239 · raw

@+root:String -> @+id:Ident -> @+num:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(Unit)

def place_msg source · line 242 · raw

@+id:Ident -> @+migrate:Maybe<&2, String> -> @+num:String -> String

def current_place2 source · line 245 · raw

@+root:String -> @+id:Ident -> @+creds:String -> @+cfg_text:String -> @+alias:String -> @+ts:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+num:String -> @+displace:Maybe<&2, String> -> @+migrate:Maybe<&2, String> -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def current_place source · line 254 · raw

@+root:String -> @+id:Ident -> @+creds:String -> @+cfg_text:String -> @+alias:String -> @+ts:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+p:0x0717344745a30ebad1f19045228e8f18/store/plan.SlotPlan -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def current_branch2 source · line 261 · raw

@+refresh:Maybe<&2, String> -> @+root:String -> @+id:Ident -> @+creds:String -> @+cfg_text:String -> @+alias:String -> @+slot0:Maybe<&2, U32> -> @+assume_yes:Bool -> @+ts:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def refresh_for source · line 268 · raw

@+slot0:Maybe<&2, U32> -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+id:Ident -> Maybe<&2, String>

def current_branch source · line 275 · raw

@+root:String -> @+id:Ident -> @+creds:String -> @+cfg_text:String -> @+alias:String -> @+slot0:Maybe<&2, U32> -> @+assume_yes:Bool -> @+ts:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def creds_checked source · line 278 · raw

@+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+cfg:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def notice_for source · line 285 · raw

@+creds:String -> @+cfg:0x0717344745a30ebad1f19045228e8f18/json.Json -> @fetch:(@_:String -> IO(0x0717344745a30ebad1f19045228e8f18/store/plan.Prof)) -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def current4 source · line 290 · raw

@+root:String -> @+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+alias:String -> @+slot0:Maybe<&2, U32> -> @+assume_yes:Bool -> @+ts:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+cfg_text:String -> @+cfg:0x0717344745a30ebad1f19045228e8f18/json.Json -> @fetch:(@_:String -> IO(0x0717344745a30ebad1f19045228e8f18/store/plan.Prof)) -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def no_login source · line 297 · raw

String

def current3c source · line 300 · raw

@+none:Bool -> @+root:String -> @+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+alias:String -> @+slot0:Maybe<&2, U32> -> @+assume_yes:Bool -> @+ts:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+cfg_text:String -> @+cfg:0x0717344745a30ebad1f19045228e8f18/json.Json -> @fetch:(@_:String -> IO(0x0717344745a30ebad1f19045228e8f18/store/plan.Prof)) -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def current3b source · line 307 · raw

@+root:String -> @+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+alias:String -> @+slot0:Maybe<&2, U32> -> @+assume_yes:Bool -> @+ts:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+cfg_text:String -> @parsed:Result<&2, &2, String, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> @fetch:(@_:String -> IO(0x0717344745a30ebad1f19045228e8f18/store/plan.Prof)) -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def read_config_text2 source · line 314 · raw

@r:0x0717344745a30ebad1f19045228e8f18/fs.Res(String) -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def read_config_text source · line 321 · raw

@+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def current3 source · line 324 · raw

@+root:String -> @+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+alias:String -> @+slot0:Maybe<&2, U32> -> @+assume_yes:Bool -> @fetch:(@_:String -> IO(0x0717344745a30ebad1f19045228e8f18/store/plan.Prof)) -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def add_current source · line 338 · raw

@+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+alias:Maybe<&2, String> -> @+slot0:Maybe<&2, U32> -> @+assume_yes:Bool -> @fetch:(@_:String -> IO(0x0717344745a30ebad1f19045228e8f18/store/plan.Prof)) -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

Adopt the live login (~/.claude.json oauthAccount + .credentials.json) into a slot. The credential's owner is looked up with fetch (profile_http in production, a stub in tests); an owner that disagrees with the config's (email, organization) is refused with the reference's wording and nothing is written. An unresolvable owner registers with a Notice line, as the reference does. An occupied slot needs assume_yes (see add_token).

def env_or source · line 345 · raw

@r:Result<&1, &1, Pair(U32, String), String> -> String

def ctx_with source · line 352 · raw

@+home:String -> @r:Result<&1, &1, Pair(U32, String), String> -> IO(0x0717344745a30ebad1f19045228e8f18/store/base.Ctx)

def ctx_env source · line 356 · raw

IO(0x0717344745a30ebad1f19045228e8f18/store/base.Ctx)

Ctx from $HOME and $CLAUDE_CONFIG_DIR.