@sema-agent/core 7.54.1 → 7.55.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 +437 -0
- package/dist/agents/agent-transcript-tool.js +2 -1
- package/dist/agents/builtin-agents.d.ts +12 -14
- package/dist/agents/cc-peer-directory.d.ts +36 -0
- package/dist/agents/cc-peer-directory.js +138 -0
- package/dist/agents/cc-peer-wire.d.ts +105 -0
- package/dist/agents/cc-peer-wire.js +98 -0
- package/dist/agents/cc-uds-peer-channel.d.ts +40 -0
- package/dist/agents/cc-uds-peer-channel.js +457 -0
- package/dist/agents/cross-session-envelope.d.ts +4 -1
- package/dist/agents/cross-session-envelope.js +8 -1
- package/dist/agents/cross-session-judge.d.ts +2 -2
- package/dist/agents/list-agents-tool.js +2 -1
- package/dist/agents/observer.d.ts +4 -5
- package/dist/agents/observer.js +2 -1
- package/dist/agents/peer-admission.d.ts +6 -0
- package/dist/agents/peer-admission.js +4 -1
- package/dist/agents/peer-directory.d.ts +43 -9
- package/dist/agents/peer-directory.js +66 -23
- package/dist/agents/peer-notices.d.ts +1 -1
- package/dist/agents/peer-session-drain.d.ts +3 -1
- package/dist/agents/peer-session-drain.js +1 -0
- package/dist/agents/read-inbox-tool.js +2 -1
- package/dist/agents/retain-ledger.d.ts +1 -1
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/send-message-tool.d.ts +10 -0
- package/dist/agents/send-message-tool.js +34 -5
- package/dist/agents/subagent.d.ts +34 -79
- package/dist/agents/subagent.js +45 -46
- package/dist/agents/tool-filter.d.ts +29 -46
- package/dist/agents/tool-filter.js +8 -31
- package/dist/agents/verify.d.ts +3 -3
- package/dist/brain/anthropic.js +14 -9
- package/dist/brain/errors.d.ts +15 -0
- package/dist/brain/errors.js +10 -0
- package/dist/brain/model-presets.d.ts +4 -4
- package/dist/brain/open-responses.js +15 -10
- package/dist/brain/openai.js +17 -12
- package/dist/brain/provider-dialect.d.ts +39 -3
- package/dist/brain/provider-dialect.js +28 -0
- package/dist/brain/reasoning.d.ts +1 -1
- package/dist/brain/request-params.d.ts +55 -5
- package/dist/brain/request-params.js +35 -3
- package/dist/brain/retry.d.ts +1 -1
- package/dist/brain/route-adjudicator.d.ts +15 -0
- package/dist/brain/route-adjudicator.js +15 -0
- package/dist/brain/stream-engine.js +6 -5
- package/dist/brain/stream-shared.d.ts +1 -1
- package/dist/core/advisor-verdict.d.ts +120 -0
- package/dist/core/advisor-verdict.js +92 -0
- package/dist/core/agent-definition.d.ts +7 -8
- package/dist/core/allow-entry.d.ts +49 -23
- package/dist/core/allow-entry.js +57 -32
- package/dist/core/allow-rule-shadow.d.ts +7 -0
- package/dist/core/approval-object.d.ts +2 -1
- package/dist/core/approval-object.js +6 -6
- package/dist/core/ask-origin.d.ts +63 -11
- package/dist/core/ask-origin.js +27 -5
- package/dist/core/ask-question.js +10 -4
- package/dist/core/auto-compaction.d.ts +11 -8
- package/dist/core/auto-compaction.js +4 -2
- package/dist/core/auto-mode-arming.d.ts +2 -2
- package/dist/core/auto-mode-defaults.d.ts +8 -8
- package/dist/core/auto-mode-prompt-assets.d.ts +3 -3
- package/dist/core/auto-mode-prompt.d.ts +1 -1
- package/dist/core/auto-mode.d.ts +17 -9
- package/dist/core/auto-mode.js +9 -6
- package/dist/core/background-agent-store.d.ts +3 -3
- package/dist/core/canonical-json.d.ts +1 -1
- package/dist/core/canonical-json.js +2 -2
- package/dist/core/checkpoint-requirements.d.ts +6 -3
- package/dist/core/checkpoint-requirements.js +4 -14
- package/dist/core/checkpoint-store.d.ts +80 -51
- package/dist/core/checkpoint-store.js +56 -74
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +3 -16
- package/dist/core/compliance.d.ts +2 -2
- package/dist/core/context-edit.d.ts +6 -7
- package/dist/core/cross-boundary-taint.d.ts +9 -3
- package/dist/core/cross-boundary-taint.js +5 -3
- package/dist/core/decision-receipt.js +2 -2
- package/dist/core/effective-path-target.d.ts +1 -1
- package/dist/core/engine-notice.d.ts +19 -5
- package/dist/core/exec-output-tail.d.ts +1 -1
- package/dist/core/file-history-retention.d.ts +1 -1
- package/dist/core/file-history-store.d.ts +59 -9
- package/dist/core/file-history-store.js +35 -17
- package/dist/core/gate-fold.js +3 -2
- package/dist/core/gate-lanes.js +12 -8
- package/dist/core/gate-outcome.d.ts +17 -4
- package/dist/core/gate-outcome.js +30 -0
- package/dist/core/governance-codes.d.ts +13 -3
- package/dist/core/governance-codes.js +10 -0
- package/dist/core/hands-band.d.ts +1 -1
- package/dist/core/hooks.d.ts +4 -4
- package/dist/core/host-target.d.ts +49 -0
- package/dist/core/host-target.js +59 -0
- package/dist/core/image-downsample.d.ts +1 -1
- package/dist/core/lsp-diagnostics.d.ts +4 -4
- package/dist/core/lsp.d.ts +3 -3
- package/dist/core/mailbox-store.d.ts +4 -0
- package/dist/core/mcp-connection-pool.d.ts +18 -2
- package/dist/core/mcp-connection-pool.js +53 -6
- package/dist/core/mcp-failure.d.ts +23 -4
- package/dist/core/mcp-failure.js +26 -11
- package/dist/core/mcp-listing-drift.d.ts +10 -0
- package/dist/core/mcp-listing-drift.js +6 -0
- package/dist/core/mcp-server-link.d.ts +173 -0
- package/dist/core/mcp-server-link.js +127 -0
- package/dist/core/mcp-server-spec.d.ts +4 -2
- package/dist/core/mcp-session-end.d.ts +26 -0
- package/dist/core/mcp-session-end.js +29 -0
- package/dist/core/mcp-startup-request.d.ts +17 -0
- package/dist/core/mcp-startup-request.js +17 -0
- package/dist/core/mcp.d.ts +13 -13
- package/dist/core/mcp.js +187 -162
- package/dist/core/media-byte-cap.d.ts +1 -1
- package/dist/core/memory-engine/engine.d.ts +9 -9
- package/dist/core/memory-engine/provenance-wording.d.ts +1 -1
- package/dist/core/memory-engine/tools.js +4 -1
- package/dist/core/mode-policy.d.ts +1 -1
- package/dist/core/namespaced-rule-name.d.ts +33 -7
- package/dist/core/namespaced-rule-name.js +39 -25
- package/dist/core/output-style.d.ts +1 -1
- package/dist/core/param-rule-reach.d.ts +15 -0
- package/dist/core/param-rule-reach.js +30 -0
- package/dist/core/parent-spec-seat.d.ts +8 -1
- package/dist/core/parent-spec-seat.js +4 -0
- package/dist/core/pause-registry.d.ts +16 -5
- package/dist/core/pause-registry.js +6 -2
- package/dist/core/peer-channel.d.ts +70 -0
- package/dist/core/peer-channel.js +1 -0
- package/dist/core/permission-rule-consent.d.ts +11 -5
- package/dist/core/permission-rule-consent.js +37 -30
- package/dist/core/permission-rule-model.d.ts +233 -64
- package/dist/core/permission-rule-model.js +384 -85
- package/dist/core/permission-rule-provider.d.ts +2 -1
- package/dist/core/permission-rule-store.d.ts +20 -25
- package/dist/core/permission-rule-store.js +1 -4
- package/dist/core/permission-rule-sync.d.ts +11 -2
- package/dist/core/permission-rule-sync.js +8 -1
- package/dist/core/permission-rules.d.ts +49 -11
- package/dist/core/permission-rules.js +123 -89
- package/dist/core/persisted-rule-arms.d.ts +4 -2
- package/dist/core/present-plan-tool.js +3 -1
- package/dist/core/protocol-naming.d.ts +2 -2
- package/dist/core/read-only-shell-table.d.ts +1 -1
- package/dist/core/read-only-shell.d.ts +1 -1
- package/dist/core/roles.d.ts +6 -2
- package/dist/core/roles.js +45 -44
- package/dist/core/rule-offer-read.d.ts +53 -0
- package/dist/core/rule-offer-read.js +146 -0
- package/dist/core/rule-owner.d.ts +46 -0
- package/dist/core/rule-owner.js +28 -0
- package/dist/core/runner/advisor-instructions.d.ts +70 -0
- package/dist/core/runner/advisor-instructions.js +61 -0
- package/dist/core/runner/advisor-tool.d.ts +33 -0
- package/dist/core/runner/advisor-tool.js +112 -0
- package/dist/core/runner/announce-once-ledger.d.ts +4 -26
- package/dist/core/runner/announce-once-ledger.js +14 -46
- package/dist/core/runner/approval-feedback.js +6 -3
- package/dist/core/runner/assemble-result.d.ts +1 -1
- package/dist/core/runner/caller-roster.d.ts +7 -0
- package/dist/core/runner/caller-roster.js +11 -0
- package/dist/core/runner/classifier-ladder.d.ts +27 -5
- package/dist/core/runner/classifier-ladder.js +12 -11
- package/dist/core/runner/compaction-restate.d.ts +10 -6
- package/dist/core/runner/compaction-restate.js +9 -3
- package/dist/core/runner/contracts.d.ts +13 -9
- package/dist/core/runner/conversation-segment.d.ts +28 -0
- package/dist/core/runner/conversation-segment.js +42 -0
- package/dist/core/runner/cross-boundary-lane.d.ts +6 -5
- package/dist/core/runner/cross-boundary-lane.js +26 -15
- package/dist/core/runner/decide-continuation.d.ts +7 -4
- package/dist/core/runner/decide-continuation.js +2 -2
- package/dist/core/runner/denial-limit-arms.d.ts +2 -2
- package/dist/core/runner/derived-route-fallback.d.ts +24 -24
- package/dist/core/runner/derived-route-fallback.js +9 -7
- package/dist/core/runner/gate-exit.d.ts +6 -0
- package/dist/core/runner/gate-exit.js +7 -2
- package/dist/core/runner/initial-run-state.js +1 -1
- package/dist/core/runner/permission-rule-lanes.d.ts +2 -2
- package/dist/core/runner/permission-rule-lanes.js +14 -7
- package/dist/core/runner/person-path-rows.js +1 -1
- package/dist/core/runner/prepare-advisor.d.ts +63 -0
- package/dist/core/runner/prepare-advisor.js +77 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +1 -1
- package/dist/core/runner/prepare-config-doors.d.ts +6 -4
- package/dist/core/runner/prepare-config-doors.js +18 -12
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.js +1 -1
- package/dist/core/runner/prepare-file-history.js +39 -39
- package/dist/core/runner/prepare-gate-stations.d.ts +1 -4
- package/dist/core/runner/prepare-gate-stations.js +2 -7
- package/dist/core/runner/prepare-inherited-gate.d.ts +5 -4
- package/dist/core/runner/prepare-inherited-gate.js +3 -3
- package/dist/core/runner/prepare-park-ask.js +7 -7
- package/dist/core/runner/prepare-policy-chain.d.ts +1 -1
- package/dist/core/runner/prepare-policy-chain.js +4 -10
- package/dist/core/runner/prepare-project-context.d.ts +5 -2
- package/dist/core/runner/prepare-project-context.js +6 -3
- package/dist/core/runner/prepare-prompt-inputs.js +1 -1
- package/dist/core/runner/prepare-protocol-tools.d.ts +2 -2
- package/dist/core/runner/prepare-protocol-tools.js +3 -2
- package/dist/core/runner/prepare-safety-scan.d.ts +9 -12
- package/dist/core/runner/prepare-safety-scan.js +8 -6
- package/dist/core/runner/prepare-task.js +15 -18
- package/dist/core/runner/prepare-tool-disclosure-mount.js +6 -4
- package/dist/core/runner/prepare-wiring-manifest.d.ts +6 -3
- package/dist/core/runner/prepare-wiring-manifest.js +2 -2
- package/dist/core/runner/resume-policy-outcome.js +1 -1
- package/dist/core/runner/retired-runner-deps.js +1 -1
- package/dist/core/runner/run-attachment-seats.js +0 -1
- package/dist/core/runner/run-compaction-machinery.d.ts +1 -1
- package/dist/core/runner/run-compaction-machinery.js +2 -12
- package/dist/core/runner/run-git-lane.d.ts +1 -0
- package/dist/core/runner/run-harness-handlers.js +2 -3
- package/dist/core/runner/run-leg.js +13 -0
- package/dist/core/runner/run-settle-and-teardown.js +1 -1
- package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
- package/dist/core/runner/run-turn-boundary.d.ts +1 -0
- package/dist/core/runner/run-turn-boundary.js +14 -12
- package/dist/core/runner/session-rule-policy.d.ts +22 -21
- package/dist/core/runner/session-rule-policy.js +13 -28
- package/dist/core/runner/side-call-account.d.ts +32 -8
- package/dist/core/runner/side-call-account.js +23 -1
- package/dist/core/runner/strict-output-schema.d.ts +1 -1
- package/dist/core/runner/sub-agent-deny-lists.js +4 -3
- package/dist/core/runner/synthetic-tools.d.ts +10 -13
- package/dist/core/runner/synthetic-tools.js +4 -2
- package/dist/core/runner/tool-disclosure.js +2 -1
- package/dist/core/runner/tool-face-overlay.d.ts +2 -1
- package/dist/core/runner/tool-face-overlay.js +17 -1
- package/dist/core/runner/tool-progress-lane.d.ts +2 -2
- package/dist/core/runner/tool-turn-repair-seat.d.ts +3 -2
- package/dist/core/runner/turn-attachments.d.ts +60 -67
- package/dist/core/runner-deps.d.ts +37 -37
- package/dist/core/runtime-caps.d.ts +4 -4
- package/dist/core/safety-merge-corpus.js +17 -1
- package/dist/core/same-plain-value.d.ts +40 -0
- package/dist/core/same-plain-value.js +49 -0
- package/dist/core/scheduler.d.ts +1 -1
- package/dist/core/sensitive-path-policy.d.ts +1 -1
- package/dist/core/sensitive-path-policy.js +1 -1
- package/dist/core/session-policy-store.d.ts +77 -22
- package/dist/core/session-policy-store.js +56 -14
- package/dist/core/session-reconcile.d.ts +2 -2
- package/dist/core/session-store.d.ts +80 -30
- package/dist/core/session-store.js +118 -76
- package/dist/core/session.d.ts +24 -46
- package/dist/core/shared-memory/tools.js +3 -1
- package/dist/core/shared-memory/types.d.ts +1 -1
- package/dist/core/side-query.d.ts +10 -0
- package/dist/core/side-query.js +5 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +29 -2
- package/dist/core/store-contracts/file-history-store-contract.js +43 -3
- package/dist/core/store-contracts/session-policy-store-contract.d.ts +7 -0
- package/dist/core/store-contracts/session-policy-store-contract.js +130 -0
- package/dist/core/store-contracts/session-repo-contract.js +125 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +4 -7
- package/dist/core/store-contracts/session-store-contract.js +215 -41
- package/dist/core/store-contracts/workflow-journal-store-contract.js +26 -1
- package/dist/core/surrogate-safe-slice.d.ts +3 -3
- package/dist/core/task-event.d.ts +10 -4
- package/dist/core/task-notification.d.ts +3 -3
- package/dist/core/task-registry-agent.d.ts +4 -4
- package/dist/core/task-registry-shared.d.ts +4 -4
- package/dist/core/task-registry-shared.js +1 -0
- package/dist/core/task-registry.d.ts +4 -4
- package/dist/core/task-registry.js +3 -1
- package/dist/core/task-result.d.ts +3 -3
- package/dist/core/task-spec.d.ts +52 -52
- package/dist/core/task-stream.d.ts +6 -6
- package/dist/core/task-tool-shape.d.ts +4 -4
- package/dist/core/tighten-task-spec.d.ts +1 -1
- package/dist/core/tool-catalog-entries.d.ts +19 -2
- package/dist/core/tool-catalog-entries.js +57 -42
- package/dist/core/tool-conformance.js +1 -0
- package/dist/core/tool-errors.d.ts +2 -2
- package/dist/core/tool-face-reader.js +5 -3
- package/dist/core/tool-face.d.ts +21 -2
- package/dist/core/tool-face.js +1 -1
- package/dist/core/tool-model-gate.d.ts +3 -3
- package/dist/core/tool-name-aliases.d.ts +29 -8
- package/dist/core/tool-name-aliases.js +27 -3
- package/dist/core/tool-name-readings.d.ts +5 -8
- package/dist/core/tool-name-readings.js +1 -2
- package/dist/core/tool-policy.d.ts +24 -5
- package/dist/core/tool-policy.js +34 -10
- package/dist/core/tool-registry.d.ts +14 -7
- package/dist/core/tool-registry.js +17 -7
- package/dist/core/tool-result-store.js +2 -1
- package/dist/core/tool-roster.d.ts +47 -18
- package/dist/core/tool-roster.js +53 -32
- package/dist/core/tool-spec-members.js +1 -1
- package/dist/core/tool-spec.d.ts +35 -21
- package/dist/core/tools.js +3 -2
- package/dist/core/trace.d.ts +4 -0
- package/dist/core/untrusted-egress.d.ts +1 -1
- package/dist/core/untrusted-text.d.ts +1 -1
- package/dist/core/warm-resume.d.ts +1 -1
- package/dist/core/wiring-manifest.d.ts +49 -0
- package/dist/core/wiring-manifest.js +13 -5
- package/dist/core/workflow-journal-store.d.ts +62 -0
- package/dist/core/workflow-journal-store.js +77 -1
- package/dist/core/workflow-run-store.d.ts +6 -0
- package/dist/core/workflow-run-store.js +2 -0
- package/dist/engine/compaction/compaction.d.ts +9 -9
- package/dist/engine/execution-env/node-execution-env.d.ts +19 -5
- package/dist/engine/execution-env/node-execution-env.js +43 -22
- package/dist/engine/harness/agent-harness.d.ts +14 -8
- package/dist/engine/harness/agent-harness.js +33 -26
- package/dist/engine/harness/types.d.ts +29 -7
- package/dist/engine/harness/types.js +12 -1
- package/dist/engine/llm/types.d.ts +9 -9
- package/dist/engine/llm/validation.d.ts +4 -1
- package/dist/engine/llm/validation.js +13 -1
- package/dist/engine/loop/agent-loop.d.ts +1 -1
- package/dist/engine/loop/agent-loop.js +10 -8
- package/dist/engine/loop/types.d.ts +15 -13
- package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
- package/dist/engine/session/memory-repo.d.ts +10 -11
- package/dist/engine/session/memory-repo.js +13 -8
- package/dist/engine/session/parent-chain-guard.d.ts +3 -2
- package/dist/engine/session/parent-chain-guard.js +1 -1
- package/dist/engine/session/repo-utils.d.ts +31 -3
- package/dist/engine/session/repo-utils.js +42 -5
- package/dist/index.d.ts +27 -15
- package/dist/index.js +21 -11
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +3 -3
- package/dist/internal/harness.js +2 -2
- package/dist/internal/llm.d.ts +1 -1
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/goal.js +2 -2
- package/dist/orchestration/run-workflow-tool.d.ts +2 -2
- package/dist/orchestration/run-workflow-tool.js +5 -3
- package/dist/orchestration/workflow-size-guideline.d.ts +4 -4
- package/dist/orchestration/workflow-types.d.ts +18 -0
- package/dist/orchestration/workflow-types.js +6 -0
- package/dist/orchestration/workflow.d.ts +2 -13
- package/dist/orchestration/workflow.js +21 -31
- package/dist/prompt-assembly/event-registry.js +1 -0
- package/dist/prompt-assembly/tool-catalog.d.ts +3 -0
- package/dist/prompt-assembly/tool-catalog.js +3 -0
- package/dist/prompts/default.d.ts +14 -14
- package/dist/scenarios/full-body.d.ts +4 -4
- package/dist/stores/file/adoption/adopt.d.ts +4 -3
- package/dist/stores/file/adoption/adopt.js +24 -31
- package/dist/stores/file/adoption/marker.d.ts +6 -13
- package/dist/stores/file/adoption/marker.js +6 -15
- package/dist/stores/file/checkpoint-store.d.ts +3 -0
- package/dist/stores/file/checkpoint-store.js +9 -3
- package/dist/stores/file/file-history-store.d.ts +20 -19
- package/dist/stores/file/file-history-store.js +152 -135
- package/dist/stores/file/fs-atomic.d.ts +15 -0
- package/dist/stores/file/fs-atomic.js +89 -14
- package/dist/stores/file/index.d.ts +1 -1
- package/dist/stores/file/mailbox-store.d.ts +3 -0
- package/dist/stores/file/mailbox-store.js +3 -1
- package/dist/stores/file/permission-rule-adopt.d.ts +1 -1
- package/dist/stores/file/permission-rule-adopt.js +15 -16
- package/dist/stores/file/permission-rule-store.d.ts +18 -2
- package/dist/stores/file/permission-rule-store.js +21 -14
- package/dist/stores/file/session-policy-store.d.ts +3 -3
- package/dist/stores/file/session-store.d.ts +26 -11
- package/dist/stores/file/session-store.js +77 -40
- package/dist/stores/file/workflow-journal-store.d.ts +10 -4
- package/dist/stores/file/workflow-journal-store.js +28 -13
- package/dist/tools/artifact/artifact-text.d.ts +1 -1
- package/dist/tools/artifact/artifact-tool.js +2 -1
- package/dist/tools/fs/bash-readonly-classifier.d.ts +3 -3
- package/dist/tools/fs/fs-bash.d.ts +2 -2
- package/dist/tools/fs/fs-bash.js +3 -1
- package/dist/tools/fs/fs-shared.d.ts +8 -8
- package/dist/tools/fs/gh-rate-limit.d.ts +1 -1
- package/dist/tools/fs/notebook.d.ts +2 -2
- package/dist/tools/fs/read-deny.d.ts +29 -7
- package/dist/tools/fs/read-deny.js +63 -22
- package/dist/tools/fs/removal-targets.d.ts +1 -1
- package/dist/tools/fs/safety.d.ts +9 -9
- package/dist/tools/fs/search.d.ts +6 -6
- package/dist/tools/fs/shell-read-check.js +6 -1
- package/dist/tools/fs/shell-read-judge.d.ts +4 -0
- package/dist/tools/fs/shell-read-judge.js +5 -2
- package/dist/tools/loop-tick.d.ts +2 -2
- package/dist/tools/scheduler-tools.js +5 -1
- package/dist/tools/task-list.d.ts +7 -7
- package/dist/tools/task-list.js +5 -1
- package/dist/tools/todo.js +2 -1
- package/dist/tools/web.d.ts +1 -1
- package/dist/tools/web.js +40 -37
- package/dist/tools/worktree.d.ts +3 -3
- package/dist/tools/worktree.js +3 -1
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +5756 -5638
- package/wire-changes/core@7.55.0.json +3318 -0
- package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +0 -39
- package/dist/core/store-contracts/session-store-incarnation-contract.js +0 -95
package/dist/tools/web.js
CHANGED
|
@@ -4,10 +4,11 @@ import { delimitUntrusted, inlineUntrusted } from "../core/untrusted-text.js";
|
|
|
4
4
|
import { discloseReminderShaped, observeReminderMarkEcho } from "../core/reminder-disclosure.js";
|
|
5
5
|
import { egressThrownText } from "../core/untrusted-egress.js";
|
|
6
6
|
import { isPrivateHost } from "../core/runner/image.js";
|
|
7
|
+
import { HOST_UNREADABLE_SENTENCE, hostOfSpelling, hostOfUrl } from "../core/host-target.js";
|
|
7
8
|
import { DEFAULT_CHARS_PER_TOKEN } from "../internal/harness.js";
|
|
8
9
|
import { binaryMagicFormat } from "./fs/safety.js";
|
|
9
10
|
import { pdfMagicMatches } from "../core/image-admission.js";
|
|
10
|
-
import { toolFace } from "../core/tool-catalog-entries.js";
|
|
11
|
+
import { mountRuleFace, toolFace } from "../core/tool-catalog-entries.js";
|
|
11
12
|
import { thrownText } from "../core/thrown-value.js";
|
|
12
13
|
const MAX_REDIRECTS = 10;
|
|
13
14
|
const MAX_URL_LENGTH = 2048;
|
|
@@ -201,25 +202,29 @@ function isPermittedRedirectHop(from, to) {
|
|
|
201
202
|
return false;
|
|
202
203
|
if (to.port !== from.port)
|
|
203
204
|
return false;
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
205
|
+
const here = hostOfUrl(from.toString());
|
|
206
|
+
const there = hostOfUrl(to.toString());
|
|
207
|
+
return "host" in here && "host" in there && here.host === there.host;
|
|
208
|
+
}
|
|
209
|
+
function hopRefusal(url, allowHosts) {
|
|
210
|
+
if (url.protocol !== "http:" && url.protocol !== "https:")
|
|
211
|
+
return `redirect to a non-http(s) URL (${url.protocol}) was refused`;
|
|
212
|
+
const reading = hostOfUrl(url.toString());
|
|
213
|
+
if ("unreadable" in reading)
|
|
214
|
+
return `${HOST_UNREADABLE_SENTENCE[reading.unreadable]}; refused`;
|
|
215
|
+
const allowlisted = allowHosts?.includes(reading.host) ?? false;
|
|
216
|
+
if (isPrivateHost(reading.host) && !allowlisted)
|
|
217
|
+
return `host "${reading.host}" is private/internal; refused (SSRF guard)${allowHosts ? " — not in the allowlist" : ""}`;
|
|
218
|
+
if (allowHosts && !allowlisted)
|
|
219
|
+
return `host "${reading.host}" is not in the allowlist; refused (redirect target re-checked)`;
|
|
220
|
+
return undefined;
|
|
208
221
|
}
|
|
209
222
|
async function fetchAllowlisted(doFetch, start, allowHosts, userAgent, signal, onResponse) {
|
|
210
223
|
let current = start;
|
|
211
224
|
for (let hop = 0; hop <= MAX_REDIRECTS; hop++) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const host = current.hostname;
|
|
216
|
-
const allowlisted = allowHosts?.includes(host) ?? false;
|
|
217
|
-
if (isPrivateHost(host) && !allowlisted) {
|
|
218
|
-
return { ok: false, error: `host "${host}" is private/internal; refused (SSRF guard)${allowHosts ? " — not in the allowlist" : ""}` };
|
|
219
|
-
}
|
|
220
|
-
if (allowHosts && !allowlisted) {
|
|
221
|
-
return { ok: false, error: `host "${host}" is not in the allowlist; refused (redirect target re-checked)` };
|
|
222
|
-
}
|
|
225
|
+
const refused = hopRefusal(current, allowHosts);
|
|
226
|
+
if (refused !== undefined)
|
|
227
|
+
return { ok: false, error: refused };
|
|
223
228
|
const res = await doFetch(current.toString(), {
|
|
224
229
|
signal,
|
|
225
230
|
redirect: "manual",
|
|
@@ -237,16 +242,9 @@ async function fetchAllowlisted(doFetch, start, allowHosts, userAgent, signal, o
|
|
|
237
242
|
catch {
|
|
238
243
|
return { ok: false, error: `invalid redirect Location: ${loc}` };
|
|
239
244
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
const nextAllowlisted = allowHosts?.includes(next.hostname) ?? false;
|
|
244
|
-
if (isPrivateHost(next.hostname) && !nextAllowlisted) {
|
|
245
|
-
return { ok: false, error: `host "${next.hostname}" is private/internal; refused (SSRF guard)${allowHosts ? " — not in the allowlist" : ""}` };
|
|
246
|
-
}
|
|
247
|
-
if (allowHosts && !nextAllowlisted) {
|
|
248
|
-
return { ok: false, error: `host "${next.hostname}" is not in the allowlist; refused (redirect target re-checked)` };
|
|
249
|
-
}
|
|
245
|
+
const nextRefused = hopRefusal(next, allowHosts);
|
|
246
|
+
if (nextRefused !== undefined)
|
|
247
|
+
return { ok: false, error: nextRefused };
|
|
250
248
|
if (!isPermittedRedirectHop(current, next)) {
|
|
251
249
|
return { ok: false, redirect: { originalUrl: current.toString(), redirectUrl: next.toString(), statusCode: res.status } };
|
|
252
250
|
}
|
|
@@ -261,10 +259,12 @@ export function webFetchToolSpec(config = {}) {
|
|
|
261
259
|
const maxBytes = resolveWebMaxBytes(config.maxBytes);
|
|
262
260
|
const fetchTimeoutMs = resolveWebTimeoutMs(config.timeoutMs, "WebFetch timeoutMs", DEFAULT_FETCH_TIMEOUT_MS);
|
|
263
261
|
const doFetch = config.fetchImpl ?? globalThis.fetch;
|
|
262
|
+
const allowHosts = config.allowHosts?.map((entry) => hostOfSpelling(entry) ?? entry);
|
|
264
263
|
const canSummarize = config.summarize !== undefined;
|
|
265
264
|
return {
|
|
266
265
|
name: "WebFetch",
|
|
267
266
|
...toolFace("web-fetch"),
|
|
267
|
+
ruleFace: mountRuleFace("web-fetch"),
|
|
268
268
|
description: (canSummarize
|
|
269
269
|
? "Fetches a URL, converts the page to markdown, and answers `prompt` against it with a sub-model.\n"
|
|
270
270
|
: "Fetches a URL, converts the page to markdown, and returns the markdown. This deployment has no " +
|
|
@@ -288,19 +288,21 @@ export function webFetchToolSpec(config = {}) {
|
|
|
288
288
|
if (url.length > MAX_URL_LENGTH) {
|
|
289
289
|
return failure(`Error (WebFetch): URL is ${url.length} characters — the limit is ${MAX_URL_LENGTH}.`);
|
|
290
290
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
parsed = new URL(url);
|
|
294
|
-
}
|
|
295
|
-
catch {
|
|
291
|
+
const subject = hostOfUrl(url);
|
|
292
|
+
if ("unreadable" in subject && (subject.unreadable === "not_text" || subject.unreadable === "not_url")) {
|
|
296
293
|
return failure(`Error (WebFetch): "${url}" is not a valid URL.`);
|
|
297
294
|
}
|
|
295
|
+
const parsed = new URL(url);
|
|
298
296
|
urlForDetails = parsed.toString();
|
|
299
|
-
if (
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
297
|
+
if ("unreadable" in subject) {
|
|
298
|
+
switch (subject.unreadable) {
|
|
299
|
+
case "not_http":
|
|
300
|
+
return failure(`Error (WebFetch): only http(s) URLs are allowed (got ${parsed.protocol}).`);
|
|
301
|
+
case "credentials":
|
|
302
|
+
return failure("Error (WebFetch): URLs with embedded credentials (user:pass@host) are refused.");
|
|
303
|
+
default:
|
|
304
|
+
return failure(`Error (WebFetch): the URL's host does not read back as one host ("${parsed.hostname.slice(0, 120)}") — write the host with no trailing dots.`);
|
|
305
|
+
}
|
|
304
306
|
}
|
|
305
307
|
if (!doFetch)
|
|
306
308
|
return failure("Error (WebFetch): no fetch implementation available in this environment.");
|
|
@@ -320,7 +322,7 @@ export function webFetchToolSpec(config = {}) {
|
|
|
320
322
|
let bodyCut;
|
|
321
323
|
let stoppedAtLimit = false;
|
|
322
324
|
try {
|
|
323
|
-
const fr = await fetchAllowlisted(doFetch, parsed,
|
|
325
|
+
const fr = await fetchAllowlisted(doFetch, parsed, allowHosts, config.userAgent ?? DEFAULT_WEBFETCH_USER_AGENT, ac.signal, (status, statusText) => {
|
|
324
326
|
connectedMeta = { status, statusText };
|
|
325
327
|
});
|
|
326
328
|
if (!fr.ok) {
|
|
@@ -845,6 +847,7 @@ export function createWebSearchTool(config) {
|
|
|
845
847
|
return {
|
|
846
848
|
name: "WebSearch",
|
|
847
849
|
...toolFace("web-search"),
|
|
850
|
+
ruleFace: mountRuleFace("web-search"),
|
|
848
851
|
description: "Search the web. Returns result blocks with titles and URLs.\n" +
|
|
849
852
|
"\n" +
|
|
850
853
|
`- The current month is ${currentMonthYear} — use this when searching for recent information.\n` +
|
package/dist/tools/worktree.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 审计深挖 G4 — the `EnterWorktree` / `ExitWorktree` tool pair: SESSION-level git-worktree
|
|
3
|
-
* isolation
|
|
3
|
+
* isolation. EnterWorktree creates a managed worktree under `.sema-worktrees/`
|
|
4
4
|
* (the same {@link WORKTREE_PARENT} the subagent `isolation:"worktree"` lane uses) and REALLY switches
|
|
5
5
|
* the task's working directory into it; ExitWorktree returns to the original directory and cleans up.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Semantics:
|
|
8
8
|
* ① worktrees live in a managed parent dir inside the repo (CC: `.claude/worktrees/`; sema:
|
|
9
9
|
* `.sema-worktrees/`) — never scattered;
|
|
10
10
|
* ② baseRef is two-state: `"head"` = the current local HEAD (unpushed commits present), `"fresh"` =
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* sandbox**. resolveKey's containment anchor stays the ORIGINAL task root — it is deliberately NOT
|
|
32
32
|
* re-anchored/tightened to the worktree dir, so `../../` from inside the worktree can still reach the
|
|
33
33
|
* rest of the repository (which is WITHIN the task root and was reachable before Enter too), while
|
|
34
|
-
* anything outside the task root stays fenced exactly as before. This matches
|
|
34
|
+
* anything outside the task root stays fenced exactly as before. This matches the reference's semantics
|
|
35
35
|
* (CC worktrees live beside the repo with no containment tightening either); tightening here would buy
|
|
36
36
|
* no security (Bash/`cd` already roam the root) and would break legitimate repo-relative access. The
|
|
37
37
|
* tool description + Enter reply state this honestly so the model never assumes isolation.
|
package/dist/tools/worktree.js
CHANGED
|
@@ -2,7 +2,7 @@ import { resolve } from "node:path";
|
|
|
2
2
|
import { Type } from "typebox";
|
|
3
3
|
import { defineTool, errorResult } from "../core/tools.js";
|
|
4
4
|
import { addWorktree, pruneWorktrees, WORKTREE_PARENT } from "../core/git-worktree-env.js";
|
|
5
|
-
import { toolFace } from "../core/tool-catalog-entries.js";
|
|
5
|
+
import { mountRuleFace, toolFace } from "../core/tool-catalog-entries.js";
|
|
6
6
|
import { thrownText } from "../core/thrown-value.js";
|
|
7
7
|
const ENTER_DESCRIPTION = "Use this tool ONLY when explicitly instructed to work in a worktree — either by the user directly, or by " +
|
|
8
8
|
"project instructions. This tool creates an isolated git worktree and switches the current session into it.\n" +
|
|
@@ -113,6 +113,7 @@ export function createWorktreeTools(env, opts) {
|
|
|
113
113
|
const enter = defineTool({
|
|
114
114
|
name: "EnterWorktree",
|
|
115
115
|
...toolFace("enter-worktree"),
|
|
116
|
+
ruleFace: mountRuleFace("enter-worktree"),
|
|
116
117
|
description: ENTER_DESCRIPTION,
|
|
117
118
|
parameters: Type.Object({
|
|
118
119
|
name: Type.Optional(Type.String({
|
|
@@ -242,6 +243,7 @@ export function createWorktreeTools(env, opts) {
|
|
|
242
243
|
const exit = defineTool({
|
|
243
244
|
name: "ExitWorktree",
|
|
244
245
|
...toolFace("exit-worktree"),
|
|
246
|
+
ruleFace: mountRuleFace("exit-worktree"),
|
|
245
247
|
description: EXIT_DESCRIPTION,
|
|
246
248
|
parameters: Type.Object({
|
|
247
249
|
keep: Type.Optional(Type.Boolean({
|