@sema-agent/core 5.20.0 → 5.21.1
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 +19 -0
- 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/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/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 +107 -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 +292 -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 +608 -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/mcp.d.ts +381 -0
- 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 +33 -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 +12 -11
- package/dist/core/runner/prompt-suggestions.d.ts +7 -0
- package/dist/core/runner/runtask.d.ts +304 -3
- 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-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-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/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 +16 -1
- package/dist/index.js +0 -1
- 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-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/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/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/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/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-search-tools.js +0 -1
- 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/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,21 +1,53 @@
|
|
|
1
1
|
import type { AgentMessage } from "../internal/harness-types.js";
|
|
2
2
|
import { type ToolResultStore } from "./tool-result-store.js";
|
|
3
|
+
/**
|
|
4
|
+
* Per-message aggregate tool-result budget (design/64 §17.2 / §24 — CC `MAX_TOOL_RESULTS_PER_MESSAGE_CHARS`,
|
|
5
|
+
* `constants/toolLimits.ts:49`). A single turn's batch of N parallel tool results can each be under the
|
|
6
|
+
* per-tool offload threshold yet SUM past the model/API limit (10×40K = 400K). This caps the aggregate of
|
|
7
|
+
* one turn's tool_result batch: while over budget, the LARGEST fresh non-exempt result is offloaded to a
|
|
8
|
+
* preview (largest-first), repeating until the batch fits.
|
|
9
|
+
*
|
|
10
|
+
* **Simpler than CC by construction (§24.2):** a request-only, non-destructive transform (returns a new
|
|
11
|
+
* array; the durable session keeps full results) applied in the existing `harness.on("context")` hook —
|
|
12
|
+
* the same per-query point as `clearStaleToolResults` (the mirror of CC's query.ts:379). It is DETERMINISTIC
|
|
13
|
+
* (stable `ref = tr_<sessionId>_<toolCallId>` + deterministic {@link buildPreview}), so re-running it every
|
|
14
|
+
* query yields byte-identical previews → prompt-cache safe **without** CC's ContentReplacementState freeze
|
|
15
|
+
* machine (the determinism IS the freeze), and resume-free (the transcript holds originals; this re-applies
|
|
16
|
+
* on replay). Reuses design/30's offload store + preview format; with no store it falls back to a
|
|
17
|
+
* self-contained head+tail truncation preview that still bounds the request.
|
|
18
|
+
*/
|
|
19
|
+
/** CC's per-message cap (chars, not tokens — the "100K token" figure in old notes was unsourced). */
|
|
3
20
|
export declare const AGGREGATE_TOOL_RESULT_BUDGET_CHARS = 200000;
|
|
4
21
|
export interface AggregateBudgetOptions {
|
|
22
|
+
/** Per-batch char budget. Default {@link AGGREGATE_TOOL_RESULT_BUDGET_CHARS}. */
|
|
5
23
|
budgetChars?: number;
|
|
24
|
+
/** Tool names exempt from the budget (their own caps bound them) — e.g. read_file, read_tool_result. */
|
|
6
25
|
exemptTools?: ReadonlySet<string>;
|
|
26
|
+
/** design/30 store for offload+read-back. Absent ⇒ self-contained truncation preview. */
|
|
7
27
|
store?: ToolResultStore;
|
|
28
|
+
/** Namespaces the stable ref so an offloaded result is globally addressable. */
|
|
8
29
|
sessionId: string;
|
|
30
|
+
/** service [398] C8: fired once per result actually capped (offloaded OR degraded to a truncation
|
|
31
|
+
* preview). `storeFallback` = the model LOST read-back for this result (store.put failed / no store)
|
|
32
|
+
* — the silent-degradation face this callback exists for. Must not throw (caller-side contract). */
|
|
9
33
|
onCapped?: (info: {
|
|
10
34
|
tool?: string;
|
|
11
35
|
sizeChars: number;
|
|
12
36
|
storeFallback: boolean;
|
|
13
37
|
}) => void;
|
|
38
|
+
/** RB-142: fired once per batch that is STILL over budget after both passes — i.e. the cap did what it
|
|
39
|
+
* could and the request is going out oversized anyway. Reachable when a batch holds more results than
|
|
40
|
+
* the budget can hold even at the minimum preview size (a compact preview has a floor, and N of them
|
|
41
|
+
* cannot be smaller than N × that floor). Before this existed the shortfall was entirely silent, so a
|
|
42
|
+
* caller could not tell "capped and fits" from "capped and still 2× over". Must not throw. */
|
|
14
43
|
onBudgetUnreachable?: (info: {
|
|
15
44
|
batchChars: number;
|
|
16
45
|
budgetChars: number;
|
|
17
46
|
results: number;
|
|
18
47
|
}) => void;
|
|
19
48
|
}
|
|
49
|
+
/** Default exemptions: tools whose result is self-bounded (read_file errors at its own token cap; the
|
|
50
|
+
* offload reader pages small slices). grep/bash/glob/web_fetch/MCP are the risk sources, NOT exempt. */
|
|
20
51
|
export declare const DEFAULT_BUDGET_EXEMPT_TOOLS: ReadonlySet<string>;
|
|
52
|
+
/** Cap each over-budget turn-batch (run of consecutive tool_result messages). Request-only; see file docs. */
|
|
21
53
|
export declare function capAggregateToolResults(messages: AgentMessage[], opts: AggregateBudgetOptions): Promise<AgentMessage[]>;
|
|
@@ -1,21 +1,112 @@
|
|
|
1
1
|
import type { AgentTool } from "../internal/harness-types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Pluggable backing store for **offloaded large tool results** (design/30). When a tool returns more
|
|
4
|
+
* text than the threshold, the full content is moved here and the conversation keeps only a preview +
|
|
5
|
+
* a `ref`; the model fetches the rest via the injected `read_tool_result` tool. This is the local,
|
|
6
|
+
* provider-agnostic equivalent of CC's `toolResultStorage` (no Anthropic `cache_edits` dependency).
|
|
7
|
+
*
|
|
8
|
+
* Default is {@link InMemoryToolResultStore} (task-scoped, lives only for the run). Inject a durable
|
|
9
|
+
* implementation (TiDB/blob, keyed by the opaque `ref`) so an offloaded result survives wake/resume;
|
|
10
|
+
* with the in-memory default, a fetch after a cross-process wake returns undefined and the model is told
|
|
11
|
+
* the output is no longer available — the preview still stands in context, so it degrades, never crashes.
|
|
12
|
+
*/
|
|
2
13
|
export interface ToolResultStore {
|
|
14
|
+
/**
|
|
15
|
+
* Managed-retention declaration (ruled 2026-08-05, retention.ts): `"managed"` promises the
|
|
16
|
+
* `ManagedRetentionCapability` contract (scheduled, tenant-scoped, audited deletion); `"none"` (or
|
|
17
|
+
* ABSENT — read fail-closed as `"none"`) states the store cannot delete on schedule. A deployment
|
|
18
|
+
* with a LOCKED retention policy refuses to start over a `"none"` store. Declaration, never
|
|
19
|
+
* duck-typing.
|
|
20
|
+
*/
|
|
3
21
|
readonly retention?: import("./retention.js").RetentionDeclaration;
|
|
22
|
+
/**
|
|
23
|
+
* Persist full content under a stable `ref`. **Write-once and idempotent**: if `ref` already exists,
|
|
24
|
+
* keep the existing content and do nothing (the aggregate budget re-runs every query with the same
|
|
25
|
+
* deterministic ref, so `put` for an already-stored ref MUST be a no-op — re-writing would risk a
|
|
26
|
+
* non-identical preview and break the prompt cache). A durable backend treats `ref` as the primary key
|
|
27
|
+
* and should validate/sanitize it (it is composed from sessionId+toolCallId, not raw model input, but a
|
|
28
|
+
* durable store still owns key hygiene for its storage layer). RB-266: the floor of that hygiene is
|
|
29
|
+
* NOT per-backend — every implementation rejects the unsafe ref set via {@link assertSafeToolResultRef}
|
|
30
|
+
* (a volatile backend silently accepting what a durable one rejects is the drift this closes).
|
|
31
|
+
*/
|
|
4
32
|
put(ref: string, content: string): Promise<void> | void;
|
|
33
|
+
/** Read a slice of the stored content. Unknown `ref` → undefined. */
|
|
5
34
|
get(ref: string, opts?: {
|
|
6
35
|
offset?: number;
|
|
7
36
|
limit?: number;
|
|
8
37
|
}): Promise<ToolResultSlice | undefined> | ToolResultSlice | undefined;
|
|
9
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* RB-266 — the ref-safety half of the {@link ToolResultStore} contract, shared by every backend.
|
|
41
|
+
*
|
|
42
|
+
* Why it is central and not per-backend: the file backend has always rejected these refs (its path
|
|
43
|
+
* component guard, `stores/file/fs-atomic.ts:48`), while the in-memory backend accepted them
|
|
44
|
+
* silently — the SAME ref stored fine in dev and threw in a durable deployment. That is the
|
|
45
|
+
* "backend outside the shared contract drifts on its own" mechanism (same family as RB-86/MB1 on
|
|
46
|
+
* MailboxStore), and the honest direction is the strict one: a ref that no durable backend can key
|
|
47
|
+
* is a defect at the WRITE, not something a volatile backend should quietly absorb.
|
|
48
|
+
*
|
|
49
|
+
* The rejected set is deliberately the intersection-unsafe one — empty / `.` / `..` / path
|
|
50
|
+
* separators / control characters — i.e. refs that are unusable as a key ANYWHERE (they traverse in
|
|
51
|
+
* a path-backed store and are ambiguous in every other). Backends may still be stricter about their
|
|
52
|
+
* own storage layer (the file backend additionally enforces a filename charset); that extra
|
|
53
|
+
* strictness is a backend capability, not part of this contract.
|
|
54
|
+
*
|
|
55
|
+
* Read face stays lenient by design: `get` with such a ref returns `undefined` (an unknown ref), it
|
|
56
|
+
* does NOT throw — the model is told the output is gone and the run degrades instead of crashing.
|
|
57
|
+
*
|
|
58
|
+
* RB-273 amends one clause of the above: a backend may be stricter about its own STORAGE LAYER, but not
|
|
59
|
+
* about which refs it accepts. A ref this function accepts must round-trip on every backend — a backend
|
|
60
|
+
* whose native key space is narrower (the file one's filename charset) owns an injective ENCODING into
|
|
61
|
+
* that space, not a rejection. Otherwise the same "dev green / deployment red" split this rule closed
|
|
62
|
+
* for `..` simply reappears one charset over (it did: a `:` in a provider-minted toolCallId).
|
|
63
|
+
*/
|
|
10
64
|
export declare function assertSafeToolResultRef(ref: string): void;
|
|
65
|
+
/**
|
|
66
|
+
* RB-273 — the SINGLE mint point for a tool-result `ref`. Three call sites compose the same
|
|
67
|
+
* `tr_<sessionId>_<toolCallId>` string (`withToolResultOffload` here, the aggregate budget's preview
|
|
68
|
+
* pass, and the runner's clear-with-offload persist); this is that string's one definition.
|
|
69
|
+
*
|
|
70
|
+
* Why it must sanitize: `sessionId` is engine-minted, but **`toolCallId` is PROVIDER-minted** — it is
|
|
71
|
+
* whatever the model gateway put in the tool-call frame, not something core controls. Providers ship
|
|
72
|
+
* ids with `:` in them, and nothing stops one shipping a `/`. Composed raw, that produced two distinct
|
|
73
|
+
* failures, both far from their cause:
|
|
74
|
+
* - `/` or a control char ⇒ the ref violates {@link assertSafeToolResultRef} ⇒ `put` THROWS at mint,
|
|
75
|
+
* i.e. an offload (a context-economy optimization) turns a working tool call into a failed one;
|
|
76
|
+
* - `:` ⇒ accepted by memory/pg, rejected by the file backend's filename charset ⇒ the classic
|
|
77
|
+
* dev-green/deployment-red split (`probe-r5-store-parity-matrix`'s last two divergent cells).
|
|
78
|
+
*
|
|
79
|
+
* The mapping is IDENTITY for every id already in the native charset — which is all of them in practice
|
|
80
|
+
* (`toolu_…`, `call_…`, uuids) — so refs minted before this existed are byte-identical afterwards and
|
|
81
|
+
* the prompt-cache stability the preview rests on is untouched. Only an out-of-charset (or absurdly
|
|
82
|
+
* long) segment is folded, and then INJECTIVELY: readable base + a sha256 of the RAW segment, the same
|
|
83
|
+
* construction (and the same reason: two distinct ids must never collide onto one ref, which would
|
|
84
|
+
* cross-serve one tool's output as another's) as `sanitizeScope` in the file store.
|
|
85
|
+
*
|
|
86
|
+
* Read-back of refs minted BEFORE this change is unaffected in both directions: safe ids are unchanged,
|
|
87
|
+
* and an unsafe one only ever lived in a memory/pg deployment, where the ref the model reads back comes
|
|
88
|
+
* from the `<persisted-output ref="…">` text already in its context — the read path does not re-mint,
|
|
89
|
+
* and `get` is keyed on that literal string.
|
|
90
|
+
*/
|
|
11
91
|
export declare function buildToolResultRef(sessionId: string, toolCallId: string): string;
|
|
12
92
|
export interface ToolResultSlice {
|
|
13
93
|
content: string;
|
|
94
|
+
/** Byte/char offset this slice starts at. */
|
|
14
95
|
offset: number;
|
|
96
|
+
/** Total chars of the full stored content. */
|
|
15
97
|
totalChars: number;
|
|
16
98
|
}
|
|
99
|
+
/** Default in-memory store (no cross-process durability); write-once per ref.
|
|
100
|
+
*
|
|
101
|
+
* Blackboard 2026-07-03 (clay dogfood: `ReadToolResult(ref)` came back empty for a workflow child's
|
|
102
|
+
* offloaded output): the Runner now shares ONE instance across its tasks (instead of a per-task
|
|
103
|
+
* island), so a parent can deref a child's ref within the process. A shared long-lived instance
|
|
104
|
+
* needs a bound — `maxTotalChars` FIFO-evicts the oldest refs past the cap (an evicted deref lands
|
|
105
|
+
* on the existing honest "may have expired" text). Durability across restarts still requires a real
|
|
106
|
+
* store (e.g. FileToolResultStore) via `RunnerDeps.toolResultStore`. */
|
|
17
107
|
export declare class InMemoryToolResultStore implements ToolResultStore {
|
|
18
108
|
private readonly opts?;
|
|
109
|
+
/** put/get only — no scheduled deletion contract: honestly `"none"` (retention.ts). */
|
|
19
110
|
readonly retention: "none";
|
|
20
111
|
private readonly map;
|
|
21
112
|
private totalChars;
|
|
@@ -23,41 +114,123 @@ export declare class InMemoryToolResultStore implements ToolResultStore {
|
|
|
23
114
|
maxTotalChars?: number;
|
|
24
115
|
} | undefined);
|
|
25
116
|
put(ref: string, content: string): void;
|
|
117
|
+
/** design/80 D-2: true when NOTHING has been offloaded — a durable suspend can then proceed safely even on
|
|
118
|
+
* this in-memory store, because a cross-replica resume has no offloaded result to deref to null. */
|
|
26
119
|
isEmpty(): boolean;
|
|
27
120
|
get(ref: string, opts?: {
|
|
28
121
|
offset?: number;
|
|
29
122
|
limit?: number;
|
|
30
123
|
}): ToolResultSlice | undefined;
|
|
31
124
|
}
|
|
125
|
+
/** Marker subclass for the Runner's own shared fallback instance (no injected store). prepare-task
|
|
126
|
+
* detects it and wraps a per-task {@link ScopedToolResultStore} around it — an INJECTED store is
|
|
127
|
+
* never wrapped (a multi-tenant deployment that injects a durable store owns its own scoping). */
|
|
32
128
|
export declare class RunnerSharedToolResultStore extends InMemoryToolResultStore {
|
|
33
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Per-task view over the Runner-shared fallback (impl-review 2026-07-03, codex 2 BLOCKER):
|
|
132
|
+
* 1. **Tenant isolation**: refs are namespaced by the task's trust scope (principal), so tenant B's
|
|
133
|
+
* `ReadToolResult` can never deref tenant A's ref — the per-task-instance era made this isolation
|
|
134
|
+
* implicit; sharing one instance re-opened it. Same-scope cross-task deref (the A2 fix's whole
|
|
135
|
+
* point) still works: same scope ⇒ same namespace.
|
|
136
|
+
* 2. **D-2 durable-suspend gate fidelity**: `isEmpty()` reflects only THIS task's offloads (local put
|
|
137
|
+
* count) — matching the per-task-instance semantics the gate was written against — so an unrelated
|
|
138
|
+
* prior task's offloaded entry can no longer disable durable suspend for a task that offloaded
|
|
139
|
+
* nothing (prepare-task's fail-fast reads `isEmpty()`).
|
|
140
|
+
*/
|
|
34
141
|
export declare class ScopedToolResultStore implements ToolResultStore {
|
|
35
142
|
private readonly inner;
|
|
36
143
|
private readonly scope;
|
|
37
144
|
private localPuts;
|
|
145
|
+
/** True when the underlying shared store is process-memory (volatile across replicas) — the D-2
|
|
146
|
+
* suspend gate treats a NON-empty volatile store as unsafe to durably suspend. */
|
|
38
147
|
readonly volatileBacking: boolean;
|
|
39
148
|
constructor(inner: ToolResultStore, scope: string);
|
|
149
|
+
/** Length-prefixed namespace — unambiguous for any scope string (no delimiter-injection ambiguity).
|
|
150
|
+
* RB-266: the scope segment is percent-ENCODED (injective, and its output charset carries no path
|
|
151
|
+
* separator or control character), so a deployment whose trust scope contains one cannot compose a
|
|
152
|
+
* key the inner store must reject — the ref-safety rule then applies to the caller's ref alone. */
|
|
40
153
|
private key;
|
|
41
154
|
put(ref: string, content: string): Promise<void> | void;
|
|
42
155
|
get(ref: string, opts?: {
|
|
43
156
|
offset?: number;
|
|
44
157
|
limit?: number;
|
|
45
158
|
}): Promise<ToolResultSlice | undefined> | ToolResultSlice | undefined;
|
|
159
|
+
/** THIS task's offload count only — the D-2 gate's per-task semantics (see class doc). */
|
|
46
160
|
isEmpty(): boolean;
|
|
47
161
|
}
|
|
162
|
+
/** True when a durable suspend would lose offloaded results held only in process memory (D-2 gate). */
|
|
48
163
|
export declare function isVolatileOffloadStore(store: ToolResultStore): boolean;
|
|
164
|
+
/** Reserved name of the injected large-result reader (design/108 PascalCase: `read_tool_result`→`ReadToolResult`). */
|
|
49
165
|
export declare const OFFLOAD_TOOL_NAME = "ReadToolResult";
|
|
166
|
+
/**
|
|
167
|
+
* RB-469-d — the runner's clear-with-offload persist, as ONE construction point (the closure used to
|
|
168
|
+
* live inline in prepare-task). Fire-and-forget by design (the caller returns the ref synchronously),
|
|
169
|
+
* but a failed put no longer strands the model with a ref pointing at nothing: a tiny lost-marker is
|
|
170
|
+
* written under the same ref so the page-back face reports the true cause (C6 — "lost at write" and
|
|
171
|
+
* "expired" are different answers). If the marker write fails too, the generic miss remains.
|
|
172
|
+
*/
|
|
50
173
|
export declare function createOffloadPersist(store: ToolResultStore, sessionId: string): (toolCallId: string, fullText: string) => string;
|
|
174
|
+
/**
|
|
175
|
+
* RB-374① — the ONE source of the "page the offloaded text back" suggestion sentence, shared by
|
|
176
|
+
* {@link buildPreview} (offload preview tail) and context-edit's cleared-marker refNote. The two
|
|
177
|
+
* used to hard-code the same advice in independently drifting wordings, and neither knew whether
|
|
178
|
+
* the reader tool is even CALLABLE in the current session: with {@link OFFLOAD_TOOL_NAME} deferred
|
|
179
|
+
* (a design/36 placeholder), the suggestion was a self-referential dead end — the model follows it
|
|
180
|
+
* and the placeholder rejects with "not active yet".
|
|
181
|
+
*
|
|
182
|
+
* `reachableTools` is OPTIONAL: omitted ⇒ byte-identical to the historic sentences (the
|
|
183
|
+
* determinism/prompt-cache contract of both call sites rests on this default — notably the
|
|
184
|
+
* per-request aggregate-budget pass, which re-derives previews every query and therefore must
|
|
185
|
+
* never receive a session-varying set). Passed and missing {@link OFFLOAD_TOOL_NAME} ⇒ the honest
|
|
186
|
+
* two-step form (activate via ToolSearch first — wording kept close to tool-disclosure.ts's
|
|
187
|
+
* placeholder hint). The `core` fragment below is deliberately shared by both forms so the two
|
|
188
|
+
* faces cannot drift apart again (a wording change moves both, and both pins move with it).
|
|
189
|
+
*/
|
|
51
190
|
export declare function offloadPagebackHint(ref: string, form: "preview" | "cleared", reachableTools?: ReadonlySet<string>): string;
|
|
191
|
+
/** Leading marker of an offload preview (see {@link buildPreview}) — single source so the aggregate
|
|
192
|
+
* budget (design/64 §17.2) can recognize an already-offloaded result without re-deriving the string. */
|
|
52
193
|
export declare const PERSISTED_OUTPUT_PREFIX = "<persisted-output ref=";
|
|
194
|
+
/** Default per-result offload threshold (chars). ~5K tokens; configurable globally or per tool. */
|
|
53
195
|
export declare const DEFAULT_TOOL_RESULT_THRESHOLD_CHARS = 20000;
|
|
196
|
+
/**
|
|
197
|
+
* CC 198 per-tool persistence thresholds, mirrored for the first-party mounts (PARITY-SPOT-USAGE-CONSTANTS
|
|
198
|
+
* 2026-07-10 F1/F2). CC's GIa framework (pretty.js:286716-286721) resolves each tool's persist threshold as
|
|
199
|
+
* `min(maxResultSizeChars, w6t=50000)`:
|
|
200
|
+
* - Read declares `maxResultSizeChars: 1/0` (:478260) → **never persisted**. Read already owns its bound
|
|
201
|
+
* (25K-token first-page auto-pagination) and the aggregate budget exempts it — wrapping it in offload
|
|
202
|
+
* re-truncated a page the tool had already sized (the F1 two-layer inconsistency). Structural exemption:
|
|
203
|
+
* applies even when a deployment sets an explicit global threshold.
|
|
204
|
+
* - Bash 30000 (:335231) / Grep 20000 (:333220) / Monitor 1e4 (:450030); everything else first-party
|
|
205
|
+
* declares 1e5 (Agent :453402, Glob :333570, TaskOutput :458260, …) → min(1e5, 50000) = 50000.
|
|
206
|
+
* Unknown tools keep the deployment default ({@link DEFAULT_TOOL_RESULT_THRESHOLD_CHARS}) — we deliberately
|
|
207
|
+
* do NOT mirror KIa's bare `$xa=400000` undeclared-tool fallback: our aggregate budget is 200K chars, so a
|
|
208
|
+
* 400K inline result is unrepresentable anyway.
|
|
209
|
+
*/
|
|
54
210
|
export declare function firstPartyOffloadPolicy(toolName: string): {
|
|
55
211
|
offload?: boolean;
|
|
56
212
|
offloadThresholdChars?: number;
|
|
57
213
|
};
|
|
214
|
+
/** Head+tail preview of an offloaded result, pointing at {@link OFFLOAD_TOOL_NAME} via `ref`. Exported so
|
|
215
|
+
* the per-message aggregate budget (design/64 §17.2) produces the SAME preview format (deterministic →
|
|
216
|
+
* byte-identical across queries → prompt-cache safe). */
|
|
58
217
|
export declare function buildPreview(full: string, ref: string, sizes?: {
|
|
59
218
|
head: number;
|
|
60
219
|
tail: number;
|
|
61
220
|
}, reachableTools?: ReadonlySet<string>): string;
|
|
62
|
-
|
|
221
|
+
/**
|
|
222
|
+
* Wrap an {@link AgentTool} so that an oversized text result is offloaded to `store` and replaced with a
|
|
223
|
+
* preview + `ref` before it ever reaches the session/model. `ref = tr_<toolCallId>` is stable and the
|
|
224
|
+
* store is write-once: a **same-process** replay keeps an identical (cacheable) preview; a **cross-process**
|
|
225
|
+
* wake needs a durable store (the default in-memory store loses the full text — the preview still stands).
|
|
226
|
+
* Image blocks are left untouched; only text is offloaded. Forwards the `onUpdate` progress callback so a
|
|
227
|
+
* wrapped (e.g. MCP) streaming tool isn't broken.
|
|
228
|
+
*/
|
|
229
|
+
export declare function withToolResultOffload(tool: AgentTool, store: ToolResultStore, thresholdChars: number, sessionId: string,
|
|
230
|
+
/** RB-374① — LIVE accessor for the session's currently CALLABLE tool set (evaluated per offload,
|
|
231
|
+
* so a mid-run ToolSearch activation is reflected by the next preview). Absent/`undefined`-returning
|
|
232
|
+
* ⇒ byte-identical historic preview. An accessor (not a snapshot) because the wrap happens at
|
|
233
|
+
* prepare time, before the deferred classification exists and before any activation can. */
|
|
234
|
+
reachableTools?: () => ReadonlySet<string> | undefined): AgentTool;
|
|
235
|
+
/** The injected `read_tool_result` tool: pages through an offloaded result. `effect:"read"` (verifier/reconcile-safe). */
|
|
63
236
|
export declare function createReadToolResultTool(store: ToolResultStore): AgentTool;
|
package/dist/core/tools.d.ts
CHANGED
|
@@ -1,15 +1,60 @@
|
|
|
1
1
|
import type { TSchema } from "typebox";
|
|
2
2
|
import type { AgentTool } from "../internal/harness.js";
|
|
3
3
|
import type { ToolExecuteContext, ToolSpec } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* E1(黑板 [1937],test/server/cli 三方交叉核实): wrap an already-built failure message string into the
|
|
6
|
+
* `ToolReturn` shape that actually signals failure. A bare `string` return is UNCONDITIONALLY
|
|
7
|
+
* `isError:false` (see `ToolReturn.isError`'s own doc comment) — the toolkit-wide survey found 120+
|
|
8
|
+
* sites across fs/web/sql/scheduler/worktree/etc. that build a correct `"Error (...): ..."` message
|
|
9
|
+
* but then `return` it as a bare string, so the model/UI/metrics see success. Message text is
|
|
10
|
+
* unchanged; only the envelope changes — call sites keep building strings exactly as before and wrap
|
|
11
|
+
* the final value: `return errorResult(violationText(...))` / `return errorResult(\`Error (Write): ...\`)`.
|
|
12
|
+
*/
|
|
4
13
|
export declare function errorResult(text: string, details?: unknown): {
|
|
5
14
|
content: string;
|
|
6
15
|
isError: true;
|
|
7
16
|
details?: unknown;
|
|
8
17
|
};
|
|
18
|
+
/** True iff `x` is an `AgentTool` this module's `defineTool` itself constructed — see {@link DEFINE_TOOL_BRAND}. */
|
|
9
19
|
export declare function isDefineToolProduct(x: unknown): x is AgentTool;
|
|
20
|
+
/** RB-362 类修同源章点 — the ONE place the brand is stamped. `defineTool` uses it on its own product;
|
|
21
|
+
* the only OTHER legitimate caller is a wrapper that (a) starts from a branded product and (b)
|
|
22
|
+
* preserves the AgentTool `execute(toolCallId, rawParams, signal, onUpdate)` contract faithfully
|
|
23
|
+
* (e.g. teacher.ts's logging wrapper). A shallow copy that does NOT re-stamp deliberately loses the
|
|
24
|
+
* brand — that is the brand's documented survival contract, not an accident. Internal only. */
|
|
10
25
|
export declare function stampDefineToolBrand<T extends object>(tool: T): T;
|
|
26
|
+
/**
|
|
27
|
+
* RB-409 — a per-call ctx builder a MOUNT hands to {@link defineTool}.
|
|
28
|
+
*
|
|
29
|
+
* Why the seat exists: the adapter below feeds the inner `ToolSpec.execute` a `{toolCallId, signal}`
|
|
30
|
+
* ctx, because `AgentTool.execute(toolCallId, rawParams, signal, onUpdate)` — the contract every
|
|
31
|
+
* `defineTool` product answers to — has NO ctx parameter at all. There was therefore no runtime
|
|
32
|
+
* channel through which a Runner could hand a finished product the trusted axes it fills in for a raw
|
|
33
|
+
* `ToolSpec` (parentTaskId/parentSessionId/taskId/sessionId/principal/…), so a first-party mounted
|
|
34
|
+
* tool read them as `undefined` on every call and its ctx-first arms were structurally dead. This
|
|
35
|
+
* closes the gap at MOUNT time instead: the mount — which does hold the Runner's trusted context —
|
|
36
|
+
* supplies a builder, and the adapter runs it PER CALL, so call-time snapshots (the run's current
|
|
37
|
+
* model, the live skill scope) stay current rather than freezing at factory time.
|
|
38
|
+
*
|
|
39
|
+
* Shape is deliberately the SAME `(ctx) => ctx` one the Runner's `spec.tools` wrapper already applies,
|
|
40
|
+
* so a mount passes THAT builder itself instead of re-listing the axes — one source for the trusted
|
|
41
|
+
* seat set, no second table to drift out of sync with it.
|
|
42
|
+
*
|
|
43
|
+
* Trust: whatever this returns rides the tool's TRUSTED seat, so a mount must never build one out of
|
|
44
|
+
* model-supplied arguments. The per-call identity (`toolCallId`/`signal`) is re-stamped AFTER the
|
|
45
|
+
* builder runs and can never be rewritten by it. A builder that throws surfaces as this tool call's
|
|
46
|
+
* error (the adapter's existing formatter), never as a loop crash.
|
|
47
|
+
*/
|
|
11
48
|
export type ToolCtxEnricher = (base: ToolExecuteContext) => ToolExecuteContext;
|
|
49
|
+
/**
|
|
50
|
+
* Optional factory knobs for {@link defineTool}. Internal only — NOT re-exported from `index.ts`
|
|
51
|
+
* (same posture as {@link isDefineToolProduct}); a caller passes an object literal, which structural
|
|
52
|
+
* typing accepts without needing the name.
|
|
53
|
+
*/
|
|
12
54
|
export interface DefineToolOptions {
|
|
55
|
+
/** RB-409 — see {@link ToolCtxEnricher}. Absent ⇒ the inner spec sees exactly the pre-RB-409
|
|
56
|
+
* `{toolCallId, signal}` ctx, so every mount that does not opt in stays byte-identical. */
|
|
13
57
|
enrichCtx?: ToolCtxEnricher;
|
|
14
58
|
}
|
|
59
|
+
/** Adapt a friendly ToolSpec into the vendored AgentTool the agent loop expects. */
|
|
15
60
|
export declare function defineTool<TParams extends TSchema = TSchema>(spec: ToolSpec<TParams>, options?: DefineToolOptions): AgentTool<TParams>;
|