@sema-agent/server 7.52.1 → 7.54.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/USAGE.md +7 -1
- package/dist/adoption/plan.d.ts +3 -3
- package/dist/adoption/quiesce.d.ts +1 -1
- package/dist/adoption/sql.d.ts +2 -2
- package/dist/adoption/wire.d.ts +1 -1
- package/dist/approval-ask-machine.d.ts +2 -2
- package/dist/approval-card.d.ts +18 -18
- package/dist/approval-deny-reasons.d.ts +1 -1
- package/dist/approval-hmac.d.ts +2 -2
- package/dist/approval-reconciler.d.ts +14 -14
- package/dist/approval.d.ts +2 -2
- package/dist/audit.d.ts +4 -4
- package/dist/auth-keys.d.ts +6 -6
- package/dist/bench/l8/artifact.d.ts +6 -1
- package/dist/bench/l8/artifact.js +2 -27
- package/dist/bench/l8/escape.d.ts +3 -3
- package/dist/bench/l8/index.d.ts +1 -1
- package/dist/bench/s1/arms.d.ts +3 -3
- package/dist/bench/s1/oracle.d.ts +2 -2
- package/dist/bench/s1/reviewer.d.ts +1 -1
- package/dist/bench/s1/row.d.ts +5 -5
- package/dist/bench/s1/runner-ctx.d.ts +3 -3
- package/dist/boot/config-center.d.ts +14 -7
- package/dist/boot/config-center.js +4 -2
- package/dist/boot/coordinators.d.ts +4 -4
- package/dist/boot/crash-last.d.ts +1 -1
- package/dist/boot/device-lane.d.ts +3 -3
- package/dist/boot/engine-lease.d.ts +4 -4
- package/dist/boot/governance-seams.d.ts +5 -5
- package/dist/boot/leader.d.ts +5 -5
- package/dist/boot/leader.js +2 -0
- package/dist/boot/limit-sync.d.ts +1 -1
- package/dist/boot/memory-boundary.d.ts +5 -5
- package/dist/boot/memory-consolidation.d.ts +8 -2
- package/dist/boot/memory-consolidation.js +1 -0
- package/dist/boot/org-memory.d.ts +5 -5
- package/dist/boot/parked-revive-gate.d.ts +6 -6
- package/dist/boot/permission-rules-audit.d.ts +2 -2
- package/dist/boot/reapers.d.ts +8 -8
- package/dist/boot/resolve-spec.d.ts +4 -4
- package/dist/boot/resolve-spec.js +1 -3
- package/dist/boot/retention-lane.d.ts +1 -1
- package/dist/boot/runner-deps.d.ts +53 -27
- package/dist/boot/runner-deps.js +16 -9
- package/dist/boot/runtime-caps.d.ts +4 -4
- package/dist/boot/session-faces.d.ts +1 -1
- package/dist/boot/shutdown.d.ts +10 -10
- package/dist/boot/shutdown.js +1 -1
- package/dist/boot/side-query-lane.d.ts +14 -14
- package/dist/boot/stores.js +5 -0
- package/dist/boot/task-list-lane.d.ts +3 -3
- package/dist/boot/webfetch-summarize-lane.d.ts +9 -9
- package/dist/boot/workflow-orchestration.d.ts +1 -1
- package/dist/bounded-session-map.d.ts +1 -1
- package/dist/brain.d.ts +3 -3
- package/dist/budget.d.ts +3 -3
- package/dist/canonical-json.d.ts +53 -0
- package/dist/canonical-json.js +48 -0
- package/dist/capabilities/center-prompts.d.ts +13 -13
- package/dist/capabilities/collab-workflows.d.ts +1 -1
- package/dist/capabilities/hands-lane.d.ts +4 -4
- package/dist/capabilities/memory-notice.d.ts +4 -4
- package/dist/capabilities/prompt.d.ts +2 -2
- package/dist/capabilities/sandbox-file-send.d.ts +2 -2
- package/dist/capabilities/scenarios.d.ts +16 -16
- package/dist/capabilities/skills.d.ts +1 -1
- package/dist/capabilities/team.d.ts +13 -12
- package/dist/capabilities/tool-defer.d.ts +6 -6
- package/dist/config-catalog.d.ts +139 -0
- package/dist/config-catalog.js +556 -0
- package/dist/config-center/apply-effective.d.ts +42 -30
- package/dist/config-center/apply-effective.js +69 -62
- package/dist/config-center/apply-ledger.d.ts +6 -6
- package/dist/config-center/effective-keys.d.ts +30 -0
- package/dist/config-center/effective-keys.js +49 -0
- package/dist/config-center/facade.d.ts +6 -5
- package/dist/config-center/facade.js +1 -1
- package/dist/config-center/hot-keys-registry.d.ts +2 -2
- package/dist/config-center/http-client.d.ts +5 -5
- package/dist/config-center/mcp-revocation.d.ts +6 -4
- package/dist/config-center/mcp-revocation.js +2 -12
- package/dist/config-center/restart-signal.d.ts +11 -1
- package/dist/config-center/restart-signal.js +4 -10
- package/dist/config-center/skills-mcp.d.ts +2 -2
- package/dist/config-center/stage-limits.d.ts +3 -3
- package/dist/config-center/types.d.ts +42 -59
- package/dist/config-invariants.d.ts +1 -1
- package/dist/config-lkg.js +7 -1
- package/dist/config-provider.d.ts +2 -2
- package/dist/config-provider.js +1 -1
- package/dist/config-types.d.ts +140 -132
- package/dist/config.d.ts +22 -22
- package/dist/config.js +2 -1
- package/dist/degenerate-instrument.d.ts +1 -1
- package/dist/deployment-governance.d.ts +13 -13
- package/dist/device-enrollment.d.ts +5 -3
- package/dist/device-store.d.ts +17 -3
- package/dist/device-store.js +2 -0
- package/dist/device-ws-hub.d.ts +10 -5
- package/dist/device-ws-hub.js +25 -5
- package/dist/device-ws-protocol.d.ts +3 -3
- package/dist/digest-form.d.ts +1 -1
- package/dist/elicitation.d.ts +1 -1
- package/dist/env-facts.d.ts +7 -7
- package/dist/execution-lane-caps.d.ts +5 -5
- package/dist/fleet/fleet-bus.d.ts +53 -53
- package/dist/fleet/fleet-reconciler.d.ts +2 -2
- package/dist/fleet/fleet-terminal-window.d.ts +1 -1
- package/dist/fleet/subagent-tail-bus.d.ts +3 -3
- package/dist/fleet-client.d.ts +3 -3
- package/dist/fleet-lease.d.ts +1 -1
- package/dist/hooks/branch-transcript.d.ts +2 -2
- package/dist/hooks/cc-agent-hook-prompt.d.ts +2 -2
- package/dist/hooks/cc-stop-prompt.d.ts +2 -2
- package/dist/hooks/hook-llm.d.ts +1 -1
- package/dist/hooks/hook-runner.d.ts +5 -5
- package/dist/http/active-run-conflict.d.ts +31 -33
- package/dist/http/active-run-conflict.js +4 -2
- package/dist/http/route-ctx.d.ts +22 -22
- package/dist/http/routes/a2a-serve.d.ts +2 -2
- package/dist/http/routes/admin-config-refresh.d.ts +1 -1
- package/dist/http/routes/admin-drain.d.ts +4 -4
- package/dist/http/routes/admin-memory-optout.d.ts +5 -5
- package/dist/http/routes/adoption.d.ts +1 -1
- package/dist/http/routes/agents-roster.d.ts +1 -1
- package/dist/http/routes/approvals-assistant.d.ts +6 -6
- package/dist/http/routes/approvals-assistant.js +4 -1
- package/dist/http/routes/capabilities.d.ts +1 -1
- package/dist/http/routes/capabilities.js +1 -0
- package/dist/http/routes/config-catalog.d.ts +28 -0
- package/dist/http/routes/config-catalog.js +42 -0
- package/dist/http/routes/diagnostics.d.ts +2 -2
- package/dist/http/routes/fleet.d.ts +1 -1
- package/dist/http/routes/images.d.ts +1 -1
- package/dist/http/routes/leader.d.ts +1 -1
- package/dist/http/routes/memory-bundle.d.ts +4 -4
- package/dist/http/routes/memory-compliance.d.ts +7 -7
- package/dist/http/routes/memory-consolidation.d.ts +1 -1
- package/dist/http/routes/memory-origin.d.ts +9 -9
- package/dist/http/routes/memory-policy.d.ts +3 -3
- package/dist/http/routes/notify-wake.d.ts +1 -1
- package/dist/http/routes/observability.d.ts +1 -1
- package/dist/http/routes/retention-ops.d.ts +1 -1
- package/dist/http/routes/rules.d.ts +3 -3
- package/dist/http/routes/run-memory-capture.d.ts +1 -1
- package/dist/http/routes/runs.d.ts +3 -3
- package/dist/http/routes/runs.js +12 -17
- package/dist/http/routes/session-sync.d.ts +2 -2
- package/dist/http/routes/sessions-list.d.ts +1 -1
- package/dist/http/routes/sessions.d.ts +9 -1
- package/dist/http/routes/sessions.js +60 -0
- package/dist/http/routes/shared-memory.d.ts +1 -1
- package/dist/http/routes/side-query.d.ts +1 -1
- package/dist/http/routes/tasks.d.ts +1 -1
- package/dist/http/routes/trace-usage.d.ts +1 -1
- package/dist/http/routes/workflows.d.ts +1 -1
- package/dist/http/run-meta.d.ts +1 -1
- package/dist/http/send.d.ts +6 -6
- package/dist/http/server.d.ts +84 -67
- package/dist/http/server.js +39 -10
- package/dist/http/sse-lifecycle.d.ts +1 -1
- package/dist/http/sse-log.d.ts +6 -6
- package/dist/http/verify-rounds.d.ts +3 -3
- package/dist/http/wire-gate.d.ts +2 -2
- package/dist/http/wire-types.d.ts +57 -38
- package/dist/key-resolver.d.ts +1 -1
- package/dist/leader/diffout.d.ts +2 -2
- package/dist/leader/diffup.d.ts +1 -1
- package/dist/leader/endpoint.d.ts +1 -1
- package/dist/leader/fanout.d.ts +6 -6
- package/dist/leader/grader-env-factory.d.ts +1 -1
- package/dist/leader/leader.d.ts +12 -12
- package/dist/leader/merge.d.ts +3 -3
- package/dist/leader/planner.d.ts +5 -5
- package/dist/leader/repair-oracle.d.ts +1 -1
- package/dist/leader/wire.d.ts +21 -9
- package/dist/leader/wire.js +6 -5
- package/dist/lsp/manager.d.ts +2 -2
- package/dist/lsp/types.d.ts +1 -1
- package/dist/lsp/ws-transport.d.ts +2 -2
- package/dist/main.js +12 -2
- package/dist/mcp-content-origin.d.ts +1 -1
- package/dist/memory-bundle-engine.d.ts +5 -3
- package/dist/memory-bundle-engine.js +2 -2
- package/dist/memory-operator-faces.d.ts +41 -11
- package/dist/memory-operator-faces.js +12 -0
- package/dist/memory-origin-fence.d.ts +1 -1
- package/dist/memory-origin-fence.js +2 -13
- package/dist/memory-posture.d.ts +6 -6
- package/dist/memory-scope.d.ts +7 -7
- package/dist/model-select.d.ts +5 -5
- package/dist/observability/cost-quota.d.ts +6 -6
- package/dist/observability/cost-taxonomy.d.ts +2 -2
- package/dist/observability/fail-open.d.ts +17 -5
- package/dist/observability/fail-open.js +16 -4
- package/dist/observability/metrics.d.ts +1 -1
- package/dist/observability/prompt-manifest.d.ts +8 -8
- package/dist/observability/rate-limit.d.ts +2 -2
- package/dist/observability/secret-env-scrub.d.ts +1 -1
- package/dist/observability/tool-trace.d.ts +1 -1
- package/dist/orchestration/hardened-vm-runner.d.ts +6 -6
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +1 -1
- package/dist/orchestration/subagent-steer.d.ts +3 -3
- package/dist/orchestration/workflow-agent-steer.d.ts +1 -1
- package/dist/orchestration/workflow-completion-inbox.d.ts +6 -6
- package/dist/orchestration/workflow-notify-journal.d.ts +6 -6
- package/dist/parent-watch.d.ts +1 -1
- package/dist/parked-decide.d.ts +11 -11
- package/dist/plan-cache-probe.d.ts +1 -1
- package/dist/plugins/adoption-log-sql.d.ts +4 -4
- package/dist/plugins/approval-ask-store-memory.d.ts +1 -1
- package/dist/plugins/approval-ask-store-memory.js +12 -0
- package/dist/plugins/approval-ask-store-sql.d.ts +39 -17
- package/dist/plugins/approval-ask-store-sql.js +23 -6
- package/dist/plugins/approval-payload-fingerprint.d.ts +23 -0
- package/dist/plugins/approval-payload-fingerprint.js +23 -0
- package/dist/plugins/background-agent-store-sql.d.ts +8 -8
- package/dist/plugins/background-shell-support.d.ts +12 -12
- package/dist/plugins/blob-backend.d.ts +3 -3
- package/dist/plugins/breaker-state-sql.d.ts +3 -3
- package/dist/plugins/caching-session-store.d.ts +6 -6
- package/dist/plugins/checkpoint-store-sql.d.ts +162 -66
- package/dist/plugins/checkpoint-store-sql.js +76 -33
- package/dist/plugins/device-store-sql.d.ts +4 -3
- package/dist/plugins/e2b-orphan-reclaim.d.ts +3 -3
- package/dist/plugins/file-history-store-sql.d.ts +9 -8
- package/dist/plugins/file-run-store.d.ts +27 -27
- package/dist/plugins/fork-routing-session-store.d.ts +9 -9
- package/dist/plugins/image-bake-store-sql.d.ts +1 -1
- package/dist/plugins/image-index-sql.d.ts +2 -2
- package/dist/plugins/k8s-bg-scripts.d.ts +1 -1
- package/dist/plugins/k8s-exec-protocol.d.ts +1 -1
- package/dist/plugins/leader-run-store-sql.d.ts +1 -1
- package/dist/plugins/local-checkpoint-store.d.ts +26 -17
- package/dist/plugins/local-checkpoint-store.js +21 -11
- package/dist/plugins/local-session-store.d.ts +5 -5
- package/dist/plugins/mailbox-store-sql.d.ts +6 -6
- package/dist/plugins/memory-embedder-fingerprint.d.ts +2 -2
- package/dist/plugins/memory-engine-pg.d.ts +1 -1
- package/dist/plugins/memory-engine-tidb.d.ts +1 -1
- package/dist/plugins/memory-key-guards.d.ts +3 -3
- package/dist/plugins/memory-optout-grant-store-sql.d.ts +10 -10
- package/dist/plugins/memory-origin-law.d.ts +13 -13
- package/dist/plugins/memory-run-store.d.ts +12 -12
- package/dist/plugins/outcome-ledger-sql.d.ts +3 -3
- package/dist/plugins/permission-rule-store-file.d.ts +3 -3
- package/dist/plugins/permission-rule-store-sql.d.ts +38 -33
- package/dist/plugins/permission-rule-store-sql.js +7 -12
- package/dist/plugins/pg-cost-quota.d.ts +2 -2
- package/dist/plugins/pg-pool.d.ts +29 -2
- package/dist/plugins/pg-pool.js +50 -2
- package/dist/plugins/pg-query.d.ts +1 -1
- package/dist/plugins/pg-rate-limiter.d.ts +2 -2
- package/dist/plugins/pg-session-storage.d.ts +9 -9
- package/dist/plugins/remote-env-adb.d.ts +1 -1
- package/dist/plugins/remote-env-device.d.ts +6 -4
- package/dist/plugins/remote-env-device.js +4 -1
- package/dist/plugins/remote-env-e2b.d.ts +11 -11
- package/dist/plugins/remote-env-file-error.d.ts +2 -2
- package/dist/plugins/remote-env-host.d.ts +10 -10
- package/dist/plugins/remote-env-k8s.d.ts +7 -7
- package/dist/plugins/remote-env-local-docker.d.ts +1 -1
- package/dist/plugins/remote-env-ssh.d.ts +9 -9
- package/dist/plugins/remote-scratchpad.d.ts +1 -1
- package/dist/plugins/resume-anchor-store-sql.d.ts +1 -1
- package/dist/plugins/retention-lane-store-sql.d.ts +2 -2
- package/dist/plugins/retention-store-sql.d.ts +11 -11
- package/dist/plugins/roster-store-sql.d.ts +6 -8
- package/dist/plugins/run-store-sql.d.ts +12 -12
- package/dist/plugins/scheduler-support.d.ts +1 -1
- package/dist/plugins/send-user-file.d.ts +1 -1
- package/dist/plugins/session-capture-record-store-sql.d.ts +99 -0
- package/dist/plugins/session-capture-record-store-sql.js +110 -0
- package/dist/plugins/session-placement.d.ts +1 -1
- package/dist/plugins/session-policy-store-sql.d.ts +2 -2
- package/dist/plugins/session-store.d.ts +3 -3
- package/dist/plugins/shared-memory-store-sql.d.ts +5 -5
- package/dist/plugins/sql-driver.d.ts +7 -7
- package/dist/plugins/sql-errors.d.ts +2 -2
- package/dist/plugins/sql-escape.d.ts +1 -1
- package/dist/plugins/sql-row-helpers.d.ts +1 -1
- package/dist/plugins/store-backend.d.ts +32 -19
- package/dist/plugins/store-backend.js +5 -1
- package/dist/plugins/store-contracts.d.ts +9 -9
- package/dist/plugins/task-list-store-sql.d.ts +3 -3
- package/dist/plugins/tidb-cost-quota.d.ts +3 -3
- package/dist/plugins/tidb-pool.d.ts +13 -0
- package/dist/plugins/tidb-pool.js +9 -0
- package/dist/plugins/tidb-rate-limiter.d.ts +2 -2
- package/dist/plugins/tidb-session-storage.d.ts +2 -2
- package/dist/plugins/tidb-session-store.d.ts +11 -11
- package/dist/plugins/tool-result-store-sql.d.ts +8 -8
- package/dist/plugins/usage-window-store-sql.d.ts +3 -3
- package/dist/plugins/web-search.d.ts +7 -7
- package/dist/plugins/workflow-journal-store-sql.d.ts +6 -6
- package/dist/plugins/workflow-run-store-sql.d.ts +1 -1
- package/dist/plugins/write-behind-counter.d.ts +6 -6
- package/dist/principal-jwt.d.ts +2 -2
- package/dist/project-memory.d.ts +1 -1
- package/dist/prompts-domain-validate.d.ts +8 -8
- package/dist/question.d.ts +3 -3
- package/dist/resource-suspend.d.ts +4 -4
- package/dist/resource-window.d.ts +3 -3
- package/dist/router/route-orchestration.d.ts +1 -1
- package/dist/rules-consent.d.ts +48 -40
- package/dist/run-local.d.ts +5 -5
- package/dist/runs.d.ts +19 -19
- package/dist/runtime-caps-resolver.d.ts +6 -6
- package/dist/runtime-governance.d.ts +11 -7
- package/dist/runtime-governance.js +23 -1
- package/dist/security.d.ts +13 -13
- package/dist/session-leaf-bus.d.ts +1 -1
- package/dist/session-sync-content.d.ts +4 -4
- package/dist/session-sync-kernel.d.ts +2 -2
- package/dist/session-sync.d.ts +13 -13
- package/dist/session-titler.d.ts +1 -1
- package/dist/session-watch.d.ts +3 -3
- package/dist/shared-memory-scope-authorizer.d.ts +4 -4
- package/dist/sighup-idle.d.ts +1 -1
- package/dist/spec-fields.d.ts +20 -20
- package/dist/ssh-host-key.d.ts +5 -5
- package/dist/store-live-probe.d.ts +2 -2
- package/dist/task-cwd.d.ts +11 -11
- package/dist/task-mcp.d.ts +5 -5
- package/dist/task-settings.d.ts +35 -35
- package/dist/task-workflow.d.ts +3 -3
- package/dist/text-bidi.d.ts +1 -1
- package/dist/tool-approval.d.ts +186 -182
- package/dist/tool-approval.js +247 -120
- package/dist/trace/core-keyset-guard.d.ts +19 -5
- package/dist/trace/engine-notice-wire.d.ts +7 -7
- package/dist/trace/engine-notice-wire.js +2 -0
- package/dist/trace/injection-tier.d.ts +11 -21
- package/dist/trace/injection-tier.js +3 -4
- package/dist/trace/ledger-events.d.ts +3 -3
- package/dist/trace/ledger-sink.d.ts +7 -7
- package/dist/trace/project.d.ts +31 -30
- package/dist/trace/project.js +1 -0
- package/dist/turn-activity.d.ts +4 -4
- package/dist/usage-analytics.d.ts +1 -1
- package/dist/wall-clock-jump-guard.d.ts +3 -3
- package/package.json +6 -6
package/dist/leader/fanout.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* v2 MVP — leader fan-out composition layer (
|
|
2
|
+
* v2 MVP — leader fan-out composition layer ([ref] §3, V2-MVP-PLAN.md M1, core seam).
|
|
3
3
|
*
|
|
4
4
|
* Runs N sub-task workers in parallel over `runner.runTaskStream` sharing ONE AbortController, bounded by a
|
|
5
5
|
* Semaphore, with an overall deadline (no infinite wait — council#5), and a
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* snapshot — closing the late-registration race (council round-2). Returns a typed WorkerReport per worker (council#6 — the
|
|
8
8
|
* Coordinator needs a defined shape to route diffs in merge(b)).
|
|
9
9
|
*
|
|
10
|
-
* ── 重复 spawn 的去重由谁负责(
|
|
10
|
+
* ── 重复 spawn 的去重由谁负责([ref] 车4 件1,台账 P1-9③ 更正)────────────────────────────────────
|
|
11
11
|
* 这段头注**曾经**写着 fan-out 带一道「concurrency claim(run-store createRun unique-key CAS)」并称
|
|
12
12
|
* 「the rule-5 dual-session tax solved at worker scale」。亲读后裁定:那道 claim 全链路无人传,而且
|
|
13
13
|
* **由构造即无效** —— 它的 CAS 键是 `(workerId, sessionId)`,而 sessionId 是 `wire.ts` 每次现铸的
|
|
@@ -41,15 +41,15 @@ export interface WorkerReport {
|
|
|
41
41
|
error?: string;
|
|
42
42
|
/** The worker's TaskResult.stats (tokens/cost/turns) — for the value-campaign cost accounting. */
|
|
43
43
|
stats?: TaskResult["stats"];
|
|
44
|
-
/**
|
|
44
|
+
/** [ref] L3a module sub-gate: did this worker's module pass the per-module judge (after any repair)? */
|
|
45
45
|
moduleJudge?: "pass" | "fail";
|
|
46
46
|
/** Number of bounded repairs the module sub-gate spent on this worker (0 = passed first try). */
|
|
47
47
|
repairs?: number;
|
|
48
|
-
/**
|
|
48
|
+
/** [ref] Slice 6: the terminal checkpoint gate when a worker is still SUSPENDED (the leader auto-resumed
|
|
49
49
|
* it up to its bound but it didn't fully complete — e.g. the overall deadline hit or the slice cap). Present
|
|
50
50
|
* ⇒ resumable: the operator/leader can escalate (more budget) or accept the belt-diff partial progress. */
|
|
51
51
|
checkpointGate?: TaskResult["checkpointGate"];
|
|
52
|
-
/**
|
|
52
|
+
/** [ref] Slice 6: the worker's terminal `TaskResult.errorCode` (e.g. `limits.max_cost_exceeded` on an
|
|
53
53
|
* exhausted resume, `limits.max_turns_exceeded` — core 5.8.0 码名轴) — surfaced for /v1/leader observability. */
|
|
54
54
|
errorCode?: TaskResult["errorCode"];
|
|
55
55
|
/** LEADER-REPAIRLOOP-INTEGRATION §10.6 (THE push chokepoint): the `runRepairLoop` terminal a single-agent
|
|
@@ -95,7 +95,7 @@ export interface FanOutOptions {
|
|
|
95
95
|
* cancelled worker actually aborts (else the overall-timeout's `await work` can never unblock). Like the default
|
|
96
96
|
* path it need not catch — runOne maps a throw to failed/timeout. */
|
|
97
97
|
runWorker?: (st: FanOutSubtask, signal: AbortSignal) => Promise<WorkerReport>;
|
|
98
|
-
/** Replan-lite C4 (
|
|
98
|
+
/** Replan-lite C4 ([ref] §6): when a worker settles SUSPENDED, immediately cancelAll the rest — the
|
|
99
99
|
* suspended worker itself has already settled (its stream is deregistered), so the cancel sweep cannot
|
|
100
100
|
* touch its checkpoint/paused env (the destroy-exemption falls out of the registration lifecycle). */
|
|
101
101
|
cancelOnSuspend?: boolean;
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* built. v1 reuses the integration sandbox (R1) + re-seeds it (R2) instead. **There is no config key that turns
|
|
21
21
|
* such a factory on** — an earlier revision of this header named one and shipped a `throw`-only stub beside it,
|
|
22
22
|
* but no such key ever existed in `config.ts`, so an operator following that text set an env var that did
|
|
23
|
-
* nothing. Both the stub and the promise were removed (
|
|
23
|
+
* nothing. Both the stub and the promise were removed ([ref] 车4 件3 / staleness ledger P2-9); the auto-accept
|
|
24
24
|
* slice, when it happens, is a new design件 that lands its factory, its wiring and its knob in one batch.
|
|
25
25
|
*
|
|
26
26
|
* Everything here is additive + OFF by default: nothing in this file runs unless the Stage-2 seams call it behind
|
package/dist/leader/leader.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* v2 MVP M4 — the leader orchestrator (
|
|
2
|
+
* v2 MVP M4 — the leader orchestrator ([ref] §3, V2-MVP-PLAN.md). Composes the proven pieces into one
|
|
3
3
|
* callable API: Planner → fanOut (M1) → diff-out (M2) → merge(b) (M3) → Coordinator push.
|
|
4
4
|
*
|
|
5
|
-
* Worker-env model (
|
|
5
|
+
* Worker-env model ([ref] §8 F2(a)): preferred = FACTORY env (runner-owned lifecycle; durable suspend only
|
|
6
6
|
* yields a complete ownedEnv on this path) + diff-out via the worker's mandatory SELF-UPLOAD last step
|
|
7
7
|
* (`fetchDiff`, diffup.ts). Compat = the original static env the leader owns: provision up-front, pull each
|
|
8
8
|
* branch's diff OUT of the still-alive env (pullDiff), destroy every env in a `finally`.
|
|
@@ -16,7 +16,7 @@ import { type RunnerLike, type WorkerReport } from "./fanout.js";
|
|
|
16
16
|
import { type ExecStreamLike } from "./diffout.js";
|
|
17
17
|
import { type MergeDeps, type MergeResult } from "./merge.js";
|
|
18
18
|
import { type TaskSpec, type VerifyConfig, type CheckpointToken, type ToolSpec, type RepairTerminal, type OracleTier, type RepairResult } from "@sema-agent/core";
|
|
19
|
-
/**
|
|
19
|
+
/** [ref] Slice 6: drive a worker's resource-suspend auto-resume to a terminal (or bound) state. Exported
|
|
20
20
|
* for unit tests. Loops `resume(token, slice)` WHILE the result carries a `resource_limit` checkpoint gate —
|
|
21
21
|
* NOT by status (the verify wrapper may surface a suspend as failed-with-token). Exits on: a terminal result
|
|
22
22
|
* (completed/failed → no gate), an exhausted budget (core fails the resume fast → no token/gate), a
|
|
@@ -44,16 +44,16 @@ export interface ProvisionedWorker {
|
|
|
44
44
|
branch: string;
|
|
45
45
|
/** base commit of THIS worker's env (drives `git format-patch <baseSha>..<branch>` diff-out). */
|
|
46
46
|
baseSha: string;
|
|
47
|
-
/** runs the worker agent on this worker's env (static `executionEnv` or a factory —
|
|
47
|
+
/** runs the worker agent on this worker's env (static `executionEnv` or a factory — [ref] F2(a)). */
|
|
48
48
|
runner: RunnerLike;
|
|
49
49
|
/** Static-env mode (M2 compat): pull the worker's branch diff OUT of its (post-task, still-alive) env. */
|
|
50
50
|
diffEnv?: ExecStreamLike;
|
|
51
|
-
/** Factory-env mode (
|
|
51
|
+
/** Factory-env mode ([ref] F2(a), preferred when set): fetch the diff the worker SELF-UPLOADED as its
|
|
52
52
|
* mandatory last task step (presigned MinIO object) — the env is runner-owned and already gone. */
|
|
53
53
|
fetchDiff?: () => Promise<import("./diffout.js").PullDiffResult>;
|
|
54
54
|
/** Static-env mode only: the leader owns + destroys the env. Factory envs omit this — the runner's factory
|
|
55
55
|
* lifecycle destroys them, and a SUSPENDED worker's paused env is thereby exempt from the leader's reap
|
|
56
|
-
* (
|
|
56
|
+
* ([ref] row4/C4: destroying a suspended worker's env = expiring its resume token). */
|
|
57
57
|
destroy?: () => Promise<void>;
|
|
58
58
|
spec: Omit<TaskSpec, "sessionId" | "signal">;
|
|
59
59
|
/** Optional read-effect PROBE tools for the L3 verifier (verifyWorker path). The default verifierTools = the
|
|
@@ -71,7 +71,7 @@ export interface LeaderDeps {
|
|
|
71
71
|
push: MergeDeps["push"];
|
|
72
72
|
/** Integration test command (the merge gate) + repo dir inside the sandbox. */
|
|
73
73
|
testCmd: string;
|
|
74
|
-
/** Optional truecorrect MEASURE (
|
|
74
|
+
/** Optional truecorrect MEASURE ([ref]): a thorough hidden-oracle command run IN the integration sandbox
|
|
75
75
|
* after the gate passes (NOT a gate) — offloads the measure from the control plane. Result in result.merge.measure. */
|
|
76
76
|
measureCmd?: string;
|
|
77
77
|
repoDir?: string;
|
|
@@ -80,7 +80,7 @@ export interface LeaderDeps {
|
|
|
80
80
|
/** fan-out deadline + concurrency cap. */
|
|
81
81
|
timeoutMs: number;
|
|
82
82
|
maxConcurrency: number;
|
|
83
|
-
/**
|
|
83
|
+
/** [ref] L3a — optional per-module sub-gate + bounded repair, run AFTER fan-out, BEFORE merge. For each
|
|
84
84
|
* completed worker: judge its module (diff) vs its sub-objective; on fail, re-run that ONE worker with the
|
|
85
85
|
* judge's feedback (bounded by maxRepairs, default 1) on its own still-alive env, then re-judge. A module that
|
|
86
86
|
* still fails is marked `failed` (merge quarantines it). Catches per-module escapes the end-integration test
|
|
@@ -93,12 +93,12 @@ export interface LeaderDeps {
|
|
|
93
93
|
repairObjective: (sub: SubtaskSpec, reason: string) => string;
|
|
94
94
|
maxRepairs?: number;
|
|
95
95
|
};
|
|
96
|
-
/** core 1.72 native L3a (
|
|
96
|
+
/** core 1.72 native L3a ([ref] §4): when set, each worker runs via `runWithVerification` (run the module +
|
|
97
97
|
* an INDEPENDENT DECORRELATED verifier tries to break it reading the diff/workspace + a bounded fix-loop)
|
|
98
98
|
* instead of plain fan-out. The worker runner's `models` catalog MUST carry the heterogeneous `verifierModel`
|
|
99
99
|
* (decorrelation = deployment contract). Mutually exclusive with `moduleGate` (this IS the native version). */
|
|
100
100
|
verifyWorker?: VerifyConfig;
|
|
101
|
-
/** Replan-lite (
|
|
101
|
+
/** Replan-lite ([ref] §6): bounded, DETERMINISTIC reactions — no runtime DAG surgery. When set:
|
|
102
102
|
* worker failed → redispatch ×1 on a FRESH env (clean base; a crashed worker's half-written workspace is
|
|
103
103
|
* never reused) → still failed = collapse-remainder-to-single; verify FAIL (repair already bounded inside
|
|
104
104
|
* the verify loop) → collapse; structural merge conflict → collapse + record; budgetUsd exceeded → stop
|
|
@@ -151,7 +151,7 @@ export interface LeaderResult {
|
|
|
151
151
|
route?: "single" | "fanout";
|
|
152
152
|
/** Set when planning/provisioning failed before fan-out. */
|
|
153
153
|
error?: string;
|
|
154
|
-
/** Replan-lite (
|
|
154
|
+
/** Replan-lite ([ref] §6): which trigger won arbitration + what was done. */
|
|
155
155
|
replan?: {
|
|
156
156
|
trigger: "suspended" | "budget" | "merge-conflict" | "verify-fail" | "worker-failed";
|
|
157
157
|
redispatched?: string[];
|
|
@@ -163,7 +163,7 @@ export interface LeaderResult {
|
|
|
163
163
|
workerId: string;
|
|
164
164
|
sessionId: string;
|
|
165
165
|
}>;
|
|
166
|
-
/**
|
|
166
|
+
/** [ref] Slice 6 / task#16: the diff (uncommitted work auto-committed by the belt, then diff-out) of
|
|
167
167
|
* workers that did NOT merge (failed / still-suspended). Their progress is otherwise lost — the merge only
|
|
168
168
|
* integrates COMPLETED workers — so surface it here for review/cherry-pick instead of silently dropping it
|
|
169
169
|
* (the migration-run loss: a network-failed worker's 4 commits vanished). Best-effort + non-empty only. */
|
package/dist/leader/merge.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* v2 MVP M3 — merge(b), the hard bone (
|
|
2
|
+
* v2 MVP M3 — merge(b), the hard bone ([ref] §7, V2-MVP-PLAN.md, search [25]/[26], council round-1).
|
|
3
3
|
*
|
|
4
4
|
* The deterministic Coordinator integrates N completed workers' branches under FULL isolation:
|
|
5
5
|
* 1. pull each worker's patch OUT of its container (M2 `pullDiff` — no creds go in).
|
|
@@ -65,7 +65,7 @@ export interface IntegrationRepair {
|
|
|
65
65
|
* then VERIFIES no marker/.rej remains before continuing, and the downstream test gate still guards correctness.
|
|
66
66
|
* Wired by the caller (provisionIntegrationSandbox); when unset, an apply conflict stays terminal exactly as before
|
|
67
67
|
* (zero behaviour change). Reuses the IntegrationRepair sandbox + hands pattern → no new core/env seam (the seam
|
|
68
|
-
*
|
|
68
|
+
* [ref] §8 feared for "adopting N half-done workspaces" is unnecessary for the conflict case).
|
|
69
69
|
*/
|
|
70
70
|
export interface ConflictResolver {
|
|
71
71
|
/** Max resolution attempts before giving up (each = one agent run + one marker/.rej re-check). */
|
|
@@ -112,7 +112,7 @@ export interface MergeDeps {
|
|
|
112
112
|
repoDir?: string;
|
|
113
113
|
/** Full test command run in the sandbox (the merge gate). */
|
|
114
114
|
testCmd: string;
|
|
115
|
-
/** Optional truecorrect MEASURE (
|
|
115
|
+
/** Optional truecorrect MEASURE ([ref]): a thorough hidden-oracle command run IN the integration sandbox
|
|
116
116
|
* (E2B) right after the gate passes — offloads the measure from the CPU-contended control plane (the
|
|
117
117
|
* frontier-multi oracle-timeout fix). NOT a gate (does not affect `ok`); the result lands in MergeResult.measure
|
|
118
118
|
* for the caller to read as the objective truly-correct signal. Same place + env as the gate, just a thornier test. */
|
package/dist/leader/planner.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* v2 MVP — LLM Planner (
|
|
2
|
+
* v2 MVP — LLM Planner ([ref] §3: leader = LLM-planner that splits a DAG + deterministic Coordinator).
|
|
3
3
|
* Decomposes an objective into N **disjoint-file** sub-tasks via one model completion, then VALIDATES the plan
|
|
4
4
|
* deterministically (the trust boundary: an LLM proposes, the Coordinator enforces — service[19] leaderless-
|
|
5
5
|
* leader). Disjoint file-ownership is the invariant that lets workers run in parallel + merge without conflict.
|
|
@@ -14,17 +14,17 @@ export interface PlanOptions {
|
|
|
14
14
|
maxSubtasks?: number;
|
|
15
15
|
/** Extra repo/context guidance appended to the prompt (e.g. file layout, conventions). */
|
|
16
16
|
context?: string;
|
|
17
|
-
/** Deployment knob (
|
|
17
|
+
/** Deployment knob ([ref] §11 A6, correctness-first): `false` = never fan out — `routePlan` skips the
|
|
18
18
|
* router model call entirely and returns the deterministic single route (zero routing cost, zero risk of a
|
|
19
19
|
* false fan-out). Default (undefined/true) = the router decides. */
|
|
20
20
|
fanoutEnabled?: boolean;
|
|
21
|
-
/** Economic guard threshold (
|
|
21
|
+
/** Economic guard threshold ([ref] §7, search[83] ruling): an objective SHORTER than this never reaches
|
|
22
22
|
* the router — deterministic single (a small task can't be economically decomposable; false-single is the
|
|
23
23
|
* cheap error side). Default 64 — deliberately below the route corpus's smallest fan-out case. */
|
|
24
24
|
minFanoutChars?: number;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
* Deterministic economic 防灾 guard (
|
|
27
|
+
* Deterministic economic 防灾 guard ([ref] §7 / §11 D2, search [83] ruling (b)): the asymmetry is that a
|
|
28
28
|
* false fan-out is the -98% disaster while a false single merely runs slower — so every case decidable WITHOUT
|
|
29
29
|
* the model resolves to single, for free. Pure function (unit-testable); the semantic judgments (sequential/
|
|
30
30
|
* coupled/uncertain) stay with the router LLM, and "估不准回 single" is the collapse fallback (B3).
|
|
@@ -65,7 +65,7 @@ export declare function routePrompt(objective: string, opts?: PlanOptions): stri
|
|
|
65
65
|
* validated by `parsePlan` (the same disjointness/shape invariants the Coordinator depends on). */
|
|
66
66
|
export declare function routePlan(objective: string, runRoute: (prompt: string) => Promise<string>, opts?: PlanOptions): Promise<SubtaskSpec[]>;
|
|
67
67
|
/**
|
|
68
|
-
* Decomposer quality gate (
|
|
68
|
+
* Decomposer quality gate ([ref] §5/§11 B1-B3): run the router, and on a rejected/unparseable plan retry
|
|
69
69
|
* the LLM AT MOST ONCE, then COLLAPSE TO SINGLE (never fail the task on a bad plan — single is almost always
|
|
70
70
|
* the right fallback, and a false fan-out is the -98% disaster; a plan failure must not be louder than that).
|
|
71
71
|
* `collapsed` carries the reason (observability: a collapse is a router-quality signal, not silent).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The PROFILE-injected `RepairOracle` closure for the leader's single-agent self-repair loop
|
|
3
|
-
* (`runRepairLoop`, core
|
|
3
|
+
* (`runRepairLoop`, core [ref] / D1). See `sema-internal server/docs/LEADER-REPAIRLOOP-INTEGRATION.md` (§3.1 + the authoritative
|
|
4
4
|
* §10 corrected layer). The closure GRADES a worker's candidate in an ISOLATED grader env (the reused
|
|
5
5
|
* integration sandbox, distinct from the worker env) and maps the result to a core `OracleResult`. core only
|
|
6
6
|
* fixes the `OracleResult` shape + the read-only/identity contract; the composition lives HERE so the core type
|
package/dist/leader/wire.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { type Brain, type Model, type ModelRoles, type ModelPricing, type TaskSpec, type ExecutionEnvFactory, type RemoteExecutionEnv, type ToolResultStore, type SessionStore, type RunnerDeps } from "@sema-agent/core";
|
|
2
2
|
import type { CheckpointStoreFull } from "../plugins/store-backend.js";
|
|
3
3
|
import { type LeaderDeps, type LeaderResult } from "./leader.js";
|
|
4
|
+
import { type DeploymentPostureSeats } from "../boot/runner-deps.js";
|
|
4
5
|
import type { LeaderRequestBody } from "./endpoint.js";
|
|
5
6
|
export interface LeaderWireConfig {
|
|
6
7
|
/** Static-env compat mode (E2B only): the leader provisions/owns each env. Required when `envFactory` unset. */
|
|
7
8
|
e2bApiKey?: string;
|
|
8
|
-
/**
|
|
9
|
+
/** [ref] F2(a) + k8s lane: the per-task execution-env factory the service main already built for
|
|
9
10
|
* REMOTE_EXEC (e2b or k8s/Kata) — workers and the integration sandbox run on envs from THIS factory.
|
|
10
11
|
* Requires `s3` (diff-out is the worker's self-upload; there is no leader-held env to pull from). */
|
|
11
12
|
envFactory?: ExecutionEnvFactory;
|
|
12
|
-
/** Durable suspend/resume for SUB-WORKERS (
|
|
13
|
+
/** Durable suspend/resume for SUB-WORKERS ([ref] C4): when set, each worker task carries the durable
|
|
13
14
|
* question/ask policy + checkpoint store, so a gated ask/AskUserQuestion SUSPENDS the worker (checkpoint +
|
|
14
15
|
* paused env) instead of failing — the trigger replan-lite C4 arbitrates on. Mirrors main.ts's per-task
|
|
15
16
|
* durable wiring; ctx is seeded at provision so the surfaced token is resumable on the single-agent path. */
|
|
@@ -31,11 +32,22 @@ export interface LeaderWireConfig {
|
|
|
31
32
|
* the resume dies with SessionError "Entry <leafId> not found" (found live: drill c3 deny path). */
|
|
32
33
|
sessionStore?: SessionStore;
|
|
33
34
|
/**
|
|
34
|
-
*
|
|
35
|
+
* [ref] 件B/C/D([ref],codex R2-F1)—— 部署治理三座席,**原样递给本车道的每一只 Runner**。
|
|
35
36
|
* 主车道的 `boot/governance-seams.ts` 是唯一属主(判据、拒启、解析全在那里),本字段只是把它的产物
|
|
36
37
|
* 搬过来:一个进程里「这台部署禁哪些能力、锁了哪些键」只能有一个答案。缺席 = 与接线前逐字相同。
|
|
37
38
|
*/
|
|
38
39
|
governance?: Pick<RunnerDeps, "compliancePostureResolver" | "lockedConfig" | "retentionPolicy">;
|
|
40
|
+
/**
|
|
41
|
+
* [ref](黑板 [ref])—— **部署姿态座席族**(readFace 四席 `readFace`/`readDenyPatterns`/`readDenyBuiltinTiers`/
|
|
42
|
+
* `readDenyBuiltinExclude` + `memoryDelegationEvidence`/`memoryProvenance`/`memoryCapturePolicy`/
|
|
43
|
+
* `delegationEntryCaps`),**原样递给本车道的每一只 Runner**。唯一属主 = `boot/runner-deps.ts` 的
|
|
44
|
+
* `buildDeploymentPostureSeats(config)`(主 runner / subRunner / run-local 的共享基座展开的就是它),
|
|
45
|
+
* `boot/leader.ts` 把**同一函数、同一 config** 的产物搬过来:一个进程里「这台部署的 READ 面 / 记忆姿态 /
|
|
46
|
+
* 委派 caps」只能有一个答案。缺席 = 展开空对象 = 五处字面量键缺席(与接线前逐字相同)。
|
|
47
|
+
* 修前(≤7.53)这五只 Runner 一席都没有:运维写的 READ_DENY_PATTERNS / MEMORY_DELEGATION_EVIDENCE 等对
|
|
48
|
+
* leader 编排的 planner / worker / repair / conflict 四类任务**静默不生效**(core 内建 deny 表仍在)。
|
|
49
|
+
*/
|
|
50
|
+
deploymentPosture?: DeploymentPostureSeats;
|
|
39
51
|
/** Worker model brain + catalog (the same the service runs tasks on). */
|
|
40
52
|
brain: Brain;
|
|
41
53
|
models: Record<string, Model>;
|
|
@@ -48,7 +60,7 @@ export interface LeaderWireConfig {
|
|
|
48
60
|
name: string;
|
|
49
61
|
email: string;
|
|
50
62
|
};
|
|
51
|
-
/**
|
|
63
|
+
/** [ref] A6 knob: false = router never fans out (deterministic single route, zero router cost). */
|
|
52
64
|
fanoutEnabled?: boolean;
|
|
53
65
|
/** The model (a catalog name) the ROUTER/planner call runs on. The route is a trivial single-vs-fanout
|
|
54
66
|
* classification; running it on a heavy reasoning model (deepseek-v4-pro + reasoning) returns an EMPTY
|
|
@@ -65,7 +77,7 @@ export interface LeaderWireConfig {
|
|
|
65
77
|
* Env override: LEADER_CONFLICT_ROUNDS. Resolves the conflict in-place + keeps the other workers' work, instead
|
|
66
78
|
* of discarding all fan-out output and redoing single. Runs the strong (default) model with hands in the sandbox. */
|
|
67
79
|
conflictRounds?: number;
|
|
68
|
-
/**
|
|
80
|
+
/** [ref] §8 F2(a): when set, workers run on FACTORY envs (runner-owned lifecycle — the durable-suspend-
|
|
69
81
|
* complete path; a suspended worker's paused env is exempt from the leader reap by construction) and diff-out
|
|
70
82
|
* is the worker's mandatory self-upload to this MinIO/S3 store (presigned per worker; creds adapter-held).
|
|
71
83
|
* Unset = the original leader-owned static-env mode (pullDiff compat). */
|
|
@@ -85,11 +97,11 @@ export interface LeaderWireConfig {
|
|
|
85
97
|
/** The env surface wire needs (both the E2B and k8s adapters implement core's RemoteExecutionEnv). */
|
|
86
98
|
type WireEnv = Pick<RemoteExecutionEnv, "exec" | "writeFile">;
|
|
87
99
|
/**
|
|
88
|
-
* Resume-safe worker staging (the
|
|
100
|
+
* Resume-safe worker staging (the [ref] F2(a) factory-env path). Runs adapter-side before the agent's
|
|
89
101
|
* first workspace-touching call: seed the base repo at the worker branch + plant the upload script (so the
|
|
90
102
|
* presigned URL never passes through the model).
|
|
91
103
|
*
|
|
92
|
-
* 🔴 BL-1 fix (
|
|
104
|
+
* 🔴 BL-1 fix ([ref] Slice 6): on a RESOURCE-SUSPEND RESUME core re-invokes the `executionEnvFactory`,
|
|
93
105
|
* producing a FRESH `withStaging` wrapper (`staged=undefined`) whose `stage()` runs AGAIN — AFTER core's
|
|
94
106
|
* `resumeVM()` has already untar'd the snapshot onto the fresh pod (`resumeVM` is not a STAGED_METHOD, so it
|
|
95
107
|
* is NOT intercepted by the staging proxy; the agent's first `exec` is what triggers `stage()`, lazily, and
|
|
@@ -134,7 +146,7 @@ export declare function leaderResourceConfig(env?: NodeJS.ProcessEnv): {
|
|
|
134
146
|
workerBudgetUsd: number;
|
|
135
147
|
workerLimits: Partial<TaskSpec>;
|
|
136
148
|
presignTtlSec: number;
|
|
137
|
-
/**
|
|
149
|
+
/** [ref] Slice 6: opt-in (LEADER_RESOURCE_SUSPEND=true) resource-slice suspend for workers. When set, a
|
|
138
150
|
* worker SUSPENDS at the per-slice window (`sliceMaxCostUsd`) instead of failing at the budget, and the
|
|
139
151
|
* leader auto-resumes (resumeWithVerification) until the TOTAL (`totalBudgetUsd` = workerBudgetUsd) is spent
|
|
140
152
|
* — a budget overrun becomes a resumable pause, not a worker failure. ⚠️ 语义更新(core 5.11.0 B3,
|
|
@@ -160,7 +172,7 @@ export interface LeaderLoopConfig {
|
|
|
160
172
|
measureGatesOn: boolean;
|
|
161
173
|
repairLoopAttempts: number;
|
|
162
174
|
oracleFlakyK: number;
|
|
163
|
-
/** replan-lite (
|
|
175
|
+
/** replan-lite ([ref] §6) fan-out spend cap from LEADER_BUDGET_USD. Absent = replan-lite's own default
|
|
164
176
|
* (unset env stays absent — existing contract untouched; see leaderLoopConfig doc below). */
|
|
165
177
|
replanBudgetUsd?: number;
|
|
166
178
|
}
|
package/dist/leader/wire.js
CHANGED
|
@@ -129,6 +129,7 @@ export function createLeaderRunner(cfg) {
|
|
|
129
129
|
const { repairRounds, repairBudgetUsd, conflictRounds, repairLoopOn, measureGatesOn, repairLoopAttempts, oracleFlakyK, replanBudgetUsd, } = leaderLoopConfig({ repairRounds: cfg.repairRounds, conflictRounds: cfg.conflictRounds });
|
|
130
130
|
const onNoticeSeat = createEngineNoticeSeat(cfg.logger);
|
|
131
131
|
const governanceSeat = cfg.governance ?? {};
|
|
132
|
+
const deploymentPostureSeat = cfg.deploymentPosture ?? {};
|
|
132
133
|
const mkRepair = (rawEnv, repoDir, oracleFiles) => {
|
|
133
134
|
if (repairRounds <= 0)
|
|
134
135
|
return undefined;
|
|
@@ -142,7 +143,7 @@ export function createLeaderRunner(cfg) {
|
|
|
142
143
|
throw new Error(`oracle still present after remove (${f.path}) — refusing repair (measurement integrity)`);
|
|
143
144
|
}
|
|
144
145
|
try {
|
|
145
|
-
const runner = new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, executionEnv: rawEnv, rootPath: repoDir });
|
|
146
|
+
const runner = new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat, executionEnv: rawEnv, rootPath: repoDir });
|
|
146
147
|
const objective = [
|
|
147
148
|
`The integrated project at ${repoDir} fails its build/test. Make the MINIMAL change to the working tree so this command exits 0 (cd into the repo and run it yourself to confirm):`,
|
|
148
149
|
` ${testCmd}`,
|
|
@@ -185,7 +186,7 @@ export function createLeaderRunner(cfg) {
|
|
|
185
186
|
throw new Error(`oracle still present after remove (${f.path}) — refusing conflict-resolve (measurement integrity)`);
|
|
186
187
|
}
|
|
187
188
|
try {
|
|
188
|
-
const runner = new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, executionEnv: rawEnv, rootPath: repoDir });
|
|
189
|
+
const runner = new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat, executionEnv: rawEnv, rootPath: repoDir });
|
|
189
190
|
const objective = [
|
|
190
191
|
`A parallel worker '${workerId}' ported a module on its own branch, but applying its patch onto the already-integrated tree at ${repoDir} produced a MERGE CONFLICT (git apply --3way). The OTHER workers' patches already applied cleanly — integrate THIS worker's changes too, resolving the overlap.`,
|
|
191
192
|
`Resolve EVERY conflict in the working tree: open each file containing conflict markers (<<<<<<< / ======= / >>>>>>>) and merge BOTH sides' real intent (keep both workers' behaviour — never drop one side just to make it apply). Then apply any rejected hunks recorded in *.rej files by hand, and DELETE every *.rej and *.orig file.`,
|
|
@@ -248,7 +249,7 @@ export function createLeaderRunner(cfg) {
|
|
|
248
249
|
if (Array.isArray(body.subtasks) && body.subtasks.length > 0) {
|
|
249
250
|
return validateSubtasks(body.subtasks);
|
|
250
251
|
}
|
|
251
|
-
const planRunner = new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat });
|
|
252
|
+
const planRunner = new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat });
|
|
252
253
|
const runRoute = async (prompt) => {
|
|
253
254
|
const res = await planRunner.runTaskStream({
|
|
254
255
|
objective: prompt,
|
|
@@ -338,7 +339,7 @@ export function createLeaderRunner(cfg) {
|
|
|
338
339
|
workerId: sub.workerId, sessionId, branch: sub.branch,
|
|
339
340
|
baseSha,
|
|
340
341
|
runner: keepCtxWarm(new Runner({
|
|
341
|
-
brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat,
|
|
342
|
+
brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat,
|
|
342
343
|
...(cfg.toolResultStore ? { toolResultStore: cfg.toolResultStore } : {}),
|
|
343
344
|
...(cfg.sessionStore ? { sessionStore: cfg.sessionStore } : {}),
|
|
344
345
|
executionEnvFactory: (ctx) => withStaging(envFactory(ctx), stage, async (e) => {
|
|
@@ -358,7 +359,7 @@ export function createLeaderRunner(cfg) {
|
|
|
358
359
|
const baseSha = await sh(env)(`cd ${repo} && git rev-parse HEAD`);
|
|
359
360
|
return {
|
|
360
361
|
workerId: sub.workerId, sessionId, branch: sub.branch, baseSha,
|
|
361
|
-
runner: keepCtxWarm(new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...(cfg.toolResultStore ? { toolResultStore: cfg.toolResultStore } : {}), ...(cfg.sessionStore ? { sessionStore: cfg.sessionStore } : {}), executionEnv: env })),
|
|
362
|
+
runner: keepCtxWarm(new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat, ...(cfg.toolResultStore ? { toolResultStore: cfg.toolResultStore } : {}), ...(cfg.sessionStore ? { sessionStore: cfg.sessionStore } : {}), executionEnv: env })),
|
|
362
363
|
diffEnv: env,
|
|
363
364
|
destroy: () => env.destroy().then(() => { }),
|
|
364
365
|
spec: { ...workerLimits, ...sub.spec, ...durableSpec, ...resourceSpec },
|
package/dist/lsp/manager.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export interface E2bLspManagerOptions {
|
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
70
|
* §DESIGN-V2 F1/F8/F9 —— 本文件曾**手抄**一份 core 的 `settleOnAbort`(注释自陈 core「un-exported」,并写下
|
|
71
|
-
* 「一旦 core 导出即 find-and-delete」的计划)。
|
|
71
|
+
* 「一旦 core 导出即 find-and-delete」的计划)。[ref]([ref])执行了那句话:core 现已从包根导出它
|
|
72
72
|
* (`index.d.ts:27`,来自 `core/lsp.js`),手抄件遂删除,本文件的两处调用直接消费 core 的实现。
|
|
73
73
|
*
|
|
74
74
|
* 它的语义(读点在 `open` 的两处调用):给**这一个**调用方一个自己的 settle —— 调用方的 `signal` 让它拿到
|
|
@@ -86,7 +86,7 @@ export declare class E2bLspManager implements LspServerManager {
|
|
|
86
86
|
private readonly log;
|
|
87
87
|
private readonly hasServerCommand;
|
|
88
88
|
private readonly metrics;
|
|
89
|
-
/**
|
|
89
|
+
/** [ref] (core 1.220, board [S] ①): the workspace diagnostics registry — WORKSPACE-scoped (survives
|
|
90
90
|
* heal/evict; diagnostics belong to files, not servers), drained by the Runner at turn boundaries. Every
|
|
91
91
|
* session feeds it from `textDocument/publishDiagnostics` (the WS transport now dispatches notifications).
|
|
92
92
|
* ⚠️ ONE registry across sandboxes on this manager instance (it is per-deployment) — same posture as
|
package/dist/lsp/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* LSP sidecar — service-side types (
|
|
2
|
+
* LSP sidecar — service-side types ([ref] §13.1). core 1.82+ ships `createLspTool(manager)`
|
|
3
3
|
* + the `LspServerManager`/`LspSession`/`LspResult` SEAM (`@sema-agent/core`); the runner mounts the tool
|
|
4
4
|
* when OUR manager is wired via `RunnerDeps.lspManager`. We re-export core's seam types — SINGLE SOURCE OF TRUTH,
|
|
5
5
|
* incl. the injectable `LspTransport` (the WS-bridge connection to the language server inside E2B) + `LspReadText`.
|
|
@@ -17,7 +17,7 @@ export declare class WsLspTransport implements LspTransport {
|
|
|
17
17
|
private isClosed;
|
|
18
18
|
private keepalive;
|
|
19
19
|
private awaitingPong;
|
|
20
|
-
/**
|
|
20
|
+
/** [ref]: server→client NOTIFICATION subscribers (publishDiagnostics etc.). */
|
|
21
21
|
private readonly notificationHandlers;
|
|
22
22
|
constructor(ws: WsLike, requestTimeoutMs?: number, keepaliveMs?: number);
|
|
23
23
|
/** Manager-visible liveness (LspTransport.closed): evict + reopen instead of reusing a dead connection. */
|
|
@@ -26,7 +26,7 @@ export declare class WsLspTransport implements LspTransport {
|
|
|
26
26
|
private failAll;
|
|
27
27
|
request(method: string, params: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
28
28
|
notify(method: string, params: unknown): void;
|
|
29
|
-
/**
|
|
29
|
+
/** [ref] (core 1.220): subscribe to server→client notifications; returns unsubscribe. Additive —
|
|
30
30
|
* core's diagnostics registry is the intended consumer; with no subscriber, behavior is byte-identical. */
|
|
31
31
|
onNotification(handler: (method: string, params: unknown) => void): () => void;
|
|
32
32
|
close(): Promise<void>;
|
package/dist/main.js
CHANGED
|
@@ -32,7 +32,7 @@ import { createHttpServer, explicitOperatorOk, hasServiceAuth } from "./http/ser
|
|
|
32
32
|
import { exportMemoryScope } from "./memory-export.js";
|
|
33
33
|
import { workflowModelAllowlistFor } from "./task-workflow.js";
|
|
34
34
|
import { createMemoryBundleFaces } from "./memory-bundle-engine.js";
|
|
35
|
-
import { backendOwnsControlPlane, createMemoryComplianceFaces, createMemoryOriginFaces } from "./memory-operator-faces.js";
|
|
35
|
+
import { backendOwnsControlPlane, createMemoryComplianceFaces, createMemoryOriginFaces, createSessionMemoryStatusFace } from "./memory-operator-faces.js";
|
|
36
36
|
import { performMemorySync } from "./memory-sync.js";
|
|
37
37
|
import { startOtlpExporter } from "./observability/otel-exporter.js";
|
|
38
38
|
import { HEARTBEAT_MS, backgroundAgentOutput, taskHandleOutput, taskHandleStop } from "./runs.js";
|
|
@@ -120,17 +120,23 @@ async function main() {
|
|
|
120
120
|
await configCenter.applyLocalRemoteExec();
|
|
121
121
|
const { backend, storeBackendDegraded, memoryEngine, memorySyncCursors, rosterStore, backgroundAgentStore, taskAttachmentStore, mailboxStore, memoryExportBackend, memorySyncRunner, sessionStore, breakerState, usageWindowStore, memoryPosture, taskListLane, } = await openStores({ config, logger, metrics, localRoot });
|
|
122
122
|
const instanceId = uuidv7();
|
|
123
|
-
const
|
|
123
|
+
const sessionCaptureRecordStore = backend?.sessionCaptureRecords();
|
|
124
|
+
const memoryBundleFaces = memoryEngine ? createMemoryBundleFaces(memoryEngine, { ...(sessionCaptureRecordStore !== undefined ? { captureRecordStore: sessionCaptureRecordStore } : {}) }) : undefined;
|
|
124
125
|
const memoryComplianceFaces = memoryEngine
|
|
125
126
|
? createMemoryComplianceFaces(memoryEngine, {
|
|
126
127
|
onIncident: (err) => logger.warn("memory_compliance_incident", { code: err.code ?? null, detail: err.message }),
|
|
128
|
+
...(sessionCaptureRecordStore !== undefined ? { captureRecordStore: sessionCaptureRecordStore } : {}),
|
|
127
129
|
})
|
|
128
130
|
: undefined;
|
|
129
131
|
const memoryOriginFaces = memoryEngine
|
|
130
132
|
? createMemoryOriginFaces(memoryEngine, {
|
|
131
133
|
onIncident: (err) => logger.warn("memory_origin_incident", { code: err.code ?? null, detail: err.message }),
|
|
134
|
+
...(sessionCaptureRecordStore !== undefined ? { captureRecordStore: sessionCaptureRecordStore } : {}),
|
|
132
135
|
})
|
|
133
136
|
: undefined;
|
|
137
|
+
const sessionMemoryStatusFace = memoryEngine
|
|
138
|
+
? createSessionMemoryStatusFace(memoryEngine, { ...(sessionCaptureRecordStore !== undefined ? { captureRecordStore: sessionCaptureRecordStore } : {}) })
|
|
139
|
+
: undefined;
|
|
134
140
|
const adoptionBoot = await runAdoptionBootScan({ backend, logger });
|
|
135
141
|
if (adoptionBoot.scanned > 0 || adoptionBoot.error !== undefined) {
|
|
136
142
|
logger.info("adoption_boot_scan", { ...adoptionBoot });
|
|
@@ -211,6 +217,7 @@ async function main() {
|
|
|
211
217
|
...(config.memoryProvenance !== undefined ? { provenance: config.memoryProvenance } : {}),
|
|
212
218
|
onIncident: (err) => logger.warn("memory_consolidation_incident", { code: err.code ?? null, detail: err.message }),
|
|
213
219
|
onStopDetail: (audit) => logger.warn("memory_consolidation_stop_detail", audit),
|
|
220
|
+
...(sessionCaptureRecordStore !== undefined ? { captureRecordStore: sessionCaptureRecordStore } : {}),
|
|
214
221
|
})
|
|
215
222
|
: undefined;
|
|
216
223
|
for (const w of buildConsolidationValveAudit({
|
|
@@ -246,6 +253,7 @@ async function main() {
|
|
|
246
253
|
mcpRevocations,
|
|
247
254
|
config, logger, metrics, localRoot, promptSource: configCenter.promptSource, rosterStore, backgroundAgentStore, mailboxStore, usageWindowStore, brain,
|
|
248
255
|
pricing, tracer, outcomeSink, elicitation, question, toolApproval, sessionStore, memoryEngine,
|
|
256
|
+
sessionCaptureRecordStore,
|
|
249
257
|
memorySyncRunner, toolResultStore: runnerOffloadStore, sessionPolicyStore, runtimeCapsResolver, fileHistoryStore,
|
|
250
258
|
legacyRewindBoundaryProbe: backend?.legacyRewindBoundaryProbe ? backend.legacyRewindBoundaryProbe.bind(backend) : undefined,
|
|
251
259
|
permissionRuleStore: permissionRuleStores?.provider,
|
|
@@ -610,6 +618,7 @@ async function main() {
|
|
|
610
618
|
memoryBundleImport: memoryBundleFaces ? memoryBundleFaces.importBundle : undefined,
|
|
611
619
|
memoryCompliance: memoryComplianceFaces,
|
|
612
620
|
memoryOriginFace: memoryOriginFaces,
|
|
621
|
+
sessionMemoryStatus: sessionMemoryStatusFace,
|
|
613
622
|
memoryConsolidation: memoryConsolidationFaces,
|
|
614
623
|
memoryOptOutGrant: memoryOptOutGrantStore,
|
|
615
624
|
orgMemoryDirectory: orgMemoryAdmission.directory,
|
|
@@ -662,6 +671,7 @@ async function main() {
|
|
|
662
671
|
mcpRevocations,
|
|
663
672
|
mcpRevocationState: () => configCenter.mcpRevocationState(),
|
|
664
673
|
configRefreshNow: () => configCenter.refreshNow(),
|
|
674
|
+
configCenterManagedKeys: () => configCenter.centerManagedKeys(),
|
|
665
675
|
drainState,
|
|
666
676
|
storeDegraded: storeBackendDegraded,
|
|
667
677
|
storeLiveState: storeLiveProbe ? () => storeLiveProbe.state() : undefined,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref](core 5.60.0)—— `McpServerSpec.contentOrigin` 的**闭词表单一属主**。
|
|
3
3
|
*
|
|
4
4
|
* core 给 MCP 条目开了一个**内容出处声明**座位:一台 server 的整套工具的结果算 `"local"`(部署自己
|
|
5
5
|
* 写的)/ `"execution"`(执行环境产物,`execIsExternalContent` 仍能收紧)/ `"external"`(第三方内容,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] v2-c —— `POST /v1/memory/{export,import}` 两口的**引擎接线**(core 5.40.0 [ref] v2-c)。
|
|
3
3
|
*
|
|
4
4
|
* ## 为什么需要这个模块(而不是在 main.ts 里直接 new)
|
|
5
5
|
*
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* HTTP 面诚实 501。
|
|
30
30
|
*
|
|
31
31
|
* 🔴 首版把这件事当成**运行期**事实(照常挂载,让 core 每次抛 `memory.export_incomplete` / 422),
|
|
32
|
-
* 被 codex 交叉复审驳倒(
|
|
32
|
+
* 被 codex 交叉复审驳倒([ref] 提货批 [medium],验真后修):`typeof backend.exportSnapshotOf === "function"`
|
|
33
33
|
* 是一次**属性检查**,boot 期就判得出;而且它是**永久**缺席(换后端才会变),不是瞬时状态。照旧挂着
|
|
34
34
|
* 就成了「能力位说 yes、每一次调用都确定性失败」——本仓「says yes ⟺ route works」是结构性承诺,
|
|
35
35
|
* 一个恒假的 yes 会让壳给用户开出一条走不通的迁移流程。
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
* `memory.export_incomplete` —— 那是诚实的运行期拒,附录 A 单列一条。绝不在这里回落到「用通用读面拼
|
|
42
42
|
* 一个包」:core 明写那正是它拒绝生产的形(a governance-less export is the laundering shape)。
|
|
43
43
|
*/
|
|
44
|
-
import { type MemoryBackend, type MemoryExportBundle, type MemoryImportReport } from "@sema-agent/core";
|
|
44
|
+
import { type MemoryBackend, type MemoryExportBundle, type MemoryImportReport, type SessionCaptureRecordStore } from "@sema-agent/core";
|
|
45
45
|
/** 两口 HTTP 面消费的窄能力面(`ServiceDeps.memoryBundle{Export,Import}` 的实参来源)。 */
|
|
46
46
|
export interface MemoryBundleFaces {
|
|
47
47
|
exportScopes: (scopes: readonly string[]) => Promise<MemoryExportBundle>;
|
|
@@ -60,5 +60,7 @@ export interface MemoryBundleFaces {
|
|
|
60
60
|
export declare function createMemoryBundleFaces(store: {
|
|
61
61
|
backend: MemoryBackend;
|
|
62
62
|
root: string;
|
|
63
|
+
}, opts?: {
|
|
64
|
+
captureRecordStore?: SessionCaptureRecordStore;
|
|
63
65
|
}): MemoryBundleFaces | undefined;
|
|
64
66
|
//# sourceMappingURL=memory-bundle-engine.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { MemoryEngine } from "@sema-agent/core";
|
|
2
|
-
export function createMemoryBundleFaces(store) {
|
|
2
|
+
export function createMemoryBundleFaces(store, opts) {
|
|
3
3
|
const b = store.backend;
|
|
4
4
|
if (typeof b.exportSnapshotOf !== "function" || typeof b.importBundleCommit !== "function")
|
|
5
5
|
return undefined;
|
|
6
|
-
const engine = new MemoryEngine({ backend: store.backend, memoryDir: store.root });
|
|
6
|
+
const engine = new MemoryEngine({ backend: store.backend, memoryDir: store.root, ...(opts?.captureRecordStore !== undefined ? { captureRecordStore: opts.captureRecordStore } : {}) });
|
|
7
7
|
return {
|
|
8
8
|
exportScopes: (scopes) => engine.exportMemoryScopes(scopes),
|
|
9
9
|
importBundle: (bundle, opts) => engine.importMemoryBundle(bundle, opts),
|