@stigmer/runner 3.1.1 → 3.1.3
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/.build-fingerprint +1 -1
- package/dist/activities/execute-cursor/attachment-resolver.d.ts +49 -8
- package/dist/activities/execute-cursor/attachment-resolver.js +83 -26
- package/dist/activities/execute-cursor/attachment-resolver.js.map +1 -1
- package/dist/activities/execute-cursor/capture-flow.d.ts +18 -0
- package/dist/activities/execute-cursor/capture-flow.js +21 -0
- package/dist/activities/execute-cursor/capture-flow.js.map +1 -1
- package/dist/activities/execute-cursor/cas-observations.d.ts +13 -0
- package/dist/activities/execute-cursor/cas-observations.js +39 -5
- package/dist/activities/execute-cursor/cas-observations.js.map +1 -1
- package/dist/activities/execute-cursor/hook-script.js +19 -1
- package/dist/activities/execute-cursor/hook-script.js.map +1 -1
- package/dist/activities/execute-cursor/index.d.ts +5 -0
- package/dist/activities/execute-cursor/index.js +222 -160
- package/dist/activities/execute-cursor/index.js.map +1 -1
- package/dist/activities/execute-cursor/message-translator.js +10 -1
- package/dist/activities/execute-cursor/message-translator.js.map +1 -1
- package/dist/activities/execute-cursor/prompt-builder.d.ts +32 -7
- package/dist/activities/execute-cursor/prompt-builder.js +38 -20
- package/dist/activities/execute-cursor/prompt-builder.js.map +1 -1
- package/dist/activities/execute-cursor/skill-resolver.d.ts +1 -10
- package/dist/activities/execute-cursor/skill-resolver.js +3 -55
- package/dist/activities/execute-cursor/skill-resolver.js.map +1 -1
- package/dist/activities/execute-cursor/stigmer-link.d.ts +35 -0
- package/dist/activities/execute-cursor/stigmer-link.js +73 -0
- package/dist/activities/execute-cursor/stigmer-link.js.map +1 -0
- package/dist/activities/execute-cursor/turn-boundary.d.ts +108 -0
- package/dist/activities/execute-cursor/turn-boundary.js +163 -0
- package/dist/activities/execute-cursor/turn-boundary.js.map +1 -0
- package/dist/activities/execute-cursor/workspace-provision.d.ts +3 -2
- package/dist/activities/execute-cursor/workspace-provision.js +5 -3
- package/dist/activities/execute-cursor/workspace-provision.js.map +1 -1
- package/dist/activities/execute-deep-agent/index.js +89 -5
- package/dist/activities/execute-deep-agent/index.js.map +1 -1
- package/dist/activities/execute-deep-agent/prompt-builder.d.ts +17 -0
- package/dist/activities/execute-deep-agent/prompt-builder.js +16 -0
- package/dist/activities/execute-deep-agent/prompt-builder.js.map +1 -1
- package/dist/activities/execute-deep-agent/setup.js +22 -16
- package/dist/activities/execute-deep-agent/setup.js.map +1 -1
- package/dist/activities/execute-deep-agent/streaming-v3.js +6 -1
- package/dist/activities/execute-deep-agent/streaming-v3.js.map +1 -1
- package/dist/activities/execute-deep-agent/streaming.d.ts +7 -0
- package/dist/activities/execute-deep-agent/streaming.js +5 -1
- package/dist/activities/execute-deep-agent/streaming.js.map +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/config.js +9 -0
- package/dist/config.js.map +1 -1
- package/dist/middleware/approval-gate.js +36 -6
- package/dist/middleware/approval-gate.js.map +1 -1
- package/dist/runner-manager.d.ts +2 -0
- package/dist/runner-manager.js +2 -1
- package/dist/runner-manager.js.map +1 -1
- package/dist/runner.d.ts +2 -0
- package/dist/runner.js +2 -1
- package/dist/runner.js.map +1 -1
- package/dist/shared/artifact-storage.d.ts +32 -0
- package/dist/shared/artifact-storage.js +74 -1
- package/dist/shared/artifact-storage.js.map +1 -1
- package/dist/shared/filereview/capture.d.ts +18 -1
- package/dist/shared/filereview/capture.js +105 -28
- package/dist/shared/filereview/capture.js.map +1 -1
- package/dist/shared/filereview/cas-substrate.d.ts +9 -0
- package/dist/shared/filereview/cas-substrate.js +9 -1
- package/dist/shared/filereview/cas-substrate.js.map +1 -1
- package/dist/shared/filereview/events.d.ts +16 -0
- package/dist/shared/filereview/events.js +37 -0
- package/dist/shared/filereview/events.js.map +1 -1
- package/dist/shared/filereview/git-substrate.d.ts +42 -0
- package/dist/shared/filereview/git-substrate.js +78 -0
- package/dist/shared/filereview/git-substrate.js.map +1 -1
- package/dist/shared/filereview/index.d.ts +3 -1
- package/dist/shared/filereview/index.js +3 -1
- package/dist/shared/filereview/index.js.map +1 -1
- package/dist/shared/filereview/line-counts.d.ts +48 -0
- package/dist/shared/filereview/line-counts.js +72 -0
- package/dist/shared/filereview/line-counts.js.map +1 -0
- package/dist/shared/filereview/progress.d.ts +96 -0
- package/dist/shared/filereview/progress.js +134 -0
- package/dist/shared/filereview/progress.js.map +1 -0
- package/dist/shared/implement-plan-prompt.d.ts +44 -0
- package/dist/shared/implement-plan-prompt.js +98 -0
- package/dist/shared/implement-plan-prompt.js.map +1 -0
- package/dist/shared/plan-artifact.d.ts +59 -11
- package/dist/shared/plan-artifact.js +144 -16
- package/dist/shared/plan-artifact.js.map +1 -1
- package/dist/shared/plan-mode-prompt.d.ts +32 -0
- package/dist/shared/plan-mode-prompt.js +56 -0
- package/dist/shared/plan-mode-prompt.js.map +1 -0
- package/dist/shared/status.d.ts +11 -0
- package/dist/shared/status.js +12 -2
- package/dist/shared/status.js.map +1 -1
- package/dist/shared/tool-row.d.ts +30 -1
- package/dist/shared/tool-row.js +53 -4
- package/dist/shared/tool-row.js.map +1 -1
- package/dist/shared/workspace/session-root.d.ts +35 -0
- package/dist/shared/workspace/session-root.js +53 -0
- package/dist/shared/workspace/session-root.js.map +1 -0
- package/dist/shared/workspace/workspace-lock.d.ts +86 -0
- package/dist/shared/workspace/workspace-lock.js +187 -0
- package/dist/shared/workspace/workspace-lock.js.map +1 -0
- package/package.json +8 -5
- package/src/__tests__/config.test.ts +8 -0
- package/src/activities/__tests__/classify-tool-approvals.test.ts +1 -0
- package/src/activities/__tests__/discover-mcp-server.test.ts +1 -0
- package/src/activities/execute-cursor/__tests__/attachment-resolver.test.ts +161 -0
- package/src/activities/execute-cursor/__tests__/build-prompt.test.ts +132 -2
- package/src/activities/execute-cursor/__tests__/cas-observations.test.ts +55 -0
- package/src/activities/execute-cursor/__tests__/delta-enricher.test.ts +68 -0
- package/src/activities/execute-cursor/__tests__/hitl-ledger.test.ts +28 -0
- package/src/activities/execute-cursor/__tests__/hook-script.test.ts +63 -4
- package/src/activities/execute-cursor/__tests__/turn-boundary.test.ts +280 -0
- package/src/activities/execute-cursor/__tests__/workspace-provision.test.ts +36 -2
- package/src/activities/execute-cursor/attachment-resolver.ts +116 -34
- package/src/activities/execute-cursor/capture-flow.ts +32 -0
- package/src/activities/execute-cursor/cas-observations.ts +41 -5
- package/src/activities/execute-cursor/hook-script.ts +19 -1
- package/src/activities/execute-cursor/index.ts +243 -178
- package/src/activities/execute-cursor/message-translator.ts +9 -1
- package/src/activities/execute-cursor/prompt-builder.ts +60 -22
- package/src/activities/execute-cursor/skill-resolver.ts +3 -59
- package/src/activities/execute-cursor/stigmer-link.ts +78 -0
- package/src/activities/execute-cursor/turn-boundary.ts +274 -0
- package/src/activities/execute-cursor/workspace-provision.ts +5 -3
- package/src/activities/execute-deep-agent/__tests__/hitl-resume-approve-all.test.ts +7 -2
- package/src/activities/execute-deep-agent/__tests__/hitl-resume-history.test.ts +7 -2
- package/src/activities/execute-deep-agent/__tests__/index.test.ts +4 -1
- package/src/activities/execute-deep-agent/__tests__/prompt-builder.test.ts +99 -0
- package/src/activities/execute-deep-agent/__tests__/sequential-gate-resume.test.ts +7 -2
- package/src/activities/execute-deep-agent/index.ts +104 -5
- package/src/activities/execute-deep-agent/prompt-builder.ts +39 -0
- package/src/activities/execute-deep-agent/setup.ts +25 -17
- package/src/activities/execute-deep-agent/streaming-v3.ts +6 -1
- package/src/activities/execute-deep-agent/streaming.ts +12 -1
- package/src/config.ts +17 -0
- package/src/middleware/__tests__/approval-gate.test.ts +77 -12
- package/src/middleware/approval-gate.ts +39 -7
- package/src/runner-manager.ts +6 -1
- package/src/runner.ts +6 -1
- package/src/shared/__tests__/artifact-storage.test.ts +111 -1
- package/src/shared/__tests__/implement-plan-prompt.test.ts +86 -0
- package/src/shared/__tests__/plan-artifact.test.ts +142 -9
- package/src/shared/__tests__/secret-leak-scan.test.ts +105 -0
- package/src/shared/__tests__/status.test.ts +7 -2
- package/src/shared/__tests__/tool-row.test.ts +136 -1
- package/src/shared/artifact-storage.ts +83 -1
- package/src/shared/filereview/__tests__/capture.test.ts +182 -1
- package/src/shared/filereview/__tests__/cas-substrate.test.ts +34 -0
- package/src/shared/filereview/__tests__/events.test.ts +105 -0
- package/src/shared/filereview/__tests__/line-counts.test.ts +73 -0
- package/src/shared/filereview/__tests__/progress.test.ts +236 -0
- package/src/shared/filereview/capture.ts +134 -30
- package/src/shared/filereview/cas-substrate.ts +17 -1
- package/src/shared/filereview/events.ts +50 -0
- package/src/shared/filereview/git-substrate.ts +108 -0
- package/src/shared/filereview/index.ts +22 -1
- package/src/shared/filereview/line-counts.ts +83 -0
- package/src/shared/filereview/progress.ts +186 -0
- package/src/shared/implement-plan-prompt.ts +104 -0
- package/src/shared/plan-artifact.ts +152 -16
- package/src/shared/plan-mode-prompt.ts +56 -0
- package/src/shared/status.ts +11 -1
- package/src/shared/tool-row.ts +58 -5
- package/src/shared/workspace/__tests__/session-root.test.ts +42 -0
- package/src/shared/workspace/__tests__/workspace-lock.test.ts +200 -0
- package/src/shared/workspace/session-root.ts +60 -0
- package/src/shared/workspace/workspace-lock.ts +241 -0
package/dist/.build-fingerprint
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"hash":"
|
|
1
|
+
{"hash":"21af7d0537f439ed","builtAt":"2026-07-05T14:32:49.617Z","fileCount":237}
|
|
@@ -1,19 +1,60 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Resolves execution attachments into the platform-managed directory.
|
|
3
3
|
*
|
|
4
|
-
* Attachments are files provided as inputs to the agent execution.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Attachments are files provided as inputs to the agent execution. Each is
|
|
5
|
+
* materialized under the session platform dir's `inputs/` subdirectory and
|
|
6
|
+
* surfaced to the agent as `.stigmer/inputs/{filename}` through the workspace
|
|
7
|
+
* `.stigmer` symlink (see stigmer-link.ts), which this resolver guarantees —
|
|
8
|
+
* an agent with attachments but no skills still gets the link.
|
|
9
|
+
*
|
|
10
|
+
* Content sources, in order:
|
|
11
|
+
* - `localPath` (local mode only): read straight off the caller's disk — the
|
|
12
|
+
* CLI fast path, no storage round-trip.
|
|
13
|
+
* - `storageKey`: downloaded via {@link ArtifactStorage} — the universal path;
|
|
14
|
+
* the backend's create pipeline requires a storage key on every attachment
|
|
15
|
+
* it accepts, and in local mode the storage reads directly off disk.
|
|
16
|
+
*
|
|
17
|
+
* Placement is always `inputs/{filename}` — the platform namespace this
|
|
18
|
+
* harness can surface in the workspace. An attachment's `mountPath` is
|
|
19
|
+
* honored by convention, not mechanism: the standard mounts (e.g. the
|
|
20
|
+
* approved plan at `.stigmer/inputs/<slug>_<id>.plan.md`) resolve to exactly this
|
|
21
|
+
* placement, and the prompt's `<input_files>` section plus any path-derived
|
|
22
|
+
* directives are built from the RESOLVED paths, so prompt and filesystem can
|
|
23
|
+
* never disagree.
|
|
24
|
+
*
|
|
25
|
+
* Error model: fail-hard, matching the native harness's attachment injector.
|
|
26
|
+
* Attachments are explicit user inputs — an execution that silently runs
|
|
27
|
+
* without one produces silently incorrect results (the "plan file wasn't
|
|
28
|
+
* found" class of failure). Any attachment that cannot be materialized aborts
|
|
29
|
+
* the execution with an actionable error.
|
|
7
30
|
*/
|
|
8
31
|
import type { Attachment } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/spec_pb";
|
|
32
|
+
import type { ArtifactStorage } from "../../shared/artifact-storage.js";
|
|
9
33
|
export interface ResolvedAttachment {
|
|
10
34
|
filename: string;
|
|
35
|
+
/** Workspace-relative path the agent reads (`.stigmer/inputs/{filename}`). */
|
|
11
36
|
relativePath: string;
|
|
12
37
|
}
|
|
38
|
+
export interface AttachmentResolverOptions {
|
|
39
|
+
sessionId: string;
|
|
40
|
+
primaryWorkspaceDir: string;
|
|
41
|
+
mode: "local" | "cloud";
|
|
42
|
+
/**
|
|
43
|
+
* Artifact storage for `storageKey` downloads. `undefined` when the runner
|
|
44
|
+
* could not build a store (proxy misconfig) — a storage-backed attachment
|
|
45
|
+
* then fails with an actionable error rather than a silent skip.
|
|
46
|
+
*/
|
|
47
|
+
storage: ArtifactStorage | undefined;
|
|
48
|
+
}
|
|
49
|
+
export declare class AttachmentResolutionError extends Error {
|
|
50
|
+
readonly attachmentFilename: string;
|
|
51
|
+
readonly reason: string;
|
|
52
|
+
constructor(attachmentFilename: string, reason: string);
|
|
53
|
+
}
|
|
13
54
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
55
|
+
* Materialize all attachments under `.stigmer/inputs/` and return their
|
|
56
|
+
* workspace-relative paths for prompt injection. Throws
|
|
57
|
+
* {@link AttachmentResolutionError} on the first attachment that cannot be
|
|
58
|
+
* materialized (fail-hard — see module doc).
|
|
18
59
|
*/
|
|
19
|
-
export declare function resolveAttachments(attachments: Attachment[],
|
|
60
|
+
export declare function resolveAttachments(attachments: Attachment[], options: AttachmentResolverOptions): Promise<ResolvedAttachment[]>;
|
|
@@ -1,52 +1,109 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Resolves execution attachments into the platform-managed directory.
|
|
3
3
|
*
|
|
4
|
-
* Attachments are files provided as inputs to the agent execution.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Attachments are files provided as inputs to the agent execution. Each is
|
|
5
|
+
* materialized under the session platform dir's `inputs/` subdirectory and
|
|
6
|
+
* surfaced to the agent as `.stigmer/inputs/{filename}` through the workspace
|
|
7
|
+
* `.stigmer` symlink (see stigmer-link.ts), which this resolver guarantees —
|
|
8
|
+
* an agent with attachments but no skills still gets the link.
|
|
9
|
+
*
|
|
10
|
+
* Content sources, in order:
|
|
11
|
+
* - `localPath` (local mode only): read straight off the caller's disk — the
|
|
12
|
+
* CLI fast path, no storage round-trip.
|
|
13
|
+
* - `storageKey`: downloaded via {@link ArtifactStorage} — the universal path;
|
|
14
|
+
* the backend's create pipeline requires a storage key on every attachment
|
|
15
|
+
* it accepts, and in local mode the storage reads directly off disk.
|
|
16
|
+
*
|
|
17
|
+
* Placement is always `inputs/{filename}` — the platform namespace this
|
|
18
|
+
* harness can surface in the workspace. An attachment's `mountPath` is
|
|
19
|
+
* honored by convention, not mechanism: the standard mounts (e.g. the
|
|
20
|
+
* approved plan at `.stigmer/inputs/<slug>_<id>.plan.md`) resolve to exactly this
|
|
21
|
+
* placement, and the prompt's `<input_files>` section plus any path-derived
|
|
22
|
+
* directives are built from the RESOLVED paths, so prompt and filesystem can
|
|
23
|
+
* never disagree.
|
|
24
|
+
*
|
|
25
|
+
* Error model: fail-hard, matching the native harness's attachment injector.
|
|
26
|
+
* Attachments are explicit user inputs — an execution that silently runs
|
|
27
|
+
* without one produces silently incorrect results (the "plan file wasn't
|
|
28
|
+
* found" class of failure). Any attachment that cannot be materialized aborts
|
|
29
|
+
* the execution with an actionable error.
|
|
7
30
|
*/
|
|
8
|
-
import { mkdir, copyFile } from "node:fs/promises";
|
|
31
|
+
import { mkdir, copyFile, writeFile } from "node:fs/promises";
|
|
9
32
|
import { join, basename } from "node:path";
|
|
10
33
|
import { getPlatformDir } from "../../shared/workspace/platform-dir.js";
|
|
11
|
-
|
|
34
|
+
import { ensureStigmerSymlink, STIGMER_LOCAL_STATE_DIR } from "./stigmer-link.js";
|
|
12
35
|
const INPUTS_SUBDIR = "inputs";
|
|
36
|
+
export class AttachmentResolutionError extends Error {
|
|
37
|
+
attachmentFilename;
|
|
38
|
+
reason;
|
|
39
|
+
constructor(attachmentFilename, reason) {
|
|
40
|
+
super(`Attachment '${attachmentFilename}': ${reason}`);
|
|
41
|
+
this.name = "AttachmentResolutionError";
|
|
42
|
+
this.attachmentFilename = attachmentFilename;
|
|
43
|
+
this.reason = reason;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
13
46
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
47
|
+
* Materialize all attachments under `.stigmer/inputs/` and return their
|
|
48
|
+
* workspace-relative paths for prompt injection. Throws
|
|
49
|
+
* {@link AttachmentResolutionError} on the first attachment that cannot be
|
|
50
|
+
* materialized (fail-hard — see module doc).
|
|
18
51
|
*/
|
|
19
|
-
export async function resolveAttachments(attachments,
|
|
52
|
+
export async function resolveAttachments(attachments, options) {
|
|
20
53
|
if (attachments.length === 0)
|
|
21
54
|
return [];
|
|
22
|
-
const platformDir = getPlatformDir(sessionId);
|
|
55
|
+
const platformDir = getPlatformDir(options.sessionId);
|
|
23
56
|
const inputsDir = join(platformDir, INPUTS_SUBDIR);
|
|
24
57
|
await mkdir(inputsDir, { recursive: true });
|
|
58
|
+
// The symlink is what makes `inputs/` visible in the workspace; without it
|
|
59
|
+
// every resolved path below would dangle (the skill resolver also ensures
|
|
60
|
+
// it, but only when the agent has skills).
|
|
61
|
+
await ensureStigmerSymlink(options.primaryWorkspaceDir, platformDir);
|
|
25
62
|
const results = [];
|
|
26
63
|
for (const attachment of attachments) {
|
|
27
|
-
|
|
28
|
-
const resolved = await resolveAttachment(attachment, inputsDir, mode);
|
|
29
|
-
if (resolved)
|
|
30
|
-
results.push(resolved);
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
console.warn(`Failed to resolve attachment ${attachment.filename}: ${err instanceof Error ? err.message : err}`);
|
|
34
|
-
}
|
|
64
|
+
results.push(await resolveAttachment(attachment, inputsDir, options));
|
|
35
65
|
}
|
|
66
|
+
console.log(`[attachment-resolver] resolved ${results.length} attachment(s): ` +
|
|
67
|
+
results.map((r) => r.relativePath).join(", "));
|
|
36
68
|
return results;
|
|
37
69
|
}
|
|
38
|
-
async function resolveAttachment(attachment, inputsDir,
|
|
39
|
-
|
|
70
|
+
async function resolveAttachment(attachment, inputsDir, options) {
|
|
71
|
+
// Local-mode fast path: the file is already on this machine's disk.
|
|
72
|
+
if (options.mode === "local" && attachment.localPath) {
|
|
40
73
|
const filename = attachment.filename || basename(attachment.localPath);
|
|
41
|
-
|
|
42
|
-
|
|
74
|
+
try {
|
|
75
|
+
await copyFile(attachment.localPath, join(inputsDir, filename));
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
throw new AttachmentResolutionError(attachment.filename, `failed to copy local file '${attachment.localPath}': ` +
|
|
79
|
+
`${err instanceof Error ? err.message : String(err)}`);
|
|
80
|
+
}
|
|
43
81
|
return {
|
|
44
82
|
filename,
|
|
45
83
|
relativePath: join(STIGMER_LOCAL_STATE_DIR, INPUTS_SUBDIR, filename),
|
|
46
84
|
};
|
|
47
85
|
}
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
86
|
+
// Universal path: download the uploaded content by storage key.
|
|
87
|
+
if (!attachment.storageKey) {
|
|
88
|
+
throw new AttachmentResolutionError(attachment.filename, "missing storageKey — cannot download attachment from storage");
|
|
89
|
+
}
|
|
90
|
+
if (!options.storage) {
|
|
91
|
+
throw new AttachmentResolutionError(attachment.filename, `artifact storage is unavailable, so this attachment ` +
|
|
92
|
+
`(key: ${attachment.storageKey}) cannot be downloaded`);
|
|
93
|
+
}
|
|
94
|
+
const filename = attachment.filename || basename(attachment.storageKey);
|
|
95
|
+
let content;
|
|
96
|
+
try {
|
|
97
|
+
content = await options.storage.download(attachment.storageKey);
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
throw new AttachmentResolutionError(attachment.filename, `failed to download from storage (key: ${attachment.storageKey}): ` +
|
|
101
|
+
`${err instanceof Error ? err.message : String(err)}`);
|
|
102
|
+
}
|
|
103
|
+
await writeFile(join(inputsDir, filename), content);
|
|
104
|
+
return {
|
|
105
|
+
filename,
|
|
106
|
+
relativePath: join(STIGMER_LOCAL_STATE_DIR, INPUTS_SUBDIR, filename),
|
|
107
|
+
};
|
|
51
108
|
}
|
|
52
109
|
//# sourceMappingURL=attachment-resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-resolver.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/attachment-resolver.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"attachment-resolver.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/attachment-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAElF,MAAM,aAAa,GAAG,QAAQ,CAAC;AAoB/B,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IACzC,kBAAkB,CAAS;IAC3B,MAAM,CAAS;IAExB,YAAY,kBAA0B,EAAE,MAAc;QACpD,KAAK,CAAC,eAAe,kBAAkB,MAAM,MAAM,EAAE,CAAC,CAAC;QACvD,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;QACxC,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,WAAyB,EACzB,OAAkC;IAElC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAExC,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IACnD,MAAM,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE5C,2EAA2E;IAC3E,0EAA0E;IAC1E,2CAA2C;IAC3C,MAAM,oBAAoB,CAAC,OAAO,CAAC,mB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CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;QAC3B,MAAM,IAAI,yBAAyB,CACjC,UAAU,CAAC,QAAQ,EACnB,8DAA8D,CAC/D,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrB,MAAM,IAAI,yBAAyB,CACjC,UAAU,CAAC,QAAQ,EACnB,sDAAsD;YACtD,SAAS,UAAU,CAAC,UAAU,wBAAwB,CACvD,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,IAAI,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACxE,IAAI,OAAe,CAAC;IACpB,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAClE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,yBAAyB,CACjC,UAAU,CAAC,QAAQ,EACnB,yCAAyC,UAAU,CAAC,UAAU,KAAK;YACnE,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CACtD,CAAC;IACJ,CAAC;IACD,MAAM,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;IAEpD,OAAO;QACL,QAAQ;QACR,YAAY,EAAE,IAAI,CAAC,uBAAuB,EAAE,aAAa,EAAE,QAAQ,CAAC;KACrE,CAAC;AACJ,CAAC"}
|
|
@@ -21,6 +21,7 @@ import type { AgentMessage } from "@stigmer/protos/ai/stigmer/agentic/agentexecu
|
|
|
21
21
|
import type { AgentExecutionStatus } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
|
|
22
22
|
import type { FileChangeSet, TurnCommandProvenance } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/filereview_pb";
|
|
23
23
|
import { type CaptureResumeResult } from "../../shared/filereview/capture.js";
|
|
24
|
+
import { type ProgressCaptureState } from "../../shared/filereview/progress.js";
|
|
24
25
|
import type { GitSubstrateChange as GitCapturedChange } from "../../shared/filereview/git-substrate.js";
|
|
25
26
|
import type { ArtifactStorage } from "../../shared/artifact-storage.js";
|
|
26
27
|
export type { CaptureResumeResult };
|
|
@@ -100,6 +101,23 @@ export declare function captureTurnToLedger(opts: {
|
|
|
100
101
|
*/
|
|
101
102
|
readonly commandProvenance?: TurnCommandProvenance;
|
|
102
103
|
}): Promise<readonly GitCapturedChange[]>;
|
|
104
|
+
/**
|
|
105
|
+
* Mid-run: attach the live "N files changed so far" snapshot onto
|
|
106
|
+
* `status.file_change_progress` (DD-32), throttled by the floor + tree-sha
|
|
107
|
+
* short-circuit inside {@link captureFileChangeProgress}. The Cursor adapter binds
|
|
108
|
+
* `CURSOR_RUNNER_OWNED_PATHS` so the progress diff excludes the gate's own files —
|
|
109
|
+
* the SAME exclusion {@link captureTurnToLedger} uses for the turn-boundary
|
|
110
|
+
* candidate, so the live count and the reviewed set agree. Content-free and
|
|
111
|
+
* secret-safe; a no-op when nothing changed since the last capture.
|
|
112
|
+
*/
|
|
113
|
+
export declare function captureProgressToStatus(opts: {
|
|
114
|
+
readonly status: AgentExecutionStatus;
|
|
115
|
+
readonly gitRoot: string;
|
|
116
|
+
readonly executionId: string;
|
|
117
|
+
readonly changeSetId: string;
|
|
118
|
+
readonly baselineTree: string;
|
|
119
|
+
readonly state: ProgressCaptureState;
|
|
120
|
+
}): Promise<void>;
|
|
103
121
|
/**
|
|
104
122
|
* Resume: reconcile the working tree to the change set's DECIDED decisions
|
|
105
123
|
* (keep approved "after" bytes, snap rejected/undecided back to baseline,
|
|
@@ -26,6 +26,7 @@ import { readCasObservations } from "./cas-observations.js";
|
|
|
26
26
|
import { contentDigest } from "../../shared/file-tools.js";
|
|
27
27
|
import { isToolCallRowHidden, stampFileEditRow } from "../../shared/tool-row.js";
|
|
28
28
|
import { applyCaptureDecisions as sharedApplyCaptureDecisions, captureBaselineToLedger as sharedCaptureBaselineToLedger, captureCandidateToLedger as sharedCaptureCandidateToLedger, } from "../../shared/filereview/capture.js";
|
|
29
|
+
import { captureFileChangeProgress, } from "../../shared/filereview/progress.js";
|
|
29
30
|
import { hasCandidateCaptured } from "../../shared/filereview/events.js";
|
|
30
31
|
import { partitionIgnoredPathsBySecret } from "../../shared/filereview/secret-paths.js";
|
|
31
32
|
import { casBlobReader } from "../../shared/filereview/cas-substrate.js";
|
|
@@ -131,6 +132,26 @@ export async function captureTurnToLedger(opts) {
|
|
|
131
132
|
}
|
|
132
133
|
return changes;
|
|
133
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Mid-run: attach the live "N files changed so far" snapshot onto
|
|
137
|
+
* `status.file_change_progress` (DD-32), throttled by the floor + tree-sha
|
|
138
|
+
* short-circuit inside {@link captureFileChangeProgress}. The Cursor adapter binds
|
|
139
|
+
* `CURSOR_RUNNER_OWNED_PATHS` so the progress diff excludes the gate's own files —
|
|
140
|
+
* the SAME exclusion {@link captureTurnToLedger} uses for the turn-boundary
|
|
141
|
+
* candidate, so the live count and the reviewed set agree. Content-free and
|
|
142
|
+
* secret-safe; a no-op when nothing changed since the last capture.
|
|
143
|
+
*/
|
|
144
|
+
export async function captureProgressToStatus(opts) {
|
|
145
|
+
await captureFileChangeProgress({
|
|
146
|
+
status: opts.status,
|
|
147
|
+
gitRoot: opts.gitRoot,
|
|
148
|
+
executionId: opts.executionId,
|
|
149
|
+
changeSetId: opts.changeSetId,
|
|
150
|
+
baselineTree: opts.baselineTree,
|
|
151
|
+
excludePaths: CURSOR_RUNNER_OWNED_PATHS,
|
|
152
|
+
state: opts.state,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
134
155
|
/**
|
|
135
156
|
* Compose this turn's CAS captures from the sidecar the hook staged, mirroring
|
|
136
157
|
* deep-agent's `buildCasTurnCaptures`: for each non-secret observed path, the
|
|
@@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|
*/
|
|
74
74
|
export declare function readCasObservations(hitlDir: string): Promise<CasObservations>;
|
|
75
|
+
/**
|
|
76
|
+
* Build a standalone Node.js script that CLASSIFIES a single path as secret-like
|
|
77
|
+
* without staging anything — the deny-gate (no-capture-substrate) counterpart of
|
|
78
|
+
* {@link buildObservationStagingScript}.
|
|
79
|
+
*
|
|
80
|
+
* Invoked as `printf %s "$SALIENT" | node -e '<this>'` — the path rides stdin (no
|
|
81
|
+
* argv escaping). Prints `secret` for a secret-like path, `ok` otherwise. Empty
|
|
82
|
+
* input classifies as `secret` (fail-closed, matching {@link isSecretLikePath}).
|
|
83
|
+
* The Cursor hook uses this to hard-block a secret write on the deny-gate so its
|
|
84
|
+
* content never reaches an approval (DD-26 follow-up #2); it shares the classifier
|
|
85
|
+
* fragment above, so its verdict equals the runner's {@link isSecretLikePath}.
|
|
86
|
+
*/
|
|
87
|
+
export declare function buildSecretClassifyScript(): string;
|
|
75
88
|
/**
|
|
76
89
|
* Build the standalone Node.js script the hook runs to observe a single
|
|
77
90
|
* gitignored write — the disk-backed mirror of `CasCaptureFilesystemBackend`'s
|
|
@@ -122,6 +122,44 @@ export async function readCasObservations(hitlDir) {
|
|
|
122
122
|
function regexLiteral(re) {
|
|
123
123
|
return `new RegExp(${JSON.stringify(re.source)},${JSON.stringify(re.flags)})`;
|
|
124
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* The JS lines that define `isSecret(p)` inside a hook-embedded script — a
|
|
127
|
+
* byte-identical mirror of {@link isSecretLikePath} generated from the SAME
|
|
128
|
+
* {@link SECRET_BASENAME_PATTERNS}/{@link SECRET_PATH_PATTERNS} arrays.
|
|
129
|
+
*
|
|
130
|
+
* ONE definition, so every hook-side classifier (the capture-mode staging script
|
|
131
|
+
* and the deny-gate classify-only script) agrees with the runner-side classifier
|
|
132
|
+
* by construction — the "no bash-regex, no divergence" invariant this module owns.
|
|
133
|
+
* Authored as single-quoted-bash strings, so the JS must contain no single quotes.
|
|
134
|
+
*/
|
|
135
|
+
function secretClassifierFragment() {
|
|
136
|
+
const base = SECRET_BASENAME_PATTERNS.map(regexLiteral).join(",");
|
|
137
|
+
const pathPatterns = SECRET_PATH_PATTERNS.map(regexLiteral).join(",");
|
|
138
|
+
return [
|
|
139
|
+
`const baseName=(p)=>{const n=p.replace(/\\\\/g,"/");const i=n.lastIndexOf("/");return i>=0?n.slice(i+1):n;};`,
|
|
140
|
+
`const BASE=[${base}];const PATHP=[${pathPatterns}];`,
|
|
141
|
+
`const isSecret=(p)=>{if(!p)return true;const nm=p.replace(/\\\\/g,"/");const b=baseName(nm).toLowerCase();for(const r of BASE){if(r.test(b))return true;}const lp=nm.toLowerCase();for(const r of PATHP){if(r.test(lp))return true;}return false;};`,
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Build a standalone Node.js script that CLASSIFIES a single path as secret-like
|
|
146
|
+
* without staging anything — the deny-gate (no-capture-substrate) counterpart of
|
|
147
|
+
* {@link buildObservationStagingScript}.
|
|
148
|
+
*
|
|
149
|
+
* Invoked as `printf %s "$SALIENT" | node -e '<this>'` — the path rides stdin (no
|
|
150
|
+
* argv escaping). Prints `secret` for a secret-like path, `ok` otherwise. Empty
|
|
151
|
+
* input classifies as `secret` (fail-closed, matching {@link isSecretLikePath}).
|
|
152
|
+
* The Cursor hook uses this to hard-block a secret write on the deny-gate so its
|
|
153
|
+
* content never reaches an approval (DD-26 follow-up #2); it shares the classifier
|
|
154
|
+
* fragment above, so its verdict equals the runner's {@link isSecretLikePath}.
|
|
155
|
+
*/
|
|
156
|
+
export function buildSecretClassifyScript() {
|
|
157
|
+
return [
|
|
158
|
+
`let salient="";try{salient=require("fs").readFileSync(0,"utf8");}catch(e){salient="";}`,
|
|
159
|
+
...secretClassifierFragment(),
|
|
160
|
+
`process.stdout.write(isSecret(salient)?"secret":"ok");`,
|
|
161
|
+
].join("");
|
|
162
|
+
}
|
|
125
163
|
/**
|
|
126
164
|
* Build the standalone Node.js script the hook runs to observe a single
|
|
127
165
|
* gitignored write — the disk-backed mirror of `CasCaptureFilesystemBackend`'s
|
|
@@ -144,8 +182,6 @@ function regexLiteral(re) {
|
|
|
144
182
|
* single-quoted-bash string, so the JS must contain no single quotes.
|
|
145
183
|
*/
|
|
146
184
|
export function buildObservationStagingScript() {
|
|
147
|
-
const base = SECRET_BASENAME_PATTERNS.map(regexLiteral).join(",");
|
|
148
|
-
const pathPatterns = SECRET_PATH_PATTERNS.map(regexLiteral).join(",");
|
|
149
185
|
const metaSuffix = JSON.stringify(META_SUFFIX);
|
|
150
186
|
const blobSuffix = JSON.stringify(BLOB_SUFFIX);
|
|
151
187
|
return [
|
|
@@ -161,9 +197,7 @@ export function buildObservationStagingScript() {
|
|
|
161
197
|
`let rel=path.relative(wsRoot,abs).split(path.sep).join("/");`,
|
|
162
198
|
`if(!rel||rel===".."||rel.startsWith("../")){process.stdout.write("error");process.exit(0);}`,
|
|
163
199
|
// --- secret classifier: byte-identical mirror of isSecretLikePath ---
|
|
164
|
-
|
|
165
|
-
`const BASE=[${base}];const PATHP=[${pathPatterns}];`,
|
|
166
|
-
`const isSecret=(p)=>{if(!p)return true;const nm=p.replace(/\\\\/g,"/");const b=baseName(nm).toLowerCase();for(const r of BASE){if(r.test(b))return true;}const lp=nm.toLowerCase();for(const r of PATHP){if(r.test(lp))return true;}return false;};`,
|
|
200
|
+
...secretClassifierFragment(),
|
|
167
201
|
`const key=crypto.createHash("sha256").update(rel,"utf8").digest("hex");`,
|
|
168
202
|
`const metaPath=path.join(obsDir,key+${metaSuffix});const blobPath=path.join(obsDir,key+${blobSuffix});`,
|
|
169
203
|
`try{fs.mkdirSync(obsDir,{recursive:true});}catch(e){}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cas-observations.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/cas-observations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH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AAW,EAAE,CAAC;AACnC,CAAC;AAED;;;;GAIG;AACH,SAAS,YAAY,CAAC,EAAU;IAC9B,OAAO,cAAc,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC;AAChF,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"cas-observations.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/cas-observations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAEzG,yDAAyD;AACzD,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAE3D,iFAAiF;AACjF,MAAM,WAAW,GAAG,YAAY,CAAC;AACjC,8EAA8E;AAC9E,MAAM,WAAW,GAAG,OAAO,CAAC;AAE5B,kEAAkE;AAClE,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,OAAO,IAAI,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC;AACjD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAe;IACxD,MAAM,GAAG,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACtC,OAAO,GAAG,CAAC;AACb,CAAC;AAkBD;;;;;;GAMG;AAC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C;IAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/C,OAAO;QACL,mFAAmF;QACnF,oEAAoE;QACpE,6EAA6E;QAC7E,uEAAuE;QACvE,2EAA2E;QAC3E,4EAA4E;QAC5E,8EAA8E;QAC9E,iEAAiE;QACjE,yCAAyC;QACzC,8DAA8D;QAC9D,6FAA6F;QAC7F,uEAAuE;QACvE,GAAG,wBAAwB,EAAE;QAC7B,yEAAyE;QACzE,uCAAuC,UAAU,yCAAyC,UAAU,IAAI;QACxG,uDAAuD;QACvD,6EAA6E;QAC7E,mKAAmK;QACnK,0EAA0E;QAC1E,mEAAmE;QACnE,gFAAgF;QAChF,8EAA8E;QAC9E,gEAAgE;QAChE,0GAA0G;QAC1G,yEAAyE;QACzE,wEAAwE;QACxE,2RAA2R;QAC3R,mCAAmC;KACpC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACb,CAAC"}
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
*/
|
|
88
88
|
import { SALIENT_ARG_FIELDS, getBuiltInGatedCategories } from "./approval-policy.js";
|
|
89
89
|
import { EDIT_OLD_FIELDS, EDIT_NEW_FIELDS, WRITE_CONTENT_FIELDS, } from "../../shared/file-tools.js";
|
|
90
|
-
import { buildObservationStagingScript, CAS_OBSERVATIONS_DIRNAME } from "./cas-observations.js";
|
|
90
|
+
import { buildObservationStagingScript, buildSecretClassifyScript, CAS_OBSERVATIONS_DIRNAME } from "./cas-observations.js";
|
|
91
91
|
// Shown to the model when the gate denies a tool call. It must NOT teach the
|
|
92
92
|
// model to ask for permission in prose or to "stop and wait" — that framing
|
|
93
93
|
// makes the model narrate approval requests instead of invoking tools (the
|
|
@@ -262,6 +262,7 @@ export function generateHookScript(activePointerPath, workspaceRoot = "") {
|
|
|
262
262
|
const categoryCaseArms = buildCategoryCaseArms();
|
|
263
263
|
const nodeIdentityScript = buildNodeIdentityScript();
|
|
264
264
|
const observationStagingScript = buildObservationStagingScript();
|
|
265
|
+
const secretClassifyScript = buildSecretClassifyScript();
|
|
265
266
|
const nodeBin = process.execPath;
|
|
266
267
|
return `#!/bin/bash
|
|
267
268
|
# Stigmer HITL approval hook for Cursor (preToolUse + beforeMCPExecution).
|
|
@@ -556,6 +557,23 @@ if [ -n "$CATEGORY" ]; then
|
|
|
556
557
|
exit 0
|
|
557
558
|
fi
|
|
558
559
|
fi
|
|
560
|
+
# Deny-gate secret hard-block (DD-26 #2): a secret-like WRITE that reaches the
|
|
561
|
+
# deny-gate (no capture substrate for it — capture off, or captureIgnored off in
|
|
562
|
+
# a git-no-storage workspace) must not surface its content for approval. Classify
|
|
563
|
+
# byte-identically to isSecretLikePath (no staging) and, on a match, hard-block
|
|
564
|
+
# with the security message: the agent continues, nothing is written, and NO
|
|
565
|
+
# content is recorded to the ledger. Placed before the grant/lease checks so a
|
|
566
|
+
# write-category lease can never bypass it; only writes are content-bearing
|
|
567
|
+
# (deletes stay gated). Fail-open on a classify error — the write falls to the
|
|
568
|
+
# normal deny-gate and the runner-side backstop still withholds any secret
|
|
569
|
+
# content before persist.
|
|
570
|
+
if [ "$CATEGORY" = "write" ] && [ -n "$SALIENT" ]; then
|
|
571
|
+
SECRET_RESULT=$(printf '%s' "$SALIENT" | ELECTRON_RUN_AS_NODE=1 "$NODE_BIN" -e '${secretClassifyScript}' 2>/dev/null || echo ok)
|
|
572
|
+
if [ "$SECRET_RESULT" = "secret" ]; then
|
|
573
|
+
echo '{"permission":"deny","agent_message":"${SECRET_BLOCKED_AGENT_MESSAGE}","user_message":"Blocked for security: this file matches a secret-like path and was not written."}'
|
|
574
|
+
exit 0
|
|
575
|
+
fi
|
|
576
|
+
fi
|
|
559
577
|
# Reinvocation grant: allow when the CONTENT-exact token (a file edit approved
|
|
560
578
|
# earlier with this exact content) OR the COARSE token (a shell/delete, or the
|
|
561
579
|
# content-less degrade) is in approvedGrantTokens. A sibling edit to the same
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook-script.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/hook-script.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AAEH,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EACL,eAAe,EACf,eAAe,EACf,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"hook-script.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/hook-script.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AAEH,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EACL,eAAe,EACf,eAAe,EACf,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAE3H,6EAA6E;AAC7E,4EAA4E;AAC5E,2EAA2E;AAC3E,gEAAgE;AAChE,+EAA+E;AAC/E,6EAA6E;AAC7E,oEAAoE;AACpE,+EAA+E;AAC/E,uCAAuC;AACvC,MAAM,+BAA+B,GACnC,6EAA6E;IAC7E,gFAAgF;IAChF,+EAA+E;IAC/E,8EAA8E;IAC9E,qEAAqE;IACrE,6EAA6E,CAAC;AAEhF,iFAAiF;AACjF,kFAAkF;AAClF,kFAAkF;AAClF,gFAAgF;AAChF,oEAAoE;AACpE,MAAM,4BAA4B,GAChC,4EAA4E;IAC5E,gFAAgF;IAChF,iFAAiF;IACjF,+EA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AyB,EAAE,CAAC;IACzD,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;IACjC,OAAO;;;;;;;;;;;;;;;YAeG,OAAO;eACJ,iBAAiB;;;YAGpB,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2EAgGkD,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2B5E,aAAa;;;;;;EAM5B,gBAAgB;;;;;;;;;;;;;;gDAc8B,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sCAiDzC,wBAAwB;iFACmB,wBAAwB;;;;;kDAKvD,4BAA4B;;;;;;kDAM5B,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDA2C7B,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sFAsCG,oBAAoB;;oDAEtD,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;gDA4BhC,+BAA+B;;;;;;;;;CAS9E,CAAC;AACF,CAAC"}
|
|
@@ -54,6 +54,11 @@ export interface BuildPromptInput {
|
|
|
54
54
|
*/
|
|
55
55
|
appliedToolCallIds?: ReadonlySet<string>;
|
|
56
56
|
interactionMode?: InteractionMode;
|
|
57
|
+
/**
|
|
58
|
+
* The execution is a Build-from-plan turn (spec.execution_config
|
|
59
|
+
* .build_from_plan): both prompt paths carry the implement-plan directive.
|
|
60
|
+
*/
|
|
61
|
+
buildFromPlan?: boolean;
|
|
57
62
|
}
|
|
58
63
|
/**
|
|
59
64
|
* Select and build the appropriate prompt based on resolution reason and
|