sideby 0.38.1 → 0.40.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 +6 -0
- package/dist/src/cli/commands.js +120 -1
- package/dist/src/cli/json-schemas.js +44 -2
- package/dist/src/cli/main.js +37 -0
- package/dist/src/core/cli-commands.js +26 -2
- package/dist/src/core/config.d.ts +14 -0
- package/dist/src/core/config.js +21 -0
- package/dist/src/core/launch.d.ts +5 -0
- package/dist/src/core/launch.js +11 -1
- package/dist/src/core/progress-state.d.ts +94 -0
- package/dist/src/core/progress-state.js +240 -0
- package/dist/src/core/progress.d.ts +36 -0
- package/dist/src/core/progress.js +77 -0
- package/dist/src/core/prompt-origin.d.ts +40 -0
- package/dist/src/core/prompt-origin.js +98 -0
- package/dist/src/core/search-catalog.js +43 -0
- package/dist/src/core/unattended-attended.d.ts +109 -0
- package/dist/src/core/unattended-attended.js +337 -0
- package/dist/src/core/unattended-pending.d.ts +14 -2
- package/dist/src/core/unattended-pending.js +27 -3
- package/dist/src/core/unattended-state.d.ts +19 -1
- package/dist/src/core/unattended-state.js +31 -5
- package/dist/src/core/unattended-wait.d.ts +86 -0
- package/dist/src/core/unattended-wait.js +125 -0
- package/dist/src/core/unattended.d.ts +29 -2
- package/dist/src/core/unattended.js +48 -6
- package/dist/src/handoff/hook.js +19 -4
- package/dist/src/network/hook.js +4 -8
- package/dist/src/panel/handler.d.ts +3 -0
- package/dist/src/panel/handler.js +31 -1
- package/dist/src/panel/i18n.d.ts +27 -0
- package/dist/src/panel/i18n.js +56 -2
- package/dist/src/panel/page-script.js +118 -4
- package/dist/src/panel/page-styles.js +21 -0
- package/dist/src/progress/hook.d.ts +57 -0
- package/dist/src/progress/hook.js +258 -0
- package/dist/src/runtime.d.ts +9 -0
- package/dist/src/runtime.js +45 -2
- package/dist/src/types.d.ts +5 -0
- package/dist/src/unattended/hook.d.ts +26 -6
- package/dist/src/unattended/hook.js +361 -25
- package/package.json +1 -1
- package/schemas/config.json +27 -0
- package/schemas/progress.json +137 -0
- package/schemas/unattended-defer.json +5 -0
- package/schemas/unattended-pending.json +5 -0
- package/schemas/unattended.json +54 -2
- package/skills/sideby/SKILL.md +4 -1
- package/skills/sideby/references/progress.md +25 -0
- package/skills/sideby/references/unattended.md +25 -3
package/dist/src/runtime.js
CHANGED
|
@@ -20,7 +20,10 @@ import { memoStore } from './core/memo-store.js';
|
|
|
20
20
|
import { codexNetworkTrustLine, guardLaunch, guardOn, ipChangedLine, networkHookPart, networkOverview, networkSettingsLine, } from './core/network.js';
|
|
21
21
|
import { resolvePaths } from './core/paths.js';
|
|
22
22
|
import { choosePick, suggestPickName } from './core/pick-commands.js';
|
|
23
|
+
import { PROGRESS_FAMILIES, progressHookPart, progressSettingsLine, progressView, setProgress, } from './core/progress.js';
|
|
24
|
+
import { PROGRESS_ENV, validEvery } from './core/progress-state.js';
|
|
23
25
|
import { categoryReader } from './core/project-categories.js';
|
|
26
|
+
import { LAUNCH_PROMPTS_ENV, LAUNCH_PROMPTS_UNSET } from './core/prompt-origin.js';
|
|
24
27
|
import { FETCH_TIMEOUT_MS, fetchedQuota, loginProblemOf, quotaCheckOff, shownQuota, } from './core/quota-fetch.js';
|
|
25
28
|
import { takeoverLimits } from './core/quota-levels.js';
|
|
26
29
|
import { quotaStoreFile, readQuotaStore } from './core/quota-store.js';
|
|
@@ -150,8 +153,27 @@ export async function createRuntime(opts = {}) {
|
|
|
150
153
|
}
|
|
151
154
|
if (p.family.id === 'codex')
|
|
152
155
|
addNotice(p, [await codexUnattendedTrustLine(paths.stateDir, p.account.ref, p.env)]);
|
|
156
|
+
// Which prompts sideby put on the command line, so the hook never takes one for typed (ADR-0075): filled in from
|
|
157
|
+
// the final arguments where the Host starts (`spawnHost`); left as it is, the session counts no prompt as typed.
|
|
158
|
+
if (p.family.id === 'claude')
|
|
159
|
+
p.env[LAUNCH_PROMPTS_ENV] = LAUNCH_PROMPTS_UNSET;
|
|
153
160
|
return unattendedHookPart();
|
|
154
161
|
};
|
|
162
|
+
/**
|
|
163
|
+
* Progress Reminders on a Claude session sideby starts (spec §3.42): their hooks while config `progress.every` is
|
|
164
|
+
* set, and the interval at launch in the environment (used only when the config cannot be read).
|
|
165
|
+
*/
|
|
166
|
+
const progressPrepared = (p) => {
|
|
167
|
+
const every = config.progress?.every;
|
|
168
|
+
if (!validEvery(every) || !PROGRESS_FAMILIES.includes(p.family.id))
|
|
169
|
+
return null;
|
|
170
|
+
if (hasOption(p.args, ['--settings'])) {
|
|
171
|
+
addNotice(p, [progressSettingsLine(p.env)]);
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
p.env[PROGRESS_ENV] = String(every);
|
|
175
|
+
return progressHookPart();
|
|
176
|
+
};
|
|
155
177
|
/** Puts every session hook into the Launch's arguments: one `--settings` for Claude, `-c hooks.*` for Codex. */
|
|
156
178
|
const addSessionHooks = async (p, list) => {
|
|
157
179
|
const parts = list.filter((x) => x !== null);
|
|
@@ -163,13 +185,18 @@ export async function createRuntime(opts = {}) {
|
|
|
163
185
|
p.networkArgs = args;
|
|
164
186
|
p.args = beforeDashes(p.args, args);
|
|
165
187
|
};
|
|
166
|
-
/**
|
|
188
|
+
/**
|
|
189
|
+
* Network Guard, Unattended Mode and Progress Reminders on a prepared Launch, in that order; hooks only for a session
|
|
190
|
+
* (`run`).
|
|
191
|
+
*/
|
|
167
192
|
const sessionReady = async (p, session, o) => {
|
|
168
193
|
const parts = [];
|
|
169
194
|
if (!o.ignoreNetwork)
|
|
170
195
|
parts.push(await guardPrepared(p, session));
|
|
171
196
|
if (session)
|
|
172
197
|
parts.push(await unattendedPrepared(p, Boolean(o.unattended)));
|
|
198
|
+
if (session)
|
|
199
|
+
parts.push(progressPrepared(p));
|
|
173
200
|
await addSessionHooks(p, parts);
|
|
174
201
|
};
|
|
175
202
|
const familyOf = (id) => {
|
|
@@ -1003,6 +1030,8 @@ export async function createRuntime(opts = {}) {
|
|
|
1003
1030
|
config.ask = fresh.ask;
|
|
1004
1031
|
config.advisor = fresh.advisor;
|
|
1005
1032
|
config.claude = fresh.claude;
|
|
1033
|
+
// Progress Reminders turned on, off or to another interval reach the next session a chain starts too.
|
|
1034
|
+
config.progress = fresh.progress;
|
|
1006
1035
|
}
|
|
1007
1036
|
const all = await accounts();
|
|
1008
1037
|
const inputs = launchInputs(ref, all, userArgs, command);
|
|
@@ -1065,7 +1094,8 @@ export async function createRuntime(opts = {}) {
|
|
|
1065
1094
|
const guarded = async (h) => {
|
|
1066
1095
|
const net = !ro.ignoreNetwork && guardOn(config, h.env);
|
|
1067
1096
|
const unattended = Boolean(ro.unattended) || config.unattended !== undefined;
|
|
1068
|
-
|
|
1097
|
+
const progress = validEvery(config.progress?.every) && PROGRESS_FAMILIES.includes(family.id);
|
|
1098
|
+
if (!net && !unattended && !progress)
|
|
1069
1099
|
return h;
|
|
1070
1100
|
const main = (await accounts()).find((a) => a.family === family.id && a.isMain);
|
|
1071
1101
|
if (!main)
|
|
@@ -1387,6 +1417,19 @@ export async function createRuntime(opts = {}) {
|
|
|
1387
1417
|
config.quota = r.after;
|
|
1388
1418
|
return { changed: r.changed };
|
|
1389
1419
|
},
|
|
1420
|
+
progressView: () => progressView(config),
|
|
1421
|
+
async setProgress(every) {
|
|
1422
|
+
const r = await setProgress(paths.configFile, every);
|
|
1423
|
+
if (r.config === undefined)
|
|
1424
|
+
delete config.progress;
|
|
1425
|
+
else
|
|
1426
|
+
config.progress = r.config;
|
|
1427
|
+
return {
|
|
1428
|
+
changed: r.changed,
|
|
1429
|
+
...(r.before === undefined ? {} : { before: r.before }),
|
|
1430
|
+
...(r.after === undefined ? {} : { after: r.after }),
|
|
1431
|
+
};
|
|
1432
|
+
},
|
|
1390
1433
|
displayOrder: () => config.display ?? {},
|
|
1391
1434
|
async setDisplayOrder(display) {
|
|
1392
1435
|
const r = await editConfigDisplay(paths.configFile, display);
|
package/dist/src/types.d.ts
CHANGED
|
@@ -738,6 +738,11 @@ export interface PendingDecisionInfo {
|
|
|
738
738
|
agentType?: string;
|
|
739
739
|
/** The question with its options, the tool and what it was to do, or the deferred text (at most 4000 characters). */
|
|
740
740
|
text: string;
|
|
741
|
+
/**
|
|
742
|
+
* Minutes the question or permission prompt was on screen with nobody answering before the session went on without
|
|
743
|
+
* an answer (Answer Wait, spec §3.37). Absent when it was never shown.
|
|
744
|
+
*/
|
|
745
|
+
waited?: number;
|
|
741
746
|
doneAt?: string;
|
|
742
747
|
}
|
|
743
748
|
/**
|
|
@@ -9,6 +9,12 @@ export interface UnattendedHookDeps {
|
|
|
9
9
|
sleep?: (ms: number) => Promise<void>;
|
|
10
10
|
/** Whether the Host that started the hook is gone (`ppid` 1 by default): nothing is left to wake. */
|
|
11
11
|
parentGone?: () => boolean;
|
|
12
|
+
/** The Host's pid, whose session record says what is on screen (Answer Wait); `process.ppid` by default. */
|
|
13
|
+
hostPid?: number;
|
|
14
|
+
/** Answer Wait, for tests: runs once the wait is over, before the last check. */
|
|
15
|
+
beforeAct?: () => Promise<unknown>;
|
|
16
|
+
/** Answer Wait, for tests: runs after the Pending Decision is kept, before the check that may take it back. */
|
|
17
|
+
afterKeep?: () => Promise<unknown>;
|
|
12
18
|
}
|
|
13
19
|
/**
|
|
14
20
|
* The question as the user should read it later: each question (with its short header) and its options' labels.
|
|
@@ -16,8 +22,11 @@ export interface UnattendedHookDeps {
|
|
|
16
22
|
* the tool's input.
|
|
17
23
|
*/
|
|
18
24
|
export declare function questionText(input: Record<string, unknown>): string;
|
|
19
|
-
/**
|
|
20
|
-
|
|
25
|
+
/**
|
|
26
|
+
* What the model reads instead of an answer. `waited`: the question was on screen this many minutes with nobody
|
|
27
|
+
* answering (Answer Wait); the session shows the text too, so it opens with what happened for the person coming back.
|
|
28
|
+
*/
|
|
29
|
+
export declare function questionReason(state: UnattendedState, now: Date, zh: boolean, kept: boolean, waited?: number): string;
|
|
21
30
|
/** How much of the end of the model's last message is read to tell whether it ends on a question. */
|
|
22
31
|
export declare const QUESTION_TAIL = 600;
|
|
23
32
|
/**
|
|
@@ -34,8 +43,11 @@ export declare const QUESTION_PATTERNS: readonly RegExp[];
|
|
|
34
43
|
* paragraph (and the one before it when the last is a list), unless a negation comes just before it ("无需你来决定").
|
|
35
44
|
*/
|
|
36
45
|
export declare function endingQuestion(message: string): string | undefined;
|
|
37
|
-
/**
|
|
38
|
-
|
|
46
|
+
/**
|
|
47
|
+
* What the model reads when it ended its turn on a question and nobody is here to answer. `waited`: the question was
|
|
48
|
+
* left this many minutes with no reply (Answer Wait); this note then wakes the session, and is not the user's reply.
|
|
49
|
+
*/
|
|
50
|
+
export declare function stopReason(state: UnattendedState, now: Date, zh: boolean, kept: boolean, waited?: number): string;
|
|
39
51
|
/** What a declined MCP form is kept as: the server's name and what it asked, never a field's value. */
|
|
40
52
|
export declare function elicitationText(v: Record<string, unknown>): string;
|
|
41
53
|
/**
|
|
@@ -52,8 +64,16 @@ export declare function commandProgram(command: string): string | undefined;
|
|
|
52
64
|
* other tool its name only.
|
|
53
65
|
*/
|
|
54
66
|
export declare function permissionText(tool: string, input: Record<string, unknown>): string;
|
|
55
|
-
/**
|
|
56
|
-
|
|
67
|
+
/**
|
|
68
|
+
* What the model reads instead of the permission prompt Claude Code would have shown. `waited`: the prompt was on
|
|
69
|
+
* screen this many minutes with nobody answering (Answer Wait).
|
|
70
|
+
*/
|
|
71
|
+
export declare function permissionReason(state: UnattendedState, now: Date, kept: boolean, waited?: number): string;
|
|
72
|
+
/**
|
|
73
|
+
* What the user reads once in an Attended Session while Unattended Mode is on (ADR-0075), as a `systemMessage`: shown
|
|
74
|
+
* in the session, never to the model.
|
|
75
|
+
*/
|
|
76
|
+
export declare function attendedNotice(state: UnattendedState, zh: boolean): string;
|
|
57
77
|
/**
|
|
58
78
|
* Returns the exit code: 0 lets the Host go on, 2 refuses the tool call (the reason is written to `err`). A permission
|
|
59
79
|
* request, a stop on a question and an MCP form are answered with exit 0 and the decision written to `out`. Errors
|