toolroll 0.9.117 → 0.9.119
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 +42 -0
- package/README.md +14 -14
- package/dist/agent-fence.js +54 -6
- package/dist/assignment.js +40 -29
- package/dist/browser/workspace.css +1 -1
- package/dist/browser/workspace.js +32 -31
- package/dist/builder.js +295 -237
- package/dist/central-recovery-stage.js +3 -3
- package/dist/check-failure.js +2 -2
- package/dist/check-levels.js +3 -0
- package/dist/check-report.js +58 -7
- package/dist/coding-context.js +16 -2
- package/dist/coding-provider.js +7 -3
- package/dist/coding-workspace.js +5 -5
- package/dist/contracts/console-api.js +4 -1
- package/dist/contracts/engine-api.js +1 -0
- package/dist/contracts/release-check.js +7 -4
- package/dist/contracts/release-terms.js +11 -2
- package/dist/contracts/verification-receipt.js +1 -1
- package/dist/deploy-gate.js +7 -1
- package/dist/direct-chat.js +3 -3
- package/dist/easy-start.js +8 -6
- package/dist/engine-reads.js +72 -0
- package/dist/flexible-conversation-schema.js +24 -0
- package/dist/flexible-conversation.js +162 -0
- package/dist/flexible-custody.js +3 -0
- package/dist/flexible-import.js +51 -0
- package/dist/flexible-session.js +84 -11
- package/dist/install-mode.js +1 -1
- package/dist/invoke.js +18 -6
- package/dist/local-landing.js +500 -0
- package/dist/local-owner.js +1 -0
- package/dist/operate.js +143 -22
- package/dist/passwordless.js +1 -1
- package/dist/planner.js +6 -1
- package/dist/project-delete.js +1 -0
- package/dist/project-skills.js +28 -13
- package/dist/rehearsal.js +27 -0
- package/dist/release-adapters.js +170 -2
- package/dist/release-approval.js +11 -8
- package/dist/release-card.js +7 -2
- package/dist/release-carry.js +1 -1
- package/dist/release-cli.js +115 -14
- package/dist/release-main-proof.js +49 -0
- package/dist/release-main.js +110 -0
- package/dist/release-recheck.js +10 -3
- package/dist/release.js +221 -33
- package/dist/reply-shape.js +6 -1
- package/dist/result-actions.js +7 -1
- package/dist/result-follow-ups.js +8 -4
- package/dist/scout.js +6 -2
- package/dist/serve.js +31 -14
- package/dist/server/direct-chat.js +88 -3
- package/dist/server/engine-api.js +43 -5
- package/dist/server/render-results.js +3 -1
- package/dist/server/render-tasks.js +10 -1
- package/dist/server/route-table.js +9 -0
- package/dist/server/settings.js +31 -7
- package/dist/server/task-views.js +15 -0
- package/dist/server/tasks.js +63 -3
- package/dist/settings-groups-ui.js +2 -2
- package/dist/skills-manifest.js +57 -0
- package/dist/store.js +29 -4
- package/dist/surface.js +9 -1
- 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/verification-evidence.js +17 -6
- package/dist/workspace-ui.js +1 -1
- package/package.json +3 -2
- package/scripts/release-proof.mjs +240 -0
|
@@ -6,9 +6,9 @@ import { openStore } from "./store.js";
|
|
|
6
6
|
import { holdAutoPublish, autoPublishHeld, PUBLISH_ALLOWED_ACTION, PUBLISH_HELD_ACTION } from "./release-auto.js";
|
|
7
7
|
import { revokeCoordinator } from "./coordinator.js";
|
|
8
8
|
export const MAX_STAGE_BYTES = 128 * 1024 * 1024;
|
|
9
|
-
const SUPPORTED_SCHEMA =
|
|
10
|
-
const SCHEMA_OBJECT_COUNT =
|
|
11
|
-
const SCHEMA_DIGEST = "
|
|
9
|
+
const SUPPORTED_SCHEMA = 185;
|
|
10
|
+
const SCHEMA_OBJECT_COUNT = 726;
|
|
11
|
+
const SCHEMA_DIGEST = "8e589635cf648eef4a4c85fb12c614b3c004d983df639ccd2bf95b3005bf5791";
|
|
12
12
|
const INVENTORY = [
|
|
13
13
|
["person-credentials", "store.ts:revokeApiToken", "credential", true],
|
|
14
14
|
["lead-credentials", "store.ts:revokeLeadCredentials", "credential", true],
|
package/dist/check-failure.js
CHANGED
|
@@ -4,7 +4,7 @@ import { busyMachineTimeout, CHECK_LOAD_CAPTURE, readCheckLoad } from "./check-l
|
|
|
4
4
|
import { regateTask } from "./dispose.js";
|
|
5
5
|
import { INFRA_RERUNS_PER_CANDIDATE, INFRA_RERUNS_PER_INCIDENT } from "./release.js";
|
|
6
6
|
import { releaseCheckScope } from "./scope.js";
|
|
7
|
-
import { isVerificationReceipt, verificationEvidence } from "./verification-evidence.js";
|
|
7
|
+
import { coveragePasses, isVerificationReceipt, verificationEvidence } from "./verification-evidence.js";
|
|
8
8
|
import { checkAttemptOf } from "./store.js";
|
|
9
9
|
import { endedInterrupted } from "./run-ending.js";
|
|
10
10
|
export { INFRA_RERUNS_PER_CANDIDATE, INFRA_RERUNS_PER_INCIDENT };
|
|
@@ -18,7 +18,7 @@ const PLANE_INFRA = {
|
|
|
18
18
|
const busyWords = (why) => `${why}: Toolroll's own machine, so this commit's check runs again`;
|
|
19
19
|
export function classifyCheckFailure(facts, report, load = null) {
|
|
20
20
|
const result = facts.result;
|
|
21
|
-
const passedCoverage = facts.coverage
|
|
21
|
+
const passedCoverage = coveragePasses(facts.coverage);
|
|
22
22
|
if (result.configured && result.ran === true && result.exitCode === 0 && passedCoverage)
|
|
23
23
|
return null;
|
|
24
24
|
if (!result.configured)
|
package/dist/check-levels.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
+
import { folderAnswers } from "./folder-gate.js";
|
|
3
4
|
import { approvalOf } from "./scope.js";
|
|
4
5
|
export const CHECK_LEVELS = ["quick", "full", "off"];
|
|
5
6
|
export const isCheckLevel = (value) => typeof value === "string" && CHECK_LEVELS.includes(value);
|
|
@@ -107,6 +108,8 @@ export function runCheckLevel(store, runId) {
|
|
|
107
108
|
return row !== null && isCheckLevel(row.outcome) ? row.outcome : null;
|
|
108
109
|
}
|
|
109
110
|
export function suggestQuickCommand(repo) {
|
|
111
|
+
if (!folderAnswers(repo))
|
|
112
|
+
return null;
|
|
110
113
|
const file = join(repo, "package.json");
|
|
111
114
|
if (!existsSync(file))
|
|
112
115
|
return null;
|
package/dist/check-report.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createHash, randomBytes } from "node:crypto";
|
|
|
2
2
|
import { lstatSync, realpathSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { readVerifiedCommit, verifiedBlobs, verifiedTreeEntries } from "./commit-extract.js";
|
|
5
|
-
import { CHECK_PARTS, CHECK_REPORT_MAX_BYTES, CHECK_REPORT_PREFIX, learnRequest, readCheckReport, } from "./contracts/release-check.js";
|
|
5
|
+
import { CHECK_PARTS, CHECK_REPORT_MAX_BYTES, CHECK_REPORT_PREFIX, DEPLOY_PART, learnRequest, readCheckReport, } from "./contracts/release-check.js";
|
|
6
6
|
import { readVerifiedArtifact, storeEvidence } from "./evidence.js";
|
|
7
7
|
import { releaseBaselineRecord } from "./release-card.js";
|
|
8
8
|
import { checkAttemptOf, recordCheckAttempt } from "./store.js";
|
|
@@ -130,25 +130,30 @@ export function prepareCheckAttempt(store, root, input, now) {
|
|
|
130
130
|
}
|
|
131
131
|
baseFacts = baseRead.facts;
|
|
132
132
|
}
|
|
133
|
-
const
|
|
133
|
+
const fullOwed = fullObligationsOf(read.facts, baseFacts, baseFacts === null ? [] : versionBumpsOf(gitDir, baseFacts, read.facts));
|
|
134
|
+
const deploy = input.deploy ?? null;
|
|
135
|
+
if (deploy !== null && plan !== null)
|
|
136
|
+
throw new Error("A deploy check runs no targeted plan.");
|
|
137
|
+
const owed = deploy === null ? fullOwed : ["build", DEPLOY_PART, ...(fullOwed.includes("upgrade") ? ["upgrade"] : [])];
|
|
134
138
|
const release = input.release !== false;
|
|
135
139
|
const ciSubstitute = !release;
|
|
136
|
-
const inventory = inventoryOf(read.facts, plan, { owed, release });
|
|
140
|
+
const inventory = deploy === null ? inventoryOf(read.facts, plan, { owed: fullOwed, release }) : { version: 1, units: [], parts: owed, ciSubstitute: false, release: true, deploy: true };
|
|
137
141
|
const context = checkContextOf(read.facts, input.command, input.access);
|
|
138
142
|
const nonce = randomBytes(32).toString("hex");
|
|
139
|
-
const mode = plan === null ? "full" : "targeted";
|
|
143
|
+
const mode = deploy !== null ? "deploy" : plan === null ? "full" : "targeted";
|
|
140
144
|
sealJson(store, root, input.runId, "check-context.json", context, CHECK_CONTEXT_CAPTURE, now);
|
|
141
145
|
if (plan !== null)
|
|
142
146
|
sealJson(store, root, input.runId, "targeted-plan.json", plan, TARGETED_PLAN_CAPTURE, now);
|
|
143
147
|
if (snapshot !== null)
|
|
144
148
|
sealJson(store, root, input.runId, "obligation-snapshot.json", snapshot, OBLIGATION_SNAPSHOT_CAPTURE, now);
|
|
145
149
|
recordCheckAttempt(store, {
|
|
146
|
-
run: input.runId, authority: input.authority ?? null, mode, baseRun: plan?.base ?? null,
|
|
150
|
+
run: input.runId, authority: input.authority ?? null, mode: mode === "deploy" ? "full" : mode, baseRun: plan?.base ?? null,
|
|
147
151
|
planDigest: plan === null ? null : payloadDigest(plan), snapshotDigest: snapshot === null ? null : payloadDigest(snapshot),
|
|
148
152
|
inventoryDigest: payloadDigest(inventory), contextDigest: payloadDigest(context), nonceHash: sha256(nonce),
|
|
149
153
|
}, now);
|
|
150
154
|
const learn = learnRequest(input.learn ?? []);
|
|
151
|
-
const stdin = JSON.stringify({ nonce, mode, plan, watch: [...(input.watch ?? [])], limitMs: Number.isSafeInteger(input.limitMs) && input.limitMs >= input.command.timeoutMs ? input.limitMs : input.command.timeoutMs, reportBytes: CHECK_ARTIFACT_CAP, ...(plan === null ? { owed, ciSubstitute } : {}), ...(learn.length > 0 ? { learn } : {})
|
|
155
|
+
const stdin = JSON.stringify({ nonce, mode, plan, watch: [...(input.watch ?? [])], limitMs: Number.isSafeInteger(input.limitMs) && input.limitMs >= input.command.timeoutMs ? input.limitMs : input.command.timeoutMs, reportBytes: CHECK_ARTIFACT_CAP, ...(plan === null ? { owed, ciSubstitute } : {}), ...(learn.length > 0 && deploy === null ? { learn } : {}),
|
|
156
|
+
...(deploy === null ? {} : { copy: deploy.copy }) });
|
|
152
157
|
return { runId: input.runId, nonce, stdin, mode, inventory, context, plan, snapshot, watch: [...(input.watch ?? [])], learn };
|
|
153
158
|
}
|
|
154
159
|
export function sealJson(store, root, runId, name, value, capture, now) {
|
|
@@ -213,6 +218,50 @@ export function readSealedJson(store, root, runId, capture) {
|
|
|
213
218
|
return null;
|
|
214
219
|
}
|
|
215
220
|
}
|
|
221
|
+
export function deployCheckProblem(input) {
|
|
222
|
+
const { report, inventory, exitCode } = input;
|
|
223
|
+
if (exitCode === null)
|
|
224
|
+
return "the deploy check didn't end on its own (it timed out or was stopped), so it has no result";
|
|
225
|
+
if (report === null)
|
|
226
|
+
return "the deploy check gave no valid report for this run";
|
|
227
|
+
if (report.mode !== "deploy")
|
|
228
|
+
return `the check reported a ${report.mode} run, not the deploy check it was asked for`;
|
|
229
|
+
if (report.exitCode !== exitCode)
|
|
230
|
+
return `the check's report says exit ${report.exitCode}, but it exited ${exitCode}`;
|
|
231
|
+
if (inventory === null)
|
|
232
|
+
return "the check's sealed inventory can't be read";
|
|
233
|
+
if (inventory.sealed.deploy !== true || inventory.sealed.release !== true)
|
|
234
|
+
return "the check wasn't sealed as a deploy check before it ran";
|
|
235
|
+
if (exitCode !== 0)
|
|
236
|
+
return null;
|
|
237
|
+
const parts = new Map(report.parts.map(one => [one.part, one]));
|
|
238
|
+
if (parts.size !== report.parts.length)
|
|
239
|
+
return "the report names a part twice";
|
|
240
|
+
const owed = new Set(["build", DEPLOY_PART, ...inventory.sealed.parts]);
|
|
241
|
+
for (const part of owed) {
|
|
242
|
+
const one = parts.get(part);
|
|
243
|
+
if (one === undefined || one.selected !== true)
|
|
244
|
+
return `the deploy check owed the ${part}, and the report doesn't say it ran`;
|
|
245
|
+
}
|
|
246
|
+
for (const part of report.parts) {
|
|
247
|
+
if (!part.selected)
|
|
248
|
+
continue;
|
|
249
|
+
if (!part.ran || part.code === null)
|
|
250
|
+
return `${part.part} has no result: it was selected and never ran`;
|
|
251
|
+
if (part.timedOut || part.stopped === true || part.signal != null)
|
|
252
|
+
return `${part.part} has no result: it was stopped before it finished`;
|
|
253
|
+
if (part.code !== 0)
|
|
254
|
+
return `${part.part} exited ${part.code}, yet the check exited 0`;
|
|
255
|
+
}
|
|
256
|
+
if (owed.has("upgrade")) {
|
|
257
|
+
const upgrades = report.upgrades;
|
|
258
|
+
if (upgrades === null || !upgrades.finished || upgrades.inventoried !== true)
|
|
259
|
+
return "the upgrade path has no complete result";
|
|
260
|
+
if (upgrades.versions.length === 0 || upgrades.versions.some(one => one.state !== "passed"))
|
|
261
|
+
return "the upgrade path didn't pass every version it listed";
|
|
262
|
+
}
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
216
265
|
export function fullCheckProblem(input) {
|
|
217
266
|
const { report, inventory, exitCode } = input;
|
|
218
267
|
if (exitCode === null)
|
|
@@ -232,7 +281,9 @@ export function fullCheckProblem(input) {
|
|
|
232
281
|
const parts = new Map(report.parts.map(one => [one.part, one]));
|
|
233
282
|
if (parts.size !== report.parts.length || CHECK_PARTS.some(part => !parts.has(part)))
|
|
234
283
|
return "the report doesn't account for every part of the check exactly once";
|
|
235
|
-
|
|
284
|
+
if (inventory.sealed.deploy === true)
|
|
285
|
+
return "the check was sealed as a deploy check, not a full one";
|
|
286
|
+
const owed = new Set(["typecheck", "build", ...inventory.sealed.parts.filter((part) => CHECK_PARTS.includes(part))]);
|
|
236
287
|
for (const part of CHECK_PARTS)
|
|
237
288
|
if (owed.has(part) && parts.get(part).selected !== true)
|
|
238
289
|
return `the report says the ${part} wasn't selected, but the check owed it`;
|
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.');
|
|
@@ -178,7 +178,7 @@ export const CONSOLE_FORMS = {
|
|
|
178
178
|
chatAck: formContract("POST /chat/ack/<id>", ["token", "nonce"]),
|
|
179
179
|
recipes: formContract("POST /recipes/prepare, /recipes/preview, /recipes/import, /recipes/launch, /recipes/save", ["repo", "projectRevision", "recipe", "recipeRevision", "document", "purpose", "source", "sourceRevision", "preview", "next"]),
|
|
180
180
|
runNote: formContract("POST /r/<run>/note", ["note"]),
|
|
181
|
-
diffComment: formContract("POST /r/<run>/comment", ["return", "tab", "intent", "batch", "source", "context", "note", "path", "line", "request", "image", "comment"]),
|
|
181
|
+
diffComment: formContract("POST /r/<run>/comment", ["return", "tab", "intent", "batch", "source", "context", "note", "path", "line", "request", "image", "comment", "approve"]),
|
|
182
182
|
editorLinks: formContract("POST /session/editor-links", ["on", "return"]),
|
|
183
183
|
revise: formContract("POST /r/<run>/revise", ["return", "batch", "source"]),
|
|
184
184
|
followUp: formContract("POST /r/<run>/checks|add-tests", ["return", "level"]),
|
|
@@ -205,6 +205,7 @@ export const CONSOLE_FORMS = {
|
|
|
205
205
|
taskApprove: formContract("POST /t/<task>/approve", ["return", "digest", "token", "nonce", "rebuild", "sheet"]),
|
|
206
206
|
taskAcceptProof: formContract("POST /t/<task>/accept-proof", ["run", "note", "return"]),
|
|
207
207
|
taskComplete: formContract("POST /t/<task>/complete", ["receipt", "run", "accept", "note", "publish", "return"]),
|
|
208
|
+
taskLand: formContract("POST /t/<task>/land", ["key", "into", "undo"]),
|
|
208
209
|
taskStop: formContract("POST /t/<task>/stop", ["run", "return"]),
|
|
209
210
|
taskPause: formContract("POST /t/<task>/pause", ["run", "request", "note", "mode", "return", "key"]),
|
|
210
211
|
taskResume: formContract("POST /t/<task>/resume|resume-arm", ["run", "token", "nonce", "return"]),
|
|
@@ -216,6 +217,8 @@ export const CONSOLE_FORMS = {
|
|
|
216
217
|
directChatShipPreview: formContract("POST /engine/direct-chats/<id>/ship-preview", ["mode", "title", "goal"]),
|
|
217
218
|
directChatShip: formContract("POST /engine/direct-chats/<id>/ship", ["mode", "title", "goal", "termsDigest", "password"]),
|
|
218
219
|
directChatShipCancel: formContract("POST /engine/direct-chats/<id>/ship-cancel", ["shipId"]),
|
|
220
|
+
directChatPageShipReview: formContract("POST /direct-chats/<id>/ship-review", []),
|
|
221
|
+
directChatPageShip: formContract("POST /direct-chats/<id>/ship", ["mode", "termsDigest", "title", "goal", "password"]),
|
|
219
222
|
};
|
|
220
223
|
export const BODILESS_POSTS = [
|
|
221
224
|
"POST /settings/models/<unknown action>",
|
|
@@ -9,6 +9,7 @@ const liveRecordSchema = z.union([
|
|
|
9
9
|
z.object({ k: z.literal("open"), at: iso, detail: z.enum(["base", "commands"]), s: z.number().int().optional() }),
|
|
10
10
|
z.object({ k: z.literal("start"), at: iso, s: z.number().int().optional() }),
|
|
11
11
|
z.object({ k: z.literal("say"), at: iso, t: z.array(z.string()), s: z.number().int().optional() }),
|
|
12
|
+
z.object({ k: z.literal("you"), at: iso, t: z.array(z.string()) }),
|
|
12
13
|
z.object({ k: z.literal("step"), at: iso, id: z.string(), kind: z.string(), target: z.string().optional(), once: z.literal(true).optional(), s: z.number().int().optional() }),
|
|
13
14
|
z.object({ k: z.literal("done"), at: iso, id: z.string(), ok: z.boolean().nullable(), out: z.array(z.string()).optional(), s: z.number().int().optional() }),
|
|
14
15
|
z.object({ k: z.literal("cut"), at: iso, s: z.number().int().optional() }),
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { readVersioned, versioned } from "./contract.js";
|
|
3
3
|
export const CHECK_PARTS = ["typecheck", "build", "unit", "flows", "app", "flows-real", "app-real", "upgrade"];
|
|
4
|
+
export const DEPLOY_PART = "rehearsal";
|
|
5
|
+
export const REPORT_PARTS = [...CHECK_PARTS, DEPLOY_PART];
|
|
4
6
|
export const JOURNEY_SCRIPTS = ["app", "flows"];
|
|
5
7
|
const hex64 = z.string().regex(/^[0-9a-f]{64}$/);
|
|
6
8
|
const repoPath = z.string().min(1).max(512).regex(/^(?!\/)(?!.*(?:^|\/)\.\.?(?:\/|$))[^\u0000-\u001f\\]+$/);
|
|
@@ -12,11 +14,11 @@ export const CHECK_REPORT_PREFIX = "TOOLROLL_CHECK_REPORT ";
|
|
|
12
14
|
export const CHECK_REPORT_MAX_BYTES = 256 * 1024;
|
|
13
15
|
export const checkReportSchema = versioned(1, {
|
|
14
16
|
nonce: hex64,
|
|
15
|
-
mode: z.enum(["full", "targeted"]),
|
|
17
|
+
mode: z.enum(["full", "targeted", "deploy"]),
|
|
16
18
|
planDigest: hex64.nullable(),
|
|
17
19
|
exitCode: z.int().min(0).max(255),
|
|
18
20
|
parts: z.array(z.strictObject({
|
|
19
|
-
part: z.enum(
|
|
21
|
+
part: z.enum(REPORT_PARTS),
|
|
20
22
|
selected: z.boolean(),
|
|
21
23
|
ran: z.boolean(),
|
|
22
24
|
code: z.int().min(0).max(255).nullable(),
|
|
@@ -25,7 +27,7 @@ export const checkReportSchema = versioned(1, {
|
|
|
25
27
|
signal: z.string().max(20).nullable().optional(),
|
|
26
28
|
stopped: z.boolean().optional(),
|
|
27
29
|
spawnFailed: z.boolean().optional(),
|
|
28
|
-
})).max(
|
|
30
|
+
})).max(REPORT_PARTS.length),
|
|
29
31
|
units: z.strictObject({
|
|
30
32
|
reusedFromCI: z.boolean(),
|
|
31
33
|
finished: z.boolean(),
|
|
@@ -67,9 +69,10 @@ export function readCheckReport(input) {
|
|
|
67
69
|
}
|
|
68
70
|
export const checkInventorySchema = versioned(1, {
|
|
69
71
|
units: z.array(repoPath).max(20_000),
|
|
70
|
-
parts: z.array(z.enum(
|
|
72
|
+
parts: z.array(z.enum(REPORT_PARTS)).max(REPORT_PARTS.length),
|
|
71
73
|
ciSubstitute: z.boolean().optional(),
|
|
72
74
|
release: z.boolean().optional(),
|
|
75
|
+
deploy: z.literal(true).optional(),
|
|
73
76
|
});
|
|
74
77
|
export const sealedInventorySchema = versioned(1, {
|
|
75
78
|
sealed: checkInventorySchema,
|
|
@@ -56,7 +56,8 @@ export function storedReleaseTerms(raw) {
|
|
|
56
56
|
return { ok: true, terms: read.value };
|
|
57
57
|
}
|
|
58
58
|
export const releaseCheckPurposeSchema = versioned(1, {
|
|
59
|
-
purpose: z.
|
|
59
|
+
purpose: z.enum(["release-check", "main-release"]),
|
|
60
|
+
check: z.enum(["deploy", "full"]).optional(),
|
|
60
61
|
repo: z.string().min(1).max(4096),
|
|
61
62
|
packageVersion: z.string().regex(/^\d+\.\d+\.\d+$/),
|
|
62
63
|
branch: z.string().min(1).max(255).regex(/^[A-Za-z0-9._/-]+$/),
|
|
@@ -68,7 +69,15 @@ export const releaseCheckPurposeSchema = versioned(1, {
|
|
|
68
69
|
access: z.enum(["sandboxed", "sign-ins", "unsandboxed"]),
|
|
69
70
|
});
|
|
70
71
|
export function readReleaseCheckPurpose(input) {
|
|
71
|
-
|
|
72
|
+
const read = readVersioned(releaseCheckPurposeSchema, input);
|
|
73
|
+
if (read.ok && (read.value.purpose === "main-release") !== (read.value.check !== undefined))
|
|
74
|
+
return { ok: false, issues: [{ path: "check", kind: "invalid", line: "check: only a main release names its check, and it always does" }] };
|
|
75
|
+
return read;
|
|
76
|
+
}
|
|
77
|
+
export function purposeCheckMode(purpose) {
|
|
78
|
+
if (purpose == null)
|
|
79
|
+
return null;
|
|
80
|
+
return purpose.purpose === "main-release" && purpose.check === "deploy" ? "deploy" : "full";
|
|
72
81
|
}
|
|
73
82
|
export function releaseCheckPurposeDigest(purpose) {
|
|
74
83
|
return createHash("sha256").update(`release-check-purpose:${JSON.stringify(purpose)}`).digest("hex");
|
|
@@ -48,7 +48,7 @@ export const receiptLogSchema = z.strictObject({
|
|
|
48
48
|
captureStatus: z.enum(["ok", "failed"]).nullable(),
|
|
49
49
|
});
|
|
50
50
|
export const RECEIPT_VERSION = 3;
|
|
51
|
-
export const RECEIPT_COVERAGES = ["full", "composed", "partial", "identity-removed", "no-result"];
|
|
51
|
+
export const RECEIPT_COVERAGES = ["full", "composed", "partial", "identity-removed", "no-result", "deploy"];
|
|
52
52
|
const receiptFields = {
|
|
53
53
|
run: z.int(),
|
|
54
54
|
head: z.string(),
|
package/dist/deploy-gate.js
CHANGED
|
@@ -4,6 +4,7 @@ import { verificationEvidence } from "./verification-evidence.js";
|
|
|
4
4
|
import { refArchived } from "./task-archive.js";
|
|
5
5
|
import { releaseCiRunningOf } from "./release-ci-hold.js";
|
|
6
6
|
import { nightlyDebtHold } from "./nightly-github.js";
|
|
7
|
+
import { mainReleaseProofProblem } from "./release-main-proof.js";
|
|
7
8
|
export function deploymentGate(store, input) {
|
|
8
9
|
const refuse = (message) => ({ ok: false, message });
|
|
9
10
|
const run = store.getRun(input.runId);
|
|
@@ -48,8 +49,13 @@ export function deploymentGate(store, input) {
|
|
|
48
49
|
}
|
|
49
50
|
const live = ref.repo === null ? null : store.liveVerifyCommand(ref.repo);
|
|
50
51
|
const result = gate["result"];
|
|
51
|
-
if (gate["coverage"] !== undefined && gate["coverage"] !== "full" && gate["coverage"] !== "composed")
|
|
52
|
+
if (gate["coverage"] !== undefined && gate["coverage"] !== "full" && gate["coverage"] !== "composed" && gate["coverage"] !== "deploy")
|
|
52
53
|
return refuse(`The release check didn't cover this candidate (${String(gate["coverage"])}).`);
|
|
54
|
+
if (gate["coverage"] === "deploy") {
|
|
55
|
+
const problem = mainReleaseProofProblem(store, ref.externalId, scope, input.now);
|
|
56
|
+
if (problem !== null)
|
|
57
|
+
return refuse(`This candidate passed only the deploy check, which deploys a release from main alone: ${problem}.`);
|
|
58
|
+
}
|
|
53
59
|
const command = gate["command"];
|
|
54
60
|
if (gate["run"] !== input.runId || gate["head"] !== head || gate["scopeDigest"] !== scope.digest || result?.ran !== true || result.exitCode !== 0
|
|
55
61
|
|| live === null || command?.command !== live.command)
|
package/dist/direct-chat.js
CHANGED
|
@@ -907,8 +907,8 @@ export class DirectChatHost {
|
|
|
907
907
|
if (finalStatus === "completed") {
|
|
908
908
|
const changed = diff?.changedFiles.length ?? 0;
|
|
909
909
|
const diffPart = changed > 0
|
|
910
|
-
? `${changed} ${changed === 1 ? "file" : "files"} changed
|
|
911
|
-
:
|
|
910
|
+
? `${changed} ${changed === 1 ? "file" : "files"} changed. [Review it](/direct-chats/${thread.id})`
|
|
911
|
+
: `no file changes yet. [Open it](/direct-chats/${thread.id})`;
|
|
912
912
|
const snippet = sanitizeLine(assistantText).slice(0, 160);
|
|
913
913
|
text = snippet !== ""
|
|
914
914
|
? `Direct Chat finished — "${title}" (${providerLabel}, ${proj}): ${diffPart}\n${snippet}${assistantText.trim().length > 160 ? "…" : ""}`
|
|
@@ -916,7 +916,7 @@ export class DirectChatHost {
|
|
|
916
916
|
}
|
|
917
917
|
else {
|
|
918
918
|
const reason = sanitizeLine(errorText ?? "Ended without completing.").slice(0, 180);
|
|
919
|
-
text = `Direct Chat ${finalStatus} — "${title}" (${providerLabel}, ${proj}): ${reason}`;
|
|
919
|
+
text = `Direct Chat ${finalStatus} — "${title}" (${providerLabel}, ${proj}): ${reason} [Open it](/direct-chats/${thread.id})`;
|
|
920
920
|
}
|
|
921
921
|
this.store.appendLeadMessage({ thread: leadThreadId, turn: null, role: "assistant", text, activity: null }, now);
|
|
922
922
|
}
|
package/dist/easy-start.js
CHANGED
|
@@ -226,8 +226,7 @@ export async function runEasyStart(mode, args, seams) {
|
|
|
226
226
|
write(died);
|
|
227
227
|
return EXIT.failed;
|
|
228
228
|
}
|
|
229
|
-
|
|
230
|
-
if (child !== null) {
|
|
229
|
+
if (ownedNow() !== null) {
|
|
231
230
|
if (exit === "keep") {
|
|
232
231
|
const said = await handoff();
|
|
233
232
|
write(said);
|
|
@@ -236,10 +235,13 @@ export async function runEasyStart(mode, args, seams) {
|
|
|
236
235
|
return EXIT.ok;
|
|
237
236
|
}
|
|
238
237
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
238
|
+
const child = ownedNow();
|
|
239
|
+
if (child !== null) {
|
|
240
|
+
write("Stopping Toolroll… (running work is saved)");
|
|
241
|
+
stopOwned(child);
|
|
242
|
+
await child.exited;
|
|
243
|
+
write("Toolroll stopped.");
|
|
244
|
+
}
|
|
243
245
|
}
|
|
244
246
|
write("Reopen with: toolroll");
|
|
245
247
|
return EXIT.ok;
|
package/dist/engine-reads.js
CHANGED
|
@@ -17,6 +17,8 @@ import { DIFF_CONTEXT_MAX, ENGINE_API_VERSION } from "./contracts/engine-api.js"
|
|
|
17
17
|
import { agentSetupOf, detectionLines, NO_AGENT_YET, npmRegistryOf } from "./agent-detect.js";
|
|
18
18
|
import { readVerifiedArtifact, reportShotsOf, scanPatchForSecrets } from "./evidence.js";
|
|
19
19
|
import { fastCompletionProblem } from "./fast-start.js";
|
|
20
|
+
import { cleanLiveText, HIDDEN_LINE } from "./live-records.js";
|
|
21
|
+
import { keyShaped } from "./flexible-conversation.js";
|
|
20
22
|
import { viewedGitSync } from "./teardown-git.js";
|
|
21
23
|
import { wasInterrupted } from "./run-ending.js";
|
|
22
24
|
import { agentChoicesFor, routeOfTask } from "./agentconfig.js";
|
|
@@ -573,3 +575,73 @@ function agentChoicesOf(store, taskId, ref, now) {
|
|
|
573
575
|
const pairs = (phase) => choices[phase].filter(one => one.selectable).map(one => ({ provider: one.provider, model: one.model }));
|
|
574
576
|
return { plan: pairs("plan"), build: pairs("build") };
|
|
575
577
|
}
|
|
578
|
+
function shownPatch(text) {
|
|
579
|
+
let inKey = false, inHunk = false;
|
|
580
|
+
return text.replace(/\r\n/g, "\n").split("\n").map(line => {
|
|
581
|
+
if (line.startsWith("diff --git ")) {
|
|
582
|
+
inHunk = false;
|
|
583
|
+
inKey = false;
|
|
584
|
+
return keyShaped(line) ? `diff --git a/${HIDDEN_NAME} b/${HIDDEN_NAME}` : cleanLiveText(line);
|
|
585
|
+
}
|
|
586
|
+
const named = inHunk ? null : /^(---|\+\+\+) (.*)$/.exec(line);
|
|
587
|
+
if (named !== null)
|
|
588
|
+
return keyShaped(named[2]) ? `${named[1]} ${named[1] === "---" ? "a" : "b"}/${HIDDEN_NAME}` : cleanLiveText(line);
|
|
589
|
+
const hunk = /^(@@ -\d+(?:,\d+)? \+\d+(?:,\d+)? @@)(.*)$/.exec(line);
|
|
590
|
+
if (hunk !== null) {
|
|
591
|
+
inHunk = true;
|
|
592
|
+
const context = hunk[2];
|
|
593
|
+
return PRIVATE_KEY_MARK.test(context) || PRIVATE_KEY_MARK.test(cleanLiveText(context)) || keyShaped(context) ? hunk[1] : cleanLiveText(line);
|
|
594
|
+
}
|
|
595
|
+
const marker = inHunk && /^[-+ ]/.test(line) ? line[0] : "";
|
|
596
|
+
const body = marker === "" ? line : line.slice(1);
|
|
597
|
+
const seen = cleanLiveText(body);
|
|
598
|
+
if (marker !== "" && (/-----BEGIN [A-Z ]*PRIVATE KEY-----/.test(body) || /-----BEGIN [A-Z ]*PRIVATE KEY-----/.test(seen)))
|
|
599
|
+
inKey = true;
|
|
600
|
+
const hide = (marker !== "" && inKey) || keyShaped(body);
|
|
601
|
+
if (marker !== "" && (/-----END [A-Z ]*PRIVATE KEY-----/.test(body) || /-----END [A-Z ]*PRIVATE KEY-----/.test(seen)))
|
|
602
|
+
inKey = false;
|
|
603
|
+
return hide ? `${marker}${HIDDEN_LINE}` : `${marker}${seen}`;
|
|
604
|
+
}).join("\n");
|
|
605
|
+
}
|
|
606
|
+
const PRIVATE_KEY_MARK = /-----(?:BEGIN|END) [A-Z ]*PRIVATE KEY-----/;
|
|
607
|
+
const HIDDEN_NAME = "[a name was hidden]";
|
|
608
|
+
export function threadDiffOf(thread, turn, changes) {
|
|
609
|
+
const empty = (problem) => ({ version: ENGINE_API_VERSION, task: thread, run: turn, totals: null, files: [], patchTruncated: false, problem });
|
|
610
|
+
if (!changes.ok)
|
|
611
|
+
return empty(`This thread's changes can't be read: ${cleanLiveText(changes.message)}`);
|
|
612
|
+
if ("none" in changes)
|
|
613
|
+
return empty("No committed changes yet. Ask the agent to commit its work: Ship sends committed work only.");
|
|
614
|
+
const files = patchFiles(changes.patch).map((text, index) => {
|
|
615
|
+
const parsed = parseReviewDiff(text).files[0];
|
|
616
|
+
let additions = 0, deletions = 0;
|
|
617
|
+
for (const line of text.split("\n")) {
|
|
618
|
+
if (line.startsWith("+") && !line.startsWith("+++"))
|
|
619
|
+
additions += 1;
|
|
620
|
+
else if (line.startsWith("-") && !line.startsWith("---"))
|
|
621
|
+
deletions += 1;
|
|
622
|
+
}
|
|
623
|
+
const binary = /^(?:Binary files .* differ|GIT binary patch)$/m.test(text);
|
|
624
|
+
const shownPath = (path) => keyShaped(path) ? HIDDEN_NAME : cleanLiveText(path);
|
|
625
|
+
return { file: index, path: shownPath(parsed?.path ?? "changed file"), oldPath: parsed?.oldPath == null ? null : shownPath(parsed.oldPath), additions, deletions, binary,
|
|
626
|
+
hunks: parsed?.hunks.length ?? 0 };
|
|
627
|
+
});
|
|
628
|
+
if (files.length === 0)
|
|
629
|
+
return empty("No committed changes yet. Ask the agent to commit its work: Ship sends committed work only.");
|
|
630
|
+
return { version: ENGINE_API_VERSION, task: thread, run: turn, totals: null, files, patchTruncated: changes.truncated, problem: null };
|
|
631
|
+
}
|
|
632
|
+
export function threadDiffFileOf(thread, turn, changes, file) {
|
|
633
|
+
if (!changes.ok || "none" in changes)
|
|
634
|
+
return null;
|
|
635
|
+
const text = patchFiles(changes.patch)[file];
|
|
636
|
+
if (text === undefined)
|
|
637
|
+
return null;
|
|
638
|
+
const parsed = parseReviewDiff(shownPatch(text));
|
|
639
|
+
const one = parsed.files[0];
|
|
640
|
+
if (one === undefined)
|
|
641
|
+
return null;
|
|
642
|
+
return { version: ENGINE_API_VERSION, task: thread, run: turn,
|
|
643
|
+
file: { file, path: keyShaped(one.path) ? HIDDEN_NAME : cleanLiveText(one.path), oldPath: one.oldPath === null ? null : keyShaped(one.oldPath) ? HIDDEN_NAME : cleanLiveText(one.oldPath),
|
|
644
|
+
meta: one.meta.map(cleanLiveText), hunks: one.hunks.map(hunk => ({ ...hunk, header: cleanLiveText(hunk.header) })),
|
|
645
|
+
lineCount: patchLineCount(one.hunks) },
|
|
646
|
+
linesTruncated: parsed.linesTruncated };
|
|
647
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const V185_SCHEMA = `
|
|
2
|
+
CREATE TABLE IF NOT EXISTS flexible_turn_said (
|
|
3
|
+
turn TEXT PRIMARY KEY CHECK (length(turn) = 32 AND turn NOT GLOB '*[^0-9a-f]*'),
|
|
4
|
+
thread TEXT NOT NULL CHECK (length(thread) = 32 AND thread NOT GLOB '*[^0-9a-f]*'),
|
|
5
|
+
seq INTEGER NOT NULL CHECK (seq >= 1),
|
|
6
|
+
said TEXT NOT NULL CHECK (length(said) BETWEEN 1 AND 100000),
|
|
7
|
+
said_at TEXT NOT NULL,
|
|
8
|
+
start_tip TEXT CHECK (start_tip IS NULL OR (length(start_tip) IN (40, 64) AND start_tip NOT GLOB '*[^0-9a-f]*')),
|
|
9
|
+
reply TEXT CHECK (reply IS NULL OR length(reply) <= 20000),
|
|
10
|
+
files TEXT CHECK (files IS NULL OR length(files) <= 20000),
|
|
11
|
+
UNIQUE (thread, seq)
|
|
12
|
+
);
|
|
13
|
+
CREATE TRIGGER IF NOT EXISTS flexible_turn_said_written_once BEFORE UPDATE ON flexible_turn_said
|
|
14
|
+
WHEN NEW.turn IS NOT OLD.turn OR NEW.thread IS NOT OLD.thread OR NEW.seq IS NOT OLD.seq OR NEW.said IS NOT OLD.said OR NEW.said_at IS NOT OLD.said_at
|
|
15
|
+
OR (OLD.start_tip IS NOT NULL AND NEW.start_tip IS NOT OLD.start_tip)
|
|
16
|
+
OR (OLD.reply IS NOT NULL AND NEW.reply IS NOT OLD.reply)
|
|
17
|
+
OR (OLD.files IS NOT NULL AND NEW.files IS NOT OLD.files)
|
|
18
|
+
BEGIN
|
|
19
|
+
SELECT RAISE(ABORT, 'what was said in a flexible turn is written once');
|
|
20
|
+
END;
|
|
21
|
+
`;
|
|
22
|
+
export const V185_TABLES = Object.freeze(["flexible_turn_said"]);
|
|
23
|
+
export const V185_STEPS = Object.freeze(["flexible-conversation"]);
|
|
24
|
+
export const V185_OBJECTS = Object.freeze([["table", "flexible_turn_said"], ["trigger", "flexible_turn_said_written_once"]]);
|