toolroll 0.9.116 → 0.9.118
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/CHANGELOG.md +46 -0
- package/README.md +43 -26
- package/dist/acp-agents.js +14 -1
- package/dist/acp-client.js +19 -1
- package/dist/agent-change-check.js +60 -0
- package/dist/agent-change-schema.js +19 -0
- package/dist/agent-detect.js +11 -1
- package/dist/agent-fence.js +93 -16
- package/dist/agent-network-request.js +108 -0
- package/dist/agent-requests.js +105 -0
- package/dist/approval-summary.js +3 -3
- package/dist/backup.js +17 -1
- package/dist/batch-checks.js +81 -18
- package/dist/browser/terminal.js +41 -41
- package/dist/browser/workspace.css +2 -2
- package/dist/browser/workspace.js +36 -36
- package/dist/builder.js +12 -2
- package/dist/candidate-materialize.js +119 -0
- package/dist/central-enrollment-contract.js +156 -0
- package/dist/central-recovery-stage.js +329 -0
- package/dist/chat-actions.js +101 -2
- package/dist/chat-channel.js +40 -0
- package/dist/check-only-standing.js +13 -0
- package/dist/check-only.js +25 -13
- package/dist/check-recovery-hold.js +199 -0
- package/dist/check-recovery-index-schema.js +3 -0
- package/dist/check-screenshots.js +83 -0
- package/dist/cli.js +125 -6
- package/dist/codex-limits.js +4 -0
- package/dist/coding-context.js +16 -2
- package/dist/coding-provider.js +7 -3
- package/dist/coding-workspace.js +5 -5
- package/dist/connect-cli.js +257 -11
- package/dist/contracts/chat-actions.js +4 -0
- package/dist/contracts/console-api.js +14 -3
- package/dist/contracts/engine-api.js +331 -2
- package/dist/contracts/lead-tools.js +56 -2
- package/dist/contracts/provider.js +1 -1
- package/dist/contracts/route.js +1 -1
- package/dist/contracts/terminal-connection.js +50 -0
- package/dist/converse.js +80 -4
- package/dist/device-pair.js +280 -0
- package/dist/direct-chat-artifacts.js +347 -0
- package/dist/direct-chat-catalog.js +311 -0
- package/dist/direct-chat-fence.js +96 -0
- package/dist/direct-chat-git.js +343 -0
- package/dist/direct-chat-laptop.js +19 -0
- package/dist/direct-chat-schema.js +181 -0
- package/dist/direct-chat-ship.js +861 -0
- package/dist/direct-chat-workspace.js +389 -0
- package/dist/direct-chat.js +2107 -0
- package/dist/doctor.js +1 -1
- package/dist/easy-start.js +18 -0
- package/dist/egress.js +25 -4
- package/dist/engine-chat.js +454 -0
- package/dist/engine-reads.js +141 -13
- package/dist/exec.js +4 -3
- package/dist/flexible-agents.js +8 -16
- package/dist/flexible-session.js +91 -47
- package/dist/flexible-ship.js +87 -7
- package/dist/flexible-start.js +4 -1
- package/dist/flexible-thread.js +2 -3
- package/dist/flexible-turns.js +26 -5
- package/dist/flow-triggers.js +13 -4
- package/dist/flows-ui.js +54 -20
- package/dist/handoff-cli.js +630 -0
- package/dist/invoke.js +71 -17
- package/dist/lead-contract.js +5 -4
- package/dist/lead-doors.js +80 -1
- package/dist/lead-progress.js +9 -0
- package/dist/lead-tools.js +681 -10
- package/dist/lead.js +37 -9
- package/dist/live-bus.js +11 -0
- package/dist/live-terminal.js +132 -12
- package/dist/local-handoff.js +363 -0
- package/dist/local-owner-acts.js +264 -2
- package/dist/local-owner.js +16 -1
- package/dist/multiplayer-handoff.js +528 -0
- package/dist/multiplayer-presence.js +471 -0
- package/dist/names.js +17 -4
- package/dist/needs-you.js +10 -0
- package/dist/operate.js +280 -19
- package/dist/planner.js +6 -1
- package/dist/policy.js +2 -2
- package/dist/project-delete-ui.js +18 -11
- package/dist/project-delete.js +65 -4
- package/dist/project-skills.js +28 -13
- package/dist/project-tools.js +1 -1
- package/dist/prompt.js +1 -1
- package/dist/provider-connection.js +2 -0
- package/dist/provider-home.js +251 -8
- package/dist/provider.js +3 -2
- package/dist/publish.js +119 -64
- package/dist/pull-request-flow.js +35 -14
- package/dist/read-executor-worker.js +1 -1
- package/dist/read-executor.js +95 -1
- package/dist/restore-retirement.js +152 -0
- package/dist/result-follow-ups.js +116 -37
- package/dist/route-change.js +44 -4
- package/dist/scope.js +62 -5
- package/dist/scout.js +6 -2
- package/dist/serve.js +49 -5
- package/dist/server/chat.js +94 -13
- package/dist/server/direct-chat.js +583 -0
- package/dist/server/engine-api.js +219 -21
- package/dist/server/flows.js +43 -10
- package/dist/server/found-repos.js +25 -0
- package/dist/server/guards.js +20 -6
- package/dist/server/live.js +81 -23
- package/dist/server/pages.js +67 -13
- package/dist/server/people-tokens.js +47 -6
- package/dist/server/remote.js +29 -0
- package/dist/server/render-results.js +6 -2
- package/dist/server/render-settings.js +4 -2
- package/dist/server/render-tasks.js +18 -17
- package/dist/server/route-table.js +69 -2
- package/dist/server/settings.js +22 -7
- package/dist/server/task-views.js +15 -3
- package/dist/server/tasks.js +39 -2
- package/dist/server/terminals.js +185 -11
- package/dist/settings-proofs.js +1 -1
- package/dist/skills-manifest.js +57 -0
- package/dist/store.js +499 -56
- package/dist/subscription-chat.js +33 -6
- package/dist/subscription-usage.js +233 -0
- package/dist/task-live.js +2 -1
- package/dist/teardown-git.js +34 -4
- package/dist/terminal-connection.js +159 -0
- package/dist/tui/darwin-arm64/toolroll-tui +0 -0
- package/dist/tui/darwin-x64/toolroll-tui +0 -0
- package/dist/tui/linux-arm64/toolroll-tui +0 -0
- package/dist/tui/linux-x64/toolroll-tui +0 -0
- package/dist/tui-contract.js +1 -1
- package/dist/tui-launch.js +32 -1
- package/dist/workspace-identity-schema.js +21 -0
- package/package.json +4 -2
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { RECOVERY_GENERATION_PATTERN } from "./workspace-identity-schema.js";
|
|
4
|
+
export const CHECK_RECOVERY_HELD = "checks recovery held";
|
|
5
|
+
const REQUESTED = "checks requested", FAMILY_LIMIT = 256;
|
|
6
|
+
const id = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
|
|
7
|
+
const text = z.string().max(4096);
|
|
8
|
+
const requestSchema = z.object({ id, repo: text.nullable(), runId: id, taskId: z.string().min(1).max(512),
|
|
9
|
+
action: z.literal(REQUESTED), outcome: z.enum(["quick", "full"]), detail: z.string().min(1).max(4096),
|
|
10
|
+
}).strict();
|
|
11
|
+
const detailSchema = z.object({ v: z.literal(1), q: z.string().regex(/^[0-9a-f]{64}$/),
|
|
12
|
+
g: z.string().regex(RECOVERY_GENERATION_PATTERN), r: id,
|
|
13
|
+
}).strict();
|
|
14
|
+
export function representCheckHoldDetail(input) {
|
|
15
|
+
const parsed = detailSchema.safeParse(input);
|
|
16
|
+
return parsed.success ? JSON.stringify(parsed.data) : null;
|
|
17
|
+
}
|
|
18
|
+
export function parseCheckHoldDetail(raw) {
|
|
19
|
+
if (typeof raw !== "string" || Buffer.byteLength(raw, "utf8") > 300)
|
|
20
|
+
return null;
|
|
21
|
+
try {
|
|
22
|
+
const parsed = detailSchema.safeParse(JSON.parse(raw));
|
|
23
|
+
return parsed.success && JSON.stringify(parsed.data) === raw ? parsed.data : null;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function checkRequestDigest(input) {
|
|
30
|
+
const parsed = requestSchema.safeParse(input);
|
|
31
|
+
if (!parsed.success)
|
|
32
|
+
return null;
|
|
33
|
+
const q = parsed.data, parts = q.detail.split(" · ");
|
|
34
|
+
if ((parts.length !== 3 && parts.length !== 4) || !/^[0-9a-f]{40}$/.test(parts[0])
|
|
35
|
+
|| !["person", "pull-request", "batch", "recheck"].includes(parts[1]) || !/^(?:[0-9a-f]{16}|[0-9a-f]{64})$/.test(parts[2])
|
|
36
|
+
|| (parts.length === 4 && (parts[1] !== "batch" || (parts[3] !== "" && !/^[0-9a-f]{40}$/.test(parts[3])))))
|
|
37
|
+
return null;
|
|
38
|
+
return createHash("sha256").update(JSON.stringify([1, q.id, q.repo, q.runId, q.taskId, q.action, q.outcome, q.detail])).digest("hex");
|
|
39
|
+
}
|
|
40
|
+
const whole = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
41
|
+
function refOf(row) {
|
|
42
|
+
if (row === undefined || !whole(row["id"]) || row["backend"] !== "built-in" || typeof row["external_id"] !== "string"
|
|
43
|
+
|| (row["repo"] !== null && typeof row["repo"] !== "string") || (row["revision_of"] !== null && typeof row["revision_of"] !== "string")
|
|
44
|
+
|| (row["revision_brief_artifact"] !== null && !whole(row["revision_brief_artifact"])))
|
|
45
|
+
return null;
|
|
46
|
+
return row;
|
|
47
|
+
}
|
|
48
|
+
function family(store, seed) {
|
|
49
|
+
const refs = new Map(), pending = [seed];
|
|
50
|
+
const byId = (n) => refOf(store.handle.prepare("SELECT * FROM task_ref WHERE id = ?").get(n));
|
|
51
|
+
const byName = (name) => {
|
|
52
|
+
const rows = store.handle.prepare("SELECT * FROM task_ref WHERE backend = 'built-in' AND external_id = ? LIMIT 2").all(name);
|
|
53
|
+
return rows.length === 1 ? refOf(rows[0]) : null;
|
|
54
|
+
};
|
|
55
|
+
const revision = (child, parent) => {
|
|
56
|
+
if (child.repo !== parent.repo || child.revision_of !== parent.external_id || child.revision_brief_artifact === null)
|
|
57
|
+
return false;
|
|
58
|
+
const proof = store.handle.prepare("SELECT a.kind, r.task_ref FROM artifact a JOIN run r ON r.id = a.run WHERE a.id = ?").get(child.revision_brief_artifact);
|
|
59
|
+
return proof?.["kind"] === "revision-brief" && proof["task_ref"] === parent.id;
|
|
60
|
+
};
|
|
61
|
+
while (pending.length > 0) {
|
|
62
|
+
const at = pending.pop();
|
|
63
|
+
if (refs.has(at.id))
|
|
64
|
+
continue;
|
|
65
|
+
if (refs.size >= FAMILY_LIMIT)
|
|
66
|
+
return { problem: "family-bound-exceeded" };
|
|
67
|
+
if (at.repo !== seed.repo || store.handle.prepare("SELECT 1 FROM task WHERE id = ?").get(at.external_id) === undefined)
|
|
68
|
+
return { problem: "family-scope-mismatch" };
|
|
69
|
+
refs.set(at.id, at);
|
|
70
|
+
if (at.revision_of !== null) {
|
|
71
|
+
const parent = byName(at.revision_of);
|
|
72
|
+
if (parent === null || !revision(at, parent))
|
|
73
|
+
return { problem: "invalid-revision-lineage" };
|
|
74
|
+
pending.push(parent);
|
|
75
|
+
}
|
|
76
|
+
for (const row of store.handle.prepare("SELECT * FROM task_ref WHERE backend = 'built-in' AND revision_of = ? LIMIT ?").all(at.external_id, FAMILY_LIMIT + 1)) {
|
|
77
|
+
const child = refOf(row);
|
|
78
|
+
if (child === null || !revision(child, at))
|
|
79
|
+
return { problem: "invalid-revision-lineage" };
|
|
80
|
+
pending.push(child);
|
|
81
|
+
}
|
|
82
|
+
for (const row of store.handle.prepare("SELECT task_ref, successor FROM task_replacement WHERE task_ref = ? OR successor = ? LIMIT ?").all(at.id, at.external_id, FAMILY_LIMIT + 1)) {
|
|
83
|
+
const predecessor = whole(row["task_ref"]) ? byId(row["task_ref"]) : null;
|
|
84
|
+
const successor = typeof row["successor"] === "string" ? byName(row["successor"]) : null;
|
|
85
|
+
if (predecessor === null || successor === null || predecessor.repo !== successor.repo)
|
|
86
|
+
return { problem: "invalid-replacement-lineage" };
|
|
87
|
+
pending.push(predecessor, successor);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const edges = new Map();
|
|
91
|
+
for (const at of refs.values()) {
|
|
92
|
+
if (at.revision_of !== null) {
|
|
93
|
+
const parent = [...refs.values()].find(r => r.external_id === at.revision_of);
|
|
94
|
+
if (parent === undefined)
|
|
95
|
+
return { problem: "missing-family-parent" };
|
|
96
|
+
edges.set(at.id, [...(edges.get(at.id) ?? []), parent.id]);
|
|
97
|
+
}
|
|
98
|
+
for (const row of store.handle.prepare("SELECT successor FROM task_replacement WHERE task_ref = ?").all(at.id)) {
|
|
99
|
+
const successor = [...refs.values()].find(r => r.external_id === row["successor"]);
|
|
100
|
+
if (successor === undefined)
|
|
101
|
+
return { problem: "missing-replacement" };
|
|
102
|
+
edges.set(successor.id, [...(edges.get(successor.id) ?? []), at.id]);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const done = new Set(), visiting = new Set();
|
|
106
|
+
const cycle = (n) => {
|
|
107
|
+
if (visiting.has(n))
|
|
108
|
+
return true;
|
|
109
|
+
if (done.has(n))
|
|
110
|
+
return false;
|
|
111
|
+
visiting.add(n);
|
|
112
|
+
if ((edges.get(n) ?? []).some(cycle))
|
|
113
|
+
return true;
|
|
114
|
+
visiting.delete(n);
|
|
115
|
+
done.add(n);
|
|
116
|
+
return false;
|
|
117
|
+
};
|
|
118
|
+
if ([...refs.keys()].some(cycle))
|
|
119
|
+
return { problem: "cyclic-family" };
|
|
120
|
+
return { refs: [...refs.values()].sort((a, b) => a.id - b.id) };
|
|
121
|
+
}
|
|
122
|
+
function result(kind, reason, refs = [], holds = []) {
|
|
123
|
+
return Object.freeze({ kind, reason, familyRefs: Object.freeze([...refs]), holds: Object.freeze([...holds]),
|
|
124
|
+
runtimeProtection: false, retirementSupported: false, nativeStopProof: false });
|
|
125
|
+
}
|
|
126
|
+
export function readCheckRecoveryHoldsForRun(store, runId) {
|
|
127
|
+
if (!whole(runId))
|
|
128
|
+
return result("invalid-evidence", "invalid-run-id");
|
|
129
|
+
try {
|
|
130
|
+
return readSnapshot(store, () => {
|
|
131
|
+
const run = store.handle.prepare("SELECT task_ref FROM run WHERE id = ?").get(runId);
|
|
132
|
+
const seed = run !== undefined && whole(run["task_ref"]) ? refOf(store.handle.prepare("SELECT * FROM task_ref WHERE id = ?").get(run["task_ref"])) : null;
|
|
133
|
+
if (seed === null)
|
|
134
|
+
return result("invalid-evidence", "missing-run-ref");
|
|
135
|
+
return readCheckRecoveryHoldsAtRef(store, seed.id);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return result("invalid-evidence", "unreadable-evidence");
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function readSnapshot(store, body) {
|
|
143
|
+
store.handle.exec("SAVEPOINT ch0_check_hold_read");
|
|
144
|
+
try {
|
|
145
|
+
return body();
|
|
146
|
+
}
|
|
147
|
+
finally {
|
|
148
|
+
store.handle.exec("RELEASE SAVEPOINT ch0_check_hold_read");
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
export function readCheckRecoveryHoldsForTaskRef(store, taskRefId) {
|
|
152
|
+
if (!whole(taskRefId))
|
|
153
|
+
return result("invalid-evidence", "invalid-task-ref");
|
|
154
|
+
try {
|
|
155
|
+
return readSnapshot(store, () => readCheckRecoveryHoldsAtRef(store, taskRefId));
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
return result("invalid-evidence", "unreadable-evidence");
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function readCheckRecoveryHoldsAtRef(store, taskRefId) {
|
|
162
|
+
const seed = refOf(store.handle.prepare("SELECT * FROM task_ref WHERE id = ?").get(taskRefId));
|
|
163
|
+
if (seed === null)
|
|
164
|
+
return result("invalid-evidence", "missing-task-ref");
|
|
165
|
+
const found = family(store, seed);
|
|
166
|
+
if ("problem" in found)
|
|
167
|
+
return result("invalid-evidence", found.problem);
|
|
168
|
+
const ids = found.refs.map(r => r.id), serialized = JSON.stringify(ids), names = JSON.stringify(found.refs.map(r => r.external_id));
|
|
169
|
+
const events = store.handle.prepare(`SELECT h.* FROM action_ledger h WHERE h.action = ? AND
|
|
170
|
+
(h.run_id IN (SELECT id FROM run WHERE task_ref IN (SELECT value FROM json_each(?)))
|
|
171
|
+
OR h.task_id IN (SELECT value FROM json_each(?))
|
|
172
|
+
OR (CASE WHEN json_valid(h.detail) THEN json_extract(h.detail, '$.r') ELSE NULL END) IN (SELECT value FROM json_each(?))
|
|
173
|
+
OR EXISTS (SELECT 1 FROM action_ledger q WHERE q.id = CAST(h.outcome AS INTEGER) AND CAST(q.id AS TEXT) = h.outcome AND
|
|
174
|
+
(q.task_id IN (SELECT value FROM json_each(?)) OR q.run_id IN
|
|
175
|
+
(SELECT id FROM run WHERE task_ref IN (SELECT value FROM json_each(?)))))) ORDER BY h.id`)
|
|
176
|
+
.all(CHECK_RECOVERY_HELD, serialized, names, serialized, names, serialized);
|
|
177
|
+
const holds = [];
|
|
178
|
+
for (const event of events) {
|
|
179
|
+
if (typeof event["outcome"] !== "string" || !/^[1-9][0-9]*$/.test(event["outcome"]))
|
|
180
|
+
return result("invalid-evidence", "invalid-request-id", ids);
|
|
181
|
+
const requestId = Number(event["outcome"]), detail = parseCheckHoldDetail(event["detail"]);
|
|
182
|
+
if (!whole(requestId) || detail === null || !whole(event["id"]) || event["id"] <= requestId
|
|
183
|
+
|| event["source"] !== "work" || event["actor"] !== "toolroll")
|
|
184
|
+
return result("invalid-evidence", "invalid-hold-event", ids);
|
|
185
|
+
const q = store.handle.prepare("SELECT * FROM action_ledger WHERE id = ?").get(requestId);
|
|
186
|
+
if (q === undefined || !whole(q["run_id"]))
|
|
187
|
+
return result("invalid-evidence", "missing-request", ids);
|
|
188
|
+
const actual = { id: q["id"], repo: q["repo"], runId: q["run_id"], taskId: q["task_id"], action: q["action"], outcome: q["outcome"], detail: q["detail"] };
|
|
189
|
+
const hashed = checkRequestDigest(actual);
|
|
190
|
+
const qrun = store.handle.prepare("SELECT task_ref FROM run WHERE id = ?").get(q["run_id"]);
|
|
191
|
+
const ref = found.refs.find(r => r.id === qrun?.["task_ref"]);
|
|
192
|
+
if (hashed === null || hashed !== detail.q || ref === undefined || detail.r !== ref.id || ref.repo !== q["repo"] || ref.external_id !== q["task_id"]
|
|
193
|
+
|| event["run_id"] !== q["run_id"] || event["repo"] !== q["repo"] || event["task_id"] !== q["task_id"])
|
|
194
|
+
return result("invalid-evidence", "hold-binding-mismatch", ids);
|
|
195
|
+
holds.push(Object.freeze({ event: event["id"], request: requestId, run: q["run_id"], taskRef: ref.id, repo: ref.repo,
|
|
196
|
+
recoveryGeneration: detail.g, admission: "blocked", priorExecution: "unverified" }));
|
|
197
|
+
}
|
|
198
|
+
return result(holds.length === 0 ? "no-evidence" : "held-evidence", holds.length === 0 ? "no-hold-evidence" : "recognized-only-not-enforced", ids, holds);
|
|
199
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { lstatSync, readdirSync, realpathSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { readMailbox, SCREENSHOT_BYTE_CAP, storeEvidence, validateScreenshotBytes } from "./evidence.js";
|
|
4
|
+
export const CHECK_SHOTS_DIR = "evidence/checks";
|
|
5
|
+
export const CHECK_SHOTS_MAX = 8;
|
|
6
|
+
const IMAGE_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,99}\.(?:png|jpe?g)$/i;
|
|
7
|
+
const FOLDER_PROBLEM = "the folder isn't a plain folder inside the checkout";
|
|
8
|
+
export const checkScreenshotCapture = (path, commit, kind) => `check screenshot at ${path} of ${commit} (validated ${kind})`;
|
|
9
|
+
export const CHECK_SCREENSHOT_CAPTURE = /^check screenshot at (evidence\/checks\/[^ ]+) of ([a-f0-9]{40}) \(validated (?:png|jpeg)\)$/;
|
|
10
|
+
export function collectCheckScreenshots(checkout) {
|
|
11
|
+
let root;
|
|
12
|
+
try {
|
|
13
|
+
root = realpathSync(checkout);
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return { files: [], problems: [] };
|
|
17
|
+
}
|
|
18
|
+
const folder = join(root, CHECK_SHOTS_DIR);
|
|
19
|
+
for (const at of [join(root, "evidence"), folder]) {
|
|
20
|
+
let held;
|
|
21
|
+
try {
|
|
22
|
+
held = lstatSync(at);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return { files: [], problems: [] };
|
|
26
|
+
}
|
|
27
|
+
if (!held.isDirectory() || held.isSymbolicLink())
|
|
28
|
+
return { files: [], problems: [{ path: CHECK_SHOTS_DIR, problem: FOLDER_PROBLEM }] };
|
|
29
|
+
}
|
|
30
|
+
let real;
|
|
31
|
+
try {
|
|
32
|
+
real = realpathSync(folder);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return { files: [], problems: [{ path: CHECK_SHOTS_DIR, problem: FOLDER_PROBLEM }] };
|
|
36
|
+
}
|
|
37
|
+
if (real !== folder)
|
|
38
|
+
return { files: [], problems: [{ path: CHECK_SHOTS_DIR, problem: FOLDER_PROBLEM }] };
|
|
39
|
+
let names;
|
|
40
|
+
try {
|
|
41
|
+
names = readdirSync(folder).filter(name => IMAGE_NAME.test(name)).sort();
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return { files: [], problems: [{ path: CHECK_SHOTS_DIR, problem: "the folder couldn't be listed" }] };
|
|
45
|
+
}
|
|
46
|
+
const out = { files: [], problems: [] };
|
|
47
|
+
for (const name of names) {
|
|
48
|
+
const path = `${CHECK_SHOTS_DIR}/${name}`;
|
|
49
|
+
if (out.files.length >= CHECK_SHOTS_MAX) {
|
|
50
|
+
out.problems.push({ path, problem: `only the first ${CHECK_SHOTS_MAX} screenshots are kept` });
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
const read = readMailbox(join(folder, name), SCREENSHOT_BYTE_CAP);
|
|
54
|
+
if (!read.ok) {
|
|
55
|
+
out.problems.push({ path, problem: read.problem });
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const valid = validateScreenshotBytes(read.raw);
|
|
59
|
+
if (!valid.ok) {
|
|
60
|
+
out.problems.push({ path, problem: valid.problem });
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
out.files.push({ path, raw: read.raw, kind: valid.kind });
|
|
64
|
+
}
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
export function keepCheckScreenshots(store, root, runId, checkout, commit, now) {
|
|
68
|
+
if (!/^[a-f0-9]{40}$/.test(commit))
|
|
69
|
+
return [];
|
|
70
|
+
const shots = collectCheckScreenshots(checkout);
|
|
71
|
+
try {
|
|
72
|
+
shots.files.forEach((one, at) => {
|
|
73
|
+
storeEvidence(store, root, runId, "screenshot", `check-shot-${at + 1}.${one.kind === "png" ? "png" : "jpg"}`, one.raw, checkScreenshotCapture(one.path, commit, one.kind), now, { captureStatus: "ok" });
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
return [`The screenshots in ${CHECK_SHOTS_DIR} couldn't be kept: ${error instanceof Error ? error.message : String(error)}.`];
|
|
78
|
+
}
|
|
79
|
+
return [
|
|
80
|
+
...(shots.files.length === 0 ? [] : [`Kept ${shots.files.length} screenshot${shots.files.length === 1 ? "" : "s"} from ${CHECK_SHOTS_DIR}.`]),
|
|
81
|
+
...shots.problems.map(one => `Not kept: ${one.path}: ${one.problem}.`),
|
|
82
|
+
];
|
|
83
|
+
}
|
package/dist/cli.js
CHANGED
|
@@ -16,7 +16,7 @@ import { isBareInvocation, runQuickStart } from "./quick-start.js";
|
|
|
16
16
|
import { easyStartApplies, easyStartArgs } from "./easy-start-args.js";
|
|
17
17
|
import { underAgent } from "./prompt.js";
|
|
18
18
|
import { COMMAND_GUIDE, SURFACE_NOTES, SURFACE_SCHEMA_VERSION } from "./surface.js";
|
|
19
|
-
import { hasCentralProfile, maybeRunConnectCommand } from "./connect-cli.js";
|
|
19
|
+
import { centralProfile, hasCentralProfile, maybeRunConnectCommand, probeTerminalConnection, saveCentralBinding } from "./connect-cli.js";
|
|
20
20
|
import { removedCommand, removedMessage } from "./deprecations.js";
|
|
21
21
|
import { maybeRunRemoteCommand } from "./remote-exec.js";
|
|
22
22
|
import { discover, inspectAll } from "./discover.js";
|
|
@@ -162,7 +162,7 @@ export const OPERATE_COMMANDS = new Set([
|
|
|
162
162
|
"reconcile",
|
|
163
163
|
"run",
|
|
164
164
|
"flows",
|
|
165
|
-
"config", "chat", "proposals", "mode", "chat-approval", "people", "tokens", "keys", "agents",
|
|
165
|
+
"config", "chat", "proposals", "request", "mode", "chat-approval", "people", "tokens", "keys", "agents",
|
|
166
166
|
"setup",
|
|
167
167
|
"verify",
|
|
168
168
|
"intake",
|
|
@@ -304,6 +304,15 @@ async function dispatch(argv, write, mainOptions) {
|
|
|
304
304
|
const connected = await maybeRunConnectCommand(argv, write, mainOptions.connect);
|
|
305
305
|
if (connected !== null)
|
|
306
306
|
return connected;
|
|
307
|
+
if (argv[0] === "handoff") {
|
|
308
|
+
const { maybeRunHandoffCommand } = await import("./handoff-cli.js");
|
|
309
|
+
const handoffCode = await maybeRunHandoffCommand(argv, write, connectOptions ?? {});
|
|
310
|
+
if (handoffCode !== null)
|
|
311
|
+
return handoffCode;
|
|
312
|
+
}
|
|
313
|
+
if (argv[0] === "--remote") {
|
|
314
|
+
return runRemoteTuiCommand(argv.slice(1), write, connectOptions ?? {});
|
|
315
|
+
}
|
|
307
316
|
if ((argv[0] === "chat" || argv[0] === "brief") && argv.includes("--local"))
|
|
308
317
|
argv = argv.filter(arg => arg !== "--local");
|
|
309
318
|
const [first, ...rest] = argv;
|
|
@@ -339,7 +348,8 @@ async function dispatch(argv, write, mainOptions) {
|
|
|
339
348
|
if (first !== undefined && OPERATE_COMMANDS.has(first)) {
|
|
340
349
|
return runOperate(first, rest, write, mainOptions.operate ?? {});
|
|
341
350
|
}
|
|
342
|
-
|
|
351
|
+
const startArgs = easyStartArgs(argv);
|
|
352
|
+
if (startArgs !== null) {
|
|
343
353
|
const terminal = mainOptions.easyStart?.terminal ?? (process.stdin.isTTY === true && process.stdout.isTTY === true);
|
|
344
354
|
const agent = terminal && (mainOptions.easyStart?.underAgent ?? underAgent(process.env));
|
|
345
355
|
if (easyStartApplies(argv, { stdin: terminal, stdout: terminal, agent })) {
|
|
@@ -349,10 +359,16 @@ async function dispatch(argv, write, mainOptions) {
|
|
|
349
359
|
databaseFile, write, build: (await import("./monitoring.js")).packageVersion(),
|
|
350
360
|
...(mainOptions.operate === undefined ? {} : { operate: mainOptions.operate }),
|
|
351
361
|
admit: repo => runReposCommand(["add", repo], write, mainOptions.onboard),
|
|
352
|
-
...(
|
|
353
|
-
...(
|
|
362
|
+
...(startArgs.screenReader === true ? { screenReader: true } : {}),
|
|
363
|
+
...(startArgs.tuiBinary === undefined ? {} : { tuiBinary: startArgs.tuiBinary }),
|
|
354
364
|
});
|
|
355
|
-
return easy.runEasyStart("start",
|
|
365
|
+
return easy.runEasyStart("start", startArgs, { ...seams, ...mainOptions.easyStart?.seams });
|
|
366
|
+
}
|
|
367
|
+
if (startArgs.tuiBinary !== undefined) {
|
|
368
|
+
write(agent
|
|
369
|
+
? "Toolroll detected a coding-agent session. Open the workbench launcher yourself from a fresh terminal session."
|
|
370
|
+
: "The workbench needs interactive input and output. Run the launcher in a terminal window.");
|
|
371
|
+
return USAGE_EXIT;
|
|
356
372
|
}
|
|
357
373
|
}
|
|
358
374
|
const scanNamed = first === "scan";
|
|
@@ -1358,6 +1374,109 @@ function hushExperimentalSqlite() {
|
|
|
1358
1374
|
original(warning, ...rest);
|
|
1359
1375
|
});
|
|
1360
1376
|
}
|
|
1377
|
+
async function runRemoteTuiCommand(argv, write, connectOptions) {
|
|
1378
|
+
let profileName;
|
|
1379
|
+
let devBinary = null;
|
|
1380
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
1381
|
+
const arg = argv[i];
|
|
1382
|
+
if (arg === "--help" || arg === "-h") {
|
|
1383
|
+
write("toolroll --remote [--profile <name>]\n Open the terminal workbench connected to your saved central Toolroll server.\n Connect first with: toolroll connect <https://origin> --browser");
|
|
1384
|
+
return 0;
|
|
1385
|
+
}
|
|
1386
|
+
if (arg === "--profile" || arg === "--tui-binary") {
|
|
1387
|
+
const next = argv[++i];
|
|
1388
|
+
if (!next || next.startsWith("--")) {
|
|
1389
|
+
write(`${arg} needs a value.`);
|
|
1390
|
+
return 2;
|
|
1391
|
+
}
|
|
1392
|
+
if (arg === "--profile")
|
|
1393
|
+
profileName = next;
|
|
1394
|
+
else
|
|
1395
|
+
devBinary = next;
|
|
1396
|
+
continue;
|
|
1397
|
+
}
|
|
1398
|
+
write(`Unknown option for --remote: ${arg}`);
|
|
1399
|
+
return 2;
|
|
1400
|
+
}
|
|
1401
|
+
let profile;
|
|
1402
|
+
try {
|
|
1403
|
+
profile = centralProfile(connectOptions, profileName);
|
|
1404
|
+
}
|
|
1405
|
+
catch (error) {
|
|
1406
|
+
write(error instanceof Error ? error.message : "Could not read saved remote profile.");
|
|
1407
|
+
return 2;
|
|
1408
|
+
}
|
|
1409
|
+
if (profile === null) {
|
|
1410
|
+
write("No central server connected yet. Run: toolroll connect <https://origin> --browser");
|
|
1411
|
+
return 2;
|
|
1412
|
+
}
|
|
1413
|
+
if (!profile.apiToken) {
|
|
1414
|
+
write("Remote terminal mode requires an API token (so_...). Reconnect with --token-stdin or --token-file.");
|
|
1415
|
+
return 2;
|
|
1416
|
+
}
|
|
1417
|
+
if (!profile.origin.startsWith("https://")) {
|
|
1418
|
+
write("Remote terminal mode requires an HTTPS origin (for example over Tailscale HTTPS).");
|
|
1419
|
+
return 2;
|
|
1420
|
+
}
|
|
1421
|
+
let workspaceId = profile.workspaceId;
|
|
1422
|
+
let recoveryGeneration = profile.recoveryGeneration;
|
|
1423
|
+
if (workspaceId === undefined || recoveryGeneration === undefined) {
|
|
1424
|
+
const probed = await probeTerminalConnection(profile, connectOptions);
|
|
1425
|
+
if (probed === null) {
|
|
1426
|
+
write(`Could not verify ${profile.origin}/engine/connection with your saved API token.`);
|
|
1427
|
+
return 1;
|
|
1428
|
+
}
|
|
1429
|
+
workspaceId = probed.workspace.id;
|
|
1430
|
+
recoveryGeneration = probed.workspace.recoveryGeneration;
|
|
1431
|
+
saveCentralBinding(connectOptions, profile.name, { workspaceId, recoveryGeneration, label: probed.workspace.label });
|
|
1432
|
+
}
|
|
1433
|
+
const { engineContractDigest } = await import("./contracts/engine-api.js");
|
|
1434
|
+
const { chooseTuiBinary, formatCentralBootstrapPayload, runTuiBinary } = await import("./tui-launch.js");
|
|
1435
|
+
const chosen = chooseTuiBinary({
|
|
1436
|
+
env: process.env,
|
|
1437
|
+
screenReader: false,
|
|
1438
|
+
platform: process.platform,
|
|
1439
|
+
arch: process.arch,
|
|
1440
|
+
contract: engineContractDigest(),
|
|
1441
|
+
devBinary,
|
|
1442
|
+
});
|
|
1443
|
+
if (!chosen.ok) {
|
|
1444
|
+
write(`Could not start the terminal workbench: ${chosen.why}.`);
|
|
1445
|
+
return 1;
|
|
1446
|
+
}
|
|
1447
|
+
const payload = formatCentralBootstrapPayload({
|
|
1448
|
+
origin: profile.origin,
|
|
1449
|
+
workspaceId,
|
|
1450
|
+
recoveryGeneration,
|
|
1451
|
+
account: profile.account,
|
|
1452
|
+
token: profile.token,
|
|
1453
|
+
});
|
|
1454
|
+
const origin = profile.origin;
|
|
1455
|
+
const openUrl = async (path) => {
|
|
1456
|
+
const target = new URL(path, origin).href;
|
|
1457
|
+
(await import("./operate.js")).openBrowser(target);
|
|
1458
|
+
return `Opened ${target} in your browser.`;
|
|
1459
|
+
};
|
|
1460
|
+
const ended = await runTuiBinary({
|
|
1461
|
+
binary: chosen.binary,
|
|
1462
|
+
identity: chosen.identity,
|
|
1463
|
+
link: payload,
|
|
1464
|
+
project: null,
|
|
1465
|
+
session: {
|
|
1466
|
+
owned: () => false,
|
|
1467
|
+
openBrowser: async (page) => openUrl(page === "projects" ? "/projects" : page === "lead-providers" ? "/settings/lead#lead-config" : "/"),
|
|
1468
|
+
list: async () => [],
|
|
1469
|
+
detail: async () => null,
|
|
1470
|
+
decide: async () => ({ ok: false, words: "Approvals open in your browser." }),
|
|
1471
|
+
addTask: async () => ({ ok: false, words: "Handled by remote CLI." }),
|
|
1472
|
+
steer: async () => ({ ok: false, words: "Handled by remote CLI." }),
|
|
1473
|
+
revise: async () => ({ ok: false, words: "Handled by remote CLI." }),
|
|
1474
|
+
complete: async () => ({ ok: false, words: "Handled by remote CLI." }),
|
|
1475
|
+
stop: async () => ({ ok: false, words: "Handled by remote CLI." }),
|
|
1476
|
+
},
|
|
1477
|
+
});
|
|
1478
|
+
return ended === "central-unavailable" || ended === "changed" ? 1 : 0;
|
|
1479
|
+
}
|
|
1361
1480
|
export async function runCliProcess(argv) {
|
|
1362
1481
|
hushExperimentalSqlite();
|
|
1363
1482
|
process.exitCode = await main(argv);
|
package/dist/codex-limits.js
CHANGED
|
@@ -2,6 +2,7 @@ import { spawn } from "node:child_process";
|
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { codingEnvironment } from "./coding-provider.js";
|
|
4
4
|
import { codexLimitsOf, record } from "./provider-limits.js";
|
|
5
|
+
import { refreshSubscriptions } from "./subscription-usage.js";
|
|
5
6
|
import { billingOf } from "./spend.js";
|
|
6
7
|
import { envValue } from "./names.js";
|
|
7
8
|
function accountBilling(account) {
|
|
@@ -109,6 +110,9 @@ export function startCodexLimits(store, signedIn, everyMs = 5 * 60_000) {
|
|
|
109
110
|
busy = true;
|
|
110
111
|
try {
|
|
111
112
|
await codexLimitsPass(store, { signedIn, stopped: () => stopped });
|
|
113
|
+
if (!stopped) {
|
|
114
|
+
await refreshSubscriptions(store, store.databaseFile(), { skipCodex: true });
|
|
115
|
+
}
|
|
112
116
|
}
|
|
113
117
|
catch {
|
|
114
118
|
}
|
package/dist/coding-context.js
CHANGED
|
@@ -2,7 +2,7 @@ import { existsSync, readFileSync, realpathSync, statSync } from 'node:fs';
|
|
|
2
2
|
import { createHash } from 'node:crypto';
|
|
3
3
|
import { basename, dirname, join, resolve, relative, isAbsolute, sep } from 'node:path';
|
|
4
4
|
import { KNOWLEDGE_GUIDANCE, selectProjectKnowledge } from './project-knowledge.js';
|
|
5
|
-
import { materializeProjectSkills, PROJECT_SKILLS_GUIDANCE, selectProjectSkills } from './project-skills.js';
|
|
5
|
+
import { materializeProjectSkills, PROJECT_SKILLS_GUIDANCE, PROJECT_SKILLS_READ, selectProjectSkills } from './project-skills.js';
|
|
6
6
|
import { identityMatches, learningIdentity, learningSha } from './project-learning.js';
|
|
7
7
|
import { CODING_CONTEXT_VERSION } from './contracts/coding-context.js';
|
|
8
8
|
function freeze(value) {
|
|
@@ -42,7 +42,7 @@ export function prepareCodingContext(store, args) {
|
|
|
42
42
|
if (captured.knowledge.revision > 0)
|
|
43
43
|
parts.push(KNOWLEDGE_GUIDANCE, JSON.stringify(captured.knowledge));
|
|
44
44
|
if (supplied.catalog.length)
|
|
45
|
-
parts.push('Project skills supplied for this coding session. ' + PROJECT_SKILLS_GUIDANCE, JSON.stringify(supplied.catalog));
|
|
45
|
+
parts.push('Project skills supplied for this coding session. ' + PROJECT_SKILLS_GUIDANCE + PROJECT_SKILLS_READ, JSON.stringify(supplied.catalog));
|
|
46
46
|
const text = parts.length ? '\nToolroll project context, frozen when this coding session started. Native repository and home instructions, tools, and MCP configuration still apply.\n' + parts.join('\n') + '\n' : '';
|
|
47
47
|
const metadata = {
|
|
48
48
|
version: 1,
|
|
@@ -64,6 +64,20 @@ export function prepareCodingContext(store, args) {
|
|
|
64
64
|
};
|
|
65
65
|
return freeze({ version: CODING_CONTEXT_VERSION, text, metadata, sha256: digest(text, metadata) });
|
|
66
66
|
}
|
|
67
|
+
export function codingSkillsManifest(context) {
|
|
68
|
+
const metadata = context?.metadata;
|
|
69
|
+
if (metadata === undefined || metadata.directory === null || metadata.files.length === 0)
|
|
70
|
+
return null;
|
|
71
|
+
const directory = metadata.directory;
|
|
72
|
+
const folders = new Set([directory]);
|
|
73
|
+
const files = metadata.files.map(file => {
|
|
74
|
+
const path = join(directory, ...file.path.split('/'));
|
|
75
|
+
for (let folder = dirname(path); folder.startsWith(directory + sep); folder = dirname(folder))
|
|
76
|
+
folders.add(folder);
|
|
77
|
+
return { path, sha256: file.sha256 };
|
|
78
|
+
});
|
|
79
|
+
return { directory, files, folders: [...folders].sort() };
|
|
80
|
+
}
|
|
67
81
|
export function verifyCodingContext(context, repo, baseRevision) {
|
|
68
82
|
if (context.metadata.version !== 1 || context.metadata.repo !== repo || context.metadata.baseRevision !== baseRevision || !identityMatches(repo, context.metadata.identity) || context.sha256 !== digest(context.text, context.metadata))
|
|
69
83
|
throw Error('The coding session context could not be verified.');
|
package/dist/coding-provider.js
CHANGED
|
@@ -4,7 +4,8 @@ import { TextDecoder } from "node:util";
|
|
|
4
4
|
import { homedir, hostname } from "node:os";
|
|
5
5
|
import { readDenyPath } from "./project-sandbox.js";
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
7
|
-
import { codexFenceConfig, fenceFor, FENCE_POLICY_CURRENT, runFolders, taskBoundary, trustedWorktreeBinding } from "./agent-fence.js";
|
|
7
|
+
import { codexFenceConfig, ExactFileChanged, fenceFor, FENCE_POLICY_CURRENT, runFolders, taskBoundary, trustedWorktreeBinding } from "./agent-fence.js";
|
|
8
|
+
import { skillsGrant } from "./skills-manifest.js";
|
|
8
9
|
import { poolRootOf } from "./worktree.js";
|
|
9
10
|
import { currentBootId } from "./boot-identity.js";
|
|
10
11
|
import { currentMachineId } from "./machine-identity.js";
|
|
@@ -416,10 +417,13 @@ async function sessionPermissions(store, input) {
|
|
|
416
417
|
const storage = await prepareProtectedStorage();
|
|
417
418
|
const boundary = taskBoundary({ worktree: input.worktree, provider: "codex", binding, policy: FENCE_POLICY_CURRENT, storage });
|
|
418
419
|
const readDeny = store.projectSandbox(input.repo).readDeny.map(one => readDenyPath(one, homedir()));
|
|
419
|
-
const
|
|
420
|
+
const skills = skillsGrant({ root: join(dirname(databaseFile), "coding-context"), manifest: input.skills ?? null });
|
|
421
|
+
if (skills.problem !== null)
|
|
422
|
+
return { problem: `${skills.problem}, so the session was not started.` };
|
|
423
|
+
const launch = fenceFor("build", { databaseFile, worktree: input.worktree, boundary, binding, runFolders: runFolders(null), poolRoots, readDeny, extra: skills.deny, policy: FENCE_POLICY_CURRENT, storage, exactFiles: skills.files });
|
|
420
424
|
return { config: codexFenceConfig(launch.fence, false, launch.fenceGrants) };
|
|
421
425
|
}
|
|
422
426
|
catch (error) {
|
|
423
|
-
return { problem: storageRefusalOf(error)?.message ?? "The session's worktree couldn't be bound to its project, so the session was not started." };
|
|
427
|
+
return { problem: storageRefusalOf(error)?.message ?? (error instanceof ExactFileChanged ? error.message : "The session's worktree couldn't be bound to its project, so the session was not started.") };
|
|
424
428
|
}
|
|
425
429
|
}
|
package/dist/coding-workspace.js
CHANGED
|
@@ -9,7 +9,7 @@ import { sqliteRuntime } from './sqlite-runtime.js';
|
|
|
9
9
|
import { run } from './exec.js';
|
|
10
10
|
import { processMayBeAlive } from './process-liveness.js';
|
|
11
11
|
import { createCodexCodingProvider } from './coding-provider.js';
|
|
12
|
-
import { verifyCodingContext } from './coding-context.js';
|
|
12
|
+
import { codingSkillsManifest, verifyCodingContext } from './coding-context.js';
|
|
13
13
|
import { codingSessionDocument, parseCodingSessionDocument } from './contracts/coding-workspace.js';
|
|
14
14
|
import { readCodingCustodyWitness, readCodingItem, readCodingRequest, readCodingRpcId } from './contracts/coding-activity.js';
|
|
15
15
|
export class CodingActionError extends Error {
|
|
@@ -268,8 +268,8 @@ export class CodingWorkspace {
|
|
|
268
268
|
const clientId = string(item['clientId']) || string(item['clientUserMessageId']);
|
|
269
269
|
return { id, type, text, status: string(item['status']) || null, ...(type === 'userMessage' && clientId ? { clientId } : {}) };
|
|
270
270
|
}
|
|
271
|
-
async permissionsFor(repo, worktree) {
|
|
272
|
-
const made = await this.options.permissions({ repo, worktree });
|
|
271
|
+
async permissionsFor(repo, worktree, context) {
|
|
272
|
+
const made = await this.options.permissions({ repo, worktree, skills: codingSkillsManifest(context) });
|
|
273
273
|
if ('problem' in made)
|
|
274
274
|
throw Error(made.problem);
|
|
275
275
|
return made;
|
|
@@ -441,7 +441,7 @@ export class CodingWorkspace {
|
|
|
441
441
|
this.authorize(actor, repo);
|
|
442
442
|
this.admit();
|
|
443
443
|
nativeStartupAttempted = true;
|
|
444
|
-
const result = object(await this.request('thread/start', { cwd: worktree, approvalPolicy: 'on-request', approvalsReviewer: 'user', ...(await this.permissionsFor(repo, worktree)), ...(input.model ? { model: input.model } : {}), developerInstructions: CODING_INSTRUCTIONS + (context?.text ?? ''), persistExtendedHistory: true }));
|
|
444
|
+
const result = object(await this.request('thread/start', { cwd: worktree, approvalPolicy: 'on-request', approvalsReviewer: 'user', ...(await this.permissionsFor(repo, worktree, context)), ...(input.model ? { model: input.model } : {}), developerInstructions: CODING_INSTRUCTIONS + (context?.text ?? ''), persistExtendedHistory: true }));
|
|
445
445
|
const thread = object(result['thread']), nativeThreadId = string(thread['id']);
|
|
446
446
|
if (!nativeThreadId)
|
|
447
447
|
throw Error('The agent did not return a session identity.');
|
|
@@ -490,7 +490,7 @@ export class CodingWorkspace {
|
|
|
490
490
|
this.authorize({ name: session.owner, generation: session.generation }, session.repo);
|
|
491
491
|
if (session.context)
|
|
492
492
|
verifyCodingContext(session.context, session.repo, session.base);
|
|
493
|
-
const result = object(await this.request('thread/resume', { threadId: session.nativeThreadId, cwd: session.worktree, approvalPolicy: 'on-request', approvalsReviewer: 'user', ...(await this.permissionsFor(session.repo, session.worktree)), ...(session.model ? { model: session.model } : {}), developerInstructions: CODING_INSTRUCTIONS + (session.context?.text ?? ''), persistExtendedHistory: true }));
|
|
493
|
+
const result = object(await this.request('thread/resume', { threadId: session.nativeThreadId, cwd: session.worktree, approvalPolicy: 'on-request', approvalsReviewer: 'user', ...(await this.permissionsFor(session.repo, session.worktree, session.context)), ...(session.model ? { model: session.model } : {}), developerInstructions: CODING_INSTRUCTIONS + (session.context?.text ?? ''), persistExtendedHistory: true }));
|
|
494
494
|
const thread = object(result['thread']);
|
|
495
495
|
if (thread['id'] !== session.nativeThreadId)
|
|
496
496
|
throw Error('The agent returned a different conversation. Continuity could not be verified.');
|