@sema-agent/core 5.19.0 → 5.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +102 -4
- package/dist/agents/agent-definition.d.ts +7 -0
- package/dist/agents/agent-transcript-tool.d.ts +30 -0
- package/dist/agents/builtin-agents.d.ts +60 -0
- package/dist/agents/cascade.d.ts +107 -0
- package/dist/agents/cumulative-stats.d.ts +56 -0
- package/dist/agents/observer.d.ts +162 -0
- package/dist/agents/peer-admission.d.ts +95 -0
- package/dist/agents/repair-loop.d.ts +226 -0
- package/dist/agents/retain-ledger.d.ts +141 -0
- package/dist/agents/roster-store.d.ts +105 -0
- package/dist/agents/roster-store.js +3 -0
- package/dist/agents/send-message-tool.d.ts +92 -0
- package/dist/agents/session-util.d.ts +5 -0
- package/dist/agents/subagent-steps.d.ts +66 -0
- package/dist/agents/subagent.d.ts +600 -0
- package/dist/agents/suspend-guard.d.ts +29 -0
- package/dist/agents/teacher.d.ts +75 -0
- package/dist/agents/team.d.ts +120 -1
- package/dist/agents/tool-filter.d.ts +34 -0
- package/dist/agents/verify.d.ts +198 -0
- package/dist/bench/metrics.d.ts +455 -0
- package/dist/brain/anthropic.d.ts +30 -0
- package/dist/brain/circuit-breaker.d.ts +33 -0
- package/dist/brain/circuit-breaker.js +14 -3
- package/dist/brain/context-overflow.d.ts +60 -3
- package/dist/brain/degrading.d.ts +67 -0
- package/dist/brain/errors.d.ts +42 -0
- package/dist/brain/failover.d.ts +15 -0
- package/dist/brain/media-degrade.d.ts +39 -0
- package/dist/brain/model-presets.d.ts +31 -0
- package/dist/brain/open-responses.d.ts +19 -0
- package/dist/brain/openai.d.ts +46 -0
- package/dist/brain/reasoning.d.ts +106 -1
- package/dist/brain/repetition.d.ts +83 -0
- package/dist/brain/request-params.d.ts +56 -0
- package/dist/brain/retry.d.ts +46 -0
- package/dist/brain/routing.d.ts +12 -0
- package/dist/brain/status-sink.d.ts +30 -1
- package/dist/brain/stream-engine.d.ts +147 -0
- package/dist/brain/stream-shared.d.ts +34 -0
- package/dist/brain/terminal-cause.d.ts +31 -0
- package/dist/brain/timeout.d.ts +108 -0
- package/dist/brain/timeout.js +11 -0
- package/dist/brain/tool-call-id.d.ts +20 -0
- package/dist/brain/tool-call-repair.d.ts +13 -0
- package/dist/config/catalog.d.ts +47 -0
- package/dist/config/defaults.d.ts +33 -0
- package/dist/core/a2a-task-state.d.ts +53 -0
- package/dist/core/a2a.d.ts +51 -0
- package/dist/core/arg-summary.d.ts +62 -0
- package/dist/core/ask-question.d.ts +272 -2
- package/dist/core/auto-compaction.d.ts +467 -0
- package/dist/core/auto-compaction.js +20 -6
- package/dist/core/auto-mode-prompt-assets.d.ts +8 -0
- package/dist/core/auto-mode-prompt.d.ts +27 -0
- package/dist/core/auto-mode.d.ts +54 -3
- package/dist/core/auto-promote.d.ts +100 -0
- package/dist/core/background-agent-store.d.ts +293 -0
- package/dist/core/background-agent-store.js +5 -0
- package/dist/core/background-shell.d.ts +110 -0
- package/dist/core/cache-break-detector.d.ts +34 -0
- package/dist/core/canonical-json.d.ts +57 -0
- package/dist/core/checkpoint-store.d.ts +1574 -16
- package/dist/core/compliance.d.ts +30 -0
- package/dist/core/consolidate-scope.d.ts +75 -0
- package/dist/core/context-edit.d.ts +99 -0
- package/dist/core/context-guard.d.ts +46 -0
- package/dist/core/exec-gate.d.ts +44 -0
- package/dist/core/exec-output-tail.d.ts +61 -0
- package/dist/core/file-snapshot-store.d.ts +104 -0
- package/dist/core/fs-write-gate-policy.d.ts +36 -0
- package/dist/core/git-worktree-env.d.ts +31 -0
- package/dist/core/governance-codes.d.ts +19 -0
- package/dist/core/hooks.d.ts +609 -1
- package/dist/core/human-input-projection.d.ts +37 -0
- package/dist/core/human-input-projection.js +13 -0
- package/dist/core/image-downsample.d.ts +74 -0
- package/dist/core/locked-config.d.ts +37 -0
- package/dist/core/lsp-diagnostics.d.ts +77 -0
- package/dist/core/lsp-protocol.d.ts +29 -0
- package/dist/core/lsp-session.d.ts +60 -1
- package/dist/core/lsp.d.ts +150 -1
- package/dist/core/mailbox-store.d.ts +57 -0
- package/dist/core/mailbox-store.js +2 -0
- package/dist/core/mcp.d.ts +385 -0
- package/dist/core/mcp.js +58 -11
- package/dist/core/media-byte-cap.d.ts +21 -0
- package/dist/core/memory-admission.d.ts +71 -0
- package/dist/core/memory-engine/content-origin.d.ts +64 -0
- package/dist/core/memory-engine/data-plane.d.ts +43 -0
- package/dist/core/memory-engine/dual-root.d.ts +24 -0
- package/dist/core/memory-engine/engine.d.ts +230 -0
- package/dist/core/memory-engine/engine.js +103 -35
- package/dist/core/memory-engine/file-backend.d.ts +155 -0
- package/dist/core/memory-engine/frontmatter.d.ts +16 -0
- package/dist/core/memory-engine/layout.d.ts +217 -0
- package/dist/core/memory-engine/memory-backend-contract.d.ts +12 -0
- package/dist/core/memory-engine/migrate.d.ts +9 -0
- package/dist/core/memory-engine/scan.d.ts +12 -0
- package/dist/core/memory-engine/scope-contract.d.ts +61 -1
- package/dist/core/memory-engine/sync-client.d.ts +87 -0
- package/dist/core/memory-engine/sync.d.ts +60 -0
- package/dist/core/memory-engine/tools.d.ts +41 -0
- package/dist/core/memory-engine/types.d.ts +188 -0
- package/dist/core/memory-recall.d.ts +141 -0
- package/dist/core/memory-vector.d.ts +20 -0
- package/dist/core/memory.d.ts +458 -0
- package/dist/core/message-utils.d.ts +6 -0
- package/dist/core/oracle-isolation.d.ts +69 -0
- package/dist/core/permission-rule-consent.d.ts +138 -0
- package/dist/core/permission-rule-model.d.ts +122 -0
- package/dist/core/permission-rule-store.d.ts +119 -3
- package/dist/core/permission-rules.d.ts +87 -1
- package/dist/core/present-plan-tool.d.ts +20 -0
- package/dist/core/pricing.d.ts +26 -0
- package/dist/core/property-harness.d.ts +86 -0
- package/dist/core/protocol-naming.d.ts +38 -0
- package/dist/core/protocol-table.d.ts +61 -0
- package/dist/core/push-queue.d.ts +1 -0
- package/dist/core/remote-env.d.ts +383 -1
- package/dist/core/retention-policy.d.ts +40 -0
- package/dist/core/retention-policy.js +21 -0
- package/dist/core/retention.d.ts +51 -0
- package/dist/core/roles.d.ts +59 -0
- package/dist/core/runner/active-skill-scope.d.ts +34 -0
- package/dist/core/runner/assemble-result.d.ts +134 -0
- package/dist/core/runner/compaction-call-options.d.ts +97 -1
- package/dist/core/runner/grounding-signal.d.ts +10 -0
- package/dist/core/runner/image.d.ts +17 -0
- package/dist/core/runner/image.js +29 -15
- package/dist/core/runner/memory-consolidation.d.ts +60 -0
- package/dist/core/runner/prepare-memory.d.ts +59 -0
- package/dist/core/runner/prepare-task.d.ts +1011 -2
- package/dist/core/runner/prepare-task.js +51 -14
- package/dist/core/runner/prompt-suggestions.d.ts +7 -0
- package/dist/core/runner/runtask.d.ts +304 -3
- package/dist/core/runner/runtask.js +17 -2
- package/dist/core/runner/session-file-state-replay.d.ts +49 -0
- package/dist/core/runner/session-rule-policy.d.ts +58 -0
- package/dist/core/runner/strict-output-schema.d.ts +18 -3
- package/dist/core/runner/synthetic-tools.d.ts +113 -0
- package/dist/core/runner/teardown-bounded.d.ts +34 -0
- package/dist/core/runner/tool-disclosure.d.ts +227 -0
- package/dist/core/runner/tool-output-projection.d.ts +6 -0
- package/dist/core/runner/turn-attachments.d.ts +634 -0
- package/dist/core/runner/usage-accounting.d.ts +32 -0
- package/dist/core/runtime.d.ts +9 -0
- package/dist/core/safe-notify.d.ts +64 -0
- package/dist/core/safety-axis-vocab.d.ts +23 -0
- package/dist/core/safety-merge-corpus.d.ts +37 -0
- package/dist/core/scheduler.d.ts +121 -0
- package/dist/core/secret-env.d.ts +32 -0
- package/dist/core/select-model.d.ts +15 -0
- package/dist/core/sensitive-path-policy.d.ts +42 -0
- package/dist/core/session-policy-store.d.ts +94 -0
- package/dist/core/session-reconcile.d.ts +80 -0
- package/dist/core/session-store.d.ts +85 -0
- package/dist/core/session.d.ts +153 -0
- package/dist/core/shared-memory/contract.d.ts +22 -0
- package/dist/core/shared-memory/normalize.d.ts +123 -2
- package/dist/core/shared-memory/tools.d.ts +14 -0
- package/dist/core/shared-memory/types.d.ts +105 -0
- package/dist/core/shutdown-debug.d.ts +6 -0
- package/dist/core/side-query.d.ts +38 -0
- package/dist/core/side-query.js +6 -1
- package/dist/core/skill-tool-specifier.d.ts +72 -0
- package/dist/core/skills-directory.d.ts +100 -1
- package/dist/core/spec-contract.d.ts +89 -0
- package/dist/core/store-contracts/background-agent-store-contract.d.ts +31 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +26 -0
- package/dist/core/store-contracts/contract-harness.d.ts +20 -0
- package/dist/core/store-contracts/contract-kit-version.d.ts +27 -0
- package/dist/core/store-contracts/file-snapshot-store-contract.d.ts +8 -0
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +42 -0
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +13 -0
- package/dist/core/strategy-store.d.ts +37 -0
- package/dist/core/stub-env.d.ts +7 -0
- package/dist/core/surrogate-safe-slice.d.ts +35 -0
- package/dist/core/task-notification.d.ts +202 -0
- package/dist/core/task-outcome.d.ts +53 -0
- package/dist/core/task-registry-agent.d.ts +337 -1
- package/dist/core/task-registry-agent.js +2 -0
- package/dist/core/task-registry-monitor.d.ts +12 -0
- package/dist/core/task-registry-shared.d.ts +540 -0
- package/dist/core/task-registry.d.ts +343 -0
- package/dist/core/task-registry.js +13 -2
- package/dist/core/task-tool-shape.d.ts +44 -0
- package/dist/core/tighten-task-spec.d.ts +21 -0
- package/dist/core/tool-detach.d.ts +21 -0
- package/dist/core/tool-errors.d.ts +131 -0
- package/dist/core/tool-errors.js +4 -0
- package/dist/core/tool-name-aliases.d.ts +27 -0
- package/dist/core/tool-policy.d.ts +555 -0
- package/dist/core/tool-policy.js +3 -0
- package/dist/core/tool-result-budget.d.ts +32 -0
- package/dist/core/tool-result-store.d.ts +174 -1
- package/dist/core/tools.d.ts +45 -0
- package/dist/core/trace.d.ts +323 -0
- package/dist/core/types.d.ts +3859 -2
- package/dist/core/untrusted-egress.d.ts +8 -0
- package/dist/core/untrusted-text.d.ts +156 -0
- package/dist/core/usage-window-store.d.ts +95 -0
- package/dist/core/version.d.ts +1 -0
- package/dist/core/warm-resume.d.ts +17 -0
- package/dist/core/wiring-manifest.d.ts +169 -0
- package/dist/core/with-retry.d.ts +24 -0
- package/dist/core/workflow-journal-store.d.ts +160 -0
- package/dist/core/workflow-run-store-contract.d.ts +25 -0
- package/dist/core/workflow-run-store.d.ts +119 -0
- package/dist/core/workflow-run-store.js +2 -0
- package/dist/engine/compaction/compaction.d.ts +256 -1
- package/dist/engine/compaction/utils.d.ts +94 -0
- package/dist/engine/execution-env/kill-tree.d.ts +29 -0
- package/dist/engine/execution-env/node-execution-env.d.ts +94 -0
- package/dist/engine/harness/agent-harness.d.ts +116 -0
- package/dist/engine/harness/agent-harness.js +3 -14
- package/dist/engine/harness/messages.d.ts +15 -0
- package/dist/engine/harness/types.d.ts +464 -2
- package/dist/engine/llm/diagnostics.d.ts +4 -0
- package/dist/engine/llm/event-stream.d.ts +3 -0
- package/dist/engine/llm/index.d.ts +7 -0
- package/dist/engine/llm/types.d.ts +500 -3
- package/dist/engine/llm/validation.d.ts +3 -0
- package/dist/engine/loop/agent-loop.d.ts +87 -2
- package/dist/engine/loop/runtime-deps.d.ts +7 -0
- package/dist/engine/loop/types.d.ts +424 -0
- package/dist/engine/lsp/frame-decoder.d.ts +13 -0
- package/dist/engine/lsp/node-lsp-manager.d.ts +107 -0
- package/dist/engine/lsp/stdio-lsp-transport.d.ts +7 -0
- package/dist/engine/session/import-validate.d.ts +27 -0
- package/dist/engine/session/log-digest.d.ts +93 -0
- package/dist/engine/session/memory-repo.d.ts +6 -0
- package/dist/engine/session/memory-storage.d.ts +2 -0
- package/dist/engine/session/session.d.ts +75 -0
- package/dist/engine/session/storage-base.d.ts +8 -0
- package/dist/fixtures/index.d.ts +36 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.js +1 -2
- package/dist/internal/harness-types.d.ts +6 -0
- package/dist/internal/harness.d.ts +11 -0
- package/dist/internal/llm.d.ts +6 -0
- package/dist/orchestration/builtin-workflows.d.ts +53 -0
- package/dist/orchestration/dev-vm-script-runner.d.ts +19 -0
- package/dist/orchestration/goal.d.ts +57 -0
- package/dist/orchestration/goal.js +3 -0
- package/dist/orchestration/run-spec.d.ts +42 -0
- package/dist/orchestration/run-spec.js +4 -0
- package/dist/orchestration/run-workflow-tool.d.ts +169 -0
- package/dist/orchestration/workflow-governance.d.ts +61 -0
- package/dist/orchestration/workflow-meta.d.ts +28 -0
- package/dist/orchestration/workflow-observe.d.ts +60 -0
- package/dist/orchestration/workflow-primitives.d.ts +23 -1
- package/dist/orchestration/workflow-sandbox-conformance.d.ts +38 -0
- package/dist/orchestration/workflow-script-runner.d.ts +88 -0
- package/dist/orchestration/workflow-script-store.d.ts +98 -0
- package/dist/orchestration/workflow-size-guideline.d.ts +67 -0
- package/dist/orchestration/workflow-types.d.ts +169 -2
- package/dist/orchestration/workflow.d.ts +358 -0
- package/dist/orchestration/workflow.js +13 -2
- package/dist/prompt-assembly/artifact-store.d.ts +33 -0
- package/dist/prompt-assembly/artifact.d.ts +25 -0
- package/dist/prompt-assembly/assemble.d.ts +20 -0
- package/dist/prompt-assembly/composer.d.ts +29 -0
- package/dist/prompt-assembly/epoch.d.ts +55 -1
- package/dist/prompt-assembly/event-registry.d.ts +35 -0
- package/dist/prompt-assembly/explain.d.ts +12 -0
- package/dist/prompt-assembly/tool-catalog.d.ts +38 -0
- package/dist/prompt-assembly/turn-snapshot.d.ts +40 -0
- package/dist/prompt-assembly/types.d.ts +115 -0
- package/dist/prompts/coordinator.d.ts +27 -0
- package/dist/prompts/default.d.ts +539 -0
- package/dist/prompts/simple-sections.d.ts +45 -0
- package/dist/prompts/supervisor.d.ts +66 -0
- package/dist/scenarios/env.d.ts +28 -0
- package/dist/scenarios/full-body.d.ts +50 -0
- package/dist/scenarios/scenario-registry.d.ts +60 -0
- package/dist/scenarios/teacher-quickstart.d.ts +27 -0
- package/dist/server/http.d.ts +17 -0
- package/dist/stores/cc/lockfile.d.ts +6 -0
- package/dist/stores/cc/mailbox-store.d.ts +8 -0
- package/dist/stores/cc/roster-adapter.d.ts +4 -0
- package/dist/stores/cc/sidecar-transcript.d.ts +66 -0
- package/dist/stores/file/background-agent-store.d.ts +24 -0
- package/dist/stores/file/background-agent-store.js +2 -1
- package/dist/stores/file/checkpoint-store.d.ts +38 -0
- package/dist/stores/file/file-snapshot-store.d.ts +25 -0
- package/dist/stores/file/fs-atomic.d.ts +155 -0
- package/dist/stores/file/index.d.ts +89 -0
- package/dist/stores/file/mailbox-store.d.ts +36 -0
- package/dist/stores/file/mailbox-store.js +2 -0
- package/dist/stores/file/memory-store.d.ts +82 -0
- package/dist/stores/file/permission-rule-store.d.ts +79 -0
- package/dist/stores/file/session-policy-store.d.ts +28 -0
- package/dist/stores/file/session-store.d.ts +40 -0
- package/dist/stores/file/shared-ledger.d.ts +83 -0
- package/dist/stores/file/tool-result-store.d.ts +11 -0
- package/dist/stores/file/usage-window-store.d.ts +18 -0
- package/dist/stores/file/workflow-journal-store.d.ts +100 -0
- package/dist/stores/file/workflow-run-store.d.ts +11 -0
- package/dist/stores/file/workflow-run-store.js +2 -0
- package/dist/tools/fs/bash-readonly-classifier.d.ts +282 -0
- package/dist/tools/fs/encoding.d.ts +60 -0
- package/dist/tools/fs/fs-bash.d.ts +133 -0
- package/dist/tools/fs/fs-pdf.d.ts +28 -0
- package/dist/tools/fs/fs-search-tools.d.ts +5 -0
- package/dist/tools/fs/fs-shared.d.ts +360 -0
- package/dist/tools/fs/fs-write.d.ts +16 -0
- package/dist/tools/fs/gh-rate-limit.d.ts +22 -0
- package/dist/tools/fs/index.d.ts +79 -0
- package/dist/tools/fs/notebook.d.ts +56 -0
- package/dist/tools/fs/pdf.d.ts +70 -0
- package/dist/tools/fs/pdf.js +8 -2
- package/dist/tools/fs/repo-map.d.ts +10 -0
- package/dist/tools/fs/safety.d.ts +376 -0
- package/dist/tools/fs/search.d.ts +131 -0
- package/dist/tools/loop-tick.d.ts +24 -0
- package/dist/tools/monitor.d.ts +55 -0
- package/dist/tools/scheduler-tools.d.ts +51 -0
- package/dist/tools/sql-adapters.d.ts +18 -0
- package/dist/tools/sql.d.ts +25 -0
- package/dist/tools/task-list.d.ts +77 -0
- package/dist/tools/todo.d.ts +8 -0
- package/dist/tools/web.d.ts +184 -0
- package/dist/tools/web.js +32 -5
- package/dist/tools/worktree.d.ts +81 -0
- package/package.json +2 -2
- package/dist/tools/gitea-issue.d.ts +0 -13
- package/dist/tools/gitea-issue.js +0 -75
|
@@ -1,11 +1,47 @@
|
|
|
1
1
|
import type { ExecutionEnv } from "../internal/harness-types.js";
|
|
2
2
|
import type { ToolPolicy } from "./tool-policy.js";
|
|
3
|
+
/** Options for {@link createFsWriteGatePolicy}. */
|
|
3
4
|
export interface FsWriteGatePolicyOptions {
|
|
5
|
+
/** The task's real execution env (the one the hands run against) — canonicalization must see the
|
|
6
|
+
* actual filesystem (a remote/E2B task resolves in its container). */
|
|
4
7
|
env: ExecutionEnv;
|
|
8
|
+
/** The FALLBACK base a relative path resolves against (omit = paths resolve as given). RB-108: the
|
|
9
|
+
* call's TARGET prefers the live tracked cwd when the engine stamps one ({@link ToolCallRequest.cwd});
|
|
10
|
+
* the `acceptDirs`/`exemptDirs` entries below always resolve against THIS value. */
|
|
5
11
|
rootPath?: string;
|
|
12
|
+
/** Writes whose canonical target lands inside one of these dirs are ALLOWED (the accept-session
|
|
13
|
+
* domain, e.g. the cwd subtree after "allow all edits during this session"). */
|
|
6
14
|
acceptDirs?: readonly string[];
|
|
15
|
+
/** Writes whose canonical target lands inside one of these dirs are ALLOWED and never asked
|
|
16
|
+
* (auto-approved working areas: the scratchpad dir, plan files). Checked before `acceptDirs`
|
|
17
|
+
* (same verdict — the split is intent/observability, exemptions are structural not session-won). */
|
|
7
18
|
exemptDirs?: readonly string[];
|
|
19
|
+
/** Verdict for a covered write OUTSIDE every domain: `"ask"` (the manual-mode default) routes it
|
|
20
|
+
* to the ask-resolution chain (live onAsk / durable park / headless deny); `"allow"` is the
|
|
21
|
+
* acceptEdits-mode shape (domain checks still run so a sensitive-path deny composes unchanged). */
|
|
8
22
|
defaultWrite: "ask" | "allow";
|
|
23
|
+
/**
|
|
24
|
+
* Session-exemption lookup ("allow all for this session" grants recorded by the deployment's approval
|
|
25
|
+
* surface). Consulted ONCE per covered write, after the domain checks and immediately BEFORE the gate
|
|
26
|
+
* would produce its `ask`/default verdict — a `true` return short-circuits to `allow` (with a message
|
|
27
|
+
* naming the exemption source for the audit trail) so an already-granted write does not re-ask/park.
|
|
28
|
+
*
|
|
29
|
+
* · `toolName` is the CANONICAL tool name (same normalization this gate matches on), so an exemption
|
|
30
|
+
* recorded under either alias of a tool matches both — key your store with the same normalization.
|
|
31
|
+
* · `canonicalPath` is the CANONICALIZED real target (the exact key the gate's own symlink-safe
|
|
32
|
+
* containment judged) — a symlink alias of an exempted file therefore still hits the exemption,
|
|
33
|
+
* and an exemption can never be minted for a raw alias that resolves elsewhere.
|
|
34
|
+
* · FAIL-CLOSED: a throwing/rejecting lookup counts as "not exempt" (the write asks as before) —
|
|
35
|
+
* an exemption-store outage must never widen the gate.
|
|
36
|
+
* · Cannot override a DENY: this factory never denies; a sensitive-path deny composed alongside via
|
|
37
|
+
* `combinePolicies` outranks this `allow` under the deny > ask > allow fold, and the two fail-closed
|
|
38
|
+
* asks for an UNRESOLVABLE target fire before any canonical key exists, so they are never exempted.
|
|
39
|
+
*/
|
|
9
40
|
isExempt?: (toolName: string, canonicalPath: string) => boolean | Promise<boolean>;
|
|
10
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Build the file-write approval gate policy. Mount via `combinePolicies` alongside the deployment's
|
|
44
|
+
* other layers (sensitive-path deny, session rules, caller policy) — see the module header for the
|
|
45
|
+
* layering contract. Idempotent + side-effect free per {@link combinePolicies}'s requirement.
|
|
46
|
+
*/
|
|
11
47
|
export declare function createFsWriteGatePolicy(opts: FsWriteGatePolicyOptions): ToolPolicy;
|
|
@@ -1,17 +1,48 @@
|
|
|
1
1
|
import type { ExecutionEnv } from "../internal/harness-types.js";
|
|
2
|
+
/** Private parent dir (under the repo root) that holds all managed worktrees, so {@link pruneWorktrees} and a
|
|
3
|
+
* userland reaper can find orphans by a single known location. */
|
|
2
4
|
export declare const WORKTREE_PARENT = ".sema-worktrees";
|
|
3
5
|
export interface AddWorktreeOptions {
|
|
6
|
+
/** The base repository root — where `git worktree add` runs (the base env's cwd is typically this). */
|
|
4
7
|
repoRoot: string;
|
|
8
|
+
/** Stable per-task identity, sanitized into the worktree dir name (for human-readable orphan diagnosis). */
|
|
5
9
|
sessionId: string;
|
|
10
|
+
/**
|
|
11
|
+
* How to build a worktree-ROOTED {@link ExecutionEnv} for THIS env type — the only env-specific bit. Local:
|
|
12
|
+
* `(dir) => new NodeExecutionEnv({ cwd: dir })`. A single-E2B deployment: an E2B env whose cwd is `dir`. The
|
|
13
|
+
* returned env's fs/shell must operate relative to `dir`, so the agent's hands AND exec are confined there.
|
|
14
|
+
*/
|
|
6
15
|
rootEnvAt: (worktreeDir: string) => ExecutionEnv | Promise<ExecutionEnv>;
|
|
16
|
+
/** Base commit/ref for the worktree (default `HEAD` at creation time). */
|
|
7
17
|
commit?: string;
|
|
8
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* design/97 CORE-6 — the env-agnostic git-WORKTREE isolation primitive. Creates a detached worktree under
|
|
21
|
+
* {@link WORKTREE_PARENT} in `repoRoot` (via the BASE env's shell) and returns a worktree-ROOTED ExecutionEnv
|
|
22
|
+
* (built by `rootEnvAt`) whose `destroy()` removes the worktree. A control-plane `executionEnvFactory` calls this
|
|
23
|
+
* when its `ctx.isolation === "worktree"` and returns the result (with `destroy`); for a non-isolated task it
|
|
24
|
+
* returns the SHARED base env (no `destroy`) so the Runner never tears the base down.
|
|
25
|
+
*
|
|
26
|
+
* ISOLATE-ONLY (clay): the runtime never merges — the orchestrator script reads each worktree's result and
|
|
27
|
+
* decides verify/merge in userland. Caveats (codex review): `git worktree` isolates the git WORKING COPY, not
|
|
28
|
+
* arbitrary shell access (bash can still reach the host — sandbox separately); UNCOMMITTED changes in the base
|
|
29
|
+
* repo are absent in the child (detached HEAD); a worktree orphaned by a process crash is reaped by
|
|
30
|
+
* {@link pruneWorktrees} (userland — there is no Runner hook for post-kill cleanup).
|
|
31
|
+
*/
|
|
9
32
|
export declare function addWorktree(baseEnv: ExecutionEnv, opts: AddWorktreeOptions): Promise<{
|
|
10
33
|
env: ExecutionEnv & {
|
|
11
34
|
destroy(): Promise<void>;
|
|
12
35
|
};
|
|
13
36
|
worktreeDir: string;
|
|
14
37
|
}>;
|
|
38
|
+
/** Reap orphaned worktrees (after a crash removed their dirs) — `git worktree prune` deregisters them. A userland
|
|
39
|
+
* reaper calls this periodically against the base repo; core ships no post-kill Runner hook.
|
|
40
|
+
*
|
|
41
|
+
* HRD-PTL-11: the exec Result used to be discarded, so every caller had to ASSUME the prune landed — and
|
|
42
|
+
* ExitWorktree's "already gone externally" leg told the model "stale git worktree metadata was pruned"
|
|
43
|
+
* on a claim it could not have checked. Same fail-loud treatment {@link removeWorktree} already got
|
|
44
|
+
* (server [1796]②): report the outcome, let the caller decide what to say. Never throws (a throwing env
|
|
45
|
+
* lands on the same `{ok:false}`), so a caller that ignores the value behaves exactly as before. */
|
|
15
46
|
export declare function pruneWorktrees(baseEnv: ExecutionEnv, repoRoot: string): Promise<{
|
|
16
47
|
ok: true;
|
|
17
48
|
} | {
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
/** Retry class of a governance code: `transient` = a later retry can self-heal (control-plane
|
|
2
|
+
* absence/outage); `terminal` = policy adjudicated, re-issuing changes nothing. */
|
|
1
3
|
export type GovernanceRetryClass = "transient" | "terminal";
|
|
4
|
+
/**
|
|
5
|
+
* The closed governance-code registry. tsc forces every entry to a valid class; the gate test
|
|
6
|
+
* forces the naming convention and pack-family completeness. Adding a code = one deliberate row.
|
|
7
|
+
*/
|
|
2
8
|
export declare const GOVERNANCE_CODES: {
|
|
3
9
|
readonly "usage.window_exhausted": "terminal";
|
|
4
10
|
readonly "memory.admission_required": "transient";
|
|
@@ -8,5 +14,18 @@ export declare const GOVERNANCE_CODES: {
|
|
|
8
14
|
readonly "config.locked_key": "terminal";
|
|
9
15
|
};
|
|
10
16
|
export type GovernanceCode = keyof typeof GOVERNANCE_CODES;
|
|
17
|
+
/**
|
|
18
|
+
* `memory.*` error codes DELIBERATELY outside governance: write-gate and engine incident codes
|
|
19
|
+
* (secret detection, promotable-gate refusals, announce/partition incidents, tail truncation) —
|
|
20
|
+
* mechanical faults and content-safety refusals, not per-principal policy verdicts; they classify
|
|
21
|
+
* as `logic`. The gate test forces every `memory.*` literal minted in src/ to appear EITHER in
|
|
22
|
+
* {@link GOVERNANCE_CODES} or here — a new code gets NAMED and dispositioned, never silently
|
|
23
|
+
* classified.
|
|
24
|
+
*/
|
|
11
25
|
export declare const NON_GOVERNANCE_MEMORY_CODES: ReadonlySet<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Look up a code's governance retry class. Registered code ⇒ its table class; unregistered
|
|
28
|
+
* `usage.*` ⇒ `"terminal"` (the prefix family's shipped classification); anything else ⇒
|
|
29
|
+
* `undefined` (NOT governance — the caller falls through to its ordinary taxonomy).
|
|
30
|
+
*/
|
|
12
31
|
export declare function governanceRetryClass(code: string): GovernanceRetryClass | undefined;
|