sideby 0.40.1 → 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/dist/build.json +1 -1
- package/dist/src/cli/commands.d.ts +7 -0
- package/dist/src/cli/commands.js +144 -0
- package/dist/src/cli/json-schemas.js +68 -0
- package/dist/src/cli/main.js +30 -0
- package/dist/src/core/claude-trust.d.ts +198 -0
- package/dist/src/core/claude-trust.js +559 -0
- package/dist/src/core/cli-commands.js +14 -2
- package/dist/src/core/config.d.ts +7 -3
- package/dist/src/core/config.js +12 -5
- package/dist/src/core/search-catalog.js +23 -0
- package/dist/src/panel/handler.d.ts +14 -0
- package/dist/src/panel/handler.js +55 -0
- package/dist/src/panel/i18n.d.ts +22 -0
- package/dist/src/panel/i18n.js +44 -0
- package/dist/src/panel/page-script.js +79 -1
- package/dist/src/runtime.d.ts +32 -0
- package/dist/src/runtime.js +74 -1
- package/package.json +1 -1
- package/schemas/config.json +5 -1
- package/schemas/trust-set.json +117 -0
- package/schemas/trust-undo.json +155 -0
- package/schemas/trust.json +183 -0
- package/skills/sideby/SKILL.md +2 -1
- package/skills/sideby/references/trust.md +28 -0
|
@@ -205,6 +205,29 @@ const ENTRIES = [
|
|
|
205
205
|
target: { settings: 'accounts', find: 'advisor' },
|
|
206
206
|
cliCommand: 'sideby advisor',
|
|
207
207
|
},
|
|
208
|
+
{
|
|
209
|
+
id: 'setting.trust',
|
|
210
|
+
kind: 'setting',
|
|
211
|
+
title: { en: 'Folder trust', zh: '文件夹信任' },
|
|
212
|
+
synonyms: [
|
|
213
|
+
'trust',
|
|
214
|
+
'trust this folder',
|
|
215
|
+
'do you trust',
|
|
216
|
+
'quick safety check',
|
|
217
|
+
'accessing workspace',
|
|
218
|
+
'workspace trust',
|
|
219
|
+
'trust dialog',
|
|
220
|
+
'carry trust',
|
|
221
|
+
'信任',
|
|
222
|
+
'信任文件夹',
|
|
223
|
+
'信任此文件夹',
|
|
224
|
+
'安全检查',
|
|
225
|
+
'每次都问信任',
|
|
226
|
+
],
|
|
227
|
+
panel: at(SET, { en: 'Folder trust', zh: '文件夹信任' }),
|
|
228
|
+
target: { settings: 'trust', find: 'trust' },
|
|
229
|
+
cliCommand: 'sideby trust',
|
|
230
|
+
},
|
|
208
231
|
{
|
|
209
232
|
id: 'setting.quota-checks',
|
|
210
233
|
kind: 'setting',
|
|
@@ -304,6 +304,20 @@ export interface PanelState {
|
|
|
304
304
|
unattended?: PanelUnattendedStatus;
|
|
305
305
|
/** Progress Reminders (spec §3.42): on or off, how often, and the choices; absent without Claude Accounts. */
|
|
306
306
|
progress?: ProgressView;
|
|
307
|
+
/**
|
|
308
|
+
* Carried trust (spec §3.43): config `claude.carryTrust` and the marks sideby copied, from sideby's own records (no
|
|
309
|
+
* `.claude.json` is read for it); absent with fewer than two Claude Accounts, unless it is on or has marks.
|
|
310
|
+
*/
|
|
311
|
+
trust?: PanelTrust;
|
|
312
|
+
}
|
|
313
|
+
export interface PanelTrust {
|
|
314
|
+
on: boolean;
|
|
315
|
+
carried: {
|
|
316
|
+
account: string;
|
|
317
|
+
path: string;
|
|
318
|
+
from: string;
|
|
319
|
+
at: string;
|
|
320
|
+
}[];
|
|
307
321
|
}
|
|
308
322
|
/** One Pending Decision as the Panel's Unattended page lists it, with the way back to its Session. */
|
|
309
323
|
export interface PanelPendingDecision extends PendingDecision {
|
|
@@ -650,6 +650,7 @@ async function buildState(rt, opts) {
|
|
|
650
650
|
.catch(() => undefined);
|
|
651
651
|
const showBrowser = browser && (browser.families.matched.length || browser.families.openOnly.length);
|
|
652
652
|
const progress = accounts.some((a) => PROGRESS_FAMILIES.includes(a.family)) ? rt.progressView() : undefined;
|
|
653
|
+
const trust = await panelTrust(rt, accounts).catch(() => undefined);
|
|
653
654
|
const permissions = aiTaskPermissions(rt.config);
|
|
654
655
|
return {
|
|
655
656
|
schemaVersion: 1,
|
|
@@ -698,6 +699,17 @@ async function buildState(rt, opts) {
|
|
|
698
699
|
...(network ? { network } : {}),
|
|
699
700
|
...(unattended ? { unattended } : {}),
|
|
700
701
|
...(progress ? { progress } : {}),
|
|
702
|
+
...(trust ? { trust } : {}),
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
/** The Panel's view of carried trust (spec §3.43), or undefined when there is nothing to show. */
|
|
706
|
+
async function panelTrust(rt, accounts) {
|
|
707
|
+
const st = await rt.trustStatus();
|
|
708
|
+
if (accounts.filter((a) => a.family === 'claude').length < 2 && !st.on && !st.carried.length)
|
|
709
|
+
return undefined;
|
|
710
|
+
return {
|
|
711
|
+
on: st.on,
|
|
712
|
+
carried: st.carried.map(({ key, ...x }) => ({ ...x, path: tildify(key, rt.paths.home) })),
|
|
701
713
|
};
|
|
702
714
|
}
|
|
703
715
|
const SHELL_SAFE = /^[A-Za-z0-9_@%+=:,./-]+$/;
|
|
@@ -1488,6 +1500,49 @@ export function createPanelHandler(opts) {
|
|
|
1488
1500
|
apply: (rt) => rt.remoteControlOn(),
|
|
1489
1501
|
}),
|
|
1490
1502
|
'/api/remote-control/undo': previewedChange({ apply: (rt) => rt.remoteControlUndo() }),
|
|
1503
|
+
// Carried trust (spec §3.43, ADR-0078): config `claude.carryTrust`, shown first like every config change; the
|
|
1504
|
+
// switch sends `confirm` with the words it shows beside it.
|
|
1505
|
+
'/api/trust/settings': {
|
|
1506
|
+
writes: (body) => body.confirm === true,
|
|
1507
|
+
async run(body) {
|
|
1508
|
+
if (typeof body.on !== 'boolean')
|
|
1509
|
+
throw new HttpError(400, '"on" must be true or false');
|
|
1510
|
+
const rt = await getRuntime();
|
|
1511
|
+
const r = await rt.trustSet(body.on, { apply: optBool(body, 'confirm') });
|
|
1512
|
+
return { ...r, file: tildify(r.file, rt.paths.home) };
|
|
1513
|
+
},
|
|
1514
|
+
},
|
|
1515
|
+
// Takes back the trust marks sideby copied (`sideby trust undo`): without `confirm` what it would do, with it done.
|
|
1516
|
+
'/api/trust/undo': {
|
|
1517
|
+
writes: (body) => body.confirm === true,
|
|
1518
|
+
async run(body) {
|
|
1519
|
+
const rt = await getRuntime();
|
|
1520
|
+
// Inside text too: a reason names a path in the middle of a sentence.
|
|
1521
|
+
const show = (p) => p.split(`${rt.paths.home}/`).join('~/');
|
|
1522
|
+
const apply = optBool(body, 'confirm');
|
|
1523
|
+
// A confirmation names the carries the page showed: one made since (a Launch meanwhile) is not taken back unseen.
|
|
1524
|
+
let only;
|
|
1525
|
+
if (apply) {
|
|
1526
|
+
const list = body.items;
|
|
1527
|
+
if (!Array.isArray(list) ||
|
|
1528
|
+
!list.every((x) => x &&
|
|
1529
|
+
typeof x === 'object' &&
|
|
1530
|
+
typeof x.id === 'string' &&
|
|
1531
|
+
/^[0-9a-f]{32}$/.test(x.id) &&
|
|
1532
|
+
typeof x.at === 'string'))
|
|
1533
|
+
throw new HttpError(400, '"items" must list the shown carries as { id, at }; review the list again');
|
|
1534
|
+
only = list.map((x) => ({ id: x.id, at: x.at }));
|
|
1535
|
+
}
|
|
1536
|
+
const items = await rt.trustUndo({ apply, ...(only ? { only } : {}) });
|
|
1537
|
+
return {
|
|
1538
|
+
items: items.map(({ key, why, ...x }) => ({
|
|
1539
|
+
...x,
|
|
1540
|
+
path: show(key),
|
|
1541
|
+
...(why ? { why: show(why) } : {}),
|
|
1542
|
+
})),
|
|
1543
|
+
};
|
|
1544
|
+
},
|
|
1545
|
+
},
|
|
1491
1546
|
// Claude Code's advisor (spec §3.41, ADR-0074): the same change as `sideby advisor <model>|off [--account]`. It
|
|
1492
1547
|
// writes `advisorModel` only into the files the page showed (`previewedChange`); a model also turns config
|
|
1493
1548
|
// `advisor.unlock` on, and config `claude.apiBetasOff` where the variable leaves a file API Accounts share, both
|
package/dist/src/panel/i18n.d.ts
CHANGED
|
@@ -1774,6 +1774,28 @@ declare const en: {
|
|
|
1774
1774
|
'pr.everyToast': string;
|
|
1775
1775
|
'pr.offToast': string;
|
|
1776
1776
|
'pr.failed': string;
|
|
1777
|
+
'ai.ask.trust': string;
|
|
1778
|
+
'tr.title': string;
|
|
1779
|
+
'tr.hint': string;
|
|
1780
|
+
'tr.switch': string;
|
|
1781
|
+
'tr.what': string;
|
|
1782
|
+
'tr.only': string;
|
|
1783
|
+
'tr.offKeeps': string;
|
|
1784
|
+
'tr.carried.one': string;
|
|
1785
|
+
'tr.carried.other': string;
|
|
1786
|
+
'tr.review': string;
|
|
1787
|
+
'tr.undoIntro': string;
|
|
1788
|
+
'tr.undoRow': string;
|
|
1789
|
+
'tr.changed': string;
|
|
1790
|
+
'tr.gone': string;
|
|
1791
|
+
'tr.remove': string;
|
|
1792
|
+
'tr.nothing': string;
|
|
1793
|
+
'tr.removed.one': string;
|
|
1794
|
+
'tr.removed.other': string;
|
|
1795
|
+
'tr.notRemoved': string;
|
|
1796
|
+
'tr.onToast': string;
|
|
1797
|
+
'tr.offToast': string;
|
|
1798
|
+
'tr.failed': string;
|
|
1777
1799
|
};
|
|
1778
1800
|
export type MessageKey = keyof typeof en;
|
|
1779
1801
|
export declare const MESSAGES: Record<PanelLang, Record<string, string>>;
|
package/dist/src/panel/i18n.js
CHANGED
|
@@ -1776,6 +1776,28 @@ const en = {
|
|
|
1776
1776
|
'pr.everyToast': 'Progress updates now every {n} minutes.',
|
|
1777
1777
|
'pr.offToast': 'Progress updates off.',
|
|
1778
1778
|
'pr.failed': 'Could not change progress updates: {msg}. It is back as it was; try again, or run sideby progress in a terminal.',
|
|
1779
|
+
'ai.ask.trust': 'Stop Claude asking whether I trust a folder in one account when another of my accounts already trusts it.',
|
|
1780
|
+
'tr.title': 'Folder trust',
|
|
1781
|
+
'tr.hint': 'Claude Code asks each account once whether you trust a folder, and pressing Enter at that question ends the session. sideby can reuse the answer you already gave in another account.',
|
|
1782
|
+
'tr.switch': 'Reuse trust from my other Claude accounts',
|
|
1783
|
+
'tr.what': 'Before sideby starts a Claude session in a folder this account has not trusted yet, it copies the trust another of your Claude accounts already gave that folder, so Claude Code does not ask again.',
|
|
1784
|
+
'tr.only': 'It only reuses trust you already gave. A folder none of your accounts trusted still asks, as before.',
|
|
1785
|
+
'tr.offKeeps': 'Turning it off keeps the trust already copied; you can take it back here.',
|
|
1786
|
+
'tr.carried.one': 'sideby copied trust once',
|
|
1787
|
+
'tr.carried.other': 'sideby copied trust {n} times',
|
|
1788
|
+
'tr.review': 'Review',
|
|
1789
|
+
'tr.undoIntro': 'Removing these makes Claude Code ask again in these folders:',
|
|
1790
|
+
'tr.undoRow': '{account} · {path} · from {from}',
|
|
1791
|
+
'tr.changed': 'changed since; left as it is',
|
|
1792
|
+
'tr.gone': 'its file is gone',
|
|
1793
|
+
'tr.remove': 'Remove',
|
|
1794
|
+
'tr.nothing': 'Nothing left to remove: each one changed since sideby copied it.',
|
|
1795
|
+
'tr.removed.one': 'Removed 1 copied trust.',
|
|
1796
|
+
'tr.removed.other': 'Removed {n} copied trusts.',
|
|
1797
|
+
'tr.notRemoved': 'Some could not be changed: {msg}',
|
|
1798
|
+
'tr.onToast': 'Folder trust is reused now. Claude accounts sideby starts no longer ask where another account trusts the folder.',
|
|
1799
|
+
'tr.offToast': 'Folder trust is no longer reused. What was copied stays.',
|
|
1800
|
+
'tr.failed': 'Could not change folder trust: {msg}. Try again, or run sideby trust in a terminal.',
|
|
1779
1801
|
};
|
|
1780
1802
|
const zh = {
|
|
1781
1803
|
'top.tagline': '所有 AI 编程账号,并排运行。',
|
|
@@ -3552,5 +3574,27 @@ const zh = {
|
|
|
3552
3574
|
'pr.everyToast': '进度提醒改为每 {n} 分钟一次。',
|
|
3553
3575
|
'pr.offToast': '已关闭进度提醒。',
|
|
3554
3576
|
'pr.failed': '没能改进度提醒:{msg}。已恢复原样;可以再试一次,或在终端运行 sideby progress。',
|
|
3577
|
+
'ai.ask.trust': '我的一个 Claude 账号已经信任过的文件夹,别让其他账号再问我信不信任。',
|
|
3578
|
+
'tr.title': '文件夹信任',
|
|
3579
|
+
'tr.hint': 'Claude Code 会在每个账号里问一次你是否信任某个文件夹,在这个问题上直接按回车会结束会话。sideby 可以沿用你在另一个账号里已经给过的回答。',
|
|
3580
|
+
'tr.switch': '沿用我其他 Claude 账号的信任',
|
|
3581
|
+
'tr.what': 'sideby 在某个账号还没信任过的文件夹里启动 Claude 会话前,把你另一个 Claude 账号对这个文件夹的信任复制过来,Claude Code 就不会再问。',
|
|
3582
|
+
'tr.only': '只沿用你已经给过的信任。你哪个账号都没信任过的文件夹,照样会问。',
|
|
3583
|
+
'tr.offKeeps': '关掉后,已经复制的信任会保留;可以在这里撤回。',
|
|
3584
|
+
'tr.carried.one': 'sideby 复制过 1 次信任',
|
|
3585
|
+
'tr.carried.other': 'sideby 复制过 {n} 次信任',
|
|
3586
|
+
'tr.review': '查看',
|
|
3587
|
+
'tr.undoIntro': '移除后,Claude Code 会在这些文件夹里重新询问:',
|
|
3588
|
+
'tr.undoRow': '{account} · {path} · 来自 {from}',
|
|
3589
|
+
'tr.changed': '之后改过,保持原样',
|
|
3590
|
+
'tr.gone': '文件已不在',
|
|
3591
|
+
'tr.remove': '移除',
|
|
3592
|
+
'tr.nothing': '没有可移除的:每一条在复制后都改过。',
|
|
3593
|
+
'tr.removed.one': '已移除 1 条复制的信任。',
|
|
3594
|
+
'tr.removed.other': '已移除 {n} 条复制的信任。',
|
|
3595
|
+
'tr.notRemoved': '有几条没能改:{msg}',
|
|
3596
|
+
'tr.onToast': '已开始沿用文件夹信任。sideby 启动的 Claude 账号,在别的账号信任过的文件夹里不再询问。',
|
|
3597
|
+
'tr.offToast': '已不再沿用文件夹信任。已经复制的保留。',
|
|
3598
|
+
'tr.failed': '没能改文件夹信任:{msg}。可以再试一次,或在终端运行 sideby trust。',
|
|
3555
3599
|
};
|
|
3556
3600
|
export const MESSAGES = { en, zh };
|
|
@@ -7059,6 +7059,82 @@ const MAIN = String.raw `
|
|
|
7059
7059
|
out.push(h('p', { class: 'small' }, h('button', { class: 'link-btn small', type: 'button', 'data-key': 'pr-ask', onclick: () => openAsk({ text: t('ai.ask.progress') }) }, t('adv.ask'))))
|
|
7060
7060
|
return out
|
|
7061
7061
|
}
|
|
7062
|
+
// Carried trust (spec §3.43, ADR-0078): the switch writes config claude.carryTrust at once (the words beside it say
|
|
7063
|
+
// what it does) and the toast offers the way back. The trust sideby copied is listed behind Review, read from
|
|
7064
|
+
// sideby's own records, and goes only after the list is shown and Remove is pressed.
|
|
7065
|
+
const tu = { open: false, busy: false, items: null, error: null }
|
|
7066
|
+
async function setTrust(on) {
|
|
7067
|
+
const tr = S.state && S.state.trust
|
|
7068
|
+
if (!tr) return
|
|
7069
|
+
const was = tr.on
|
|
7070
|
+
S.state.trust = Object.assign({}, tr, { on })
|
|
7071
|
+
refreshSettings()
|
|
7072
|
+
try {
|
|
7073
|
+
await api('/api/trust/settings', { on, confirm: true })
|
|
7074
|
+
toast(t(on ? 'tr.onToast' : 'tr.offToast'), { kind: 'ok', action: { label: t('toast.undo'), run: () => setTrust(was) }, duration: 8000 })
|
|
7075
|
+
} catch (e) {
|
|
7076
|
+
S.state.trust = Object.assign({}, S.state.trust, { on: was })
|
|
7077
|
+
refreshSettings()
|
|
7078
|
+
toast(t('tr.failed', { msg: e.message }), { kind: 'fail' })
|
|
7079
|
+
}
|
|
7080
|
+
load({ silent: true })
|
|
7081
|
+
}
|
|
7082
|
+
// The list is read before it opens, so it opens at its full size.
|
|
7083
|
+
async function trustReview() {
|
|
7084
|
+
if (tu.open) { tu.open = false; refreshSettings(); return }
|
|
7085
|
+
if (tu.busy) return
|
|
7086
|
+
Object.assign(tu, { busy: true, items: null, error: null })
|
|
7087
|
+
refreshSettings()
|
|
7088
|
+
try { tu.items = (await api('/api/trust/undo', {})).items } catch (e) { tu.error = e.message }
|
|
7089
|
+
Object.assign(tu, { busy: false, open: true })
|
|
7090
|
+
refreshSettings()
|
|
7091
|
+
}
|
|
7092
|
+
async function trustRemove() {
|
|
7093
|
+
tu.busy = true
|
|
7094
|
+
refreshSettings()
|
|
7095
|
+
try {
|
|
7096
|
+
const shown = (tu.items || []).map((x) => ({ id: x.id, at: x.at }))
|
|
7097
|
+
const items = (await api('/api/trust/undo', { confirm: true, items: shown })).items
|
|
7098
|
+
const done = items.filter((x) => x.status === 'undone').length
|
|
7099
|
+
const stuck = items.filter((x) => x.status === 'blocked' || x.status === 'busy')
|
|
7100
|
+
if (stuck.length) toast(t('tr.notRemoved', { msg: stuck.map((x) => x.why || x.path).join('; ') }), { kind: 'fail' })
|
|
7101
|
+
else toast(tn('tr.removed', done))
|
|
7102
|
+
Object.assign(tu, { open: false, items: null })
|
|
7103
|
+
} catch (e) { toast(t('tr.notRemoved', { msg: e.message }), { kind: 'fail' }) }
|
|
7104
|
+
tu.busy = false
|
|
7105
|
+
refreshSettings()
|
|
7106
|
+
load({ silent: true })
|
|
7107
|
+
}
|
|
7108
|
+
function trustItems() {
|
|
7109
|
+
const tr = S.state.trust
|
|
7110
|
+
const label = t('tr.switch')
|
|
7111
|
+
const out = [fm('trust', h('div', { class: 'set-row', 'data-patch': '' },
|
|
7112
|
+
h('span', { class: 'set-label' }, label),
|
|
7113
|
+
BOOT.readOnly ? h('span', { class: 'chip chip-sm' + (tr.on ? ' chip-ok' : '') }, tr.on ? t('ah.on') : t('ah.off'))
|
|
7114
|
+
: h('div', { class: 'seg', role: 'group', 'aria-label': label, 'data-patch': '' }, [[true, t('ah.on')], [false, t('ah.off')]].map(([v, text]) =>
|
|
7115
|
+
h('button', { class: 'seg-btn', type: 'button', 'aria-pressed': String(v === tr.on), onclick: () => { if (v !== tr.on) setTrust(v) } }, text)))))]
|
|
7116
|
+
out.push(h('ul', { class: 'pr-notes' }, h('li', null, t('tr.what')), h('li', null, t('tr.only')), h('li', null, t('tr.offKeeps'))))
|
|
7117
|
+
if (tr.carried.length) {
|
|
7118
|
+
out.push(h('div', { class: 'set-row', 'data-patch': '' },
|
|
7119
|
+
h('span', { class: 'set-label' }, tn('tr.carried', tr.carried.length)),
|
|
7120
|
+
BOOT.readOnly ? null : h('button', { class: 'link-btn small', type: 'button', 'aria-expanded': String(tu.open), 'aria-busy': tu.busy && !tu.open ? 'true' : null, 'data-key': 'tr-review', onclick: trustReview }, t('tr.review'))))
|
|
7121
|
+
const items = tu.items || []
|
|
7122
|
+
const todo = items.filter((x) => x.status === 'undo')
|
|
7123
|
+
const body = tu.error ? [h('p', { class: 'small' }, t('tr.notRemoved', { msg: tu.error }))]
|
|
7124
|
+
: [h('p', { class: 'small' }, todo.length ? t('tr.undoIntro') : t('tr.nothing')),
|
|
7125
|
+
h('ul', { class: 'pr-notes' }, items.map((x) => h('li', null, t('tr.undoRow', { account: x.account, path: x.path, from: x.from }),
|
|
7126
|
+
x.status === 'undo' ? null : h('span', { class: 'muted' }, ' · ', t(x.status === 'gone' ? 'tr.gone' : x.status === 'changed' ? 'tr.changed' : 'tr.notRemoved', { msg: x.why || '' }))))),
|
|
7127
|
+
h('div', { class: 'row-actions', 'data-patch': '' },
|
|
7128
|
+
h('button', { class: 'btn btn-sm', type: 'button', disabled: tu.busy || !todo.length, 'aria-busy': tu.busy ? 'true' : null, onclick: trustRemove }, t('tr.remove')),
|
|
7129
|
+
h('button', { class: 'link-btn small', type: 'button', disabled: tu.busy, onclick: trustReview }, t('btn.cancel')))]
|
|
7130
|
+
if (!BOOT.readOnly)
|
|
7131
|
+
out.push(h('div', { class: 'reveal' + (tu.open ? ' is-open' : ''), 'data-patch': '', 'data-key': 'tr-undo', inert: tu.open ? undefined : true },
|
|
7132
|
+
h('div', { class: 'reveal-in', 'data-patch': '' }, body)))
|
|
7133
|
+
}
|
|
7134
|
+
if (!BOOT.readOnly && !askBridged(BOOT, window))
|
|
7135
|
+
out.push(h('p', { class: 'small' }, h('button', { class: 'link-btn small', type: 'button', 'data-key': 'tr-ask', onclick: () => openAsk({ text: t('ai.ask.trust') }) }, t('adv.ask'))))
|
|
7136
|
+
return out
|
|
7137
|
+
}
|
|
7062
7138
|
function famTitleOf(fam) { const f = S.state && S.state.families.find((x) => x.id === fam); return f ? f.title : fam }
|
|
7063
7139
|
// ---------- settings ----------
|
|
7064
7140
|
// One header button holds what is set once and rarely changed: language, theme, Remote Control and Auto Handoff.
|
|
@@ -7076,6 +7152,7 @@ const MAIN = String.raw `
|
|
|
7076
7152
|
if (S.state && (S.state.quotaChecks || []).length) out.push('checks')
|
|
7077
7153
|
if (S.state && S.state.network) out.push('net')
|
|
7078
7154
|
if (S.state && S.state.progress) out.push('progress')
|
|
7155
|
+
if (S.state && S.state.trust) out.push('trust')
|
|
7079
7156
|
return out
|
|
7080
7157
|
}
|
|
7081
7158
|
function renderSettingsButton() {
|
|
@@ -7190,6 +7267,7 @@ const MAIN = String.raw `
|
|
|
7190
7267
|
{ id: 'quota', title: t('set.g.quota'), items: checks, foot: t('set.quotaChecksHint', { n: every }) },
|
|
7191
7268
|
{ id: 'handoff', title: t('ah.button'), items: [ahLink(leave)].filter(Boolean), foot: t('set.ahHint') },
|
|
7192
7269
|
{ id: 'progress', title: t('pr.title'), items: secs.includes('progress') ? progressItems() : [], foot: t('pr.hint') },
|
|
7270
|
+
{ id: 'trust', title: t('tr.title'), items: secs.includes('trust') ? trustItems() : [], foot: t('tr.hint') },
|
|
7193
7271
|
{ id: 'network', title: t('net.title'), items: netItems, foot: t('net.hint') },
|
|
7194
7272
|
{ id: 'ai', title: t('set.g.ai'), items: ai, foot: t('set.aiHint') },
|
|
7195
7273
|
].filter((g) => g.items.length)
|
|
@@ -7891,7 +7969,7 @@ const MAIN = String.raw `
|
|
|
7891
7969
|
return Boolean(u && u.skillUpdate && u.skillUpdate.installed && u.skillUpdate.installed.length)
|
|
7892
7970
|
}
|
|
7893
7971
|
// Example phrases: a click puts one in the Let AI do it box (spec §3.28).
|
|
7894
|
-
const AI_ASKS = ['ai.ask.quota', 'ai.ask.reset', 'ai.ask.pick', 'ai.ask.new', 'ai.ask.api', 'ai.ask.pin', 'ai.ask.hide', 'ai.ask.relogin', 'ai.ask.expired', 'ai.ask.fix', 'ai.ask.handoff', 'ai.ask.handoffRules', 'ai.ask.session', 'ai.ask.history', 'ai.ask.send', 'ai.ask.inbound', 'ai.ask.menubar', 'ai.ask.rc', 'ai.ask.advisor', 'ai.ask.network', 'ai.ask.unattended', 'ai.ask.progress', 'ai.ask.theme', 'ai.ask.find', 'ai.ask.commands', 'ai.ask.tool']
|
|
7972
|
+
const AI_ASKS = ['ai.ask.quota', 'ai.ask.reset', 'ai.ask.pick', 'ai.ask.new', 'ai.ask.api', 'ai.ask.pin', 'ai.ask.hide', 'ai.ask.relogin', 'ai.ask.expired', 'ai.ask.fix', 'ai.ask.handoff', 'ai.ask.handoffRules', 'ai.ask.session', 'ai.ask.history', 'ai.ask.send', 'ai.ask.inbound', 'ai.ask.menubar', 'ai.ask.rc', 'ai.ask.advisor', 'ai.ask.trust', 'ai.ask.network', 'ai.ask.unattended', 'ai.ask.progress', 'ai.ask.theme', 'ai.ask.find', 'ai.ask.commands', 'ai.ask.tool']
|
|
7895
7973
|
// Network Guard (spec §3.35): one dialog with the switch, the allowed countries and the newest result per address.
|
|
7896
7974
|
// Countries are never ticked for the user, the current one included: a wrong network would allow itself.
|
|
7897
7975
|
const NET_COMMON = ['US', 'JP', 'SG', 'GB', 'DE', 'FR', 'NL', 'CA', 'AU', 'KR', 'TW', 'HK']
|
package/dist/src/runtime.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type AccountRefError } from './core/accounts.ts';
|
|
2
2
|
import { type AdvisorChange, type AdvisorChoice, type AdvisorSeen, type AdvisorStatus } from './core/advisor.ts';
|
|
3
|
+
import { type TrustStatus, type UndoItem } from './core/claude-trust.ts';
|
|
3
4
|
import { type Config, type DisplayConfig, type HandoffSettings } from './core/config.ts';
|
|
4
5
|
import { type CreateResult } from './core/create.ts';
|
|
5
6
|
import { type DesktopDeps } from './core/desktop-app.ts';
|
|
@@ -450,6 +451,29 @@ export interface Runtime {
|
|
|
450
451
|
unlock: boolean;
|
|
451
452
|
message: string;
|
|
452
453
|
}>;
|
|
454
|
+
/**
|
|
455
|
+
* Carried trust (spec §3.43, ADR-0078): config `claude.carryTrust` and the carries sideby recorded; with `dir` while
|
|
456
|
+
* it is on, each Claude Account's trust of that folder (booleans only). While it is off no `.claude.json` is read.
|
|
457
|
+
*/
|
|
458
|
+
trustStatus(dir?: string): Promise<TrustStatus>;
|
|
459
|
+
/** Turns config `claude.carryTrust` on or off; without `apply`, only says what would change. */
|
|
460
|
+
trustSet(on: boolean, opts: {
|
|
461
|
+
apply: boolean;
|
|
462
|
+
}): Promise<{
|
|
463
|
+
changed: boolean;
|
|
464
|
+
applied: boolean;
|
|
465
|
+
before: boolean;
|
|
466
|
+
after: boolean;
|
|
467
|
+
file: string;
|
|
468
|
+
}>;
|
|
469
|
+
/** Takes back the trust marks sideby copied, only where each still holds what sideby wrote; `apply` false previews. */
|
|
470
|
+
trustUndo(opts: {
|
|
471
|
+
apply: boolean;
|
|
472
|
+
only?: readonly {
|
|
473
|
+
id: string;
|
|
474
|
+
at: string;
|
|
475
|
+
}[];
|
|
476
|
+
}): Promise<UndoItem[]>;
|
|
453
477
|
/**
|
|
454
478
|
* Which Account of a Family to move on to (spec §3.13), for a start the user asks for: past the Takeover Limit it
|
|
455
479
|
* falls back to the least used Account under 100% (`tight`). Throws a UserError with code `no-quota-source`
|
|
@@ -513,4 +537,12 @@ export declare function createRuntime(opts?: {
|
|
|
513
537
|
limitReset?: {
|
|
514
538
|
timeoutMs?: number;
|
|
515
539
|
};
|
|
540
|
+
/**
|
|
541
|
+
* Internal, for tests: the folder a Launch starts in (the Host inherits sideby's own) and where a carry's line goes
|
|
542
|
+
* (spec §3.43). Omitted, `process.cwd()` and stderr. Not part of the plugin or Portal contract.
|
|
543
|
+
*/
|
|
544
|
+
trust?: {
|
|
545
|
+
cwd?: () => string;
|
|
546
|
+
print?: (line: string) => void;
|
|
547
|
+
};
|
|
516
548
|
}): Promise<Runtime>;
|
package/dist/src/runtime.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// The one service layer the CLI and the Panel share. Frozen contract for v0.1 (plan: 审核修订).
|
|
2
2
|
import { aliasesByAccount, discoverAccounts, resolveRef, startArgsOf, } from './core/accounts.js';
|
|
3
3
|
import { advisorStatus, checkAdvisorAccount, setAdvisor, setAdvisorUnlock, undoAdvisor, } from './core/advisor.js';
|
|
4
|
-
import {
|
|
4
|
+
import { carryLine, carryTrust, trustStatus, undoCarries, } from './core/claude-trust.js';
|
|
5
|
+
import { addConfigAlias, addConfigPickCommand, aiTaskPermissions, aliasAccount, aliasArgs, aliasProblem, aliasRefs, editConfigClaude, editConfigDisplay, editConfigQuotaCheck, handoffSettings, loadConfig, removeConfigAlias, removeConfigPickCommand, } from './core/config.js';
|
|
5
6
|
import { createAccount } from './core/create.js';
|
|
6
7
|
import { bindDesktopDeps, checkAppData } from './core/desktop-app.js';
|
|
7
8
|
import { applyFixes, runDoctor } from './core/doctor.js';
|
|
@@ -39,6 +40,7 @@ import { codexUnattendedTrustLine, UNATTENDED_FAMILIES, unattendedFamilyLine, un
|
|
|
39
40
|
import { UNATTENDED_ENV } from './core/unattended-state.js';
|
|
40
41
|
import { inCi } from './core/update.js';
|
|
41
42
|
import { packageVersion } from './core/version.js';
|
|
43
|
+
import { claudeJsonOf } from './families/claude/index.js';
|
|
42
44
|
import { withClaudeMod } from './families/claude/mod.js';
|
|
43
45
|
import { BUILTIN_PLUGINS } from './families/index.js';
|
|
44
46
|
import { LOGIN_KEY_READERS } from './families/login-keys.js';
|
|
@@ -94,6 +96,32 @@ export async function createRuntime(opts = {}) {
|
|
|
94
96
|
const categories = loaded.categories && categoryReader(loaded.categories.def, loaded.categories.owner);
|
|
95
97
|
const ignore = new Set(config.ignore ?? []);
|
|
96
98
|
const now = opts.now ?? (() => new Date());
|
|
99
|
+
/** Where trust is read and written (spec §3.43): every Claude Account sideby knows, by the Family's own path rule. */
|
|
100
|
+
const trustCtx = (all) => ({
|
|
101
|
+
accounts: all.filter((a) => a.family === 'claude'),
|
|
102
|
+
jsonOf: claudeJsonOf,
|
|
103
|
+
home: paths.home,
|
|
104
|
+
stateDir: paths.stateDir,
|
|
105
|
+
});
|
|
106
|
+
const printTrust = opts.trust?.print ?? ((line) => void process.stderr.write(`sideby: ${line}\n`));
|
|
107
|
+
/**
|
|
108
|
+
* Config `claude.carryTrust` on a Claude session about to start (spec §3.43, ADR-0078): copies another Account's trust
|
|
109
|
+
* of the folder when this one has none. Printed at once, not as a notice: Auto Handoff may prepare a Launch twice.
|
|
110
|
+
* Nothing it meets stops the Launch.
|
|
111
|
+
*/
|
|
112
|
+
const carryAtLaunch = async (target, all) => {
|
|
113
|
+
// Inside text too: a reason names a path in the middle of a sentence.
|
|
114
|
+
const show = (p) => p.split(`${paths.home}/`).join('~/');
|
|
115
|
+
try {
|
|
116
|
+
const r = await carryTrust(trustCtx(all), target, opts.trust?.cwd?.() ?? process.cwd(), { now: now() });
|
|
117
|
+
const line = carryLine(r, target.ref, show);
|
|
118
|
+
if (line)
|
|
119
|
+
printTrust(line);
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
printTrust(`could not carry folder trust to ${target.ref}: ${show(err.message)}. Claude Code will ask whether you trust this folder`);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
97
125
|
/** Adds lines to what a Launch prints before it starts. */
|
|
98
126
|
const addNotice = (p, lines) => {
|
|
99
127
|
const notice = [p.notice, ...lines].filter(Boolean).join('\n');
|
|
@@ -1057,6 +1085,12 @@ export async function createRuntime(opts = {}) {
|
|
|
1057
1085
|
// Network Guard (spec §3.35) and Unattended Mode (§3.37): last, on the environment the Host gets, so the check
|
|
1058
1086
|
// takes the Host's route.
|
|
1059
1087
|
await sessionReady(p, command === 'run', opts);
|
|
1088
|
+
// Carried trust (spec §3.43): only once nothing refused the Launch, for a session a person works in.
|
|
1089
|
+
if (command === 'run' &&
|
|
1090
|
+
p.family.id === 'claude' &&
|
|
1091
|
+
config.claude?.carryTrust === true &&
|
|
1092
|
+
!claudeHeadless(p.args))
|
|
1093
|
+
await carryAtLaunch(p.account, all);
|
|
1060
1094
|
return p;
|
|
1061
1095
|
},
|
|
1062
1096
|
async unattendedStatus() {
|
|
@@ -1561,6 +1595,30 @@ export async function createRuntime(opts = {}) {
|
|
|
1561
1595
|
await reloadAdvisorConfig();
|
|
1562
1596
|
return r;
|
|
1563
1597
|
},
|
|
1598
|
+
async trustStatus(dir) {
|
|
1599
|
+
const fresh = await loadConfig(paths.configFile).catch(() => null);
|
|
1600
|
+
if (fresh)
|
|
1601
|
+
config.claude = fresh.claude;
|
|
1602
|
+
return trustStatus(trustCtx(await accounts()), config.claude?.carryTrust === true, dir);
|
|
1603
|
+
},
|
|
1604
|
+
async trustSet(on, o) {
|
|
1605
|
+
const r = await editConfigClaude(paths.configFile, (c) => {
|
|
1606
|
+
if (on)
|
|
1607
|
+
return { ...c, carryTrust: true };
|
|
1608
|
+
const { carryTrust: _drop, ...rest } = c;
|
|
1609
|
+
return Object.keys(rest).length ? rest : undefined;
|
|
1610
|
+
}, { dryRun: !o.apply });
|
|
1611
|
+
if (o.apply && r.changed)
|
|
1612
|
+
config.claude = r.after;
|
|
1613
|
+
return {
|
|
1614
|
+
changed: r.changed,
|
|
1615
|
+
applied: o.apply && r.changed,
|
|
1616
|
+
before: r.before?.carryTrust === true,
|
|
1617
|
+
after: r.after?.carryTrust === true,
|
|
1618
|
+
file: paths.configFile,
|
|
1619
|
+
};
|
|
1620
|
+
},
|
|
1621
|
+
trustUndo: (o) => undoCarries(paths.stateDir, { apply: o.apply, ...(o.only ? { only: o.only } : {}) }),
|
|
1564
1622
|
async advisorUnlock(on) {
|
|
1565
1623
|
const r = await setAdvisorUnlock(paths.configFile, on);
|
|
1566
1624
|
await reloadAdvisorConfig();
|
|
@@ -1699,3 +1757,18 @@ export async function createRuntime(opts = {}) {
|
|
|
1699
1757
|
bindDesktopDeps(rt, opts.desktop);
|
|
1700
1758
|
return rt;
|
|
1701
1759
|
}
|
|
1760
|
+
/**
|
|
1761
|
+
* Whether Claude's arguments ask for a headless run: `-p`/`--print`, also inside a group of short flags such as `-cp`
|
|
1762
|
+
* (Claude Code's option parser reads `-cp` as `-c -p`). Before the first `--` only.
|
|
1763
|
+
*/
|
|
1764
|
+
function claudeHeadless(args) {
|
|
1765
|
+
if (hasOption(args, ['-p', '--print']))
|
|
1766
|
+
return true;
|
|
1767
|
+
for (const a of args) {
|
|
1768
|
+
if (a === '--')
|
|
1769
|
+
return false;
|
|
1770
|
+
if (/^-[A-Za-z]{2,}$/.test(a) && a.includes('p'))
|
|
1771
|
+
return true;
|
|
1772
|
+
}
|
|
1773
|
+
return false;
|
|
1774
|
+
}
|
package/package.json
CHANGED
package/schemas/config.json
CHANGED
|
@@ -424,10 +424,14 @@
|
|
|
424
424
|
"apiBetasOff": {
|
|
425
425
|
"type": "boolean",
|
|
426
426
|
"description": "Give Claude API accounts `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` when sideby starts them, for gateways that reject Claude Code's `anthropic-beta` headers. The account's own proxy.env and a value already in the environment win. Off by default; `sideby advisor <model>` turns it on when it removes that variable from a settings file API accounts share."
|
|
427
|
+
},
|
|
428
|
+
"carryTrust": {
|
|
429
|
+
"type": "boolean",
|
|
430
|
+
"description": "Carry folder trust between Claude accounts (spec §3.43, ADR-0078): before sideby starts an interactive Claude session in a folder this account has not trusted yet, when another Claude account of yours already trusts it (the folder, a parent folder outside any git repository, or the repository's main checkout), sideby copies that one trust mark (`projects[\"<path>\"].hasTrustDialogAccepted`) into this account's `.claude.json`, so Claude Code does not ask again. It never adds trust no account gave. Off by default; turning it off does not remove marks already copied (`sideby trust undo` does)."
|
|
427
431
|
}
|
|
428
432
|
},
|
|
429
433
|
"additionalProperties": false,
|
|
430
|
-
"description": "Claude Code launches (spec §3.41, ADR-0074)."
|
|
434
|
+
"description": "Claude Code launches (spec §3.41, ADR-0074; `carryTrust`: spec §3.43, ADR-0078)."
|
|
431
435
|
},
|
|
432
436
|
"unattended": {
|
|
433
437
|
"type": "object",
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "sideby/trust-set.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": [
|
|
6
|
+
"schemaVersion",
|
|
7
|
+
"action",
|
|
8
|
+
"on",
|
|
9
|
+
"changed",
|
|
10
|
+
"applied",
|
|
11
|
+
"before",
|
|
12
|
+
"after",
|
|
13
|
+
"file"
|
|
14
|
+
],
|
|
15
|
+
"properties": {
|
|
16
|
+
"schemaVersion": {
|
|
17
|
+
"type": "number",
|
|
18
|
+
"const": 1
|
|
19
|
+
},
|
|
20
|
+
"action": {
|
|
21
|
+
"anyOf": [
|
|
22
|
+
{
|
|
23
|
+
"type": "string",
|
|
24
|
+
"const": "on"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"type": "string",
|
|
28
|
+
"const": "off"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"on": {
|
|
33
|
+
"type": "boolean",
|
|
34
|
+
"description": "Whether config `claude.carryTrust` is on now."
|
|
35
|
+
},
|
|
36
|
+
"changed": {
|
|
37
|
+
"type": "boolean"
|
|
38
|
+
},
|
|
39
|
+
"applied": {
|
|
40
|
+
"type": "boolean",
|
|
41
|
+
"description": "False when only the change was shown; run again with --yes (exit 10)."
|
|
42
|
+
},
|
|
43
|
+
"before": {
|
|
44
|
+
"type": "boolean"
|
|
45
|
+
},
|
|
46
|
+
"after": {
|
|
47
|
+
"type": "boolean"
|
|
48
|
+
},
|
|
49
|
+
"file": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"description": "The config file changed."
|
|
52
|
+
},
|
|
53
|
+
"_notice": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"properties": {
|
|
56
|
+
"update": {
|
|
57
|
+
"type": "object",
|
|
58
|
+
"required": [
|
|
59
|
+
"current",
|
|
60
|
+
"latest",
|
|
61
|
+
"command",
|
|
62
|
+
"message"
|
|
63
|
+
],
|
|
64
|
+
"properties": {
|
|
65
|
+
"current": {
|
|
66
|
+
"type": "string"
|
|
67
|
+
},
|
|
68
|
+
"latest": {
|
|
69
|
+
"type": "string"
|
|
70
|
+
},
|
|
71
|
+
"command": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"description": "Run it after the user agrees: it shows the plan and exits 10; then --yes."
|
|
74
|
+
},
|
|
75
|
+
"message": {
|
|
76
|
+
"type": "string"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"skill": {
|
|
81
|
+
"type": "object",
|
|
82
|
+
"required": [
|
|
83
|
+
"installed",
|
|
84
|
+
"current",
|
|
85
|
+
"command",
|
|
86
|
+
"message"
|
|
87
|
+
],
|
|
88
|
+
"properties": {
|
|
89
|
+
"installed": {
|
|
90
|
+
"anyOf": [
|
|
91
|
+
{
|
|
92
|
+
"type": "string"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"type": "null"
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"description": "The skill's version; null when it has none."
|
|
99
|
+
},
|
|
100
|
+
"current": {
|
|
101
|
+
"type": "string"
|
|
102
|
+
},
|
|
103
|
+
"command": {
|
|
104
|
+
"type": "string",
|
|
105
|
+
"description": "`sideby update`, which updates the skill with sideby: run it after the user agrees; it shows the plan and exits 10, then --yes."
|
|
106
|
+
},
|
|
107
|
+
"message": {
|
|
108
|
+
"type": "string"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"description": "Not the answer to the task: mention it briefly afterwards and offer to update."
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"title": "sideby trust on|off --json"
|
|
117
|
+
}
|