@sema-agent/core 7.15.0 → 7.17.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 +202 -0
- package/dist/agents/builtin-agents.d.ts +3 -3
- package/dist/agents/cross-session-envelope.d.ts +0 -1
- package/dist/agents/cross-session-envelope.js +0 -1
- package/dist/agents/peer-notices.d.ts +0 -9
- package/dist/agents/peer-notices.js +0 -63
- package/dist/agents/subagent.js +7 -15
- package/dist/brain/request-params.d.ts +2 -2
- package/dist/config/defaults.d.ts +0 -7
- package/dist/config/defaults.js +0 -2
- package/dist/core/artifact-host.d.ts +218 -0
- package/dist/core/artifact-host.js +92 -0
- package/dist/core/ask-origin.d.ts +29 -3
- package/dist/core/ask-origin.js +17 -9
- package/dist/core/ask-question.d.ts +25 -0
- package/dist/core/ask-question.js +4 -0
- package/dist/core/ask-unresolvable-notice.d.ts +30 -21
- package/dist/core/ask-unresolvable-notice.js +16 -8
- package/dist/core/auto-compaction.d.ts +10 -10
- package/dist/core/auto-mode-arming.d.ts +2 -2
- package/dist/core/background-agent-store.d.ts +5 -5
- package/dist/core/background-shell.d.ts +1 -1
- package/dist/core/checkpoint-execution-record.d.ts +0 -3
- package/dist/core/checkpoint-execution-record.js +0 -4
- package/dist/core/checkpoint-store.d.ts +71 -99
- package/dist/core/checkpoint-store.js +9 -16
- package/dist/core/context-edit.d.ts +36 -104
- package/dist/core/context-edit.js +37 -60
- package/dist/core/effective-path-target.d.ts +68 -8
- package/dist/core/effective-path-target.js +42 -30
- package/dist/core/engine-notice.d.ts +46 -32
- package/dist/core/env-budget.d.ts +31 -0
- package/dist/core/env-budget.js +39 -0
- package/dist/core/exec-output-tail.d.ts +5 -5
- package/dist/core/file-history-store.js +3 -6
- package/dist/core/fs-write-gate-policy.d.ts +1 -1
- package/dist/core/fs-write-gate-policy.js +3 -3
- package/dist/core/gate-lanes.js +9 -15
- package/dist/core/governance-codes.d.ts +1 -1
- package/dist/core/governance-codes.js +4 -0
- package/dist/core/hands-band.d.ts +1 -1
- package/dist/core/hooks.d.ts +18 -17
- package/dist/core/lsp-session.d.ts +1 -1
- package/dist/core/lsp.d.ts +1 -1
- package/dist/core/lsp.js +5 -4
- package/dist/core/mcp.d.ts +5 -5
- package/dist/core/mcp.js +4 -48
- package/dist/core/memory-engine/delegation-settlement.d.ts +37 -12
- package/dist/core/memory-engine/delegation-settlement.js +128 -39
- package/dist/core/memory-engine/engine.d.ts +9 -8
- package/dist/core/memory-engine/engine.js +115 -120
- package/dist/core/memory-engine/file-backend.d.ts +17 -5
- package/dist/core/memory-engine/file-backend.js +78 -34
- package/dist/core/memory-engine/index.d.ts +2 -2
- package/dist/core/memory-engine/index.js +2 -2
- package/dist/core/memory-engine/layout.d.ts +152 -54
- package/dist/core/memory-engine/layout.js +441 -104
- package/dist/core/memory-engine/types.d.ts +8 -3
- package/dist/core/memory-engine/types.js +5 -0
- package/dist/core/memory-recall.d.ts +0 -8
- package/dist/core/memory.d.ts +1 -1
- package/dist/core/oracle-isolation.js +2 -2
- package/dist/core/parent-spec-seat.d.ts +66 -0
- package/dist/core/parent-spec-seat.js +47 -0
- package/dist/core/permission-rule-model.d.ts +11 -6
- package/dist/core/permission-rule-model.js +53 -37
- package/dist/core/permission-rules.js +8 -3
- package/dist/core/protocol-naming.d.ts +2 -2
- package/dist/core/remote-env.d.ts +1 -1
- package/dist/core/retired-keys.d.ts +19 -0
- package/dist/core/retired-keys.js +15 -0
- package/dist/core/runner/abort-race.d.ts +3 -3
- package/dist/core/runner/active-skill-scope.d.ts +2 -2
- package/dist/core/runner/active-skill-scope.js +3 -3
- package/dist/core/runner/assemble-result.d.ts +42 -40
- package/dist/core/runner/assemble-result.js +5 -4
- package/dist/core/runner/checkpoint-scope.d.ts +4 -4
- package/dist/core/runner/clock-and-limits.d.ts +3 -3
- package/dist/core/runner/compaction-call-options.d.ts +35 -99
- package/dist/core/runner/compaction-knobs.d.ts +4 -4
- package/dist/core/runner/compaction-seams.d.ts +5 -5
- package/dist/core/runner/contracts.d.ts +232 -233
- package/dist/core/runner/decide-continuation.d.ts +6 -6
- package/dist/core/runner/denial-limit-arms.d.ts +8 -8
- package/dist/core/runner/derived-route-fallback.d.ts +2 -2
- package/dist/core/runner/gate-exit.d.ts +6 -6
- package/dist/core/runner/gate-exit.js +15 -1
- package/dist/core/runner/git-status-frame.d.ts +7 -7
- package/dist/core/runner/halt-attribution.d.ts +35 -0
- package/dist/core/runner/halt-attribution.js +16 -0
- package/dist/core/runner/inherited-ask-grants.d.ts +6 -6
- package/dist/core/runner/memory-capture-optout.d.ts +1 -1
- package/dist/core/runner/memory-consolidation-driver.d.ts +4 -4
- package/dist/core/runner/memory-consolidation.d.ts +6 -8
- package/dist/core/runner/memory-consolidation.js +0 -1
- package/dist/core/runner/park-commit.d.ts +6 -6
- package/dist/core/runner/permission-rule-lanes.d.ts +19 -19
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +4 -4
- package/dist/core/runner/prepare-artifact.d.ts +53 -0
- package/dist/core/runner/prepare-artifact.js +77 -0
- package/dist/core/runner/prepare-ask-lane.d.ts +3 -3
- package/dist/core/runner/prepare-boundary-parks.d.ts +3 -3
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +9 -7
- package/dist/core/runner/prepare-caps-and-workflow.js +2 -3
- package/dist/core/runner/prepare-config-doors.d.ts +24 -24
- package/dist/core/runner/prepare-config-doors.js +5 -2
- package/dist/core/runner/prepare-context-lane.d.ts +8 -8
- package/dist/core/runner/prepare-context-lane.js +2 -13
- package/dist/core/runner/prepare-defer-classify.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.d.ts +1 -1
- package/dist/core/runner/prepare-file-history.d.ts +3 -3
- package/dist/core/runner/prepare-file-history.js +3 -52
- package/dist/core/runner/prepare-gate-stations.d.ts +5 -5
- package/dist/core/runner/prepare-hands-readface.d.ts +35 -38
- package/dist/core/runner/prepare-hands-readface.js +3 -2
- package/dist/core/runner/prepare-inherited-gate.d.ts +9 -6
- package/dist/core/runner/prepare-inherited-gate.js +7 -8
- package/dist/core/runner/prepare-listings.d.ts +3 -3
- package/dist/core/runner/prepare-lsp.d.ts +3 -3
- package/dist/core/runner/prepare-memory-engine-session.d.ts +5 -5
- package/dist/core/runner/prepare-memory.d.ts +4 -6
- package/dist/core/runner/prepare-memory.js +10 -9
- package/dist/core/runner/prepare-offload-wrappers.d.ts +2 -2
- package/dist/core/runner/prepare-park-ask.d.ts +6 -6
- package/dist/core/runner/prepare-policy-chain.d.ts +7 -7
- package/dist/core/runner/prepare-policy-chain.js +15 -30
- package/dist/core/runner/prepare-prompt-assembly.js +1 -1
- package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -5
- package/dist/core/runner/prepare-protocol-tools.d.ts +1 -1
- package/dist/core/runner/prepare-question-face.d.ts +4 -4
- package/dist/core/runner/prepare-run-refs.d.ts +11 -11
- package/dist/core/runner/prepare-safety-scan.d.ts +2 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +4 -4
- package/dist/core/runner/prepare-suspend-saga.js +0 -2
- package/dist/core/runner/prepare-task.d.ts +12 -12
- package/dist/core/runner/prepare-task.js +10 -9
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +2 -3
- package/dist/core/runner/prepare-wiring-manifest.d.ts +4 -4
- package/dist/core/runner/prepare-wiring-manifest.js +9 -7
- package/dist/core/runner/prepare-workspace-restore.d.ts +1 -1
- package/dist/core/runner/remote-env-retry.d.ts +3 -3
- package/dist/core/runner/resume-admission.d.ts +1 -1
- package/dist/core/runner/resume-admission.js +2 -1
- package/dist/core/runner/resume-claim.d.ts +1 -1
- package/dist/core/runner/resume-internals-and-config.d.ts +1 -1
- package/dist/core/runner/resume-internals-and-config.js +4 -0
- package/dist/core/runner/resume-policy-outcome.d.ts +1 -1
- package/dist/core/runner/resume-preflight.d.ts +1 -1
- package/dist/core/runner/resume-review-outcome.d.ts +1 -1
- package/dist/core/runner/retired-runner-deps.d.ts +3 -0
- package/dist/core/runner/retired-runner-deps.js +7 -0
- package/dist/core/runner/run-brain-sinks.d.ts +1 -1
- package/dist/core/runner/run-clock-and-content.d.ts +4 -4
- package/dist/core/runner/run-compaction-machinery.d.ts +3 -3
- package/dist/core/runner/run-git-lane.d.ts +1 -1
- package/dist/core/runner/run-harness-handlers.d.ts +2 -2
- package/dist/core/runner/run-harness-handlers.js +2 -3
- package/dist/core/runner/run-identity-wiring.d.ts +4 -4
- package/dist/core/runner/run-leg.d.ts +3 -3
- package/dist/core/runner/run-notification-lane.d.ts +2 -2
- package/dist/core/runner/run-reasoning-seat.d.ts +2 -2
- package/dist/core/runner/run-settle-and-teardown.d.ts +5 -5
- package/dist/core/runner/run-settle-and-teardown.js +3 -1
- package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +2 -2
- package/dist/core/runner/run-terminal-adoption.d.ts +5 -5
- package/dist/core/runner/runtask.d.ts +14 -14
- package/dist/core/runner/session-file-state-replay.d.ts +3 -3
- package/dist/core/runner/session-file-state-replay.js +3 -3
- package/dist/core/runner/session-rule-policy.d.ts +2 -2
- package/dist/core/runner/session-rule-policy.js +3 -4
- package/dist/core/runner/steer-admission.d.ts +2 -2
- package/dist/core/runner/stream-halt-verbs.d.ts +1 -1
- package/dist/core/runner/stream-halt-verbs.js +1 -1
- package/dist/core/runner/stream-reap.d.ts +1 -1
- package/dist/core/runner/stream-steer-verb.js +1 -4
- package/dist/core/runner/synthetic-tools.d.ts +8 -8
- package/dist/core/runner/teardown-bounded.d.ts +2 -2
- package/dist/core/runner/tool-defer-gate.d.ts +1 -1
- package/dist/core/runner/tool-disclosure.d.ts +33 -33
- package/dist/core/runner/tool-end-body.d.ts +3 -3
- package/dist/core/runner/tool-face-overlay.d.ts +2 -2
- package/dist/core/runner/tool-output-projection.d.ts +2 -2
- package/dist/core/runner/turn-attachments.d.ts +53 -53
- package/dist/core/runner/usage-accounting.d.ts +4 -4
- package/dist/core/runner/workspace-path.d.ts +1 -1
- package/dist/core/runner/workspace-path.js +3 -0
- package/dist/core/runner-deps.d.ts +30 -49
- package/dist/core/safe-notify.d.ts +1 -1
- package/dist/core/sensitive-path-policy.d.ts +1 -1
- package/dist/core/sensitive-path-policy.js +4 -4
- package/dist/core/session.d.ts +2 -2
- package/dist/core/skill-tool-specifier.d.ts +1 -1
- package/dist/core/skills-directory.d.ts +1 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +1 -1
- package/dist/core/strategy-store.d.ts +8 -11
- package/dist/core/task-event.d.ts +20 -17
- package/dist/core/task-limits.d.ts +1 -1
- package/dist/core/task-notification.d.ts +5 -5
- package/dist/core/task-registry-agent.d.ts +5 -5
- package/dist/core/task-registry-monitor.d.ts +2 -2
- package/dist/core/task-registry-shared.d.ts +27 -27
- package/dist/core/task-registry-shared.js +3 -13
- package/dist/core/task-registry.d.ts +8 -8
- package/dist/core/task-result.d.ts +37 -37
- package/dist/core/task-spec.d.ts +5 -5
- package/dist/core/task-stream.d.ts +16 -11
- package/dist/core/tool-catalog-entries.d.ts +1 -0
- package/dist/core/tool-catalog-entries.js +5 -0
- package/dist/core/tool-conformance.d.ts +0 -2
- package/dist/core/tool-conformance.js +1 -3
- package/dist/core/tool-errors.d.ts +5 -0
- package/dist/core/tool-errors.js +1 -0
- package/dist/core/tool-policy.d.ts +51 -22
- package/dist/core/tool-policy.js +28 -5
- package/dist/core/tool-result-budget.d.ts +1 -1
- package/dist/core/tool-result-store.d.ts +11 -11
- package/dist/core/tool-spec.d.ts +34 -38
- package/dist/core/tools.d.ts +2 -2
- package/dist/core/trace.d.ts +12 -15
- package/dist/core/untrusted-text.d.ts +1 -1
- package/dist/core/wiring-manifest.d.ts +4 -3
- package/dist/core/workflow-journal-store.d.ts +11 -11
- package/dist/engine/execution-env/node-execution-env.d.ts +3 -2
- package/dist/engine/execution-env/node-execution-env.js +4 -2
- package/dist/engine/harness/agent-harness.d.ts +47 -4
- package/dist/engine/harness/agent-harness.js +52 -9
- package/dist/engine/llm/types.d.ts +1 -1
- package/dist/engine/loop/agent-loop.js +15 -8
- package/dist/engine/loop/types.d.ts +5 -0
- package/dist/index.d.ts +21 -16
- package/dist/index.js +17 -12
- package/dist/internal/harness.d.ts +1 -0
- package/dist/orchestration/run-spec.d.ts +3 -0
- package/dist/orchestration/run-spec.js +3 -3
- package/dist/orchestration/run-workflow-tool.d.ts +12 -6
- package/dist/orchestration/run-workflow-tool.js +23 -5
- package/dist/orchestration/workflow-primitives.d.ts +4 -2
- package/dist/orchestration/workflow-primitives.js +1 -4
- package/dist/orchestration/workflow-types.d.ts +34 -4
- package/dist/orchestration/workflow-types.js +2 -0
- package/dist/orchestration/workflow.d.ts +39 -7
- package/dist/orchestration/workflow.js +234 -113
- package/dist/prompt-assembly/assemble.d.ts +2 -2
- package/dist/prompt-assembly/assemble.js +9 -9
- package/dist/prompt-assembly/composer.d.ts +6 -7
- package/dist/prompt-assembly/composer.js +10 -10
- package/dist/prompt-assembly/epoch.js +1 -1
- package/dist/prompt-assembly/event-registry.d.ts +0 -21
- package/dist/prompt-assembly/packs/sema-default.js +30 -30
- package/dist/prompt-assembly/types.d.ts +14 -14
- package/dist/prompts/coordinator.d.ts +0 -13
- package/dist/prompts/coordinator.js +0 -3
- package/dist/stores/file/checkpoint-store.js +1 -5
- package/dist/stores/file/file-history-store.js +2 -2
- package/dist/stores/file/permission-rule-store.d.ts +4 -35
- package/dist/stores/file/permission-rule-store.js +4 -148
- package/dist/tools/artifact/artifact-text.d.ts +62 -0
- package/dist/tools/artifact/artifact-text.js +68 -0
- package/dist/tools/artifact/artifact-tool.d.ts +52 -0
- package/dist/tools/artifact/artifact-tool.js +351 -0
- package/dist/tools/artifact/local-stub.d.ts +26 -0
- package/dist/tools/artifact/local-stub.js +296 -0
- package/dist/tools/fs/bash-readonly-classifier.d.ts +114 -48
- package/dist/tools/fs/bash-readonly-classifier.js +171 -60
- package/dist/tools/fs/encoding.d.ts +31 -40
- package/dist/tools/fs/fs-bash.d.ts +49 -45
- package/dist/tools/fs/fs-bash.js +19 -27
- package/dist/tools/fs/fs-pdf.d.ts +8 -8
- package/dist/tools/fs/fs-search-tools.d.ts +4 -4
- package/dist/tools/fs/fs-search-tools.js +5 -2
- package/dist/tools/fs/fs-shared.d.ts +146 -158
- package/dist/tools/fs/fs-shared.js +3 -11
- package/dist/tools/fs/fs-write.d.ts +8 -8
- package/dist/tools/fs/gh-rate-limit.d.ts +13 -14
- package/dist/tools/fs/index.d.ts +78 -78
- package/dist/tools/fs/index.js +4 -1
- package/dist/tools/fs/notebook.d.ts +24 -25
- package/dist/tools/fs/pdf.d.ts +3 -3
- package/dist/tools/fs/read-deny.d.ts +22 -22
- package/dist/tools/fs/read-face.d.ts +21 -24
- package/dist/tools/fs/repo-map.d.ts +8 -8
- package/dist/tools/fs/safety.d.ts +233 -130
- package/dist/tools/fs/safety.js +131 -31
- package/dist/tools/fs/search.d.ts +63 -71
- package/dist/tools/fs/search.js +8 -6
- package/package.json +6 -2
- package/test/export-surface.snapshot.json +119 -39
|
@@ -2,7 +2,7 @@ import type { McpDroppedTool } from "../mcp.js";
|
|
|
2
2
|
import type { TaskSpec } from "../types.js";
|
|
3
3
|
import { type SkillListingEntry } from "./synthetic-tools.js";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Turn-boundary attachment seam: the PURE producer layer (CC `getContextAttachments`
|
|
6
6
|
* parity). This module is the single home of the CC-parity cadence judgment + reminder copy (提示词主权批:
|
|
7
7
|
* harness 语料归 core); it holds NO harness handle, does NO I/O, and never injects anything itself — the
|
|
8
8
|
* run loop (runtask onTurnBoundary) is the ONLY steerer. That split exists so every trigger window is
|
|
@@ -21,7 +21,7 @@ export declare const PLAN_MODE_ATTACHMENT_CONFIG: {
|
|
|
21
21
|
readonly TURNS_BETWEEN_ATTACHMENTS: 5;
|
|
22
22
|
readonly FULL_REMINDER_EVERY_N_ATTACHMENTS: 5;
|
|
23
23
|
};
|
|
24
|
-
/**
|
|
24
|
+
/** CC 2.1.220 tool-search reminder cadence, the shipped defaults of its `juniper_shoal`
|
|
25
25
|
* config block (`sru = 15` / `aru = 10` @185913-185914, read as `{everyNTurns, maxNames}` @185836-185849).
|
|
26
26
|
* `EVERY_N_TURNS` gates BOTH windows (since-last-ToolSearch and since-last-reminder, @608920);
|
|
27
27
|
* `MAX_NAMES` bounds how many undiscovered names the body enumerates before the `(+N more)` tail. */
|
|
@@ -30,7 +30,7 @@ export declare const TOOL_SEARCH_REMINDER_CONFIG: {
|
|
|
30
30
|
readonly MAX_NAMES: 10;
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* The `total_tokens_reminder` mode set, CC 2.1.245-VERBATIM and in CC's declaration order
|
|
34
34
|
* (bundle `R9o`; the settings schema declares the same five for its `totalTokensReminder` key).
|
|
35
35
|
* Each arm names what the rendered number IS, per CC's own schema prose:
|
|
36
36
|
* - `off` — the lane is silent. Kept as a member rather than folded into the opt-in flag because it
|
|
@@ -47,7 +47,7 @@ export declare const TOOL_SEARCH_REMINDER_CONFIG: {
|
|
|
47
47
|
*/
|
|
48
48
|
export declare const TOTAL_TOKENS_REMINDER_MODES: readonly ["off", "infinite", "fixed", "countdown", "padded-countdown"];
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* The closed set is spelled TWICE (the public `TaskSpec.attachments.
|
|
51
51
|
* totalTokensReminderMode` literal union and this array), and only the TaskSpec→array direction had
|
|
52
52
|
* a compile chain (runtask's AttachmentInputs assignment). The config door widens this array to
|
|
53
53
|
* `readonly string[]` before `includes`, so a member added HERE and never to the public union used
|
|
@@ -59,11 +59,11 @@ export declare const TOTAL_TOKENS_REMINDER_MODES: readonly ["off", "infinite", "
|
|
|
59
59
|
*/
|
|
60
60
|
type TaskSpecTotalTokensReminderMode = NonNullable<NonNullable<TaskSpec["attachments"]>["totalTokensReminderMode"]>;
|
|
61
61
|
export type TotalTokensReminderMode = [TaskSpecTotalTokensReminderMode] extends [(typeof TOTAL_TOKENS_REMINDER_MODES)[number]] ? (typeof TOTAL_TOKENS_REMINDER_MODES)[number] : never;
|
|
62
|
-
/**
|
|
62
|
+
/** CC 2.1.245's own default ("Defaults to padded-countdown"). The 2026-07-30 registration of
|
|
63
63
|
* this lane rested on the 2.1.220 premise "OFF by default even in 220"; 245 flipped it, which is the
|
|
64
64
|
* fact that reopened the ruling. Applies only ONCE the deployment has opted the lane in. */
|
|
65
65
|
export declare const TOTAL_TOKENS_REMINDER_DEFAULT_MODE: TotalTokensReminderMode;
|
|
66
|
-
/**
|
|
66
|
+
/** CC's `fixed` arm constant (bundle `A9o`). A fixed anchor is the POINT of that arm (the
|
|
67
67
|
* number is meant not to move), so it is copied as the constant it is rather than re-pointed at a
|
|
68
68
|
* declared ceiling — a deployment that wants its own number picks a countdown arm instead. */
|
|
69
69
|
export declare const TOTAL_TOKENS_FIXED_ARM_VALUE = 5000000;
|
|
@@ -88,7 +88,7 @@ export interface AgentListingEntry {
|
|
|
88
88
|
* "All tools" / "All tools except X, Y" / an explicit list / "None"). Computed by the producer
|
|
89
89
|
* (createSubagentTool → {@link import("../../agents/subagent.js").agentToolsNote}).
|
|
90
90
|
*
|
|
91
|
-
*
|
|
91
|
+
* Omitting it no longer drops the tail. 220's `fvd` (@465664-465668) interpolates
|
|
92
92
|
* `WW_(def)` UNCONDITIONALLY and `WW_` is total — its no-allow/no-deny arm returns the literal
|
|
93
93
|
* "All tools" — so every roster line in 220 carries the boundary. sema's optional field only ever
|
|
94
94
|
* meant "a hand-built entry did not precompute one"; that entry's real boundary IS the full offered
|
|
@@ -147,13 +147,13 @@ export interface AttachmentState {
|
|
|
147
147
|
todoLastWriteTurn?: number;
|
|
148
148
|
lastTodoReminderTurn: number;
|
|
149
149
|
lastTaskReminderTurn: number;
|
|
150
|
-
/**
|
|
150
|
+
/** Cadence-clock value at the last `ToolSearch` tool_use block (CC 220 `cFy` @608887-608914
|
|
151
151
|
* finds it by BACKWARD transcript scan: `turnsSinceLastToolSearch`). Same INITIATION-anchor semantics
|
|
152
152
|
* as {@link taskLastWriteTurn} — the block existing in the transcript is the anchor, no outcome check.
|
|
153
153
|
* `undefined` = never used this leg, which is the state the reminder exists for (220's scan returns the
|
|
154
154
|
* full transcript length there). */
|
|
155
155
|
toolSearchLastUseTurn?: number;
|
|
156
|
-
/**
|
|
156
|
+
/** Cadence-clock value at the last tool_search_usage_reminder emitted (CC 220 `cFy`'s
|
|
157
157
|
* `turnsSinceLastReminder`, found by scanning back for the attachment entry itself). */
|
|
158
158
|
lastToolSearchReminderTurn: number;
|
|
159
159
|
/** plan_mode attachments emitted so far — drives CC's full/sparse rotation (1st, 6th, 11th… = full).
|
|
@@ -204,7 +204,7 @@ export interface AttachmentState {
|
|
|
204
204
|
* construction — agent roster ≤ cap by deployment size, skills block ≤ SKILLS_BLOCK_MAX_BYTES). */
|
|
205
205
|
skillsListingStarved?: boolean;
|
|
206
206
|
/**
|
|
207
|
-
*
|
|
207
|
+
* The `padded-countdown` arm's SMOOTHING FLOOR: the highest usage figure this run has
|
|
208
208
|
* already published against. CC's `cumulativeUsed` (bundle: `Math.max(storedFloor, rolledOver +
|
|
209
209
|
* used − anchor)`, stored back) exists so the countdown never RUNS BACKWARDS when the live usage
|
|
210
210
|
* coordinate drops under it — a model that watched its budget shrink and then saw it grow again
|
|
@@ -280,7 +280,7 @@ export declare function createAttachmentState(): AttachmentState;
|
|
|
280
280
|
* bash, fs, mcp, …) is structurally ignored, which is also the child-isolation contract: a subagent's
|
|
281
281
|
* own todo state never reaches the parent's onToolEnd, and its delegation-card types don't parse here.
|
|
282
282
|
*
|
|
283
|
-
* task #51 F3 (
|
|
283
|
+
* task #51 F3 (窗口复位/投影摄入拆分): this reducer is PROJECTION INGEST ONLY — it
|
|
284
284
|
* never touches the write windows. CC's window anchor is the tool_use block's PRESENCE in the
|
|
285
285
|
* transcript (qFm/BFm match the block by name, :480217-480219/:480253-480254, with no execution-
|
|
286
286
|
* outcome check), so the run loop stamps the windows on INITIATION via {@link stampWriteAnchor}
|
|
@@ -294,9 +294,9 @@ export declare function createAttachmentState(): AttachmentState;
|
|
|
294
294
|
*/
|
|
295
295
|
export declare function reduceToolEnd(state: AttachmentState, details: unknown): void;
|
|
296
296
|
/** task #51 F2/F3 — which reminder window a tool_use block resets. Resolved by the run loop (alias-aware:
|
|
297
|
-
* ToolSpec.aliases over the mounted roster;
|
|
297
|
+
* ToolSpec.aliases over the mounted roster; retired-name normalization is gone); the producers
|
|
298
298
|
* here never inspect tool names themselves.
|
|
299
|
-
*
|
|
299
|
+
* Adds `tool_search`: not a write, but the same INITIATION-anchor mechanism (a `ToolSearch`
|
|
300
300
|
* tool_use block resets that lane's "haven't used it recently" window), so it rides the same walk
|
|
301
301
|
* instead of duplicating the message scan. */
|
|
302
302
|
export type WriteFamily = "todo" | "task" | "tool_search";
|
|
@@ -309,7 +309,7 @@ export type WriteFamily = "todo" | "task" | "tool_search";
|
|
|
309
309
|
*/
|
|
310
310
|
export declare function stampWriteAnchor(state: AttachmentState, family: WriteFamily, clock: number): void;
|
|
311
311
|
/**
|
|
312
|
-
* 口径④ cadence clock, task #51 F1 (
|
|
312
|
+
* 口径④ cadence clock, task #51 F1 (verified against observed CC behavior) — CC's cadence unit is the
|
|
313
313
|
* per-content-block assistant TRANSCRIPT ENTRY, not the physical turn. CC 198 mints ONE
|
|
314
314
|
* `{type:"assistant"}` entry PER content block: the streaming layer at `content_block_stop`
|
|
315
315
|
* (pretty.js:593011-593038 — `content: pnn([Pr],…)` single-block array, `rn.push` per block) and the
|
|
@@ -336,7 +336,7 @@ export declare function stampWriteAnchor(state: AttachmentState, family: WriteFa
|
|
|
336
336
|
*/
|
|
337
337
|
export declare function advanceCadenceClock(state: AttachmentState, clock: number, content: unknown, writeFamilyOf: (toolName: string) => WriteFamily | undefined): number;
|
|
338
338
|
/**
|
|
339
|
-
* task #51 F4 (
|
|
339
|
+
* task #51 F4 (压缩交互) — rebase every reminder window to the CURRENT cadence clock
|
|
340
340
|
* when a compaction LANDS. CC's windows are recomputed per request by BACKWARD TRANSCRIPT SCAN
|
|
341
341
|
* (BFm/qFm): compaction removes the write tool_use anchors and the reminder attachment entries, so
|
|
342
342
|
* both counters find nothing (t=-1/n=-1) and only count post-compaction entries — the windows
|
|
@@ -380,7 +380,7 @@ export interface AttachmentInputs {
|
|
|
380
380
|
used: number;
|
|
381
381
|
total: number;
|
|
382
382
|
};
|
|
383
|
-
/**
|
|
383
|
+
/** The TOKEN twin of {@link budgetUsd}, fed
|
|
384
384
|
* from the same place for the same reason: `used` is the run's cumulative token spend
|
|
385
385
|
* (`stats.tokens`) and `total` is the ceiling the budget gate enforces against it
|
|
386
386
|
* (`rs.budget.maxTokensWindow` = min(`limits.maxTokens`, the cross-slice allocation's remainder)),
|
|
@@ -408,7 +408,7 @@ export interface AttachmentInputs {
|
|
|
408
408
|
* value (or absence) = CC `"baseline"` (on). sema keeps env resolution at the deployment shell
|
|
409
409
|
* and carries only the resolved mode here — core reads no env. */
|
|
410
410
|
todoReminderMode?: "baseline" | "off";
|
|
411
|
-
/**
|
|
411
|
+
/** Tool_search_usage_reminder lane (opt-in, default OFF; CC 220 mounts it only when the
|
|
412
412
|
* `toolSearchReminder` config resolves non-null, @607450-607456 / `cXi` @185859). */
|
|
413
413
|
toolSearchReminder?: boolean;
|
|
414
414
|
changedFiles: boolean;
|
|
@@ -420,12 +420,12 @@ export interface AttachmentInputs {
|
|
|
420
420
|
* loop adds a continuation gate (tool-calling turns only — a boundary steer must never EXTEND a
|
|
421
421
|
* finished run, see runtask's `lastTurnHadToolCalls`).
|
|
422
422
|
*
|
|
423
|
-
*
|
|
423
|
+
* Attribution CORRECTED (the previous note claimed "gated `d = !t.agentId` :479177 —
|
|
424
424
|
* subagents never see it", which reads 220 wrong). In 220 the `!agentId` flag gates only the
|
|
425
425
|
* MAIN-AGENT-EXCLUSIVE producer group (`_` @607478-607522: ide_selection / output_style /
|
|
426
426
|
* diagnostics / memory_update / token_usage / output_token_usage). `budget_usd` sits in the SHARED
|
|
427
427
|
* group `g` (@607474) and its ONLY door is `maxBudgetUsd === undefined → []` — so a 220 SUBAGENT
|
|
428
|
-
* whose own options carry a ceiling DOES see the readout. Core
|
|
428
|
+
* whose own options carry a ceiling DOES see the readout. Core follows 220. There is no
|
|
429
429
|
* agent-identity door in this collector to remove — the lane's reachability is entirely
|
|
430
430
|
* "does this task's spec carry a ceiling and opt in", which is true for a child exactly when the
|
|
431
431
|
* deployment gave it both. Capability位 (what the delegation lane does NOT do): `buildChildSpec`
|
|
@@ -435,16 +435,16 @@ export interface AttachmentInputs {
|
|
|
435
435
|
* snapshots `maxCostUsd` and every other governance field) reaches the lane. */
|
|
436
436
|
budgetUsd?: boolean;
|
|
437
437
|
/**
|
|
438
|
-
*
|
|
438
|
+
* `total_tokens_reminder` (CC 2.1.245 producer `MPs`, renderer `Oje`,
|
|
439
439
|
* registered in the SHARED producer group beside `budget_usd`, so a subagent carrying its own
|
|
440
|
-
* ceiling sees it too — the
|
|
441
|
-
*
|
|
440
|
+
* ceiling sees it too — the attribution verbatim). DEFAULT ON, matching 2.1.245+'s own default;
|
|
441
|
+
* explicit `false` opts out. Before the
|
|
442
442
|
* flip an un-opted deployment rendered no reminder frame at all. The countdown arms still need a
|
|
443
443
|
* declared ceiling, so a task without one is silent either way. (Scoped deliberately to this lane:
|
|
444
444
|
* registering
|
|
445
445
|
* `<total_tokens>` in ENGINE_ENVELOPES changed the SANITIZE/DISCLOSURE faces for every
|
|
446
446
|
* deployment, opted or not — untrusted text carrying that spelling is now defused on the fenced
|
|
447
|
-
* lanes and envelope-shaped external data trips the
|
|
447
|
+
* lanes and envelope-shaped external data trips the disclosure tail. That is the
|
|
448
448
|
* defensive direction and unconditional by design: the envelope family must be un-forgeable
|
|
449
449
|
* whether or not anyone renders the real frame.)
|
|
450
450
|
*
|
|
@@ -456,7 +456,7 @@ export interface AttachmentInputs {
|
|
|
456
456
|
* ({@link AttachmentInputs.totalTokens}), the ceiling is the deployment's own declared
|
|
457
457
|
* `limits.maxTokens`, and with no ceiling declared the countdown arms simply never fire.
|
|
458
458
|
*
|
|
459
|
-
* AND WHY IT IS NOW ON BY DEFAULT
|
|
459
|
+
* AND WHY IT IS NOW ON BY DEFAULT: the same 245 fact that
|
|
460
460
|
* justified BUILDING it is a statement about its DEFAULT, so shipping it opt-in left the engine
|
|
461
461
|
* one ruling short of the anchor. Both halves of "is this safe on by default" hold here — the
|
|
462
462
|
* readout cannot be wrong (it reads the enforced coordinate, never an estimate), and it cannot
|
|
@@ -468,7 +468,7 @@ export interface AttachmentInputs {
|
|
|
468
468
|
* TOTAL_TOKENS_REMINDER_DEFAULT_MODE}); `off` there silences the lane without un-wiring it.
|
|
469
469
|
*/
|
|
470
470
|
totalTokensReminder?: boolean;
|
|
471
|
-
/**
|
|
471
|
+
/** The RESOLVED mode (see {@link TOTAL_TOKENS_REMINDER_MODES}). CC resolves it from env /
|
|
472
472
|
* settings / a server gate; sema keeps env resolution at the deployment shell and carries only the
|
|
473
473
|
* resolved value, exactly like {@link todoReminderMode}. Absent ⇒ {@link
|
|
474
474
|
* TOTAL_TOKENS_REMINDER_DEFAULT_MODE}. A value outside the closed set is refused at the config
|
|
@@ -476,7 +476,7 @@ export interface AttachmentInputs {
|
|
|
476
476
|
totalTokensReminderMode?: TotalTokensReminderMode;
|
|
477
477
|
/** G1: post-compact background-task announce (opt-in, default OFF like the 133 members). */
|
|
478
478
|
backgroundTasks?: boolean;
|
|
479
|
-
/** G1: deferred-tool materialization announce (
|
|
479
|
+
/** G1: deferred-tool materialization announce (setTools delta → boundary notice). */
|
|
480
480
|
toolsDelta?: boolean;
|
|
481
481
|
/** G1 续批: agent-type roster announce (CC `agent_listing_delta`). [c209-C]: listing-family
|
|
482
482
|
* member — default ON at the TaskSpec layer (the frame is the ONLY roster source since the
|
|
@@ -488,13 +488,13 @@ export interface AttachmentInputs {
|
|
|
488
488
|
/** G1 续批: MCP server-instruction delta announce (CC `mcp_instructions_delta`). */
|
|
489
489
|
mcpInstructions?: boolean;
|
|
490
490
|
};
|
|
491
|
-
/**
|
|
491
|
+
/** Deferred tools whose schemas the model has NOT loaded yet (declared but not
|
|
492
492
|
* activated), sorted, snapshotted by the run loop. CC 220's equivalent is
|
|
493
493
|
* `tools.filter(iY(u) && !discovered.has(u.name)).map(name).sort()` (@608934-608938). Only passed
|
|
494
494
|
* when `config.toolSearchReminder` is opted in AND the task actually has deferred tools — an empty
|
|
495
495
|
* or absent list silences the lane permanently (CC `no_undiscovered_tools`, @608939 (cli250.js:44368)). */
|
|
496
496
|
undiscoveredTools?: readonly string[];
|
|
497
|
-
/**
|
|
497
|
+
/** Is the direct-call lane mounted on this run's placeholders (`Prepared.deferDirectCall`,
|
|
498
498
|
* i.e. `TaskSpec.deferSelfResolve` not disabled)? Selects which closing sentence the
|
|
499
499
|
* tool_search_usage_reminder body carries; absent ⇒ the default direct-lane posture, matching the
|
|
500
500
|
* spec field's own default. Meaningless unless `config.toolSearchReminder` is on. */
|
|
@@ -513,16 +513,16 @@ export interface AttachmentInputs {
|
|
|
513
513
|
* CALLER owns consumption: drain its pending list only when the returned capped bundle actually
|
|
514
514
|
* retained the `tools_delta` block (cap starvation must not lose the announcement forever). */
|
|
515
515
|
newTools?: readonly string[];
|
|
516
|
-
/**
|
|
516
|
+
/** `true` when the run materializes statically (activation never swaps the tools
|
|
517
517
|
* block): the tools_delta wording must then not claim "full schemas are loaded". Rides beside
|
|
518
518
|
* `newTools` because it qualifies the same frame. */
|
|
519
519
|
newToolsStaticFace?: boolean;
|
|
520
|
-
/**
|
|
520
|
+
/** The subset of `newTools` that the static face could not carry in result text and
|
|
521
521
|
* that materialized into the tools block instead. See {@link renderToolsDelta}. */
|
|
522
522
|
newToolsSwappedUnderStatic?: readonly string[];
|
|
523
|
-
/**
|
|
523
|
+
/** The same fact for the READDED arm. See {@link renderToolsDelta}. */
|
|
524
524
|
readdedToolsSwappedUnderStatic?: readonly string[];
|
|
525
|
-
/**
|
|
525
|
+
/** The MCP-driven arms of the SAME tools_delta frame (removed / readded / failed servers).
|
|
526
526
|
* Same pre-diffed input + CALLER-owned intact-survival consumption discipline as `newTools`; only
|
|
527
527
|
* passed when `config.toolsDelta` is opted in. See {@link McpToolsDeltaFacts} for reachability. */
|
|
528
528
|
mcpToolsDelta?: McpToolsDeltaFacts;
|
|
@@ -576,14 +576,14 @@ export interface AttachmentInputs {
|
|
|
576
576
|
*/
|
|
577
577
|
export declare function collectDueAttachments(state: AttachmentState, inp: AttachmentInputs): readonly TurnAttachment[];
|
|
578
578
|
/**
|
|
579
|
-
*
|
|
579
|
+
* CC 2.1.220 (@626269-626280, the `tool_search_usage_reminder` renderer), with the two
|
|
580
580
|
* interpolations resolved: the name list (+ `(+N more)` tail when the census exceeds
|
|
581
581
|
* {@link TOOL_SEARCH_REMINDER_CONFIG}.MAX_NAMES) and the ToolSearch tool's mounted name — sema mounts
|
|
582
582
|
* the same name. The quoted `select:<name>[,<name>...]` form is also sema's real ToolSearch contract
|
|
583
583
|
* (tool-disclosure.ts's `select:` prefix parser), so the copy stays true rather than merely quoted.
|
|
584
584
|
*
|
|
585
585
|
* ONE sema amendment, the same one DD-5 already applied to the sibling ToolSearch description: the
|
|
586
|
-
* closing sentence is POSTURE-AWARE rather than an absolute failure promise. With the
|
|
586
|
+
* closing sentence is POSTURE-AWARE rather than an absolute failure promise. With the
|
|
587
587
|
* direct-call lane mounted — the default (`TaskSpec.deferSelfResolve` not disabled) — a call on a
|
|
588
588
|
* still-deferred tool whose arguments match the real schema EXECUTES and activates it, so "calling a
|
|
589
589
|
* tool before its schema is loaded will fail" is false for that posture. This face must not assert an
|
|
@@ -655,7 +655,7 @@ export declare function commitInstructionsChange(state: InstructionsChangeState,
|
|
|
655
655
|
}>): void;
|
|
656
656
|
export declare function renderBudgetUsd(used: number, total: number): string;
|
|
657
657
|
/**
|
|
658
|
-
*
|
|
658
|
+
* CC 2.1.245 `Oje` VERBATIM: the whole body is the one-line envelope
|
|
659
659
|
* `<total_tokens>N tokens left</total_tokens>`, where N is the arm's own substitution — the literal
|
|
660
660
|
* `Infinite`, the {@link TOTAL_TOKENS_FIXED_ARM_VALUE} constant, or the remaining count clamped at
|
|
661
661
|
* zero (CC's `Math.max(0, …)`: an over-spent run reads `0 tokens left`, never a negative number).
|
|
@@ -683,11 +683,11 @@ export declare function renderOrphanedBackgroundTasks(tasks: ReadonlyArray<{
|
|
|
683
683
|
description?: string;
|
|
684
684
|
}>): string;
|
|
685
685
|
/**
|
|
686
|
-
*
|
|
686
|
+
* CC's per-frame list cap for the `deferred_tools_delta` arms (`lP`, (pretty220.js:518269, historical; not relocated in 250 — see cc-250 anchors)).
|
|
687
687
|
* Lists longer than this collapse to a grouped one-liner + "…and N more".
|
|
688
688
|
*/
|
|
689
689
|
export declare const TOOLS_DELTA_LIST_MAX = 30;
|
|
690
|
-
/**
|
|
690
|
+
/** The MCP-driven arms of the deferred-tools announce. All fields are pre-diffed by the
|
|
691
691
|
* producer (prepare-task's `rematerialize` seam / the materialize-time failed-server projection) and
|
|
692
692
|
* are CALLER-drained on intact cap survival, exactly like {@link AttachmentInputs.newTools}. */
|
|
693
693
|
export interface McpToolsDeltaFacts {
|
|
@@ -705,7 +705,7 @@ export interface McpToolsDeltaFacts {
|
|
|
705
705
|
}>;
|
|
706
706
|
}
|
|
707
707
|
/**
|
|
708
|
-
* G1 — deferred-tool materialization announce (
|
|
708
|
+
* G1 — deferred-tool materialization announce (boundary notice). CC 2.1.198 template
|
|
709
709
|
* (bundle pretty.js:599148, `deferred_tools_delta` case) verbatim reads: "The following deferred
|
|
710
710
|
* tools are now available via ${ToolSearch}. Their schemas are NOT loaded — calling them directly
|
|
711
711
|
* will fail with InputValidationError. Use ${ToolSearch} with query \"select:<name>[,...]\" to load
|
|
@@ -714,9 +714,9 @@ export interface McpToolsDeltaFacts {
|
|
|
714
714
|
* the middle clause is inverted to match sema's actual contract. Same CC shape: lead sentence +
|
|
715
715
|
* name list.
|
|
716
716
|
*
|
|
717
|
-
*
|
|
717
|
+
* CC 2.1.220 (`deferred_tools_delta`, cli250.js:45890-45918) carries SIX arms; sema
|
|
718
718
|
* shipped only the `added` one. The arms below are the ones whose STATE IS REACHABLE in this engine
|
|
719
|
-
* (data-side audit
|
|
719
|
+
* (data-side audit):
|
|
720
720
|
* - `readded` (@626525) / `removed` (@626530 (cli250.js:45892)): reachable via RefreshMcpTools — the refresh splices a
|
|
721
721
|
* server's whole `mcp__<server>__` prefix domain out of the live tool array and pushes the fresh
|
|
722
722
|
* listing back, so a withdrawn tool genuinely leaves (and a re-advertised one genuinely returns)
|
|
@@ -739,7 +739,7 @@ export interface McpToolsDeltaFacts {
|
|
|
739
739
|
export declare function renderToolsDelta(input: {
|
|
740
740
|
added?: readonly string[];
|
|
741
741
|
staticFace?: boolean;
|
|
742
|
-
/**
|
|
742
|
+
/** The subset of `added` that the STATIC face could not carry and that therefore
|
|
743
743
|
* materialized into the tools block instead (a declaration too large to inline in result text,
|
|
744
744
|
* or one that does not serialize; see the per-tool exemption in prepare-task). Empty/absent on
|
|
745
745
|
* every ordinary static run, which keeps the common frame byte-identical; when it is non-empty
|
|
@@ -752,7 +752,7 @@ export declare function renderToolsDelta(input: {
|
|
|
752
752
|
* assert compact placeholders the model can see are not there. */
|
|
753
753
|
readdedSwappedUnderStatic?: readonly string[];
|
|
754
754
|
} & McpToolsDeltaFacts): string | undefined;
|
|
755
|
-
/**
|
|
755
|
+
/** The `(Tools: …)` value for an entry that precomputed none (CC 220 `WW_`'s terminal arm
|
|
756
756
|
* @465662: no allowlist and no denylist ⇒ the literal "All tools"). */
|
|
757
757
|
export declare const AGENT_TOOLS_NOTE_DEFAULT = "All tools";
|
|
758
758
|
/** CC 2.1.198 verbatim (bundle pretty.js:599221, `agent_listing_delta` isInitial+showConcurrencyNote arm). */
|
|
@@ -792,11 +792,11 @@ export declare function agentListingDeltaHeader(toolName: string): string;
|
|
|
792
792
|
* calls announce only drift: adds under "New agent types are now available…", removals under "The
|
|
793
793
|
* following agent types are no longer available:" + `- <name>` lines, followed by the CC-verbatim
|
|
794
794
|
* {@link AMBIENT_CONTEXT_NOTE} (CC `Emr`, pretty.js:599211/599992). Name-keyed like CC: a description
|
|
795
|
-
* change on an existing name is not re-announced. Every line carries a `(Tools: …)` tail (
|
|
795
|
+
* change on an existing name is not re-announced. Every line carries a `(Tools: …)` tail (
|
|
796
796
|
* 220 `fvd`/`WW_` @465651-465668 — the model needs each type's tool boundary to pick a type;
|
|
797
797
|
* PARITY-SPOT-AGENT-TYPES F3), defaulted to {@link AGENT_TOOLS_NOTE_DEFAULT} when the entry precomputed none.
|
|
798
798
|
*
|
|
799
|
-
*
|
|
799
|
+
* ShowConcurrencyNote, honest attribution: `entries.length > 1` is a sema APPROXIMATION, not
|
|
800
800
|
* CC semantics. 220's real predicate (@607882) is `Aa() !== "pro" && Cq() === "default"` — subscription
|
|
801
801
|
* tier is not "pro" AND the output style is the default one. Neither axis exists in core (BYOM has no
|
|
802
802
|
* subscription plane; there is no output-style plane at all), so the predicate is untranslatable, and
|
|
@@ -806,7 +806,7 @@ export declare function agentListingDeltaHeader(toolName: string): string;
|
|
|
806
806
|
* noise. RESIDUAL (divergences candidate): under a >1 roster sema shows the note where 220 would hide it
|
|
807
807
|
* for a pro/non-default-style user.
|
|
808
808
|
*
|
|
809
|
-
*
|
|
809
|
+
* Added/removed ordering: adds are sorted by `localeCompare` and removals by the default
|
|
810
810
|
* `sort()`, exactly as 220 does at @607873 (`c.sort((p,f) => p.agentType.localeCompare(f.agentType)), u.sort()`).
|
|
811
811
|
* This is not cosmetic here: the announced-set advance ({@link commitAgentListing}) is gated on the
|
|
812
812
|
* rendered block surviving the capped bundle BYTE-IDENTICAL against a re-render, so a deployment that
|
|
@@ -818,7 +818,7 @@ export declare function agentListingDeltaHeader(toolName: string): string;
|
|
|
818
818
|
* information an alphabetical sort would destroy. The initial frame renders one array once, so it has
|
|
819
819
|
* no re-render byte-identity exposure of its own.
|
|
820
820
|
*
|
|
821
|
-
*
|
|
821
|
+
* PURE — never mutates `state`. The announced-set advance is CALLER-owned via
|
|
822
822
|
* {@link commitAgentListing}, committed ONLY when the rendered block survived the byte cap INTACT
|
|
823
823
|
* (tools_delta/mcp_instructions discipline — a cap-clipped/dropped block previously advanced the
|
|
824
824
|
* announced map anyway, losing the roster announcement forever).
|
|
@@ -870,7 +870,7 @@ export declare function renderSkillsListingDelta(state: AttachmentState, entries
|
|
|
870
870
|
* announced map untouched so the next quiet boundary re-announces. */
|
|
871
871
|
export declare function commitSkillsListing(state: AttachmentState, entries: ReadonlyArray<SkillListingEntry>): void;
|
|
872
872
|
/**
|
|
873
|
-
*
|
|
873
|
+
* Per-server bound (in CODE POINTS, matching every other clipper in `untrusted-text.ts`) on
|
|
874
874
|
* ONE MCP server's `instructions` text. The text is SERVER-controlled and UNBOUNDED on the wire: the
|
|
875
875
|
* bundle byte cap ({@link ATTACHMENT_BYTE_CAP}) is a per-frame structural backstop on the delta lane
|
|
876
876
|
* and does not exist AT ALL on the stable system-prompt lane, so without this a single server could
|
|
@@ -881,8 +881,8 @@ export declare function commitSkillsListing(state: AttachmentState, entries: Rea
|
|
|
881
881
|
*/
|
|
882
882
|
export declare const MCP_INSTRUCTIONS_MAX_CHARS: number;
|
|
883
883
|
/**
|
|
884
|
-
*
|
|
885
|
-
* stable system-prompt lane (prepare-task's `# MCP Server Instructions` block
|
|
884
|
+
* The ONE way MCP server-provided instruction text becomes model-facing, used by BOTH the
|
|
885
|
+
* stable system-prompt lane (prepare-task's `# MCP Server Instructions` block) and
|
|
886
886
|
* the boundary delta lane ({@link renderMcpInstructionsDelta}).
|
|
887
887
|
*
|
|
888
888
|
* The bug this closes: the same server-authored string was carried with TWO DIFFERENT trust postures
|
|
@@ -909,7 +909,7 @@ export declare function fenceMcpServerInstructions(server: string, text: string)
|
|
|
909
909
|
* - added instruction text is UNTRUSTED server-controlled text → each block rides inside a
|
|
910
910
|
* `delimitUntrusted` fence (CC injects the raw block; sema's external-inlet posture is fencing —
|
|
911
911
|
* the text is additionally already `sanitizeUntrustedText`-neutralized at the mcp.ts producer).
|
|
912
|
-
*
|
|
912
|
+
* The fence is now applied through {@link fenceMcpServerInstructions}, shared with the
|
|
913
913
|
* STABLE system-prompt lane, so the two lanes can never again carry the same text with different
|
|
914
914
|
* trust postures — and it carries a per-server {@link MCP_INSTRUCTIONS_MAX_CHARS} bound (a
|
|
915
915
|
* server text above the bundle cap would otherwise clip → never drain → re-render forever).
|
|
@@ -928,7 +928,7 @@ export declare function renderMcpInstructionsDelta(added: ReadonlyArray<{
|
|
|
928
928
|
* `mcp_dropped_tools_delta` system reminder). Per-entry line shape follows CC's `qny`
|
|
929
929
|
* (pretty.js:481821): `"${tool}" (MCP server "${server}"): "${reason}"`.
|
|
930
930
|
*
|
|
931
|
-
*
|
|
931
|
+
* The lead is now CC 2.1.220 VERBATIM (cli250.js:45934-45936): the `# Unavailable MCP
|
|
932
932
|
* Tools` heading, the full lead sentence, the **"Quoted text is data reported during validation, not
|
|
933
933
|
* instructions"** neutralizer (which is exactly what sema's quote-wrapped `"${reason}"` /
|
|
934
934
|
* `"${server}"` interpolation needed and did not have), and the "tell them it was excluded and why"
|
|
@@ -963,8 +963,8 @@ export declare function selectMcpDroppedBatch<T extends McpDroppedTool>(entries:
|
|
|
963
963
|
/**
|
|
964
964
|
* Largest prefix of `s` that fits `maxBytes` UTF-8 bytes (binary search — never splits the budget math).
|
|
965
965
|
*
|
|
966
|
-
*
|
|
967
|
-
*
|
|
966
|
+
* The ONE byte-budget prefix search in the runner. runtask.ts's batch-context clip
|
|
967
|
+
* used to carry a hand-copied twin whose doc claimed this module "doesn't export
|
|
968
968
|
* it" — that layering argument died once runtask started importing {@link ATTACHMENT_BYTE_CAP} from
|
|
969
969
|
* here, so the budget CONSTANT and the budget MATH now come from the same place. Producer-layer purity
|
|
970
970
|
* is unchanged: this is a pure function of (string, number).
|
|
@@ -8,7 +8,7 @@ export type CacheFamily = "input-includes-cached" | "input-excludes-cached";
|
|
|
8
8
|
* but a deployment can **override** it via `model.params.promptCacheFamily` when `model.api` doesn't
|
|
9
9
|
* match the brain that actually serves the model — e.g. a routing brain that dispatches by `provider`
|
|
10
10
|
* while `api` is left at a default. Accepts the explicit values or the aliases `"anthropic"`/`"openai"`.
|
|
11
|
-
* (
|
|
11
|
+
* (a route-by-provider setup with `api` hardcoded misjudged the family → 1090% hit rate.)
|
|
12
12
|
*/
|
|
13
13
|
export declare function cacheFamilyOf(model: Model): CacheFamily;
|
|
14
14
|
/** Total prompt tokens presented this turn, normalized so `cachedTokens` is always ⊆ the total. */
|
|
@@ -22,14 +22,14 @@ export declare function promptTokensOf(family: CacheFamily, u: {
|
|
|
22
22
|
* the Anthropic protocol calls `usage.input_tokens`, normalized across families. Derived from the
|
|
23
23
|
* normalized total so the identity `total = uncached + cacheRead + cacheWrite` holds by construction.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
25
|
+
* The wire faces named `inputTokens`/`promptTokens` carry THIS, not the total — a consumer
|
|
26
26
|
* computing `cacheRead / (input + cacheRead)` on a same-named protocol field otherwise double-counts
|
|
27
27
|
* the cache subset and reports `h/(1+h)` (a real 98% hit rate surfaces as 49.5%). The BILLING path
|
|
28
28
|
* still consumes the total (`promptTokensOf`) — `computeCostMicroUsd` subtracts the priced subsets
|
|
29
29
|
* itself, so handing it the uncached figure would drop the cache legs from the bill entirely.
|
|
30
30
|
*
|
|
31
31
|
* Clamped at 0: when a provider reports subsets LARGER than its own total the cache family is
|
|
32
|
-
* misdeclared
|
|
32
|
+
* misdeclared, which the run loop already reports on its own face; here the identity
|
|
33
33
|
* degrades to `total ≤ uncached + cacheRead + cacheWrite` rather than going negative.
|
|
34
34
|
*/
|
|
35
35
|
export declare function uncachedInputTokensOf(family: CacheFamily, u: {
|
|
@@ -41,7 +41,7 @@ export declare function uncachedInputTokensOf(family: CacheFamily, u: {
|
|
|
41
41
|
* Normalize one turn's reported usage into its `{ totalInputTokens, uncachedInputTokens, costMicroUsd }`
|
|
42
42
|
* — the authoritative cost re-priced in core from injected pricing (so cached tokens aren't charged at
|
|
43
43
|
* full price). Shared by the run loop's per-turn accounting and post-task memory consolidation
|
|
44
|
-
*
|
|
44
|
+
* so a pricing change lives in ONE place. We emit only 5-min-TTL cache writes, so
|
|
45
45
|
* `cacheWriteTokensLong` is 0.
|
|
46
46
|
*/
|
|
47
47
|
export declare function usageCostMicroUsd(family: CacheFamily, u: {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function rebaseWorkspacePath(p: string, fromRaw: string, toRaw: string): string;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* {@link rebaseWorkspacePath} over a SET of accepted spellings of the old root: the first
|
|
22
22
|
* prefix that actually matches wins, and a path under none of them is returned unchanged.
|
|
23
23
|
*
|
|
24
24
|
* The set exists because "the old root" has no single spelling. `WorkspaceHandle.mountPath` is whatever the
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { isWinFormPath, pathFamilyOf } from "../../tools/fs/safety.js";
|
|
1
2
|
export function rebaseWorkspacePath(p, fromRaw, toRaw) {
|
|
2
3
|
if (p.includes("\\") || fromRaw.includes("\\") || toRaw.includes("\\"))
|
|
3
4
|
return p;
|
|
5
|
+
if (pathFamilyOf({ root: fromRaw }) !== "posix" || pathFamilyOf({ root: toRaw }) !== "posix" || isWinFormPath(p))
|
|
6
|
+
return p;
|
|
4
7
|
const stripTrail = (s) => (s.length > 1 && s.endsWith("/") ? stripTrail(s.slice(0, -1)) : s);
|
|
5
8
|
const from = stripTrail(fromRaw);
|
|
6
9
|
const to = stripTrail(toRaw);
|
|
@@ -187,7 +187,7 @@ export interface RunnerDeps {
|
|
|
187
187
|
*/
|
|
188
188
|
readDenyPatterns?: readonly import("../tools/fs/read-deny.js").ReadDenyEntry[];
|
|
189
189
|
/**
|
|
190
|
-
*
|
|
190
|
+
* The deployment's built-in deny-table TIER selection:
|
|
191
191
|
* EXACTLY the listed tiers of
|
|
192
192
|
* {@link import("../tools/fs/read-deny.js").READ_FACE_BUILTIN_DENY_TABLE} are active (`[]` = none —
|
|
193
193
|
* explicit and legal); absent = the default selection
|
|
@@ -203,7 +203,7 @@ export interface RunnerDeps {
|
|
|
203
203
|
*/
|
|
204
204
|
readDenyBuiltinTiers?: readonly string[];
|
|
205
205
|
/**
|
|
206
|
-
*
|
|
206
|
+
* Per-row removal from the built-in deny table by STABLE NAME (= the row's canonical
|
|
207
207
|
* pattern text, e.g. `".ssh"`, `".config/gcloud"`; the admin delete channel), applied after
|
|
208
208
|
* {@link readDenyBuiltinTiers} selection. Naming a row of an inactive tier is a satisfied intent
|
|
209
209
|
* (no-op); a name matching NO table row refuses loudly at prepare (#123 — never silently
|
|
@@ -490,30 +490,6 @@ export interface RunnerDeps {
|
|
|
490
490
|
* in its own audit surface. Values outside the two-member set refuse prepare loudly.
|
|
491
491
|
*/
|
|
492
492
|
onTrackFailure?: "refuse" | "proceed-unprotected";
|
|
493
|
-
/**
|
|
494
|
-
* design/381 §5.3① / §10 S-1 — the ADDITIVE discriminant for the rewind refusal that this engine
|
|
495
|
-
* cannot decide on its own. When a restore finds no boundary for the requested entry, there are
|
|
496
|
-
* two very different worlds: the boundary NEVER existed (those turns ran with no history store, or
|
|
497
|
-
* it was reaped), or it exists in the RETIRED whole-tree snapshot epoch, which the per-edited-file
|
|
498
|
-
* seat deliberately does not restore. The engine holds no whole-tree state, so absent this probe
|
|
499
|
-
* the refusal honestly names BOTH possibilities rather than picking one — the default, and the
|
|
500
|
-
* only honest wording for a deployment that never had a whole-tree epoch at all.
|
|
501
|
-
*
|
|
502
|
-
* A deployment that DOES hold the retired epoch (its assembly layer can ask the old table whether
|
|
503
|
-
* that entry has a legacy row) supplies the bit here, and the refusal splits into the two precise
|
|
504
|
-
* messages. `true` = a whole-tree-era boundary exists for that entry; `false` = it definitively
|
|
505
|
-
* does not; `undefined` = the deployment cannot tell, which reads exactly like an absent probe.
|
|
506
|
-
*
|
|
507
|
-
* Consulted ONLY on the refusal path (never on a successful restore), so a slow probe costs
|
|
508
|
-
* nothing in the ordinary case. It is a DIAGNOSTIC input, never a control input: a probe that
|
|
509
|
-
* throws, hangs past the caller's own patience, or answers a non-boolean cannot change the outcome
|
|
510
|
-
* — the refusal still happens, the wording falls back to the honest both-possibilities form, and
|
|
511
|
-
* the bad value is disclosed through `onError` (phase "rewind") rather than silently absorbed.
|
|
512
|
-
*/
|
|
513
|
-
legacyRewindBoundaryProbe?: (query: {
|
|
514
|
-
sessionId: string;
|
|
515
|
-
entryId: string;
|
|
516
|
-
}) => boolean | undefined | Promise<boolean | undefined>;
|
|
517
493
|
/**
|
|
518
494
|
* design/99 §E6 — DURABLE per-session permission rules (a deny-narrowing folded into the task-time tool
|
|
519
495
|
* policy). Omitted ⇒ the feature is OFF (no rules read, zero behavior change). A deployment supplies a
|
|
@@ -713,7 +689,7 @@ export interface RunnerDeps {
|
|
|
713
689
|
*/
|
|
714
690
|
denialLimit?: import("./auto-mode.js").AutoModeDenialLimitOptions;
|
|
715
691
|
/**
|
|
716
|
-
*
|
|
692
|
+
* OPT IN to recording this arming's serializable criteria (an
|
|
717
693
|
* {@link import("./auto-mode-arming.js").AutoModeArmingRecipe}) on the constraint-chain entries a
|
|
718
694
|
* durable park freezes, so a CROSS-PROCESS redemption can rebuild an equivalent classifier over its
|
|
719
695
|
* own model leg ({@link import("./auto-mode-rebuild.js").rebuildAutoModeDecider}) instead of
|
|
@@ -733,7 +709,7 @@ export interface RunnerDeps {
|
|
|
733
709
|
*/
|
|
734
710
|
persistArming?: boolean;
|
|
735
711
|
/**
|
|
736
|
-
*
|
|
712
|
+
* The deployment's auto-mode SETTINGS GENERATION (a config revision, a settings hash, a
|
|
737
713
|
* publish id — the string is opaque to the engine). Recorded in the arming recipe and compared at
|
|
738
714
|
* rebuild time against the REDEEMING deployment's own: it is a declaration axis that can only make
|
|
739
715
|
* the rebuild stricter (see {@link import("./auto-mode-arming.js").foldAutoModeArming}). Absent =
|
|
@@ -947,7 +923,7 @@ export interface RunnerDeps {
|
|
|
947
923
|
/** design/72 §2.2 (B): deployment default for the suspend-loop cap (see `TaskSpec.maxSuspends`).
|
|
948
924
|
* Default 5 (loose — human-approval flows re-suspend rarely). A task's own `maxSuspends` overrides. */
|
|
949
925
|
maxSuspends?: number;
|
|
950
|
-
/**
|
|
926
|
+
/** Deployment default for the outer per-brain-call guardrail — see
|
|
951
927
|
* `TaskSpec.limits.brainCallGuardrailMs` for the semantics (default one hour; `false`/`0` = off;
|
|
952
928
|
* an invalid value is a fail-loud config error). A task's own `limits.brainCallGuardrailMs`
|
|
953
929
|
* overrides it. Set it here to cover EVERY run of this Runner, delegated children included — a
|
|
@@ -1156,6 +1132,18 @@ export interface RunnerDeps {
|
|
|
1156
1132
|
* `undefined` for a file whose language has no server, and the tool degrades to "fall back to grep". A
|
|
1157
1133
|
* task's own `lspManager` overrides this. Unset ⇒ no `lsp` tool. */
|
|
1158
1134
|
lspManager?: import("./lsp.js").LspServerManager;
|
|
1135
|
+
/**
|
|
1136
|
+
* The Artifacts hosting seat — a storage/service-tier seam of the same family as
|
|
1137
|
+
* {@link checkpointStore} and {@link rosterStore}. Three states, judged once at prepare: ABSENT ⇒ no
|
|
1138
|
+
* `Artifact` tool and no announcement (the default: a library deployment has no hosting); a host
|
|
1139
|
+
* whose `capabilities()` satisfies the declaration invariants ⇒ ONE `Artifact` tool assembled from
|
|
1140
|
+
* that declaration (`plane: "hosted"` mounts the hosted face over the declared action subset,
|
|
1141
|
+
* `plane: "local-stub"` — `localArtifactStub({ dir })` — mounts the publish-only local face with
|
|
1142
|
+
* `eval-stub://` links); a host whose declaration fails an invariant ⇒ no tool and a loud
|
|
1143
|
+
* `config.artifact_host_invalid` notice. Filling the seat IS the authorization to publish: there is
|
|
1144
|
+
* no second switch. `TaskSpec.excludeTools` unmounts the tool as it does any other.
|
|
1145
|
+
*/
|
|
1146
|
+
artifactHost?: import("./artifact-host.js").ArtifactHost;
|
|
1159
1147
|
/**
|
|
1160
1148
|
* Default in-process hooks for all tasks (design/37) — the FULL lifecycle seam of the `Hooks`
|
|
1161
1149
|
* interface, not just the tool-call trio: `preToolUse` (rewrite/restrict args + inject context),
|
|
@@ -1309,27 +1297,20 @@ export interface RunnerDeps {
|
|
|
1309
1297
|
*/
|
|
1310
1298
|
toolResultThresholdChars?: number;
|
|
1311
1299
|
/**
|
|
1312
|
-
* design/374 — microCompact
|
|
1313
|
-
* default ON (`machine: "cc"`, `clearOnRejection: true`); the pre-374 behavior is the explicit
|
|
1314
|
-
* opt-out `{ machine: "legacy", clearOnRejection: false }`.
|
|
1300
|
+
* design/374 — the microCompact knobs. Both default ON (`machine: "cc"`, `clearOnRejection: true`).
|
|
1315
1301
|
*
|
|
1316
|
-
* - `machine`:
|
|
1317
|
-
*
|
|
1318
|
-
*
|
|
1319
|
-
*
|
|
1320
|
-
*
|
|
1321
|
-
*
|
|
1322
|
-
*
|
|
1323
|
-
*
|
|
1324
|
-
* fallback re-ordering shipped with this default (blocking-point re-run → in-turn forced
|
|
1325
|
-
* compaction behind the adopt seam → trim demoted to the disaster-only last resort), so an
|
|
1326
|
-
* under-20k refusal no longer falls straight into a message-dropping trim.
|
|
1302
|
+
* - `machine`: `"cc"` (default: the CC 2.1.223 rejection-leg form — keep 5, ≥20k minimum-savings
|
|
1303
|
+
* gate, one deep clear beyond the keep window, CC marker bytes) or `"off"` (no proactive
|
|
1304
|
+
* frontier clearing at all — the D-2 off switch; the machine then gets its ONE shot at the
|
|
1305
|
+
* blocking point instead, the slice-3 arm A, trace trigger `"blocking"`). The vocabulary is
|
|
1306
|
+
* {@link import("./context-edit.js").MICRO_COMPACT_MACHINES}; the guard chain behind either
|
|
1307
|
+
* value is the same (blocking-point run → in-turn forced compaction behind the adopt seam →
|
|
1308
|
+
* trim demoted to the disaster-only last resort), so an under-20k refusal never falls straight
|
|
1309
|
+
* into a message-dropping trim.
|
|
1327
1310
|
* - `clearOnRejection` (MC-R, slice 2): on a provider input-too-long rejection, run ONE cheap
|
|
1328
|
-
* deterministic clear over the rejected projection (same
|
|
1329
|
-
* and retry inside the turn BEFORE the forced-compaction recovery. Default true
|
|
1330
|
-
*
|
|
1331
|
-
* `machine` — an enabled MC-R always clears in the cc form (the rejection arm has no
|
|
1332
|
-
* budget coordinate for the legacy incremental form to stop at). BUDGET ACCOUNTING (design/374
|
|
1311
|
+
* deterministic clear over the rejected projection (the same machine, savings ≥20k or nothing)
|
|
1312
|
+
* and retry inside the turn BEFORE the forced-compaction recovery. Default true. Independent of
|
|
1313
|
+
* `machine` — an enabled MC-R clears even with the frontier pass `"off"`. BUDGET ACCOUNTING (design/374
|
|
1333
1314
|
* §3.2.1, stated here because it is otherwise invisible to a deployment): a successful MC-R
|
|
1334
1315
|
* clear-and-retry SPENDS one attempt of the shared prompt-too-long recovery budget (default 2
|
|
1335
1316
|
* attempts per chain), so a chain that clears and is rejected AGAIN has one forced-compaction
|
|
@@ -1344,7 +1325,7 @@ export interface RunnerDeps {
|
|
|
1344
1325
|
* effect.
|
|
1345
1326
|
*/
|
|
1346
1327
|
microCompact?: {
|
|
1347
|
-
machine?: "
|
|
1328
|
+
machine?: import("./context-edit.js").MicroCompactMachine;
|
|
1348
1329
|
clearOnRejection?: boolean;
|
|
1349
1330
|
};
|
|
1350
1331
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Host-callback isolation, one primitive.
|
|
3
3
|
*
|
|
4
4
|
* The invariant "a callback the HOST handed us must never take the engine down" was implemented by hand at
|
|
5
5
|
* ~20 sites across 10 modules (observer taps, cascade/verify observability hooks, roster eviction sinks, the
|
|
@@ -60,7 +60,7 @@ export declare function dataRootSpellings(explicit: string | undefined): string[
|
|
|
60
60
|
* `env` is the same ExecutionEnv the hands run against (inject the one you pass to the Runner), so
|
|
61
61
|
* canonicalization sees the task's real filesystem (a remote/E2B task resolves in its container).
|
|
62
62
|
* `rootPath` is the FALLBACK base a relative path resolves against (omit = paths resolve as given).
|
|
63
|
-
*
|
|
63
|
+
* When the engine stamps a live cwd onto the request (`ToolCallRequest.cwd` — the tracked
|
|
64
64
|
* directory the shell's `cd` moves and the fs tools resolve with), THAT wins for the call's target, so
|
|
65
65
|
* the guard judges the file the tool will actually write. `rootPath` still serves every deployment that
|
|
66
66
|
* calls this policy outside a Runner.
|