@sema-agent/core 5.56.0 → 5.58.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 +122 -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 +13 -2
- package/dist/agents/send-message-tool.js +34 -12
- package/dist/agents/subagent-steps.d.ts +1 -1
- package/dist/agents/subagent.d.ts +13 -13
- package/dist/agents/team.d.ts +15 -6
- package/dist/agents/team.js +1 -0
- 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/anthropic.js +15 -5
- package/dist/brain/circuit-breaker.js +2 -1
- package/dist/brain/degrading.d.ts +1 -1
- package/dist/brain/degrading.js +4 -1
- package/dist/brain/errors.d.ts +3 -3
- package/dist/brain/failover.js +16 -1
- package/dist/brain/open-responses.js +15 -5
- package/dist/brain/openai.js +16 -5
- package/dist/brain/reasoning.d.ts +2 -2
- package/dist/brain/repetition.d.ts +1 -1
- package/dist/brain/request-params.d.ts +30 -27
- package/dist/brain/request-params.js +1 -7
- package/dist/brain/route-adjudicator.d.ts +190 -0
- package/dist/brain/route-adjudicator.js +189 -0
- package/dist/brain/route-conformance.d.ts +55 -0
- package/dist/brain/route-conformance.js +136 -0
- package/dist/brain/routing.js +8 -3
- 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.js +2 -0
- 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/mcp.js +4 -4
- package/dist/core/memory-engine/consolidation-driver.d.ts +207 -0
- package/dist/core/memory-engine/consolidation-driver.js +378 -0
- package/dist/core/memory-engine/consolidation.d.ts +46 -2
- package/dist/core/memory-engine/consolidation.js +1 -0
- 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 +62 -8
- package/dist/core/memory-engine/engine.js +40 -4
- package/dist/core/memory-engine/file-backend.d.ts +1 -1
- package/dist/core/memory-engine/index.d.ts +4 -2
- package/dist/core/memory-engine/index.js +4 -2
- 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-recall.d.ts +1 -1
- package/dist/core/memory.d.ts +2 -2
- package/dist/core/permission-rule-consent.d.ts +230 -36
- package/dist/core/permission-rule-consent.js +258 -54
- package/dist/core/permission-rule-model.d.ts +295 -97
- package/dist/core/permission-rule-model.js +132 -41
- 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 +54 -18
- package/dist/core/runner/prepare-workspace-restore.d.ts +2 -2
- package/dist/core/runner/runtask.d.ts +15 -12
- package/dist/core/runner/runtask.js +48 -0
- 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 +10 -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 +14 -7
- 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 +55 -28
- 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 +155 -70
- 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/agent-harness.js +26 -1
- package/dist/engine/harness/messages.d.ts +1 -1
- package/dist/engine/harness/types.d.ts +15 -11
- package/dist/engine/llm/types.d.ts +79 -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 +8 -4
- package/dist/index.js +5 -2
- package/dist/internal/llm.d.ts +1 -1
- 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 +10 -10
- package/dist/prompts/default.js +2 -0
- 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 +6 -2
- package/dist/scenarios/scenario-registry.js +4 -2
- 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/index.js +8 -1
- 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/scheduler-tools.js +28 -6
- package/dist/tools/task-list.d.ts +2 -2
- package/dist/tools/web.d.ts +19 -4
- package/dist/tools/web.js +8 -2
- package/dist/tools/worktree.d.ts +5 -5
- package/dist/tools/worktree.js +2 -2
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +74 -3
|
@@ -48,11 +48,11 @@ export interface WorkflowCompletionNotifier {
|
|
|
48
48
|
summary: string;
|
|
49
49
|
result?: string;
|
|
50
50
|
usage?: unknown;
|
|
51
|
-
/**
|
|
51
|
+
/** The diagnosis route (per-agent rows / journal locator / resumeFromRunId guidance).
|
|
52
52
|
* Added 1.353 on the payload but silently dropped at this hand-written subset seam until 1.404 —
|
|
53
53
|
* keep this interface in lockstep with the payload fields the settle legs mint. */
|
|
54
54
|
diagnostics?: string;
|
|
55
|
-
/**
|
|
55
|
+
/** See {@link "../core/task-notification.js".TaskNotificationPayload.completionId}.
|
|
56
56
|
* This CROSS-REPLICA seam is exactly one of the read faces the cross-channel correlation contract
|
|
57
57
|
* promises the same value on — added here in the same car specifically so this interface does not
|
|
58
58
|
* repeat the diagnostics field's own drift history (the comment right above this one). */
|
|
@@ -133,7 +133,7 @@ export interface RunWorkflowToolDeps {
|
|
|
133
133
|
scriptRunner: WorkflowScriptRunner;
|
|
134
134
|
/** Deployment-trusted governance every spawned agent inherits (design/98 §2.5). */
|
|
135
135
|
governanceBaseline: WorkflowGovernanceBaseline;
|
|
136
|
-
/**
|
|
136
|
+
/** (tool-face round 5): the HOST task's tool-face controls (prepare-time snapshot) — a
|
|
137
137
|
* scenario roster must survive the workflow delegation path exactly like the Agent path. Merged
|
|
138
138
|
* (union — tighten-only) into the baseline base for every child spec this workflow spawns. */
|
|
139
139
|
parentExcludeTools?: readonly string[];
|
|
@@ -142,7 +142,7 @@ export interface RunWorkflowToolDeps {
|
|
|
142
142
|
* declared for the tree must survive this direct-mount lane exactly like the deferral it exempts
|
|
143
143
|
* from. Union (widen-the-exemption never tightens the child beyond the parent's own face). */
|
|
144
144
|
parentAlwaysLoadTools?: readonly string[];
|
|
145
|
-
/** design/277
|
|
145
|
+
/** design/277: the HOST task's model-gate restore selector
|
|
146
146
|
* ({@link import("../core/types.js").TaskSpec.restoreGatedTools}, prepare-time frozen snapshot) —
|
|
147
147
|
* the workflow lane is a delegation lane too, so the selector inherits here exactly like the
|
|
148
148
|
* three tool-face controls above (union with the baseline's own; `true` on either side wins).
|
|
@@ -166,7 +166,7 @@ export interface RunWorkflowToolDeps {
|
|
|
166
166
|
/** design/97 CORE-9 (Part A) — optional LOAD-BEARING resume journal: records each agent result so a
|
|
167
167
|
* `resumeFromRunId` re-run replays the unchanged prefix (durable cross-replica resume). Opt-in. */
|
|
168
168
|
journalStore?: WorkflowJournalStore;
|
|
169
|
-
/** design/149
|
|
169
|
+
/** design/149: the process-level BackgroundChildEvent sink — workflow-spawned agents
|
|
170
170
|
* mint synthetic `wa*` rows (spawn/tick/terminal) on the SAME observer bg subagents use
|
|
171
171
|
* (RunnerDeps.onBackgroundChildEvent), immune to any run-leg forwarding freeze. Opt-in. */
|
|
172
172
|
onBackgroundChildEvent?: (event: import("../core/types.js").BackgroundChildEvent) => void;
|
|
@@ -180,7 +180,7 @@ export interface RunWorkflowToolDeps {
|
|
|
180
180
|
notifier?: WorkflowCompletionNotifier;
|
|
181
181
|
/** The originating session id, threaded into every completion notify. */
|
|
182
182
|
originatingSessionId?: string;
|
|
183
|
-
/**
|
|
183
|
+
/** The ROOT host session of the delegation tree (prepare-task passes
|
|
184
184
|
* `internals?.rootSessionId ?? sessionId` per task). The AUTO-MOUNTED tool's execute ctx is the
|
|
185
185
|
* harness-native one (no internals enrichment — that wrapper covers spec.tools only), so the
|
|
186
186
|
* root MUST ride deps; `ctx.rootSessionId` stays first for a deployment-composed mount that
|
|
@@ -209,7 +209,7 @@ export interface RunWorkflowToolDeps {
|
|
|
209
209
|
/** The originating task id + principal, threaded to the notifier. */
|
|
210
210
|
sourceTaskId?: string;
|
|
211
211
|
principal?: string;
|
|
212
|
-
/**
|
|
212
|
+
/** mirrors {@link "../core/types.js".TaskSpec.oneShot}: this submission has
|
|
213
213
|
* no later turn for an async notification to land in. Branches the launch receipt's `note` guidance
|
|
214
214
|
* (see {@link createRunWorkflowTool}'s `note` composition) toward an active block-wait instead of
|
|
215
215
|
* "end your turn and wait" — the latter is actively wrong for a one-shot caller. */
|
|
@@ -246,14 +246,14 @@ export interface RunWorkflowToolDeps {
|
|
|
246
246
|
* `ToolExecuteContext.interactiveTools` seat — without it a headless-clamped host's workflow
|
|
247
247
|
* children could re-mount the interactive tool the host run disabled. */
|
|
248
248
|
parentInteractiveTools?: false;
|
|
249
|
-
/**
|
|
249
|
+
/** Call-time getter for the HOST task's RESOLVED Model object: a spawned agent whose
|
|
250
250
|
* fold chain produced no model inherits the parent's full object (baseUrl/key routing included),
|
|
251
251
|
* mirroring the subagent lane's ctx.model semantics. */
|
|
252
252
|
parentModel?: () => import("../internal/llm.js").Model | undefined;
|
|
253
|
-
/**
|
|
253
|
+
/** The HOST task's per-model auth hook: the CREDENTIAL half of model
|
|
254
254
|
* inheritance. The Model object fixed the URL routing but the child brain still authenticated
|
|
255
|
-
* with the boot env token (
|
|
256
|
-
* has inherited this hook since
|
|
255
|
+
* with the boot env token (rerun: 7/7 kimi-route 401s with the qwen key). The subagent lane
|
|
256
|
+
* has inherited this hook since; the workflow lane never did — the governance whitelist
|
|
257
257
|
* rightly blocks SCRIPTS from setting it, but host inheritance is a different lane. */
|
|
258
258
|
parentGetApiKeyAndHeaders?: import("../core/types.js").TaskSpec["getApiKeyAndHeaders"];
|
|
259
259
|
/** backlog #342 — the HOST task's frozen effective approver (`spec.onAsk ?? deps.onAsk`, the exact
|
|
@@ -323,7 +323,7 @@ export interface RunWorkflowToolDeps {
|
|
|
323
323
|
* mounts it under the same gate). Returns a structured error (not a throw) for an LLM-correctable problem
|
|
324
324
|
* (oversized / malformed-meta / nesting), so the model can fix and retry.
|
|
325
325
|
*
|
|
326
|
-
* Async since
|
|
326
|
+
* Async since: the card's named-workflow roster is derived from the SAME sources the execute path
|
|
327
327
|
* resolves against (built-ins probed through `resolveName` shadowing + awaited `list()`), so the card can
|
|
328
328
|
* never advertise a workflow the call would resolve differently.
|
|
329
329
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* design/98 §2.5 / §E.2 (S8b, security core) — the DEFAULT-DENY governance for a sub-agent an LLM-authored
|
|
3
3
|
* workflow script spawns. The child spec is BUILT (complete-by-construction) from the deployment's trusted
|
|
4
4
|
* {@link WorkflowGovernanceBaseline} + a strict WHITELIST of safe work-fields the script may set — NEVER by
|
|
5
|
-
* stripping a denylist off the untrusted spec (
|
|
5
|
+
* stripping a denylist off the untrusted spec (a missed control-plane field would leak).
|
|
6
6
|
*
|
|
7
7
|
* The script's spec is UNTRUSTED. Only {@link WHITELIST_KEYS} are ever read from it; every other field
|
|
8
8
|
* (toolPolicy / onAsk / hooks / principal / tools / mcp / skills / lspManager / checkpointStore /
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* host-ctx bindings the engine writes onto the baseline/child, never a read of anything the script wrote:
|
|
16
16
|
* a script-authored `onAsk` (or any other control-plane key) keeps being stripped + announced. The model is
|
|
17
17
|
* chosen by NAME ONLY (resolved against an allowlist to a deploy-configured `Model` — the script never sees a
|
|
18
|
-
* `Model` object, which carries `baseUrl`/`headers` = an exfil surface
|
|
18
|
+
* `Model` object, which carries `baseUrl`/`headers` = an exfil surface). Resource limits
|
|
19
19
|
* are CLAMPED to the baseline + workflow ceilings (`tightenTaskSpec` only covers the safety knobs, not
|
|
20
|
-
* cost/token caps
|
|
20
|
+
* cost/token caps).
|
|
21
21
|
*/
|
|
22
22
|
import type { Model } from "../internal/llm.js";
|
|
23
23
|
import type { EngineNotice, ImageInput, TaskSpec, ThinkingLevel, WorkflowGovernanceBaseline } from "../core/types.js";
|
|
@@ -31,7 +31,7 @@ export declare class WorkflowModelNotAllowedError extends Error {
|
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* The SAFE fields an LLM-authored workflow script may set per sub-agent — the WORK, never the control plane.
|
|
34
|
-
* `model` is a NAME (string), NOT a `ModelRef`/`Model` object (
|
|
34
|
+
* `model` is a NAME (string), NOT a `ModelRef`/`Model` object (a `Model` carries
|
|
35
35
|
* `baseUrl`/`headers`/`extraBody` = endpoint + auth-header injection). No `modelRole`/`roles` (a `roles.select`
|
|
36
36
|
* conditional selector is its own vector). The engine resolves `modelName` against the allowlist.
|
|
37
37
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WorkflowRunStore, WorkflowRunSummary } from "../core/workflow-run-store.js";
|
|
2
2
|
import type { WorkflowEvent, WorkflowItemStatus, WorkflowRun, WorkflowRunStatus } from "./workflow.js";
|
|
3
3
|
/** design/97 S1c: mark a run RUNNING (called by `runWorkflow` before it emits `run_start`).
|
|
4
|
-
*
|
|
4
|
+
* B-3 (BREAKING): carries the run's SCOPE — {@link subscribeWorkflow} gates on it. */
|
|
5
5
|
export declare function markWorkflowActive(runId: string, scope: string): void;
|
|
6
6
|
/** T2A-9 (2026-07-05 soak): is this runId currently ACTIVE in-process? Used by `startWorkflow` to reject an
|
|
7
7
|
* explicit duplicate `opts.runId` up front — two runs sharing one observation channel let the first finisher
|
|
@@ -35,7 +35,7 @@ export declare function selfOrchestrationFailClosedReason(spec: TaskSpec, deps:
|
|
|
35
35
|
* ({@link import("./dev-vm-script-runner.js").devWorkflowScriptRunner}, S8b) that is explicitly NOT a
|
|
36
36
|
* security boundary, plus a conformance contract a hard runner must pass.
|
|
37
37
|
*
|
|
38
|
-
* 🔴 **Membrane = STRUCTURAL constraint, not a behavioral promise
|
|
38
|
+
* 🔴 **Membrane = STRUCTURAL constraint, not a behavioral promise.** The seam's
|
|
39
39
|
* `run()` accepts ONLY {@link WorkflowPrimitives} — a flat, sterile record of bound callbacks + a budget
|
|
40
40
|
* DATA snapshot. It does NOT accept a `WorkflowRunContext` (a host object whose prototype chain the script
|
|
41
41
|
* could walk via `ctx.constructor.constructor("return process")()` to escape). The engine extracts the bound
|
|
@@ -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).
|