@mcoda/mswarm 0.1.135-codali.41 → 0.1.135-codali.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vendor/codali/cli/TerminalCommand.js +2 -2
- package/dist/vendor/codali/cli/tui/TerminalPresentation.js +1 -1
- package/dist/vendor/codali/config/OrchestrationConfig.d.ts +1 -0
- package/dist/vendor/codali/config/OrchestrationConfig.d.ts.map +1 -1
- package/dist/vendor/codali/config/OrchestrationConfig.js +3 -1
- package/dist/vendor/codali/docdex/DocdexClient.d.ts +11 -0
- package/dist/vendor/codali/docdex/DocdexClient.d.ts.map +1 -1
- package/dist/vendor/codali/docdex/DocdexClient.js +55 -1
- package/dist/vendor/codali/eval/fixtures/ContractReviewProvider.d.ts +5 -0
- package/dist/vendor/codali/eval/fixtures/ContractReviewProvider.d.ts.map +1 -1
- package/dist/vendor/codali/eval/fixtures/ContractReviewProvider.js +63 -0
- package/dist/vendor/codali/eval/fixtures/MixedMediaRecoveryJourney.js +2 -2
- package/dist/vendor/codali/eval/fixtures/TerminalRecoveryJourney.js +2 -2
- package/dist/vendor/codali/permissions/PermissionGate.d.ts +7 -0
- package/dist/vendor/codali/permissions/PermissionGate.d.ts.map +1 -1
- package/dist/vendor/codali/permissions/PermissionGate.js +27 -1
- package/dist/vendor/codali/providers/ClaudeCliProvider.d.ts.map +1 -1
- package/dist/vendor/codali/providers/ClaudeCliProvider.js +1 -0
- package/dist/vendor/codali/providers/CodexCliProvider.d.ts.map +1 -1
- package/dist/vendor/codali/providers/CodexCliProvider.js +1 -0
- package/dist/vendor/codali/providers/ConfiguredProvider.d.ts +2 -0
- package/dist/vendor/codali/providers/ConfiguredProvider.d.ts.map +1 -1
- package/dist/vendor/codali/providers/ConfiguredProvider.js +29 -0
- package/dist/vendor/codali/providers/ModelServiceError.d.ts +16 -2
- package/dist/vendor/codali/providers/ModelServiceError.d.ts.map +1 -1
- package/dist/vendor/codali/providers/ModelServiceError.js +18 -1
- package/dist/vendor/codali/providers/OllamaRemoteProvider.d.ts.map +1 -1
- package/dist/vendor/codali/providers/OllamaRemoteProvider.js +1 -0
- package/dist/vendor/codali/providers/OpenAiCompatibleProvider.d.ts.map +1 -1
- package/dist/vendor/codali/providers/OpenAiCompatibleProvider.js +4 -0
- package/dist/vendor/codali/providers/ProviderTypes.d.ts +4 -0
- package/dist/vendor/codali/providers/ProviderTypes.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/AnswerEdits.d.ts +39 -0
- package/dist/vendor/codali/runtime/AnswerEdits.d.ts.map +1 -0
- package/dist/vendor/codali/runtime/AnswerEdits.js +134 -0
- package/dist/vendor/codali/runtime/AnswerVerification.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/AnswerVerification.js +4 -2
- package/dist/vendor/codali/runtime/AuditGuards.d.ts +41 -0
- package/dist/vendor/codali/runtime/AuditGuards.d.ts.map +1 -0
- package/dist/vendor/codali/runtime/AuditGuards.js +81 -0
- package/dist/vendor/codali/runtime/CompletionReport.d.ts +4 -2
- package/dist/vendor/codali/runtime/CompletionReport.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/CompletionReport.js +8 -3
- package/dist/vendor/codali/runtime/ContextCompression.d.ts +5 -0
- package/dist/vendor/codali/runtime/ContextCompression.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/ContextCompression.js +16 -4
- package/dist/vendor/codali/runtime/DeliveryDocs.d.ts +21 -0
- package/dist/vendor/codali/runtime/DeliveryDocs.d.ts.map +1 -0
- package/dist/vendor/codali/runtime/DeliveryDocs.js +148 -0
- package/dist/vendor/codali/runtime/FigureCheck.d.ts +61 -2
- package/dist/vendor/codali/runtime/FigureCheck.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/FigureCheck.js +210 -14
- package/dist/vendor/codali/runtime/GatewayRequest.d.ts +13 -0
- package/dist/vendor/codali/runtime/GatewayRequest.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/GatewayRequest.js +54 -1
- package/dist/vendor/codali/runtime/InspectionConvergence.d.ts +4 -0
- package/dist/vendor/codali/runtime/InspectionConvergence.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/InspectionConvergence.js +24 -1
- package/dist/vendor/codali/runtime/InteractionContract.d.ts +15 -0
- package/dist/vendor/codali/runtime/InteractionContract.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/InteractionContract.js +33 -0
- package/dist/vendor/codali/runtime/InteractionRouter.d.ts +3 -3
- package/dist/vendor/codali/runtime/InteractionRouter.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/InteractionRouter.js +1 -1
- package/dist/vendor/codali/runtime/NumericProvenance.d.ts +102 -0
- package/dist/vendor/codali/runtime/NumericProvenance.d.ts.map +1 -0
- package/dist/vendor/codali/runtime/NumericProvenance.js +411 -0
- package/dist/vendor/codali/runtime/OutageWait.d.ts +46 -5
- package/dist/vendor/codali/runtime/OutageWait.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/OutageWait.js +81 -8
- package/dist/vendor/codali/runtime/ResearchEvidence.d.ts +14 -0
- package/dist/vendor/codali/runtime/ResearchEvidence.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/ResearchEvidence.js +139 -3
- package/dist/vendor/codali/runtime/ReviewCoordinator.d.ts +22 -0
- package/dist/vendor/codali/runtime/ReviewCoordinator.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/ReviewCoordinator.js +203 -25
- package/dist/vendor/codali/runtime/ReviewSource.d.ts +5 -0
- package/dist/vendor/codali/runtime/ReviewSource.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/ReviewSource.js +6 -1
- package/dist/vendor/codali/runtime/SessionController.d.ts +85 -10
- package/dist/vendor/codali/runtime/SessionController.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/SessionController.js +996 -176
- package/dist/vendor/codali/runtime/StructuralEvidence.d.ts +10 -0
- package/dist/vendor/codali/runtime/StructuralEvidence.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/StructuralEvidence.js +10 -0
- package/dist/vendor/codali/runtime/TaskReview.d.ts +10 -0
- package/dist/vendor/codali/runtime/TaskReview.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/TaskReview.js +31 -3
- package/dist/vendor/codali/runtime/VerificationCommand.d.ts +8 -0
- package/dist/vendor/codali/runtime/VerificationCommand.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/VerificationCommand.js +114 -0
- package/dist/vendor/codali/runtime/WorkingStyle.d.ts +20 -0
- package/dist/vendor/codali/runtime/WorkingStyle.d.ts.map +1 -0
- package/dist/vendor/codali/runtime/WorkingStyle.js +71 -0
- package/dist/vendor/codali/tools/ToolRegistry.d.ts.map +1 -1
- package/dist/vendor/codali/tools/ToolRegistry.js +30 -4
- package/dist/vendor/codali/tools/ToolTypes.d.ts +3 -0
- package/dist/vendor/codali/tools/ToolTypes.d.ts.map +1 -1
- package/dist/vendor/codali/tools/browser/BrowserTool.d.ts +23 -1
- package/dist/vendor/codali/tools/browser/BrowserTool.d.ts.map +1 -1
- package/dist/vendor/codali/tools/browser/BrowserTool.js +83 -4
- package/dist/vendor/codali/tools/browser/BrowserWorker.js +142 -2
- package/dist/vendor/codali/tools/browser/HttpFallback.d.ts +39 -0
- package/dist/vendor/codali/tools/browser/HttpFallback.d.ts.map +1 -0
- package/dist/vendor/codali/tools/browser/HttpFallback.js +240 -0
- package/dist/vendor/codali/tools/calculation/CalculatorTool.d.ts +16 -1
- package/dist/vendor/codali/tools/calculation/CalculatorTool.d.ts.map +1 -1
- package/dist/vendor/codali/tools/calculation/CalculatorTool.js +321 -26
- package/dist/vendor/codali/tools/deterministic/DeterministicTools.js +1 -1
- package/dist/vendor/codali/tools/deterministic/node-worker.cjs +10 -10
- package/dist/vendor/codali/tools/shell/AsyncProcess.d.ts +2 -0
- package/dist/vendor/codali/tools/shell/AsyncProcess.d.ts.map +1 -1
- package/dist/vendor/codali/tools/shell/AsyncProcess.js +38 -5
- package/dist/vendor/codali/tools/shell/IsolatedExecutor.d.ts +29 -1
- package/dist/vendor/codali/tools/shell/IsolatedExecutor.d.ts.map +1 -1
- package/dist/vendor/codali/tools/shell/IsolatedExecutor.js +179 -9
- package/dist/vendor/codali/tools/shell/ShellTool.d.ts +2 -0
- package/dist/vendor/codali/tools/shell/ShellTool.d.ts.map +1 -1
- package/dist/vendor/codali/tools/shell/ShellTool.js +33 -3
- package/dist/vendor/codali/tools/verification/CodeRunTool.d.ts +19 -0
- package/dist/vendor/codali/tools/verification/CodeRunTool.d.ts.map +1 -0
- package/dist/vendor/codali/tools/verification/CodeRunTool.js +104 -0
- package/dist/vendor/codali/tools/verification/JavaScriptVerificationTool.d.ts.map +1 -1
- package/dist/vendor/codali/tools/verification/JavaScriptVerificationTool.js +21 -10
- package/dist/vendor/codali/tools/verification/VitestTool.d.ts +27 -0
- package/dist/vendor/codali/tools/verification/VitestTool.d.ts.map +1 -1
- package/dist/vendor/codali/tools/verification/VitestTool.js +232 -18
- package/dist/vendor/config/deterministic/node-worker.mjs +15 -2
- package/dist/vendor/config/skills/code-implementation/SKILL.md +1 -1
- package/dist/vendor/config/skills/planning/SKILL.md +1 -1
- package/dist/vendor/config/skills/testing-and-verification/SKILL.md +5 -5
- package/dist/vendor/config/skills/ui-ux-design/SKILL.md +1 -1
- package/dist/vendor/config/skills/webapp-testing/SKILL.md +4 -0
- package/dist/vendor/config/skills/webapp-testing/journey-driver.mjs +186 -0
- package/package.json +3 -3
|
@@ -6,6 +6,16 @@ export interface StructuralAnalysis {
|
|
|
6
6
|
valid: boolean;
|
|
7
7
|
}
|
|
8
8
|
export declare const isSourcePath: (file: string) => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Build output (build/, dist/, out/, coverage/, framework caches, minified
|
|
11
|
+
* bundles, source maps) is produced from other files: nothing calls into it and
|
|
12
|
+
* a build replaces it wholesale. dist/, coverage/, .next/ and .nuxt/ are output
|
|
13
|
+
* at any depth (packages/web/dist/); build/ and out/ only at the root, since
|
|
14
|
+
* nested folders of those names often hold authored build scripts. This is a
|
|
15
|
+
* location rule only: SessionController never treats a Git-tracked file as
|
|
16
|
+
* generated.
|
|
17
|
+
*/
|
|
18
|
+
export declare const isGeneratedOutput: (file: string) => boolean;
|
|
9
19
|
/** Installed dependencies/toolchains are inventoried for isolation, not authored source. */
|
|
10
20
|
export declare const isDependencyArtifact: (file: string) => boolean;
|
|
11
21
|
export declare const workspaceRelativePath: (root: string, file: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StructuralEvidence.d.ts","sourceRoot":"","sources":["../../src/runtime/StructuralEvidence.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,WAAW,GAAG,QAAQ,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,OAA2I,CAAC;AAExL,4FAA4F;AAC5F,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,KAAG,OAA8H,CAAC;AAEnL,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,MAIlE,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,iBAAiB,GAAU,MAAM,MAAM,EAAE,QAAQ,MAAM,EAAE,EAAE,mBAAmB,EAAE,iBAAgB,MAAM,EAAO,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAoC1J,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG;IAAE,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAIjI,CAAC;AAEF,wFAAwF;AACxF,eAA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AE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAIjI,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,mBAAmB,GAAI,MAAM,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,OAAO,EAAE,MAAM,MAAM,KAAG,OAOnG,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,EAAE,UAAU,QAAQ,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAA;CAAE,CAAC,KAAG,MAAM,EAQnJ,CAAC"}
|
|
@@ -4,6 +4,16 @@ import { hashWorkspacePath } from "./WorkspaceSnapshot.js";
|
|
|
4
4
|
import { isWithinScope } from "../session/WorkspaceScope.js";
|
|
5
5
|
export { isWithinScope } from "../session/WorkspaceScope.js";
|
|
6
6
|
export const isSourcePath = (file) => /\.(?:[cm]?[jt]sx?|py|rs|go|java|kt|kts|c|cc|cpp|cxx|h|hpp|cs|rb|php|swift|sh|bash|lua|ex|exs|scala|sc|vue|svelte)$/i.test(file);
|
|
7
|
+
/**
|
|
8
|
+
* Build output (build/, dist/, out/, coverage/, framework caches, minified
|
|
9
|
+
* bundles, source maps) is produced from other files: nothing calls into it and
|
|
10
|
+
* a build replaces it wholesale. dist/, coverage/, .next/ and .nuxt/ are output
|
|
11
|
+
* at any depth (packages/web/dist/); build/ and out/ only at the root, since
|
|
12
|
+
* nested folders of those names often hold authored build scripts. This is a
|
|
13
|
+
* location rule only: SessionController never treats a Git-tracked file as
|
|
14
|
+
* generated.
|
|
15
|
+
*/
|
|
16
|
+
export const isGeneratedOutput = (file) => /^(?:build|out)\/|(?:^|\/)(?:dist|coverage|\.next|\.nuxt)\//.test(file) || /\.min\.(?:js|css)$|\.map$/.test(file);
|
|
7
17
|
/** Installed dependencies/toolchains are inventoried for isolation, not authored source. */
|
|
8
18
|
export const isDependencyArtifact = (file) => file.split("/").some(part => ["node_modules", ".gradle", ".npm-cache", ".pnpm-store", ".toolchain"].includes(part));
|
|
9
19
|
export const workspaceRelativePath = (root, file) => {
|
|
@@ -10,6 +10,12 @@ export interface ReviewSourcePage {
|
|
|
10
10
|
export interface TaskReviewResult {
|
|
11
11
|
passed: boolean;
|
|
12
12
|
findings: string[];
|
|
13
|
+
/** Checks the portion budget left unreviewed (not rejected). */
|
|
14
|
+
unreviewed?: {
|
|
15
|
+
id: string;
|
|
16
|
+
sourceId: string;
|
|
17
|
+
expectedBehavior: string;
|
|
18
|
+
}[];
|
|
13
19
|
}
|
|
14
20
|
/** Read-only evidence requests share the caller's model budget and acceptance fence. */
|
|
15
21
|
export declare function runTaskReview(options: {
|
|
@@ -21,5 +27,9 @@ export declare function runTaskReview(options: {
|
|
|
21
27
|
maxInputChars: number;
|
|
22
28
|
maxOutputTokens?: number;
|
|
23
29
|
signal?: AbortSignal;
|
|
30
|
+
/** Checks an approval before it is accepted. Problems get one repair round,
|
|
31
|
+
* in which the reviewer may supply the missing evidence or reject; problems
|
|
32
|
+
* that remain become the review's findings. */
|
|
33
|
+
approve?: (verdict: Readonly<Record<string, unknown>>) => Promise<string[]>;
|
|
24
34
|
}): Promise<TaskReviewResult>;
|
|
25
35
|
//# sourceMappingURL=TaskReview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskReview.d.ts","sourceRoot":"","sources":["../../src/runtime/TaskReview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAE/E,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED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,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC7E,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAiH5B"}
|
|
@@ -6,10 +6,12 @@ export async function runTaskReview(options) {
|
|
|
6
6
|
const reject = (finding) => ({ passed: false, findings: [finding] });
|
|
7
7
|
let sourceRounds = 0;
|
|
8
8
|
let formatRepaired = false;
|
|
9
|
+
let repeatReminded = false;
|
|
10
|
+
let evidenceRepaired = false;
|
|
9
11
|
// Four evidence rounds followed by a final decision. No execution tool or
|
|
10
12
|
// permission widening is available. One received malformed JSON reply may be
|
|
11
13
|
// repaired, still within the original contract, context and model-call budget.
|
|
12
|
-
for (let call = 0; call <
|
|
14
|
+
for (let call = 0; call < 7; call++) {
|
|
13
15
|
options.signal?.throwIfAborted();
|
|
14
16
|
if (JSON.stringify(messages).length > options.maxInputChars) {
|
|
15
17
|
return reject("Required review evidence exceeds the configured model context. Split the task or select a larger compatible reviewer context; acceptance is not established.");
|
|
@@ -42,6 +44,18 @@ export async function runTaskReview(options) {
|
|
|
42
44
|
if (typeof result.passed !== "boolean" || !Array.isArray(result.findings) || !result.findings.every(finding => typeof finding === "string")) {
|
|
43
45
|
return reject("Review did not provide valid acceptance evidence.");
|
|
44
46
|
}
|
|
47
|
+
if (result.passed === true && result.findings.length === 0 && options.approve) {
|
|
48
|
+
const problems = await options.approve(result);
|
|
49
|
+
if (problems.length) {
|
|
50
|
+
if (evidenceRepaired)
|
|
51
|
+
return { passed: false, findings: problems };
|
|
52
|
+
evidenceRepaired = true;
|
|
53
|
+
messages.push({ role: "assistant", content: response.message.content });
|
|
54
|
+
messages.push({ role: "user", content: JSON.stringify({ evidenceProblems: problems,
|
|
55
|
+
instruction: "The approval was not accepted: these checks lack verifiable evidence. For each one, cite evidence that exists exactly as quoted, or reject with a finding that names what is missing. Do not approve a check you cannot prove. Reply with the same verdict format, including evidence for every check in this portion." }) });
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
45
59
|
return { passed: result.passed === true && result.findings.length === 0,
|
|
46
60
|
findings: result.findings.length ? result.findings : result.passed ? [] : ["Review rejected acceptance without a specific finding."] };
|
|
47
61
|
}
|
|
@@ -53,6 +67,7 @@ export async function runTaskReview(options) {
|
|
|
53
67
|
return reject("Review sourceRequests must contain one to eight bounded path/offset requests.");
|
|
54
68
|
}
|
|
55
69
|
const requests = [];
|
|
70
|
+
let repeats = 0;
|
|
56
71
|
for (const request of result.sourceRequests) {
|
|
57
72
|
if (!request || typeof request !== "object" || typeof request.path !== "string" || !options.allowedPaths.includes(request.path)) {
|
|
58
73
|
return reject("Review requested a file outside the current review evidence scope.");
|
|
@@ -61,11 +76,24 @@ export async function runTaskReview(options) {
|
|
|
61
76
|
if (!Number.isSafeInteger(offset) || offset < 0)
|
|
62
77
|
return reject("Review source offsets must be nonnegative safe integers.");
|
|
63
78
|
const key = JSON.stringify([request.path, offset]);
|
|
64
|
-
|
|
65
|
-
|
|
79
|
+
// A page already supplied is skipped, not fatal: a reviewer that asks
|
|
80
|
+
// for it again beside new pages has lost nothing. Only a request with
|
|
81
|
+
// no new page is a loop, and it gets one reminder before the review ends.
|
|
82
|
+
if (requested.has(key)) {
|
|
83
|
+
repeats++;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
66
86
|
requested.add(key);
|
|
67
87
|
requests.push({ path: request.path, offset });
|
|
68
88
|
}
|
|
89
|
+
if (!requests.length) {
|
|
90
|
+
if (repeatReminded)
|
|
91
|
+
return reject("Review repeated a source page request without progress; acceptance is not established.");
|
|
92
|
+
repeatReminded = true;
|
|
93
|
+
messages.push({ role: "assistant", content: response.message.content });
|
|
94
|
+
messages.push({ role: "user", content: `Every page in that request was already supplied above (${repeats} repeated). Decide from the evidence you have with {"passed":boolean,"findings":string[]}, or request a page you have not received: use the nextOffset of the last page of that file.` });
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
69
97
|
const pages = [];
|
|
70
98
|
for (const request of requests) {
|
|
71
99
|
options.signal?.throwIfAborted();
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
/** Budget eligibility for inspection only; never substitutes for test evidence. */
|
|
2
2
|
export declare const isVerificationInspectionCommand: (args: unknown) => boolean;
|
|
3
|
+
/** Whether a `bash -c` / `sh -c` line can stand as validation: steps joined
|
|
4
|
+
* only by &&, so any failing step fails the call, with a real test command
|
|
5
|
+
* among them. Every step is `cd <dir>`, `set -e` (never `set +...`) or one of a
|
|
6
|
+
* few ordinary programs; nothing is expanded, substituted or redefined.
|
|
7
|
+
* `cmd; echo EXIT=$?`, `|| true`, `exit 0 && ...`, `trap`, variables and brace
|
|
8
|
+
* lists are refused. Output may go to a file, and in bash (which runs with
|
|
9
|
+
* pipefail) through tail, head, grep, tee or cat. */
|
|
10
|
+
export declare const failFastShellVerification: (command: string, argv: string[]) => boolean;
|
|
3
11
|
/** Command-shape eligibility only; success, fresh input hashes and review remain mandatory. */
|
|
4
12
|
export declare const isVerificationCommand: (args: unknown) => boolean;
|
|
5
13
|
//# sourceMappingURL=VerificationCommand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerificationCommand.d.ts","sourceRoot":"","sources":["../../src/runtime/VerificationCommand.ts"],"names":[],"mappings":"AAEA,mFAAmF;AACnF,eAAO,MAAM,+BAA+B,GAAI,MAAM,OAAO,KAAG,OAiB/D,CAAC;AAEF,+FAA+F;AAC/F,eAAO,MAAM,qBAAqB,GAAI,MAAM,OAAO,KAAG,
|
|
1
|
+
{"version":3,"file":"VerificationCommand.d.ts","sourceRoot":"","sources":["../../src/runtime/VerificationCommand.ts"],"names":[],"mappings":"AAEA,mFAAmF;AACnF,eAAO,MAAM,+BAA+B,GAAI,MAAM,OAAO,KAAG,OAiB/D,CAAC;AA0BF;;;;;;qDAMqD;AACrD,eAAO,MAAM,yBAAyB,GAAI,SAAS,MAAM,EAAE,MAAM,MAAM,EAAE,KAAG,OAkC3E,CAAC;AAEF,+FAA+F;AAC/F,eAAO,MAAM,qBAAqB,GAAI,MAAM,OAAO,KAAG,OA8BrD,CAAC"}
|
|
@@ -27,6 +27,118 @@ export const isVerificationInspectionCommand = (args) => {
|
|
|
27
27
|
}
|
|
28
28
|
return true;
|
|
29
29
|
};
|
|
30
|
+
/** Words of one simple command, or undefined when it holds anything a shell
|
|
31
|
+
* would expand or interpret: variables, braces, globs, tildes, escapes, comments. */
|
|
32
|
+
const shellWords = (text) => {
|
|
33
|
+
const words = [];
|
|
34
|
+
let current = "", quoted, started = false;
|
|
35
|
+
for (const char of text) {
|
|
36
|
+
if (quoted) {
|
|
37
|
+
if (char === quoted)
|
|
38
|
+
quoted = undefined;
|
|
39
|
+
else if (quoted === '"' && /[`\\$]/.test(char))
|
|
40
|
+
return undefined;
|
|
41
|
+
else
|
|
42
|
+
current += char;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (char === '"' || char === "'") {
|
|
46
|
+
quoted = char;
|
|
47
|
+
started = true;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (/\s/.test(char)) {
|
|
51
|
+
if (started || current)
|
|
52
|
+
words.push(current);
|
|
53
|
+
current = "";
|
|
54
|
+
started = false;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (!/[A-Za-z0-9_@%+=:,.\/-]/.test(char))
|
|
58
|
+
return undefined;
|
|
59
|
+
current += char;
|
|
60
|
+
}
|
|
61
|
+
if (quoted)
|
|
62
|
+
return undefined;
|
|
63
|
+
if (started || current)
|
|
64
|
+
words.push(current);
|
|
65
|
+
return words;
|
|
66
|
+
};
|
|
67
|
+
/** Environment a test line may set: names that configure the app under test,
|
|
68
|
+
* never ones that change how the shell, npm or the runtime start a command. */
|
|
69
|
+
const SAFE_ENV = /^(?:PORT|HOST|NODE_ENV|CI|TZ|LANG|LC_ALL|FORCE_COLOR|NO_COLOR|DB_PATH|DATA_DIR|LOG_LEVEL|DEBUG)=[A-Za-z0-9_@%+:,.\/-]*$/;
|
|
70
|
+
/** Programs that may run before or after the test in the same line. They are
|
|
71
|
+
* ordinary processes: unlike exit, exec, trap, eval or set +o they cannot change
|
|
72
|
+
* what the shell reports for the steps around them. */
|
|
73
|
+
const STEP_PROGRAMS = new Set(["npm", "pnpm", "yarn", "bun", "node", "npx", "tsc", "python3", "pytest", "cargo", "go", "make", "mkdir"]);
|
|
74
|
+
/** Whether a `bash -c` / `sh -c` line can stand as validation: steps joined
|
|
75
|
+
* only by &&, so any failing step fails the call, with a real test command
|
|
76
|
+
* among them. Every step is `cd <dir>`, `set -e` (never `set +...`) or one of a
|
|
77
|
+
* few ordinary programs; nothing is expanded, substituted or redefined.
|
|
78
|
+
* `cmd; echo EXIT=$?`, `|| true`, `exit 0 && ...`, `trap`, variables and brace
|
|
79
|
+
* lists are refused. Output may go to a file, and in bash (which runs with
|
|
80
|
+
* pipefail) through tail, head, grep, tee or cat. */
|
|
81
|
+
export const failFastShellVerification = (command, argv) => {
|
|
82
|
+
if (!["bash", "sh"].includes(command))
|
|
83
|
+
return false;
|
|
84
|
+
const flags = argv.slice(0, -1).filter(arg => arg !== "-o" && arg !== "pipefail");
|
|
85
|
+
if (argv.length < 2 || flags.length !== flags.filter(arg => /^-[euxc]+$/.test(arg) || arg === "--noprofile" || arg === "--norc").length || !flags.some(arg => /^-[eux]*c$/.test(arg)))
|
|
86
|
+
return false;
|
|
87
|
+
const script = argv.at(-1);
|
|
88
|
+
if (script.length > 2000 || /[\n`]|\$\(|\$'|\$"|<</.test(script))
|
|
89
|
+
return false;
|
|
90
|
+
// Quoted text is set aside so a "|" or ";" inside a grep pattern is not read as shell syntax.
|
|
91
|
+
const quoted = [];
|
|
92
|
+
const masked = script.replace(/2>&1/g, " ").replace(/"[^"]*"|'[^']*'/g, text => `\u0000${quoted.push(text) - 1}\u0000`);
|
|
93
|
+
if (/["';#]|\|\||&(?!&)(?<!&&)/.test(masked))
|
|
94
|
+
return false;
|
|
95
|
+
const restore = (text) => text.replace(/\u0000(\d+)\u0000/g, (_, index) => quoted[Number(index)]);
|
|
96
|
+
let verified = false;
|
|
97
|
+
for (const step of masked.split("&&")) {
|
|
98
|
+
const [head, ...filters] = step.split("|");
|
|
99
|
+
if (filters.length && (command !== "bash" || filters.some(filter => !/^\s*(?:tail|head|grep|tee|cat)\b[^<>&]*$/.test(filter) || /[$`]/.test(restore(filter)))))
|
|
100
|
+
return false;
|
|
101
|
+
// Redirection to a file keeps the exit status; the target is not a word of the command.
|
|
102
|
+
const words = shellWords(restore(head.replace(/\s\d?>>?\s*\S+/g, " ")));
|
|
103
|
+
if (!words?.length)
|
|
104
|
+
return false;
|
|
105
|
+
let at = 0;
|
|
106
|
+
while (at < words.length && /^[A-Za-z_][A-Za-z0-9_]*=/.test(words[at])) {
|
|
107
|
+
if (!SAFE_ENV.test(words[at]))
|
|
108
|
+
return false;
|
|
109
|
+
at++;
|
|
110
|
+
}
|
|
111
|
+
if (at >= words.length)
|
|
112
|
+
return false;
|
|
113
|
+
if (words[at] === "timeout") {
|
|
114
|
+
at++;
|
|
115
|
+
while (words[at] === "-s" || words[at] === "-k") {
|
|
116
|
+
if (!/^[A-Za-z0-9.]+$/.test(words[at + 1] ?? ""))
|
|
117
|
+
return false;
|
|
118
|
+
at += 2;
|
|
119
|
+
}
|
|
120
|
+
if (!/^\d+(?:\.\d+)?[smh]?$/.test(words[at] ?? ""))
|
|
121
|
+
return false;
|
|
122
|
+
at++;
|
|
123
|
+
}
|
|
124
|
+
const program = words[at], args = words.slice(at + 1);
|
|
125
|
+
if (program === "cd") {
|
|
126
|
+
if (at !== 0 || args.length !== 1 || args[0].startsWith("-"))
|
|
127
|
+
return false;
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (program === "set") {
|
|
131
|
+
if (at !== 0 || !(args.length === 1 && /^-[eux]+$/.test(args[0]) || args.length === 2 && /^-[eux]*o$/.test(args[0]) && args[1] === "pipefail"))
|
|
132
|
+
return false;
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (!STEP_PROGRAMS.has(program))
|
|
136
|
+
return false;
|
|
137
|
+
if (isVerificationCommand({ command: program, args }))
|
|
138
|
+
verified = true;
|
|
139
|
+
}
|
|
140
|
+
return verified;
|
|
141
|
+
};
|
|
30
142
|
/** Command-shape eligibility only; success, fresh input hashes and review remain mandatory. */
|
|
31
143
|
export const isVerificationCommand = (args) => {
|
|
32
144
|
if (!args || typeof args !== "object" || Array.isArray(args))
|
|
@@ -36,6 +148,8 @@ export const isVerificationCommand = (args) => {
|
|
|
36
148
|
return false;
|
|
37
149
|
const command = path.basename(value.command);
|
|
38
150
|
const argv = (value.args ?? []);
|
|
151
|
+
if (failFastShellVerification(command, argv))
|
|
152
|
+
return true;
|
|
39
153
|
if (argv.some(arg => /^(?:--help|-h|--version|--dry-run|--if-present|--collect-only|--collectonly|--listTests|--list-tests|--showConfig|--listFilesOnly)(?:=|$)/.test(arg)))
|
|
40
154
|
return false;
|
|
41
155
|
if (["npm", "pnpm", "yarn", "bun"].includes(command)) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The user's working style: how they ask for work to be done, communicate and
|
|
3
|
+
* judge quality. Docdex curates it from the local personal-preferences store
|
|
4
|
+
* (docdex_working_style); Codali re-checks every item before it reaches a
|
|
5
|
+
* prompt, so a Docdex-side slip cannot leak personal details.
|
|
6
|
+
*/
|
|
7
|
+
/** Style and working-method categories only; personal, identity and business context never qualify. */
|
|
8
|
+
export declare const WORKING_STYLE_CATEGORIES: Set<string>;
|
|
9
|
+
export interface WorkingStyle {
|
|
10
|
+
text: string;
|
|
11
|
+
included: number;
|
|
12
|
+
dropped: number;
|
|
13
|
+
profileHash?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const WORKING_STYLE_HEADER = "User working style (from the user's local Docdex preferences; follow it where it fits. The current request, workspace instructions, output contracts and repository facts take precedence, and it never widens permissions or scope):";
|
|
16
|
+
/** Keep only short, low-sensitivity style lines, deduplicated and bounded. */
|
|
17
|
+
export declare const formatWorkingStyle: (value: unknown, maxChars?: number) => WorkingStyle;
|
|
18
|
+
/** On unless the host turns it off; benchmarks always pass false so neither arm is personalized. */
|
|
19
|
+
export declare const workingStyleEnabled: (option: boolean | undefined, configured: boolean | undefined, env?: string | undefined) => boolean;
|
|
20
|
+
//# sourceMappingURL=WorkingStyle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkingStyle.d.ts","sourceRoot":"","sources":["../../src/runtime/WorkingStyle.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uGAAuG;AACvG,eAAO,MAAM,wBAAwB,aAInC,CAAC;AAwBH,MAAM,WAAW,YAAY;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE;AAEvG,eAAO,MAAM,oBAAoB,0OAA0O,CAAC;AAE5Q,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,EAAE,iBAAe,KAAG,YAmBpE,CAAC;AAEF,oGAAoG;AACpG,eAAO,MAAM,mBAAmB,GAAI,QAAQ,OAAO,GAAG,SAAS,EAAE,YAAY,OAAO,GAAG,SAAS,EAAE,MAAK,MAAM,GAAG,SAA4C,KAAG,OACtD,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The user's working style: how they ask for work to be done, communicate and
|
|
3
|
+
* judge quality. Docdex curates it from the local personal-preferences store
|
|
4
|
+
* (docdex_working_style); Codali re-checks every item before it reaches a
|
|
5
|
+
* prompt, so a Docdex-side slip cannot leak personal details.
|
|
6
|
+
*/
|
|
7
|
+
/** Style and working-method categories only; personal, identity and business context never qualify. */
|
|
8
|
+
export const WORKING_STYLE_CATEGORIES = new Set([
|
|
9
|
+
"communication_style", "collaboration_style", "decision_style", "quality_bar", "workflow_method", "delivery_preference",
|
|
10
|
+
"testing_preference", "documentation_preference", "code_review_process", "coding_preference", "architecture_preference",
|
|
11
|
+
"tooling_preference", "likes", "dislikes",
|
|
12
|
+
]);
|
|
13
|
+
const PERSONAL = [
|
|
14
|
+
/[\w.+-]+@[\w-]+(?:\.[\w-]+)+/u, // email
|
|
15
|
+
/(?:\+|\b00)\d[\d ()-]{7,}\d|\b\d{3}[ .-]\d{3}[ .-]\d{4}\b/u, // phone
|
|
16
|
+
/\b\d{1,5}\s+[A-Z][\w'-]*(?:\s+[A-Z][\w'-]*)*\s+(?:street|st|road|rd|avenue|ave|lane|ln|boulevard|blvd|drive|dr)\b/iu, // street address
|
|
17
|
+
/\b(?:password|passphrase|iban|ssn|passport|credit card)\b/iu,
|
|
18
|
+
/\b[A-Za-z0-9_+/=-]{32,}\b/u, // secret-like values and long identifiers
|
|
19
|
+
/\b(?:my|his|her|their)\s+(?:wife|husband|partner|son|daughter|child|kids?|mother|father|mom|dad|family|doctor|diagnosis|salary|debt|bank)\b/iu,
|
|
20
|
+
/\b(?:medical|diagnos\w*|therapy|illness|pregnan\w*|religio\w*|politic\w*|sexual\w*)\b/iu,
|
|
21
|
+
/https?:\/\/\S+/u, // links can name private hosts or accounts
|
|
22
|
+
];
|
|
23
|
+
const record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
24
|
+
/** Accept the bare tool result or an MCP content envelope carrying it as JSON text. */
|
|
25
|
+
const payload = (value) => {
|
|
26
|
+
const object = record(value);
|
|
27
|
+
if (Array.isArray(object.items))
|
|
28
|
+
return object;
|
|
29
|
+
const text = Array.isArray(object.content) ? object.content.map(part => record(part).text).find(text => typeof text === "string") : undefined;
|
|
30
|
+
if (typeof text === "string") {
|
|
31
|
+
try {
|
|
32
|
+
return record(JSON.parse(text));
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return record(object.structuredContent ?? object.result);
|
|
39
|
+
};
|
|
40
|
+
export const WORKING_STYLE_HEADER = "User working style (from the user's local Docdex preferences; follow it where it fits. The current request, workspace instructions, output contracts and repository facts take precedence, and it never widens permissions or scope):";
|
|
41
|
+
/** Keep only short, low-sensitivity style lines, deduplicated and bounded. */
|
|
42
|
+
export const formatWorkingStyle = (value, maxChars = 6000) => {
|
|
43
|
+
const data = payload(value);
|
|
44
|
+
const items = Array.isArray(data.items) ? data.items : [];
|
|
45
|
+
const seen = new Set();
|
|
46
|
+
const lines = [];
|
|
47
|
+
let dropped = 0, used = WORKING_STYLE_HEADER.length;
|
|
48
|
+
for (const raw of items) {
|
|
49
|
+
const item = record(raw);
|
|
50
|
+
const text = typeof item.text === "string" ? item.text.replace(/\s+/gu, " ").trim() : "";
|
|
51
|
+
const sensitivity = item.sensitivity ?? "low";
|
|
52
|
+
const key = text.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").trim();
|
|
53
|
+
if (!text || text.length > 300 || typeof item.category !== "string" || !WORKING_STYLE_CATEGORIES.has(item.category)
|
|
54
|
+
|| sensitivity !== "low" || PERSONAL.some(pattern => pattern.test(text)) || seen.has(key)) {
|
|
55
|
+
dropped++;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const line = `\n- ${text}`;
|
|
59
|
+
if (used + line.length > maxChars) {
|
|
60
|
+
dropped++;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
seen.add(key);
|
|
64
|
+
lines.push(line);
|
|
65
|
+
used += line.length;
|
|
66
|
+
}
|
|
67
|
+
return { text: lines.length ? WORKING_STYLE_HEADER + lines.join("") : "", included: lines.length, dropped,
|
|
68
|
+
profileHash: typeof data.profile_hash === "string" ? data.profile_hash.slice(0, 128) : undefined };
|
|
69
|
+
};
|
|
70
|
+
/** On unless the host turns it off; benchmarks always pass false so neither arm is personalized. */
|
|
71
|
+
export const workingStyleEnabled = (option, configured, env = process.env.CODALI_WORKING_STYLE) => option ?? (env !== undefined && /^(?:0|false|off|no)$/iu.test(env.trim()) ? false : configured ?? true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolRegistry.d.ts","sourceRoot":"","sources":["../../src/tools/ToolRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,cAAc,EAGnB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAE1B,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,cAAc,KAAG,cAOvD,CAAC;AA4HH,eAAO,MAAM,qBAAqB,GAChC,OAAO,OAAO,EACd,QAAQ,oBAAoB,GAAG,SAAS,KACvC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAwBrC,CAAC;
|
|
1
|
+
{"version":3,"file":"ToolRegistry.d.ts","sourceRoot":"","sources":["../../src/tools/ToolRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,cAAc,EAGnB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAE1B,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,cAAc,KAAG,cAOvD,CAAC;AA4HH,eAAO,MAAM,qBAAqB,GAChC,OAAO,OAAO,EACd,QAAQ,oBAAoB,GAAG,SAAS,KACvC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAwBrC,CAAC;AA2LF,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAqC;IAElD,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAOpC,IAAI,IAAI,cAAc,EAAE;IAIxB,wEAAwE;IACxE,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAE9B,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,aAAa,GAAG,aAAa,CAAC,CAAC;IAQ/E;;;;OAIG;IACH,OAAO,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,cAAc,EAAE;IAOpD,2EAA2E;IAC3E,YAAY,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,GAAG,CAAC,cAAc,EAAE,cAAc,EAAE,CAAC;IAaxE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAqE/F"}
|
|
@@ -326,6 +326,7 @@ const normalizeExecutionError = (error) => {
|
|
|
326
326
|
}
|
|
327
327
|
return buildToolError("tool_execution_failed", message, { retryable: true });
|
|
328
328
|
};
|
|
329
|
+
const WORKSPACE_TOOLS = new Set(["write_file", "create_directory", "prepare_edit", "apply_patch", "delete_file", "run_shell", "work_claim", "work_verify", "work_complete"]);
|
|
329
330
|
export class ToolRegistry {
|
|
330
331
|
constructor() {
|
|
331
332
|
this.tools = new Map();
|
|
@@ -379,7 +380,11 @@ export class ToolRegistry {
|
|
|
379
380
|
return {
|
|
380
381
|
ok: false,
|
|
381
382
|
output: "",
|
|
382
|
-
|
|
383
|
+
// A workspace tool asked for while only answering (no workspace changes
|
|
384
|
+
// in this step): say what to do instead of only that it is unknown.
|
|
385
|
+
error: buildToolError("tool_unknown", WORKSPACE_TOOLS.has(name)
|
|
386
|
+
? `${name} is not permitted while answering: nothing in the workspace can be changed in this step. Put the content in the answer itself (for example the complete file in a code block), or hand over with start_work when the workspace must change. Available here: ${[...this.tools.keys()].slice(0, 20).join(", ")}`
|
|
387
|
+
: `Unknown tool: ${name}. Available here: ${[...this.tools.keys()].slice(0, 20).join(", ")}`, {
|
|
383
388
|
retryable: false,
|
|
384
389
|
details: { tool: name },
|
|
385
390
|
}),
|
|
@@ -403,7 +408,19 @@ export class ToolRegistry {
|
|
|
403
408
|
context.signal?.throwIfAborted();
|
|
404
409
|
await context.beforeTool?.(toolDescriptorFor(tool), sanitized.value);
|
|
405
410
|
context.signal?.throwIfAborted();
|
|
406
|
-
|
|
411
|
+
// A read-only tool that ignores cancellation (a stuck search, a site that
|
|
412
|
+
// never answers) must not hold the turn after it was cancelled or ran out
|
|
413
|
+
// of time; nothing it does can change the workspace. A tool that writes
|
|
414
|
+
// is awaited, so its outcome is always known.
|
|
415
|
+
const running = tool.handler(sanitized.value, context);
|
|
416
|
+
const signal = context.signal;
|
|
417
|
+
const result = tool.readOnly && signal ? await new Promise((resolve, reject) => {
|
|
418
|
+
const onAbort = () => reject(signal.reason ?? new Error("Tool call cancelled"));
|
|
419
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
420
|
+
if (signal.aborted)
|
|
421
|
+
onAbort();
|
|
422
|
+
running.then(resolve, reject).finally(() => signal.removeEventListener("abort", onAbort));
|
|
423
|
+
}) : await running;
|
|
407
424
|
execution = { ok: true, output: result.output, data: result.data };
|
|
408
425
|
}
|
|
409
426
|
catch (error) {
|
|
@@ -413,8 +430,17 @@ export class ToolRegistry {
|
|
|
413
430
|
error: normalizeExecutionError(error),
|
|
414
431
|
};
|
|
415
432
|
}
|
|
416
|
-
// Persistence failures must stop the run, not silently acknowledge a side
|
|
417
|
-
|
|
433
|
+
// Persistence failures must stop the run, not silently acknowledge a side
|
|
434
|
+
// effect. A ToolExecutionError from the host's check of this call (a scope
|
|
435
|
+
// or workspace conflict) fails only this call; the model sees it.
|
|
436
|
+
try {
|
|
437
|
+
await context.afterTool?.(toolDescriptorFor(tool), sanitized.value, execution);
|
|
438
|
+
}
|
|
439
|
+
catch (error) {
|
|
440
|
+
if (!(error instanceof ToolExecutionError) || context.signal?.aborted)
|
|
441
|
+
throw error;
|
|
442
|
+
execution = { ok: false, output: "", error: normalizeExecutionError(error) };
|
|
443
|
+
}
|
|
418
444
|
context.signal?.throwIfAborted();
|
|
419
445
|
return execution;
|
|
420
446
|
}
|
|
@@ -4,7 +4,10 @@ export interface ToolContext {
|
|
|
4
4
|
beforeTool?: (tool: ToolDescriptor, args: unknown) => Promise<void>;
|
|
5
5
|
afterTool?: (tool: ToolDescriptor, args: unknown, result: ToolExecutionResult) => Promise<void>;
|
|
6
6
|
checkPath?: (resolvedPath: string, action: "read" | "write") => Promise<void>;
|
|
7
|
+
/** Time a shell command gets when it asks for none. */
|
|
7
8
|
shellTimeoutMs?: number;
|
|
9
|
+
/** The most a shell command may ask for; when unset, a set shellTimeoutMs is also the cap. */
|
|
10
|
+
shellMaxTimeoutMs?: number;
|
|
8
11
|
shellMaxOutputBytes?: number;
|
|
9
12
|
/** Process cwd inside workspaceRoot; does not change root-relative write scopes. */
|
|
10
13
|
shellWorkingDirectory?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolTypes.d.ts","sourceRoot":"","sources":["../../src/tools/ToolTypes.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,mBAAmB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChG,SAAS,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oFAAoF;IACpF,qBAA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,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;CACvD;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE9F;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAEpC,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,gFAAgF;IAChF,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,OAAO,EAAE,WAAW,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,cAAc,CAAC;CAC5B;AAED,eAAO,MAAM,uBAAuB,YAAY,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,KAAG,cAapD,CAAC"}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { type ToolDefinition } from "../ToolTypes.js";
|
|
2
2
|
export declare const browserUrl: (value: string) => string;
|
|
3
3
|
export declare function resolveBrowserBinary(): Promise<string>;
|
|
4
|
+
interface BrowserSnapshot {
|
|
5
|
+
id: string;
|
|
6
|
+
url: string;
|
|
7
|
+
title: string;
|
|
8
|
+
capturedAt: string;
|
|
9
|
+
content: string;
|
|
10
|
+
scope: "main" | "page";
|
|
11
|
+
format?: "rendered_text" | "accessibility" | "http_text" | "pdf_text";
|
|
12
|
+
notice?: string;
|
|
13
|
+
truncated: boolean;
|
|
14
|
+
httpStatus: number | null;
|
|
15
|
+
contentType: string | null;
|
|
16
|
+
}
|
|
4
17
|
export declare function findSnapshotText(content: string, query: string, offset?: number): {
|
|
5
18
|
index: number;
|
|
6
19
|
mode: "exact" | "ordered_terms" | "ranked_terms";
|
|
@@ -9,9 +22,18 @@ export declare function findSnapshotText(content: string, query: string, offset?
|
|
|
9
22
|
export declare function snapshotSectionContext(content: string, offset: number): string[];
|
|
10
23
|
/** A starting-position hint only: retain the full snapshot for offset reads. */
|
|
11
24
|
export declare function snapshotContentStart(content: string): number;
|
|
12
|
-
|
|
25
|
+
type Capture = Omit<BrowserSnapshot, "id" | "capturedAt">;
|
|
26
|
+
/** Read a URL without the browser: a PDF as extracted text, HTML as static text. */
|
|
27
|
+
export declare function captureDirect(url: string, scope: "main" | "page", signal?: AbortSignal, deps?: {
|
|
28
|
+
fetcher?: typeof fetch;
|
|
29
|
+
pythonRoot?: string;
|
|
30
|
+
}): Promise<Capture>;
|
|
13
31
|
export declare function createBrowserTools(options?: {
|
|
14
32
|
executablePath?: string;
|
|
15
33
|
timeoutMs?: number;
|
|
34
|
+
directTimeoutMs?: number;
|
|
35
|
+
fetcher?: typeof fetch;
|
|
36
|
+
pythonRoot?: string;
|
|
16
37
|
}): ToolDefinition[];
|
|
38
|
+
export {};
|
|
17
39
|
//# sourceMappingURL=BrowserTool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserTool.d.ts","sourceRoot":"","sources":["../../../src/tools/browser/BrowserTool.ts"],"names":[],"mappings":"AAKA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"BrowserTool.d.ts","sourceRoot":"","sources":["../../../src/tools/browser/BrowserTool.ts"],"names":[],"mappings":"AAKA,OAAO,EAAsB,KAAK,cAAc,EAAE,MA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