@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
|
@@ -2,31 +2,164 @@ import type { AgentTool, ExecutionEnv } from "../../internal/harness-types.js";
|
|
|
2
2
|
import { type TaskRegistry } from "../../core/task-registry.js";
|
|
3
3
|
import { type CwdRef } from "./fs-shared.js";
|
|
4
4
|
import { type BashReadonlyRootBoundary } from "./bash-readonly-classifier.js";
|
|
5
|
+
/**
|
|
6
|
+
* design/80 D-2 (part-1): a parsed-command classifier for the `bash` tool, exposed as a
|
|
7
|
+
* `ToolSpec.reversibilityProbe`. A full shell is treated as egress+irreversible by DEFAULT; this probe is the
|
|
8
|
+
* "real parsed classifier" that lets a deployment safely auto-allow the provably-benign subset (the §4-OQ4
|
|
9
|
+
* doctrine: shell⇒always-gate UNLESS a parsed classifier is wired). design/154 upgraded it from
|
|
10
|
+
* single-command to {@link classifyCompoundReadonly}: a command is reversible ONLY if every `;`/`&&`/`||`/`|`
|
|
11
|
+
* connected segment is a bare command (no redirects/substitution/subshells/escapes/`&` anywhere — those
|
|
12
|
+
* whole-string reject, so it can't chain to `curl`/`git push`/`rm` or background past TaskStop) whose
|
|
13
|
+
* `argv[0]` is in the reversible allowlist (default
|
|
14
|
+
* {@link BASH_READONLY_DEFAULT_ALLOW} — `ls`/`cat`/`grep`/…, curated to commands with NO write/mutation mode
|
|
15
|
+
* under ANY args; the final-council MAJOR removed `date`/`hostname`/`file`, which mutate with args). EVERYTHING
|
|
16
|
+
* else (a write command, an egress command, an operator/pipe, a path-prefixed or env-assigned command, a
|
|
17
|
+
* non-string arg) is NOT reversible → the gate tightens it to an `irreversible_ask` durable suspend. Fail-closed
|
|
18
|
+
* by construction: the allowlist is the only path to `reversible: true`. It is an argv[0]-NAME filter, so the
|
|
19
|
+
* remaining residual is the OTHER axis — a listed reader with crafted args can still READ a secret (a DATA side
|
|
20
|
+
* channel, NOT irreversibility/egress); a deployment that widens `allow` owns that (and the mutation tradeoff).
|
|
21
|
+
*
|
|
22
|
+
* Wire it on the `bash` tool with `irreversibility: "maybe"` (or via `TaskSpec.shellGate: "classify"`); without
|
|
23
|
+
* a classifier a deployment should mark `bash` `irreversibility: "always"` (`shellGate: "always"`) — fail-closed.
|
|
24
|
+
*
|
|
25
|
+
* RB-412 closed the DATA-side residual named above for the read direction: pass `boundary` and a listed
|
|
26
|
+
* reader whose path arguments leave the allowed directories stops being reversible, so the gate asks
|
|
27
|
+
* instead of auto-allowing. Pass it as a FUNCTION wherever the working directory is observable (an
|
|
28
|
+
* in-task `cd` moves the base a relative operand resolves against, and the probe is called per command).
|
|
29
|
+
* Omitted ⇒ name-only classification, exactly as before.
|
|
30
|
+
*
|
|
31
|
+
* The BOUNDED READ-ONLY POLL LOOP arm: a monitoring consumer's whole idiom is `for i in $(seq 1 8);
|
|
32
|
+
* do tail -n 5 x.log; sleep 2; done`, which the compound face rejects as a class (`for` is not an
|
|
33
|
+
* allowlisted name) — making the classify gate behave like `always` for exactly the tool that polls
|
|
34
|
+
* the most. When the plain face rejects, the probe consults
|
|
35
|
+
* {@link classifyBoundedReadonlyPollLoop} — a narrow exact grammar (literal bound, `;`-separated
|
|
36
|
+
* allowlisted readers + literal `sleep`, the same read boundary, everything else banned; the full
|
|
37
|
+
* safety argument lives on that function). Additive by construction: the plain verdict is tried
|
|
38
|
+
* first and is never overridden.
|
|
39
|
+
*/
|
|
5
40
|
export declare function bashReversibilityProbe(allow?: readonly string[], boundary?: BashReadonlyRootBoundary | (() => BashReadonlyRootBoundary | undefined)): (args: unknown) => {
|
|
6
41
|
reversible: boolean;
|
|
7
42
|
};
|
|
43
|
+
/** The CC-verbatim exit-1 interpretation for `command`, or undefined when exit 1 means a real error.
|
|
44
|
+
* Conservative parse: last `;`/`&&`/`||`/newline statement → last `|` pipeline segment → leading
|
|
45
|
+
* command name (env-assignments skipped, path prefix stripped); `git grep`/`git diff` special-cased
|
|
46
|
+
* (CC cLp). Exported for the 批④ unit tests. */
|
|
8
47
|
export declare function bashExitOneInterpretation(command: string): string | undefined;
|
|
9
48
|
export declare function canAutoBackground(command: string, depth?: number): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* `bash` (effect:write) — a full shell. ⚠️ It runs with `rootCanonical` as the initial cwd but is NOT
|
|
51
|
+
* sandboxed: a command can `cd` out, read/write/delete any path the process can reach, and use the
|
|
52
|
+
* network. `rootPath` is a file-tool guard rail, NOT a bash sandbox (design/44 §5, DESIGN#6) — real
|
|
53
|
+
* isolation is the deployment's job (inject a chroot/container `ExecutionEnv`). Every call still goes
|
|
54
|
+
* through the design/37 policy gate, which a multi-tenant deployment MUST wire to constrain it. The cwd
|
|
55
|
+
* persists across calls (design/64 §8.1A): a per-task `cwdRef` starts at `rootCanonical` and is updated
|
|
56
|
+
* from the shell's final pwd after each command.
|
|
57
|
+
*/
|
|
10
58
|
export declare function createBashTool(env: ExecutionEnv, rootCanonical: string, coAuthor?: string | false, cwdRef?: CwdRef, taskOpts?: {
|
|
11
59
|
taskRegistry?: TaskRegistry;
|
|
12
60
|
taskOwner?: string;
|
|
13
61
|
taskScope?: string;
|
|
62
|
+
/** (design/129, mirrors MonitorToolOptions.sessionId): when the task runs INSIDE a session,
|
|
63
|
+
* a background command registers session-resident (owner = sessionId, sessionScoped flag) — it
|
|
64
|
+
* survives the run teardown like CC's bg shells and is reaped at the session terminal. Absent ⇒
|
|
65
|
+
* run-scoped registration exactly as before (killed-with-receipt at teardown). */
|
|
14
66
|
sessionId?: string;
|
|
67
|
+
/** design/116 §7 G2b: completion-notification sink — a finished background command fires ONE
|
|
68
|
+
* task-notification (priority "next": boundary interrupt, CC LocalShellTask posture). */
|
|
15
69
|
onTaskNotification?: (n: import("../../core/task-notification.js").TaskNotificationPayload, opts?: {
|
|
16
70
|
priority?: "now" | "next" | "later";
|
|
17
71
|
}) => void;
|
|
72
|
+
/** design/116 detach: per-tool-call detach hub — a fired signal adopts the running command as background. */
|
|
18
73
|
detachHub?: import("../../core/tool-detach.js").ToolDetachHub;
|
|
74
|
+
/**
|
|
75
|
+
* RB-198 F1 (CC 220 `Zry`/`WZi.#m` parity) — EXPLICIT deployment opt-in: on this command's own
|
|
76
|
+
* timeout, an eligible foreground command (see `canAutoBackground`'s own docstring — a
|
|
77
|
+
* DELIBERATELY simplified, narrower-than-CC classifier) is adopted as a background task instead
|
|
78
|
+
* of being killed. Defaults to `false` (the pre-existing, unconditional kill-on-timeout behavior)
|
|
79
|
+
* — this must NOT be inferred from `detachHub`/`taskRegistry` merely being present, because those
|
|
80
|
+
* are wired UNCONDITIONALLY for every task (the ctrl+b manual-detach capability, `defaultTaskRegistry`
|
|
81
|
+
* is a module-level singleton) — tying auto-eligibility to their mere presence would silently flip
|
|
82
|
+
* the timeout outcome for every existing caller/test with no opt-in signal at all (caught by
|
|
83
|
+
* `test/tool-cut-kill.test.ts`'s pre-existing "ordinary lane" self-timeout test: a
|
|
84
|
+
* `canAutoBackground`-eligible command it never expected to survive its timeout started surviving
|
|
85
|
+
* it). A deployment that wants the CC-parity behavior sets this explicitly; sema's own default
|
|
86
|
+
* Runner wiring currently does NOT set it, so this feature ships INERT until a caller opts in.
|
|
87
|
+
*/
|
|
19
88
|
autoBackgroundOnTimeout?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* RB-220 — mirrors {@link import("../../core/types.js").TaskSpec.oneShot}: this run has no later
|
|
91
|
+
* turn for an async background notification to land in (a headless `-p` process exits once the
|
|
92
|
+
* turn ends). Branches the background-launch receipt's guidance toward an active block-wait
|
|
93
|
+
* instruction instead of "you will be notified — do not poll", the same failure form
|
|
94
|
+
* `run_workflow`'s launch note was fixed for (a model that follows "end your turn" advice in a
|
|
95
|
+
* one-shot process loses the result — the process exits with nothing left alive to receive it).
|
|
96
|
+
*/
|
|
20
97
|
oneShot?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* RB-371 ②: the EXTRA containment roots of the structured file tools (additionalDirectories,
|
|
100
|
+
* canonical) — combined with `rootCanonical` and consulted ONLY for the post-`cd` disclosure
|
|
101
|
+
* note (a committed cwd outside every root gets one trailer line saying the structured tools'
|
|
102
|
+
* relative paths now resolve there and may be refused). Bash itself stays deliberately
|
|
103
|
+
* unconfined; passing this never gates anything.
|
|
104
|
+
*/
|
|
21
105
|
additionalRoots?: readonly string[];
|
|
106
|
+
/** RB-370 ② (cli [2088]): override of the `timeout` parameter's DEFAULT budget, in ms — see
|
|
107
|
+
* {@link import("./index.js").HandsToolkitOptions.bashDefaultTimeoutMs} for the resolution
|
|
108
|
+
* contract (options over env over constant; invalid values discarded). */
|
|
22
109
|
bashDefaultTimeoutMs?: number;
|
|
110
|
+
/** RB-370 ② (cli [2088]): override of the `timeout` parameter's engine CEILING, in ms — only-widen
|
|
111
|
+
* vs the resolved default; see {@link import("./index.js").HandsToolkitOptions.bashMaxTimeoutMs}. */
|
|
23
112
|
bashMaxTimeoutMs?: number;
|
|
113
|
+
/**
|
|
114
|
+
* #181-F6 — whether the Monitor tool is on THIS run's roster (the Runner's own mount predicate is
|
|
115
|
+
* `backgroundTaskToolsActive`; it, not this tool, mounts Monitor). Read by the SR-2 gh rate-limit
|
|
116
|
+
* hint, whose closing clause teaches the Monitor tool: `false` ⇒ the clause is dropped (the sleep
|
|
117
|
+
* advice stays), absent/`true` ⇒ historic full wording (a standalone toolkit consumer may well have
|
|
118
|
+
* mounted Monitor itself — the omitted default must not silently rewrite its hint).
|
|
119
|
+
*/
|
|
24
120
|
monitorToolActive?: boolean;
|
|
25
121
|
}): AgentTool;
|
|
122
|
+
/**
|
|
123
|
+
* `bash_readonly` (effect:read) — a restricted shell for the verifier read-only boundary (design/44 M2):
|
|
124
|
+
* a single allowlisted, bare command with no shell operators. effect:read lets it survive the verifier's
|
|
125
|
+
* read-only filter, but it is NOT a policy bypass — it still goes through the design/37 gate (council #7:
|
|
126
|
+
* a read can still be a side channel, e.g. dumping a secret file). The allowlist is a coarse pre-filter;
|
|
127
|
+
* the policy gate is the authoritative control.
|
|
128
|
+
*
|
|
129
|
+
* RB-413 (安全面, adjudicated: hard refusal) — that allowlist vets argv[0] and nothing else, so until this
|
|
130
|
+
* leg carried a path boundary an allowlisted reader could name ANY file on the host and get it: `cat
|
|
131
|
+
* /etc/passwd` went straight through. RB-412 gave the full `bash` leg the same boundary as a DEMOTION —
|
|
132
|
+
* that leg's verdict feeds an approval gate, so "outside the roots" can become a prompt. This face has no
|
|
133
|
+
* such channel: `effect:"read"` is precisely what lets it run where the write shell may not (the verifier's
|
|
134
|
+
* read-only band), so an out-of-root read here is not something to escalate, it is outside what the tool
|
|
135
|
+
* is. It is refused, fail-closed, before anything executes — including the conservative direction, where
|
|
136
|
+
* the operand cannot be resolved statically (there is nothing to degrade to).
|
|
137
|
+
*/
|
|
26
138
|
export declare function createBashReadonlyTool(env: ExecutionEnv, rootCanonical: string, allow: ReadonlySet<string>, opts?: {
|
|
139
|
+
/** RB-370 ② (cli [2088]): same timeout-cap overrides the full `bash` leg takes — see
|
|
140
|
+
* {@link import("./index.js").HandsToolkitOptions.bashDefaultTimeoutMs} /
|
|
141
|
+
* {@link import("./index.js").HandsToolkitOptions.bashMaxTimeoutMs} (类修完整域: both foreground
|
|
142
|
+
* legs share runShell's clamp, so both must share the configurable resolution). */
|
|
27
143
|
bashDefaultTimeoutMs?: number;
|
|
28
144
|
bashMaxTimeoutMs?: number;
|
|
145
|
+
/** RB-413: the extra containment roots the structured file tools got (design/119 `--add-dir`,
|
|
146
|
+
* canonical). A read this deployment already sanctions for Read/Grep/Glob is equally sanctioned
|
|
147
|
+
* here — the two faces must not disagree about which directories exist for this session. */
|
|
29
148
|
additionalRoots?: readonly string[];
|
|
30
149
|
}): AgentTool;
|
|
150
|
+
/**
|
|
151
|
+
* design/115 P0 `TaskOutput` (legacy aliases: BashOutput/AgentOutput*) — read a background shell's NEW output
|
|
152
|
+
* since the last call (cursor), by task_id. Optional legacy `filter` regex is applied BEFORE the per-poll truncation so a watched line survives even when it
|
|
153
|
+
* falls in a high-throughput middle window. Untrusted process output is fenced (delimitUntrusted) — observe-only,
|
|
154
|
+
* never re-fed as instructions.
|
|
155
|
+
*/
|
|
31
156
|
export declare function createEnvTaskOutputTool(env: ExecutionEnv): AgentTool;
|
|
157
|
+
/** design/115 P0 `TaskStop` (RB-476-A: legacy aliases cleared) — terminate a background shell by task_id.
|
|
158
|
+
*
|
|
159
|
+
* design/134 KNOWN-ISSUES close-out: this band kills ENV-DIRECT (it mounts precisely when the toolkit has
|
|
160
|
+
* no registry — the createHandsToolkit ternary routes registry deployments to createTaskStopTool), so a
|
|
161
|
+
* row for the SAME shell in the process-local {@link defaultTaskRegistry} (a Runner-mounted run sharing
|
|
162
|
+
* this env) used to settle via the watcher's no-claimant floor as stoppedBy:"system". The tool now marks
|
|
163
|
+
* the initiation site ("parent") on `registry` (default: the process-local {@link defaultTaskRegistry})
|
|
164
|
+
* BEFORE the kill — attribution only; the kill path and the model-facing receipt text are unchanged. */
|
|
32
165
|
export declare function createEnvTaskStopTool(env: ExecutionEnv, registry?: TaskRegistry): AgentTool;
|
|
@@ -4,9 +4,37 @@ import type { ExecutionEnv } from "../../internal/harness-types.js";
|
|
|
4
4
|
import { type PdfModelCapabilities } from "./pdf.js";
|
|
5
5
|
import { type ReadImageDownsamplerOption } from "./fs-shared.js";
|
|
6
6
|
export { pdfModelCapabilitiesOf, type PdfModelCapabilities } from "./pdf.js";
|
|
7
|
+
/** What the Read tool's PDF pipeline returns (document block, or rendered page images, or an error string). */
|
|
7
8
|
type ReadPdfReturn = string | {
|
|
8
9
|
content: Array<TextContent | ImageContent | DocumentContent>;
|
|
9
10
|
details: unknown;
|
|
10
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* PDF read pipeline (CC FileReadTool parity — mechanism取证 + limits in fs/pdf.ts):
|
|
14
|
+
* - no `pages` → whole file as a native `document` block, gated at ≤{@link PDF_TARGET_RAW_SIZE} raw and
|
|
15
|
+
* ≤{@link PDF_INLINE_PAGE_THRESHOLD} pages (page count via `pdfinfo`, byte-scan fallback; unknown = fail-open,
|
|
16
|
+
* CC-identical — the size gate still bounds the request);
|
|
17
|
+
* - `pages` "F-L" → poppler `pdftoppm` renders the range as JPEG page images (CC-identical mechanism; the
|
|
18
|
+
* downsampler seam then applies the same pipeline as the Read image branch). poppler absent → HONEST
|
|
19
|
+
* degradation with the working alternative, never a fake success.
|
|
20
|
+
* Wire discipline: the base64 payload rides `details.file` only while ≤48K chars (same OMIT rule as the
|
|
21
|
+
* image variant — a bigger card would be dropped whole by the structuredFrom 4×cap and blind the shell).
|
|
22
|
+
* structured-card audit item B (2026-08-05): that budget management assumed `"document"` was on `CC_DETAIL_TYPES`, which
|
|
23
|
+
* it was not — every `document` card, sized or not, was dropped at the gate, making the 48K rule dead
|
|
24
|
+
* code and the pages/fallback-level disclosure invisible to a host. The word is registered now.
|
|
25
|
+
*
|
|
26
|
+
* Degradation chain v2 (clay 拍: the brain-level placeholder is NOT the end state): when the SERVING model
|
|
27
|
+
* cannot take a native document block (`caps.document === false` — e.g. any openai-compatible API), the
|
|
28
|
+
* whole-PDF path degrades IN THE TOOL (the only layer holding env.exec), best first:
|
|
29
|
+
* 1. `pdftotext -layout` text extraction → the content arrives as TEXT (Read byte-cap discipline applies);
|
|
30
|
+
* 2. pdftotext absent/failed + the model has vision → render the first {@link PDF_FALLBACK_RENDER_PAGES}
|
|
31
|
+
* pages via the existing `pdftoppm` pipeline (note directs `pages` for more);
|
|
32
|
+
* 3. honest placeholder explaining WHY levels 1–2 did not run + the Bash self-help.
|
|
33
|
+
* Every degraded return carries `details.fallback = { level, reason }` (telemetry on the structured frame).
|
|
34
|
+
* `caps` absent ⇒ fully capable (byte-compat: native document block; the brain placeholder still guards).
|
|
35
|
+
*/
|
|
11
36
|
export declare function readPdfFile(env: ExecutionEnv, path: string, key: string, pages: string | undefined, signal: AbortSignal | undefined, downsamplerOpt: ReadImageDownsamplerOption, cwd: string, preRead?: Uint8Array, caps?: PdfModelCapabilities): Promise<ReadPdfReturn>;
|
|
37
|
+
/** E1: readPdfFile's own return type stays `ReadPdfReturn` (its INTERNAL string-means-error dispatch
|
|
38
|
+
* contract, shared with pdfPagesToImageBlocks) — the isError flag is applied once, here, at the tool's
|
|
39
|
+
* actual execute() boundary, not inside the helper. */
|
|
12
40
|
export declare function pdfResultToToolReturn(r: ReadPdfReturn): ReturnType<typeof errorResult> | Exclude<ReadPdfReturn, string>;
|
|
@@ -2,4 +2,9 @@ import type { AgentTool, ExecutionEnv } from "../../internal/harness-types.js";
|
|
|
2
2
|
import type { ToolEffect } from "../../core/types.js";
|
|
3
3
|
export declare function createGrepTool(env: ExecutionEnv, rootCanonical: string, additionalRoots?: readonly string[]): AgentTool;
|
|
4
4
|
export declare function createGlobTool(env: ExecutionEnv, rootCanonical: string, additionalRoots?: readonly string[]): AgentTool;
|
|
5
|
+
/** Static side-effect class of every hand tool, by name (design/44 §3). Used by prepare-task to (a) feed
|
|
6
|
+
* wake/resume reconciliation and (b) drive the verifier read-only boundary. Every mutating hand tool is
|
|
7
|
+
* `write` (RB-264 ⑥W1 folded `Write` back in — see below); `bash` is `write` (a command can do anything);
|
|
8
|
+
* `bash_readonly` is `read` (so it survives the verifier boundary — but still goes through the policy
|
|
9
|
+
* gate, council #7: effect:read is a redo-safety class, never a policy bypass). */
|
|
5
10
|
export declare const HAND_TOOL_EFFECTS: Readonly<Record<string, ToolEffect>>;
|