toolroll 0.9.111 → 0.9.113
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 +62 -0
- package/README.md +28 -29
- package/dist/action-ledger.js +13 -0
- package/dist/agent-said.js +60 -6
- package/dist/bin.js +5 -1
- package/dist/browser/terminal.js +1 -1
- package/dist/browser/workspace.js +1 -1
- package/dist/chat-channel.js +10 -0
- package/dist/cli-help.js +6 -0
- package/dist/cli.js +2 -0
- package/dist/contracts/console-api.js +2 -1
- package/dist/contracts/engine-api.js +12 -0
- package/dist/contracts/lead-tools.js +28 -0
- package/dist/easy-start.js +8 -3
- package/dist/engine-reads.js +15 -0
- package/dist/evidence.js +6 -6
- package/dist/fast-terms.js +8 -4
- package/dist/flexible-agents.js +2 -8
- package/dist/flexible-answers.js +4 -26
- package/dist/flexible-available.js +31 -1
- package/dist/flexible-import.js +2 -14
- package/dist/flexible-launch.js +15 -3
- package/dist/flexible-launcher.js +0 -5
- package/dist/flexible-relay.js +7 -4
- package/dist/flexible-session.js +123 -32
- package/dist/flexible-setting-schema.js +10 -0
- package/dist/flexible-ship.js +8 -18
- package/dist/flexible-start.js +2 -2
- package/dist/flexible-thread.js +21 -27
- package/dist/flexible-turns.js +7 -17
- package/dist/flexible.js +9 -11
- package/dist/flow-triggers.js +4 -1
- package/dist/lead-tools.js +107 -1
- package/dist/lead.js +1 -1
- package/dist/ledger-view.js +2 -1
- package/dist/live-terminal.js +28 -0
- package/dist/local-owner.js +1 -0
- package/dist/needs-you.js +10 -2
- package/dist/operate.js +62 -5
- package/dist/outbound-privacy.js +6 -1
- package/dist/plain-words.js +1 -1
- package/dist/release.js +2 -0
- package/dist/serve.js +10 -1
- package/dist/server/chat.js +6 -1
- package/dist/server/engine-api.js +91 -27
- package/dist/server/mutation-key.js +6 -0
- package/dist/server/render-history.js +2 -1
- package/dist/server/route-table.js +3 -0
- package/dist/server/settings-section-table.js +3 -0
- package/dist/server/settings-sections.js +23 -0
- package/dist/server/settings.js +36 -3
- package/dist/server/terminals.js +3 -3
- package/dist/settings-proofs.js +2 -0
- package/dist/store.js +18 -4
- 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/view-tools.js +94 -0
- package/dist/work-index.js +6 -2
- package/package.json +2 -1
package/dist/serve.js
CHANGED
|
@@ -1783,7 +1783,7 @@ export function createDecisionServer(options) {
|
|
|
1783
1783
|
catch { }
|
|
1784
1784
|
}
|
|
1785
1785
|
await Promise.all(waits);
|
|
1786
|
-
}),
|
|
1786
|
+
}).finally(() => options.onBackgroundPass?.()),
|
|
1787
1787
|
onError: () => { }, });
|
|
1788
1788
|
void backgroundChecks.runNow();
|
|
1789
1789
|
});
|
|
@@ -1975,6 +1975,7 @@ export function createDecisionServer(options) {
|
|
|
1975
1975
|
get browserKeys() { return browserKeys; },
|
|
1976
1976
|
get outsideAdmissions() { return outsideAdmissions; },
|
|
1977
1977
|
get localAgents() { return localAgents; },
|
|
1978
|
+
get heldApprovalNonce() { return heldApprovalNonce; },
|
|
1978
1979
|
};
|
|
1979
1980
|
const tasksHandlers = createTasksHandlers(handlerRuntime);
|
|
1980
1981
|
const pagesHandlers = createPagesHandlers(handlerRuntime, { listFor: tasksHandlers.workListFor, showOrder: tasksHandlers.showOrder });
|
|
@@ -2072,6 +2073,14 @@ export function createDecisionServer(options) {
|
|
|
2072
2073
|
return null;
|
|
2073
2074
|
return holdSignInLink({ kind: "local-owner", ...binding, expires: Date.now() + SIGN_IN_LINK_MS });
|
|
2074
2075
|
}
|
|
2076
|
+
function heldApprovalNonce(name, taskId, digest) {
|
|
2077
|
+
const now = Date.now();
|
|
2078
|
+
for (const [nonce, held] of approvalNonces) {
|
|
2079
|
+
if (held.expiresAt >= now && held.name === name && held.taskId === taskId && held.digest === digest)
|
|
2080
|
+
return nonce;
|
|
2081
|
+
}
|
|
2082
|
+
return mintApprovalNonce(name, taskId, digest);
|
|
2083
|
+
}
|
|
2075
2084
|
return Object.assign(server, { mintSignInLink, mintLocalLink, keyEpoch, closeCoding });
|
|
2076
2085
|
}
|
|
2077
2086
|
export { PAGE_CSS, pinnedTheme, SENSITIVE_INPUT } from "./server/chrome.js";
|
package/dist/server/chat.js
CHANGED
|
@@ -37,6 +37,7 @@ import { runActivityOf } from "../task-activity.js";
|
|
|
37
37
|
import { teamWorkspaceHtml } from '../team-ui.js';
|
|
38
38
|
import { loadBotToken, redactToken } from "../telegram.js";
|
|
39
39
|
import { WORK_INDEX_MAX_LIMIT, workIndexPage } from "../work-index.js";
|
|
40
|
+
import { binaryViewRunner, viewAllowedFor } from '../view-tools.js';
|
|
40
41
|
import { html, htmlString, postForm, reauth } from "../html.js";
|
|
41
42
|
import { requestContext } from "./request-context.js";
|
|
42
43
|
import { refuse, screen, whenTime } from "./chrome.js";
|
|
@@ -863,7 +864,8 @@ export function createChatHandlers(runtime) {
|
|
|
863
864
|
const ended = (ok) => { if (onProgress !== undefined)
|
|
864
865
|
endLiveTurn(opened.thread.id, ok, onProgress); };
|
|
865
866
|
void freshFacts.run(null, () => runLeadTurn({ store, who: principal, session: leadSession, thread: opened.thread, config: enabled.config, key: enabled.key, message,
|
|
866
|
-
onAdmitted: () => { onProgress = beginLiveTurn(opened.thread.id, liveShape); }, onProgress: event => onProgress?.(event), channel: "console", requestId,
|
|
867
|
+
onAdmitted: () => { onProgress = beginLiveTurn(opened.thread.id, liveShape); }, onProgress: event => onProgress?.(event), channel: "console", requestId,
|
|
868
|
+
...(viewAllowed(request, who) ? { view: viewRunner } : {}), ...(focusTask === null && chatProject !== null ? { context: `Current project: ${projectName(chatProject)} (${chatProject}). Keep this conversation about that project unless the operator explicitly asks to broaden it; use it as the repo for project tools.` } : {}), ...(focusTask === null ? {} : { context: `Current task: ${focusTask.id}. Read it with get_task before answering or proposing changes. Read its currentExecution next and bind new actions to that exact execution. Never replace the target of a prior proposal with a newer revision. Keep this turn about that task unless the operator explicitly asks to broaden it.${resultContext}${modeContext}` }), fetcher: chatFetcher, ...(options.subscriptionChatRunner === undefined ? {} : { subscriptionRunner: options.subscriptionChatRunner }), clock, evidenceRoot }))
|
|
867
869
|
.then(outcome => {
|
|
868
870
|
if (!outcome.ok && "refused" in outcome && (outcome.refused === "concurrent" || outcome.refused === "backlog") && queueIt().kind === "queued") {
|
|
869
871
|
ended(false);
|
|
@@ -1385,5 +1387,8 @@ export function createChatHandlers(runtime) {
|
|
|
1385
1387
|
"chat.file": chatFile,
|
|
1386
1388
|
"chat.ack-send": chatAckSend,
|
|
1387
1389
|
});
|
|
1390
|
+
const viewRunner = options.viewRunner ?? binaryViewRunner();
|
|
1391
|
+
const viewAllowed = (request, who) => viewAllowedFor({ via: who.via, ...(who.authority === undefined ? {} : { authority: who.authority }), name: who.name,
|
|
1392
|
+
fromThisComputer: runtime.fromThisComputer(request), approvers: store.listApprovers().map(one => one.name) });
|
|
1388
1393
|
return { registrations, chatFirstRun, phoneCard, chatProjectOf, beginLiveTurn, endLiveTurn, noteLead, takeLeadNote, demoResultView, storeChatKey, forgetChatKey, sweepChatDrafts, runChatTurn, chatHomeOf, firstTasksFor, approverCandidateCount, evictOldestCandidate };
|
|
1389
1394
|
}
|
|
@@ -3,12 +3,13 @@ import { randomBytes } from "node:crypto";
|
|
|
3
3
|
import { boardRunOf } from "../agent-board.js";
|
|
4
4
|
import { checkEngineResponse, DIFF_CONTEXT_MAX, ENGINE_API_VERSION, ENGINE_RESPONSES, engineContractDigest, linkRedemptionRequestSchema } from "../contracts/engine-api.js";
|
|
5
5
|
import { CONSOLE_FORMS, readForm } from "../contracts/console-api.js";
|
|
6
|
-
import {
|
|
6
|
+
import { flexibleAvailable } from "../flexible-available.js";
|
|
7
7
|
import { FLEXIBLE_UNAVAILABLE } from "../flexible.js";
|
|
8
|
-
import { admitFlexibleThreadOwner, answerFlexibleRequest, closeFlexibleSessions, flexibleThreadChangeOf, flexibleThreadLiveOf, flexibleThreadsOf, FLEXIBLE_WAIT_MS, openFlexibleSessions, recoverFlexibleHolders, startFlexibleThread, tickFlexibleSessions, waitFlexibleThreadChange } from "../flexible-session.js";
|
|
8
|
+
import { admitFlexibleThreadOwner, answerFlexibleRequest, closeFlexibleSessions, flexibleThreadChangeOf, flexibleThreadLiveOf, flexibleThreadsOf, FLEXIBLE_WAIT_MS, flexibleThreadsExist, flexibleWorkOpen, openFlexibleSessions, recoverFlexibleHolders, startFlexibleThread, settleFlexibleStops, tickFlexibleSessions, waitFlexibleThreadChange } from "../flexible-session.js";
|
|
9
9
|
import { createFlexibleLauncher } from "../flexible-launcher.js";
|
|
10
10
|
import { flexibleStartCard } from "../flexible-start.js";
|
|
11
11
|
import { summaryLines } from "../approval-summary.js";
|
|
12
|
+
import { termsOfLines } from "../fast-terms.js";
|
|
12
13
|
import { localActNow } from "../local-owner.js";
|
|
13
14
|
import { authenticateApprover } from "../scope.js";
|
|
14
15
|
import { defaultChainOf, installModeNow } from "../install-mode.js";
|
|
@@ -111,21 +112,25 @@ export function createEngineHandlers(runtime) {
|
|
|
111
112
|
};
|
|
112
113
|
return sendChecked(response, 200, "liveSessionWindow", body);
|
|
113
114
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
let flexible = null;
|
|
116
|
+
let launcher = null;
|
|
117
|
+
const openHost = () => {
|
|
118
|
+
if (flexible !== null)
|
|
119
|
+
return flexible;
|
|
117
120
|
const opened = openFlexibleSessions(store);
|
|
118
121
|
if (!opened.ok)
|
|
119
122
|
return null;
|
|
123
|
+
flexible = opened.sessions;
|
|
120
124
|
void recoverFlexibleHolders(store, opened.sessions).catch(() => { });
|
|
121
|
-
return opened.sessions;
|
|
122
|
-
})();
|
|
123
|
-
const launcher = (() => {
|
|
124
|
-
if (!FLEXIBLE_AVAILABLE || flexible === null)
|
|
125
|
-
return null;
|
|
126
125
|
const made = createFlexibleLauncher(store);
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
launcher = "prepare" in made ? made : null;
|
|
127
|
+
return flexible;
|
|
128
|
+
};
|
|
129
|
+
if (flexibleAvailable(store) || flexibleWorkOpen(store))
|
|
130
|
+
openHost();
|
|
131
|
+
const threadsOn = () => flexibleAvailable(store) ? openHost() : null;
|
|
132
|
+
const threadsRead = () => flexible ?? (flexibleAvailable(store) || flexibleThreadsExist(store) ? openHost() : null);
|
|
133
|
+
let stopping = false;
|
|
129
134
|
const ownedThread = (request, who, sessions, thread) => {
|
|
130
135
|
if (rereadBrowser(runtime, request, who) === null)
|
|
131
136
|
return null;
|
|
@@ -137,8 +142,9 @@ export function createEngineHandlers(runtime) {
|
|
|
137
142
|
const { url, who, request, response } = ctx;
|
|
138
143
|
if (who.via !== "cookie")
|
|
139
144
|
return refusal(response, 403, "session");
|
|
140
|
-
|
|
141
|
-
|
|
145
|
+
const flexible = threadsRead();
|
|
146
|
+
if (flexible === null)
|
|
147
|
+
return refusal(response, 404, "thread");
|
|
142
148
|
const known = url.searchParams.get("known"), wait = url.searchParams.get("wait");
|
|
143
149
|
const plain = new URL(url.href);
|
|
144
150
|
plain.searchParams.delete("known");
|
|
@@ -174,22 +180,25 @@ export function createEngineHandlers(runtime) {
|
|
|
174
180
|
const { url, who, request, response } = ctx;
|
|
175
181
|
if (who.via !== "cookie")
|
|
176
182
|
return refusal(response, 403, "session");
|
|
177
|
-
if (!FLEXIBLE_AVAILABLE || flexible === null)
|
|
178
|
-
return refusal(response, 404, "not-available");
|
|
179
183
|
if ([...url.searchParams.keys()].length > 0)
|
|
180
184
|
return refusal(response, 400, "request");
|
|
181
185
|
if (rereadBrowser(runtime, request, who) === null)
|
|
182
186
|
return refusal(response, 403, "session");
|
|
187
|
+
const on = flexibleAvailable(store);
|
|
188
|
+
const flexible = threadsRead();
|
|
189
|
+
if (flexible === null)
|
|
190
|
+
return sendChecked(response, 200, "liveThreads", { version: ENGINE_API_VERSION, on, threads: [] });
|
|
183
191
|
const read = flexibleThreadsOf(store, flexible, { owner: who.name });
|
|
184
192
|
if (!read.ok)
|
|
185
|
-
return refusal(response, 404, "
|
|
186
|
-
const body = { version: ENGINE_API_VERSION, threads: read.threads.filter(one => store.accountCanAccess(who.name, one.repo))
|
|
193
|
+
return refusal(response, 404, "thread");
|
|
194
|
+
const body = { version: ENGINE_API_VERSION, on, threads: read.threads.filter(one => store.accountCanAccess(who.name, one.repo))
|
|
187
195
|
.map(one => ({ id: one.id, title: one.title, project: one.project, level: one.level, live: one.live, waiting: one.waiting, costUsd: one.turn?.costUsd ?? null })) };
|
|
188
196
|
return sendChecked(response, 200, "liveThreads", body);
|
|
189
197
|
}
|
|
190
198
|
async function threadAnswer(ctx) {
|
|
191
199
|
const { url, who, request, response, posted } = ctx;
|
|
192
|
-
|
|
200
|
+
const flexible = threadsOn();
|
|
201
|
+
if (flexible === null)
|
|
193
202
|
return acted(response, 404, "refused", FLEXIBLE_UNAVAILABLE);
|
|
194
203
|
if (who.via !== "cookie")
|
|
195
204
|
return acted(response, 403, "refused", "Only a person signed in here can answer an agent.");
|
|
@@ -219,13 +228,17 @@ export function createEngineHandlers(runtime) {
|
|
|
219
228
|
}
|
|
220
229
|
async function threadStart(ctx) {
|
|
221
230
|
const { who, request, response, posted } = ctx;
|
|
222
|
-
|
|
231
|
+
const flexible = threadsOn();
|
|
232
|
+
if (flexible === null)
|
|
223
233
|
return acted(response, 404, "refused", FLEXIBLE_UNAVAILABLE);
|
|
224
234
|
if (who.via !== "cookie" || rereadBrowser(runtime, request, who) === null)
|
|
225
235
|
return acted(response, 403, "refused", "Only a person signed in here can start a thread.");
|
|
226
236
|
if (launcher === null)
|
|
227
237
|
return acted(response, 409, "refused", "This console can't give a thread its network, so no thread was started.");
|
|
228
238
|
const body = readForm(posted, CONSOLE_FORMS.threadStart);
|
|
239
|
+
const agent = body.get("agent");
|
|
240
|
+
if (agent !== null && agent !== "claude")
|
|
241
|
+
return acted(response, 409, "refused", FLEXIBLE_CLAUDE_ONLY);
|
|
229
242
|
const repo = body.get("repo") ?? "", message = body.get("message") ?? "";
|
|
230
243
|
if (!store.accountCanAccess(who.name, repo))
|
|
231
244
|
return acted(response, 403, "refused", "That project is outside your access.");
|
|
@@ -266,6 +279,30 @@ export function createEngineHandlers(runtime) {
|
|
|
266
279
|
return refusal(response, 404, "task");
|
|
267
280
|
return sendChecked(response, 200, "stepCards", stepCardsOf({ store, family, now: clock(), access: runtime.workAccess(), evidenceRoot, viewer: who.name }));
|
|
268
281
|
}
|
|
282
|
+
async function taskApproval(ctx) {
|
|
283
|
+
const { url, response, who, request } = ctx;
|
|
284
|
+
if (who.via !== "cookie")
|
|
285
|
+
return refusal(response, 403, "session");
|
|
286
|
+
if (!runtime.browserKeys.terminalKeyed(who, request))
|
|
287
|
+
return refusal(response, 403, "key");
|
|
288
|
+
if ([...url.searchParams.keys()].length > 0)
|
|
289
|
+
return refusal(response, 400, "request");
|
|
290
|
+
const family = familyAt(url, "approval");
|
|
291
|
+
if (family === null)
|
|
292
|
+
return refusal(response, 404, "task");
|
|
293
|
+
const taskId = family.current.id;
|
|
294
|
+
const none = (problem) => sendChecked(response, 200, "approvalCard", { version: ENGINE_API_VERSION, task: taskId, key: null, digest: null, nonce: null, terms: [], problem });
|
|
295
|
+
const waits = (view) => view.nonce !== "" && view.approvalDigest != null && view.approvalSummary != null;
|
|
296
|
+
const view = runtime.taskViewData(taskId, who, null, { mintNonce: false });
|
|
297
|
+
if (view === null)
|
|
298
|
+
return refusal(response, 404, "task");
|
|
299
|
+
if (!waits(view))
|
|
300
|
+
return none(NOTHING_TO_APPROVE);
|
|
301
|
+
if (view.approvalLocal?.eligible !== true)
|
|
302
|
+
return none(`${view.approvalLocal?.eligible === false ? `${view.approvalLocal.message} ` : "This approval needs your password. "}${APPROVE_IN_BROWSER}`);
|
|
303
|
+
return sendChecked(response, 200, "approvalCard", { version: ENGINE_API_VERSION, task: taskId, key: view.approvalSummary.key, digest: view.approvalDigest,
|
|
304
|
+
nonce: runtime.heldApprovalNonce(who.name, taskId, view.approvalDigest), terms: approvalTermsOf(view.approvalSummary, view.planContract ?? null, view.revision ?? null), problem: null });
|
|
305
|
+
}
|
|
269
306
|
async function taskDiff(ctx) {
|
|
270
307
|
const { url, response } = ctx;
|
|
271
308
|
const params = url.searchParams, runParam = params.get("run"), fileParam = params.get("file"), fromParam = params.get("from"), countParam = params.get("count");
|
|
@@ -334,29 +371,38 @@ export function createEngineHandlers(runtime) {
|
|
|
334
371
|
return sendChecked(response, 200, "linkRedemption", body);
|
|
335
372
|
}
|
|
336
373
|
return {
|
|
337
|
-
upkeep: () => {
|
|
374
|
+
upkeep: () => {
|
|
375
|
+
const host = flexible;
|
|
376
|
+
if (host === null)
|
|
377
|
+
return;
|
|
338
378
|
try {
|
|
339
|
-
tickFlexibleSessions(store,
|
|
379
|
+
tickFlexibleSessions(store, host);
|
|
340
380
|
}
|
|
341
381
|
catch { }
|
|
342
|
-
|
|
382
|
+
if (stopping)
|
|
383
|
+
return;
|
|
384
|
+
stopping = true;
|
|
385
|
+
void settleFlexibleStops(store, host).catch(() => { }).finally(() => { stopping = false; });
|
|
386
|
+
},
|
|
343
387
|
close: async () => {
|
|
388
|
+
const host = flexible, made = launcher;
|
|
344
389
|
try {
|
|
345
|
-
if (
|
|
346
|
-
await closeFlexibleSessions(store,
|
|
390
|
+
if (host !== null)
|
|
391
|
+
await closeFlexibleSessions(store, host);
|
|
347
392
|
}
|
|
348
393
|
finally {
|
|
349
|
-
await
|
|
394
|
+
await made?.close();
|
|
350
395
|
}
|
|
351
396
|
},
|
|
352
397
|
registrations: [
|
|
353
398
|
...handlersOf("pages", { "engine.hello": hello, "engine.agents": agents, "engine.agents-check": agentsCheck, "agents.live.run": liveRun, "agents.live.thread": liveThread, "agents.live.threads": liveThreads,
|
|
354
399
|
"agents.live.thread.answer": threadAnswer, "agents.live.thread.start": threadStart }),
|
|
355
|
-
...handlersOf("tasks", { "task.steps": taskSteps, "task.diff": taskDiff }),
|
|
400
|
+
...handlersOf("tasks", { "task.steps": taskSteps, "task.approval": taskApproval, "task.diff": taskDiff }),
|
|
356
401
|
...handlersOf("people", {}, { "edge.login-link-json": redeemLink }),
|
|
357
402
|
],
|
|
358
403
|
};
|
|
359
404
|
}
|
|
405
|
+
export const FLEXIBLE_CLAUDE_ONLY = "Interactive agent threads run Claude Code only for now. Codex threads come later. Nothing was started.";
|
|
360
406
|
const START_PROOFS = new Set(["password-now", "sso-now", "fresh-password", "fresh-sso", "session", "local-owner"]);
|
|
361
407
|
const FRESH_PROOFS = new Set(["password-now", "sso-now", "fresh-password", "fresh-sso", "local-owner"]);
|
|
362
408
|
function bodyOf(request, cap) {
|
|
@@ -376,3 +422,21 @@ function bodyOf(request, cap) {
|
|
|
376
422
|
request.on("error", () => resolve(null));
|
|
377
423
|
});
|
|
378
424
|
}
|
|
425
|
+
export const NOTHING_TO_APPROVE = "Nothing on this task is waiting for your approval.";
|
|
426
|
+
export const APPROVE_IN_BROWSER = "Press w to open it in your browser.";
|
|
427
|
+
export function approvalTermsOf(summary, contract, revision) {
|
|
428
|
+
const terms = termsOfLines(summaryLines(summary));
|
|
429
|
+
if (contract !== null && "problem" in contract)
|
|
430
|
+
terms.push({ label: "Plan record", words: contract.problem });
|
|
431
|
+
else if (contract !== null && (contract.filed || contract.revision === true) && contract.changes.length > 0) {
|
|
432
|
+
const count = `${contract.changes.length} change${contract.changes.length === 1 ? "" : "s"}`;
|
|
433
|
+
terms.push({ label: "Plan changes", words: [contract.revision === true ? `The plan makes ${count} from your notes:` : `The plan makes ${count} to what you filed:`,
|
|
434
|
+
...contract.changeWords, ...(contract.amendment === null ? [] : [`Why: ${contract.amendment}`])].join("\n") });
|
|
435
|
+
}
|
|
436
|
+
if (revision !== null && "problem" in revision)
|
|
437
|
+
terms.push({ label: "Sent back", words: revision.problem });
|
|
438
|
+
else if (revision !== null && revision.comments.length > 0) {
|
|
439
|
+
terms.push({ label: "Sent back", words: revision.comments.map(one => `${one.path === null ? "" : `${one.path}${one.line === null ? "" : `:${one.line}`} — `}${one.note} (${one.author})`).join("\n") });
|
|
440
|
+
}
|
|
441
|
+
return terms;
|
|
442
|
+
}
|
|
@@ -83,6 +83,12 @@ export function createBrowserKeys(deps) {
|
|
|
83
83
|
return null;
|
|
84
84
|
},
|
|
85
85
|
stale,
|
|
86
|
+
terminalKeyed(who, request) {
|
|
87
|
+
if (!deps.enabled || who.via !== "cookie" || !terminalSession(who.session) || stale(who) !== null)
|
|
88
|
+
return false;
|
|
89
|
+
const presented = presentedKey(request, null);
|
|
90
|
+
return presented !== null && keyMatches(presented, who.session.keyHash);
|
|
91
|
+
},
|
|
86
92
|
issue(session, request) {
|
|
87
93
|
const canonical = canonicalHost();
|
|
88
94
|
if (canonical === null || request.headers.host !== canonical)
|
|
@@ -7,6 +7,7 @@ import { taskHref } from "./http.js";
|
|
|
7
7
|
import { btn, chip, disclose, doc, docHeader, dock, facts, note, notice, phoneHeader, radios, slots, status } from "./kit.js";
|
|
8
8
|
import { editorFileHref, evidenceBundleCard, evidenceWords, humanBytes, prefillScript, resultPanelHtml, revisionSealFields, runFactsRows, runNoun, terminalDiffCard, } from "./render-results.js";
|
|
9
9
|
import { publicationFactsOf } from "./render-tasks.js";
|
|
10
|
+
import { detailShown } from "../action-ledger.js";
|
|
10
11
|
export const sec = (title, body, attrs = html ``) => html `<section class="k-sec"${attrs}><h3>${title}</h3>${body}</section>`;
|
|
11
12
|
const kitPage = (attrs, ...parts) => html `<div class="h-page" data-kit-page${attrs}>${parts}</div>`;
|
|
12
13
|
export function runPage(chrome, run, taskId, artifacts, terminal = null, notes = [], csrf = "", comments = [], ciRepair = null, liveScript, peekable = false, running = false, editor = null, editorToggle = null, noted = false, structuredHandoff = null, proofBundle = null, route = null, publicationRow = null, review = null, result = null, sourceDigest = null) {
|
|
@@ -203,7 +204,7 @@ ${runs.map(run => html `<div class="h-tr" role="row"><span role="cell"><a class=
|
|
|
203
204
|
const entries = pack.ledger.entries.filter(one => one.source !== "request");
|
|
204
205
|
const requests = pack.ledger.entries.length - entries.length;
|
|
205
206
|
const log = sec("Audit log", html `${entries.length === 0 ? note("No entries.") : html `<ul class="h-log">${[...entries].reverse().map(one => html `<li data-ledger-id="${one.id}">\
|
|
206
|
-
<span class="k-num k-muted">${at(one.at)}</span><span><b>${one.actor}</b> ${one.action}${one.detail ? html `<span class="k-muted"> · ${one.detail}</span>` : ""}</span>\
|
|
207
|
+
<span class="k-num k-muted">${at(one.at)}</span><span><b>${one.actor}</b> ${one.action}${one.detail ? html `<span class="k-muted"> · ${detailShown(one.detail)}</span>` : ""}</span>\
|
|
207
208
|
<span class="k-muted">${one.outcome}</span><span class="h-seal">${shortHash(one.seal?.hash ?? null)}</span></li>`)}</ul>`}${requests > 0 ? note(`Plus ${requests} ${requests === 1 ? "request" : "requests"} made through the console (accepted or refused), listed in the JSON.`) : ""}${pack.ledger.truncated ? note(`This record holds ${entries.length} of the task's entries and the newest ${requests} requests; the audit log export has the rest.`) : ""}`);
|
|
208
209
|
const foot = html `<p class="k-note h-foot">Record digest <span class="k-mono">${pack.digest}</span>. Each entry's seal can be rechecked from the JSON: <span class="k-mono">${pack.ledger.recipe}</span>.</p>`;
|
|
209
210
|
return { summary, broken, versions, agents, outcome, log, foot };
|
|
@@ -88,6 +88,7 @@ const LOCAL_POSTS = Object.freeze({
|
|
|
88
88
|
"settings.knowledge-tidy": "memory-review",
|
|
89
89
|
"settings.advanced": "view-preference",
|
|
90
90
|
"settings.task-sizing": "task-sizing-switch",
|
|
91
|
+
"settings.flexible": "flexible-switch",
|
|
91
92
|
"agents.seen": "mark-seen",
|
|
92
93
|
"agents.watch": "watch-agent",
|
|
93
94
|
});
|
|
@@ -267,6 +268,7 @@ get("tasks", "task.page", `^\\/t\\/${TASK}$`, { project: "task", limited: "resou
|
|
|
267
268
|
get("tasks", "task.evidence", `^\\/t\\/${TASK}\\/evidence$`, { project: "task", limited: "resource", ...free, sample: "/t/one/evidence" });
|
|
268
269
|
get("tasks", "task.steps", `^\\/t\\/${TASK}\\/steps$`, { project: "task", limited: "resource", ...free, sample: "/t/one/steps" });
|
|
269
270
|
get("tasks", "task.diff", `^\\/t\\/${TASK}\\/diff$`, { project: "task", limited: "resource", ...free, sample: "/t/one/diff" });
|
|
271
|
+
get("tasks", "task.approval", `^\\/t\\/${TASK}\\/approval$`, { project: "task", limited: "resource", callers: ["cookie"], ...free, sample: "/t/one/approval" });
|
|
270
272
|
get("tasks", "task.release", `^\\/t\\/${TASK}\\/release$`, { project: "task", limited: "resource", ...free, sample: "/t/one/release" });
|
|
271
273
|
get("tasks", "release.locate", `^\\/approve\\/${ID}$`, { project: "task-ref", limited: "resource", ...free, sample: "/approve/1" });
|
|
272
274
|
get("pages", "ledger.export", "/ledger/export", { limited: "unscoped", ...free });
|
|
@@ -418,6 +420,7 @@ get("settings", "settings.passwordless", "/settings/passwordless", { ...free, ..
|
|
|
418
420
|
post("settings", "settings.passwordless-send", "/settings/passwordless", { callers: ["cookie"], ...operator("An instance operator sets Passwordless.", "/settings") });
|
|
419
421
|
post("settings", "settings.local-mode-off", "/settings/local-mode/off", { callers: ["cookie"], scope: "step-up", ...operator("An instance operator turns off local mode.", "/settings/general?section=local-mode") });
|
|
420
422
|
post("settings", "settings.task-sizing", "/settings/task-sizing", { scope: "step-up", limited: "deny", ...operator("An instance operator chooses how tasks are sized.", "/settings/general?section=task-sizing") });
|
|
423
|
+
post("settings", "settings.flexible", "/settings/flexible", { callers: ["cookie"], scope: "step-up", limited: "deny", ...operator("An instance operator turns interactive agent threads on or off.", "/settings/general?section=flexible") });
|
|
421
424
|
post("settings", "settings.just-me", "/settings/install-mode/solo", { callers: ["cookie"], scope: "step-up", ...operator("An instance operator says it's just them.", "/settings/general?section=install-mode") });
|
|
422
425
|
post("settings", "settings.release-approval-send", "/settings/release-approval", { callers: ["cookie"], ...approver("An approver sets how releases are approved.", "/settings/approval") });
|
|
423
426
|
post("pages", "ledger.checkpoint", "/ledger/checkpoint", operator("An instance operator makes ledger checkpoints.", "/ledger"));
|
|
@@ -20,6 +20,9 @@ export const SETTINGS_SECTIONS = Object.freeze([
|
|
|
20
20
|
{ id: "task-sizing", area: "general", title: "Size tasks with a quick model call (Claude Haiku, on your plan)", pinnedFrom: "settings.group-general", policy: GROUP_PAGE,
|
|
21
21
|
read: ["installation"], scope: {}, act: { switch: ["cookie-session", "operator"] }, changes: [{ id: "task-sizing", act: "switch", proof: "task-sizing" }],
|
|
22
22
|
opens: false, scripts: [], oldIds: [] },
|
|
23
|
+
{ id: "flexible", area: "general", title: "Interactive agent threads (beta)", pinnedFrom: "settings.group-general", policy: GROUP_PAGE,
|
|
24
|
+
read: ["installation"], scope: {}, act: { switch: ["cookie-session", "operator"] }, changes: [{ id: "flexible", act: "switch", proof: "flexible-switch" }],
|
|
25
|
+
opens: false, scripts: [], oldIds: [] },
|
|
23
26
|
{ id: "advanced", area: "general", title: "Show advanced features", pinnedFrom: "settings.group-advanced", policy: GROUP_PAGE,
|
|
24
27
|
read: [], scope: { "operator-pages": ["operator"] }, act: { switch: ["cookie-session"] }, changes: [], opens: true, scripts: [], oldIds: ["show-advanced"] },
|
|
25
28
|
{ id: "local-mode", area: "general", title: "Local mode", pinnedFrom: "settings.group-access", policy: GROUP_PAGE,
|
|
@@ -304,6 +304,28 @@ function taskSizingSection(deps) {
|
|
|
304
304
|
},
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
|
+
export const FLEXIBLE_SETTING_WORDS = "Claude Code only for now. Runs inside Toolroll's sandbox with your Claude sign-in relayed; Toolroll never gives the agent your key.";
|
|
308
|
+
function flexibleSection(deps) {
|
|
309
|
+
return {
|
|
310
|
+
loadSummary: ctx => ({ on: deps.flexible().on, canSwitch: ctx.can["switch"] === true }),
|
|
311
|
+
render: ({ summary, attrs }) => settingsSection({ id: "flexible", title: "Interactive agent threads (beta)", state: summary.on ? " · on" : " · off", attrs,
|
|
312
|
+
lead: `${summary.on ? "On" : "Off"}. ${FLEXIBLE_SETTING_WORDS}`,
|
|
313
|
+
...(summary.canSwitch ? { right: btn(summary.on ? "Turn off" : "Turn on", { sm: true, href: "/settings/change/flexible" }) } : {}), body: html `` }),
|
|
314
|
+
refusal: "An instance operator turns interactive agent threads on or off.",
|
|
315
|
+
renderChange: ({ declaration, summary, problem }) => {
|
|
316
|
+
const home = sectionHref(declaration);
|
|
317
|
+
const on = summary?.on === true;
|
|
318
|
+
const title = "Interactive agent threads (beta)";
|
|
319
|
+
const words = joinHtml([
|
|
320
|
+
html `<p>${on ? "Turn them off. No new thread or turn starts, and any thread running now is stopped." : `Turn them on. Press T in the workbench to work with Claude Code in a thread. ${FLEXIBLE_SETTING_WORDS} Each project still needs its own Flexible terms, and each thread shows its terms before it starts.`}</p>`,
|
|
321
|
+
problem === null ? "" : notice(problem),
|
|
322
|
+
kitSectionForm({ proof: on ? "flexible-switch" : "flexible-switch-on", action: "/settings/flexible", id: "flexible-form", native: true, save: { label: on ? "Turn off" : "Turn on" }, confirm: on ? "Turn off interactive agent threads" : "Turn on interactive agent threads", hidden: { enabled: on ? "off" : "on" }, body: html `` }),
|
|
323
|
+
html `<div class="k-acts">${btn("Cancel", { variant: "ghost", href: home })}</div>`,
|
|
324
|
+
]);
|
|
325
|
+
return { title, body: html `<div data-kit-page>${phoneHeader(title, { back: home })}${doc(docHeader({ title, back: [home, "General"], same: true }), words)}</div>` };
|
|
326
|
+
},
|
|
327
|
+
};
|
|
328
|
+
}
|
|
307
329
|
export function generalSections(deps) {
|
|
308
330
|
return {
|
|
309
331
|
appearance: appearanceSection(),
|
|
@@ -312,6 +334,7 @@ export function generalSections(deps) {
|
|
|
312
334
|
version: versionSection(deps),
|
|
313
335
|
"install-mode": installModeSection(deps),
|
|
314
336
|
"task-sizing": taskSizingSection(deps),
|
|
337
|
+
flexible: flexibleSection(deps),
|
|
315
338
|
advanced: advancedSection(),
|
|
316
339
|
"local-mode": localModeSection(deps),
|
|
317
340
|
};
|
package/dist/server/settings.js
CHANGED
|
@@ -58,7 +58,7 @@ import { resolvePhaseAgent } from "../agentconfig.js";
|
|
|
58
58
|
import { parseProtectedPaths } from "../approval-policy.js";
|
|
59
59
|
import { approvalRulesHtml, releaseApprovalHtml } from "../approval-rules-ui.js";
|
|
60
60
|
import { releaseApprovalSetting, setReleaseApproval } from "../release-auto.js";
|
|
61
|
-
import {
|
|
61
|
+
import { flexibleAvailable, flexibleSetting, setFlexibleSetting } from "../flexible-available.js";
|
|
62
62
|
import { enableFlexible, FLEXIBLE_LEVEL_WORDS, FLEXIBLE_UNAVAILABLE, flexibleSettingsView, isFlexibleLevel, lowerFlexible, turnFlexibleOff } from "../flexible.js";
|
|
63
63
|
import { backupHtml } from "../backup-ui.js";
|
|
64
64
|
import { BACKUP_EVERY_HOURS, backupFolderOf, backupNow, checkBackupFolder, defaultBackupFolder, MAX_KEEP } from "../backup.js";
|
|
@@ -2766,6 +2766,7 @@ ${postForm("/settings/chat-approval/save", html `\
|
|
|
2766
2766
|
"settings.lead-about": leadAbout,
|
|
2767
2767
|
"settings.lead-quick": leadQuick,
|
|
2768
2768
|
"settings.task-sizing": taskSizingAct,
|
|
2769
|
+
"settings.flexible": flexibleSwitchAct,
|
|
2769
2770
|
"settings.lead-promise-cancel": leadPromiseCancel,
|
|
2770
2771
|
"settings.lead-on": leadOn,
|
|
2771
2772
|
"settings.code-map": codeMapAct("switch"),
|
|
@@ -3020,6 +3021,37 @@ ${postForm("/settings/chat-approval/save", html `\
|
|
|
3020
3021
|
const read = taskSizingSetting(store);
|
|
3021
3022
|
return done("said", wanted === "on" ? `Task sizing is on. Each new task is sized by ${read.available === "jev" ? "Jev through your OpenRouter key" : "a quick call to Claude Haiku on your plan"} before you approve.` : "Task sizing is off. No model call before you approve; uncertain tasks get a plan first.");
|
|
3022
3023
|
}
|
|
3024
|
+
async function flexibleSwitchAct(ctx) {
|
|
3025
|
+
const { response, now, posted } = ctx;
|
|
3026
|
+
const who = browserCaller(ctx.who);
|
|
3027
|
+
const body = readForm(posted, CONSOLE_FORMS.flexibleSwitch);
|
|
3028
|
+
const done = sayTo(response, "/settings/general?section=flexible");
|
|
3029
|
+
const back = sayTo(response, "/settings/change/flexible");
|
|
3030
|
+
if (["password", "enabled"].some(field => body.sent.getAll(field).length > 1))
|
|
3031
|
+
return back("problem", "That form was sent twice over. Nothing changed.");
|
|
3032
|
+
const wanted = body.get("enabled");
|
|
3033
|
+
if (wanted !== "on" && wanted !== "off")
|
|
3034
|
+
return back("problem", "Choose on or off.");
|
|
3035
|
+
const saved = store.transact(() => {
|
|
3036
|
+
if (!store.isInstanceOperator(who.name))
|
|
3037
|
+
return false;
|
|
3038
|
+
if (wanted === "on") {
|
|
3039
|
+
if (!authenticateCredential(who, body.get("password") ?? "").ok)
|
|
3040
|
+
return false;
|
|
3041
|
+
}
|
|
3042
|
+
else {
|
|
3043
|
+
if (who.authority !== "full" && localActNow(store, "flexible-switch") === null)
|
|
3044
|
+
return false;
|
|
3045
|
+
if (!authenticateApprover(who, body.get("password") ?? "").ok)
|
|
3046
|
+
return false;
|
|
3047
|
+
}
|
|
3048
|
+
setFlexibleSetting(store, wanted === "on", who.name, now);
|
|
3049
|
+
return true;
|
|
3050
|
+
});
|
|
3051
|
+
if (!saved)
|
|
3052
|
+
return back("problem", wanted === "on" ? "Turning interactive agent threads on needs your Toolroll password, typed now." : "Enter your Toolroll password to change interactive agent threads.");
|
|
3053
|
+
return done("said", wanted === "on" ? "Interactive agent threads are on. Press T in the workbench to start one with Claude Code." : "Interactive agent threads are off. Any thread still running is stopped.");
|
|
3054
|
+
}
|
|
3023
3055
|
async function justMe(ctx) {
|
|
3024
3056
|
const { response, now, posted } = ctx;
|
|
3025
3057
|
const who = browserCaller(ctx.who);
|
|
@@ -3156,8 +3188,6 @@ ${postForm("/settings/chat-approval/save", html `\
|
|
|
3156
3188
|
async function projectFlexible(ctx) {
|
|
3157
3189
|
const { response, now, posted } = ctx;
|
|
3158
3190
|
const who = browserCaller(ctx.who);
|
|
3159
|
-
if (!FLEXIBLE_AVAILABLE)
|
|
3160
|
-
return refuse(response, who, 403, FLEXIBLE_UNAVAILABLE, "/settings/project");
|
|
3161
3191
|
const body = readForm(posted, CONSOLE_FORMS.projectFlexible);
|
|
3162
3192
|
const repo = body.get("repo") ?? "";
|
|
3163
3193
|
if (!consoleProjects().includes(repo) || !visible(repo))
|
|
@@ -3179,6 +3209,8 @@ ${postForm("/settings/chat-approval/save", html `\
|
|
|
3179
3209
|
}
|
|
3180
3210
|
if (action !== "enable")
|
|
3181
3211
|
return back("problem", "Choose to turn Flexible on, lower it or turn it off. Nothing changed.");
|
|
3212
|
+
if (!flexibleAvailable(store))
|
|
3213
|
+
return refuse(response, who, 403, FLEXIBLE_UNAVAILABLE, "/settings/project");
|
|
3182
3214
|
const proved = authenticateCredential(who, body.get("password") ?? "", repo);
|
|
3183
3215
|
if (!proved.ok)
|
|
3184
3216
|
return back("problem", "Enter your Toolroll password to turn on Flexible.");
|
|
@@ -3199,6 +3231,7 @@ ${postForm("/settings/chat-approval/save", html `\
|
|
|
3199
3231
|
localModeOn: () => localModeOf(store)?.enabled === true,
|
|
3200
3232
|
installMode: () => installModeNow(store),
|
|
3201
3233
|
taskSizing: () => taskSizingSetting(store),
|
|
3234
|
+
flexible: () => flexibleSetting(store),
|
|
3202
3235
|
});
|
|
3203
3236
|
const computersDeps = {
|
|
3204
3237
|
computers: (now, manage) => computersOf(store, now, visible, manage),
|
package/dist/server/terminals.js
CHANGED
|
@@ -10,7 +10,7 @@ import { loadPtySpawn, MAX_FRAME_BYTES, TerminalHost, MAX_VIEWERS, parseTerminal
|
|
|
10
10
|
import { logEvent } from "../log.js";
|
|
11
11
|
import { sessionStandsIn, soloNow } from "../install-mode.js";
|
|
12
12
|
import { localOwnerStandsNow } from "../local-owner.js";
|
|
13
|
-
import { resultRunsOf } from "../engine-reads.js";
|
|
13
|
+
import { resultRunsOf, SHELL_NO_COMMIT, SHELL_NO_RESULT } from "../engine-reads.js";
|
|
14
14
|
import { checkEngineResponse } from "../contracts/engine-api.js";
|
|
15
15
|
import { projectName, rowVisible } from "../project.js";
|
|
16
16
|
import { transportOf } from "../public-access.js";
|
|
@@ -119,10 +119,10 @@ export function createTerminalHandlers(runtime, deps) {
|
|
|
119
119
|
return "No such task.";
|
|
120
120
|
const run = resultRunsOf(store, family).filter(one => runtime.runVisible(one)).find(one => one.id === runId) ?? null;
|
|
121
121
|
if (run === null)
|
|
122
|
-
return
|
|
122
|
+
return SHELL_NO_RESULT;
|
|
123
123
|
const revision = run.headRevision;
|
|
124
124
|
if (revision === null || !/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/.test(revision))
|
|
125
|
-
return
|
|
125
|
+
return SHELL_NO_COMMIT;
|
|
126
126
|
const repo = runtime.taskRepoOf(run.taskRef);
|
|
127
127
|
if (repo === null)
|
|
128
128
|
return "This build's project isn't known here.";
|
package/dist/settings-proofs.js
CHANGED
|
@@ -55,6 +55,8 @@ export const PROOF_INVENTORY = [
|
|
|
55
55
|
{ id: "mode-sign-chat-approve", action: "Sign an operating mode that lets your chat app approve", routes: ["/mode/sign"], select: { field: "chat-approve", value: "1" }, form: "mode", field: "token", proof: "credential", ...CREDENTIAL, role: "any", handlerRole: "an approver of the project", secrets: [], terms: MODE_TERMS },
|
|
56
56
|
{ id: "mode-sign-repair", action: "Sign an operating mode that repairs failed checks by itself", routes: ["/mode/sign"], select: { field: "repair-auto", value: "1" }, form: "mode", field: "token", proof: "credential", ...CREDENTIAL, role: "any", handlerRole: "an approver of the project", secrets: [], terms: MODE_TERMS },
|
|
57
57
|
{ id: "install-solo", action: "Say it's just you", routes: ["/settings/install-mode/solo"], form: "justMe", field: "password", proof: "credential", ...CREDENTIAL, role: "operator", handlerRole: "a full session (never the local owner)", secrets: [], terms: [] },
|
|
58
|
+
{ id: "flexible-switch", action: "Turn interactive agent threads off", routes: ["/settings/flexible"], form: "flexibleSwitch", field: "password", proof: "step-up", ...ACCEPT, role: "operator", secrets: [], terms: ["enabled"] },
|
|
59
|
+
{ id: "flexible-switch-on", action: "Turn interactive agent threads on", routes: ["/settings/flexible"], select: { field: "enabled", value: "on" }, form: "flexibleSwitch", field: "password", proof: "credential", ...CREDENTIAL, role: "operator", handlerRole: "a full session (never the local owner)", secrets: [], terms: ["enabled"] },
|
|
58
60
|
{ id: "task-sizing", action: "Turn task sizing by a quick model call on or off", routes: ["/settings/task-sizing"], form: "taskSizing", field: "password", proof: "step-up", ...ACCEPT, role: "operator", secrets: [], terms: ["enabled", "sizer"] },
|
|
59
61
|
{ id: "provider-key", action: "Save an AI provider key", routes: ["/settings/provider-key"], form: "providerKey", field: "password", proof: "credential", ...CREDENTIAL, role: "any", secrets: ["value"], terms: [] },
|
|
60
62
|
{ id: "telegram-token", action: "Save the Telegram bot token", routes: ["/settings/telegram-token"], form: "telegramToken", field: "password", proof: "credential", ...CREDENTIAL, role: "any", secrets: ["token"], notProof: ["token"], terms: [] },
|
package/dist/store.js
CHANGED
|
@@ -28,6 +28,7 @@ import { V167_OBJECTS, V167_SCHEMA, V167_STEPS } from "./flexible-answers-schema
|
|
|
28
28
|
import { V168_OBJECTS, V168_SCHEMA, V168_STEPS } from "./flexible-ship-schema.js";
|
|
29
29
|
import { V169_ADDED_COLUMNS, V169_SCHEMA, V169_STEPS } from "./task-sizing-schema.js";
|
|
30
30
|
import { V170_ADDED_COLUMNS, V170_STEPS } from "./agent-said-schema.js";
|
|
31
|
+
import { V171_SCHEMA, V171_STEPS } from "./flexible-setting-schema.js";
|
|
31
32
|
import { endLapsedFlexible } from "./flexible.js";
|
|
32
33
|
import { refArchived, taskArchived, taskCancelled } from "./task-archive.js";
|
|
33
34
|
export { refArchived, taskArchived } from "./task-archive.js";
|
|
@@ -832,7 +833,7 @@ export function checkSuitesOf(value) {
|
|
|
832
833
|
}
|
|
833
834
|
}
|
|
834
835
|
const REGISTERED_AT_FILING = "again, as it was filed";
|
|
835
|
-
export const SCHEMA_VERSION =
|
|
836
|
+
export const SCHEMA_VERSION = 171;
|
|
836
837
|
export const V118_MERGED_TABLES = Object.freeze({ api_token: "person", coordinator_credential: "coordinator", lead_credential: "lead" });
|
|
837
838
|
const V118_REFERENCES = /REFERENCES (?:coordinator_credential\(cid\)|api_token\(id\))/g;
|
|
838
839
|
const V118_COORDINATOR_COLUMNS = [["task_ref", "coordinator_cid"], ["coordinator_event", "cid"], ["mcp_idempotency", "cid"], ["coordinator_proposal", "cid"]];
|
|
@@ -897,7 +898,7 @@ export const V115_DROPPED_TABLES = Object.freeze([
|
|
|
897
898
|
"fallback_config", "fallback_cycle", "fallback_transition",
|
|
898
899
|
]);
|
|
899
900
|
const V115_DROPPED_REFERENCES = /\s+REFERENCES (?:contestant|contest|tournament_terms|session_turn|attended_authorization|held_session|fallback_cycle|fallback_config|fallback_transition|routine|routine_fire)\(id\)(?: ON DELETE CASCADE)?/g;
|
|
900
|
-
export const UPDATE_SAFE_MIGRATIONS = Object.freeze([108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170]);
|
|
901
|
+
export const UPDATE_SAFE_MIGRATIONS = Object.freeze([108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171]);
|
|
901
902
|
export const V119_ADDED_COLUMNS = Object.freeze({
|
|
902
903
|
task_ref: { planning_generation: { definition: "INTEGER NOT NULL DEFAULT 0", saved: "0" } },
|
|
903
904
|
run: { planning_generation: { definition: "INTEGER NOT NULL DEFAULT 0", saved: "0" } },
|
|
@@ -1440,7 +1441,7 @@ export { V156_STEPS };
|
|
|
1440
1441
|
export { V157_STEPS };
|
|
1441
1442
|
export { V158_STEPS };
|
|
1442
1443
|
export { V159_STEPS };
|
|
1443
|
-
export { V160_STEPS, V161_STEPS, V162_STEPS, V163_STEPS, V164_STEPS, V165_STEPS, V166_STEPS, V167_STEPS, V168_STEPS, V169_STEPS, V170_STEPS };
|
|
1444
|
+
export { V160_STEPS, V161_STEPS, V162_STEPS, V163_STEPS, V164_STEPS, V165_STEPS, V166_STEPS, V167_STEPS, V168_STEPS, V169_STEPS, V170_STEPS, V171_STEPS };
|
|
1444
1445
|
export const RELEASE_ONCE_SCHEMA = `
|
|
1445
1446
|
CREATE TABLE IF NOT EXISTS release_authority (
|
|
1446
1447
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
@@ -4218,7 +4219,7 @@ function initializeStore(db, file, options = {}) {
|
|
|
4218
4219
|
throw new Error(`${file}: ${problem}; refusing to move chat history it cannot name`);
|
|
4219
4220
|
}
|
|
4220
4221
|
if (preflight === SCHEMA_VERSION && !findingSourcesStale(db)) {
|
|
4221
|
-
const missing = codeMapShapeProblem(db) ?? viewPreferenceShapeProblem(db) ?? flexibleTermsShapeProblem(db) ?? flexibleThreadShapeProblem(db) ?? typedByPersonShapeProblem(db) ?? flexibleTurnsShapeProblem(db) ?? flexibleLaunchShapeProblem(db) ?? flexibleRelayShapeProblem(db) ?? flexibleAnswersShapeProblem(db) ?? flexibleShipShapeProblem(db) ?? taskSizingShapeProblem(db) ?? agentSaidShapeProblem(db);
|
|
4222
|
+
const missing = codeMapShapeProblem(db) ?? viewPreferenceShapeProblem(db) ?? flexibleTermsShapeProblem(db) ?? flexibleThreadShapeProblem(db) ?? typedByPersonShapeProblem(db) ?? flexibleTurnsShapeProblem(db) ?? flexibleLaunchShapeProblem(db) ?? flexibleRelayShapeProblem(db) ?? flexibleAnswersShapeProblem(db) ?? flexibleShipShapeProblem(db) ?? taskSizingShapeProblem(db) ?? agentSaidShapeProblem(db) ?? flexibleSettingShapeProblem(db);
|
|
4222
4223
|
if (missing !== null)
|
|
4223
4224
|
throw new Error(`${file}: refusing to open — ${missing}, though the schema says v${SCHEMA_VERSION}`);
|
|
4224
4225
|
db.exec("PRAGMA journal_mode = WAL; PRAGMA foreign_keys = ON;");
|
|
@@ -4613,6 +4614,11 @@ CREATE INDEX IF NOT EXISTS run_checkpoint_by_task ON run_checkpoint (task_ref, i
|
|
|
4613
4614
|
for (const [column, { definition }] of Object.entries(columns))
|
|
4614
4615
|
addColumn(db, table, column, definition);
|
|
4615
4616
|
step("agent-said-column");
|
|
4617
|
+
db.exec(V171_SCHEMA);
|
|
4618
|
+
const flexibleSettingDamaged = flexibleSettingShapeProblem(db);
|
|
4619
|
+
if (flexibleSettingDamaged !== null)
|
|
4620
|
+
throw new Error(`${file}: refusing to open — ${flexibleSettingDamaged}`);
|
|
4621
|
+
step("flexible-setting");
|
|
4616
4622
|
if (!fresh)
|
|
4617
4623
|
reclaimDatabase(db, "migration");
|
|
4618
4624
|
const expectedMarker = preflight < 0 ? preflight : -preflight;
|
|
@@ -18961,3 +18967,11 @@ export function agentSaidOf(store, runId) {
|
|
|
18961
18967
|
return null;
|
|
18962
18968
|
}
|
|
18963
18969
|
}
|
|
18970
|
+
function flexibleSettingShapeProblem(db) {
|
|
18971
|
+
const row = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'flexible_setting'").get();
|
|
18972
|
+
if (row === undefined)
|
|
18973
|
+
return "the interactive agent threads setting table is missing";
|
|
18974
|
+
if (canonicalDdl(String(row["sql"]).replace(/;$/, "")).trim() !== canonicalDdl(V171_SCHEMA.trim().replace(/;$/, "")).trim())
|
|
18975
|
+
return "the interactive agent threads setting table has an unknown shape";
|
|
18976
|
+
return null;
|
|
18977
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|