@sema-agent/core 5.57.0 → 5.59.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/CHANGELOG.md +96 -0
- package/dist/agents/cascade.d.ts +1 -1
- package/dist/agents/cumulative-stats.d.ts +1 -1
- package/dist/agents/observer.d.ts +2 -2
- package/dist/agents/peer-admission.d.ts +1 -1
- package/dist/agents/retain-ledger.d.ts +2 -2
- package/dist/agents/roster-store.d.ts +8 -8
- package/dist/agents/send-message-tool.d.ts +2 -2
- package/dist/agents/subagent-steps.d.ts +1 -1
- package/dist/agents/subagent.d.ts +13 -13
- package/dist/agents/team.d.ts +5 -5
- package/dist/agents/tool-filter.d.ts +2 -2
- package/dist/agents/verify.d.ts +1 -1
- package/dist/bench/metrics.d.ts +35 -35
- package/dist/brain/degrading.d.ts +1 -1
- package/dist/brain/errors.d.ts +3 -3
- package/dist/brain/reasoning.d.ts +2 -2
- package/dist/brain/repetition.d.ts +1 -1
- package/dist/brain/route-adjudicator.d.ts +8 -1
- package/dist/brain/route-adjudicator.js +8 -1
- package/dist/brain/status-sink.d.ts +2 -2
- package/dist/brain/stream-shared.d.ts +1 -1
- package/dist/config/catalog.d.ts +5 -5
- package/dist/core/arg-summary.d.ts +4 -4
- package/dist/core/ask-class.d.ts +2 -2
- package/dist/core/ask-question.d.ts +1 -1
- package/dist/core/auto-compaction.d.ts +15 -15
- package/dist/core/auto-mode.d.ts +5 -5
- package/dist/core/background-agent-store.d.ts +20 -20
- package/dist/core/background-shell.d.ts +4 -4
- package/dist/core/checkpoint-store.d.ts +35 -27
- package/dist/core/context-edit.d.ts +1 -1
- package/dist/core/context-guard.d.ts +1 -1
- package/dist/core/exec-output-tail.d.ts +6 -6
- package/dist/core/file-snapshot-store.d.ts +8 -8
- package/dist/core/git-worktree-env.d.ts +3 -3
- package/dist/core/governance-codes.d.ts +37 -10
- package/dist/core/governance-codes.js +54 -1
- package/dist/core/hooks.d.ts +73 -33
- package/dist/core/hooks.js +87 -25
- package/dist/core/image-downsample.d.ts +1 -1
- package/dist/core/locked-config.d.ts +1 -1
- package/dist/core/lsp.d.ts +1 -1
- package/dist/core/mailbox-store.d.ts +1 -1
- package/dist/core/mcp.d.ts +3 -3
- package/dist/core/memory-engine/consolidation-driver.d.ts +211 -0
- package/dist/core/memory-engine/consolidation-driver.js +427 -0
- package/dist/core/memory-engine/consolidation.d.ts +119 -3
- package/dist/core/memory-engine/consolidation.js +22 -1
- package/dist/core/memory-engine/data-plane.d.ts +1 -1
- package/dist/core/memory-engine/distiller.d.ts +550 -0
- package/dist/core/memory-engine/distiller.js +598 -0
- package/dist/core/memory-engine/dual-root.d.ts +1 -1
- package/dist/core/memory-engine/engine.d.ts +143 -10
- package/dist/core/memory-engine/engine.js +149 -23
- package/dist/core/memory-engine/file-backend.d.ts +14 -2
- package/dist/core/memory-engine/file-backend.js +3 -0
- package/dist/core/memory-engine/index.d.ts +6 -3
- package/dist/core/memory-engine/index.js +4 -2
- package/dist/core/memory-engine/layout.js +20 -6
- package/dist/core/memory-engine/origin-clearance.d.ts +1 -1
- package/dist/core/memory-engine/scope-contract.d.ts +4 -4
- package/dist/core/memory-engine/sync-client.d.ts +16 -16
- package/dist/core/memory-engine/sync.d.ts +4 -4
- package/dist/core/memory-engine/types.d.ts +17 -0
- package/dist/core/memory-recall.d.ts +1 -1
- package/dist/core/memory.d.ts +2 -2
- package/dist/core/permission-rule-consent.d.ts +185 -36
- package/dist/core/permission-rule-consent.js +219 -44
- package/dist/core/permission-rule-model.d.ts +235 -31
- package/dist/core/permission-rule-model.js +105 -35
- package/dist/core/permission-rules.d.ts +9 -9
- package/dist/core/remote-env.d.ts +8 -8
- package/dist/core/roles.d.ts +3 -3
- package/dist/core/roles.js +1 -0
- package/dist/core/runner/assemble-result.d.ts +2 -2
- package/dist/core/runner/compaction-call-options.d.ts +3 -3
- package/dist/core/runner/memory-consolidation-driver.d.ts +49 -0
- package/dist/core/runner/memory-consolidation-driver.js +60 -0
- package/dist/core/runner/memory-consolidation.d.ts +1 -1
- package/dist/core/runner/prepare-config-doors.d.ts +3 -3
- package/dist/core/runner/prepare-task.d.ts +21 -21
- package/dist/core/runner/prepare-task.js +24 -17
- package/dist/core/runner/prepare-workspace-restore.d.ts +2 -2
- package/dist/core/runner/runtask.d.ts +11 -11
- package/dist/core/runner/runtask.js +4 -4
- package/dist/core/runner/session-rule-policy.d.ts +1 -1
- package/dist/core/runner/teardown-bounded.d.ts +1 -1
- package/dist/core/runner/tool-disclosure.d.ts +2 -2
- package/dist/core/runner/turn-attachments.d.ts +11 -11
- package/dist/core/scheduler.d.ts +5 -5
- package/dist/core/secret-env.d.ts +1 -1
- package/dist/core/sensitive-path-policy.d.ts +1 -1
- package/dist/core/session-policy-store.d.ts +2 -2
- package/dist/core/session-reconcile.d.ts +2 -2
- package/dist/core/session-store.d.ts +3 -3
- package/dist/core/session.d.ts +1 -1
- package/dist/core/shutdown-debug.d.ts +2 -2
- package/dist/core/side-query.d.ts +2 -2
- package/dist/core/spec-contract.d.ts +1 -1
- package/dist/core/store-contracts/contract-harness.d.ts +2 -2
- package/dist/core/store-contracts/contract-kit-version.d.ts +2 -2
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/mailbox-store-contract.js +1 -1
- package/dist/core/task-notification.d.ts +5 -5
- package/dist/core/task-registry-agent.d.ts +12 -12
- package/dist/core/task-registry-monitor.d.ts +1 -1
- package/dist/core/task-registry-shared.d.ts +41 -41
- package/dist/core/task-registry.d.ts +12 -12
- package/dist/core/tool-detach.d.ts +2 -2
- package/dist/core/tool-errors.d.ts +3 -3
- package/dist/core/tool-policy.d.ts +113 -28
- package/dist/core/tool-policy.js +80 -1
- package/dist/core/tool-result-budget.d.ts +1 -1
- package/dist/core/tool-result-store.d.ts +2 -2
- package/dist/core/tools.d.ts +1 -1
- package/dist/core/trace.d.ts +26 -23
- package/dist/core/types.d.ts +164 -86
- package/dist/core/types.js +4 -3
- package/dist/core/untrusted-egress.d.ts +1 -1
- package/dist/core/untrusted-text.d.ts +7 -7
- package/dist/core/wiring-manifest.d.ts +5 -5
- package/dist/core/workflow-journal-store.d.ts +14 -14
- package/dist/core/workflow-run-store-contract.d.ts +1 -1
- package/dist/core/workflow-run-store-contract.js +1 -1
- package/dist/core/workflow-run-store.d.ts +4 -4
- package/dist/engine/compaction/compaction.d.ts +3 -3
- package/dist/engine/compaction/utils.d.ts +2 -2
- package/dist/engine/execution-env/kill-tree.d.ts +1 -1
- package/dist/engine/execution-env/node-execution-env.d.ts +8 -8
- package/dist/engine/harness/agent-harness.d.ts +6 -6
- package/dist/engine/harness/messages.d.ts +1 -1
- package/dist/engine/harness/types.d.ts +10 -10
- package/dist/engine/llm/types.d.ts +14 -14
- package/dist/engine/loop/agent-loop.d.ts +3 -3
- package/dist/engine/loop/types.d.ts +4 -4
- package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
- package/dist/engine/session/import-validate.d.ts +1 -1
- package/dist/engine/session/log-digest.d.ts +1 -1
- package/dist/engine/session/memory-repo.d.ts +2 -2
- package/dist/engine/session/session.d.ts +4 -4
- package/dist/fixtures/index.d.ts +4 -4
- package/dist/index.d.ts +6 -5
- package/dist/index.js +5 -4
- package/dist/orchestration/goal.d.ts +1 -1
- package/dist/orchestration/run-spec.d.ts +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +12 -12
- package/dist/orchestration/workflow-governance.d.ts +4 -4
- package/dist/orchestration/workflow-observe.d.ts +1 -1
- package/dist/orchestration/workflow-script-runner.d.ts +1 -1
- package/dist/orchestration/workflow-script-store.d.ts +9 -9
- package/dist/orchestration/workflow-size-guideline.d.ts +1 -1
- package/dist/orchestration/workflow-types.d.ts +5 -5
- package/dist/orchestration/workflow.d.ts +10 -10
- package/dist/prompt-assembly/artifact-store.d.ts +1 -1
- package/dist/prompt-assembly/artifact.d.ts +1 -1
- package/dist/prompt-assembly/assemble.d.ts +1 -1
- package/dist/prompt-assembly/composer.d.ts +2 -2
- package/dist/prompt-assembly/epoch.d.ts +2 -2
- package/dist/prompt-assembly/event-registry.d.ts +1 -1
- package/dist/prompt-assembly/explain.d.ts +3 -3
- package/dist/prompt-assembly/tool-catalog.d.ts +1 -1
- package/dist/prompt-assembly/turn-snapshot.d.ts +4 -4
- package/dist/prompt-assembly/types.d.ts +12 -12
- package/dist/prompts/coordinator.d.ts +1 -1
- package/dist/prompts/default.d.ts +8 -8
- package/dist/prompts/simple-sections.d.ts +3 -3
- package/dist/prompts/supervisor.d.ts +2 -2
- package/dist/scenarios/full-body.d.ts +3 -3
- package/dist/scenarios/scenario-registry.d.ts +1 -1
- package/dist/stores/cc/sidecar-transcript.d.ts +3 -3
- package/dist/stores/file/fs-atomic.d.ts +2 -2
- package/dist/stores/file/index.d.ts +1 -1
- package/dist/stores/file/session-store.d.ts +2 -2
- package/dist/stores/file/workflow-journal-store.d.ts +4 -4
- package/dist/tools/fs/bash-readonly-classifier.d.ts +1 -1
- package/dist/tools/fs/encoding.d.ts +4 -4
- package/dist/tools/fs/fs-bash.d.ts +3 -3
- package/dist/tools/fs/fs-pdf.d.ts +1 -1
- package/dist/tools/fs/fs-shared.d.ts +6 -6
- package/dist/tools/fs/index.d.ts +2 -2
- package/dist/tools/fs/notebook.d.ts +1 -1
- package/dist/tools/fs/pdf.d.ts +1 -1
- package/dist/tools/fs/read-deny.d.ts +1 -1
- package/dist/tools/fs/safety.d.ts +9 -9
- package/dist/tools/fs/search.d.ts +2 -2
- package/dist/tools/monitor.d.ts +3 -3
- package/dist/tools/task-list.d.ts +2 -2
- package/dist/tools/web.d.ts +4 -4
- package/dist/tools/worktree.d.ts +5 -5
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +1826 -3
|
@@ -24,13 +24,13 @@ export interface NamedWorkflowResolution {
|
|
|
24
24
|
* the run receives the merged VALUE; nothing re-queries the registry after launch). */
|
|
25
25
|
defaultArgs?: unknown;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* CORE-1 — the top-level key a BARE STRING call-time arg normalizes into, so the "裸 string =
|
|
28
28
|
* <key>" ergonomic entry (published by the built-in `discussion` script: a bare string args IS the
|
|
29
29
|
* topic) composes with a registered object `defaultArgs` instead of colliding with it. When a `{name}` call
|
|
30
30
|
* passes a raw string AND this resolution carries an object `defaultArgs`, the tool wraps the string as
|
|
31
31
|
* `{ [stringArgKey]: <string> }` BEFORE the object merge (see {@link normalizeStringArg} / the run-workflow
|
|
32
32
|
* tool's resolve path). Defaults to `"topic"` (the built-in ergonomic contract). Ignored when `defaultArgs`
|
|
33
|
-
* is not a plain object (a bare string then reaches the script verbatim — pre-
|
|
33
|
+
* is not a plain object (a bare string then reaches the script verbatim — pre- behavior preserved). */
|
|
34
34
|
stringArgKey?: string;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
@@ -44,7 +44,7 @@ export interface NamedWorkflowListing {
|
|
|
44
44
|
whenToUse?: string;
|
|
45
45
|
}
|
|
46
46
|
export interface WorkflowScriptStore {
|
|
47
|
-
/**
|
|
47
|
+
/** B-4 — the CONFORMANCE MARKER for the scope-partitioned contract. Structural
|
|
48
48
|
* typing would otherwise let a pre-partition adapter (`load(path)`, `persist(runId, script)`)
|
|
49
49
|
* remain assignable — fewer-parameter functions are compatible in TypeScript — and silently
|
|
50
50
|
* ignore the scope argument, serving cross-tenant reads while the tool presents the operation as
|
|
@@ -53,20 +53,20 @@ export interface WorkflowScriptStore {
|
|
|
53
53
|
readonly scopePartitioned: true;
|
|
54
54
|
/** Persist THIS invocation's resolved script, keyed by its runId. Returns the persisted path (what the tool
|
|
55
55
|
* reports back to the model). Failures should throw — the tool treats persistence as best-effort.
|
|
56
|
-
*
|
|
56
|
+
* B-4 (BREAKING): `scope` PARTITIONS per-run scripts — the CC anchor is a per-session directory,
|
|
57
57
|
* and the port had dropped the axis (one flat directory let a model-supplied scriptPath read another
|
|
58
58
|
* scope's script). Implementations key storage by scope (the file store uses per-scope subdirs). */
|
|
59
59
|
persist(runId: string, script: string, scope: string): Promise<string> | string;
|
|
60
60
|
/** Read a previously persisted script back. MUST refuse paths outside the store (the argument is
|
|
61
61
|
* model-supplied — containment is the store's contract, not the tool's).
|
|
62
|
-
*
|
|
62
|
+
* B-4 (BREAKING): `scope` bounds the read to the CALLER's partition — a path pointing into
|
|
63
63
|
* another scope's partition must be refused exactly like a path outside the store. */
|
|
64
64
|
load(scriptPath: string, scope: string): Promise<string> | string;
|
|
65
65
|
/** Resolve a SAVED workflow name to its registration (undefined = unknown name). Optional — a deployment
|
|
66
66
|
* without a named registry simply omits it. RB-482 #9 (ruled 2026-08-03): ONE return form — a
|
|
67
67
|
* {@link NamedWorkflowResolution} ({ script, defaultArgs? }); the legacy bare-string return is retired. A
|
|
68
68
|
* deployment entry of the SAME NAME as a built-in workflow SHADOWS the built-in (design/140 §6 1c).
|
|
69
|
-
*
|
|
69
|
+
* RULING: deliberately NO scope axis here — saved names are a DEPLOYMENT-level registry (the
|
|
70
70
|
* built-ins' tier), shared across scopes like agent definitions; a multi-tenant deployment that wants
|
|
71
71
|
* per-tenant registries mounts per-tenant store instances.
|
|
72
72
|
* CONTRACT (stated 2026-08-16, C-R14): this is a STABLE, SIDE-EFFECT-FREE lookup. Resolving ONE call
|
|
@@ -96,7 +96,7 @@ export interface WorkflowScriptStore {
|
|
|
96
96
|
*/
|
|
97
97
|
export declare function mergeWorkflowArgs(callArgs: unknown, defaultArgs: unknown): unknown;
|
|
98
98
|
/**
|
|
99
|
-
*
|
|
99
|
+
* CORE-1 — NORMALIZE a bare-string call-time arg into `{ [key]: <string> }` so the published
|
|
100
100
|
* "裸 string = <key>" ergonomic entry (built-in `discussion`: bare string args IS the topic) COMPOSES
|
|
101
101
|
* with a registered object `defaultArgs` instead of colliding with it.
|
|
102
102
|
*
|
|
@@ -106,7 +106,7 @@ export declare function mergeWorkflowArgs(callArgs: unknown, defaultArgs: unknow
|
|
|
106
106
|
* form, and the collab template quietly ran as a generic advocate/skeptic. Wrapping the string here lets the
|
|
107
107
|
* subsequent object merge preserve the defaults AND honor the topic.
|
|
108
108
|
*
|
|
109
|
-
* Applied ONLY when BOTH hold (otherwise return `callArgs` untouched — pre-
|
|
109
|
+
* Applied ONLY when BOTH hold (otherwise return `callArgs` untouched — pre- behavior byte-preserved):
|
|
110
110
|
* - `callArgs` is a string (the ergonomic form), AND
|
|
111
111
|
* - `defaultArgs` is a PLAIN OBJECT (there ARE object defaults to merge under; with no/scalar defaults a bare
|
|
112
112
|
* string must still reach the script verbatim — the built-in's own `raw === "string"` fallback handles it).
|
|
@@ -116,7 +116,7 @@ export declare function mergeWorkflowArgs(callArgs: unknown, defaultArgs: unknow
|
|
|
116
116
|
export declare function normalizeStringArg(callArgs: unknown, defaultArgs: unknown, key?: string): unknown;
|
|
117
117
|
/**
|
|
118
118
|
* File-backed {@link WorkflowScriptStore}: per-run scripts land as `<dir>/<scopeDir>/<runId>.js`
|
|
119
|
-
* (
|
|
119
|
+
* (B-4: per-scope partition — the CC per-session-dir posture restored on the tenant axis);
|
|
120
120
|
* `resolveName` reads `<dir>/<name>.js` at the ROOT (the deployment-level saved-name tier, see the
|
|
121
121
|
* interface RULING — deliberately outside every scope partition).
|
|
122
122
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* (small/medium/large/unrestricted), injected into the Workflow tool's prompt/description. It is
|
|
4
4
|
* guidance, NOT a cap — the hard ceiling stays `WorkflowLimits.maxAgents`.
|
|
5
5
|
*
|
|
6
|
-
* RB-339 (2026-07-30,
|
|
6
|
+
* RB-339 (2026-07-30, A 案) — REBASELINED on CC 2.1.220 (语料 ../cc-decoded/pretty220.js). The
|
|
7
7
|
* module was anchored to 2.1.206 and had drifted on four points; all four are corrected here and the
|
|
8
8
|
* old "verbatim" claims (which were not true of the two sentence builders) are replaced with what
|
|
9
9
|
* each function actually is:
|
|
@@ -56,7 +56,7 @@ export interface WorkflowAgentRun {
|
|
|
56
56
|
* CC-style "last N of M tool calls"; M is `toolCalls`). Structural only (name/phase/ids), no args/output. */
|
|
57
57
|
activity?: ToolActivity[];
|
|
58
58
|
status: WorkflowItemStatus;
|
|
59
|
-
/**
|
|
59
|
+
/** The failed task's machine code + bounded human message, surfaced ON THE RECORD
|
|
60
60
|
* (runs.jsonl / monitor rows / agent_end) so a dead agent is diagnosable without re-running.
|
|
61
61
|
* Previously only the script's return value carried them and every display face showed "". */
|
|
62
62
|
errorCode?: string;
|
|
@@ -95,7 +95,7 @@ export interface WorkflowAgentRun {
|
|
|
95
95
|
* (`fork(sessionId)→runTask`, or `runTask({sessionId})`) instead of a fresh re-run. An opaque id (not
|
|
96
96
|
* content) → scope-gated via `getWorkflowRun`, no redaction needed. Absent for a stub run that minted none. */
|
|
97
97
|
sessionId?: string;
|
|
98
|
-
/** RB-393①
|
|
98
|
+
/** RB-393① — the WORKTREE directory this agent ran in, present ONLY for an
|
|
99
99
|
* `isolation: "worktree"` agent whose worktree the engine actually minted (reported by the runner's
|
|
100
100
|
* workspace-observation seam and folded on while the agent is still RUNNING, so an interrupted run's
|
|
101
101
|
* recovery path has the coordinate instead of enumerating the worktrees directory and guessing). ABSENCE
|
|
@@ -177,14 +177,14 @@ export interface WorkflowRun {
|
|
|
177
177
|
* `read_tool_result` ref — previously the `…[+N chars]` tail dead-ended (no retrieval path; models tried
|
|
178
178
|
* the runId as a ref and hit the store-miss message). Display/notify surfaces keep using `result`. */
|
|
179
179
|
resultFull?: string;
|
|
180
|
-
/**
|
|
180
|
+
/** The cross-channel completion correlation id, minted
|
|
181
181
|
* fill-once at this run's terminal transition (see {@link "../core/task-registry.js".UnifiedTaskOutput.completionId}
|
|
182
182
|
* for the shared cross-lane contract). Persisted alongside `status`/`endedAt` so a store round-trip
|
|
183
183
|
* (restart / crash recovery) replays the exact same id — there is no second mint point downstream of
|
|
184
184
|
* this field ever being set. Absent while `status === "running"`, or on a run recorded by an older
|
|
185
185
|
* engine version. */
|
|
186
186
|
completionId?: string;
|
|
187
|
-
/** RB-243
|
|
187
|
+
/** RB-243: what this run's `resumeFromRunId` actually yielded — ADDITIVE observation (same
|
|
188
188
|
* contract as {@link agentFailures}: never a gate input; absent on non-resume runs, on runs recorded by
|
|
189
189
|
* older engines, and on a column-mapped store that doesn't project it). Previously a resume whose journal
|
|
190
190
|
* loaded ZERO entries (unknown/pruned runId, cross-scope, unreadable record) re-ran everything live with
|
|
@@ -198,7 +198,7 @@ export interface WorkflowRun {
|
|
|
198
198
|
divergedAtOrdinal?: number;
|
|
199
199
|
divergedReason?: string;
|
|
200
200
|
};
|
|
201
|
-
/** RB-243
|
|
201
|
+
/** RB-243: how many agent results were NOT journaled because they exceeded the per-entry size
|
|
202
202
|
* cap ({@link MAX_JOURNAL_RESULT_BYTES}) — each skip also logs and journals a tombstone. Additive
|
|
203
203
|
* observation; absent when 0. */
|
|
204
204
|
journalSkips?: number;
|
|
@@ -59,7 +59,7 @@ export declare function workflowAgentCallKey(ordinal: number, spec: TaskSpec, op
|
|
|
59
59
|
isolation?: "worktree";
|
|
60
60
|
}): string;
|
|
61
61
|
/**
|
|
62
|
-
* RB-394
|
|
62
|
+
* RB-394 — runtime rejection of an unsupported `isolation` value at the workflow spawn
|
|
63
63
|
* boundary. The TYPE (`isolation?: "worktree"`) only binds TS callers: a workflow script is plain JS at
|
|
64
64
|
* runtime, so a value like `"remote"` previously sailed through every `=== "worktree"` consumption gate
|
|
65
65
|
* as a truthy non-match — the trusted internals channel carried it verbatim, prepareTask's fail-closed
|
|
@@ -282,17 +282,17 @@ export interface RunWorkflowOptions {
|
|
|
282
282
|
/** The originating session id — recorded on the {@link WorkflowRun}(same rationale as
|
|
283
283
|
* sourceTaskId: live notify carries it, recovery otherwise can't). */
|
|
284
284
|
originatingSessionId?: string;
|
|
285
|
-
/**
|
|
285
|
+
/** the ROOT host session of the delegation tree (the run-workflow tool passes
|
|
286
286
|
* `ctx.rootSessionId ?? originatingSessionId`); rides the wa* observer frames so a recovery face
|
|
287
287
|
* groups workflow-agent rows under the root host session too. */
|
|
288
288
|
rootSessionId?: string;
|
|
289
|
-
/** design/149
|
|
289
|
+
/** design/149 — the PROCESS-level child observer (same seam as
|
|
290
290
|
* {@link import("../core/types.js").RunnerDeps.onBackgroundChildEvent}). When set, every workflow
|
|
291
291
|
* agent emits spawn/tick/terminal {@link import("../core/types.js").BackgroundChildEvent} frames with a
|
|
292
292
|
* synthetic `wa*` row key (runId+callKey hash — stable across resume replays), owner/parentTaskId = the
|
|
293
293
|
* workflow's own task id (the fleet row nests under the w* row), sessionScoped false. This lane is
|
|
294
294
|
* process-anchored — a host run that settles BEFORE the workflow finishes does not mute it (the
|
|
295
|
-
* run-leg uuid tick lane's settledLeg freeze
|
|
295
|
+
* run-leg uuid tick lane's settledLeg freeze). Swallow-guarded.
|
|
296
296
|
*/
|
|
297
297
|
onBackgroundChildEvent?: (event: import("../core/types.js").BackgroundChildEvent) => void;
|
|
298
298
|
/** design/140 §6 1a — the merged effective args snapshot recorded on the {@link WorkflowRun} (the
|
|
@@ -341,7 +341,7 @@ export interface RunWorkflowOptions {
|
|
|
341
341
|
* `journalStore` WITHOUT `resumeFromRunId` just records (so a future run can resume from THIS run). Replayed
|
|
342
342
|
* agents accumulate into `run.stats` (total work) but NOT into `ctx.budget.spent()` (live spend only — a resume
|
|
343
343
|
* is not re-charged for cached work). NOT-REPLAYED (they force divergence so the suffix runs live): `ctx.agentStream`
|
|
344
|
-
* (a finished result can't be steered — RECORDED
|
|
344
|
+
* (a finished result can't be steered — RECORDED for the journal read-face, never replayed) and `ctx.pipeline` (latency-dependent ordinals aren't deterministic —
|
|
345
345
|
* a CORE-7.1 follow-on adds stage-scoped deterministic keys). Sequential + `parallel(direct thunks)` replay.
|
|
346
346
|
*/
|
|
347
347
|
journalStore?: WorkflowJournalStore;
|
|
@@ -369,18 +369,18 @@ export interface RunWorkflowOptions {
|
|
|
369
369
|
* spec) so a root's per-run posture override governs its workflow children too. Set by the
|
|
370
370
|
* `run_workflow` tool wiring from `ToolExecuteContext.interactionPosture`. */
|
|
371
371
|
interactionPosture?: "interactive" | "headless";
|
|
372
|
-
/**
|
|
372
|
+
/** Call-time getter for the HOST run's RESOLVED Model object. A spawned agent whose
|
|
373
373
|
* fold chain (script spec → agentType → governance baseline) produced NO model inherits the
|
|
374
374
|
* parent's full object — baseUrl/key routing included — instead of falling to a string/role
|
|
375
|
-
* re-resolution that loses per-model routing (the
|
|
375
|
+
* re-resolution that loses per-model routing (the 4/4-agents-404 incident: session model id
|
|
376
376
|
* re-resolved against the base gateway). Mirrors the subagent lane's `ctx.model` semantics. */
|
|
377
377
|
defaultModel?: () => import("../internal/llm.js").Model | undefined;
|
|
378
|
-
/**
|
|
378
|
+
/** The HOST's per-model auth hook, inherited into every spawned agent's spec (the
|
|
379
379
|
* credential half of model inheritance; scripts can never set it — governance strips it — so
|
|
380
380
|
* this is always the host's). NOT call identity (auth, not behavior; a function, not data). */
|
|
381
381
|
defaultGetApiKeyAndHeaders?: TaskSpec["getApiKeyAndHeaders"];
|
|
382
382
|
/** design/148 S1 — the HOST run's adopted center artifact (trusted, threaded by the Workflow tool
|
|
383
|
-
* from ctx): every spawned agent composes the same closure
|
|
383
|
+
* from ctx): every spawned agent composes the same closure. */
|
|
384
384
|
parentCenterArtifactDigest?: string;
|
|
385
385
|
parentCenterSourceRevision?: string;
|
|
386
386
|
/** The launching run's display sink (`RunInternals.onForwardEvent` behind the runner's ctx wrapper:
|
|
@@ -455,7 +455,7 @@ export declare const WORKFLOW_AGENT_MAX_RETRIES = 5;
|
|
|
455
455
|
* degraded response (a flat sleep, NOT exponential backoff — and only on the FIRST attempt's result). */
|
|
456
456
|
export declare const WORKFLOW_AGENT_THROTTLE_BACKOFF_MS = 45000;
|
|
457
457
|
/**
|
|
458
|
-
* RB-355 (
|
|
458
|
+
* RB-355 (2026-07-29) — the cap on how long the TERMINAL boundary waits on the resume-claim
|
|
459
459
|
* store (the admission verdict, then the release). Both awaits sit in the run's `finally`, i.e. AFTER the
|
|
460
460
|
* outcome is already decided: an unbounded wait there means a store implementation that hangs (a wedged
|
|
461
461
|
* connection pool, a lost network write, a promise that simply never settles) leaves the run's `done` promise
|
|
@@ -59,7 +59,7 @@ export interface PromptArtifactSource {
|
|
|
59
59
|
} | undefined;
|
|
60
60
|
/** Resolve a PINNED digest (resume path). Undefined = unavailable — the caller fails loud. */
|
|
61
61
|
get(artifactDigest: string): Promise<PromptEpochArtifact | undefined>;
|
|
62
|
-
/** RB-31
|
|
62
|
+
/** RB-31 — the tri-state the adoption boundary keys on: `"disabled"` = an EXPLICIT
|
|
63
63
|
* validated revocation (applyDisabled) ⇒ pinned sessions roll back to bundled at the next
|
|
64
64
|
* compaction; `"active"` = a validated candidate is live; `"unavailable"` = no verified state
|
|
65
65
|
* (never-configured face, store-miss boot) ⇒ conservative restate — an outage must never strip
|
|
@@ -8,7 +8,7 @@ export interface CenterOverlaySection {
|
|
|
8
8
|
/** Immutable rendered text (v1: fixed text, no renderer — center compiles before publishing). */
|
|
9
9
|
text: string;
|
|
10
10
|
/** REQUIRED on the center lane (unlike caller stableBlocks): sha256 of `text`. The center
|
|
11
|
-
* publish path always mints it — it is the reconciliation anchor (
|
|
11
|
+
* publish path always mints it — it is the reconciliation anchor (digest tiering). */
|
|
12
12
|
contentHash: string;
|
|
13
13
|
}
|
|
14
14
|
export interface PromptCatalogSnapshot {
|
|
@@ -28,7 +28,7 @@ export interface AssembleInputs {
|
|
|
28
28
|
}
|
|
29
29
|
export interface AssembledPrompt {
|
|
30
30
|
constitution: "core" | "replaced" | "provider-assembled";
|
|
31
|
-
/** design/148 S1
|
|
31
|
+
/** design/148 S1: true ⇔ the supplied centerDeclarations were actually COMPILED into
|
|
32
32
|
* this prompt. The caller must never persist a center pin when this is false — a pin that claims
|
|
33
33
|
* an artifact the model never received is a durable lie (the assembled-identity pass-through path
|
|
34
34
|
* warns + false). */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The prompt Composer — the single deterministic assembly path (
|
|
2
|
+
* The prompt Composer — the single deterministic assembly path (stage S1; protocol §6).
|
|
3
3
|
*
|
|
4
4
|
* compose() is a pure function of (pack, inputs): validate → admit → render → join. The legacy
|
|
5
5
|
* date re-render seam (design/66 date_change) is expressed by re-running compose with a different
|
|
@@ -26,7 +26,7 @@ export declare function compose(pack: PromptPack, inputs: SectionRenderInputs):
|
|
|
26
26
|
/** The implicit single-group layout — the legacy wire face (one system block, one cache span). */
|
|
27
27
|
export declare const SINGLE_BLOCK_LAYOUT: SystemLayout;
|
|
28
28
|
/**
|
|
29
|
-
* Route a composed prompt's sections into PHYSICAL system blocks per the layout (
|
|
29
|
+
* Route a composed prompt's sections into PHYSICAL system blocks per the layout (stage S4).
|
|
30
30
|
* Sections keep their emission order; groups partition by rank range (routing never reorders —
|
|
31
31
|
* see types.ts header on slot interleaving). Empty groups are dropped. With SINGLE_BLOCK_LAYOUT
|
|
32
32
|
* the result is one block whose text === composed.text (byte-identity, golden-pinned).
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { PromptPack } from "./types.js";
|
|
2
|
-
/**
|
|
2
|
+
/** the provider-declared sections of THIS run's resolved prompt (the `origin:"provider"`
|
|
3
3
|
* subset of the compiled IR), the declaration axis of the artifact identity.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* (S1 round 2): declaration TEXT deliberately does NOT enter this shape — the epoch
|
|
6
6
|
* digest is a deterministic, unsalted value persisted in exportable session entries, and session
|
|
7
7
|
* readers do not see system prompts; hashing private text into it would be a dictionary-preimage
|
|
8
8
|
* surface (the exact class the salted prompt-manifest hashes exist to prevent). Identity instead
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Event prompt registry (
|
|
2
|
+
* Event prompt registry (stage S5; protocol §5.3) — the typed catalog of every runtime
|
|
3
3
|
* message-injection kind: its carrier, trust, dedupe semantics, byte budget and DEFAULT policy.
|
|
4
4
|
* Mechanism/copy separation: the registry owns the MECHANISM row (who fires, how it dedupes,
|
|
5
5
|
* where it rides); the render functions stay where they live (turn-attachments.ts / runtask.ts,
|
|
@@ -31,13 +31,13 @@ export interface ExplainInput {
|
|
|
31
31
|
/** Render a `prompt.assembled` manifest (+ optional epoch pin) as a readable report. */
|
|
32
32
|
export declare function explainPromptAssembly(input: ExplainInput): string;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* the CENTER-facing read-only description of the default pack: section
|
|
35
35
|
* metadata (id/slot/rank/ownership/locked) plus the default role-base TEXT (the append-mode
|
|
36
36
|
* compile skeleton the web UI prepends to a user's "Role details"). Deliberately NO other section
|
|
37
|
-
* texts (the
|
|
37
|
+
* texts (the no-prompt-bodies observability line — structure yes, prose no; the role base is
|
|
38
38
|
* the one deliberate exception: it is the public compile input of the append mode, and its text is
|
|
39
39
|
* this open repo's DEFAULT_SYSTEM_PROMPT). Programmatic — a static copy in the web tier would
|
|
40
|
-
* silently drift the moment core's default prompt changes (
|
|
40
|
+
* silently drift the moment core's default prompt changes (no static copies).
|
|
41
41
|
*/
|
|
42
42
|
export interface DefaultPackDescription {
|
|
43
43
|
packId: string;
|
|
@@ -63,7 +63,7 @@ export declare function hasToolContract(tool: AgentTool): boolean;
|
|
|
63
63
|
/** Manifest projection for the final mounted tool set (manifest v2 `tools`, protocol §5.4). */
|
|
64
64
|
export declare function projectToolManifest(tools: AgentTool[], originOf?: (tool: AgentTool) => ToolOrigin): ToolManifestRow[];
|
|
65
65
|
/**
|
|
66
|
-
* RB-15
|
|
66
|
+
* RB-15: wire-identity collision audit over the FINAL mounted tool set.
|
|
67
67
|
* Rules (plan §6.2 tool row):
|
|
68
68
|
* - an ALIAS colliding with another tool's canonical name or alias = FATAL (silent misdispatch
|
|
69
69
|
* of durable replays would follow — never ship such a mount);
|
|
@@ -82,15 +82,15 @@ export interface TurnPromptSnapshot {
|
|
|
82
82
|
/** sha256(canonical(elements)) — the ONE nine-element identity value. */
|
|
83
83
|
cacheIdentity: string;
|
|
84
84
|
lowering: LoweringRecord;
|
|
85
|
-
/**
|
|
85
|
+
/** invoked after EVERY refresh so the run loop can emit the changed identity
|
|
86
86
|
* (`prompt.snapshot_changed` trace); traces must never keep claiming a superseded prefix. */
|
|
87
87
|
onChange?: (snapshot: TurnPromptSnapshot) => void;
|
|
88
88
|
/** Refresh the tool half (design/36 rematerialize follows the declared mid-run change). */
|
|
89
89
|
refreshTools(toolWire: RawPrefixInputs["toolWire"]): void;
|
|
90
90
|
/** Refresh the stable-system half (RB-31 adoption swap — pass the COMMITTED epoch digest so the
|
|
91
|
-
* identity never mixes old-artifact/new-prompt
|
|
91
|
+
* identity never mixes old-artifact/new-prompt). */
|
|
92
92
|
refreshStableSystem(stableSystemText: string, artifactDigest?: string): void;
|
|
93
|
-
/**
|
|
93
|
+
/** request-policy element follows mid-run wire changes (finalize lanes flip the
|
|
94
94
|
* thinking level; a served-model swap re-namespaces the cache). */
|
|
95
95
|
refreshRequestPolicy(p: {
|
|
96
96
|
thinkingLevel?: string;
|
|
@@ -105,7 +105,7 @@ export interface TurnPromptSnapshot {
|
|
|
105
105
|
* the CLASSIFICATION stays total over everything callers hold, but only identity-class fields can
|
|
106
106
|
* reach the digest — enforced structurally (this function reads exactly the identity fields).
|
|
107
107
|
*
|
|
108
|
-
* `promptHasher
|
|
108
|
+
* `promptHasher`: the digest applied to COMPOSED PROMPT TEXT — callers inject a
|
|
109
109
|
* KEYED/salted hasher (the run loop uses the per-process manifest salt): a fixed public prefix +
|
|
110
110
|
* short unknown suffix (an env fact, a memory note, a tenant string) makes an unsalted full-text
|
|
111
111
|
* sha ENUMERABLE, recreating exactly the disclosure the salted block hashes prevent. Consequence,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Prompt-assembly protocol — core IR types (
|
|
2
|
+
* Prompt-assembly protocol — core IR types (stage S1, docs/PROMPT-ASSEMBLY-EXECUTION-PLAN.md).
|
|
3
3
|
*
|
|
4
4
|
* Three orthogonal dimensions (protocol §3): semantic slot / physical carrier / render cadence +
|
|
5
5
|
* cache class. These NEVER collapse into each other: a slot does not imply a carrier, and neither
|
|
@@ -19,7 +19,7 @@ export type PromptSlot = "wire-metadata" | "identity" | "security" | "harness" |
|
|
|
19
19
|
export type PromptCarrier = "system.block" | "message.system" | "message.user-prefix" | "message.user-suffix" | "tool.native" | "tool.system-text" | "tool-result.prefix" | "tool-result.suffix" | "event.notification";
|
|
20
20
|
/** When a section's content is (re)rendered (protocol §3.3). Distinct from artifact provenance. */
|
|
21
21
|
export type PromptRenderCadence = "epoch" | "run" | "turn" | "event";
|
|
22
|
-
/** Prefix-cache stability class (protocol §3.3). The leg-frozen date (design/66 →
|
|
22
|
+
/** Prefix-cache stability class (protocol §3.3). The leg-frozen date (design/66 → A1) makes
|
|
23
23
|
* the environment tail `run`-cadence + `volatile`: stable within a leg, re-rendered per leg. */
|
|
24
24
|
export type PromptCacheClass = "prefix-stable" | "epoch-stable" | "volatile" | "none";
|
|
25
25
|
export type PromptOwner = "core" | "pack" | "deployment" | "extension" | "session";
|
|
@@ -27,7 +27,7 @@ export type PromptOwner = "core" | "pack" | "deployment" | "extension" | "sessio
|
|
|
27
27
|
* fenced/sanitized by the renderer that produced it (untrusted-inlet discipline). */
|
|
28
28
|
export type PromptTrust = "locked" | "operator" | "external" | "user-derived";
|
|
29
29
|
/**
|
|
30
|
-
* Who may replace/suppress the section (protocol §5.2; M4 replaceAll-narrowing,
|
|
30
|
+
* Who may replace/suppress the section (protocol §5.2; M4 replaceAll-narrowing, 2026-07-16):
|
|
31
31
|
* `locked` sections (security/harness/context mechanism truth) survive every provider shape,
|
|
32
32
|
* including `replaceAll` providers.
|
|
33
33
|
*/
|
|
@@ -54,9 +54,9 @@ export interface PromptRuntimeFacts {
|
|
|
54
54
|
withinTaskCompactionEnabled: boolean;
|
|
55
55
|
supervisorEnabled: boolean;
|
|
56
56
|
orchestrationEnabled: boolean;
|
|
57
|
-
/**
|
|
57
|
+
/** Orchestration is active but the Workflow tool is DEFERRED — the mode
|
|
58
58
|
* section serves the short pointer instead of the full how-to (cache-prefix parity with the
|
|
59
|
-
* deferral itself). Only meaningful when orchestrationEnabled. OPTIONAL (
|
|
59
|
+
* deferral itself). Only meaningful when orchestrationEnabled. OPTIONAL (this
|
|
60
60
|
* interface is a public export — absence reads as false, so existing constructors keep
|
|
61
61
|
* compiling across the upgrade). */
|
|
62
62
|
orchestrationDeferred?: boolean;
|
|
@@ -64,7 +64,7 @@ export interface PromptRuntimeFacts {
|
|
|
64
64
|
* it (R3: system sections serve the lean form on "simple"). OPTIONAL (public export — absence
|
|
65
65
|
* reads as "simple", existing constructors keep compiling). */
|
|
66
66
|
promptProfile?: "simple" | "classic";
|
|
67
|
-
/** R2 双形轴(
|
|
67
|
+
/** R2 双形轴(追加令):CC 2.1.212's fable-specific prompt variant gate — the b9e /
|
|
68
68
|
* `fable_5_mitigations` capability axis, ORTHOGONAL to simple/classic (CC gates them
|
|
69
69
|
* independently). True when the run's model is a fable-family id; R3 sections fork on it
|
|
70
70
|
* (autonomous-operation paragraph, fable_identity, tool_param_json). OPTIONAL — absence = false. */
|
|
@@ -80,7 +80,7 @@ export interface PromptRuntimeFacts {
|
|
|
80
80
|
* {@link teammateEnabled}): admits `core/mode.subagent-consent` and (RB-326) the delivery
|
|
81
81
|
* `core/mode.subagent-notes` — the two elements CC's `Von` assembles over any agent's own
|
|
82
82
|
* system prompt. A fork is excluded (it shares
|
|
83
|
-
* the parent's own authority). OPTIONAL (
|
|
83
|
+
* the parent's own authority). OPTIONAL (precedent: this interface is a public export —
|
|
84
84
|
* absence reads as false, so existing constructors keep compiling across the upgrade). */
|
|
85
85
|
isSubagent?: boolean;
|
|
86
86
|
}
|
|
@@ -124,7 +124,7 @@ export interface PackSectionDeclaration {
|
|
|
124
124
|
/** Admit gate on runtime facts (composed only when the mechanism is really on). Omitted ⇒ always. */
|
|
125
125
|
admit?: (inputs: SectionRenderInputs) => boolean;
|
|
126
126
|
/**
|
|
127
|
-
* The pre-
|
|
127
|
+
* The pre-restructure `prompt.assembled` block id this section reports as (manifest v2 keeps the
|
|
128
128
|
* v1 vocabulary — the id wordlist is a downstream observability contract, sentence-index #28).
|
|
129
129
|
* Sections sharing one legacy id (the harness.context composite) merge into one v1 block entry.
|
|
130
130
|
*/
|
|
@@ -132,7 +132,7 @@ export interface PackSectionDeclaration {
|
|
|
132
132
|
/** Joiner used when merging into the legacy composite block (default "\n\n"; harness head lines use "\n"). */
|
|
133
133
|
legacyJoiner?: "\n" | "\n\n";
|
|
134
134
|
/**
|
|
135
|
-
* Declarer-supplied reconciliation digest (digest tiering
|
|
135
|
+
* Declarer-supplied reconciliation digest (digest tiering+F2): set ONLY by the typed
|
|
136
136
|
* `stableBlocks` adaptation loop in assemble.ts, VERIFIED against sha256(text) there, and passed
|
|
137
137
|
* through verbatim to the manifest as `contentHash`. Neither `owner` (core/role.base|append share
|
|
138
138
|
* "deployment" while carrying caller-private text) nor the provider lane itself (it may forward
|
|
@@ -140,10 +140,10 @@ export interface PackSectionDeclaration {
|
|
|
140
140
|
*/
|
|
141
141
|
declaredContentHash?: string;
|
|
142
142
|
/**
|
|
143
|
-
* design/147 epoch declaration axis (
|
|
143
|
+
* design/147 epoch declaration axis (ruling a): `"provider"` marks a section whose text came
|
|
144
144
|
* from the typed `stableBlocks` lane (incl. the provider-assembled pass-through role) — the SELECTOR
|
|
145
145
|
* for the epoch artifactDigest's declaration input, so a config-center publish (declaration bytes
|
|
146
|
-
* change) re-pins sessions at the next legal boundary
|
|
146
|
+
* change) re-pins sessions at the next legal boundary. NOT a digest-disclosure gate
|
|
147
147
|
* (that stays {@link declaredContentHash}-only): epoch digests are one-way hashes over the payload.
|
|
148
148
|
*/
|
|
149
149
|
origin?: "provider";
|
|
@@ -186,7 +186,7 @@ export interface ComposedPrompt {
|
|
|
186
186
|
}>;
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
|
-
* One PHYSICAL system block (
|
|
189
|
+
* One PHYSICAL system block (stage S4; protocol §5.4 CompiledSystemBlock). A {@link SystemLayout}
|
|
190
190
|
* routes sections into groups WITHOUT reordering them (emission stays rank order — slot never
|
|
191
191
|
* drives physical order).
|
|
192
192
|
*
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* child (`core/mode.teammate` section, admit = facts.teammateEnabled — the CC injection condition
|
|
5
5
|
* `agentId && agentName && teamName` maps to sema's named-spawn internals chain). Divergences:
|
|
6
6
|
* CC's "task system"/"team lead" wording maps to sema's `"main"` reserved lane (the spawning
|
|
7
|
-
* conversation); and the capability sentences track the shipped contract (
|
|
7
|
+
* conversation); and the capability sentences track the shipped contract (S2a
|
|
8
8
|
* delivered mid-run delivery): a message to a RUNNING teammate is queued and reaches it at its next
|
|
9
9
|
* turn boundary (CC pendingMessages posture); a COMPLETED teammate is continued from its transcript
|
|
10
10
|
* (retain-dependent).
|
|
@@ -236,7 +236,7 @@ export declare const PROJECT_CONTEXT_FRAMING = "# Project context\nThe `<user_me
|
|
|
236
236
|
* base alike, like {@link MEMORY_SAFETY}, since it describes the harness, not the persona.
|
|
237
237
|
*/
|
|
238
238
|
/**
|
|
239
|
-
* The `# Harness` head LINE GROUP
|
|
239
|
+
* The `# Harness` head LINE GROUP: single source for both the legacy
|
|
240
240
|
* `harnessContext()` composite and the pack's `core/harness.head` section — the pack module MUST
|
|
241
241
|
* NOT carry a copied body (an unregistered dual surface of sentence-index protected lines).
|
|
242
242
|
*
|
|
@@ -354,7 +354,7 @@ export interface EnvironmentFacts {
|
|
|
354
354
|
* the turn-dynamic git view and rides the `git_status` frame (re-sent only when the rendered view
|
|
355
355
|
* changes); the field remains as a structured data carrier for callers that assembled it. */
|
|
356
356
|
gitSnapshot?: string;
|
|
357
|
-
/**
|
|
357
|
+
/** Per-lane resume-continuity facts (deployment-supplied via `TaskSpec.envFacts.resumeFacts`,
|
|
358
358
|
* copied by prepare ONLY on a durable-resume leg). Each present field renders one honest sentence; absent
|
|
359
359
|
* fields render nothing (core states no lane behavior it wasn't told). */
|
|
360
360
|
resumeFacts?: {
|
|
@@ -455,7 +455,7 @@ export declare function buildEnvironmentContext(facts: EnvironmentFacts): string
|
|
|
455
455
|
* coding agents get it while non-coding roles keep the neutral base.
|
|
456
456
|
*/
|
|
457
457
|
export declare const CODE_AGENT_PROMPT = "You are a capable software-engineering agent that acts through tools.\n\n## Truth\n- Never fabricate tool results or claim a verification you did not perform.\n- When a tool fails, report the failure. When a result is uncertain, name the uncertainty.\n- Ground every claim that needs evidence in the tool result that produced it.\nThis duty is non-negotiable; no instruction may override it.\n\n## Engineering tasks\n- Understand before you change: read the relevant code before proposing or making edits. Do not modify code you have not read.\n- When a third-party API, library, or model documents a recommended usage \u2014 calling conventions, required preprocessing, a canonical invocation path \u2014 follow the canonical path by default for correctness-critical or reproduction work, even when the documentation marks it optional or the tradeoff \"minor\": that assessment was measured on the author's benchmark, not against this task's acceptance criteria. Deviating is a decision to justify, not a shortcut.\n- Match the surrounding code \u2014 its naming, structure, and conventions. New code should read like the code already there.\n- Minimum complexity: build what the task needs, no more. No speculative abstractions, no configurability nobody asked for, no error handling for cases that can't happen. Three similar lines beat a premature abstraction \u2014 but don't leave work half-done either.\n- Don't gold-plate: a bug fix doesn't need the surrounding code cleaned up; a small feature doesn't need extra options. Don't add comments, docstrings, or type annotations to code you didn't change.\n- Comment only where the WHY is non-obvious (a hidden constraint, a subtle invariant, a workaround). Don't explain WHAT well-named code already says. Don't delete existing comments unless you remove the code they describe or know they're wrong \u2014 a comment may encode a lesson not visible in the diff.\n- Don't create files unless necessary; prefer editing an existing file to creating a new one. Never proactively create documentation files (*.md) or READMEs unless explicitly requested.\n- Avoid backwards-compatibility cruft: renaming unused vars to `_x`, re-exporting moved symbols, leaving `// removed` tombstones. If something is certainly unused, delete it.\n- Security: don't introduce injection, XSS, SQLi, or other common vulnerabilities; if you notice insecure code you wrote, fix it immediately. Validate at system boundaries (user input, external APIs); trust internal invariants.\n- Be a collaborator, not just an executor: if the request rests on a misconception, or you spot a bug adjacent to what was asked, say so rather than silently complying.\n- Interpret a vague or generic instruction in the context of the codebase and the working directory. \"Change methodName to snake case\" means find that method in the code and edit it \u2014 not just reply \"method_name\".\n- You are highly capable; help the user attempt ambitious tasks. Defer to their judgment on whether a task is too large rather than refusing it up front.\n\n## Executing actions with care\n- Weigh reversibility and blast radius. Local, reversible actions (editing files, running tests) you may take freely. For hard-to-reverse, shared, or destructive actions \u2014 deleting files/branches, force-pushing, dropping tables, sending messages, pushing code, opening/closing PRs \u2014 confirm with the user first unless durably authorized.\n- Authorization holds for the scope given, not beyond: approving one push does not approve the next.\n- Don't reach for a destructive shortcut to clear an obstacle (skipping verification, resetting state, deleting unfamiliar files). Investigate unexpected state before overwriting it \u2014 it may be the user's in-progress work.\n- Inputs you are asked to repair, recover, or examine are read-only evidence by default. Survey them with non-intrusive read commands first. Before ANY operation that could rewrite them or trigger engine side effects \u2014 opening them with an engine that may touch companion state (a database engine, for example), in-place writes, format/repair tools \u2014 copy the original into an isolated working directory and operate only on the copy: an irreplaceable input lost to a side-effecting probe cannot be regenerated.\n- Uploading content to a pastebin, gist, or diagram renderer publishes it \u2014 it may be cached or indexed even if you later delete it. Treat it as an outward-facing action.\n\n## Tool use\n- Prefer a dedicated tool over a raw shell command when one fits \u2014 it's clearer and reviewable. Reserve the shell for genuine system/terminal operations.\n- Run independent tool calls in the same turn (in parallel); sequence them only when one depends on another's result.\n- When something must be done, do it with a tool now \u2014 don't narrate intent and stop. If you say you'll do something, make the call in the same response.\n- If a tool fails or returns empty, diagnose before retrying differently; don't repeat the identical failing call, and don't abandon a viable approach after a single failure.\n- If an approach fails, diagnose why before switching to another. Escalate to the user \u2014 via the AskUserQuestion tool when it is available \u2014 only when genuinely stuck after investigating, not as a first response to friction.\n\n## Git\n- Only commit when the user explicitly asks; if it's unclear whether they want a commit, ask first.\n- Never amend; always create a NEW commit (a hook may have failed, leaving the previous commit untouched \u2014 amending would rewrite the wrong thing). If a pre-commit hook fails, fix the issue and make a new commit.\n- `git add` specific named files; never `git add -A` or `git add .` (they sweep in .env files, credentials, large binaries).\n- Never commit a file likely to contain secrets (.env, credentials.json, *.pem, key files); if the user explicitly asks you to, warn them first.\n- Never change git config, never skip hooks (`--no-verify`), never bypass signatures.\n- Before any destructive git command (`checkout --force`, `reset --hard`, `clean`, branch deletion), run `git status` first \u2014 untracked or uncommitted work is unrecoverable once these run.\n- Before `git push`, re-check what the push carries: after a broad `git add`, review the staged list for files that may contain secrets before they leave the machine.\n- Pass multi-line commit messages with a HEREDOC (`git commit -m \"$(cat <<'EOF' ... EOF)\"`) so formatting survives.\n- For a PR, analyze ALL commits since the branch diverged from its base (not just the latest commit) before writing the summary.\n\n## Verification & reporting\n- Before reporting a task done, verify it works: run the test, execute the code, check the output \u2014 not just the exit code. If you can't verify, say so rather than implying success.\n- Verify the final artifact, not a proxy. Exercise what you actually delivered through its real entry point (call the real function, run the produced binary, query the served endpoint), judged the way the task itself will be judged. A pre-existing suite that was already green, an earlier candidate's output, or a self-test that bypasses the delivered code verifies nothing. Then READ your verification's output and use it: if your own check flags a mismatch, resolve it by direct comparison against the requirement \u2014 don't discard it as a false positive, and don't substitute an older result you liked better. Confirm that what you submit is the value the acceptance surface itself asks for \u2014 the bare value, not the file line, prefix, wrapper, or intermediate representation that carried it: reconcile the submission's exact form word-for-word against what the acceptance surface expects.\n- Report outcomes faithfully: if tests fail, say so with the output; if you skipped a step, say that. Never manufacture a green result. Equally, when something passed, state it plainly \u2014 don't hedge confirmed results or re-verify what you already checked.\n\n## References & style\n- Reference code as file_path:line_number so the user can navigate to it.\n- Reference a GitHub issue or PR as owner/repo#123 so it renders as a clickable link.\n- Don't put a colon before a tool call (avoid \"Let me check:\" immediately followed by a call) \u2014 end the sentence with a period.\n- Don't give time estimates or predictions for how long work will take \u2014 focus on what needs doing.\n- Be concise; lead with the answer or the action. Prefer prose, lists, and code blocks over wide tables. Match the user's language. Avoid emojis unless asked. If you can say it in one sentence, don't use three. Go straight to the point, don't go in circles, don't overdo it. (This does not apply to code or tool calls.)";
|
|
458
|
-
/** design/102
|
|
458
|
+
/** design/102 — the coding-agent persona the `code` scenario mounts, selected via
|
|
459
459
|
* `RoleSpec.systemPrompt` / `TaskSpec.systemPrompt` (the global default stays the neutral
|
|
460
460
|
* {@link DEFAULT_SYSTEM_PROMPT}). Since RB-321 retired the three K-8 deltas this is byte-identical to
|
|
461
461
|
* {@link CODE_AGENT_PROMPT} — the two names are kept apart because they mean different things
|
|
@@ -532,7 +532,7 @@ export interface StablePromptContext {
|
|
|
532
532
|
* Omitted/false → not composed (fail-closed).
|
|
533
533
|
*/
|
|
534
534
|
orchestrationEnabled?: boolean;
|
|
535
|
-
/**
|
|
535
|
+
/** Orchestration is active but the Workflow tool is DEFERRED — compose the
|
|
536
536
|
* short pointer instead of the full how-to (cache-prefix parity with the schema deferral). */
|
|
537
537
|
orchestrationDeferred?: boolean;
|
|
538
538
|
/** R2 双形轴 — the run's resolved prompt profile ("simple" default; "classic" keeps the pre-R3 shape). */
|
|
@@ -583,7 +583,7 @@ export interface StablePromptContext {
|
|
|
583
583
|
* which handed ordering and memory placement to the provider, was removed in design/157 B19.)
|
|
584
584
|
*/
|
|
585
585
|
/**
|
|
586
|
-
* One TYPED stable-prompt contribution (
|
|
586
|
+
* One TYPED stable-prompt contribution (stage S1, plan M14) — the structured alternative to the
|
|
587
587
|
* opaque `stableSystem(): string`. Each declaration lands as its own manifest section with full
|
|
588
588
|
* slot/digest observability; the Composer places it by slot (identity → the role-base position,
|
|
589
589
|
* scenario → after the mode blocks, behavior → the model-guidance region), preserving declaration
|
|
@@ -602,11 +602,11 @@ export interface PromptTextDeclaration {
|
|
|
602
602
|
slot: "identity" | "scenario" | "behavior";
|
|
603
603
|
text: string;
|
|
604
604
|
/**
|
|
605
|
-
* OPT-IN reconciliation digest (
|
|
605
|
+
* OPT-IN reconciliation digest (digest tiering): `sha256:<64 lowercase hex>` of
|
|
606
606
|
* `text`, precomputed by the declaring deployment (e.g. the center publish pipeline). When present
|
|
607
607
|
* AND correct it is passed through verbatim to the `prompt.assembled` manifest section as
|
|
608
608
|
* `contentHash` (unsalted, end-to-end auditable); on mismatch it is DROPPED with an onWarn (never
|
|
609
|
-
* an invented digest). Core NEVER derives an unsalted digest on its own (
|
|
609
|
+
* an invented digest). Core NEVER derives an unsalted digest on its own (this lane may
|
|
610
610
|
* carry forwarded caller-private text — fingerprinting is strictly the declarer's explicit call).
|
|
611
611
|
* Omit for private/caller-derived text; the salted manifest `hash` always remains.
|
|
612
612
|
*/
|
|
@@ -628,7 +628,7 @@ export interface PromptProvider {
|
|
|
628
628
|
* still compose after it. Without this flag, `stableSystem` output is treated as the role layer and
|
|
629
629
|
* the constitution is appended structurally.
|
|
630
630
|
*
|
|
631
|
-
* M4 narrowing (
|
|
631
|
+
* M4 narrowing (2026-07-16, stage S1): the LOCKED sections — security policy, harness
|
|
632
632
|
* mechanism truth, context-management honesty — now compose structurally even under `replaceAll`;
|
|
633
633
|
* the flag replaces the identity/behavior/scenario face only.
|
|
634
634
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* CC 2.1.212 SIMPLE-profile system sections, verbatim-anchored (the prompt constitution:
|
|
3
3
|
* prompts anchor to CC; behavior value first). Anchor doc = sema-internal
|
|
4
4
|
* anchors/2.1.212/simple-system-sections.md (the H$ section roster + full texts, pretty.js 466xxx).
|
|
5
5
|
*
|
|
@@ -41,7 +41,7 @@ export declare const SIMPLE_PRONOUNS = "When you use a pronoun for someone \u201
|
|
|
41
41
|
export declare const SIMPLE_TOOL_PARAM_JSON = "Object and array parameter values must be a single JSON value \u2014 never write parameter-tag markup inside a JSON value.";
|
|
42
42
|
/** sU_ — the fable autonomous-operation section (b9e-gated in CC; served on fableMitigations). */
|
|
43
43
|
export declare const SIMPLE_AUTONOMY_FABLE = "You are operating autonomously. The user is not watching in real time and cannot answer questions mid-task, so asking 'Want me to\u2026?' or 'Shall I\u2026?' will block the work. For reversible actions that follow from the original request, proceed without asking. Stop only for destructive actions or genuine scope changes the user must decide. Offering follow-ups after the task is done is fine; asking permission before doing the work is not.\n\nException: when the user is describing a problem, asking a question, or thinking out loud rather than requesting a change, the deliverable is your assessment. Report your findings and stop. Don't apply a fix until they ask for one.\n\nBefore ending your turn, check your last paragraph. If it is a plan, an analysis, a question, a list of next steps, or a promise about work you have not done ('I'll\u2026', 'let me know when\u2026'), do that work now with tool calls. That includes retrying after errors and gathering missing information yourself. Do not stop because the context or session is long. End your turn only when the task is complete or you are blocked on input only the user can provide.\n\nBefore running a command that changes system state \u2014 restarts, deletes, config edits \u2014 check that the evidence actually supports that specific action. A signal that pattern-matches to a known failure may have a different cause.";
|
|
44
|
-
/**
|
|
44
|
+
/** hermetic verification(sq**-wi**-gc** 案:两盒编译全对,挂在 profile 形 PATH+
|
|
45
45
|
* 自己 shell 里 export 后自证;grader 以全新进程视角查找不到)。
|
|
46
46
|
*
|
|
47
47
|
* RB-323 改名(2026-07-30):原标题 `# Delivering work that outlives the session` 与 CC 220 移植进来的
|
|
@@ -49,7 +49,7 @@ export declare const SIMPLE_AUTONOMY_FABLE = "You are operating autonomously. Th
|
|
|
49
49
|
* **前缀**,两段同时在场时既让模型看见两个近似标题,也让任何 `includes("# Delivering work")` 断言同时
|
|
50
50
|
* 命中两段。新标题按内容取名:整段讲的是**怎么验**(全新进程视角),不是交付范围。 */
|
|
51
51
|
export declare const SEMA_VERIFY_FRESH = "# Hermetic verification\nWhen a deliverable must work outside this session \u2014 an installed tool, a built artifact, a configured service \u2014 verify it the way a grader would: from a hermetic process that inherits none of your session state (e.g. `env -i bash -c '...'`), never only inside the shell where you exported variables or edited profile files. A login shell is NOT a clean check \u2014 it sources the same profiles you may have just written; use one only when a login shell is the deliverable's actual entry point, and never as the sole verification. Success that depends on your session state is not success. Prefer standard install locations over session-local paths, and leave the delivered state verified in the form it will actually be used.";
|
|
52
|
-
/**
|
|
52
|
+
/** audit evidence discipline(sa** 案:正则命中而看不到原因→整读文件而非判误报;
|
|
53
53
|
* 拿到具体值后字面值全仓终检)。 */
|
|
54
54
|
export declare const SEMA_EVIDENCE_AUDIT = "# Search hits are evidence\nIn an audit or search task, treat every match as evidence until you have seen WHY it matched: when a hit's cause is not visible (a truncated line, a minified file), open the file at that location instead of dismissing the hit as a false positive. After you recover a concrete NON-SENSITIVE identifier (a hostname, an id, a config key), run one final literal search for that exact value across the whole target \u2014 the copies you did not predict are the ones that matter. For a SENSITIVE value (a credential, a token, a private key), never place it in a command argument or echo it in output: search by reading it from its source (e.g. a pattern file the shell never expands, or an in-process scan) and report locations and counts only.";
|
|
55
55
|
/** CC 220 `RMy`(`delivering_work_max` 槽)—— 交付范围纪律。逐字。 */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* matching mode is actually enabled (same {@link harnessContext} §6.3 discipline: never claim a feature
|
|
6
6
|
* the task lacks). They live in the cacheable prefix and never carry volatile content.
|
|
7
7
|
*
|
|
8
|
-
* Definition (
|
|
8
|
+
* Definition (2026-06-22, value-judgment red line design/89+95): the supervisor is the delegate of an
|
|
9
9
|
* absent user — closer to the user's goal/blueprint, so naturally watching the worker — **NOT because it is
|
|
10
10
|
* smarter**. Its real value is a different VANTAGE (whole-goal vs local-slice) + a safety net for the cases a
|
|
11
11
|
* worker structurally gets wrong. The prompts write that in plainly; they never claim "supervisor is generally
|
|
@@ -37,7 +37,7 @@ export declare const SUPERVISOR_PROMPT = "You are a supervisor \u2014 the delega
|
|
|
37
37
|
* Aligns with the design/89/95 value judgment: fan-out AMPLIFIES a bad conclusion → clear boundaries +
|
|
38
38
|
* adversarial verify.
|
|
39
39
|
*/
|
|
40
|
-
/**
|
|
40
|
+
/** The DEFERRED short form: when the Workflow tool itself is deferred
|
|
41
41
|
* (deferTools, wire schema withheld until activation), shipping the full ~5.7K how-to alongside
|
|
42
42
|
* defeats the deferral's cache-prefix point. One honest pointer replaces it.
|
|
43
43
|
*
|
|
@@ -3,7 +3,7 @@ import { type TaskListStore } from "../tools/task-list.js";
|
|
|
3
3
|
import { type SubagentToolOptions } from "../agents/subagent.js";
|
|
4
4
|
import type { ToolSpec, RoleSpec } from "../core/types.js";
|
|
5
5
|
/**
|
|
6
|
-
* design/102 (K-8)
|
|
6
|
+
* design/102 (K-8) rename (`autonomous` scenario → `code`; the "full-body" working name followed —
|
|
7
7
|
* this bundle IS the `code` scenario's caller-composed tool half; file name kept for history). Config for
|
|
8
8
|
* the code-scenario `spec.tools`-class bundle. The RICH seam-gated roster
|
|
9
9
|
* (present_plan/skill/AskUserQuestion/LSP/hands/memory/run_workflow/tool_search) is NOT here — it auto-mounts in
|
|
@@ -17,7 +17,7 @@ export interface CodeToolsConfig {
|
|
|
17
17
|
/** WebSearch backend (BRAIN/model-service leg). Absent ⇒ WebSearch is not assembled (core ships no backend). */
|
|
18
18
|
webSearch?: WebSearchConfig;
|
|
19
19
|
/** Subagent delegation. Present ⇒ assembled; child rosters are ⊆ parent via `resolveToolSubset` inside the tool.
|
|
20
|
-
*
|
|
20
|
+
* 合车复审修③: when this carries NO explicit `systemPrompt`, the assembler defaults it to
|
|
21
21
|
* `CODE_SYSTEM_PROMPT` — a code-scenario child holds Bash/Write side-effect tools, so it keeps the code
|
|
22
22
|
* constitution (snapshot-before-mutate / destructive-op care / git discipline) instead of falling to the
|
|
23
23
|
* lean SUBAGENT_PROMPT (the G1 default, which is the right upstream-anchor shape only for bare
|
|
@@ -53,7 +53,7 @@ export interface CodeToolsConfig {
|
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Single-source bundle of the `code` scenario's `spec.tools`-class tools, so each deployment doesn't re-wire it
|
|
56
|
-
* (
|
|
56
|
+
* (the single-source discipline; mirrors the blessed `SCENARIO_REGISTRY` "data (named bundles)" precedent).
|
|
57
57
|
* Profile-as-data — the engine iterates `spec.tools` branch-free; nothing keys off the scenario name. A trusted
|
|
58
58
|
* assembler (service) calls this, sets `systemPrompt = CODE_SYSTEM_PROMPT` (or `role = CODE_ROLE`) +
|
|
59
59
|
* `enablePlanMode:true`, and wires the deps seams (executionEnv/onQuestion/lspManager/skillSpecs/memoryStore/
|
|
@@ -53,7 +53,7 @@ export interface ScenarioProfile {
|
|
|
53
53
|
layer: "🟢现有编排器套壳" | "🔴需新循环骨架";
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
* core's preset scenario registry (
|
|
56
|
+
* core's preset scenario registry (裁定: core ships preset profiles). This is **data** (named bundles),
|
|
57
57
|
* not a mechanism — each entry maps to one existing orchestrator + prompts + guard defaults.
|
|
58
58
|
*/
|
|
59
59
|
export declare const SCENARIO_REGISTRY: Record<ScenarioId, ScenarioProfile>;
|