@stigmer/runner 3.40.0 → 3.41.0
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/README.md +3 -1
- package/dist/.build-fingerprint +1 -1
- package/dist/__test-utils__/execution-record-fixture.d.ts +2 -1
- package/dist/__test-utils__/execution-record-fixture.js.map +1 -1
- package/dist/activities/call-agent.js +1 -1
- package/dist/activities/discover-mcp-server.d.ts +7 -1
- package/dist/activities/discover-mcp-server.js +13 -29
- package/dist/activities/discover-mcp-server.js.map +1 -1
- package/dist/activities/execute-cursor/__test-utils__/fold.d.ts +4 -2
- package/dist/activities/execute-cursor/__test-utils__/fold.js +3 -4
- package/dist/activities/execute-cursor/__test-utils__/fold.js.map +1 -1
- package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.js +1 -0
- package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.js.map +1 -1
- package/dist/activities/execute-cursor/approval-policy.d.ts +1 -29
- package/dist/activities/execute-cursor/approval-policy.js +11 -35
- package/dist/activities/execute-cursor/approval-policy.js.map +1 -1
- package/dist/activities/execute-cursor/boundary-rows.js +4 -4
- package/dist/activities/execute-cursor/boundary-rows.js.map +1 -1
- package/dist/activities/execute-cursor/translator.d.ts +12 -17
- package/dist/activities/execute-cursor/translator.js +13 -30
- package/dist/activities/execute-cursor/translator.js.map +1 -1
- package/dist/activities/execute-cursor/turn-stream.js +4 -2
- package/dist/activities/execute-cursor/turn-stream.js.map +1 -1
- package/dist/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.d.ts +11 -1
- package/dist/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.js +22 -3
- package/dist/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.js.map +1 -1
- package/dist/activities/execute-deep-agent/inline-publisher.d.ts +33 -2
- package/dist/activities/execute-deep-agent/inline-publisher.js +33 -7
- package/dist/activities/execute-deep-agent/inline-publisher.js.map +1 -1
- package/dist/activities/execute-deep-agent/platform-route.d.ts +48 -13
- package/dist/activities/execute-deep-agent/platform-route.js +87 -19
- package/dist/activities/execute-deep-agent/platform-route.js.map +1 -1
- package/dist/activities/execute-deep-agent/prompt-builder.d.ts +70 -35
- package/dist/activities/execute-deep-agent/prompt-builder.js +70 -55
- package/dist/activities/execute-deep-agent/prompt-builder.js.map +1 -1
- package/dist/activities/execute-deep-agent/streaming-side-effects.d.ts +20 -3
- package/dist/activities/execute-deep-agent/streaming-side-effects.js +26 -4
- package/dist/activities/execute-deep-agent/streaming-side-effects.js.map +1 -1
- package/dist/activities/execute-deep-agent/translator.d.ts +5 -4
- package/dist/activities/execute-deep-agent/translator.js +5 -4
- package/dist/activities/execute-deep-agent/translator.js.map +1 -1
- package/dist/activities/execute-deep-agent/turn-settle.js +6 -6
- package/dist/activities/execute-deep-agent/turn-settle.js.map +1 -1
- package/dist/activities/execute-deep-agent/turn-setup.d.ts +18 -13
- package/dist/activities/execute-deep-agent/turn-setup.js +42 -36
- package/dist/activities/execute-deep-agent/turn-setup.js.map +1 -1
- package/dist/activities/execute-deep-agent/turn-stream.d.ts +10 -6
- package/dist/activities/execute-deep-agent/turn-stream.js +6 -16
- package/dist/activities/execute-deep-agent/turn-stream.js.map +1 -1
- package/dist/activities/execute-deep-agent/turn.d.ts +4 -1
- package/dist/activities/execute-deep-agent/turn.js +15 -6
- package/dist/activities/execute-deep-agent/turn.js.map +1 -1
- package/dist/activities/workflow-event-activities.js +2 -0
- package/dist/activities/workflow-event-activities.js.map +1 -1
- package/dist/config.d.ts +9 -0
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/exit-backstop.d.ts +64 -0
- package/dist/exit-backstop.js +79 -0
- package/dist/exit-backstop.js.map +1 -0
- package/dist/harness/terminal-table.d.ts +12 -5
- package/dist/harness/terminal-table.js +13 -13
- package/dist/harness/terminal-table.js.map +1 -1
- package/dist/harness/transcript/builder.d.ts +21 -0
- package/dist/harness/transcript/builder.js +53 -31
- package/dist/harness/transcript/builder.js.map +1 -1
- package/dist/harness/transcript/events.d.ts +22 -26
- package/dist/harness/transcript/events.js +6 -5
- package/dist/harness/transcript/events.js.map +1 -1
- package/dist/harness/turn-context.d.ts +3 -1
- package/dist/harness/turn-context.js +5 -3
- package/dist/harness/turn-context.js.map +1 -1
- package/dist/main.js +10 -4
- package/dist/main.js.map +1 -1
- package/dist/middleware/cost-advisory.d.ts +6 -3
- package/dist/middleware/cost-advisory.js +6 -3
- package/dist/middleware/cost-advisory.js.map +1 -1
- package/dist/middleware/execution-budget.d.ts +22 -7
- package/dist/middleware/execution-budget.js +57 -35
- package/dist/middleware/execution-budget.js.map +1 -1
- package/dist/middleware/index.d.ts +10 -7
- package/dist/middleware/index.js +10 -7
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/types.d.ts +6 -1
- package/dist/runner-manager.js +3 -2
- package/dist/runner-manager.js.map +1 -1
- package/dist/runner.d.ts +25 -0
- package/dist/runner.js +41 -14
- package/dist/runner.js.map +1 -1
- package/dist/shared/approval-policy.d.ts +23 -13
- package/dist/shared/approval-policy.js +47 -14
- package/dist/shared/approval-policy.js.map +1 -1
- package/dist/shared/caller-identity.d.ts +4 -5
- package/dist/shared/caller-identity.js +4 -5
- package/dist/shared/caller-identity.js.map +1 -1
- package/dist/shared/channel-attachment.js +3 -2
- package/dist/shared/channel-attachment.js.map +1 -1
- package/dist/shared/connect-backfill.d.ts +2 -1
- package/dist/shared/connect-backfill.js +2 -2
- package/dist/shared/connect-backfill.js.map +1 -1
- package/dist/shared/mcp-resolver.d.ts +10 -1
- package/dist/shared/mcp-resolver.js +11 -2
- package/dist/shared/mcp-resolver.js.map +1 -1
- package/dist/shared/memory-attachment.js +3 -2
- package/dist/shared/memory-attachment.js.map +1 -1
- package/dist/shared/model-error.d.ts +25 -3
- package/dist/shared/model-error.js +78 -10
- package/dist/shared/model-error.js.map +1 -1
- package/dist/shared/platform-server-address.d.ts +71 -0
- package/dist/shared/platform-server-address.js +103 -0
- package/dist/shared/platform-server-address.js.map +1 -0
- package/dist/shared/prompt-sections.d.ts +6 -28
- package/dist/shared/prompt-sections.js +6 -35
- package/dist/shared/prompt-sections.js.map +1 -1
- package/dist/shared/skill-resolver.d.ts +2 -3
- package/dist/shared/skill-resolver.js +2 -3
- package/dist/shared/skill-resolver.js.map +1 -1
- package/dist/shared/synthesized-attachment.d.ts +0 -5
- package/dist/shared/synthesized-attachment.js +0 -12
- package/dist/shared/synthesized-attachment.js.map +1 -1
- package/dist/shared/tool-rounds.d.ts +51 -23
- package/dist/shared/tool-rounds.js +67 -24
- package/dist/shared/tool-rounds.js.map +1 -1
- package/dist/shared/workspace/platform-dir.d.ts +15 -0
- package/dist/shared/workspace/platform-dir.js +18 -1
- package/dist/shared/workspace/platform-dir.js.map +1 -1
- package/dist/shared/workspace/sources/git.js +13 -6
- package/dist/shared/workspace/sources/git.js.map +1 -1
- package/dist/shared/workspace/stigmer-link.d.ts +21 -14
- package/dist/shared/workspace/stigmer-link.js +91 -29
- package/dist/shared/workspace/stigmer-link.js.map +1 -1
- package/dist/tools/url-guard.d.ts +5 -1
- package/dist/tools/url-guard.js +9 -2
- package/dist/tools/url-guard.js.map +1 -1
- package/dist/worker.d.ts +11 -2
- package/dist/worker.js +1 -1
- package/dist/worker.js.map +1 -1
- package/dist/workflow-engine/tasks/human-input.d.ts +16 -0
- package/dist/workflow-engine/tasks/human-input.js +79 -37
- package/dist/workflow-engine/tasks/human-input.js.map +1 -1
- package/dist/workflow-engine/types.d.ts +14 -4
- package/dist/workflow-engine/types.js.map +1 -1
- package/dist/workflows/call-agent-orchestrator.d.ts +13 -0
- package/dist/workflows/call-agent-orchestrator.js.map +1 -1
- package/dist/workflows/engine-core.d.ts +25 -0
- package/dist/workflows/engine-core.js.map +1 -1
- package/dist/workflows/execute-from-execution.d.ts +3 -0
- package/dist/workflows/execute-from-execution.js.map +1 -1
- package/dist/workflows/human-input-orchestrator.d.ts +9 -12
- package/dist/workflows/human-input-orchestrator.js +12 -44
- package/dist/workflows/human-input-orchestrator.js.map +1 -1
- package/package.json +5 -5
- package/src/__test-utils__/config-fixture.ts +1 -0
- package/src/__test-utils__/execution-record-fixture.ts +2 -1
- package/src/__test-utils__/harness-contract/runtime-contract.ts +5 -3
- package/src/__test-utils__/test-gate.ts +8 -0
- package/src/__tests__/exit-backstop.test.ts +91 -0
- package/src/__tests__/golden-e2e.test.ts +80 -62
- package/src/__tests__/history-encryption-e2e.test.ts +51 -27
- package/src/__tests__/runner.test.ts +60 -2
- package/src/activities/__tests__/classify-tool-approvals.test.ts +1 -0
- package/src/activities/__tests__/discover-mcp-server.hang.test.ts +5 -1
- package/src/activities/__tests__/discover-mcp-server.test.ts +90 -49
- package/src/activities/__tests__/workflow-event-activities.test.ts +28 -7
- package/src/activities/call-agent.ts +1 -1
- package/src/activities/discover-mcp-server.ts +27 -37
- package/src/activities/execute-cursor/__test-utils__/fold.ts +6 -4
- package/src/activities/execute-cursor/__test-utils__/hermetic-cursor.ts +1 -0
- package/src/activities/execute-cursor/__tests__/approval-gate.test.ts +4 -29
- package/src/activities/execute-cursor/__tests__/hermetic/bypassed-tool-call.test.ts +120 -0
- package/src/activities/execute-cursor/__tests__/hermetic/file-review-capture.test.ts +5 -5
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/file-review-capture.status.json +0 -2
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/resolution-error.status.json +1 -1
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/shell-output-delta.error-delta.status.json +0 -3
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/shell-output-delta.output-first.status.json +0 -2
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/shell-output-delta.status.json +0 -2
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/stall.status.json +0 -2
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/unattributed-hook-block.status.json +0 -3
- package/src/activities/execute-cursor/__tests__/hermetic/shell-output-delta.test.ts +9 -7
- package/src/activities/execute-cursor/__tests__/hermetic/thrown-error-arms.test.ts +6 -1
- package/src/activities/execute-cursor/__tests__/hitl-resume-history.test.ts +8 -11
- package/src/activities/execute-cursor/__tests__/sequential-gate-resume.test.ts +1 -3
- package/src/activities/execute-cursor/__tests__/translator.test.ts +68 -15
- package/src/activities/execute-cursor/approval-policy.ts +11 -36
- package/src/activities/execute-cursor/boundary-rows.ts +3 -3
- package/src/activities/execute-cursor/translator.ts +15 -32
- package/src/activities/execute-cursor/turn-stream.ts +4 -1
- package/src/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.ts +33 -2
- package/src/activities/execute-deep-agent/__tests__/adapter.test.ts +1 -0
- package/src/activities/execute-deep-agent/__tests__/goldens/system-prompt.build-from-plan.prompt.md +1 -27
- package/src/activities/execute-deep-agent/__tests__/goldens/system-prompt.everything.prompt.md +26 -30
- package/src/activities/execute-deep-agent/__tests__/goldens/system-prompt.plan-mode.prompt.md +1 -26
- package/src/activities/execute-deep-agent/__tests__/goldens/user-message.everything.md +36 -0
- package/src/activities/execute-deep-agent/__tests__/hermetic/file-review-capture.test.ts +4 -0
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/file-review-capture.status.json +1 -1
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/inline-artifact.turn1.status.json +1 -1
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/inline-artifact.turn2.status.json +1 -1
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/recursion-limit.persisted.status.json +8 -73
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/resolution-error.status.json +1 -1
- package/src/activities/execute-deep-agent/__tests__/hermetic/inline-artifact-across-gate.test.ts +17 -0
- package/src/activities/execute-deep-agent/__tests__/hermetic/recursion-limit.test.ts +86 -26
- package/src/activities/execute-deep-agent/__tests__/hermetic/resolution-error.test.ts +9 -5
- package/src/activities/execute-deep-agent/__tests__/hermetic/thrown-turn-drains-publishes.test.ts +159 -0
- package/src/activities/execute-deep-agent/__tests__/inline-publisher.test.ts +84 -0
- package/src/activities/execute-deep-agent/__tests__/platform-route.test.ts +47 -10
- package/src/activities/execute-deep-agent/__tests__/prompt-builder.test.ts +127 -199
- package/src/activities/execute-deep-agent/__tests__/prompt-goldens.test.ts +31 -26
- package/src/activities/execute-deep-agent/__tests__/streaming-side-effects.test.ts +34 -0
- package/src/activities/execute-deep-agent/__tests__/turn-stream.test.ts +13 -5
- package/src/activities/execute-deep-agent/inline-publisher.ts +47 -7
- package/src/activities/execute-deep-agent/platform-route.ts +109 -20
- package/src/activities/execute-deep-agent/prompt-builder.ts +104 -92
- package/src/activities/execute-deep-agent/streaming-side-effects.ts +27 -4
- package/src/activities/execute-deep-agent/translator.ts +5 -4
- package/src/activities/execute-deep-agent/turn-settle.ts +6 -6
- package/src/activities/execute-deep-agent/turn-setup.ts +43 -38
- package/src/activities/execute-deep-agent/turn-stream.ts +15 -22
- package/src/activities/execute-deep-agent/turn.ts +16 -7
- package/src/activities/workflow-event-activities.ts +2 -0
- package/src/config.ts +11 -0
- package/src/exit-backstop.ts +97 -0
- package/src/harness/README.md +5 -5
- package/src/harness/terminal-table.ts +13 -13
- package/src/harness/transcript/__tests__/builder.test.ts +93 -21
- package/src/harness/transcript/builder.ts +53 -30
- package/src/harness/transcript/events.ts +22 -27
- package/src/harness/turn-context.ts +5 -3
- package/src/main.ts +9 -5
- package/src/middleware/__tests__/execution-budget.test.ts +181 -103
- package/src/middleware/cost-advisory.ts +6 -3
- package/src/middleware/execution-budget.ts +60 -34
- package/src/middleware/index.ts +10 -7
- package/src/middleware/types.ts +6 -1
- package/src/runner-manager.ts +3 -2
- package/src/runner.ts +57 -15
- package/src/shared/__tests__/approval-policy.test.ts +41 -0
- package/src/shared/__tests__/artifact-storage.test.ts +1 -0
- package/src/shared/__tests__/connect-backfill.test.ts +15 -11
- package/src/shared/__tests__/mcp-resolver.test.ts +72 -10
- package/src/shared/__tests__/model-error.test.ts +71 -3
- package/src/shared/__tests__/platform-server-address.test.ts +122 -0
- package/src/shared/__tests__/prompt-sections.test.ts +2 -54
- package/src/shared/__tests__/tool-rounds.test.ts +64 -14
- package/src/shared/approval-policy.ts +57 -14
- package/src/shared/caller-identity.ts +4 -5
- package/src/shared/channel-attachment.ts +2 -2
- package/src/shared/connect-backfill.ts +5 -1
- package/src/shared/mcp-resolver.ts +11 -1
- package/src/shared/memory-attachment.ts +2 -2
- package/src/shared/model-error.ts +87 -9
- package/src/shared/platform-server-address.ts +123 -0
- package/src/shared/prompt-sections.ts +6 -55
- package/src/shared/skill-resolver.ts +2 -3
- package/src/shared/synthesized-attachment.ts +0 -12
- package/src/shared/tool-rounds.ts +70 -24
- package/src/shared/workspace/__tests__/git-source.test.ts +11 -5
- package/src/shared/workspace/__tests__/stigmer-link.test.ts +107 -10
- package/src/shared/workspace/platform-dir.ts +19 -1
- package/src/shared/workspace/sources/git.ts +14 -8
- package/src/shared/workspace/stigmer-link.ts +99 -29
- package/src/tools/__tests__/url-guard.test.ts +19 -1
- package/src/tools/url-guard.ts +9 -1
- package/src/worker.ts +12 -2
- package/src/workflow-engine/__tests__/golden-execution.test.ts +2 -1
- package/src/workflow-engine/__tests__/loader.test.ts +1 -1
- package/src/workflow-engine/__tests__/tasks/human-input.test.ts +133 -57
- package/src/workflow-engine/tasks/human-input.ts +92 -42
- package/src/workflow-engine/types.ts +16 -4
- package/src/workflows/call-agent-orchestrator.ts +7 -0
- package/src/workflows/engine-core.ts +18 -0
- package/src/workflows/execute-from-execution.ts +2 -1
- package/src/workflows/human-input-orchestrator.ts +15 -56
- package/dist/shared/skill-relevance.d.ts +0 -65
- package/dist/shared/skill-relevance.js +0 -175
- package/dist/shared/skill-relevance.js.map +0 -1
- package/src/activities/execute-deep-agent/__tests__/goldens/system-prompt.skills-below-threshold.prompt.md +0 -146
- package/src/shared/__tests__/skill-relevance.test.ts +0 -292
- package/src/shared/skill-relevance.ts +0 -222
|
@@ -30,9 +30,18 @@
|
|
|
30
30
|
*
|
|
31
31
|
* WHEN IT IS MOUNTED
|
|
32
32
|
* ------------------
|
|
33
|
-
* On
|
|
34
|
-
*
|
|
35
|
-
*
|
|
33
|
+
* On every turn: `.stigmer/` is the platform's name whether or not the turn
|
|
34
|
+
* mounted anything, so a write there never reaches the workspace. Before
|
|
35
|
+
* #1123 the route existed only on linked turns, and a write under `.stigmer/`
|
|
36
|
+
* on any other turn made a real directory in the user's tree that the next
|
|
37
|
+
* link displaced. What the route exposes follows the link, so the file tools
|
|
38
|
+
* reach exactly what the shell reaches on the same turn:
|
|
39
|
+
* - on a turn whose skill or attachment phase made the link, the platform dir
|
|
40
|
+
* ({@link PlatformContentBackend});
|
|
41
|
+
* - on any other turn, nothing ({@link NoPlatformContentBackend}): the dir
|
|
42
|
+
* still holds earlier turns' skills and inputs, which this turn's shell
|
|
43
|
+
* cannot reach, so the file tools must not either. The root listing then
|
|
44
|
+
* leaves `.stigmer/` out, as the tree does.
|
|
36
45
|
* The link itself stays: shell commands (a skill's own scripts among them)
|
|
37
46
|
* run in the workspace and resolve `.stigmer/…` through it.
|
|
38
47
|
*/
|
|
@@ -40,11 +49,18 @@ import { CompositeBackend, FilesystemBackend } from "deepagents";
|
|
|
40
49
|
import { STIGMER_LOCAL_STATE_DIR, stigmerSymlinkPointsAt } from "../../shared/workspace/stigmer-link.js";
|
|
41
50
|
/** The route prefix, with the trailing slash `CompositeBackend` needs to match `/.stigmer/x` but never `/.stigmerx`. */
|
|
42
51
|
export const PLATFORM_ROUTE_PREFIX = `/${STIGMER_LOCAL_STATE_DIR}/`;
|
|
52
|
+
/** The path as the agent named it: the route hands its backend the path with the prefix stripped. */
|
|
53
|
+
function agentPath(routedPath) {
|
|
54
|
+
return `${PLATFORM_ROUTE_PREFIX.slice(0, -1)}${routedPath}`;
|
|
55
|
+
}
|
|
43
56
|
function readOnly(routedPath) {
|
|
44
|
-
|
|
45
|
-
return (`Error: '${agentPath}' is platform content (skills, attached inputs, the approved plan) ` +
|
|
57
|
+
return (`Error: '${agentPath(routedPath)}' is platform content (skills, attached inputs, the approved plan) ` +
|
|
46
58
|
"and is read-only; write your own files in the workspace");
|
|
47
59
|
}
|
|
60
|
+
function noPlatformContent(routedPath) {
|
|
61
|
+
return (`Error: '${agentPath(routedPath)}' does not exist: this turn has no platform content ` +
|
|
62
|
+
"(no skills or attached inputs)");
|
|
63
|
+
}
|
|
48
64
|
/** The platform dir, virtual-rooted like every native backend, refusing every mutation. */
|
|
49
65
|
export class PlatformContentBackend extends FilesystemBackend {
|
|
50
66
|
constructor(platformDir) {
|
|
@@ -64,18 +80,69 @@ export class PlatformContentBackend extends FilesystemBackend {
|
|
|
64
80
|
}
|
|
65
81
|
}
|
|
66
82
|
/**
|
|
67
|
-
* The
|
|
83
|
+
* The `.stigmer/` route on a turn that exposes no platform content: nothing
|
|
84
|
+
* to read, list or find, and every mutation refused with the same message
|
|
85
|
+
* the platform dir's route gives. It stands on no filesystem, so it cannot
|
|
86
|
+
* create or reveal anything, and `ls` answers "does not exist" rather than
|
|
87
|
+
* an empty listing because the root listing leaves `.stigmer/` out.
|
|
88
|
+
*/
|
|
89
|
+
export class NoPlatformContentBackend {
|
|
90
|
+
ls(path) {
|
|
91
|
+
return { error: noPlatformContent(path) };
|
|
92
|
+
}
|
|
93
|
+
read(filePath) {
|
|
94
|
+
return { error: noPlatformContent(filePath) };
|
|
95
|
+
}
|
|
96
|
+
readRaw(filePath) {
|
|
97
|
+
return { error: noPlatformContent(filePath) };
|
|
98
|
+
}
|
|
99
|
+
grep() {
|
|
100
|
+
return { matches: [] };
|
|
101
|
+
}
|
|
102
|
+
glob() {
|
|
103
|
+
return { files: [] };
|
|
104
|
+
}
|
|
105
|
+
write(filePath) {
|
|
106
|
+
return { error: readOnly(filePath) };
|
|
107
|
+
}
|
|
108
|
+
edit(filePath) {
|
|
109
|
+
return { error: readOnly(filePath) };
|
|
110
|
+
}
|
|
111
|
+
delete(filePath) {
|
|
112
|
+
return { error: readOnly(filePath) };
|
|
113
|
+
}
|
|
114
|
+
uploadFiles(files) {
|
|
115
|
+
return files.map(([path]) => ({ path, error: "permission_denied" }));
|
|
116
|
+
}
|
|
117
|
+
downloadFiles(paths) {
|
|
118
|
+
return paths.map((path) => ({ path, content: null, error: "file_not_found" }));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The workspace backend with `.stigmer/` routed to {@link PLATFORM_ROUTE_PREFIX}'s
|
|
123
|
+
* backend for this turn.
|
|
68
124
|
*
|
|
69
125
|
* One behaviour differs from the stock router: listing `/`. The composite
|
|
70
|
-
* adds each route to the root listing
|
|
71
|
-
*
|
|
72
|
-
*
|
|
126
|
+
* adds each route to the root listing whatever the route holds. With the
|
|
127
|
+
* platform exposed, the workspace backend also lists `.stigmer/` by following
|
|
128
|
+
* the link, so the stock listing names the same directory twice and is
|
|
129
|
+
* de-duplicated by path. With nothing exposed, `.stigmer/` is left out of the
|
|
130
|
+
* root listing altogether: the route has nothing to show, and a real
|
|
131
|
+
* `.stigmer` the workspace may hold is unreachable behind it.
|
|
73
132
|
*/
|
|
74
133
|
export class PlatformRoutedBackend extends CompositeBackend {
|
|
134
|
+
exposesPlatform;
|
|
135
|
+
constructor(backend, platform) {
|
|
136
|
+
super(backend, { [PLATFORM_ROUTE_PREFIX]: platform });
|
|
137
|
+
this.exposesPlatform = platform instanceof PlatformContentBackend;
|
|
138
|
+
}
|
|
75
139
|
async ls(path) {
|
|
76
140
|
const result = await super.ls(path);
|
|
77
141
|
if (path !== "/" || !result.files)
|
|
78
142
|
return result;
|
|
143
|
+
if (!this.exposesPlatform) {
|
|
144
|
+
return { ...result, files: result.files.filter((entry) => entry.path !== PLATFORM_ROUTE_PREFIX) };
|
|
145
|
+
}
|
|
79
146
|
const seen = new Set();
|
|
80
147
|
return {
|
|
81
148
|
...result,
|
|
@@ -89,19 +156,20 @@ export class PlatformRoutedBackend extends CompositeBackend {
|
|
|
89
156
|
}
|
|
90
157
|
}
|
|
91
158
|
/**
|
|
92
|
-
* Mount the
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* a
|
|
159
|
+
* Mount the `.stigmer/` route over `backend` for this turn: the platform dir
|
|
160
|
+
* when the workspace link points at it, the empty route otherwise. Only a
|
|
161
|
+
* session without a platform dir gets `backend` back unchanged. `execute`
|
|
162
|
+
* and the sandbox identity stay the workspace backend's (`CompositeBackend`
|
|
163
|
+
* delegates both to its default), so a shell-capable graph keeps its
|
|
164
|
+
* `execute` tool and a plan-mode graph stays without one.
|
|
97
165
|
*/
|
|
98
166
|
export async function mountPlatformRoute(backend, options) {
|
|
99
167
|
const { workspaceDir, platformDir } = options;
|
|
100
|
-
if (platformDir === undefined
|
|
168
|
+
if (platformDir === undefined)
|
|
101
169
|
return backend;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
170
|
+
const platform = (await stigmerSymlinkPointsAt(workspaceDir, platformDir))
|
|
171
|
+
? new PlatformContentBackend(platformDir)
|
|
172
|
+
: new NoPlatformContentBackend();
|
|
173
|
+
return new PlatformRoutedBackend(backend, platform);
|
|
106
174
|
}
|
|
107
175
|
//# sourceMappingURL=platform-route.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-route.js","sourceRoot":"","sources":["../../../src/activities/execute-deep-agent/platform-route.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"platform-route.js","sourceRoot":"","sources":["../../../src/activities/execute-deep-agent/platform-route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAejE,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAEzG,wHAAwH;AACxH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,uBAAuB,GAAG,CAAC;AAEpE,qGAAqG;AACrG,SAAS,SAAS,CAAC,UAAkB;IAC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zC,CAAC,CAAC,IAAI,wBAAwB,EAAE,CAAC;IACnC,OAAO,IAAI,qBAAqB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The native harness's system prompt
|
|
3
|
-
* `systemPrompt`,
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* The native harness's prompt: the system prompt `createDeepAgent` receives
|
|
3
|
+
* as `systemPrompt`, and the turn's user message.
|
|
4
|
+
*
|
|
5
|
+
* The system prompt is rebuilt on EVERY invocation (never checkpointed with
|
|
6
|
+
* the message history), so every standing fact is injected on every turn by
|
|
7
|
+
* design — a first-turn-only injection would vanish from turn 2 onward. It is
|
|
8
|
+
* a function of the session and of the execution's settings (its mode), never
|
|
9
|
+
* of the turn. The provider caches tools, system and messages as one prefix,
|
|
10
|
+
* so a system byte that follows the message re-writes the cached prompt and
|
|
11
|
+
* the whole conversation after it, on every turn, at the cache-write price.
|
|
12
|
+
* What belongs to one turn — its input files, the workspace paths it
|
|
13
|
+
* references, the conversation catchup — rides that turn's user message
|
|
14
|
+
* (`composeUserMessage`), which enters the checkpointer with the turn and
|
|
15
|
+
* stays in history. That is the Cursor harness's resumed-turn placement
|
|
16
|
+
* (`execute-cursor/prompt-builder.ts` `buildPrompt`) and the runner's rule
|
|
17
|
+
* that user content goes in user messages, never the system prompt.
|
|
6
18
|
*
|
|
7
19
|
* Pure functions: no side effects, no I/O. `turn-setup.ts` gathers the
|
|
8
20
|
* inputs from the runtime's resolved record and this module renders them.
|
|
9
21
|
*
|
|
10
22
|
* What is this harness's and what is shared (since #1096):
|
|
11
23
|
* - Shared through `shared/prompt-sections.ts`: WHICH standing sections
|
|
12
|
-
* render and in WHAT order (`standingContextSections`)
|
|
13
|
-
* bullet and disclosure lines (`inputFileLines`)
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
24
|
+
* render and in WHAT order (`standingContextSections`) and the
|
|
25
|
+
* input-files bullet and disclosure lines (`inputFileLines`). Their WORDS
|
|
26
|
+
* come from each fact's own module; this builder only frames them. Every
|
|
27
|
+
* mounted skill is described on every turn, as the Cursor harness does:
|
|
28
|
+
* choosing skills by the message made the system prompt follow the
|
|
29
|
+
* message.
|
|
17
30
|
* - This harness's: the framing — `## Heading` markdown sections, the house
|
|
18
31
|
* style for a system prompt — and every text that quotes this engine's
|
|
19
32
|
* tools: the `## Skills` activation protocol, the response rules, the
|
|
@@ -24,7 +37,8 @@
|
|
|
24
37
|
*
|
|
25
38
|
* The rendered bytes are load-bearing for the hermetic tests: `ScriptedModel`
|
|
26
39
|
* tells its scripted roles apart by the system prompt's text, so this
|
|
27
|
-
* module's whole output
|
|
40
|
+
* module's whole output — the system prompt and the turn's message — is
|
|
41
|
+
* pinned by `__tests__/prompt-goldens.test.ts`.
|
|
28
42
|
*/
|
|
29
43
|
import { InteractionMode } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
30
44
|
import type { ProvisionResult } from "../../shared/workspace/types.js";
|
|
@@ -47,22 +61,6 @@ export interface PromptBuilderInput {
|
|
|
47
61
|
* when the agent serves no proactive channel or nothing is sendable.
|
|
48
62
|
*/
|
|
49
63
|
channelTemplatesPromptSection?: string;
|
|
50
|
-
workspaceFileRefs: string[];
|
|
51
|
-
workspaceRoot: string;
|
|
52
|
-
/** The turn's resolved input files, as the runtime's attachment phase returns them. */
|
|
53
|
-
inputFiles: readonly ResolvedAttachment[];
|
|
54
|
-
/**
|
|
55
|
-
* Vision facts about this turn's attachments (T04): which images the model
|
|
56
|
-
* sees inline in the user message and which degraded to path-only.
|
|
57
|
-
* Rendered inside the Input Files section.
|
|
58
|
-
*/
|
|
59
|
-
vision?: VisionPromptInfo;
|
|
60
|
-
/**
|
|
61
|
-
* What kind of URL the turn's storage backend mints (issue #532) — keys
|
|
62
|
-
* the Input Files section's hand-off wording (attachment-download-urls.ts).
|
|
63
|
-
* One turn-level fact: all attachments ride the one configured storage.
|
|
64
|
-
*/
|
|
65
|
-
downloadUrlKind?: DownloadUrlKind;
|
|
66
64
|
/**
|
|
67
65
|
* The execution's interaction mode. PLAN appends the shared plan-mode
|
|
68
66
|
* directive so the model knows the turn's deliverable is a plan document.
|
|
@@ -79,6 +77,14 @@ export interface PromptBuilderInput {
|
|
|
79
77
|
* message itself is just a short label ("Build from plan").
|
|
80
78
|
*/
|
|
81
79
|
buildFromPlan?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* The approved plan's path among the turn's input files
|
|
82
|
+
* (`implement-plan-prompt.ts` `findApprovedPlanPath`), read only under
|
|
83
|
+
* `buildFromPlan`. Absent when the plan did not materialize, which selects
|
|
84
|
+
* the directive's conversation-plan variant. The Input Files section
|
|
85
|
+
* itself rides the turn's message (`composeUserMessage`).
|
|
86
|
+
*/
|
|
87
|
+
approvedPlanPath?: string;
|
|
82
88
|
/**
|
|
83
89
|
* Rollover context bridge (cloud DD-013): a digest of the previous
|
|
84
90
|
* session's conversation, read from `SessionSpec.metadata`. Injected on
|
|
@@ -128,17 +134,46 @@ export type { VisionPromptInfo };
|
|
|
128
134
|
* sections. Pure function with no I/O.
|
|
129
135
|
*/
|
|
130
136
|
export declare function buildEnhancedSystemPrompt(input: PromptBuilderInput): string;
|
|
137
|
+
/** The turn's own content, composed around what the user typed. */
|
|
138
|
+
export interface TurnMessageInput {
|
|
139
|
+
/** What the user typed (`spec.message`); never mutated. */
|
|
140
|
+
readonly message: string;
|
|
141
|
+
/** The conversation catchup digest (cloud DD-006), when the turn carries one. */
|
|
142
|
+
readonly conversationCatchup?: string;
|
|
143
|
+
/** This turn's resolved input files, as the runtime's attachment phase returns them. */
|
|
144
|
+
readonly inputFiles: readonly ResolvedAttachment[];
|
|
145
|
+
/**
|
|
146
|
+
* Vision facts about this turn's attachments (T04): which images the model
|
|
147
|
+
* sees inline in this same message and which degraded to path-only.
|
|
148
|
+
* Rendered inside the Input Files section.
|
|
149
|
+
*/
|
|
150
|
+
readonly vision?: VisionPromptInfo;
|
|
151
|
+
/**
|
|
152
|
+
* What kind of URL the turn's storage backend mints (issue #532) — keys
|
|
153
|
+
* the Input Files section's hand-off wording (attachment-download-urls.ts).
|
|
154
|
+
* One turn-level fact: all attachments ride the one configured storage.
|
|
155
|
+
*/
|
|
156
|
+
readonly downloadUrlKind?: DownloadUrlKind;
|
|
157
|
+
/** The workspace paths the user highlighted for this message (`spec.workspace_file_refs`). */
|
|
158
|
+
readonly workspaceFileRefs: readonly string[];
|
|
159
|
+
}
|
|
131
160
|
/**
|
|
132
|
-
* Compose the turn's USER MESSAGE for the graph invocation:
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
161
|
+
* Compose the turn's USER MESSAGE for the graph invocation: this turn's
|
|
162
|
+
* payload (its input files, then the workspace paths it references), then the
|
|
163
|
+
* framed conversation catchup (cloud DD-006), then what the user typed, each
|
|
164
|
+
* set off by a horizontal rule. Payload first and context closest to the task
|
|
165
|
+
* is the Cursor harness's resumed-turn order.
|
|
166
|
+
*
|
|
167
|
+
* In the user message and never the system prompt (A27, and the module
|
|
168
|
+
* header): the system prompt is rebuilt per invocation, so a turn's content
|
|
169
|
+
* there would vanish one turn later and, while it lasted, change the cached
|
|
170
|
+
* prefix; a message enters the checkpointer with the turn and persists in
|
|
171
|
+
* history, so a later turn still knows which files an earlier one carried.
|
|
172
|
+
* An approval resume sends no new message and needs none: the payload is
|
|
173
|
+
* already in the checkpointed one. The caller's `spec.message` is never
|
|
174
|
+
* mutated; the composition exists only in the graph input.
|
|
140
175
|
*/
|
|
141
|
-
export declare function composeUserMessage(
|
|
176
|
+
export declare function composeUserMessage(input: TurnMessageInput): string;
|
|
142
177
|
/**
|
|
143
178
|
* The `## Skills` section of this harness's system prompt, rendered from the
|
|
144
179
|
* runtime's mounted-skill metadata (`shared/skill-resolver.ts`
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The native harness's system prompt
|
|
3
|
-
* `systemPrompt`,
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* The native harness's prompt: the system prompt `createDeepAgent` receives
|
|
3
|
+
* as `systemPrompt`, and the turn's user message.
|
|
4
|
+
*
|
|
5
|
+
* The system prompt is rebuilt on EVERY invocation (never checkpointed with
|
|
6
|
+
* the message history), so every standing fact is injected on every turn by
|
|
7
|
+
* design — a first-turn-only injection would vanish from turn 2 onward. It is
|
|
8
|
+
* a function of the session and of the execution's settings (its mode), never
|
|
9
|
+
* of the turn. The provider caches tools, system and messages as one prefix,
|
|
10
|
+
* so a system byte that follows the message re-writes the cached prompt and
|
|
11
|
+
* the whole conversation after it, on every turn, at the cache-write price.
|
|
12
|
+
* What belongs to one turn — its input files, the workspace paths it
|
|
13
|
+
* references, the conversation catchup — rides that turn's user message
|
|
14
|
+
* (`composeUserMessage`), which enters the checkpointer with the turn and
|
|
15
|
+
* stays in history. That is the Cursor harness's resumed-turn placement
|
|
16
|
+
* (`execute-cursor/prompt-builder.ts` `buildPrompt`) and the runner's rule
|
|
17
|
+
* that user content goes in user messages, never the system prompt.
|
|
6
18
|
*
|
|
7
19
|
* Pure functions: no side effects, no I/O. `turn-setup.ts` gathers the
|
|
8
20
|
* inputs from the runtime's resolved record and this module renders them.
|
|
9
21
|
*
|
|
10
22
|
* What is this harness's and what is shared (since #1096):
|
|
11
23
|
* - Shared through `shared/prompt-sections.ts`: WHICH standing sections
|
|
12
|
-
* render and in WHAT order (`standingContextSections`)
|
|
13
|
-
* bullet and disclosure lines (`inputFileLines`)
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
24
|
+
* render and in WHAT order (`standingContextSections`) and the
|
|
25
|
+
* input-files bullet and disclosure lines (`inputFileLines`). Their WORDS
|
|
26
|
+
* come from each fact's own module; this builder only frames them. Every
|
|
27
|
+
* mounted skill is described on every turn, as the Cursor harness does:
|
|
28
|
+
* choosing skills by the message made the system prompt follow the
|
|
29
|
+
* message.
|
|
17
30
|
* - This harness's: the framing — `## Heading` markdown sections, the house
|
|
18
31
|
* style for a system prompt — and every text that quotes this engine's
|
|
19
32
|
* tools: the `## Skills` activation protocol, the response rules, the
|
|
@@ -24,7 +37,8 @@
|
|
|
24
37
|
*
|
|
25
38
|
* The rendered bytes are load-bearing for the hermetic tests: `ScriptedModel`
|
|
26
39
|
* tells its scripted roles apart by the system prompt's text, so this
|
|
27
|
-
* module's whole output
|
|
40
|
+
* module's whole output — the system prompt and the turn's message — is
|
|
41
|
+
* pinned by `__tests__/prompt-goldens.test.ts`.
|
|
28
42
|
*/
|
|
29
43
|
import { relative } from "node:path";
|
|
30
44
|
import { InteractionMode } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
@@ -32,7 +46,7 @@ import { formatConversationCatchupText } from "../../shared/conversation-catchup
|
|
|
32
46
|
import { inputFileLines, standingContextSections, } from "../../shared/prompt-sections.js";
|
|
33
47
|
import { effectiveInstructions } from "../../shared/builtin-assistant-prompt.js";
|
|
34
48
|
import { PLAN_MODE_DIRECTIVE } from "../../shared/plan-mode-prompt.js";
|
|
35
|
-
import { buildImplementPlanDirective
|
|
49
|
+
import { buildImplementPlanDirective } from "../../shared/implement-plan-prompt.js";
|
|
36
50
|
import { STIGMER_LOCAL_STATE_DIR } from "../../shared/workspace/stigmer-link.js";
|
|
37
51
|
import { DEFAULT_MAX_CONCURRENT } from "../../shared/subagent-gate.js";
|
|
38
52
|
import { ENGINE_TOOL } from "./engine-tools.js";
|
|
@@ -127,15 +141,6 @@ export function buildEnhancedSystemPrompt(input) {
|
|
|
127
141
|
if (input.channelTemplatesPromptSection) {
|
|
128
142
|
prompt += "\n\n" + input.channelTemplatesPromptSection;
|
|
129
143
|
}
|
|
130
|
-
if (input.workspaceFileRefs.length > 0) {
|
|
131
|
-
const refSection = buildReferencedFilesSection(input.workspaceFileRefs, input.workspaceRoot);
|
|
132
|
-
if (refSection) {
|
|
133
|
-
prompt += refSection;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
if (input.inputFiles.length > 0) {
|
|
137
|
-
prompt += buildInputFilesSection(input.inputFiles, input.vision, input.downloadUrlKind);
|
|
138
|
-
}
|
|
139
144
|
// The standing context, in the shared order (the doctrine is stated once,
|
|
140
145
|
// on `standingContextSections`); this harness only frames each section.
|
|
141
146
|
for (const section of standingContextSections(input)) {
|
|
@@ -161,27 +166,41 @@ export function buildEnhancedSystemPrompt(input) {
|
|
|
161
166
|
"`.stigmer/` directory); paths outside it are refused.";
|
|
162
167
|
}
|
|
163
168
|
if (input.buildFromPlan) {
|
|
164
|
-
const planPath = findApprovedPlanPath(input.inputFiles.map((f) => f.relativePath));
|
|
165
169
|
prompt +=
|
|
166
170
|
"\n\n## Implement the approved plan\n\n" +
|
|
167
|
-
buildImplementPlanDirective(
|
|
171
|
+
buildImplementPlanDirective(input.approvedPlanPath);
|
|
168
172
|
}
|
|
169
173
|
return prompt;
|
|
170
174
|
}
|
|
171
175
|
/**
|
|
172
|
-
* Compose the turn's USER MESSAGE for the graph invocation:
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
176
|
+
* Compose the turn's USER MESSAGE for the graph invocation: this turn's
|
|
177
|
+
* payload (its input files, then the workspace paths it references), then the
|
|
178
|
+
* framed conversation catchup (cloud DD-006), then what the user typed, each
|
|
179
|
+
* set off by a horizontal rule. Payload first and context closest to the task
|
|
180
|
+
* is the Cursor harness's resumed-turn order.
|
|
181
|
+
*
|
|
182
|
+
* In the user message and never the system prompt (A27, and the module
|
|
183
|
+
* header): the system prompt is rebuilt per invocation, so a turn's content
|
|
184
|
+
* there would vanish one turn later and, while it lasted, change the cached
|
|
185
|
+
* prefix; a message enters the checkpointer with the turn and persists in
|
|
186
|
+
* history, so a later turn still knows which files an earlier one carried.
|
|
187
|
+
* An approval resume sends no new message and needs none: the payload is
|
|
188
|
+
* already in the checkpointed one. The caller's `spec.message` is never
|
|
189
|
+
* mutated; the composition exists only in the graph input.
|
|
180
190
|
*/
|
|
181
|
-
export function composeUserMessage(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
191
|
+
export function composeUserMessage(input) {
|
|
192
|
+
const parts = [];
|
|
193
|
+
if (input.inputFiles.length > 0) {
|
|
194
|
+
parts.push(buildInputFilesSection(input.inputFiles, input.vision, input.downloadUrlKind));
|
|
195
|
+
}
|
|
196
|
+
if (input.workspaceFileRefs.length > 0) {
|
|
197
|
+
parts.push(buildReferencedFilesSection(input.workspaceFileRefs));
|
|
198
|
+
}
|
|
199
|
+
if (input.conversationCatchup) {
|
|
200
|
+
parts.push(formatConversationCatchupText(input.conversationCatchup));
|
|
201
|
+
}
|
|
202
|
+
parts.push(input.message);
|
|
203
|
+
return parts.join("\n\n---\n\n");
|
|
185
204
|
}
|
|
186
205
|
/**
|
|
187
206
|
* The `## Skills` section of this harness's system prompt, rendered from the
|
|
@@ -292,13 +311,13 @@ function formatEntryDescription(result) {
|
|
|
292
311
|
"You are operating directly on the user's files — changes are " +
|
|
293
312
|
"immediate and persistent. Use git to track and verify your changes.");
|
|
294
313
|
}
|
|
314
|
+
// No commit: the clone's HEAD moves with every write-back commit, and a
|
|
315
|
+
// system prompt that names it would change on every such turn
|
|
316
|
+
// (`shared/workspace/sources/git.ts` says the same for one entry).
|
|
295
317
|
if (result.sourceType === "git_repo" && result.gitMetadata) {
|
|
296
318
|
const meta = result.gitMetadata;
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
: meta.baseCommit;
|
|
300
|
-
return (`Workspace entry **${name}** was initialized from ` +
|
|
301
|
-
`${meta.repoUrl} (branch: ${meta.branch}, commit: ${shortSha}).\n` +
|
|
319
|
+
const branch = meta.branch ? ` (branch: ${meta.branch})` : "";
|
|
320
|
+
return (`Workspace entry **${name}** was initialized from ${meta.repoUrl}${branch}.\n` +
|
|
302
321
|
"Changes you make will be captured as artifacts when execution completes.");
|
|
303
322
|
}
|
|
304
323
|
if (result.sourceType === "empty") {
|
|
@@ -307,25 +326,22 @@ function formatEntryDescription(result) {
|
|
|
307
326
|
}
|
|
308
327
|
return result.workspaceDescription;
|
|
309
328
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
let section = "\n\n## Referenced Files\n\n" +
|
|
329
|
+
/** The `## Referenced Files` part of the turn's message: the paths the user highlighted, one bullet each. */
|
|
330
|
+
function buildReferencedFilesSection(workspaceFileRefs) {
|
|
331
|
+
return ("## Referenced Files\n\n" +
|
|
314
332
|
"The user has highlighted the following workspace paths for your " +
|
|
315
|
-
`attention. Use \`${ENGINE_TOOL.readFile}\` to access file contents.\n\n
|
|
316
|
-
|
|
317
|
-
section += `- \`${refPath}\`\n`;
|
|
318
|
-
}
|
|
319
|
-
return section;
|
|
333
|
+
`attention. Use \`${ENGINE_TOOL.readFile}\` to access file contents.\n\n` +
|
|
334
|
+
workspaceFileRefs.map((refPath) => `- \`${refPath}\``).join("\n"));
|
|
320
335
|
}
|
|
321
336
|
/**
|
|
322
|
-
* The `## Input Files`
|
|
323
|
-
* file-reading tool) around the shared lines
|
|
324
|
-
* says what each bullet and disclosure
|
|
325
|
-
* group is set off by a blank line, the
|
|
337
|
+
* The `## Input Files` part of the turn's message: this harness's intro (it
|
|
338
|
+
* names this engine's file-reading tool) around the shared lines
|
|
339
|
+
* (`prompt-sections.ts` `inputFileLines` says what each bullet and disclosure
|
|
340
|
+
* carries and why). Each disclosure group is set off by a blank line, the
|
|
341
|
+
* markdown idiom.
|
|
326
342
|
*/
|
|
327
343
|
function buildInputFilesSection(files, vision, downloadUrlKind) {
|
|
328
|
-
let section = "
|
|
344
|
+
let section = "## Input Files\n\n";
|
|
329
345
|
section +=
|
|
330
346
|
"The following files have been provided as read-only reference " +
|
|
331
347
|
"material for your task. They live under `.stigmer/inputs/` and " +
|
|
@@ -344,8 +360,7 @@ function buildInputFilesSection(files, vision, downloadUrlKind) {
|
|
|
344
360
|
if (lines.vision.length > 0) {
|
|
345
361
|
section += "\n" + lines.vision.join("\n") + "\n";
|
|
346
362
|
}
|
|
347
|
-
//
|
|
348
|
-
// ends on its last line rather than adding a second blank (#1127).
|
|
363
|
+
// The part ends on its last line; the message's rule sets it off (#1127).
|
|
349
364
|
return section.replace(/\n+$/, "");
|
|
350
365
|
}
|
|
351
366
|
//# sourceMappingURL=prompt-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-builder.js","sourceRoot":"","sources":["../../../src/activities/execute-deep-agent/prompt-builder.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"prompt-builder.js","sourceRoot":"","sources":["../../../src/activities/execute-deep-agent/prompt-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAC;AAE/F,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AAKrF,OAAO,EACL,cAAc,EACd,uBAAuB,GAGxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAGpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,cAAc,GAAG;;;;gCAIS,WAAW,CAAC,QAAQ;;;;;;;;;;;;;;yDAcK,CAAC;AAE1D,4EAA4E;AAC5E,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,IAAI,GAAG,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC;IAC5C,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACnD,CAAC;IAED,0EAA0E;IAC1E,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -16,17 +16,34 @@
|
|
|
16
16
|
* Until #1096 the same correlation also fed the write-back
|
|
17
17
|
* coordinator's per-file commit (`onFileModified`); write-back is
|
|
18
18
|
* finalize-only now, the turn runtime's, so publishing is this trigger's one
|
|
19
|
-
* effect.
|
|
20
|
-
*
|
|
19
|
+
* effect.
|
|
20
|
+
*
|
|
21
|
+
* One instance per turn, owned by the turn's transcript
|
|
22
|
+
* (`turn-stream.ts` `createDeepAgentTranscript`) and not by the stream loop,
|
|
23
|
+
* so the in-flight publishes outlive a stream that throws: the settle
|
|
24
|
+
* drains them before its safety net, and the turn's `finally`
|
|
25
|
+
* (`turn.ts`) drains them on every exit, a thrown turn included, before the
|
|
26
|
+
* runtime writes the terminal status (stigmer#1116). Until then the loop
|
|
27
|
+
* built this and handed the list out only on its return values, so a turn
|
|
28
|
+
* that threw left its uploads to land on a status already persisted for the
|
|
29
|
+
* last time.
|
|
21
30
|
*/
|
|
22
31
|
import type { TranscriptEvent } from "../../harness/transcript/events.js";
|
|
23
32
|
import type { InlinePublisher } from "./inline-publisher.js";
|
|
24
33
|
export declare class StreamingSideEffects {
|
|
25
34
|
private readonly inputCache;
|
|
26
35
|
private readonly inlinePublisher;
|
|
27
|
-
readonly
|
|
36
|
+
private readonly pending;
|
|
28
37
|
constructor(opts: {
|
|
29
38
|
inlinePublisher?: InlinePublisher;
|
|
30
39
|
});
|
|
40
|
+
/** The publishes fired so far, in order; each resolves (a publish logs and swallows its own failure). */
|
|
41
|
+
get pendingPublishPromises(): readonly Promise<void>[];
|
|
42
|
+
/**
|
|
43
|
+
* Wait for every publish fired so far to land on the status. Idempotent:
|
|
44
|
+
* a second call over settled publishes returns at once. Bounded by the
|
|
45
|
+
* artifact storage's own per-call timeouts, as every drain has been.
|
|
46
|
+
*/
|
|
47
|
+
drainPublishes(): Promise<void>;
|
|
31
48
|
onEvent(event: TranscriptEvent): void;
|
|
32
49
|
}
|