sideby 0.40.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  <p align="center">
6
6
  <b>Run work, personal and API-key accounts at the same time, without their configs drifting apart.</b><br>
7
- Each account is its own directory and its own terminal. Skills, hooks and settings stay linked to your main account. Claude Code, Codex, Grok Build and pi.
7
+ Each account is its own directory and its own terminal. Skills, hooks and settings stay linked to your main account. Claude Code, Codex, Grok Build, pi and Antigravity CLI.
8
8
  </p>
9
9
 
10
10
  <p align="center">
@@ -18,7 +18,7 @@
18
18
 
19
19
  ## Quick start
20
20
 
21
- Requires Node 22.18+ and at least one Host CLI (Claude Code, Codex, Grok Build or pi) installed. AI agents: follow the setup steps in [`llms.txt`](llms.txt) ("Set up sideby for a user") instead.
21
+ Requires Node 22.18+ and at least one Host CLI (Claude Code, Codex, Grok Build, pi or Antigravity CLI) installed. AI agents: follow the setup steps in [`llms.txt`](llms.txt) ("Set up sideby for a user") instead.
22
22
 
23
23
  ```sh
24
24
  npm i -g sideby
package/dist/build.json CHANGED
@@ -1 +1 @@
1
- {"id":"20261116T100604-6fbbc9"}
1
+ {"id":"20261118T041035-3e178a"}
@@ -191,6 +191,13 @@ export declare function cmdNetwork(a: ParsedArgs, io: Io): Promise<number>;
191
191
  * is no preview) and print the undo.
192
192
  */
193
193
  export declare function cmdProgress(a: ParsedArgs, io: Io): Promise<number>;
194
+ /**
195
+ * `sideby trust` (spec §3.43, ADR-0078): carried folder trust between Claude accounts. Without a subcommand shows config
196
+ * `claude.carryTrust`, the carries sideby recorded and, while it is on, each Claude account's trust of the folder
197
+ * (`--dir`, default the current one): booleans only. `on` and `off` change the config, `undo` takes the copied marks
198
+ * back; each shows the change first and exits 10 until `--yes`.
199
+ */
200
+ export declare function cmdTrust(a: ParsedArgs, io: Io): Promise<number>;
194
201
  /** `sideby unattended …` (spec §3.37, ADR-0058): status, on and off, the Schedule, Pending Decisions and `defer`. */
195
202
  export declare function cmdUnattended(a: ParsedArgs, io: Io): Promise<number>;
196
203
  export declare function cmdCommands(a: ParsedArgs, io: Io): number;
@@ -4832,6 +4832,150 @@ export async function cmdProgress(a, io) {
4832
4832
  io.out(c.dim(`Undo: ${undo}`));
4833
4833
  return 0;
4834
4834
  }
4835
+ /**
4836
+ * `sideby trust` (spec §3.43, ADR-0078): carried folder trust between Claude accounts. Without a subcommand shows config
4837
+ * `claude.carryTrust`, the carries sideby recorded and, while it is on, each Claude account's trust of the folder
4838
+ * (`--dir`, default the current one): booleans only. `on` and `off` change the config, `undo` takes the copied marks
4839
+ * back; each shows the change first and exits 10 until `--yes`.
4840
+ */
4841
+ export async function cmdTrust(a, io) {
4842
+ const [sub, ...rest] = a.positionals;
4843
+ const asJson = a.flags.has('json');
4844
+ const usage = 'usage: sideby trust [--dir <path>] | sideby trust on|off [--yes] | sideby trust undo [--yes]';
4845
+ if (rest.length || a.rest.length || (sub !== undefined && !['status', 'on', 'off', 'undo'].includes(sub)))
4846
+ throw new UsageError(usage);
4847
+ const status = sub === undefined || sub === 'status';
4848
+ for (const k of a.flags.keys())
4849
+ if (k !== 'json' && !(k === 'dir' && status) && !(k === 'yes' && !status))
4850
+ throw new UsageError(`--${k} does not go with \`sideby trust ${sub ?? ''}\`; ${usage}`);
4851
+ const rt = await createRuntime();
4852
+ const home = rt.paths.home;
4853
+ // Inside text too: a reason names a path in the middle of a sentence.
4854
+ const show = (p) => tilde(p, home);
4855
+ const what = 'Before sideby starts a Claude session in a folder one of your Claude accounts has not trusted yet, it copies the trust another of your Claude accounts already gave that folder, so Claude Code does not ask "Is this a project you created or one you trust?" again. It never trusts a folder none of your accounts trusted.';
4856
+ if (sub === 'on' || sub === 'off') {
4857
+ const r = await rt.trustSet(sub === 'on', { apply: a.flags.has('yes') });
4858
+ const turnedOffNote = 'Turning it off keeps the trust sideby already copied; `sideby trust undo` takes it back.';
4859
+ if (asJson) {
4860
+ json(io, {
4861
+ action: sub,
4862
+ on: r.applied ? r.after : r.before,
4863
+ changed: r.changed,
4864
+ applied: r.applied,
4865
+ before: r.before,
4866
+ after: r.after,
4867
+ file: show(r.file),
4868
+ });
4869
+ }
4870
+ else if (!r.changed)
4871
+ io.out(`Carrying folder trust was already ${sub}.`);
4872
+ else if (!r.applied) {
4873
+ io.out(`Change to ${show(r.file)}: claude.carryTrust ${r.before} → ${r.after}`);
4874
+ io.out(c.dim(sub === 'on' ? what : turnedOffNote));
4875
+ io.out(c.cyan(`Apply it with \`sideby trust ${sub} --yes\`.`));
4876
+ }
4877
+ else {
4878
+ io.out(`${c.green('✓')} Carrying folder trust is ${sub}.`);
4879
+ io.out(c.dim(sub === 'on'
4880
+ ? `${what} Each copy prints one line; \`sideby trust undo\` takes them back.`
4881
+ : turnedOffNote));
4882
+ }
4883
+ return r.changed && !r.applied ? 10 : 0;
4884
+ }
4885
+ if (sub === 'undo') {
4886
+ const apply = a.flags.has('yes');
4887
+ const items = await rt.trustUndo({ apply });
4888
+ const out = items.map((x) => ({
4889
+ id: x.id,
4890
+ account: x.account,
4891
+ path: show(x.key),
4892
+ from: x.from,
4893
+ at: x.at,
4894
+ status: x.status,
4895
+ ...(x.why ? { why: show(x.why) } : {}),
4896
+ }));
4897
+ const todo = out.filter((x) => x.status === 'undo');
4898
+ const stuck = out.filter((x) => x.status === 'blocked' || x.status === 'busy');
4899
+ if (asJson)
4900
+ json(io, { action: 'undo', applied: apply, items: out });
4901
+ else if (!out.length)
4902
+ io.out('sideby has not copied any folder trust, so there is nothing to undo.');
4903
+ else {
4904
+ const word = {
4905
+ undo: 'will no longer trust',
4906
+ undone: c.green('no longer trusts'),
4907
+ changed: c.dim('left alone (changed since sideby copied it):'),
4908
+ gone: c.dim('left alone (its .claude.json is gone):'),
4909
+ blocked: c.yellow('not changed:'),
4910
+ busy: c.yellow('not changed:'),
4911
+ };
4912
+ for (const x of out)
4913
+ io.out(` ${x.account} ${word[x.status]} ${x.path}${c.dim(` (copied from ${x.from})`)}${x.why ? ` ${c.dim(x.why)}` : ''}`);
4914
+ if (!apply && todo.length)
4915
+ io.out(c.cyan('Take it back with `sideby trust undo --yes`.'));
4916
+ else if (!apply)
4917
+ io.out('Nothing to undo: each mark changed since sideby copied it.');
4918
+ if (apply && stuck.length)
4919
+ io.out(c.cyan('Fix what is named above, then run `sideby trust undo --yes` again.'));
4920
+ }
4921
+ if (!apply)
4922
+ return todo.length ? 10 : 0;
4923
+ return stuck.length ? 1 : 0;
4924
+ }
4925
+ const dirFlag = a.flags.get('dir');
4926
+ if (dirFlag === true)
4927
+ throw new UsageError(`--dir takes a folder; ${usage}`);
4928
+ const dir = typeof dirFlag === 'string' ? resolve(dirFlag) : process.cwd();
4929
+ const st = await rt.trustStatus(dir);
4930
+ if (asJson) {
4931
+ json(io, {
4932
+ action: 'status',
4933
+ on: st.on,
4934
+ carried: st.carried.map(({ key, ...x }) => ({ ...x, path: show(key) })),
4935
+ ...(st.dir ? { dir: show(st.dir) } : {}),
4936
+ ...(st.root
4937
+ ? {
4938
+ root: {
4939
+ kind: st.root.kind,
4940
+ ...(st.root.path ? { path: show(st.root.path) } : {}),
4941
+ ...(st.root.why ? { why: show(st.root.why) } : {}),
4942
+ },
4943
+ }
4944
+ : {}),
4945
+ ...(st.accounts
4946
+ ? { accounts: st.accounts.map((x) => (x.problem ? { ...x, problem: show(x.problem) } : x)) }
4947
+ : {}),
4948
+ });
4949
+ return 0;
4950
+ }
4951
+ io.out(`Carry folder trust between Claude accounts: ${st.on ? c.green('on') : c.dim('off')}`);
4952
+ if (!st.on) {
4953
+ io.out(c.dim(what));
4954
+ io.out(c.cyan('Turn it on with `sideby trust on`.'));
4955
+ }
4956
+ else if (st.root) {
4957
+ const where = st.root.kind === 'git'
4958
+ ? `git repository; trust is kept for ${show(st.root.path)}`
4959
+ : st.root.kind === 'folder'
4960
+ ? 'not in a git repository; trust of this folder or a parent folder counts'
4961
+ : `sideby cannot tell (${show(st.root.why)}), so it copies nothing here`;
4962
+ io.out(`Folder: ${show(st.dir)} (${where})`);
4963
+ const width = Math.max(0, ...(st.accounts ?? []).map((x) => x.ref.length));
4964
+ for (const x of st.accounts ?? []) {
4965
+ const state = x.trusts === true
4966
+ ? c.green('trusts it')
4967
+ : x.trusts === false
4968
+ ? `asks${x.carryFrom ? c.dim(` · gets ${x.carryFrom}'s trust when sideby starts it here`) : ''}`
4969
+ : c.dim(`cannot tell${x.problem ? `: ${show(x.problem)}` : ''}`);
4970
+ io.out(` ${x.ref.padEnd(width)} ${state}`);
4971
+ }
4972
+ }
4973
+ if (st.carried.length)
4974
+ io.out(`Copied by sideby: ${st.carried.length} ${st.carried.length === 1 ? 'mark' : 'marks'}${c.dim(' (see or take back with `sideby trust undo`)')}`);
4975
+ if (st.on)
4976
+ io.out(c.dim('Turning it off keeps what was copied; `sideby trust undo` takes it back.'));
4977
+ return 0;
4978
+ }
4835
4979
  /** `sideby unattended …` (spec §3.37, ADR-0058): status, on and off, the Schedule, Pending Decisions and `defer`. */
4836
4980
  export async function cmdUnattended(a, io) {
4837
4981
  const [sub, ...rest] = a.positionals;
@@ -1534,6 +1534,74 @@ export const OUTPUT_SCHEMAS = {
1534
1534
  undo: Type.Optional(Type.String({ description: 'on and off: the command that puts back what was there.' })),
1535
1535
  message: Type.Optional(Type.String({ description: 'on and off: one line for the user.' })),
1536
1536
  }, { title: 'sideby progress [on|off] --json' }),
1537
+ trust: Type.Object({
1538
+ schemaVersion: Version,
1539
+ action: Type.Literal('status'),
1540
+ on: Type.Boolean({
1541
+ description: 'Config `claude.carryTrust` (spec §3.43): before sideby starts an interactive Claude session, an account that does not trust the folder gets the trust another Claude account already gave it.',
1542
+ }),
1543
+ carried: Type.Array(Type.Object({
1544
+ account: Type.String({ description: 'The account that got the trust mark.' }),
1545
+ path: Type.String({ description: 'The folder the mark is for, as sideby wrote it.' }),
1546
+ from: Type.String({ description: 'The account whose trust was copied.' }),
1547
+ at: Type.String({ description: 'When (ISO time).' }),
1548
+ }), { description: 'The marks sideby copied and `sideby trust undo` can take back, oldest first.' }),
1549
+ dir: Type.Optional(Type.String({
1550
+ description: 'The folder asked about (its real path); only while on. Nothing is read while off.',
1551
+ })),
1552
+ root: Type.Optional(Type.Object({
1553
+ kind: Type.Union([Type.Literal('git'), Type.Literal('folder'), Type.Literal('unclear')], {
1554
+ description: '`git`: trust is kept for the main checkout `path`; `folder`: the folder or a parent counts; `unclear`: sideby cannot tell from the files and copies nothing.',
1555
+ }),
1556
+ path: Type.Optional(Type.String()),
1557
+ why: Type.Optional(Type.String({ description: 'With `unclear`: why.' })),
1558
+ }, { description: 'Where Claude Code looks trust up for the folder; only while on.' })),
1559
+ accounts: Type.Optional(Type.Array(Type.Object({
1560
+ ref: Str,
1561
+ trusts: Type.Optional(Type.Boolean({
1562
+ description: 'Whether this account trusts the folder; absent when sideby cannot tell (`problem`).',
1563
+ })),
1564
+ problem: Type.Optional(Type.String({ description: 'Why its .claude.json cannot be read; names the path only.' })),
1565
+ carryFrom: Type.Optional(Type.String({ description: 'Starting this account here copies the trust of this account.' })),
1566
+ }), { description: 'Each Claude account and its trust of the folder (booleans only); only while on.' })),
1567
+ }, { title: 'sideby trust [--dir <path>] --json' }),
1568
+ 'trust-set': Type.Object({
1569
+ schemaVersion: Version,
1570
+ action: Type.Union([Type.Literal('on'), Type.Literal('off')]),
1571
+ on: Type.Boolean({ description: 'Whether config `claude.carryTrust` is on now.' }),
1572
+ changed: Type.Boolean(),
1573
+ applied: Type.Boolean({
1574
+ description: 'False when only the change was shown; run again with --yes (exit 10).',
1575
+ }),
1576
+ before: Type.Boolean(),
1577
+ after: Type.Boolean(),
1578
+ file: Type.String({ description: 'The config file changed.' }),
1579
+ }, { title: 'sideby trust on|off --json' }),
1580
+ 'trust-undo': Type.Object({
1581
+ schemaVersion: Version,
1582
+ action: Type.Literal('undo'),
1583
+ applied: Type.Boolean({
1584
+ description: 'False when only shown (exit 10 when something would be taken back); true with --yes.',
1585
+ }),
1586
+ items: Type.Array(Type.Object({
1587
+ id: Type.String({ description: 'The carry record; the Panel confirms only the ids it showed.' }),
1588
+ account: Str,
1589
+ path: Type.String({ description: 'The folder the mark is for.' }),
1590
+ from: Type.String({ description: 'The account whose trust was copied.' }),
1591
+ at: Type.String({ description: 'When it was copied (ISO time).' }),
1592
+ status: Type.Union([
1593
+ Type.Literal('undo'),
1594
+ Type.Literal('undone'),
1595
+ Type.Literal('changed'),
1596
+ Type.Literal('gone'),
1597
+ Type.Literal('blocked'),
1598
+ Type.Literal('busy'),
1599
+ ], {
1600
+ description: '`undo`: would be taken back; `undone`: taken back; `changed`: the mark changed since sideby wrote it, left alone; `gone`: the file is gone; `blocked`/`busy`: not changed (`why`), kept for another try.',
1601
+ }),
1602
+ why: Type.Optional(Type.String()),
1603
+ })),
1604
+ }, { title: 'sideby trust undo --json' }),
1537
1605
  browser: Type.Object({
1538
1606
  schemaVersion: Version,
1539
1607
  enabled: Type.Boolean({
@@ -406,6 +406,33 @@ Examples:
406
406
  sideby progress on --every 15
407
407
  sideby progress off
408
408
  Exit: 0 shown or done (also when nothing changed); 2 an interval or option it does not take.`,
409
+ trust: `sideby trust [--dir <path>] [--json]
410
+ sideby trust on|off [--yes] [--json]
411
+ sideby trust undo [--yes] [--json]
412
+
413
+ Carry folder trust between Claude accounts. Claude Code asks "Is this a project you created or one you trust?" in
414
+ every account that has not trusted a folder yet, and its default answer ends the session. With this on, before
415
+ sideby starts an interactive Claude session (sideby run, short commands, pick commands, next, Auto Handoff, AI Tasks,
416
+ Unattended Mode), when that account does not trust the folder and another of your Claude accounts does, sideby
417
+ copies that one trust mark into the account's .claude.json, so Claude Code does not ask again. It reuses only trust
418
+ you already gave; it never trusts a folder none of your accounts trusted. Each copy prints one line.
419
+
420
+ Which trust counts, by Claude Code's own rules: in a git repository, the trust of the repository's main checkout (a
421
+ linked worktree uses its main checkout's); elsewhere, the trust of the folder or a parent folder (never your home
422
+ folder or /). When sideby cannot tell from the files (a submodule, a separate git folder), it copies nothing. It never
423
+ runs git in the folder. A headless run (-p) and \`sideby login\` copy nothing.
424
+
425
+ Without a subcommand: whether it is on, the marks sideby copied, and, while on, whether each Claude account trusts
426
+ the folder (--dir, default the current one); nothing of .claude.json is read while it is off. \`on\` and \`off\`
427
+ change config claude.carryTrust; turning it off keeps what was copied. \`undo\` takes the copied marks back, each
428
+ only while it still holds what sideby wrote. Each shows the change first and makes it with --yes.
429
+
430
+ Examples:
431
+ sideby trust on --yes
432
+ sideby trust --dir ~/code/app
433
+ sideby trust undo
434
+ Exit: 0 shown or done; 10 a change was shown and waits for --yes; 1 undo left a mark it could not change (the line
435
+ says why); 2 malformed command line.`,
409
436
  browser: `sideby browser [--enable|--disable] [--yes] [--json]
410
437
  sideby browser open <account> [--profile <folder|name>] [--json]
411
438
  sideby browser set <account> <folder|name> [--json]
@@ -506,6 +533,7 @@ const COMMANDS = {
506
533
  valued: ['for', 'until', 'days', 'from', 'to', 'name', 'at'],
507
534
  },
508
535
  progress: { flags: ['json'], valued: ['every'] },
536
+ trust: { flags: ['json', 'yes'], valued: ['dir'] },
509
537
  new: { flags: ['api', 'json', 'next'], valued: ['alias', 'vendor'] },
510
538
  alias: { flags: ['json', 'yes'], valued: ['pick'] },
511
539
  doctor: { flags: ['fix', 'force', 'json'] },
@@ -841,6 +869,8 @@ async function dispatch(cmd, parsed, io, cmds) {
841
869
  return await cmds.cmdUnattended(parsed, io);
842
870
  case 'progress':
843
871
  return await cmds.cmdProgress(parsed, io);
872
+ case 'trust':
873
+ return await cmds.cmdTrust(parsed, io);
844
874
  case 'shell-init':
845
875
  return await cmds.cmdShellInit(parsed, io);
846
876
  case 'plugins':
@@ -0,0 +1,198 @@
1
+ import type { Account } from '../types.ts';
2
+ /** The one field of a `projects` entry sideby reads or writes. */
3
+ export declare const TRUST_FIELD = "hasTrustDialogAccepted";
4
+ /**
5
+ * The key a Claude Account's trust is looked up by for one folder, by Claude Code's documented rules
6
+ * (https://code.claude.com/docs/en/permissions): inside a git checkout the main checkout's root (`git`, a linked
7
+ * worktree uses its main checkout's), elsewhere the folder or any parent folder (`folder`). `unclear` when sideby
8
+ * cannot tell from the files alone; then nothing counts as trusted and nothing is written.
9
+ */
10
+ export type TrustRoot = {
11
+ kind: 'git';
12
+ folder: string;
13
+ path: string;
14
+ } | {
15
+ kind: 'folder';
16
+ folder: string;
17
+ path: string;
18
+ } | {
19
+ kind: 'unclear';
20
+ folder: string;
21
+ why: string;
22
+ };
23
+ /**
24
+ * Where trust is looked up for `cwd`, from the files alone: walks up from its real path to the first `.git`. A `.git`
25
+ * folder makes that folder the root; a `.git` file must describe a linked worktree exactly (`worktreeMain`). Anything
26
+ * else (a submodule, a separate git folder, a link, a file sideby cannot read) is `unclear`. Without any `.git`, the
27
+ * folder and its parents count.
28
+ */
29
+ export declare function trustRoot(cwd: string): Promise<TrustRoot>;
30
+ /**
31
+ * The keys that make an Account trust the folder, narrowest first: the main checkout root in a git checkout, else the
32
+ * folder and every parent. HOME and a filesystem root never count, as Claude Code does not keep trust for them.
33
+ */
34
+ export declare function trustCandidates(root: TrustRoot, home: string): Promise<string[]>;
35
+ /** What one Account's `.claude.json` says about trust: the keys it trusts, or why it cannot be read. */
36
+ export type TrustRead = {
37
+ status: 'ok';
38
+ keys: Set<string>;
39
+ } | {
40
+ status: 'missing';
41
+ } | {
42
+ status: 'problem';
43
+ why: string;
44
+ };
45
+ /** The keys of `.claude.json` whose `hasTrustDialogAccepted` is `true`; nothing else of the file is kept. */
46
+ export declare function readTrustKeys(file: string): Promise<TrustRead>;
47
+ /** The narrowest key of `candidates` that `read` trusts, or null. Keys compare as written (a real path). */
48
+ export declare function trustedKey(read: TrustRead, candidates: readonly string[]): string | null;
49
+ /** What the field held before sideby set it: no entry for the key, an entry without it, or `false`. */
50
+ export type TrustBefore = 'no-entry' | 'no-field' | 'false';
51
+ /** Internal, for tests: runs between reading the file and writing it, to change it in between. */
52
+ export interface WriteHooks {
53
+ afterRead?: () => Promise<void>;
54
+ }
55
+ /**
56
+ * Sets `projects[key].hasTrustDialogAccepted` to true in `file`, under the rules of Share Mode `json-key`: never
57
+ * through a link, never in a file that is not a JSON object, a `projects` or an entry that is not an object, or a field
58
+ * that is neither absent nor `false`; only that one field (a new entry is `{ "hasTrustDialogAccepted": true }`), every
59
+ * other key and its order and the file's indentation kept; written atomically (mode 600) only while the file still
60
+ * has the hash it was read with. Never creates the file.
61
+ */
62
+ export declare function writeTrust(file: string, key: string, hooks?: WriteHooks): Promise<{
63
+ ok: true;
64
+ before: TrustBefore;
65
+ } | {
66
+ ok: true;
67
+ already: true;
68
+ } | {
69
+ ok: false;
70
+ why: string;
71
+ }>;
72
+ /** One carry sideby made, as its record keeps it (sideby's state folder; never a value of `.claude.json`). */
73
+ export interface TrustCarry {
74
+ version: 1;
75
+ /** The Account that got the mark. */
76
+ account: string;
77
+ /** Its `.claude.json`. */
78
+ file: string;
79
+ /** Where that file really was when sideby wrote it: an undo leaves the mark alone once the path leads elsewhere. */
80
+ real: string;
81
+ /** The `projects` key sideby set the field under (a folder path). */
82
+ key: string;
83
+ before: TrustBefore;
84
+ /** The Account whose trust was copied. */
85
+ from: string;
86
+ at: string;
87
+ }
88
+ /** Every carry sideby recorded, oldest first; a record that cannot be read is left out. */
89
+ export declare function readCarries(stateDir: string): Promise<(TrustCarry & {
90
+ record: string;
91
+ parked?: true;
92
+ })[]>;
93
+ /** How long a carry waits for another sideby change of the same `.claude.json`; mutable for tests only. */
94
+ export declare const trustLockWait: {
95
+ timeoutMs: number;
96
+ pollMs: number;
97
+ };
98
+ export interface TrustContext {
99
+ /** Every Claude Account sideby knows (the Main Account included). */
100
+ accounts: readonly Account[];
101
+ /** Where each Account keeps `.claude.json` (the Family's own rule). */
102
+ jsonOf: (account: Account) => string;
103
+ home: string;
104
+ stateDir: string;
105
+ }
106
+ export type CarryResult =
107
+ /** The folder has no key trust could be carried by (HOME, a root, or sideby cannot tell). */
108
+ {
109
+ status: 'no-root';
110
+ } | {
111
+ status: 'already';
112
+ }
113
+ /** No other Account trusts the folder: nothing to copy, and nothing is created. */
114
+ | {
115
+ status: 'none';
116
+ } | {
117
+ status: 'carried';
118
+ key: string;
119
+ from: string;
120
+ recordProblem?: boolean;
121
+ } | {
122
+ status: 'skipped';
123
+ key: string;
124
+ from: string;
125
+ why: string;
126
+ };
127
+ /**
128
+ * Before `target` starts in `cwd`: when it does not trust the folder and another Claude Account does, copies that
129
+ * Account's matching key into `target`'s `.claude.json` and records the carry. Reads the other Accounts only when the
130
+ * target lacks trust. Never throws for a file it cannot read or write: the answer says why.
131
+ */
132
+ export declare function carryTrust(ctx: TrustContext, target: Account, cwd: string, opts: {
133
+ now: Date;
134
+ hooks?: WriteHooks;
135
+ }): Promise<CarryResult>;
136
+ /** The one line a Launch prints for a carry, or null when there is nothing to say. `show` shortens a path. */
137
+ export declare function carryLine(r: CarryResult, target: string, show: (p: string) => string): string | null;
138
+ /** Each Claude Account's trust of one folder, for `sideby trust`: booleans only, never another `projects` key. */
139
+ export interface TrustAccountState {
140
+ ref: string;
141
+ /** Absent when sideby cannot tell (the folder is unclear, or the file cannot be read: `problem`). */
142
+ trusts?: boolean;
143
+ problem?: string;
144
+ /** With the setting on, the next Launch of this Account here copies this Account's trust. */
145
+ carryFrom?: string;
146
+ }
147
+ export declare function trustStates(ctx: TrustContext, cwd: string): Promise<{
148
+ root: TrustRoot;
149
+ accounts: TrustAccountState[];
150
+ }>;
151
+ export type UndoStatus = 'undo' | 'undone' | 'changed' | 'gone' | 'blocked' | 'busy';
152
+ export interface UndoItem {
153
+ /** The carry's record (its file name without `.json`): what a confirmation names to undo only what it showed. */
154
+ id: string;
155
+ account: string;
156
+ key: string;
157
+ from: string;
158
+ at: string;
159
+ status: UndoStatus;
160
+ why?: string;
161
+ }
162
+ /**
163
+ * `sideby trust undo`: every recorded carry, with what undoing it does (`apply` false) or did. A carry that was undone,
164
+ * or whose field the user changed since or whose file is gone, loses its record; one that is blocked or busy keeps it.
165
+ */
166
+ export declare function undoCarries(stateDir: string, opts: {
167
+ apply: boolean;
168
+ hooks?: WriteHooks;
169
+ /** Only these carries, each as shown (`id` and `at`): one made or carried again since is left for another look. */
170
+ only?: readonly {
171
+ id: string;
172
+ at: string;
173
+ }[];
174
+ }): Promise<UndoItem[]>;
175
+ /** What `sideby trust` and the Panel show (spec §3.43). */
176
+ export interface TrustStatus {
177
+ /** Config `claude.carryTrust`. */
178
+ on: boolean;
179
+ /** The carries sideby recorded and can undo, oldest first. */
180
+ carried: {
181
+ account: string;
182
+ key: string;
183
+ from: string;
184
+ at: string;
185
+ }[];
186
+ /** The folder asked about (its real path), only while on. */
187
+ dir?: string;
188
+ /** Where trust is looked up for it, only while on. */
189
+ root?: {
190
+ kind: TrustRoot['kind'];
191
+ path?: string;
192
+ why?: string;
193
+ };
194
+ /** Each Claude Account's trust of that folder, only while on. */
195
+ accounts?: TrustAccountState[];
196
+ }
197
+ /** `sideby trust` (spec §3.43): never reads a `.claude.json` while the setting is off. */
198
+ export declare function trustStatus(ctx: TrustContext, on: boolean, cwd?: string): Promise<TrustStatus>;