toolroll 0.9.36 → 0.9.38
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 +77 -0
- package/dist/assignment-adapters.d.ts +12 -48
- package/dist/assignment-adapters.js +33 -43
- package/dist/browser/THIRD_PARTY_NOTICES.txt +3 -3
- package/dist/browser/workspace.css +1 -1
- package/dist/browser/workspace.js +26 -26
- package/dist/browser-crew.js +5 -0
- package/dist/browser-workspace.d.ts +2 -0
- package/dist/build-review.d.ts +1 -1
- package/dist/build-review.js +2 -1
- package/dist/chat-acceptance.d.ts +1 -1
- package/dist/chat-actions.d.ts +18 -12
- package/dist/chat-actions.js +15 -65
- package/dist/chat-ask.js +5 -5
- package/dist/chat-channel.js +20 -9
- package/dist/chat-decide.d.ts +18 -4
- package/dist/chat-decide.js +31 -11
- package/dist/chat-delivery-state.d.ts +12 -70
- package/dist/chat-delivery-state.js +17 -135
- package/dist/chat-delivery.js +58 -30
- package/dist/chat-flow.js +8 -6
- package/dist/chat-inbox.js +1 -1
- package/dist/coding-context.d.ts +2 -39
- package/dist/coding-context.js +2 -1
- package/dist/coding-handoff.d.ts +6 -25
- package/dist/coding-handoff.js +11 -5
- package/dist/coding-types.d.ts +2 -26
- package/dist/coding-workspace.d.ts +2 -0
- package/dist/coding-workspace.js +50 -14
- package/dist/contracts/acceptance-terms.d.ts +14 -0
- package/dist/contracts/acceptance-terms.js +16 -0
- package/dist/contracts/chat-actions.d.ts +328 -0
- package/dist/contracts/chat-actions.js +133 -0
- package/dist/contracts/chat-callback-rows.d.ts +59 -0
- package/dist/contracts/chat-callback-rows.js +46 -0
- package/dist/contracts/chat-content.d.ts +276 -0
- package/dist/contracts/chat-content.js +127 -0
- package/dist/contracts/chat-tables.d.ts +6 -0
- package/dist/contracts/chat-tables.js +136 -0
- package/dist/contracts/coding-context.d.ts +97 -0
- package/dist/contracts/coding-context.js +60 -0
- package/dist/contracts/coding-handoff.d.ts +44 -0
- package/dist/contracts/coding-handoff.js +47 -0
- package/dist/contracts/coding-workspace.d.ts +165 -0
- package/dist/contracts/coding-workspace.js +71 -0
- package/dist/contracts/contract.d.ts +7 -2
- package/dist/contracts/contract.js +21 -12
- package/dist/contracts/decision.d.ts +45 -0
- package/dist/contracts/decision.js +45 -0
- package/dist/contracts/discord-callback.d.ts +45 -0
- package/dist/contracts/discord-callback.js +34 -0
- package/dist/contracts/flow-card.d.ts +50 -0
- package/dist/contracts/flow-card.js +46 -0
- package/dist/contracts/flow-send.d.ts +119 -0
- package/dist/contracts/flow-send.js +112 -0
- package/dist/contracts/flow.d.ts +5 -0
- package/dist/contracts/flow.js +5 -0
- package/dist/contracts/gateway-tools.d.ts +374 -0
- package/dist/contracts/gateway-tools.js +94 -0
- package/dist/contracts/lead-context.d.ts +165 -0
- package/dist/contracts/lead-context.js +73 -0
- package/dist/contracts/lead-tools.d.ts +1905 -0
- package/dist/contracts/lead-tools.js +265 -0
- package/dist/contracts/memory-pass.d.ts +158 -0
- package/dist/contracts/memory-pass.js +102 -0
- package/dist/contracts/project-knowledge.d.ts +126 -0
- package/dist/contracts/project-knowledge.js +93 -0
- package/dist/contracts/project-memory.d.ts +117 -0
- package/dist/contracts/project-memory.js +51 -0
- package/dist/contracts/project-skills.d.ts +121 -0
- package/dist/contracts/project-skills.js +76 -0
- package/dist/contracts/review-findings.d.ts +46 -0
- package/dist/contracts/review-findings.js +48 -0
- package/dist/contracts/route.d.ts +484 -0
- package/dist/contracts/route.js +128 -0
- package/dist/contracts/scope.d.ts +105 -0
- package/dist/contracts/scope.js +114 -0
- package/dist/contracts/scout-report.d.ts +234 -0
- package/dist/contracts/scout-report.js +141 -0
- package/dist/contracts/slack-callback.d.ts +43 -0
- package/dist/contracts/slack-callback.js +35 -0
- package/dist/contracts/sort-answer.d.ts +83 -0
- package/dist/contracts/sort-answer.js +77 -0
- package/dist/contracts/stage-output.d.ts +127 -0
- package/dist/contracts/stage-output.js +166 -0
- package/dist/contracts/task-sizing.d.ts +24 -0
- package/dist/contracts/task-sizing.js +28 -0
- package/dist/contracts/teammate-turn.d.ts +43 -0
- package/dist/contracts/teammate-turn.js +51 -0
- package/dist/contracts/teams-callback.d.ts +14 -0
- package/dist/contracts/teams-callback.js +14 -0
- package/dist/contracts/telegram-callback.d.ts +120 -0
- package/dist/contracts/telegram-callback.js +97 -0
- package/dist/decision.d.ts +11 -20
- package/dist/decision.js +86 -167
- package/dist/desktop-update.d.ts +1 -1
- package/dist/discord-chat.js +31 -20
- package/dist/flow-engine.js +14 -17
- package/dist/flow-items.d.ts +4 -13
- package/dist/flow-items.js +1 -15
- package/dist/flow-send.d.ts +6 -37
- package/dist/flow-send.js +18 -14
- package/dist/flow-share.js +7 -1
- package/dist/flow-sort.d.ts +7 -26
- package/dist/flow-sort.js +25 -20
- package/dist/flow-steps.js +3 -2
- package/dist/flows.d.ts +2 -4
- package/dist/flows.js +9 -5
- package/dist/invoke.js +4 -4
- package/dist/lead-context.d.ts +4 -2
- package/dist/lead-context.js +24 -17
- package/dist/mate-progress.d.ts +26 -0
- package/dist/mate-progress.js +24 -0
- package/dist/mate-tools.d.ts +4 -0
- package/dist/mate-tools.js +108 -275
- package/dist/mate.js +11 -2
- package/dist/mcp-connect.d.ts +24 -4
- package/dist/mcp-connect.js +78 -15
- package/dist/mcp.js +84 -216
- package/dist/memory-pass.d.ts +17 -42
- package/dist/memory-pass.js +54 -26
- package/dist/phase-routing.d.ts +19 -72
- package/dist/phase-routing.js +34 -164
- package/dist/project-knowledge.d.ts +16 -35
- package/dist/project-knowledge.js +42 -21
- package/dist/project-memory.d.ts +2 -28
- package/dist/project-memory.js +28 -13
- package/dist/project-skills.d.ts +16 -38
- package/dist/project-skills.js +41 -32
- package/dist/project-tools.d.ts +1 -0
- package/dist/project-tools.js +4 -4
- package/dist/provider.d.ts +2 -0
- package/dist/provider.js +4 -16
- package/dist/result-shots.d.ts +1 -1
- package/dist/result-shots.js +2 -1
- package/dist/review-switch.d.ts +3 -8
- package/dist/reviewer.d.ts +8 -12
- package/dist/reviewer.js +11 -35
- package/dist/scope.d.ts +21 -43
- package/dist/scope.js +42 -128
- package/dist/scout-report.d.ts +9 -194
- package/dist/scout-report.js +113 -264
- package/dist/scout.js +15 -11
- package/dist/serve.js +23 -5
- package/dist/setup-guide.d.ts +2 -2
- package/dist/slack-chat.js +26 -20
- package/dist/slack-state.js +2 -1
- package/dist/store.d.ts +9 -32
- package/dist/store.js +18 -15
- package/dist/structured-output.js +2 -1
- package/dist/subscription-chat.d.ts +4 -0
- package/dist/subscription-chat.js +4 -1
- package/dist/task-review-brief.d.ts +1 -7
- package/dist/task-review-brief.js +6 -6
- package/dist/task-sizing.d.ts +3 -27
- package/dist/task-sizing.js +11 -26
- package/dist/task-text.d.ts +0 -5
- package/dist/task-text.js +1 -3
- package/dist/teammate-question.js +7 -5
- package/dist/teammate-work.js +9 -5
- package/dist/teammates.d.ts +13 -64
- package/dist/teammates.js +32 -33
- package/dist/teams-chat.js +20 -11
- package/dist/telegram-flow.d.ts +9 -0
- package/dist/telegram-flow.js +44 -8
- package/dist/telegram-mate.d.ts +4 -14
- package/dist/telegram-mate.js +9 -8
- package/dist/telegram-team.d.ts +2 -19
- package/dist/telegram.d.ts +1 -1
- package/dist/telegram.js +94 -68
- package/dist/text-limits.d.ts +142 -1
- package/dist/text-limits.js +144 -1
- package/dist/tools-ui.d.ts +2 -1
- package/dist/tools-ui.js +7 -4
- package/package.json +17 -12
package/dist/coding-handoff.js
CHANGED
|
@@ -10,6 +10,8 @@ import { parseAcceptanceCriteria, proposeGuarded } from './scope.js';
|
|
|
10
10
|
import { validateTaskText } from './task-text.js';
|
|
11
11
|
import { PROOF_LIMITS } from './proof.js';
|
|
12
12
|
import { readPreparedEvidence } from './prepared-evidence.js';
|
|
13
|
+
import { parseCodingHandoffReceipt } from './contracts/coding-handoff.js';
|
|
14
|
+
import { parseCodingSessionDocument } from './contracts/coding-workspace.js';
|
|
13
15
|
import { BRANCH_PREFIXES, taskBranch } from './names.js';
|
|
14
16
|
const PREFIX = 'coding:';
|
|
15
17
|
const SHA = /^[a-f0-9]{40}$/;
|
|
@@ -84,7 +86,7 @@ function sessionFor(db, store, sessionId, actor) {
|
|
|
84
86
|
const row = db.prepare('SELECT owner,generation,repo,document FROM coding_session WHERE id=?').get(sessionId);
|
|
85
87
|
if (!row || row['owner'] !== actor)
|
|
86
88
|
throw Error('This coding session is not available to your account.');
|
|
87
|
-
const session =
|
|
89
|
+
const session = parseCodingSessionDocument(String(row['document']));
|
|
88
90
|
const generation = actorGeneration(store, actor, String(row['repo']));
|
|
89
91
|
if (row['generation'] !== generation || session.id !== sessionId || session.owner !== actor || session.generation !== generation || session.repo !== row['repo'])
|
|
90
92
|
throw Error('The coding session no longer matches your account or project.');
|
|
@@ -132,18 +134,22 @@ function makeReceipt(terms) {
|
|
|
132
134
|
const id = learningSha(JSON.stringify(terms)).slice(0, 32), taskId = `coding-review-${id}`;
|
|
133
135
|
return { ...terms, id, taskId, branch: taskBranch(taskId) };
|
|
134
136
|
}
|
|
135
|
-
|
|
137
|
+
/** The saved bytes are verified before they are parsed; identity and branch are checked on the parsed terms. */
|
|
138
|
+
export function parseReceipt(row) {
|
|
136
139
|
const payload = String(row['payload']);
|
|
137
140
|
if (learningSha(payload) !== row['sha'])
|
|
138
141
|
throw Error('The coding handoff receipt could not be verified.');
|
|
139
|
-
const
|
|
142
|
+
const read = parseCodingHandoffReceipt(payload);
|
|
143
|
+
if (!read.ok)
|
|
144
|
+
throw Error(`The coding handoff receipt could not be read: ${read.issues.map(issue => issue.line).join('; ')}`);
|
|
145
|
+
const receipt = read.value;
|
|
140
146
|
const { id, taskId, branch, ...terms } = receipt;
|
|
141
147
|
const expected = makeReceipt(terms);
|
|
142
|
-
if (
|
|
148
|
+
if (row['id'] !== id || id !== expected.id || taskId !== expected.taskId || !BRANCH_PREFIXES.some(prefix => branch === `${prefix}${taskId}`) || !SHA.test(receipt.base) || !SHA.test(receipt.candidate))
|
|
143
149
|
throw Error('The coding handoff receipt identity could not be verified.');
|
|
144
150
|
return receipt;
|
|
145
151
|
}
|
|
146
|
-
function sealPayload(receipt, scopeDigest) {
|
|
152
|
+
export function sealPayload(receipt, scopeDigest) {
|
|
147
153
|
return JSON.stringify({ version: 1, id: receipt.id, receiptSha256: learningSha(JSON.stringify(receipt)), scopeDigest });
|
|
148
154
|
}
|
|
149
155
|
function verifySeal(db, receipt, digest) {
|
package/dist/coding-types.d.ts
CHANGED
|
@@ -1,29 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type CodingSession = {
|
|
4
|
-
id: string;
|
|
5
|
-
owner: string;
|
|
6
|
-
generation: number;
|
|
7
|
-
repo: string;
|
|
8
|
-
title: string;
|
|
9
|
-
provider: 'codex';
|
|
10
|
-
model: string | null;
|
|
11
|
-
branch: string;
|
|
12
|
-
base: string;
|
|
13
|
-
worktree: string;
|
|
14
|
-
nativeThreadId: string | null;
|
|
15
|
-
turnId: string | null;
|
|
16
|
-
status: CodingStatus;
|
|
17
|
-
error: string | null;
|
|
18
|
-
createdAt: string;
|
|
19
|
-
updatedAt: string;
|
|
20
|
-
deliveryReviewRequired?: boolean;
|
|
21
|
-
initialRequest?: {
|
|
22
|
-
requestId: string;
|
|
23
|
-
prompt: string;
|
|
24
|
-
};
|
|
25
|
-
context?: CodingContext;
|
|
26
|
-
};
|
|
1
|
+
export type { CodingSession, CodingStatus } from './contracts/coding-workspace.js';
|
|
2
|
+
import type { CodingSession } from './contracts/coding-workspace.js';
|
|
27
3
|
export type CodingItem = {
|
|
28
4
|
id: string;
|
|
29
5
|
type: string;
|
|
@@ -60,6 +60,8 @@ export declare class CodingWorkspace {
|
|
|
60
60
|
constructor(options: Options);
|
|
61
61
|
private authorize;
|
|
62
62
|
private read;
|
|
63
|
+
/** Preserve legacy reads, but never mutate an unidentified row or save an unreadable record's error projection. */
|
|
64
|
+
private catalogRow;
|
|
63
65
|
private admit;
|
|
64
66
|
private releaseOperation;
|
|
65
67
|
list(actor: CodingActor): CodingSession[];
|
package/dist/coding-workspace.js
CHANGED
|
@@ -9,6 +9,7 @@ import { run } from './exec.js';
|
|
|
9
9
|
import { processMayBeAlive } from './process-liveness.js';
|
|
10
10
|
import { createCodexCodingProvider } from './coding-provider.js';
|
|
11
11
|
import { verifyCodingContext } from './coding-context.js';
|
|
12
|
+
import { codingSessionDocument, parseCodingSessionDocument } from './contracts/coding-workspace.js';
|
|
12
13
|
export class CodingActionError extends Error {
|
|
13
14
|
delivery;
|
|
14
15
|
sessionId;
|
|
@@ -77,8 +78,10 @@ export class CodingWorkspace {
|
|
|
77
78
|
const clean = !prior || prior['clean'] === 1;
|
|
78
79
|
this.recoveryRequired = !clean;
|
|
79
80
|
this.db.prepare('INSERT OR REPLACE INTO coding_owner VALUES(1,?,?,?,?)').run(this.owner, process.pid, prior?.['native_pid'] ?? null, clean ? 1 : 0);
|
|
80
|
-
for (const row of this.db.prepare('SELECT
|
|
81
|
-
const session =
|
|
81
|
+
for (const row of this.db.prepare('SELECT * FROM coding_session').all()) {
|
|
82
|
+
const { session, usable } = this.catalogRow(row);
|
|
83
|
+
if (!usable)
|
|
84
|
+
continue;
|
|
82
85
|
if (session.status !== 'closed' && (!clean || busy.has(session.status)))
|
|
83
86
|
this.save({ ...session, status: clean ? 'interrupted' : 'uncertain', turnId: null, error: clean ? null : 'The previous server stopped without a verified process exit. Work is preserved; session recovery needs a process check before resuming.' });
|
|
84
87
|
}
|
|
@@ -99,7 +102,23 @@ export class CodingWorkspace {
|
|
|
99
102
|
const row = this.db.prepare('SELECT document FROM coding_session WHERE id=?').get(id);
|
|
100
103
|
if (!row)
|
|
101
104
|
throw Error('Coding session unavailable.');
|
|
102
|
-
return
|
|
105
|
+
return parseCodingSessionDocument(String(row['document']));
|
|
106
|
+
}
|
|
107
|
+
/** Preserve legacy reads, but never mutate an unidentified row or save an unreadable record's error projection. */
|
|
108
|
+
catalogRow(row) {
|
|
109
|
+
try {
|
|
110
|
+
const session = parseCodingSessionDocument(String(row['document']));
|
|
111
|
+
const usable = session.id === row['id'] && session.owner === row['owner'] && session.generation === row['generation'] && session.repo === row['repo'];
|
|
112
|
+
return { session, usable };
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
return { usable: false, session: {
|
|
116
|
+
id: String(row['id']), owner: String(row['owner']), generation: Number(row['generation']), repo: String(row['repo']),
|
|
117
|
+
title: 'Unreadable coding session', provider: 'codex', model: null, branch: '', base: '', worktree: '',
|
|
118
|
+
nativeThreadId: null, turnId: null, status: 'failed', createdAt: '', updatedAt: '',
|
|
119
|
+
error: error instanceof Error ? error.message : 'The saved coding session could not be read.',
|
|
120
|
+
} };
|
|
121
|
+
}
|
|
103
122
|
}
|
|
104
123
|
admit() {
|
|
105
124
|
if (this.closed || this.closing || this.persistenceFailed)
|
|
@@ -116,7 +135,7 @@ export class CodingWorkspace {
|
|
|
116
135
|
}
|
|
117
136
|
}
|
|
118
137
|
list(actor) {
|
|
119
|
-
return this.db.prepare('SELECT
|
|
138
|
+
return this.db.prepare('SELECT * FROM coding_session WHERE owner=? AND generation=? ORDER BY rowid DESC').all(actor.name, actor.generation).map(row => this.catalogRow(row).session);
|
|
120
139
|
}
|
|
121
140
|
/** Inspect a fixed metadata window before loading admitted documents.
|
|
122
141
|
* A filtered window can be short without proving the entire list empty. */
|
|
@@ -127,13 +146,18 @@ export class CodingWorkspace {
|
|
|
127
146
|
const window = rows.slice(0, 100);
|
|
128
147
|
const admitted = window.filter(row => options.authorized(String(row['repo'])));
|
|
129
148
|
const selected = admitted.slice(0, Math.min(100, Math.max(1, options.limit)));
|
|
130
|
-
|
|
149
|
+
const sessions = selected.map(row => {
|
|
150
|
+
const session = this.catalogRow(this.db.prepare('SELECT * FROM coding_session WHERE id=? AND owner=? AND generation=?').get(String(row['id']), actor.name, actor.generation)).session;
|
|
151
|
+
this.authorize(actor, session.repo);
|
|
152
|
+
return session;
|
|
153
|
+
});
|
|
154
|
+
return { sessions, truncated: rows.length > window.length || admitted.length > selected.length };
|
|
131
155
|
}
|
|
132
156
|
get(id, actor) {
|
|
133
157
|
const row = this.db.prepare('SELECT document FROM coding_session WHERE id=? AND owner=? AND generation=?').get(id, actor.name, actor.generation);
|
|
134
158
|
if (!row)
|
|
135
159
|
throw Error('This coding session is not available to your account.');
|
|
136
|
-
const session =
|
|
160
|
+
const session = parseCodingSessionDocument(String(row['document']));
|
|
137
161
|
this.authorize(actor, session.repo);
|
|
138
162
|
return session;
|
|
139
163
|
}
|
|
@@ -204,13 +228,16 @@ export class CodingWorkspace {
|
|
|
204
228
|
}
|
|
205
229
|
save(session) {
|
|
206
230
|
session.updatedAt = now();
|
|
207
|
-
this.db.prepare('INSERT INTO coding_session(id,owner,generation,repo,document) VALUES(?,?,?,?,?) ON CONFLICT(id) DO UPDATE SET document=excluded.document,revision=revision+1').run(session.id, session.owner, session.generation, session.repo,
|
|
231
|
+
this.db.prepare('INSERT INTO coding_session(id,owner,generation,repo,document) VALUES(?,?,?,?,?) ON CONFLICT(id) DO UPDATE SET document=excluded.document,revision=revision+1').run(session.id, session.owner, session.generation, session.repo, codingSessionDocument(session));
|
|
208
232
|
}
|
|
209
233
|
byThread(thread) {
|
|
210
234
|
if (typeof thread !== 'string')
|
|
211
235
|
return null;
|
|
212
|
-
const row = this.db.prepare("SELECT
|
|
213
|
-
|
|
236
|
+
const row = this.db.prepare("SELECT * FROM coding_session WHERE json_extract(document,'$.nativeThreadId')=?").get(thread);
|
|
237
|
+
if (!row)
|
|
238
|
+
return null;
|
|
239
|
+
const { session, usable } = this.catalogRow(row);
|
|
240
|
+
return usable ? session : null;
|
|
214
241
|
}
|
|
215
242
|
putItem(session, item) {
|
|
216
243
|
// Re-reading unchanged native history must not invalidate the request
|
|
@@ -285,8 +312,10 @@ export class CodingWorkspace {
|
|
|
285
312
|
if (event.kind === 'exit') {
|
|
286
313
|
this.flush();
|
|
287
314
|
this.loaded.clear();
|
|
288
|
-
for (const row of this.db.prepare('SELECT
|
|
289
|
-
const session =
|
|
315
|
+
for (const row of this.db.prepare('SELECT * FROM coding_session').all()) {
|
|
316
|
+
const { session, usable } = this.catalogRow(row);
|
|
317
|
+
if (!usable)
|
|
318
|
+
continue;
|
|
290
319
|
if (busy.has(session.status))
|
|
291
320
|
this.save({ ...session, status: 'uncertain', error: 'The agent connection closed. Work is preserved; delivery and process exit need to be checked before continuing.' });
|
|
292
321
|
}
|
|
@@ -522,7 +551,12 @@ export class CodingWorkspace {
|
|
|
522
551
|
this.operations.add(id);
|
|
523
552
|
try {
|
|
524
553
|
if (this.provider) {
|
|
525
|
-
const active = this.db.prepare('SELECT
|
|
554
|
+
const active = this.db.prepare('SELECT * FROM coding_session').all().some(row => {
|
|
555
|
+
const { session, usable } = this.catalogRow(row);
|
|
556
|
+
if (!usable)
|
|
557
|
+
throw new CodingActionError('A saved coding session could not be checked. Repair its record before reconnecting the agent.', 'rejected', id);
|
|
558
|
+
return busy.has(session.status);
|
|
559
|
+
});
|
|
526
560
|
if (active)
|
|
527
561
|
throw new CodingActionError('Another coding turn is still active. Wait for it to finish or stop it before reconnecting the agent.', 'rejected', id);
|
|
528
562
|
await this.provider.close();
|
|
@@ -754,8 +788,10 @@ export class CodingWorkspace {
|
|
|
754
788
|
this.db.close();
|
|
755
789
|
return;
|
|
756
790
|
}
|
|
757
|
-
for (const row of this.db.prepare('SELECT
|
|
758
|
-
const session =
|
|
791
|
+
for (const row of this.db.prepare('SELECT * FROM coding_session').all()) {
|
|
792
|
+
const { session, usable } = this.catalogRow(row);
|
|
793
|
+
if (!usable)
|
|
794
|
+
continue;
|
|
759
795
|
const uncertain = this.db.prepare("SELECT 1 FROM coding_submission WHERE session=? AND status IN ('preparing','pending','uncertain')").get(session.id);
|
|
760
796
|
if (!uncertain && (busy.has(session.status) || session.status === 'uncertain'))
|
|
761
797
|
this.save({ ...session, status: 'interrupted', turnId: null, error: null });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The acceptance rubric's vocabulary and limits: the evidence kinds a criterion may require, and how many criteria
|
|
3
|
+
* and bytes a rubric may hold. A leaf with no imports but TEXT_LIMITS, because the plan contract (src/contracts/plan.ts)
|
|
4
|
+
* reads these through scope.ts while scope.ts reads the plan contract's criterion: kept here, both load in either order.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EVIDENCE_KINDS: readonly ["check", "screenshot", "changed-path", "manual-review"];
|
|
7
|
+
export type EvidenceKind = (typeof EVIDENCE_KINDS)[number];
|
|
8
|
+
export declare const ACCEPTANCE_LIMITS: {
|
|
9
|
+
readonly criteria: 12;
|
|
10
|
+
readonly id: 40;
|
|
11
|
+
readonly statement: 1000;
|
|
12
|
+
readonly how: 500;
|
|
13
|
+
readonly evidenceKinds: 4;
|
|
14
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The acceptance rubric's vocabulary and limits: the evidence kinds a criterion may require, and how many criteria
|
|
3
|
+
* and bytes a rubric may hold. A leaf with no imports but TEXT_LIMITS, because the plan contract (src/contracts/plan.ts)
|
|
4
|
+
* reads these through scope.ts while scope.ts reads the plan contract's criterion: kept here, both load in either order.
|
|
5
|
+
*/
|
|
6
|
+
import { TEXT_LIMITS } from "../text-limits.js";
|
|
7
|
+
export const EVIDENCE_KINDS = ["check", "screenshot", "changed-path", "manual-review"];
|
|
8
|
+
export const ACCEPTANCE_LIMITS = {
|
|
9
|
+
criteria: 12,
|
|
10
|
+
id: TEXT_LIMITS.acceptanceIdBytes,
|
|
11
|
+
// A statement is one testable outcome; three hundred bytes forced people to
|
|
12
|
+
// drop the qualifying clause that made it testable.
|
|
13
|
+
statement: TEXT_LIMITS.acceptanceStatementBytes,
|
|
14
|
+
how: TEXT_LIMITS.acceptanceHowBytes,
|
|
15
|
+
evidenceKinds: EVIDENCE_KINDS.length,
|
|
16
|
+
};
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared chat actions (chat-actions.ts): one schema for each action's data — what the lead proposes and what a saved
|
|
3
|
+
* proposal carries after `prepareSharedAction` has checked and rewritten it — and one for the saved proposal itself.
|
|
4
|
+
* The allowed fields (`CHAT_ACTION_FIELDS`) and the request types are derived from these; what JSON Schema can't say
|
|
5
|
+
* (credentials and control characters in text, each field's length, a zone or option that exists, who may act) runs
|
|
6
|
+
* in `prepareSharedAction` after parsing, with its own named refusal.
|
|
7
|
+
*
|
|
8
|
+
* A flow drawing, trigger or script inside a request is read by its own contract (flows.ts `validateFlowDefinition`,
|
|
9
|
+
* flow-triggers.ts `validateTriggerConfig`, flow-scripts.ts `validateScript`) when the action is prepared, in every
|
|
10
|
+
* vocabulary those accept; here it is only "a value".
|
|
11
|
+
*/
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
import { type ContractResult } from "./contract.js";
|
|
14
|
+
/**
|
|
15
|
+
* Each action's data, field order as the lead reads it in `get_actions`. Fields a branch ignores or reads through
|
|
16
|
+
* its own validator stay unknown: 0.9.36 accepted null and other non-string values there. Preparation still checks
|
|
17
|
+
* the selected branch and saves the same request bytes. No schema defaults or coercion may change its stamp.
|
|
18
|
+
*/
|
|
19
|
+
export declare const chatActionRequestSchemas: {
|
|
20
|
+
readonly skill_import: z.ZodObject<{
|
|
21
|
+
repo: z.ZodString;
|
|
22
|
+
content: z.ZodOptional<z.ZodString>;
|
|
23
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
24
|
+
path: z.ZodString;
|
|
25
|
+
base64: z.ZodString;
|
|
26
|
+
}, z.core.$strict>>>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
readonly skill_enable: z.ZodObject<{
|
|
29
|
+
repo: z.ZodString;
|
|
30
|
+
version: z.ZodString;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
readonly skill_disable: z.ZodObject<{
|
|
33
|
+
repo: z.ZodString;
|
|
34
|
+
version: z.ZodString;
|
|
35
|
+
}, z.core.$strict>;
|
|
36
|
+
readonly skill_restore: z.ZodObject<{
|
|
37
|
+
repo: z.ZodString;
|
|
38
|
+
restore: z.ZodInt;
|
|
39
|
+
}, z.core.$strict>;
|
|
40
|
+
readonly skill_test: z.ZodObject<{
|
|
41
|
+
repo: z.ZodString;
|
|
42
|
+
version: z.ZodString;
|
|
43
|
+
sample: z.ZodString;
|
|
44
|
+
nonce: z.ZodString;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
readonly knowledge_instructions: z.ZodObject<{
|
|
47
|
+
repo: z.ZodString;
|
|
48
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
readonly knowledge_save: z.ZodObject<{
|
|
51
|
+
repo: z.ZodString;
|
|
52
|
+
title: z.ZodString;
|
|
53
|
+
content: z.ZodString;
|
|
54
|
+
id: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, z.core.$strict>;
|
|
56
|
+
readonly knowledge_remove: z.ZodObject<{
|
|
57
|
+
repo: z.ZodString;
|
|
58
|
+
id: z.ZodString;
|
|
59
|
+
}, z.core.$strict>;
|
|
60
|
+
readonly knowledge_restore: z.ZodObject<{
|
|
61
|
+
repo: z.ZodString;
|
|
62
|
+
restore: z.ZodInt;
|
|
63
|
+
}, z.core.$strict>;
|
|
64
|
+
readonly tool_add: z.ZodObject<{
|
|
65
|
+
repo: z.ZodString;
|
|
66
|
+
catalog: z.ZodOptional<z.ZodUnknown>;
|
|
67
|
+
name: z.ZodOptional<z.ZodUnknown>;
|
|
68
|
+
command: z.ZodOptional<z.ZodUnknown>;
|
|
69
|
+
args: z.ZodOptional<z.ZodUnknown>;
|
|
70
|
+
url: z.ZodOptional<z.ZodUnknown>;
|
|
71
|
+
secrets: z.ZodOptional<z.ZodUnknown>;
|
|
72
|
+
about: z.ZodOptional<z.ZodUnknown>;
|
|
73
|
+
}, z.core.$strict>;
|
|
74
|
+
readonly tool_remove: z.ZodObject<{
|
|
75
|
+
repo: z.ZodString;
|
|
76
|
+
name: z.ZodString;
|
|
77
|
+
}, z.core.$strict>;
|
|
78
|
+
readonly flow_create: z.ZodObject<{
|
|
79
|
+
repo: z.ZodString;
|
|
80
|
+
name: z.ZodString;
|
|
81
|
+
definition: z.ZodUnknown;
|
|
82
|
+
trigger: z.ZodOptional<z.ZodUnknown>;
|
|
83
|
+
}, z.core.$strict>;
|
|
84
|
+
readonly flow_starter: z.ZodObject<{
|
|
85
|
+
repo: z.ZodString;
|
|
86
|
+
starter: z.ZodString;
|
|
87
|
+
}, z.core.$strict>;
|
|
88
|
+
readonly flow_edit: z.ZodObject<{
|
|
89
|
+
flow: z.ZodInt;
|
|
90
|
+
name: z.ZodOptional<z.ZodString>;
|
|
91
|
+
definition: z.ZodOptional<z.ZodUnknown>;
|
|
92
|
+
}, z.core.$strict>;
|
|
93
|
+
readonly flow_card_add: z.ZodObject<{
|
|
94
|
+
flow: z.ZodInt;
|
|
95
|
+
title: z.ZodString;
|
|
96
|
+
description: z.ZodOptional<z.ZodUnknown>;
|
|
97
|
+
zone: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strict>;
|
|
99
|
+
readonly flow_card_move: z.ZodObject<{
|
|
100
|
+
card: z.ZodInt;
|
|
101
|
+
zone: z.ZodString;
|
|
102
|
+
}, z.core.$strict>;
|
|
103
|
+
readonly flow_card_approve: z.ZodObject<{
|
|
104
|
+
card: z.ZodInt;
|
|
105
|
+
note: z.ZodOptional<z.ZodString>;
|
|
106
|
+
}, z.core.$strict>;
|
|
107
|
+
readonly flow_card_send_back: z.ZodObject<{
|
|
108
|
+
card: z.ZodInt;
|
|
109
|
+
note: z.ZodOptional<z.ZodString>;
|
|
110
|
+
}, z.core.$strict>;
|
|
111
|
+
/** An option by its number (from 1), or a reply that becomes the note. */
|
|
112
|
+
readonly flow_card_choose: z.ZodObject<{
|
|
113
|
+
card: z.ZodInt;
|
|
114
|
+
choice: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
115
|
+
note: z.ZodOptional<z.ZodUnknown>;
|
|
116
|
+
}, z.core.$strict>;
|
|
117
|
+
readonly flow_card_cancel: z.ZodObject<{
|
|
118
|
+
card: z.ZodInt;
|
|
119
|
+
}, z.core.$strict>;
|
|
120
|
+
readonly flow_card_comment: z.ZodObject<{
|
|
121
|
+
card: z.ZodInt;
|
|
122
|
+
note: z.ZodString;
|
|
123
|
+
}, z.core.$strict>;
|
|
124
|
+
readonly flow_card_assign: z.ZodObject<{
|
|
125
|
+
card: z.ZodInt;
|
|
126
|
+
owner: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
127
|
+
}, z.core.$strict>;
|
|
128
|
+
readonly flow_card_watch: z.ZodObject<{
|
|
129
|
+
card: z.ZodInt;
|
|
130
|
+
watching: z.ZodOptional<z.ZodUnknown>;
|
|
131
|
+
}, z.core.$strict>;
|
|
132
|
+
readonly flow_script_save: z.ZodObject<{
|
|
133
|
+
repo: z.ZodString;
|
|
134
|
+
script: z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>;
|
|
135
|
+
}, z.core.$strict>;
|
|
136
|
+
readonly flow_trigger_add: z.ZodObject<{
|
|
137
|
+
flow: z.ZodInt;
|
|
138
|
+
trigger: z.ZodUnknown;
|
|
139
|
+
}, z.core.$strict>;
|
|
140
|
+
readonly flow_trigger_pause: z.ZodObject<{
|
|
141
|
+
trigger: z.ZodInt;
|
|
142
|
+
}, z.core.$strict>;
|
|
143
|
+
readonly flow_trigger_resume: z.ZodObject<{
|
|
144
|
+
trigger: z.ZodInt;
|
|
145
|
+
}, z.core.$strict>;
|
|
146
|
+
readonly flow_trigger_remove: z.ZodObject<{
|
|
147
|
+
trigger: z.ZodInt;
|
|
148
|
+
}, z.core.$strict>;
|
|
149
|
+
readonly teammate_create: z.ZodObject<{
|
|
150
|
+
repo: z.ZodString;
|
|
151
|
+
template: z.ZodOptional<z.ZodUnknown>;
|
|
152
|
+
name: z.ZodOptional<z.ZodUnknown>;
|
|
153
|
+
soul: z.ZodOptional<z.ZodUnknown>;
|
|
154
|
+
}, z.core.$strict>;
|
|
155
|
+
readonly teammate_soul: z.ZodObject<{
|
|
156
|
+
teammate: z.ZodInt;
|
|
157
|
+
soul: z.ZodString;
|
|
158
|
+
}, z.core.$strict>;
|
|
159
|
+
readonly teammate_state: z.ZodObject<{
|
|
160
|
+
teammate: z.ZodInt;
|
|
161
|
+
state: z.ZodEnum<{
|
|
162
|
+
active: "active";
|
|
163
|
+
paused: "paused";
|
|
164
|
+
removed: "removed";
|
|
165
|
+
}>;
|
|
166
|
+
}, z.core.$strict>;
|
|
167
|
+
readonly teammate_note: z.ZodObject<{
|
|
168
|
+
teammate: z.ZodInt;
|
|
169
|
+
note: z.ZodString;
|
|
170
|
+
}, z.core.$strict>;
|
|
171
|
+
readonly teammate_answer: z.ZodObject<{
|
|
172
|
+
question: z.ZodInt;
|
|
173
|
+
choice: z.ZodOptional<z.ZodUnknown>;
|
|
174
|
+
text: z.ZodOptional<z.ZodUnknown>;
|
|
175
|
+
}, z.core.$strict>;
|
|
176
|
+
readonly teammate_tools: z.ZodObject<{
|
|
177
|
+
teammate: z.ZodInt;
|
|
178
|
+
tool: z.ZodString;
|
|
179
|
+
change: z.ZodEnum<{
|
|
180
|
+
grant: "grant";
|
|
181
|
+
revoke: "revoke";
|
|
182
|
+
rule: "rule";
|
|
183
|
+
}>;
|
|
184
|
+
action: z.ZodOptional<z.ZodUnknown>;
|
|
185
|
+
use: z.ZodOptional<z.ZodUnknown>;
|
|
186
|
+
limitField: z.ZodOptional<z.ZodUnknown>;
|
|
187
|
+
limitOver: z.ZodOptional<z.ZodUnknown>;
|
|
188
|
+
undoWith: z.ZodOptional<z.ZodUnknown>;
|
|
189
|
+
}, z.core.$strict>;
|
|
190
|
+
readonly teammate_memory: z.ZodObject<{
|
|
191
|
+
teammate: z.ZodInt;
|
|
192
|
+
memory: z.ZodInt;
|
|
193
|
+
change: z.ZodEnum<{
|
|
194
|
+
edit: "edit";
|
|
195
|
+
forget: "forget";
|
|
196
|
+
}>;
|
|
197
|
+
text: z.ZodOptional<z.ZodUnknown>;
|
|
198
|
+
}, z.core.$strict>;
|
|
199
|
+
readonly teammate_routine: z.ZodObject<{
|
|
200
|
+
teammate: z.ZodInt;
|
|
201
|
+
change: z.ZodEnum<{
|
|
202
|
+
add: "add";
|
|
203
|
+
remove: "remove";
|
|
204
|
+
}>;
|
|
205
|
+
routine: z.ZodOptional<z.ZodUnknown>;
|
|
206
|
+
schedule: z.ZodOptional<z.ZodUnknown>;
|
|
207
|
+
text: z.ZodOptional<z.ZodUnknown>;
|
|
208
|
+
}, z.core.$strict>;
|
|
209
|
+
readonly teammate_undo: z.ZodObject<{
|
|
210
|
+
teammate: z.ZodInt;
|
|
211
|
+
call: z.ZodInt;
|
|
212
|
+
}, z.core.$strict>;
|
|
213
|
+
readonly kit_setup: z.ZodObject<{
|
|
214
|
+
repo: z.ZodString;
|
|
215
|
+
kit: z.ZodString;
|
|
216
|
+
}, z.core.$strict>;
|
|
217
|
+
readonly decision_record: z.ZodObject<{
|
|
218
|
+
repo: z.ZodString;
|
|
219
|
+
claim: z.ZodString;
|
|
220
|
+
why: z.ZodString;
|
|
221
|
+
supersedes: z.ZodOptional<z.ZodInt>;
|
|
222
|
+
source: z.ZodOptional<z.ZodString>;
|
|
223
|
+
}, z.core.$strict>;
|
|
224
|
+
readonly decision_retire: z.ZodObject<{
|
|
225
|
+
repo: z.ZodString;
|
|
226
|
+
decision: z.ZodInt;
|
|
227
|
+
reason: z.ZodString;
|
|
228
|
+
}, z.core.$strict>;
|
|
229
|
+
/** The line, and (from 1) the line it replaces; 0 or none adds it. */
|
|
230
|
+
readonly lead_about_you: z.ZodObject<{
|
|
231
|
+
line: z.ZodString;
|
|
232
|
+
replaces: z.ZodOptional<z.ZodInt>;
|
|
233
|
+
}, z.core.$strict>;
|
|
234
|
+
readonly scope_approve: z.ZodObject<{
|
|
235
|
+
task: z.ZodString;
|
|
236
|
+
}, z.core.$strict>;
|
|
237
|
+
readonly result_accept: z.ZodObject<{
|
|
238
|
+
task: z.ZodString;
|
|
239
|
+
run: z.ZodInt;
|
|
240
|
+
}, z.core.$strict>;
|
|
241
|
+
readonly task_cancel: z.ZodObject<{
|
|
242
|
+
task: z.ZodString;
|
|
243
|
+
}, z.core.$strict>;
|
|
244
|
+
readonly task_resume: z.ZodObject<{
|
|
245
|
+
task: z.ZodString;
|
|
246
|
+
run: z.ZodInt;
|
|
247
|
+
}, z.core.$strict>;
|
|
248
|
+
};
|
|
249
|
+
export type ChatActionOperation = keyof typeof chatActionRequestSchemas;
|
|
250
|
+
export declare const CHAT_ACTION_OPERATIONS: [ChatActionOperation, ...ChatActionOperation[]];
|
|
251
|
+
export type ChatActionRequest<O extends ChatActionOperation = ChatActionOperation> = z.infer<(typeof chatActionRequestSchemas)[O]>;
|
|
252
|
+
/** The fields each action takes, from its schema. */
|
|
253
|
+
export declare const CHAT_ACTION_FIELDS: Record<ChatActionOperation, readonly string[]>;
|
|
254
|
+
/** One action's data, refused by path (`card: required`, `payload: unknown key 'cards' (did you mean card?)`). */
|
|
255
|
+
export declare function readChatActionRequest(operation: ChatActionOperation, input: unknown): ContractResult<Record<string, unknown>>;
|
|
256
|
+
export declare const SHARED_ACTION_VERSION = 1;
|
|
257
|
+
/**
|
|
258
|
+
* A prepared action as a proposal saves it: the action, its checked request, the project, the card's title and
|
|
259
|
+
* terms, the stamp that proves nothing changed before it is confirmed, and the state the stamp was taken over (each
|
|
260
|
+
* action's own staleness fence, read back only by that action).
|
|
261
|
+
*/
|
|
262
|
+
export declare const sharedActionSchema: z.ZodObject<{
|
|
263
|
+
version: z.ZodLiteral<1>;
|
|
264
|
+
operation: z.ZodEnum<{
|
|
265
|
+
decision_record: "decision_record";
|
|
266
|
+
decision_retire: "decision_retire";
|
|
267
|
+
flow_card_add: "flow_card_add";
|
|
268
|
+
flow_card_approve: "flow_card_approve";
|
|
269
|
+
flow_card_assign: "flow_card_assign";
|
|
270
|
+
flow_card_cancel: "flow_card_cancel";
|
|
271
|
+
flow_card_choose: "flow_card_choose";
|
|
272
|
+
flow_card_comment: "flow_card_comment";
|
|
273
|
+
flow_card_move: "flow_card_move";
|
|
274
|
+
flow_card_send_back: "flow_card_send_back";
|
|
275
|
+
flow_card_watch: "flow_card_watch";
|
|
276
|
+
flow_create: "flow_create";
|
|
277
|
+
flow_edit: "flow_edit";
|
|
278
|
+
flow_script_save: "flow_script_save";
|
|
279
|
+
flow_starter: "flow_starter";
|
|
280
|
+
flow_trigger_add: "flow_trigger_add";
|
|
281
|
+
flow_trigger_pause: "flow_trigger_pause";
|
|
282
|
+
flow_trigger_remove: "flow_trigger_remove";
|
|
283
|
+
flow_trigger_resume: "flow_trigger_resume";
|
|
284
|
+
kit_setup: "kit_setup";
|
|
285
|
+
knowledge_instructions: "knowledge_instructions";
|
|
286
|
+
knowledge_remove: "knowledge_remove";
|
|
287
|
+
knowledge_restore: "knowledge_restore";
|
|
288
|
+
knowledge_save: "knowledge_save";
|
|
289
|
+
lead_about_you: "lead_about_you";
|
|
290
|
+
result_accept: "result_accept";
|
|
291
|
+
scope_approve: "scope_approve";
|
|
292
|
+
skill_disable: "skill_disable";
|
|
293
|
+
skill_enable: "skill_enable";
|
|
294
|
+
skill_import: "skill_import";
|
|
295
|
+
skill_restore: "skill_restore";
|
|
296
|
+
skill_test: "skill_test";
|
|
297
|
+
task_cancel: "task_cancel";
|
|
298
|
+
task_resume: "task_resume";
|
|
299
|
+
teammate_answer: "teammate_answer";
|
|
300
|
+
teammate_create: "teammate_create";
|
|
301
|
+
teammate_memory: "teammate_memory";
|
|
302
|
+
teammate_note: "teammate_note";
|
|
303
|
+
teammate_routine: "teammate_routine";
|
|
304
|
+
teammate_soul: "teammate_soul";
|
|
305
|
+
teammate_state: "teammate_state";
|
|
306
|
+
teammate_tools: "teammate_tools";
|
|
307
|
+
teammate_undo: "teammate_undo";
|
|
308
|
+
tool_add: "tool_add";
|
|
309
|
+
tool_remove: "tool_remove";
|
|
310
|
+
}>;
|
|
311
|
+
request: z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>;
|
|
312
|
+
repo: z.ZodString;
|
|
313
|
+
title: z.ZodString;
|
|
314
|
+
terms: z.ZodArray<z.ZodString>;
|
|
315
|
+
stamp: z.ZodString;
|
|
316
|
+
state: z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>;
|
|
317
|
+
}, z.core.$strict>;
|
|
318
|
+
export type SharedAction = z.infer<typeof sharedActionSchema>;
|
|
319
|
+
/**
|
|
320
|
+
* A proposal saved before it carried `version` (every one through 0.9.36), as version 1. Its reader took the fields
|
|
321
|
+
* it knew and passed any others through unread, so this keeps exactly the known fields.
|
|
322
|
+
*/
|
|
323
|
+
export declare function upgradeUnversionedSharedAction(body: Record<string, unknown>): Record<string, unknown>;
|
|
324
|
+
export declare const SHARED_ACTION_UPGRADES: {
|
|
325
|
+
readonly 0: typeof upgradeUnversionedSharedAction;
|
|
326
|
+
};
|
|
327
|
+
/** Legacy readers checked only the envelope. Confirmation still prepares the request again before acting. */
|
|
328
|
+
export declare function readSharedAction(input: unknown): ContractResult<SharedAction>;
|