sideby 0.35.3 → 0.35.5

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 CHANGED
@@ -1 +1 @@
1
- {"id":"20261104T163724-769bbf"}
1
+ {"id":"20261105T085151-80ed7d"}
@@ -6,7 +6,7 @@ import { aliasesByAccount } from '../core/accounts.js';
6
6
  import { listAppProfiles, openAppProfile, parseProfileRef, removeAppProfile } from '../core/app-profiles.js';
7
7
  import { browserReport, openInBrowser, setBrowserChoice, setBrowserSignIns, } from '../core/browser-profiles.js';
8
8
  import { CLI_COMMANDS, COMMAND_GROUPS, commonCommands } from '../core/cli-commands.js';
9
- import { aliasAccount, aliasArgs, aliasRefs, editConfigUpdate } from '../core/config.js';
9
+ import { aiTaskPermissions, aliasAccount, aliasArgs, aliasRefs, editConfigAskPermissions, editConfigUpdate, loadConfig, } from '../core/config.js';
10
10
  import { openDesktopApp, withDesktopApps } from '../core/desktop-app.js';
11
11
  import { editSettings } from '../core/edit-settings.js';
12
12
  import { UserError } from '../core/errors.js';
@@ -2340,6 +2340,10 @@ export async function cmdAsk(a, io, runtime) {
2340
2340
  }
2341
2341
  if (a.flags.has('spec') || a.flags.has('choices'))
2342
2342
  return cmdAskSpec(a, io, runtime);
2343
+ if (a.flags.has('permissions'))
2344
+ return cmdAskPermissions(a, io, runtime);
2345
+ if (a.flags.has('yes'))
2346
+ throw new UsageError('--yes goes with `sideby ask --permissions checked|account`; a task needs no --yes.');
2343
2347
  const rt = runtime ?? (await createRuntime());
2344
2348
  const task = String(a.flags.get('task') ?? 'free');
2345
2349
  if (!AI_TASK_KINDS.includes(task))
@@ -2373,9 +2377,14 @@ export async function cmdAsk(a, io, runtime) {
2373
2377
  io.err(result.detail);
2374
2378
  return result.opened ? 0 : 1;
2375
2379
  }
2376
- /** What `sideby ask` prints once the terminal opened; a Family with `aiTaskArgs` adds that its checks stay on. */
2380
+ /**
2381
+ * What `sideby ask` prints once the terminal opened: with config `ask.permissions: account` that the Host gets the
2382
+ * Account's own arguments (ADR-0070); otherwise a Family with `aiTaskArgs` adds that its checks stay on (ADR-0031).
2383
+ */
2377
2384
  async function openedLine(rt, result) {
2378
2385
  const line = `Opened ${result.terminal} for ${result.account}.`;
2386
+ if (aiTaskPermissions(rt.config) === 'account')
2387
+ return `${line} ${c.yellow("It starts with the account's own arguments, so its permission checks may be off.")}`;
2379
2388
  const family = result.account
2380
2389
  ? await rt.resolve(result.account).then((a) => rt.families.get(a.family), () => undefined)
2381
2390
  : undefined;
@@ -2383,6 +2392,59 @@ async function openedLine(rt, result) {
2383
2392
  ? `${line} Its permission checks stay on, so risky actions are checked first.`
2384
2393
  : line;
2385
2394
  }
2395
+ /**
2396
+ * `sideby ask --permissions [checked|account] [--yes]` (ADR-0070): shows config `ask.permissions`, or changes it after
2397
+ * showing the change (exit 10 without `--yes`, in both directions).
2398
+ */
2399
+ async function cmdAskPermissions(a, io, runtime) {
2400
+ const usage = 'Use `sideby ask --permissions [checked|account] [--yes] [--json]` on its own, without a task or its text.';
2401
+ const others = [...a.flags.keys()].filter((f) => f !== 'permissions' && f !== 'yes' && f !== 'json');
2402
+ const [value, ...more] = a.positionals;
2403
+ if (others.length || more.length || a.rest.length || a.attach?.length)
2404
+ throw new UsageError(usage);
2405
+ if (value !== undefined && value !== 'checked' && value !== 'account')
2406
+ throw new UsageError(`Choose \`checked\` (permission checks stay on, the default) or \`account\` (the account's own arguments): sideby ask --permissions account`);
2407
+ const paths = runtime?.paths ?? resolvePaths();
2408
+ const file = tildify(paths.configFile, paths.home);
2409
+ const wantJson = a.flags.has('json');
2410
+ if (value === undefined) {
2411
+ if (a.flags.has('yes'))
2412
+ throw new UsageError(usage);
2413
+ const now = aiTaskPermissions(await loadConfig(paths.configFile));
2414
+ if (wantJson)
2415
+ json(io, { permissions: now, file });
2416
+ else {
2417
+ io.out(`AI Tasks: ${PERMISSION_WORDS[now]} (ask.permissions = ${now}).`);
2418
+ io.out(c.cyan(now === 'checked'
2419
+ ? "To start them with the account's own arguments instead: `sideby ask --permissions account`."
2420
+ : 'To turn the permission checks back on: `sideby ask --permissions checked`.'));
2421
+ }
2422
+ return 0;
2423
+ }
2424
+ const yes = a.flags.has('yes');
2425
+ const r = await editConfigAskPermissions(paths.configFile, value, { dryRun: !yes });
2426
+ const before = aiTaskPermissions({ ask: r.before });
2427
+ const after = aiTaskPermissions({ ask: r.after });
2428
+ const applied = r.changed && yes;
2429
+ if (wantJson)
2430
+ json(io, { permissions: applied ? after : before, changed: r.changed, applied, file, before, after });
2431
+ else if (!r.changed)
2432
+ io.out(`Nothing to change: AI Tasks already ${PERMISSION_WORDS[after]}.`);
2433
+ else if (!applied) {
2434
+ io.out(`Change to ${file}: ask.permissions ${before} → ${after}`);
2435
+ io.out(after === 'account'
2436
+ ? c.yellow("AI Tasks (the Panel's Ask AI, `sideby ask`, Task Specs) will start each account with its own arguments, as `sideby run` does, including any that switch the permission checks off (such as Claude Code's --dangerously-skip-permissions). sideby adds no --permission-mode auto.")
2437
+ : c.dim('AI Tasks will leave out the arguments that switch the permission checks off, and Claude Code starts in its auto mode.'));
2438
+ io.out(c.cyan(`Apply it with \`sideby ask --permissions ${after} --yes\`.`));
2439
+ }
2440
+ else
2441
+ io.out(`${c.green('✓')} AI Tasks now ${PERMISSION_WORDS[after]}.`);
2442
+ return r.changed && !yes ? 10 : 0;
2443
+ }
2444
+ const PERMISSION_WORDS = {
2445
+ checked: 'keep the permission checks on',
2446
+ account: "start with the account's own arguments, so the permission checks may be off",
2447
+ };
2386
2448
  /**
2387
2449
  * `sideby ask --spec - [--print]` and `sideby ask --choices` (ADR-0030): the AI Tasks a Portal starts. The Task Spec
2388
2450
  * comes on stdin, never through a shell. A refused spec exits 1 with its `code` (and `reason`, as the Portal reads
@@ -1495,6 +1495,20 @@ export const OUTPUT_SCHEMAS = {
1495
1495
  reason: Type.Union([Type.String({ enum: ['no-accounts', 'none-signed-in', 'all-full'] }), Type.Null()]),
1496
1496
  detail: Type.Union([Type.String({ description: 'What to do next, for a person.' }), Type.Null()]),
1497
1497
  }, { title: 'sideby ask --choices --json' }),
1498
+ 'ask-permissions': Type.Object({
1499
+ schemaVersion: Version,
1500
+ permissions: Type.String({
1501
+ enum: ['checked', 'account'],
1502
+ description: "Config `ask.permissions` now (ADR-0070): `checked` (the default) keeps the Host's permission checks on in AI Tasks; `account` starts them with the Account's own arguments, as `sideby run` does.",
1503
+ }),
1504
+ file: Type.String({ description: 'The config file, with `~` for the home folder.' }),
1505
+ changed: Type.Optional(Type.Boolean({ description: 'With a value: the setting would change.' })),
1506
+ applied: Type.Optional(Type.Boolean({
1507
+ description: 'False when only the change was shown; run again with --yes (exit 10).',
1508
+ })),
1509
+ before: Type.Optional(Type.String({ enum: ['checked', 'account'] })),
1510
+ after: Type.Optional(Type.String({ enum: ['checked', 'account'] })),
1511
+ }, { title: 'sideby ask --permissions [checked|account] [--yes] --json' }),
1498
1512
  terminal: Type.Object({
1499
1513
  schemaVersion: Version,
1500
1514
  preferred: Type.Union([Str, Type.Null()]),
@@ -11,7 +11,7 @@ async function generalHelp() {
11
11
  }
12
12
  /** `sideby <command> --help` for the commands agents use to set up and repair accounts (spec §3.16). */
13
13
  const COMMAND_HELP = {
14
- ask: 'sideby ask [<text>] [--task free|fix|quota|account|host|plugin|terminal|handoff|theme|menubar|hotkey|network] [--account <ref>] [--terminal <id>] [--attach <file>]... [--print] [--json]\nsideby ask --run <id> [--state-dir <dir>]\nsideby ask --spec - [--print] --json\nsideby ask --choices --json\nOpen a task in your terminal. --spec reads a Task Spec (one JSON object, at most 1 MB) from stdin, as a Portal sends it; --choices lists the accounts and terminals a task can use. --attach adds an image (PNG, JPEG, GIF, WebP; up to 20 MB) or a video (MP4, MOV, WebM; up to 200 MB), at most 5. --print prints only the prompt. If opening fails, paste the command into a terminal.',
14
+ ask: 'sideby ask [<text>] [--task free|fix|quota|account|host|plugin|terminal|handoff|theme|menubar|hotkey|network] [--account <ref>] [--terminal <id>] [--attach <file>]... [--print] [--json]\nsideby ask --run <id> [--state-dir <dir>]\nsideby ask --spec - [--print] --json\nsideby ask --choices --json\nsideby ask --permissions [checked|account] [--yes] [--json]\nOpen a task in your terminal. --spec reads a Task Spec (one JSON object, at most 1 MB) from stdin, as a Portal sends it; --choices lists the accounts and terminals a task can use. --attach adds an image (PNG, JPEG, GIF, WebP; up to 20 MB) or a video (MP4, MOV, WebM; up to 200 MB), at most 5. --print prints only the prompt. If opening fails, paste the command into a terminal.',
15
15
  terminal: "sideby terminal [--set <id>|--custom '<program> … {cwd} … {cmd}'|--unset] [--json]\nList terminals or save your preference; --custom saves and selects your own launch command.",
16
16
  key: 'sideby key <account> [--var <NAME>] [--json]\nEnter an API key without echo. Run in a terminal or use the Panel key box.',
17
17
  try: 'sideby try <account> [--model <model>] [--yes] [--json]\nSend a short request through the Host. This spends a few tokens. Exit 10 waits for --yes.\n<account> may be a short command; its arguments apply as in sideby run. --model tries another model once.',
@@ -441,7 +441,7 @@ export function nodeTooOld(version = process.versions.node) {
441
441
  }
442
442
  const COMMANDS = {
443
443
  ask: {
444
- flags: ['json', 'print', 'choices'],
444
+ flags: ['json', 'print', 'choices', 'permissions', 'yes'],
445
445
  valued: ['task', 'account', 'terminal', 'run', 'state-dir', 'attach', 'spec'],
446
446
  },
447
447
  terminal: { flags: ['json', 'unset'], valued: ['set', 'custom'] },
@@ -665,6 +665,17 @@ export const CLI_COMMANDS = [
665
665
  summary: { en: 'Choose the terminal sideby opens tasks in', zh: '选择 sideby 打开任务用的终端' },
666
666
  feature: 'setting.terminal',
667
667
  },
668
+ {
669
+ id: 'ask.permissions',
670
+ group: 'settings',
671
+ usage: 'sideby ask --permissions [checked|account] [--yes]',
672
+ help: "keep AI Tasks' permission checks on (checked, the default) or start them with the account's own arguments",
673
+ summary: {
674
+ en: "Keep AI Tasks' permission checks on, or use the account's own arguments",
675
+ zh: '让 AI 任务保持权限检查,或改用账号自己的参数',
676
+ },
677
+ example: 'sideby ask --permissions',
678
+ },
668
679
  {
669
680
  id: 'update',
670
681
  group: 'settings',
@@ -61,6 +61,7 @@ export declare const ConfigSchema: Type.TObject<{
61
61
  }>>;
62
62
  ask: Type.TOptional<Type.TObject<{
63
63
  account: Type.TOptional<Type.TString>;
64
+ permissions: Type.TOptional<Type.TString>;
64
65
  }>>;
65
66
  accounts: Type.TOptional<Type.TRecord<"^.*$", Type.TObject<{
66
67
  args: Type.TOptional<Type.TArray<Type.TString>>;
@@ -276,15 +277,33 @@ export declare function editConfigTerminal(file: string, patch: {
276
277
  custom?: string | undefined;
277
278
  } | undefined;
278
279
  }>;
280
+ /** Saves (or with no account removes) config `ask.account`, keeping the other `ask` keys. */
279
281
  export declare function editConfigAsk(file: string, account?: string): Promise<{
280
282
  changed: boolean;
281
283
  before: {
282
284
  account?: string | undefined;
285
+ permissions?: string | undefined;
283
286
  } | undefined;
284
287
  after: {
285
288
  account?: string | undefined;
289
+ permissions?: string | undefined;
286
290
  } | undefined;
287
291
  }>;
292
+ export type AiTaskPermissions = 'checked' | 'account';
293
+ /** Config `ask.permissions` (ADR-0070): how AI Tasks start the Host; `checked` when it is not set. */
294
+ export declare function aiTaskPermissions(config: Pick<Config, 'ask'>): AiTaskPermissions;
295
+ /**
296
+ * `sideby ask --permissions` (ADR-0070): sets config `ask.permissions`; `checked`, the default, removes the key, and
297
+ * an empty `ask` goes away with it. With `dryRun`, shows the change without writing.
298
+ */
299
+ export declare function editConfigAskPermissions(file: string, value: AiTaskPermissions, opts?: {
300
+ dryRun?: boolean;
301
+ }): Promise<{
302
+ changed: boolean;
303
+ before: AskConfig | undefined;
304
+ after: AskConfig | undefined;
305
+ }>;
306
+ export type AskConfig = NonNullable<Config['ask']>;
288
307
  export type PanelConfig = NonNullable<Config['panel']>;
289
308
  /**
290
309
  * The Panel's light/dark, language and Theme (spec §3.29, §3.34): a value sets the key, null removes it (back to the default), and an
@@ -176,6 +176,10 @@ export const ConfigSchema = Type.Object({
176
176
  account: Type.Optional(Type.String({
177
177
  description: 'The account AI Tasks start (`<family>:<name>` or a short command); sideby picks one without it.',
178
178
  })),
179
+ permissions: Type.Optional(Type.String({
180
+ enum: ['checked', 'account'],
181
+ description: "How AI Tasks start the Host (ADR-0070). `checked` (the default) removes the arguments that switch the Host's permission checks off and starts Claude Code in its auto mode (ADR-0031); `account` starts it with the Account's own arguments exactly as `sideby run` does, including a permission bypass you put there. Change it with `sideby ask --permissions`.",
182
+ })),
179
183
  }, { additionalProperties: false, description: 'AI Tasks (spec §3.28).' })),
180
184
  accounts: Type.Optional(Type.Record(Type.String(), Type.Object({
181
185
  args: Type.Optional(Type.Array(Type.String(), {
@@ -585,8 +589,34 @@ export function editConfigTerminal(file, patch) {
585
589
  return Object.keys(next).length ? next : undefined;
586
590
  });
587
591
  }
592
+ /** Saves (or with no account removes) config `ask.account`, keeping the other `ask` keys. */
588
593
  export function editConfigAsk(file, account) {
589
- return editConfigKey(file, 'ask', 'run `sideby ask`', () => (account ? { account } : undefined));
594
+ return editConfigKey(file, 'ask', 'run `sideby ask`', (current) => {
595
+ const next = { ...current };
596
+ if (account)
597
+ next.account = account;
598
+ else
599
+ delete next.account;
600
+ return Object.keys(next).length ? next : undefined;
601
+ });
602
+ }
603
+ /** Config `ask.permissions` (ADR-0070): how AI Tasks start the Host; `checked` when it is not set. */
604
+ export function aiTaskPermissions(config) {
605
+ return config.ask?.permissions === 'account' ? 'account' : 'checked';
606
+ }
607
+ /**
608
+ * `sideby ask --permissions` (ADR-0070): sets config `ask.permissions`; `checked`, the default, removes the key, and
609
+ * an empty `ask` goes away with it. With `dryRun`, shows the change without writing.
610
+ */
611
+ export function editConfigAskPermissions(file, value, opts = {}) {
612
+ return editConfigKey(file, 'ask', 'run `sideby ask --permissions`', (current) => {
613
+ const next = { ...current };
614
+ if (value === 'account')
615
+ next.permissions = 'account';
616
+ else
617
+ delete next.permissions;
618
+ return Object.keys(next).length ? next : undefined;
619
+ }, opts);
590
620
  }
591
621
  /**
592
622
  * The Panel's light/dark, language and Theme (spec §3.29, §3.34): a value sets the key, null removes it (back to the default), and an
@@ -7,10 +7,13 @@ export declare const NETWORK_ENV: {
7
7
  readonly allow: 'SIDEBY_NETWORK_ALLOW';
8
8
  readonly dir: 'SIDEBY_NETWORK_DIR';
9
9
  };
10
+ /** True in CI, where a notice is noise and a check is a request nobody reads. */
11
+ export declare const inCi: (env: Record<string, string | undefined>) => boolean;
10
12
  /**
11
13
  * Config `network` as the file says now, read by hand (no schema) so a running session follows the Panel and
12
- * `sideby network on|off|allow`: `guard` is false when the switch is off or no country is allowed. Undefined when the
13
- * file cannot be read or is not JSON; the caller then keeps what the session was started with.
14
+ * `sideby network on|off|allow`: `guard` is false when the switch is off or no country is allowed, and when there is no
15
+ * config file (as for every other reader, no file means the defaults, where the check is off). Undefined when the file
16
+ * exists but cannot be read or is not JSON; the caller then keeps what the session was started with.
14
17
  */
15
18
  export declare function readNetworkConfig(configFile: string): Promise<{
16
19
  guard: boolean;
@@ -27,21 +27,25 @@ export const NETWORK_ENV = {
27
27
  allow: 'SIDEBY_NETWORK_ALLOW',
28
28
  dir: 'SIDEBY_NETWORK_DIR',
29
29
  };
30
+ const set = (v) => v !== undefined && v !== '' && v !== '0' && v.toLowerCase() !== 'false';
31
+ /** True in CI, where a notice is noise and a check is a request nobody reads. */
32
+ export const inCi = (env) => set(env.CI) || set(env.CONTINUOUS_INTEGRATION) || set(env.BUILD_NUMBER);
30
33
  /**
31
34
  * Config `network` as the file says now, read by hand (no schema) so a running session follows the Panel and
32
- * `sideby network on|off|allow`: `guard` is false when the switch is off or no country is allowed. Undefined when the
33
- * file cannot be read or is not JSON; the caller then keeps what the session was started with.
35
+ * `sideby network on|off|allow`: `guard` is false when the switch is off or no country is allowed, and when there is no
36
+ * config file (as for every other reader, no file means the defaults, where the check is off). Undefined when the file
37
+ * exists but cannot be read or is not JSON; the caller then keeps what the session was started with.
34
38
  */
35
39
  export async function readNetworkConfig(configFile) {
36
- // The config may be a link a dotfiles manager keeps; reading through it is fine.
40
+ // The config may be a link a dotfiles manager keeps; reading through it is fine. No size limit: every other config
41
+ // reader takes the whole file, and a limit would turn a large config that says "off" into the started-with list.
37
42
  let config;
38
43
  try {
39
- const text = await readFile(configFile, 'utf8');
40
- if (text.length > 4 * 1024 * 1024)
41
- return undefined;
42
- config = JSON.parse(text);
44
+ config = JSON.parse(await readFile(configFile, 'utf8'));
43
45
  }
44
- catch {
46
+ catch (err) {
47
+ if (err.code === 'ENOENT')
48
+ return { guard: false, allow: [] };
45
49
  return undefined;
46
50
  }
47
51
  if (!config || typeof config !== 'object')
@@ -399,7 +403,11 @@ export function blockMessage(v, allow, opts) {
399
403
  : opts.at === 'prompt'
400
404
  ? '检查代理是否开着、节点是否正确,然后重新发送这条消息。'
401
405
  : '检查代理是否开着、节点是否正确,然后让它继续。';
402
- return `${what}${next}临时跳过:\`${skip}\`。`;
406
+ // Inside a session `--ignore-network` only helps a new one; turning the check off reaches this one at once.
407
+ const skipZh = opts.at === 'launch'
408
+ ? `临时跳过:\`${skip}\`。`
409
+ : `不想检查了:运行 \`sideby network off --yes\`,正在运行的会话也会马上放行;只跳过一次就新开会话:\`${skip}\`。`;
410
+ return `${what}${next}${skipZh}`;
403
411
  }
404
412
  const tried = tries > 1 ? ` after ${tries} tries in about ${secs} s` : '';
405
413
  const what = v.status === 'unknown'
@@ -410,5 +418,8 @@ export function blockMessage(v, allow, opts) {
410
418
  : opts.at === 'prompt'
411
419
  ? 'Check that the proxy is on and the node is right, then send the message again.'
412
420
  : 'Check that the proxy is on and the node is right, then let it continue.';
413
- return `${what} ${next} To skip once: \`${skip}\`.`;
421
+ const skipEn = opts.at === 'launch'
422
+ ? `To skip once: \`${skip}\`.`
423
+ : `To stop checking, run \`sideby network off --yes\`; sessions already running follow it at once. To skip once, start a new session: \`${skip}\`.`;
424
+ return `${what} ${next} ${skipEn}`;
414
425
  }
@@ -1,4 +1,5 @@
1
1
  import type { Env } from '../types.ts';
2
+ import { inCi } from './egress.ts';
2
3
  import type { Paths } from './paths.ts';
3
4
  export { isZombieStat } from './lock.ts';
4
5
  export { compareVersions } from './version.ts';
@@ -122,8 +123,7 @@ export declare const isNewer: (latest: string | undefined, current: string) => l
122
123
  * only gets a notice.
123
124
  */
124
125
  export declare function sameLine(from: string, to: string): boolean;
125
- /** True in CI, where a notice is noise and a check is a request nobody reads. */
126
- export declare const inCi: (env: Env) => boolean;
126
+ export { inCi };
127
127
  type UpdateSettings = {
128
128
  update?: {
129
129
  check?: boolean;
@@ -6,7 +6,7 @@ import { access, constants, mkdir, readdir, readFile, realpath, rm } from 'node:
6
6
  import { dirname, join, sep } from 'node:path';
7
7
  import { fileURLToPath } from 'node:url';
8
8
  import { afterInstall, runSkillUpdate } from './after-install.js';
9
- import { fetchTrace, proxyFor } from './egress.js';
9
+ import { fetchTrace, inCi, proxyFor } from './egress.js';
10
10
  import { writeFileAtomic } from './fs-safe.js';
11
11
  import { processAlive, takeFileLock } from './lock.js';
12
12
  import { installedSkills, REPO_URL, SKILL_UPDATE, SKILL_UPDATE_SHOWN, skillIsBehind, skillOwnerRepo, } from './skill-check.js';
@@ -194,8 +194,8 @@ export function sameLine(from, to) {
194
194
  }
195
195
  // ---- switches
196
196
  const set = (v) => v !== undefined && v !== '' && v !== '0' && v.toLowerCase() !== 'false';
197
- /** True in CI, where a notice is noise and a check is a request nobody reads. */
198
- export const inCi = (env) => set(env.CI) || set(env.CONTINUOUS_INTEGRATION) || set(env.BUILD_NUMBER);
197
+ // `inCi` lives in core/egress.ts, a leaf module `network-hook` may import.
198
+ export { inCi };
199
199
  /** Why Update Checks are off, with a code for the Panel, or null when they are on (spec §3.23). */
200
200
  export function checksOffWhy(env, config, local = localBuild() !== null) {
201
201
  // A Local Build (ADR-0024) follows the checkout: a notice or an Auto Update would only replace it with npm's.
@@ -4,7 +4,7 @@
4
4
  // reason on stderr blocks the prompt or the tool call; anything it cannot tell blocks too, after asking again for up to
5
5
  // about 30 seconds (a prompt the Host made itself is not sent again once blocked).
6
6
  import { spawn } from 'node:child_process';
7
- import { blockMessage, NETWORK_ENV, prefersChinese, readNetworkConfig, refresh, verdict, } from '../core/egress.js';
7
+ import { blockMessage, inCi, NETWORK_ENV, prefersChinese, readNetworkConfig, refresh, verdict, } from '../core/egress.js';
8
8
  import { resolvePaths } from '../core/paths.js';
9
9
  export const NETWORK_HOOK_COMMAND = 'sideby network-hook';
10
10
  /** The Host events this entry answers, and when each happens; `Refresh` is its own detached refresh. */
@@ -34,6 +34,9 @@ export async function runNetworkHook(argv, env, err, deps = {}) {
34
34
  // Not a session sideby started with Network Guard (the hook was copied somewhere): nothing to guard.
35
35
  if (!url || !dir)
36
36
  return 0;
37
+ // In CI Network Guard makes no request (AGENTS.md, spec §3.35), also when a session's variables reach it there.
38
+ if (inCi(env))
39
+ return 0;
37
40
  // The switch and the list as config says now, so turning the check off or allowing a country in the Panel or with
38
41
  // `sideby network` reaches sessions already running. When config cannot be read, the list the session started with.
39
42
  const current = await readNetworkConfig(resolvePaths(env).configFile);
@@ -150,7 +150,10 @@ export type PanelFamily = FamilyInfo & {
150
150
  keyAlways?: boolean;
151
151
  /** What "Try it" runs (`sideby try`): the Host and the probe arguments; absent when it cannot be tried. */
152
152
  tryCommand?: string[];
153
- /** AI Tasks start this Host with its permission checks on (`aiTaskArgs`, ADR-0031), so the AI dialog says so. */
153
+ /**
154
+ * AI Tasks start this Host with its permission checks on (`aiTaskArgs`, ADR-0031), so the AI dialog says so. Absent
155
+ * while config `ask.permissions` is `account` (ADR-0070).
156
+ */
154
157
  aiTaskSafe?: true;
155
158
  /** "Refresh" can ask the Host for its Quota (`fetchQuota`); without it old numbers wait for a session (spec §3.31). */
156
159
  quotaRefresh?: true;
@@ -199,6 +202,8 @@ export interface PanelState {
199
202
  readOnly: boolean;
200
203
  generatedAt: string;
201
204
  families: PanelFamily[];
205
+ /** Config `ask.permissions` when it is `account` (ADR-0070): AI Tasks start with the Account's own arguments. */
206
+ aiTaskPermissions?: 'account';
202
207
  accounts: PanelAccount[];
203
208
  pluginErrors: {
204
209
  where: string;
@@ -7,7 +7,7 @@ import { ATTACHMENT_LIMITS, MAX_ATTACHMENTS, MAX_UPLOAD_BYTES, removeStaged, sta
7
7
  import { applyAutostart, autostartStatus, PANEL_AGENT, planAutostart, } from '../core/autostart.js';
8
8
  import { FAVICON_SVG, ICON_SVG } from '../core/brand-mark.js';
9
9
  import { browserReport, openInBrowser, setBrowserChoice, setBrowserSignIns, } from '../core/browser-profiles.js';
10
- import { aliasArgs, aliasRefs, editConfigPanel, editConfigTerminal, editConfigUpdate, loadConfig, } from '../core/config.js';
10
+ import { aiTaskPermissions, aliasArgs, aliasRefs, editConfigPanel, editConfigTerminal, editConfigUpdate, loadConfig, } from '../core/config.js';
11
11
  import { openDesktopApp, withDesktopApps } from '../core/desktop-app.js';
12
12
  import { editSettings } from '../core/edit-settings.js';
13
13
  import { UserError } from '../core/errors.js';
@@ -89,7 +89,7 @@ export function healthByAccount(history) {
89
89
  });
90
90
  return out;
91
91
  }
92
- function keyFacts(def) {
92
+ function keyFacts(def, permissions) {
93
93
  let keyVar = null;
94
94
  try {
95
95
  keyVar = secretVarFor(def);
@@ -99,7 +99,7 @@ function keyFacts(def) {
99
99
  keyVar,
100
100
  ...(def.secretFileMeansApi === false ? { keyAlways: true } : {}),
101
101
  ...(def.probe ? { tryCommand: [def.bin, ...def.probe.args] } : {}),
102
- ...(def.aiTaskArgs ? { aiTaskSafe: true } : {}),
102
+ ...(def.aiTaskArgs && permissions === 'checked' ? { aiTaskSafe: true } : {}),
103
103
  ...(def.fetchQuota ? { quotaRefresh: true } : {}),
104
104
  };
105
105
  }
@@ -609,6 +609,7 @@ async function buildState(rt, opts) {
609
609
  .then((st) => withPendingIds(st, rt.paths.stateDir))
610
610
  .catch(() => undefined);
611
611
  const showBrowser = browser && (browser.families.matched.length || browser.families.openOnly.length);
612
+ const permissions = aiTaskPermissions(rt.config);
612
613
  return {
613
614
  schemaVersion: 1,
614
615
  version: opts.version,
@@ -619,8 +620,10 @@ async function buildState(rt, opts) {
619
620
  const def = rt.families.get(f.id);
620
621
  const logo = def?.logo;
621
622
  const g = f.brokenBin ? { ...f, brokenBin: tildify(f.brokenBin, ctx.home) } : f;
622
- return { ...g, ...(logo ? { logo } : {}), ...(def ? keyFacts(def) : {}) };
623
+ return { ...g, ...(logo ? { logo } : {}), ...(def ? keyFacts(def, permissions) : {}) };
623
624
  }),
625
+ // Config `ask.permissions: account` (ADR-0070): AI Tasks start with the Account's own arguments.
626
+ ...(permissions === 'account' ? { aiTaskPermissions: 'account' } : {}),
624
627
  accounts: list,
625
628
  pluginErrors: rt.pluginErrors.map((e) => ({ where: e.where, message: e.message })),
626
629
  quotaSetups,
@@ -558,6 +558,7 @@ declare const en: {
558
558
  'ask.chooseAccount': string;
559
559
  'ask.confirm': string;
560
560
  'ask.safe': string;
561
+ 'ask.accountArgs': string;
561
562
  'ask.open': string;
562
563
  'ask.opening': string;
563
564
  'ask.loading': string;
@@ -560,6 +560,7 @@ const en = {
560
560
  'ask.chooseAccount': 'Choose an account',
561
561
  'ask.confirm': 'Opens {terminal} and starts {ref} there.',
562
562
  'ask.safe': 'Its permission checks stay on, so risky actions are checked first.',
563
+ 'ask.accountArgs': "It starts with the account's own arguments, so its permission checks may be off.",
563
564
  'ask.open': 'Open in {terminal}',
564
565
  'ask.opening': 'Opening…',
565
566
  'ask.loading': 'Finding an account…',
@@ -2186,6 +2187,7 @@ const zh = {
2186
2187
  'ask.chooseAccount': '选一个账号',
2187
2188
  'ask.confirm': '将打开 {terminal},在里面启动 {ref}。',
2188
2189
  'ask.safe': '它的权限检查保持开启,有风险的操作会先经过检查。',
2190
+ 'ask.accountArgs': '它会用账号自己的参数启动,权限检查可能是关着的。',
2189
2191
  'ask.open': '在 {terminal} 中打开',
2190
2192
  'ask.opening': '正在打开…',
2191
2193
  'ask.loading': '正在挑选账号…',
@@ -671,6 +671,18 @@ export declare function askCopy(task: string, has: (key: string) => boolean, fre
671
671
  placeholder: string;
672
672
  chips: string[];
673
673
  };
674
+ /**
675
+ * The message key the AI dialog adds after its confirm line for an Account of `family` (ADR-0031, ADR-0070): with
676
+ * config `ask.permissions: account` every AI Task starts with the Account's own arguments, so its checks may be off;
677
+ * otherwise a Family whose checks stay on says so, and any other Family adds nothing.
678
+ */
679
+ export declare function askPermissionNote(state: {
680
+ aiTaskPermissions?: string;
681
+ families?: {
682
+ id: string;
683
+ aiTaskSafe?: boolean;
684
+ }[];
685
+ } | null, family: string): 'ask.accountArgs' | 'ask.safe' | null;
674
686
  /**
675
687
  * Whether the Panel hands its AI Tasks to the Portal around it (ADR-0030): createPanelHandler was given
676
688
  * `ask: { bridge: 'postMessage' }` and the page sits in a frame. A Panel opened on its own is its own parent; it keeps
@@ -1223,6 +1223,18 @@ export function askCopy(task, has, freeChips) {
1223
1223
  const chips = own ? [1, 2, 3].map((n) => 'ask.ex.' + task + '.' + n).filter(has) : [];
1224
1224
  return { title, placeholder, chips: chips.length ? chips : freeChips.slice() };
1225
1225
  }
1226
+ /**
1227
+ * The message key the AI dialog adds after its confirm line for an Account of `family` (ADR-0031, ADR-0070): with
1228
+ * config `ask.permissions: account` every AI Task starts with the Account's own arguments, so its checks may be off;
1229
+ * otherwise a Family whose checks stay on says so, and any other Family adds nothing.
1230
+ */
1231
+ export function askPermissionNote(state, family) {
1232
+ if (!state)
1233
+ return null;
1234
+ if (state.aiTaskPermissions === 'account')
1235
+ return 'ask.accountArgs';
1236
+ return (state.families || []).some((f) => f.id === family && f.aiTaskSafe) ? 'ask.safe' : null;
1237
+ }
1226
1238
  /**
1227
1239
  * Whether the Panel hands its AI Tasks to the Portal around it (ADR-0030): createPanelHandler was given
1228
1240
  * `ask: { bridge: 'postMessage' }` and the page sits in a frame. A Panel opened on its own is its own parent; it keeps
@@ -5,7 +5,7 @@ import { groupsToAccept } from '../core/inbound.js';
5
5
  import { quotaIsStale } from '../core/quota-levels.js';
6
6
  import { remoteControlTodo } from '../core/remote-control.js';
7
7
  import { catalogMatchLevel, catalogNorm, searchCatalog } from '../core/search-catalog.js';
8
- import { accountTitle, aiTaskAccounts, aliasArgsOf, aliasIssue, aliasPrefix, askBridge, askBridged, askCopy, attentionReasons, attentionWhy, autostartNote, bindingWindow, cacheHitRate, canLeaveLocal, categoryOrder, codeSwapOutcome, dotsKeepKeyboard, enableOutcome, fileSize, fixPrompt, foldSkips, foldToolCalls, formatDuration, handoffChangeOf, handoffHintAccount, handoffTaskFacts, hiddenIn, highlightParts, histFilters, historyEmpty, historyWhen, hotkeyFromKey, hotkeyPressKind, inDisplayOrder, loginClusters, loginKey, longWindow, maskEmail, matchesQuery, mdBlocks, mdInline, menuPlacement, mergeDaily, mergeUsage, messageChip, messageNews, messageToCheck, networkTaskFacts, newAccountDir, nextReset, orderedAliases, panelFixes, panelHint, panelLang, panelMigration, panelPrefs, passedWindow, pinnedIn, portalRefresh, quotaAskable, quotaHighLevel, quotaPressure, radioStep, reloadForBuild, remoteControlSummary, reorder, resetWhen, rowBadge, runCodeSwap, saveHandoffChange, sendBlock, sendFileProblem, sendResultView, sessionAge, sessionLabelParts, sessionRowShape, shortCwd, shortSessionLabel, sortAccounts, sortMenu, sortSessions, steadyOrder, stripSecrets, suggestAlias, suggestName, switchFailure, tailInView, taskFindings, uaDayRuns, uaGroupPending, uaOnChoices, uaParseClock, uaPickTime, uaSameSlot, uaShouldRead, uaSlotNight, uaStatusParts, uaStepClock, uaToggleDay, uaWaitingCount, uaWhen, updatedAge, vendorAlias, widthFollower, widthTier, windowState, withPinned, } from './page-logic.js';
8
+ import { accountTitle, aiTaskAccounts, aliasArgsOf, aliasIssue, aliasPrefix, askBridge, askBridged, askCopy, askPermissionNote, attentionReasons, attentionWhy, autostartNote, bindingWindow, cacheHitRate, canLeaveLocal, categoryOrder, codeSwapOutcome, dotsKeepKeyboard, enableOutcome, fileSize, fixPrompt, foldSkips, foldToolCalls, formatDuration, handoffChangeOf, handoffHintAccount, handoffTaskFacts, hiddenIn, highlightParts, histFilters, historyEmpty, historyWhen, hotkeyFromKey, hotkeyPressKind, inDisplayOrder, loginClusters, loginKey, longWindow, maskEmail, matchesQuery, mdBlocks, mdInline, menuPlacement, mergeDaily, mergeUsage, messageChip, messageNews, messageToCheck, networkTaskFacts, newAccountDir, nextReset, orderedAliases, panelFixes, panelHint, panelLang, panelMigration, panelPrefs, passedWindow, pinnedIn, portalRefresh, quotaAskable, quotaHighLevel, quotaPressure, radioStep, reloadForBuild, remoteControlSummary, reorder, resetWhen, rowBadge, runCodeSwap, saveHandoffChange, sendBlock, sendFileProblem, sendResultView, sessionAge, sessionLabelParts, sessionRowShape, shortCwd, shortSessionLabel, sortAccounts, sortMenu, sortSessions, steadyOrder, stripSecrets, suggestAlias, suggestName, switchFailure, tailInView, taskFindings, uaDayRuns, uaGroupPending, uaOnChoices, uaParseClock, uaPickTime, uaSameSlot, uaShouldRead, uaSlotNight, uaStatusParts, uaStepClock, uaToggleDay, uaWaitingCount, uaWhen, updatedAge, vendorAlias, widthFollower, widthTier, windowState, withPinned, } from './page-logic.js';
9
9
  // The component library's dropdown menu, copied by the brand repo's add script (--html into ui/); do not edit it.
10
10
  import { CHECK, menuItem, menuScript } from './ui/dropdown-menu/dropdown-menu.html.js';
11
11
  import { cn, esc } from './ui/lib/cn.js';
@@ -20,6 +20,7 @@ const LOGIC = [
20
20
  askBridge,
21
21
  askBridged,
22
22
  askCopy,
23
+ askPermissionNote,
23
24
  quotaAskable,
24
25
  stripSecrets,
25
26
  taskFindings,
@@ -7801,10 +7802,10 @@ const MAIN = String.raw `
7801
7802
  }
7802
7803
  if (rows.length) out.push(h('div', { class: 'ask-pick' }, rows))
7803
7804
  if (ak.account) {
7804
- // Families whose AI Tasks start with permission checks on (ADR-0031) say so after the confirm line.
7805
+ // After the confirm line: the checks stay on (ADR-0031), or the Account's own arguments are used (ADR-0070).
7805
7806
  const acct = S.state && S.state.accounts.find((x) => x.ref === ak.account)
7806
- const safe = acct && family(acct.family).aiTaskSafe
7807
- out.push(h('p', { class: 'small' }, t('ask.confirm', { terminal: termName(ak.terminal || 'terminal'), ref: ak.account }) + (safe ? ' ' + t('ask.safe') : '')))
7807
+ const note = acct ? askPermissionNote(S.state, acct.family) : null
7808
+ out.push(h('p', { class: 'small' }, t('ask.confirm', { terminal: termName(ak.terminal || 'terminal'), ref: ak.account }) + (note ? ' ' + t(note) : '')))
7808
7809
  }
7809
7810
  return out
7810
7811
  }
@@ -276,7 +276,7 @@ export interface Runtime {
276
276
  writeShellInitFiles(shells?: readonly Shell[]): Promise<ShellInitWrite[]>;
277
277
  /**
278
278
  * `opts.aiTask`: the Launch is an AI Task's (spec §3.28), so the Family's `aiTaskArgs` removes every permission
279
- * bypass from it (ADR-0031). `sideby run` never sets it.
279
+ * bypass from it (ADR-0031), unless config `ask.permissions` is `account` (ADR-0070). `sideby run` never sets it.
280
280
  */
281
281
  prepareLaunch(ref: string, userArgs: readonly string[], command: 'run' | 'login', opts?: {
282
282
  aiTask?: boolean;
@@ -1,6 +1,6 @@
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
- import { addConfigAlias, addConfigPickCommand, aliasAccount, aliasArgs, aliasProblem, aliasRefs, editConfigDisplay, editConfigQuotaCheck, handoffSettings, loadConfig, removeConfigAlias, removeConfigPickCommand, } from './core/config.js';
3
+ import { addConfigAlias, addConfigPickCommand, aiTaskPermissions, aliasAccount, aliasArgs, aliasProblem, aliasRefs, editConfigDisplay, editConfigQuotaCheck, handoffSettings, loadConfig, removeConfigAlias, removeConfigPickCommand, } from './core/config.js';
4
4
  import { createAccount } from './core/create.js';
5
5
  import { bindDesktopDeps, checkAppData } from './core/desktop-app.js';
6
6
  import { applyFixes, runDoctor } from './core/doctor.js';
@@ -740,12 +740,14 @@ export async function createRuntime(opts = {}) {
740
740
  if (fresh) {
741
741
  config.accounts = fresh.accounts;
742
742
  config.unattended = fresh.unattended;
743
+ config.ask = fresh.ask;
743
744
  }
744
745
  const all = await accounts();
745
746
  const inputs = launchInputs(ref, all, userArgs, command);
746
747
  const p = await prepareLaunch({
747
748
  ...inputs,
748
- ...(opts.aiTask ? { aiTask: true } : {}),
749
+ // Config `ask.permissions: account` (ADR-0070): the AI Task keeps the Account's own arguments, as `run` does.
750
+ ...(opts.aiTask && aiTaskPermissions(config) === 'checked' ? { aiTask: true } : {}),
749
751
  label: launchLabel(ref, inputs.account, all),
750
752
  baseEnv: env,
751
753
  bus,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sideby",
3
- "version": "0.35.3",
3
+ "version": "0.35.5",
4
4
  "description": "Run work, personal and API-key accounts at the same time, without their configs drifting apart.",
5
5
  "license": "MIT",
6
6
  "author": "Adonis0123 (https://github.com/Adonis0123)",
@@ -0,0 +1,113 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "sideby/ask-permissions.json",
4
+ "type": "object",
5
+ "required": [
6
+ "schemaVersion",
7
+ "permissions",
8
+ "file"
9
+ ],
10
+ "properties": {
11
+ "schemaVersion": {
12
+ "type": "number",
13
+ "const": 1
14
+ },
15
+ "permissions": {
16
+ "type": "string",
17
+ "enum": [
18
+ "checked",
19
+ "account"
20
+ ],
21
+ "description": "Config `ask.permissions` now (ADR-0070): `checked` (the default) keeps the Host's permission checks on in AI Tasks; `account` starts them with the Account's own arguments, as `sideby run` does."
22
+ },
23
+ "file": {
24
+ "type": "string",
25
+ "description": "The config file, with `~` for the home folder."
26
+ },
27
+ "changed": {
28
+ "type": "boolean",
29
+ "description": "With a value: the setting would change."
30
+ },
31
+ "applied": {
32
+ "type": "boolean",
33
+ "description": "False when only the change was shown; run again with --yes (exit 10)."
34
+ },
35
+ "before": {
36
+ "type": "string",
37
+ "enum": [
38
+ "checked",
39
+ "account"
40
+ ]
41
+ },
42
+ "after": {
43
+ "type": "string",
44
+ "enum": [
45
+ "checked",
46
+ "account"
47
+ ]
48
+ },
49
+ "_notice": {
50
+ "type": "object",
51
+ "properties": {
52
+ "update": {
53
+ "type": "object",
54
+ "required": [
55
+ "current",
56
+ "latest",
57
+ "command",
58
+ "message"
59
+ ],
60
+ "properties": {
61
+ "current": {
62
+ "type": "string"
63
+ },
64
+ "latest": {
65
+ "type": "string"
66
+ },
67
+ "command": {
68
+ "type": "string",
69
+ "description": "Run it after the user agrees: it shows the plan and exits 10; then --yes."
70
+ },
71
+ "message": {
72
+ "type": "string"
73
+ }
74
+ }
75
+ },
76
+ "skill": {
77
+ "type": "object",
78
+ "required": [
79
+ "installed",
80
+ "current",
81
+ "command",
82
+ "message"
83
+ ],
84
+ "properties": {
85
+ "installed": {
86
+ "anyOf": [
87
+ {
88
+ "type": "string"
89
+ },
90
+ {
91
+ "type": "null"
92
+ }
93
+ ],
94
+ "description": "The skill's version; null when it has none."
95
+ },
96
+ "current": {
97
+ "type": "string"
98
+ },
99
+ "command": {
100
+ "type": "string",
101
+ "description": "`sideby update`, which updates the skill with sideby: run it after the user agrees; it shows the plan and exits 10, then --yes."
102
+ },
103
+ "message": {
104
+ "type": "string"
105
+ }
106
+ }
107
+ }
108
+ },
109
+ "description": "Not the answer to the task: mention it briefly afterwards and offer to update."
110
+ }
111
+ },
112
+ "title": "sideby ask --permissions [checked|account] [--yes] --json"
113
+ }
@@ -80,6 +80,14 @@
80
80
  "account": {
81
81
  "type": "string",
82
82
  "description": "The account AI Tasks start (`<family>:<name>` or a short command); sideby picks one without it."
83
+ },
84
+ "permissions": {
85
+ "type": "string",
86
+ "enum": [
87
+ "checked",
88
+ "account"
89
+ ],
90
+ "description": "How AI Tasks start the Host (ADR-0070). `checked` (the default) removes the arguments that switch the Host's permission checks off and starts Claude Code in its auto mode (ADR-0031); `account` starts it with the Account's own arguments exactly as `sideby run` does, including a permission bypass you put there. Change it with `sideby ask --permissions`."
83
91
  }
84
92
  },
85
93
  "additionalProperties": false,
@@ -2,7 +2,7 @@
2
2
  name: sideby
3
3
  description: Use when the user runs, or wants to run, several AI coding accounts (Claude Code, Codex, Grok Build, pi) side by side. Covers installing sideby and setting up a new account ("install sideby", "set up another Claude account", "add cc008", "配置一个 cc00x", "再加一个 Codex 账号"), explaining what accounts share and what stays separate ("what do my accounts share?", "这些账号共享了什么"), showing which account a session is ("show [cc001] in the status line", "加上账号标识"), finding a past session of any account ("找一下我上周改登录页的那个会话"), telling another running session something, in any account ("告诉 cc002 ……", "给跑构建的那个会话发消息"; Claude Code's own SendMessage reaches only sessions of the same account), seeing accounts, quota and usage, moving on when one hits its 5-hour or weekly limit, moving the current task to another account ("用 cc008 继续", "交回 cc008"), adding a short command (alias) or a pick command that starts whichever account has the most quota ("加个 cc"), adding an API account from a vendor's docs ("加一个 DeepSeek API 账号"), supporting a new tool, and repairing drifted account directories (skills, hooks, rules or settings not shared, wrong symlinks, credential file permissions). Drives the `sideby` CLI with `--json`; the agent does every step except browser sign-in, filling in secrets and starting interactive sessions, which it hands to the user as one command (inside an Auto Handoff session, `sideby handoff ready --to` moves the task itself).
4
4
  metadata:
5
- version: "0.35.3"
5
+ version: "0.35.5"
6
6
  requires:
7
7
  bins: [sideby, node]
8
8
  cliHelp: sideby --help
@@ -71,6 +71,7 @@ Account refs are `<family>:<name>`; a bare `<name>` works only when it is unique
71
71
  | A Portal starts AI Tasks through sideby, or one of its tasks failed (`spec-version`, `bad-cwd`, "which account would it use?") | `sideby ask --choices --json`, `sideby ask --spec - --print --json` (read only) | `references/ai-tasks.md` |
72
72
  | Add an API account from a vendor's address or docs link, enter its key, check it works (also with a given model: "用 glm-5.3 试一下 pi") | `sideby new <family> --next --api --vendor <slug> --json` (short command named after the vendor, `cc-ds`), then the user runs `sideby key <ref>`; `sideby try <ref|short command> [--model <m>] --json` (exit 10 first) | `references/ai-tasks.md` |
73
73
  | Support a tool sideby does not list yet, or write a plugin | `sideby plugins new <id> --json`, `sideby plugins check <id> --json` | `references/ai-tasks.md` |
74
+ | Let AI Tasks start with the account's own arguments, including its permission bypass, or turn their permission checks back on ("AI 任务也跳过权限确认", "let Ask AI use my --dangerously-skip-permissions", "AI 任务的权限检查打开") | `sideby ask --permissions --json`; `sideby ask --permissions account\|checked --json` (exits 10 with the change; rerun with `--yes` only after a clear yes; never on your own) | `references/ai-tasks.md` |
74
75
  | Choose the terminal the Panel opens for AI Tasks and sign-in | `sideby terminal --json`, `sideby terminal --set <id> --json` | — |
75
76
  | Tune the auto-compact threshold ("which compaction setting costs the fewest tokens"), use the suggestion or undo it | `sideby tune --json`, `sideby tune apply` (exit 10 first), `sideby tune undo` | `references/diagnose.md` |
76
77
  | See or set the model and effort an account starts with ("用哪个模型", "set effort to high for cc002") | `sideby model <acct> --json`; `sideby model <acct> <model\|default> --effort <level\|default>` (exit 10 first, then `--yes` after the user agrees) | — |
@@ -11,9 +11,18 @@ You are inside such a session when the first message came from sideby and names
11
11
  - Never sign in for the user. Tell them to click **Sign in** on the account in the Panel, or to run `sideby login <ref>` in their own terminal.
12
12
  - Never ask for an API key, a token or a password in chat, and do not use one the user pastes: tell them it is not needed here and to keep it out of the chat. A key goes in with `sideby key <ref>`, which the user runs in their own terminal (or **Enter key** in the Panel); it reads the key without showing it.
13
13
  - Do not run `sideby ask` to start another AI Task yourself.
14
- - sideby started this session with the Host's permission checks on (ADR-0031): it left out any permission bypass in the account's arguments, and Claude Code runs in auto mode, which checks risky actions first. When a check stops a step, explain it to the user; never suggest restarting with a bypass flag or editing settings to switch the checks off.
14
+ - By default sideby started this session with the Host's permission checks on (ADR-0031): it left out any permission bypass in the account's arguments, and Claude Code runs in auto mode, which checks risky actions first. When a check stops a step, explain it to the user; never suggest restarting with a bypass flag, editing settings to switch the checks off, or `sideby ask --permissions account` (see [AI Task permissions](#ai-task-permissions)). When the user set `ask.permissions` to `account`, the session got the account's own arguments, so the checks may be off: ask before every change all the same.
15
15
  - Say what you changed when you finish.
16
16
 
17
+ ## AI Task permissions
18
+
19
+ Config `ask.permissions` decides how every AI Task starts the account (ADR-0070). `checked`, the default, leaves out the arguments that skip the Host's permission checks and starts Claude Code in auto mode. `account` starts it with the account's own arguments, exactly as `sideby run` does, including a bypass such as `--dangerously-skip-permissions`; sideby adds no auto mode. The Panel has no switch for it on purpose.
20
+
21
+ - Read it with `sideby ask --permissions --json` (`{ permissions, file }`).
22
+ - Change it only when the user asks for it in their own words ("let AI Tasks skip permission prompts like my own sessions", "让 AI 任务也用我账号的参数", "AI 任务别再加 auto 模式"). Run `sideby ask --permissions account --json`: it exits 10 with `before` and `after`. Tell the user plainly that AI Tasks will then start with their account's own arguments and may run without permission checks, and add `--yes` only after a clear yes.
23
+ - `sideby ask --permissions checked --json` turns the checks back on; it also exits 10 first. Offer it when the user is unhappy with what an AI Task did without asking.
24
+ - Never switch it to `account` to get past a check that stopped you, and never suggest it as a fix.
25
+
17
26
  ## Attached files
18
27
 
19
28
  When the user added screenshots or videos, the prompt has an "Attached files" section (「附件」 in Chinese): one absolute path per line with its kind, `image` or `video`. sideby saved them under its own `ai/attachments/<task-id>/` folder as `1.png`, `2.mp4` and so on, and deletes them after 7 days.
@@ -34,4 +34,4 @@ The Panel's **Let AI help** (in the Network check dialog and on the wrong-networ
34
34
 
35
35
  ## When something was blocked
36
36
 
37
- A blocked Launch exits 1 with `code` `network-blocked` (wrong country) or `network-unknown` (could not tell). Inside a session the prompt or tool call is stopped with the same reason. Help the user check their proxy (is it running, which node), then run `sideby network check --json` to confirm. To go on once anyway, the user runs `sideby run <account> --ignore-network` (or `sideby next <family> --ignore-network`); never add it yourself without their say-so.
37
+ A blocked Launch exits 1 with `code` `network-blocked` (wrong country) or `network-unknown` (could not tell). Inside a session the prompt or tool call is stopped with the same reason. Help the user check their proxy (is it running, which node), then run `sideby network check --json` to confirm. To go on once anyway, the user runs `sideby run <account> --ignore-network` (or `sideby next <family> --ignore-network`); never add it yourself without their say-so. When the user wants the check gone, show `sideby network off --json` (exit 10, a preview), then run it with `--yes` once they agree; sessions already running follow config at once, so no restart is needed.