@sema-agent/core 5.19.0 → 5.21.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 +102 -4
- package/dist/agents/agent-definition.d.ts +7 -0
- package/dist/agents/agent-transcript-tool.d.ts +30 -0
- package/dist/agents/builtin-agents.d.ts +60 -0
- package/dist/agents/cascade.d.ts +107 -0
- package/dist/agents/cumulative-stats.d.ts +56 -0
- package/dist/agents/observer.d.ts +162 -0
- package/dist/agents/peer-admission.d.ts +95 -0
- package/dist/agents/repair-loop.d.ts +226 -0
- package/dist/agents/retain-ledger.d.ts +141 -0
- package/dist/agents/roster-store.d.ts +105 -0
- package/dist/agents/roster-store.js +3 -0
- package/dist/agents/send-message-tool.d.ts +92 -0
- package/dist/agents/session-util.d.ts +5 -0
- package/dist/agents/subagent-steps.d.ts +66 -0
- package/dist/agents/subagent.d.ts +600 -0
- package/dist/agents/suspend-guard.d.ts +29 -0
- package/dist/agents/teacher.d.ts +75 -0
- package/dist/agents/team.d.ts +120 -1
- package/dist/agents/tool-filter.d.ts +34 -0
- package/dist/agents/verify.d.ts +198 -0
- package/dist/bench/metrics.d.ts +455 -0
- package/dist/brain/anthropic.d.ts +30 -0
- package/dist/brain/circuit-breaker.d.ts +33 -0
- package/dist/brain/circuit-breaker.js +14 -3
- package/dist/brain/context-overflow.d.ts +60 -3
- package/dist/brain/degrading.d.ts +67 -0
- package/dist/brain/errors.d.ts +42 -0
- package/dist/brain/failover.d.ts +15 -0
- package/dist/brain/media-degrade.d.ts +39 -0
- package/dist/brain/model-presets.d.ts +31 -0
- package/dist/brain/open-responses.d.ts +19 -0
- package/dist/brain/openai.d.ts +46 -0
- package/dist/brain/reasoning.d.ts +106 -1
- package/dist/brain/repetition.d.ts +83 -0
- package/dist/brain/request-params.d.ts +56 -0
- package/dist/brain/retry.d.ts +46 -0
- package/dist/brain/routing.d.ts +12 -0
- package/dist/brain/status-sink.d.ts +30 -1
- package/dist/brain/stream-engine.d.ts +147 -0
- package/dist/brain/stream-shared.d.ts +34 -0
- package/dist/brain/terminal-cause.d.ts +31 -0
- package/dist/brain/timeout.d.ts +108 -0
- package/dist/brain/timeout.js +11 -0
- package/dist/brain/tool-call-id.d.ts +20 -0
- package/dist/brain/tool-call-repair.d.ts +13 -0
- package/dist/config/catalog.d.ts +47 -0
- package/dist/config/defaults.d.ts +33 -0
- package/dist/core/a2a-task-state.d.ts +53 -0
- package/dist/core/a2a.d.ts +51 -0
- package/dist/core/arg-summary.d.ts +62 -0
- package/dist/core/ask-question.d.ts +272 -2
- package/dist/core/auto-compaction.d.ts +467 -0
- package/dist/core/auto-compaction.js +20 -6
- package/dist/core/auto-mode-prompt-assets.d.ts +8 -0
- package/dist/core/auto-mode-prompt.d.ts +27 -0
- package/dist/core/auto-mode.d.ts +54 -3
- package/dist/core/auto-promote.d.ts +100 -0
- package/dist/core/background-agent-store.d.ts +293 -0
- package/dist/core/background-agent-store.js +5 -0
- package/dist/core/background-shell.d.ts +110 -0
- package/dist/core/cache-break-detector.d.ts +34 -0
- package/dist/core/canonical-json.d.ts +57 -0
- package/dist/core/checkpoint-store.d.ts +1574 -16
- package/dist/core/compliance.d.ts +30 -0
- package/dist/core/consolidate-scope.d.ts +75 -0
- package/dist/core/context-edit.d.ts +99 -0
- package/dist/core/context-guard.d.ts +46 -0
- package/dist/core/exec-gate.d.ts +44 -0
- package/dist/core/exec-output-tail.d.ts +61 -0
- package/dist/core/file-snapshot-store.d.ts +104 -0
- package/dist/core/fs-write-gate-policy.d.ts +36 -0
- package/dist/core/git-worktree-env.d.ts +31 -0
- package/dist/core/governance-codes.d.ts +19 -0
- package/dist/core/hooks.d.ts +609 -1
- package/dist/core/human-input-projection.d.ts +37 -0
- package/dist/core/human-input-projection.js +13 -0
- package/dist/core/image-downsample.d.ts +74 -0
- package/dist/core/locked-config.d.ts +37 -0
- package/dist/core/lsp-diagnostics.d.ts +77 -0
- package/dist/core/lsp-protocol.d.ts +29 -0
- package/dist/core/lsp-session.d.ts +60 -1
- package/dist/core/lsp.d.ts +150 -1
- package/dist/core/mailbox-store.d.ts +57 -0
- package/dist/core/mailbox-store.js +2 -0
- package/dist/core/mcp.d.ts +385 -0
- package/dist/core/mcp.js +58 -11
- package/dist/core/media-byte-cap.d.ts +21 -0
- package/dist/core/memory-admission.d.ts +71 -0
- package/dist/core/memory-engine/content-origin.d.ts +64 -0
- package/dist/core/memory-engine/data-plane.d.ts +43 -0
- package/dist/core/memory-engine/dual-root.d.ts +24 -0
- package/dist/core/memory-engine/engine.d.ts +230 -0
- package/dist/core/memory-engine/engine.js +103 -35
- package/dist/core/memory-engine/file-backend.d.ts +155 -0
- package/dist/core/memory-engine/frontmatter.d.ts +16 -0
- package/dist/core/memory-engine/layout.d.ts +217 -0
- package/dist/core/memory-engine/memory-backend-contract.d.ts +12 -0
- package/dist/core/memory-engine/migrate.d.ts +9 -0
- package/dist/core/memory-engine/scan.d.ts +12 -0
- package/dist/core/memory-engine/scope-contract.d.ts +61 -1
- package/dist/core/memory-engine/sync-client.d.ts +87 -0
- package/dist/core/memory-engine/sync.d.ts +60 -0
- package/dist/core/memory-engine/tools.d.ts +41 -0
- package/dist/core/memory-engine/types.d.ts +188 -0
- package/dist/core/memory-recall.d.ts +141 -0
- package/dist/core/memory-vector.d.ts +20 -0
- package/dist/core/memory.d.ts +458 -0
- package/dist/core/message-utils.d.ts +6 -0
- package/dist/core/oracle-isolation.d.ts +69 -0
- package/dist/core/permission-rule-consent.d.ts +138 -0
- package/dist/core/permission-rule-model.d.ts +122 -0
- package/dist/core/permission-rule-store.d.ts +119 -3
- package/dist/core/permission-rules.d.ts +87 -1
- package/dist/core/present-plan-tool.d.ts +20 -0
- package/dist/core/pricing.d.ts +26 -0
- package/dist/core/property-harness.d.ts +86 -0
- package/dist/core/protocol-naming.d.ts +38 -0
- package/dist/core/protocol-table.d.ts +61 -0
- package/dist/core/push-queue.d.ts +1 -0
- package/dist/core/remote-env.d.ts +383 -1
- package/dist/core/retention-policy.d.ts +40 -0
- package/dist/core/retention-policy.js +21 -0
- package/dist/core/retention.d.ts +51 -0
- package/dist/core/roles.d.ts +59 -0
- package/dist/core/runner/active-skill-scope.d.ts +34 -0
- package/dist/core/runner/assemble-result.d.ts +134 -0
- package/dist/core/runner/compaction-call-options.d.ts +97 -1
- package/dist/core/runner/grounding-signal.d.ts +10 -0
- package/dist/core/runner/image.d.ts +17 -0
- package/dist/core/runner/image.js +29 -15
- package/dist/core/runner/memory-consolidation.d.ts +60 -0
- package/dist/core/runner/prepare-memory.d.ts +59 -0
- package/dist/core/runner/prepare-task.d.ts +1011 -2
- package/dist/core/runner/prepare-task.js +51 -14
- package/dist/core/runner/prompt-suggestions.d.ts +7 -0
- package/dist/core/runner/runtask.d.ts +304 -3
- package/dist/core/runner/runtask.js +17 -2
- package/dist/core/runner/session-file-state-replay.d.ts +49 -0
- package/dist/core/runner/session-rule-policy.d.ts +58 -0
- package/dist/core/runner/strict-output-schema.d.ts +18 -3
- package/dist/core/runner/synthetic-tools.d.ts +113 -0
- package/dist/core/runner/teardown-bounded.d.ts +34 -0
- package/dist/core/runner/tool-disclosure.d.ts +227 -0
- package/dist/core/runner/tool-output-projection.d.ts +6 -0
- package/dist/core/runner/turn-attachments.d.ts +634 -0
- package/dist/core/runner/usage-accounting.d.ts +32 -0
- package/dist/core/runtime.d.ts +9 -0
- package/dist/core/safe-notify.d.ts +64 -0
- package/dist/core/safety-axis-vocab.d.ts +23 -0
- package/dist/core/safety-merge-corpus.d.ts +37 -0
- package/dist/core/scheduler.d.ts +121 -0
- package/dist/core/secret-env.d.ts +32 -0
- package/dist/core/select-model.d.ts +15 -0
- package/dist/core/sensitive-path-policy.d.ts +42 -0
- package/dist/core/session-policy-store.d.ts +94 -0
- package/dist/core/session-reconcile.d.ts +80 -0
- package/dist/core/session-store.d.ts +85 -0
- package/dist/core/session.d.ts +153 -0
- package/dist/core/shared-memory/contract.d.ts +22 -0
- package/dist/core/shared-memory/normalize.d.ts +123 -2
- package/dist/core/shared-memory/tools.d.ts +14 -0
- package/dist/core/shared-memory/types.d.ts +105 -0
- package/dist/core/shutdown-debug.d.ts +6 -0
- package/dist/core/side-query.d.ts +38 -0
- package/dist/core/side-query.js +6 -1
- package/dist/core/skill-tool-specifier.d.ts +72 -0
- package/dist/core/skills-directory.d.ts +100 -1
- package/dist/core/spec-contract.d.ts +89 -0
- package/dist/core/store-contracts/background-agent-store-contract.d.ts +31 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +26 -0
- package/dist/core/store-contracts/contract-harness.d.ts +20 -0
- package/dist/core/store-contracts/contract-kit-version.d.ts +27 -0
- package/dist/core/store-contracts/file-snapshot-store-contract.d.ts +8 -0
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +42 -0
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +13 -0
- package/dist/core/strategy-store.d.ts +37 -0
- package/dist/core/stub-env.d.ts +7 -0
- package/dist/core/surrogate-safe-slice.d.ts +35 -0
- package/dist/core/task-notification.d.ts +202 -0
- package/dist/core/task-outcome.d.ts +53 -0
- package/dist/core/task-registry-agent.d.ts +337 -1
- package/dist/core/task-registry-agent.js +2 -0
- package/dist/core/task-registry-monitor.d.ts +12 -0
- package/dist/core/task-registry-shared.d.ts +540 -0
- package/dist/core/task-registry.d.ts +343 -0
- package/dist/core/task-registry.js +13 -2
- package/dist/core/task-tool-shape.d.ts +44 -0
- package/dist/core/tighten-task-spec.d.ts +21 -0
- package/dist/core/tool-detach.d.ts +21 -0
- package/dist/core/tool-errors.d.ts +131 -0
- package/dist/core/tool-errors.js +4 -0
- package/dist/core/tool-name-aliases.d.ts +27 -0
- package/dist/core/tool-policy.d.ts +555 -0
- package/dist/core/tool-policy.js +3 -0
- package/dist/core/tool-result-budget.d.ts +32 -0
- package/dist/core/tool-result-store.d.ts +174 -1
- package/dist/core/tools.d.ts +45 -0
- package/dist/core/trace.d.ts +323 -0
- package/dist/core/types.d.ts +3859 -2
- package/dist/core/untrusted-egress.d.ts +8 -0
- package/dist/core/untrusted-text.d.ts +156 -0
- package/dist/core/usage-window-store.d.ts +95 -0
- package/dist/core/version.d.ts +1 -0
- package/dist/core/warm-resume.d.ts +17 -0
- package/dist/core/wiring-manifest.d.ts +169 -0
- package/dist/core/with-retry.d.ts +24 -0
- package/dist/core/workflow-journal-store.d.ts +160 -0
- package/dist/core/workflow-run-store-contract.d.ts +25 -0
- package/dist/core/workflow-run-store.d.ts +119 -0
- package/dist/core/workflow-run-store.js +2 -0
- package/dist/engine/compaction/compaction.d.ts +256 -1
- package/dist/engine/compaction/utils.d.ts +94 -0
- package/dist/engine/execution-env/kill-tree.d.ts +29 -0
- package/dist/engine/execution-env/node-execution-env.d.ts +94 -0
- package/dist/engine/harness/agent-harness.d.ts +116 -0
- package/dist/engine/harness/agent-harness.js +3 -14
- package/dist/engine/harness/messages.d.ts +15 -0
- package/dist/engine/harness/types.d.ts +464 -2
- package/dist/engine/llm/diagnostics.d.ts +4 -0
- package/dist/engine/llm/event-stream.d.ts +3 -0
- package/dist/engine/llm/index.d.ts +7 -0
- package/dist/engine/llm/types.d.ts +500 -3
- package/dist/engine/llm/validation.d.ts +3 -0
- package/dist/engine/loop/agent-loop.d.ts +87 -2
- package/dist/engine/loop/runtime-deps.d.ts +7 -0
- package/dist/engine/loop/types.d.ts +424 -0
- package/dist/engine/lsp/frame-decoder.d.ts +13 -0
- package/dist/engine/lsp/node-lsp-manager.d.ts +107 -0
- package/dist/engine/lsp/stdio-lsp-transport.d.ts +7 -0
- package/dist/engine/session/import-validate.d.ts +27 -0
- package/dist/engine/session/log-digest.d.ts +93 -0
- package/dist/engine/session/memory-repo.d.ts +6 -0
- package/dist/engine/session/memory-storage.d.ts +2 -0
- package/dist/engine/session/session.d.ts +75 -0
- package/dist/engine/session/storage-base.d.ts +8 -0
- package/dist/fixtures/index.d.ts +36 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.js +1 -2
- package/dist/internal/harness-types.d.ts +6 -0
- package/dist/internal/harness.d.ts +11 -0
- package/dist/internal/llm.d.ts +6 -0
- package/dist/orchestration/builtin-workflows.d.ts +53 -0
- package/dist/orchestration/dev-vm-script-runner.d.ts +19 -0
- package/dist/orchestration/goal.d.ts +57 -0
- package/dist/orchestration/goal.js +3 -0
- package/dist/orchestration/run-spec.d.ts +42 -0
- package/dist/orchestration/run-spec.js +4 -0
- package/dist/orchestration/run-workflow-tool.d.ts +169 -0
- package/dist/orchestration/workflow-governance.d.ts +61 -0
- package/dist/orchestration/workflow-meta.d.ts +28 -0
- package/dist/orchestration/workflow-observe.d.ts +60 -0
- package/dist/orchestration/workflow-primitives.d.ts +23 -1
- package/dist/orchestration/workflow-sandbox-conformance.d.ts +38 -0
- package/dist/orchestration/workflow-script-runner.d.ts +88 -0
- package/dist/orchestration/workflow-script-store.d.ts +98 -0
- package/dist/orchestration/workflow-size-guideline.d.ts +67 -0
- package/dist/orchestration/workflow-types.d.ts +169 -2
- package/dist/orchestration/workflow.d.ts +358 -0
- package/dist/orchestration/workflow.js +13 -2
- package/dist/prompt-assembly/artifact-store.d.ts +33 -0
- package/dist/prompt-assembly/artifact.d.ts +25 -0
- package/dist/prompt-assembly/assemble.d.ts +20 -0
- package/dist/prompt-assembly/composer.d.ts +29 -0
- package/dist/prompt-assembly/epoch.d.ts +55 -1
- package/dist/prompt-assembly/event-registry.d.ts +35 -0
- package/dist/prompt-assembly/explain.d.ts +12 -0
- package/dist/prompt-assembly/tool-catalog.d.ts +38 -0
- package/dist/prompt-assembly/turn-snapshot.d.ts +40 -0
- package/dist/prompt-assembly/types.d.ts +115 -0
- package/dist/prompts/coordinator.d.ts +27 -0
- package/dist/prompts/default.d.ts +539 -0
- package/dist/prompts/simple-sections.d.ts +45 -0
- package/dist/prompts/supervisor.d.ts +66 -0
- package/dist/scenarios/env.d.ts +28 -0
- package/dist/scenarios/full-body.d.ts +50 -0
- package/dist/scenarios/scenario-registry.d.ts +60 -0
- package/dist/scenarios/teacher-quickstart.d.ts +27 -0
- package/dist/server/http.d.ts +17 -0
- package/dist/stores/cc/lockfile.d.ts +6 -0
- package/dist/stores/cc/mailbox-store.d.ts +8 -0
- package/dist/stores/cc/roster-adapter.d.ts +4 -0
- package/dist/stores/cc/sidecar-transcript.d.ts +66 -0
- package/dist/stores/file/background-agent-store.d.ts +24 -0
- package/dist/stores/file/background-agent-store.js +2 -1
- package/dist/stores/file/checkpoint-store.d.ts +38 -0
- package/dist/stores/file/file-snapshot-store.d.ts +25 -0
- package/dist/stores/file/fs-atomic.d.ts +155 -0
- package/dist/stores/file/index.d.ts +89 -0
- package/dist/stores/file/mailbox-store.d.ts +36 -0
- package/dist/stores/file/mailbox-store.js +2 -0
- package/dist/stores/file/memory-store.d.ts +82 -0
- package/dist/stores/file/permission-rule-store.d.ts +79 -0
- package/dist/stores/file/session-policy-store.d.ts +28 -0
- package/dist/stores/file/session-store.d.ts +40 -0
- package/dist/stores/file/shared-ledger.d.ts +83 -0
- package/dist/stores/file/tool-result-store.d.ts +11 -0
- package/dist/stores/file/usage-window-store.d.ts +18 -0
- package/dist/stores/file/workflow-journal-store.d.ts +100 -0
- package/dist/stores/file/workflow-run-store.d.ts +11 -0
- package/dist/stores/file/workflow-run-store.js +2 -0
- package/dist/tools/fs/bash-readonly-classifier.d.ts +282 -0
- package/dist/tools/fs/encoding.d.ts +60 -0
- package/dist/tools/fs/fs-bash.d.ts +133 -0
- package/dist/tools/fs/fs-pdf.d.ts +28 -0
- package/dist/tools/fs/fs-search-tools.d.ts +5 -0
- package/dist/tools/fs/fs-shared.d.ts +360 -0
- package/dist/tools/fs/fs-write.d.ts +16 -0
- package/dist/tools/fs/gh-rate-limit.d.ts +22 -0
- package/dist/tools/fs/index.d.ts +79 -0
- package/dist/tools/fs/notebook.d.ts +56 -0
- package/dist/tools/fs/pdf.d.ts +70 -0
- package/dist/tools/fs/pdf.js +8 -2
- package/dist/tools/fs/repo-map.d.ts +10 -0
- package/dist/tools/fs/safety.d.ts +376 -0
- package/dist/tools/fs/search.d.ts +131 -0
- package/dist/tools/loop-tick.d.ts +24 -0
- package/dist/tools/monitor.d.ts +55 -0
- package/dist/tools/scheduler-tools.d.ts +51 -0
- package/dist/tools/sql-adapters.d.ts +18 -0
- package/dist/tools/sql.d.ts +25 -0
- package/dist/tools/task-list.d.ts +77 -0
- package/dist/tools/todo.d.ts +8 -0
- package/dist/tools/web.d.ts +184 -0
- package/dist/tools/web.js +32 -5
- package/dist/tools/worktree.d.ts +81 -0
- package/package.json +2 -2
- package/dist/tools/gitea-issue.d.ts +0 -13
- package/dist/tools/gitea-issue.js +0 -75
|
@@ -1,9 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* design/116 detach(飞轮 [C] gap ②)— per-tool-call detach 信号毂。
|
|
3
|
+
*
|
|
4
|
+
* The missing middle of mid-flight ctrl+b: `TaskStream.detach(toolCallId)` fires the controller here; a
|
|
5
|
+
* detach-capable tool (Bash) picks the signal up BY toolCallId from its mount closure and threads it into
|
|
6
|
+
* `env.exec({ detachSignal })`, where the env adopts the running child as a background shell. Run-local
|
|
7
|
+
* (one hub per task, created in prepare-task) — never cross-task. Zero vendored surface: the loop's
|
|
8
|
+
* tool-call plumbing is untouched; the hub rides the existing closure path like taskRegistry does.
|
|
9
|
+
*
|
|
10
|
+
* `request()` uses create-then-abort so ordering races are safe: a detach that lands BEFORE the tool
|
|
11
|
+
* reads its signal still detaches (the tool receives an already-aborted signal and adopts immediately).
|
|
12
|
+
*/
|
|
1
13
|
export declare class ToolDetachHub {
|
|
2
14
|
private readonly controllers;
|
|
15
|
+
/** service [371]③: the detach verb is caller-exposed — an unknown/never-started toolCallId would otherwise
|
|
16
|
+
* strand its controller until run end (gc only fires on the real tool-completion path), a per-run memory
|
|
17
|
+
* growth vector. Bound the map: on overflow, evict the OLDEST entry (Map preserves insertion order); a
|
|
18
|
+
* live tool re-materializes its controller on the next signalFor() and an aborted one stays aborted via
|
|
19
|
+
* the tombstone set below. */
|
|
3
20
|
private static readonly MAX_CONTROLLERS;
|
|
21
|
+
/** Fired-but-evicted ids (bounded): keeps create-then-abort race safety across an eviction. */
|
|
4
22
|
private readonly firedTombstones;
|
|
5
23
|
private controllerFor;
|
|
24
|
+
/** The signal a detach-capable tool threads into its env call. */
|
|
6
25
|
signalFor(toolCallId: string): AbortSignal;
|
|
26
|
+
/** Fire a detach request for a (possibly not-yet-started) tool call. Idempotent. */
|
|
7
27
|
request(toolCallId: string): void;
|
|
28
|
+
/** Drop a finished call's controller (bounded memory; called from the tool's completion path). */
|
|
8
29
|
gc(toolCallId: string): void;
|
|
9
30
|
}
|
|
@@ -1,8 +1,139 @@
|
|
|
1
1
|
import type { TSchema } from "typebox";
|
|
2
|
+
/**
|
|
3
|
+
* Truncate a long error to head + "[N characters truncated]" + tail (design/64 §11.2, CC parity).
|
|
4
|
+
*
|
|
5
|
+
* Anchored on CC 2.1.220 `A7e` (the current authority; the previous anchor was CC 88's `toolErrors.ts`,
|
|
6
|
+
* which cut at raw code-unit indices): head and tail are cut on a code-POINT boundary — an astral character
|
|
7
|
+
* straddling either cut is dropped whole rather than emitted as a lone surrogate — and the reported count is
|
|
8
|
+
* `len − head − tail`, i.e. derived from what was actually KEPT, so a rollback is not under-reported.
|
|
9
|
+
*
|
|
10
|
+
* DELIBERATE DIVERGENCE from the sibling truncators in this repo (mcp.ts `truncateMcpErrorText`,
|
|
11
|
+
* engine/compaction `truncateForSummary`, untrusted-egress `boundedString`), which iterate the kept length
|
|
12
|
+
* down so the marker fits INSIDE the budget (RB-152): here the marker is NOT budgeted — a barely-over input
|
|
13
|
+
* comes back ~36 chars LONGER than the budget. That is CC-verbatim behaviour (`A7e` keeps 5000+marker+5000),
|
|
14
|
+
* it is pinned as a contract in test/core-toolgate-coverage.test.ts, and changing it would be a divergence
|
|
15
|
+
* FROM the anchor, not a fix. Recorded as an intentional divergence in the cc-parity divergence registry
|
|
16
|
+
* (internal assets repo, `cc-parity/`), not as an open defect.
|
|
17
|
+
*/
|
|
2
18
|
export declare function truncateError(s: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* RB-198 F4: shared clip primitive originally grown inside task-registry's `clipTaskOutput` (CC `FHl`
|
|
21
|
+
* shape, pretty.js:458012-458016) and extracted here so a SECOND caller (the foreground Bash tool) gets
|
|
22
|
+
* the SAME already-hardened arithmetic instead of a parallel reimplementation — RB-85 (pointer-fit at the
|
|
23
|
+
* boundary), RB-112 (pointer-only fallback bound), and RB-122 (surrogate-pair-safe split) were each a real
|
|
24
|
+
* bug found by a red probe against THIS algorithm; a second copy would start over with none of them fixed.
|
|
25
|
+
* TAIL-keep behind a `[Truncated. Full output: <path>]` pointer when a full-output file is available (the
|
|
26
|
+
* tail is the part a long-running command's caller most needs — errors/summaries land at the end); without
|
|
27
|
+
* a file, legacy head+tail middle-omission (there is no path to point at, and the head often carries
|
|
28
|
+
* status a bare tail-keep would drop).
|
|
29
|
+
*/
|
|
3
30
|
export declare function clipWithFilePointer(s: string, limit: number, fullOutputPath?: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Format a thrown tool error into model-facing text (design/64 §11.1/§11.2): a shell/exec error becomes
|
|
33
|
+
* `Exit code N` + stderr + stdout; a plain Error becomes its message (+ any captured streams); anything
|
|
34
|
+
* else is stringified. The result is truncated to {@link MAX_ERROR_CHARS}. An AbortError is reported as an
|
|
35
|
+
* interruption.
|
|
36
|
+
*/
|
|
4
37
|
export declare function formatToolError(error: unknown): string;
|
|
38
|
+
/**
|
|
39
|
+
* A typed, read-side fold of a `TaskResult.errorCode` into the failure CLASS it belongs to (design/80
|
|
40
|
+
* D-G data contract; the WorkerReport "errorClass" small-slice). A terminal `errorCode` (1.37+) is a
|
|
41
|
+
* **dotted namespace** (`limits.max_tokens_exceeded` / `limits.max_cost_exceeded` / `output.invalid` …)
|
|
42
|
+
* so a consumer can prefix-match a whole CLASS — but every aggregator/consumer hand-rolls
|
|
43
|
+
* `errorCode.startsWith("budget.")` (types.ts:707 documents this very pattern), which silently
|
|
44
|
+
* mis-classifies any code that does NOT follow the convention and drifts as new prefixes are added.
|
|
45
|
+
* This is the single shared folder.
|
|
46
|
+
*
|
|
47
|
+
* - `budget` — the cost/token budget gate fired (`limits.max_tokens_exceeded` / `limits.max_cost_exceeded`).
|
|
48
|
+
* - `limit` — a hard run limit fired (`limits.max_turns_exceeded` / `limits.max_walltime_exceeded`).
|
|
49
|
+
* - `output` — the structured/answer output was rejected (`output.invalid` / `output.degenerate`).
|
|
50
|
+
* - `suspend` — the suspend-loop cap fired (`suspend.loop`); a TERMINAL failure, distinct from a
|
|
51
|
+
* resumable `suspended` status (which carries no errorCode).
|
|
52
|
+
* - `review` — a review-pause terminal (`review.pending`).
|
|
53
|
+
* - `unexpected` — a nested orchestrator mapped an unexpected durable pause to failed
|
|
54
|
+
* (`unexpected.suspended` / `unexpected.needs_review`, design/45 §11 Q6 / design/80 D-B).
|
|
55
|
+
* - `oracle` — a verifier/oracle invariant breach (`oracle.unprotected`).
|
|
56
|
+
* - `resume` — a post-CAS resume/restore infrastructure failure (`resume.env_failed` /
|
|
57
|
+
* `resume.tool_unavailable`, design/45/49); a RETRYABLE basis (the work is still pending,
|
|
58
|
+
* the checkpoint is reopenable) — distinct from a logical failure, so consumers can retry.
|
|
59
|
+
* - `config` — a task-spec / assembly rejection raised in `prepare()` (`config.egress_requires_write_effect`
|
|
60
|
+
* / `config.reserved_tool_name`); a deterministic configuration error (re-running the same
|
|
61
|
+
* spec re-fails). ALSO the deployment governance-plane terminals that share the SAME
|
|
62
|
+
* registry (governance-codes.ts `GOVERNANCE_CODES` mixes them with `config.*` in one
|
|
63
|
+
* table): `memory.admission_required` / `memory.admission_denied` (org-memory admission,
|
|
64
|
+
* genuinely `prepare()`-raised, same shape as the config.* codes above) plus the two
|
|
65
|
+
* EXTERNAL/platform-cause terminals `usage.window_exhausted` (a deployment usage-governance
|
|
66
|
+
* window is full — mid-run or at entry, design/164 件五) and `env.lifetime_expired` (the
|
|
67
|
+
* execution environment's platform lifetime ran out — an engine-detected MID-RUN stop at a
|
|
68
|
+
* clean turn boundary, design/164 件四; NOT a `prepare()`-time rejection like its
|
|
69
|
+
* `config.env_lifetime_invalid` config-time sibling). The two platform-cause codes are
|
|
70
|
+
* DEFERRED-retryable (a usage window frees, a fresh environment can be provisioned) —
|
|
71
|
+
* genuinely NOT "never retryable, malformed request" in the literal sense of the codes
|
|
72
|
+
* above; they are grouped into this class as the SAME deployment-governance DOMAIN (per
|
|
73
|
+
* governance-codes.ts's own table membership and the calling convention's explicit
|
|
74
|
+
* direction), not as a retry verdict. This class NEVER carries the retry answer for
|
|
75
|
+
* ANY of its members — a caller that needs it reads the PER-CODE source of truth:
|
|
76
|
+
* `TaskResult.retryAfterMs` (set ONLY for `usage.window_exhausted`, per its own
|
|
77
|
+
* in-presence condition) for that one code, or the errorCode's own doc for every other
|
|
78
|
+
* member (`env.lifetime_expired`'s doc says "retrying needs a NEW environment, not a
|
|
79
|
+
* smaller budget" — there is no `retryAfterMs` for it, by design: an expiring
|
|
80
|
+
* environment has no return time to give). Codex adversarial review (rounds 2 and 4)
|
|
81
|
+
* twice suggested a distinct governance/platform class or leaving these `unknown`
|
|
82
|
+
* instead — rejected both times: (a) explicit calling-convention direction; (b)
|
|
83
|
+
* `WorkerErrorClass` is a small CLOSED public exported union — adding a member is an
|
|
84
|
+
* API-surface/release-tier decision outside a mechanical fix batch's mandate, and
|
|
85
|
+
* `unknown` would UNDO the very audit finding this folder exists to fix (these ARE real
|
|
86
|
+
* terminal codes, not foreign ones); (c) pre-existing precedent (`config.compliance_required`,
|
|
87
|
+
* NOT part of this diff) already folds a transient/retryable governance code into `config`.
|
|
88
|
+
* `memory.admission_required`/`_denied`/`env.lifetime_expired` are EXACT codes, not broad
|
|
89
|
+
* `memory.`/`env.` prefixes — codex adversarial review (A-005.3 follow-up) caught an
|
|
90
|
+
* earlier draft folding EVERY `memory.*`/`env.*` code here, which misclassified the
|
|
91
|
+
* memory-engine's non-governance incident codes (`memory.secret_detected` et al.,
|
|
92
|
+
* explicitly listed as NON-governance in `NON_GOVERNANCE_MEMORY_CODES` — a content-safety
|
|
93
|
+
* tool-call refusal, not a task-spec rejection) as configuration failures. `usage.*` STAYS
|
|
94
|
+
* a broad prefix: governance-codes.ts's own `governanceRetryClass` already treats every
|
|
95
|
+
* `usage.*` code (registered or not) as governance by prefix — a deliberate legacy-family
|
|
96
|
+
* rule this folder mirrors rather than re-deciding (codex round 2 questioned whether that
|
|
97
|
+
* mirroring is appropriate across the two taxonomies; kept as-is per the calling
|
|
98
|
+
* convention's explicit direction — see the function's SCOPE note for the boundary this
|
|
99
|
+
* folder does and does not draw).
|
|
100
|
+
* - `conflict` — a cross-instance optimistic-lock loss (flat `"conflict"`, unchanged 1.36 code).
|
|
101
|
+
* - `brain` — a model/transport failure lifted from the brain (flat `auth` / `rate_limit` /
|
|
102
|
+
* `invalid_request` / `server` / `network` / `http`; see brain/errors.ts).
|
|
103
|
+
* - `aborted` — a step was aborted (flat `"aborted"`).
|
|
104
|
+
* - `unknown` — no code, or a code outside every known class (the safe catch-all).
|
|
105
|
+
*/
|
|
5
106
|
export type WorkerErrorClass = "budget" | "limit" | "output" | "suspend" | "review" | "unexpected" | "oracle" | "resume" | "config" | "conflict" | "brain" | "aborted" | "unknown";
|
|
107
|
+
/**
|
|
108
|
+
* Fold a {@link "../core/types.js".TaskResult}.`errorCode` into its typed {@link WorkerErrorClass} (design/80
|
|
109
|
+
* D-G). PURE and DERIVED — it reads an existing code, never produces or changes one; an unknown / missing
|
|
110
|
+
* code folds to `"unknown"` (never throws). Replaces scattered `errorCode.startsWith("budget.")` consumer
|
|
111
|
+
* code with one tested folder so the class taxonomy lives in exactly one place.
|
|
112
|
+
*
|
|
113
|
+
* SCOPE: this folds a TERMINAL `TaskResult.errorCode` only — i.e. every OUR dotted prefix that the runner can
|
|
114
|
+
* assemble into a failed task outcome (`limits.`/`output.`/`suspend.`/`review.`/`unexpected.`/
|
|
115
|
+
* `oracle.`/`resume.`/`config.`/`usage.`) as a broad PREFIX, plus `memory.admission_required` /
|
|
116
|
+
* `memory.admission_denied` / `env.lifetime_expired` as EXACT codes (their sibling `memory.*`/`env.*` strings
|
|
117
|
+
* are NOT all terminal-errorCode-shaped — see {@link EXACT_CODE_CLASS}'s comment), plus the flat 1.36 codes.
|
|
118
|
+
* The `limits.` namespace splits into the `budget` and `limit` classes by exact code — see
|
|
119
|
+
* {@link EXACT_CODE_CLASS}. Operation-level dotted codes that are surfaced to a *caller* and never become a
|
|
120
|
+
* task outcome are deliberately OUT of scope: `steering.*` (`steering.not_running`/`steering.invalid_content`,
|
|
121
|
+
* rejected to the `steer()` caller) and `mcp.*` (`mcp.server_unavailable`, an `onWarn` warning code) — neither
|
|
122
|
+
* reaches `TaskResult.errorCode`, so a caller will never pass them here. A genuinely unmapped code → `"unknown"` (which therefore means
|
|
123
|
+
* "known-but-foreign or no code", e.g. a leaked fs/Node code, NOT "an OUR terminal class we forgot to add").
|
|
124
|
+
*/
|
|
6
125
|
export declare function errorClassOf(errorCode: string | undefined): WorkerErrorClass;
|
|
126
|
+
/**
|
|
127
|
+
* Convert a TypeBox/JSON-Schema error path (`/todos/0/activeForm`) into a readable accessor
|
|
128
|
+
* (`todos[0].activeForm`), CC `formatValidationPath` parity. Numeric segments become `[i]`, named
|
|
129
|
+
* segments become `.name`. Empty path → "" (the root object).
|
|
130
|
+
*/
|
|
7
131
|
export declare function formatValidationPath(path: string): string;
|
|
132
|
+
/**
|
|
133
|
+
* Turn a schema-validation failure into a human-readable message (design/64 §11.3 / §16.4). Reports the
|
|
134
|
+
* parameter NAME + the expected type only — never an absolute path, stack trace, or filesystem context, so
|
|
135
|
+
* a validation message can't leak internals (§16.4). Examples:
|
|
136
|
+
* - "The required parameter `todos` is missing."
|
|
137
|
+
* - "The parameter `questions[0].options` is invalid: Expected array."
|
|
138
|
+
*/
|
|
8
139
|
export declare function formatZodValidationError(schema: TSchema, value: unknown): string;
|
package/dist/core/tool-errors.js
CHANGED
|
@@ -70,6 +70,9 @@ const EXACT_CODE_CLASS = new Map([
|
|
|
70
70
|
["limits.max_cost_exceeded", "budget"],
|
|
71
71
|
["limits.max_turns_exceeded", "limit"],
|
|
72
72
|
["limits.max_walltime_exceeded", "limit"],
|
|
73
|
+
["memory.admission_required", "config"],
|
|
74
|
+
["memory.admission_denied", "config"],
|
|
75
|
+
["env.lifetime_expired", "config"],
|
|
73
76
|
]);
|
|
74
77
|
const DOTTED_PREFIX_CLASS = [
|
|
75
78
|
["limits.", "limit"],
|
|
@@ -80,6 +83,7 @@ const DOTTED_PREFIX_CLASS = [
|
|
|
80
83
|
["oracle.", "oracle"],
|
|
81
84
|
["resume.", "resume"],
|
|
82
85
|
["config.", "config"],
|
|
86
|
+
["usage.", "config"],
|
|
83
87
|
];
|
|
84
88
|
export function errorClassOf(errorCode) {
|
|
85
89
|
if (!errorCode)
|
|
@@ -1 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RB-476-A stage 2 (ruling 2026-08-02, RB-476 "no compatibility surface survives", replay
|
|
3
|
+
* resolution included) — the durable-name machinery this module used to hold is RETIRED:
|
|
4
|
+
*
|
|
5
|
+
* - `OLD_TO_NEW` (the Q6/design-108/design-115 persisted-name normalization) and the MCP `mcp__`
|
|
6
|
+
* prefix arm are gone: a persisted checkpoint/orphan/policy entry carrying a pre-rename name no
|
|
7
|
+
* longer resolves to the live roster. Old durable state misses LOUDLY (`resume.tool_unavailable`
|
|
8
|
+
* on a resumed checkpoint, a roster miss on replay) — by ruling, old sessions are sacrificed
|
|
9
|
+
* rather than carried.
|
|
10
|
+
* - `canonicalToolName` is gone with it: with the mapping cleared it was the identity function, and
|
|
11
|
+
* keeping an identity shim invites the next mapping to grow back silently.
|
|
12
|
+
* - `TOMBSTONED_TOOLS` (per-name re-education messages) is gone: a retired name now gets the same
|
|
13
|
+
* loud generic roster miss as any unknown tool.
|
|
14
|
+
*
|
|
15
|
+
* What REMAINS is validation data only: {@link RETIRED_TOOL_NAMES} maps every name the engine ever
|
|
16
|
+
* retired to a one-line guidance string. It exists because deleting the mapping flips stale POLICY
|
|
17
|
+
* entries from "silently matched" to "silently matches nothing" — and for a deny/requireApproval
|
|
18
|
+
* entry that direction WIDENS the surface. The prepare-time policy-name audit (runner/prepare-task.ts)
|
|
19
|
+
* escalates a retired name that matches nothing in the run's roster from advisory to a HARD,
|
|
20
|
+
* coordinates-carrying failure (`config.legacy_tool_name`) — `validatePermissionRules`
|
|
21
|
+
* (permission-rules.ts) does NOT classify retired names itself; a retired-name entry is a raw,
|
|
22
|
+
* ordinary-looking tool name to its compile pass by design (RB-476-A: that classification is the
|
|
23
|
+
* roster-aware prepare-time audit's job, not the compile pass's, since compile time cannot know
|
|
24
|
+
* which names a deployment mounts its OWN tool under). A deployment that mounts its OWN tool under
|
|
25
|
+
* one of these names is unaffected either way: the name is then in the roster, matches, and is never
|
|
26
|
+
* audited as stale.
|
|
27
|
+
*/
|
|
1
28
|
export declare const RETIRED_TOOL_NAMES: ReadonlyMap<string, string>;
|