@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
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
* 码数的**受门**真源=契约文档附录 D.3 的小节标题,⑥b 双向门盯着)。
|
|
5
5
|
*
|
|
6
6
|
* 起步的那六码同族:都是「这条 session 的记忆姿态」的披露,resume 之后仍然相关 ⇒ 也进 durable 账本
|
|
7
|
-
* (cli 断连补看走既有 events 重放腿,[
|
|
7
|
+
* (cli 断连补看走既有 events 重放腿,[ref](ii))。
|
|
8
8
|
*
|
|
9
|
-
* ⚠️ **自
|
|
9
|
+
* ⚠️ **自 [ref](core 5.61.0)起本表不再是单一族**:`task.turn_interrupted` 与 `task.user_*_undrained`
|
|
10
10
|
* 两族是前三条**非记忆面**的成员(前者=一次插话真的切断了在飞的 turn;后两者=用户的输入被彻底丢弃)。
|
|
11
11
|
* 判据没有变(受众 × 投递可行性 × 去重单位三条合取,见顶注),变的只是「碰巧六条都是记忆码」这个
|
|
12
12
|
* 事实——别再把「是不是记忆姿态码」当成入册的隐性第四条判据。这条隐性判据正是 `task.user_*_undrained`
|
|
13
13
|
* 两码在明拒表里陈腐多时的帮凶之一(见它们的键注)。
|
|
14
14
|
*
|
|
15
|
-
* 🔴 **表长了就得同步三处**(
|
|
15
|
+
* 🔴 **表长了就得同步三处**([ref] 实测,少一处即门红):`test/engine-notice-wire.test.ts` 的闭集 pin、
|
|
16
16
|
* 同文件 G1 e2e 的全码扇出夹具、以及契约文档附录 D.3 那张表(含**小节标题里的码数** —— 那道门本批
|
|
17
17
|
* 刚立,立完就在下一次加码时自己咬住了)。
|
|
18
18
|
*/
|
|
19
|
-
export declare const ENGINE_NOTICE_WIRE_CODES: readonly ["memory.session_polluted", "memory.harvest_quarantined", "memory.delegation_static_mark_waived", "memory.hold_opened", "memory.hold_released", "memory.hold_disposed", "task.turn_interrupted", "steering.parked_input_blocked", "task.user_steer_undrained", "task.user_followup_undrained", "memory.capture_opted_out", "memory.capture_optout_unpersisted"];
|
|
19
|
+
export declare const ENGINE_NOTICE_WIRE_CODES: readonly ["memory.session_polluted", "memory.harvest_quarantined", "memory.delegation_static_mark_waived", "memory.hold_opened", "memory.hold_released", "memory.hold_disposed", "task.turn_interrupted", "steering.parked_input_blocked", "task.user_steer_undrained", "task.user_followup_undrained", "memory.capture_opted_out", "memory.capture_optout_unpersisted", "task.halt_unconsumed", "task.late_approval"];
|
|
20
20
|
export type EngineNoticeWireCode = (typeof ENGINE_NOTICE_WIRE_CODES)[number];
|
|
21
21
|
/** 白名单谓词(单点):路由与门都读这一个,不许第二处手抄码串。 */
|
|
22
22
|
export declare function isEngineNoticeWireCode(code: string): code is EngineNoticeWireCode;
|
|
@@ -24,7 +24,7 @@ export declare function isEngineNoticeWireCode(code: string): code is EngineNoti
|
|
|
24
24
|
* 归属键抽取 —— `detail.sessionId` 提升为顶层(设计稿 ②:归属键一等化)。
|
|
25
25
|
*
|
|
26
26
|
* 非串 / 空串一律按**缺席**处理(不铸 `"undefined"` 这种看起来合法的假值——`compactionOutcomeEventData`
|
|
27
|
-
* 的同款缺键守卫纪律)。core [
|
|
27
|
+
* 的同款缺键守卫纪律)。core [ref] 的顶层 `EngineNotice.sessionId` 到货后,这里先读顶层再回落 detail
|
|
28
28
|
* (两处同值,additive 零 BREAKING),届时本函数是唯一改动点。
|
|
29
29
|
*/
|
|
30
30
|
export declare function engineNoticeSessionId(notice: {
|
|
@@ -37,7 +37,7 @@ export interface EngineNoticeWireRow {
|
|
|
37
37
|
code: string;
|
|
38
38
|
/**
|
|
39
39
|
* core 铸的人话行。🔴 **仅 fallback 展示,不是匹配键**:core 明写 `memory.session_polluted` 的 message
|
|
40
|
-
* 随 `memoryProvenance` 模式变文(
|
|
40
|
+
* 随 `memoryProvenance` 模式变文([ref] mode-aware),按 message 匹配必碎(5.41 合流码形退役同教训)。
|
|
41
41
|
*/
|
|
42
42
|
message: string;
|
|
43
43
|
/** 机器可读事实,逐键消毒后直透(见 {@link sanitizeNoticeDetail} 的消毒/尺寸契约)。 */
|
|
@@ -82,7 +82,7 @@ export type EngineNoticeWireSink = (row: EngineNoticeWireRow) => void;
|
|
|
82
82
|
*
|
|
83
83
|
* 🔴 跨 session 隔离靠的是 **Map 键的精确串相等**,不是任何「最近活跃」回落 —— 缺席就是缺席(G5)。
|
|
84
84
|
*
|
|
85
|
-
* 🔴 **同 session 的跨代隔离靠 legId「最新代独占」**(
|
|
85
|
+
* 🔴 **同 session 的跨代隔离靠 legId「最新代独占」**([ref] codex 交叉复审 R1-[high],验真后修)。
|
|
86
86
|
* 病(真窗,本仓每一处 in-flight 登记都为它写过 identity-guard):run 行在**流体内**就已 setTerminal /
|
|
87
87
|
* setSuspended,而本腿的注销在 `finally` —— 中间那一窗里,同一条 session 上的**下一条腿**(快速续跑 /
|
|
88
88
|
* 紧接着的新提交)已经注册好了自己的口。若按「会话内全量扇出」投,新腿的一条通告会**同时**落进:
|
|
@@ -13,6 +13,8 @@ export const ENGINE_NOTICE_WIRE_CODES = [
|
|
|
13
13
|
"task.user_followup_undrained",
|
|
14
14
|
"memory.capture_opted_out",
|
|
15
15
|
"memory.capture_optout_unpersisted",
|
|
16
|
+
"task.halt_unconsumed",
|
|
17
|
+
"task.late_approval",
|
|
16
18
|
];
|
|
17
19
|
const WIRE_CODES = new Set(ENGINE_NOTICE_WIRE_CODES);
|
|
18
20
|
export function isEngineNoticeWireCode(code) {
|
|
@@ -1,27 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] 注入档位(core 5.61.0)的**闭集单点**([ref])——2026-08-31 起改为 **core 根导出直调**。
|
|
3
3
|
*
|
|
4
|
-
* ##
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* · `satisfies` 管「表内不许有词表外的词」—— core 删/改档位 ⇒ 编译红;
|
|
12
|
-
* · 穷举断言管「词表不许有表外的词」—— core 加档位 ⇒ 编译红。
|
|
13
|
-
* 两条合起来 = 上游任何一侧的增删都在编译期被逼着处置,而不是运行时静默漂。
|
|
14
|
-
*
|
|
15
|
-
* ## 为什么单独一个叶子模块
|
|
16
|
-
* 消费点有两个且分属两条依赖链:`trace/project.ts`(wire 投影)与
|
|
17
|
-
* `orchestration/workflow-completion-inbox.ts`(durable park 载荷)。手抄两份就是值拷贝漂移源
|
|
18
|
-
* (本仓 [1532] 起的老病族);把它挂在任一方又会在两条链之间拉一条没必要的边。零依赖叶子最干净。
|
|
19
|
-
*
|
|
20
|
-
* 🔴 上游哪天补了根导出:删掉本文件,两处改成一行谓词调用。
|
|
4
|
+
* ## 收口条款兑现([ref] PM 审计④「core 前提句过期族」)
|
|
5
|
+
* 本文件 5.61 时代的顶注写着「core 没有把 `SYSTEM_INJECTION_PRIORITIES` / `isSystemInjectionPriority`
|
|
6
|
+
* 放进根 barrel ⇒ 本仓自留双向锚词表;上游哪天补了根导出:删掉本文件,两处改成一行谓词调用」。
|
|
7
|
+
* core 7.0.2 已把**表和谓词都放进根导出**(运行期亲证:`SYSTEM_INJECTION_PRIORITIES` 数组 +
|
|
8
|
+
* `isSystemInjectionPriority` 函数均可 require 到)——按条款执行:自留词表退役,改直调;本文件保留为
|
|
9
|
+
* 两个消费点(`trace/project.ts` / `orchestration/workflow-completion-inbox.ts`)的公共缝(语义注 +
|
|
10
|
+
* `injectionTierOrAbsent` 的丢键方向条款仍是本仓资产,不随词表走)。
|
|
21
11
|
*/
|
|
22
|
-
import type
|
|
23
|
-
/**
|
|
24
|
-
export declare const INJECTION_TIERS: readonly [
|
|
12
|
+
import { type SystemInjectionPriority } from "@sema-agent/core";
|
|
13
|
+
/** 三档闭集 —— 现在就是 core 的那份表(单源;保留导出名,两个消费点与既有测试不动)。 */
|
|
14
|
+
export declare const INJECTION_TIERS: readonly SystemInjectionPriority[];
|
|
25
15
|
/**
|
|
26
16
|
* 边界守卫 —— 闭集内的值原样返回,**其余一律 `undefined`**(= 缺席)。
|
|
27
17
|
*
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
void _injectionTierExhaustive;
|
|
1
|
+
import { isSystemInjectionPriority, SYSTEM_INJECTION_PRIORITIES } from "@sema-agent/core";
|
|
2
|
+
export const INJECTION_TIERS = SYSTEM_INJECTION_PRIORITIES;
|
|
4
3
|
export function injectionTierOrAbsent(value) {
|
|
5
|
-
return
|
|
4
|
+
return isSystemInjectionPriority(value) ? value : undefined;
|
|
6
5
|
}
|
|
7
6
|
//# sourceMappingURL=injection-tier.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* runs 账本(`task_run_event`)的**事件型闭集**——
|
|
2
|
+
* runs 账本(`task_run_event`)的**事件型闭集**——[ref] P1-③ / codex 交叉复审 F2。
|
|
3
3
|
*
|
|
4
4
|
* ## 为什么需要这个联合
|
|
5
5
|
* 账本行的 `type` 是消费端分流的键:`GET /v1/runs/:id/events` 裸回放照发,而 `trace/project.ts` 的
|
|
@@ -36,12 +36,12 @@ export type LedgerEventType = "reasoning" | "text" | "tool_start" | "tool_end" |
|
|
|
36
36
|
| "suspended" | "needs_review" | "done" | "failed" | "suggestions" | "model_usage" | "prompt_assembled" | "config_assembled" | "file_link"
|
|
37
37
|
/** 人在环三族的 open/close 帧对(投递面 = 本腿的 durable events tail)。 */
|
|
38
38
|
| "elicitation" | "elicitation_complete" | "question" | "question_complete" | "tool_approval" | "tool_approval_complete"
|
|
39
|
-
/**
|
|
39
|
+
/** [ref] §4.3 新协议的呈卡帧(与上面两只 tool_approval 帧同一条投递面)。 */
|
|
40
40
|
| "approval_request"
|
|
41
41
|
/** 异步 workflow 完成的入箱 drain(`emitPendingWorkflowCompletions` 两个字面型之一)。 */
|
|
42
42
|
| "workflow_complete"
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* [ref] `engine_notice` —— core `EngineNotice` 白名单三码按 `detail.sessionId` 路由到该会话的事件投影。
|
|
45
45
|
*
|
|
46
46
|
* 🔴 **是"腿自己的带外行",不是流事件投影**:它不经 `TaskStream`(`RunnerDeps.onNotice` 是 deps 级
|
|
47
47
|
* 同步 sink),所以两条 durable 腿的 `switch (ev.type)` 里**没有也不该有** `case "engine_notice"` ——
|
|
@@ -5,7 +5,7 @@ import type { LedgerEventType } from "./ledger-events.js";
|
|
|
5
5
|
* LedgerSink — the SINGLE "stream event → durable runs-ledger" projection, shared by the background leg
|
|
6
6
|
* (runs.ts `runInBackground`) and the sync `/v1/tasks/stream` detach lane (server.ts, `x-detach-on-disconnect`).
|
|
7
7
|
*
|
|
8
|
-
* [
|
|
8
|
+
* [ref]①/[ref]③: the sync leg historically persisted only createRun+setTerminal — its events ledger stayed
|
|
9
9
|
* EMPTY, so after a detach the shell could only poll the terminal row. Feeding the same sink on the detach
|
|
10
10
|
* lane makes `GET /v1/runs/:id/events` replay the full stream in the EXACT bg-leg vocabulary (the ledger
|
|
11
11
|
* consumer binds to these type/data shapes — a second copy of this switch would drift into a false ledger,
|
|
@@ -35,7 +35,7 @@ export interface LedgerSink {
|
|
|
35
35
|
type: string;
|
|
36
36
|
}): Promise<void>;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* [ref](core 5.34.0 的 `RunInternals.onStatusEvent` 第五席):**「只回结果」腿**的 `status` 行写口。
|
|
39
39
|
*
|
|
40
40
|
* 与 {@link onEvent} 的 `case "status"` 共用**同一个**白名单 builder(`brainStatusEventData`),差别只有
|
|
41
41
|
* 一处:本门**同步入链** —— 在回调进入的那一刻就占住序号槽,而不是先 `await flush()` 再入链。
|
|
@@ -58,7 +58,7 @@ export interface LedgerSink {
|
|
|
58
58
|
onForwardEvent(e: {
|
|
59
59
|
type?: string;
|
|
60
60
|
}): void;
|
|
61
|
-
/** Park event (durable F4 suspend /
|
|
61
|
+
/** Park event (durable F4 suspend / [ref] D-B review pause): ONLY the non-secret `checkpointGate` is
|
|
62
62
|
* persisted — never the capability `checkpointToken` (search [18] Q1b). */
|
|
63
63
|
appendParked(kind: "suspended" | "needs_review", result: unknown): Promise<void>;
|
|
64
64
|
/** Terminal `done` event. `result` must already be checkpoint-token-stripped (and, on the bg leg,
|
|
@@ -71,13 +71,13 @@ export interface LedgerSink {
|
|
|
71
71
|
}): Promise<void>;
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
|
-
* **单写串行链**的可复用形(
|
|
74
|
+
* **单写串行链**的可复用形([ref] codex 交叉复审 R1-[high],验真后修)—— `seq` 的**分配发生在链步内**,
|
|
75
75
|
* 于是「分配序 == 发起序 == 提交序」。
|
|
76
76
|
*
|
|
77
77
|
* 病(实测形,`LedgerSink` 内部早有这条纪律的内联版、其顶注 [1.211 codex H2] 逐字记着它):裸写口
|
|
78
78
|
* (`(type, data) => rs.appendEvent(taskId, ++seq, type, data)`)在**同步分配 seq、立刻发起 insert**。
|
|
79
79
|
* 主循环 await 自己的写,所以主循环内部有序;但只要有**一个 fire-and-forget 写者**(子代 forward 帧、
|
|
80
|
-
*
|
|
80
|
+
* [ref] 的通告口),它的 N 号 insert 可能在池化 SQL 后端上晚于后发的 N+1 号提交。events tail 的读法是
|
|
81
81
|
* `getEvents(id, afterSeq)` —— 读到 N+1 就把游标推过 N,**那一行此后永远不会被投递**(重连也不会,
|
|
82
82
|
* 游标只前进)。行在库里,消费端结构性看不见。
|
|
83
83
|
*
|
|
@@ -93,11 +93,11 @@ export declare function createLedgerSink(opts: {
|
|
|
93
93
|
/** TRACE_THINKING gate: reasoning deltas are buffered (later redacted+persisted) only when true (core [R57] —
|
|
94
94
|
* persisting CoT is a deployment decision). Both legs pass the SAME config source (`config.traceThinking`). */
|
|
95
95
|
persistThinking: boolean;
|
|
96
|
-
/** task_notification dedup ledger (core [
|
|
96
|
+
/** task_notification dedup ledger (core [ref]④a seq-folded keys). The bg leg passes its per-leg instance
|
|
97
97
|
* (shared with its observer/drain arms so no arm double-appends a key another arm delivered); a leg with no
|
|
98
98
|
* other durable arms (sync detach lane) omits it and gets a private instance. */
|
|
99
99
|
notifiedKeys?: NotifiedKeys;
|
|
100
|
-
/**
|
|
100
|
+
/** [ref] S1:turn 活性打点(`recordTurnActivity(taskId)`)。打点位有两处且都必须:①`onEvent` 入口
|
|
101
101
|
* ——**text_delta/reasoning_delta 只进内存缓冲、到 flush 边界才 append**(codex S1-F1,2026-08-13:
|
|
102
102
|
* 只打 append 会让长时间流式输出被误读成「无进展」,方向与本键的设计目的正好相反);②`append`
|
|
103
103
|
* 入口——兜住不经 onEvent 的直写路径(appendParked/appendDone/onForwardEvent)。分诊提示性回调:
|
package/dist/trace/project.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* SERVICE layer (core [R57] cross-review: do NOT push this shape into core — different consumer, different shape).
|
|
8
8
|
*
|
|
9
9
|
* Per core [R57] corrections: there is no `suspended` event (suspend = the run row's status); per-turn tokens ride
|
|
10
|
-
* on `turn_end.usage` (core additive). As of core 1.121.0 (
|
|
10
|
+
* on `turn_end.usage` (core additive). As of core 1.121.0 ([ref] §E1) `tool_end` ALSO carries the model-facing
|
|
11
11
|
* `output` (+ `truncated`) — redacted + size-bounded at append (runs.ts) and read straight off the event here (the
|
|
12
12
|
* old session-join `toolOutput` hook is gone, there's a real source now); `eventId`/`parentToolCallId` (§E2) ride
|
|
13
13
|
* each content event, additive / tolerate-absent.
|
|
@@ -25,13 +25,13 @@ type GetEventsFn = (taskId: string, afterSeq: number) => Promise<RunEvent[]>;
|
|
|
25
25
|
* Shared by BOTH durable-write legs (runInBackground + the resume leg) so the persisted shape never drifts; the
|
|
26
26
|
* append-only deltas make a suspended/resumed run's total resume-safe (each leg appends its own, the echo sums).
|
|
27
27
|
*
|
|
28
|
-
* core 3.0.0([
|
|
28
|
+
* core 3.0.0([ref] 装车单 S10,§DESIGN-V2 V2-⑤): every drained row is tagged with `usageBasis:
|
|
29
29
|
* "uncached-components-v1"` — the write point for this label (the tracker itself, {@link ModelUsageTracker},
|
|
30
30
|
* never sets it; it stays a pure token/cost accumulator). This is what lets {@link aggregateModelUsage} tell
|
|
31
31
|
* apart rows written under the current component semantics from older rows (pre-dating this label) when it
|
|
32
32
|
* sums across a run's whole event log. */
|
|
33
33
|
export declare function appendModelUsageDelta(append: AppendFn, modelUsage: ModelUsageTracker | undefined, taskId: string): Promise<void>;
|
|
34
|
-
/** [
|
|
34
|
+
/** [ref]② drain the pending prompt-manifest records (whitelisted at RECORD time, budget.ts — ids/digests/
|
|
35
35
|
* counts only, no prompt bodies by core's manifest contract) into durable `prompt_assembled` events, one per
|
|
36
36
|
* prepare IN EMISSION ORDER (a cascade/verify leg re-prepares under one taskId — every rung's manifest
|
|
37
37
|
* persists; release-review finding). Shared by both durable-write legs; a no-op when nothing is pending
|
|
@@ -53,12 +53,12 @@ export declare function attachModelUsage<T extends TaskResult>(result: T, ctx: {
|
|
|
53
53
|
* (append-only) → this is resume-safe: it sums across ALL process legs of a suspended/resumed run. Returns
|
|
54
54
|
* undefined when the run logged no model usage (→ the shell soft-degrades to aggregate cost only).
|
|
55
55
|
*
|
|
56
|
-
* #59([
|
|
56
|
+
* #59([ref]①):事件体是 **DB 里的 JSON**(旧版本 / 别的 producer 都可能写),此前的 `?? 0` 只接住
|
|
57
57
|
* null/undefined——NaN 与字符串会原样进 `+`,一个坏键就把该模型的整 run 总量变成 NaN 或字符串拼接,
|
|
58
58
|
* 再顺着 `TaskStats.modelUsage` 回声流进 usage-analytics 的整窗聚合。守卫改「非有限数 = 缺席、按 0 计」,
|
|
59
59
|
* 与 usage-analytics 读侧同口径。
|
|
60
60
|
*
|
|
61
|
-
* 🔴
|
|
61
|
+
* 🔴 [ref](core 2.3.0,[ref] 提货单①)——**缺席必须活着走完整条链**。此前本折叠对「costMicroUsd
|
|
62
62
|
* 缺席」与「=0」输出相同(都是 0),那时无所谓:core 恒发数字,缺席没有 producer。现在 unpriced 部署
|
|
63
63
|
* 下 core 行级缺席、budget.ts 如实透传落库,若在这里折 0,诚实就只活到落库为止——回声上又变回
|
|
64
64
|
* 「花了 0」,行级消歧白做。故改**未知传染**:该模型任一贡献行缺 costMicroUsd 键 ⇒ 总量的该键**整个不在**
|
|
@@ -109,7 +109,7 @@ export type TraceBlock = {
|
|
|
109
109
|
tools?: unknown;
|
|
110
110
|
};
|
|
111
111
|
/** The durable `tool_start` event payload, shared by BOTH append sites (runInBackground + the resume leg) so the
|
|
112
|
-
* persisted shape never drifts: redacted args (UNTRUSTED) + E2 identity. `label`([
|
|
112
|
+
* persisted shape never drifts: redacted args (UNTRUSTED) + E2 identity. `label`([ref]§三族B:durable 腿
|
|
113
113
|
* 此前剥掉——同一 run live 观看有展示名、replay/resume 退化成 wire 名):core 展示名 verbatim(tail 面
|
|
114
114
|
* 1.251 复审同裁,两腿同处理)。 */
|
|
115
115
|
export declare function toolStartEventData(ev: {
|
|
@@ -167,10 +167,10 @@ export declare function taskProgressEventData(ev: {
|
|
|
167
167
|
seq?: number;
|
|
168
168
|
model?: string;
|
|
169
169
|
}): Record<string, unknown>;
|
|
170
|
-
/** The `task_notification` payload (core 1.202
|
|
170
|
+
/** The `task_notification` payload (core 1.202 [ref] P2: a background task finished — this event is the
|
|
171
171
|
* LEDGER/display projection of the OBSERVED terminal state, emitted the moment core observes it. It does NOT
|
|
172
172
|
* attest that the `<task-notification>` XML has entered the model context: core's steer targets the NEXT TURN
|
|
173
|
-
* BOUNDARY (
|
|
173
|
+
* BOUNDARY ([ref] §7 — turn 在飞时不注入), so the frame can precede actual injection by minutes ([ref]
|
|
174
174
|
* clay live: 3m54s; the previous wording here — "core already injected in-process" — was the same wrong
|
|
175
175
|
* assumption that broke the shell's dedup). `injected: false` says exactly that on the wire: a consumer must
|
|
176
176
|
* NOT treat this frame as an echo of model-context injection. EXPLICIT WHITELIST (never `{...ev}` — the 1.72 task_progress lesson: a
|
|
@@ -217,7 +217,7 @@ export declare function taskNotificationEventData(ev: {
|
|
|
217
217
|
};
|
|
218
218
|
eventId?: string;
|
|
219
219
|
parentToolCallId?: string;
|
|
220
|
-
/**
|
|
220
|
+
/** [ref] §3.6(core 5.61.0,additive):本帧**投出去时的注入档位**。见下方投影处的键注 —— 它是
|
|
221
221
|
* **事件顶层**键,不是 {@link TaskNotificationPayload} 的键,所以只有把整只 core 事件交给本投影的腿
|
|
222
222
|
* 拿得到它;只拿到载荷的 park-drain 腿结构上没有这一位。 */
|
|
223
223
|
priority?: SystemInjectionPriority;
|
|
@@ -229,7 +229,7 @@ export declare function taskNotificationEventData(ev: {
|
|
|
229
229
|
* cards from it): `path` is the engine's own working-file path (env-derived, not free text) but still crosses our
|
|
230
230
|
* wire → `redactSecrets` (a project path can embed a secret-shaped dir name); chars/truncated are numeric/bool
|
|
231
231
|
* verbatim. Absent fields stay absent (feature off / nothing attached / no kept-tail floor). */
|
|
232
|
-
/** The `diagnostics` payload (core 1.220
|
|
232
|
+
/** The `diagnostics` payload (core 1.220 [ref] — NEW LSP diagnostics drained at a turn boundary; the model
|
|
233
233
|
* already got the `<new-diagnostics>` context message in-process, this frame is the shell's render source).
|
|
234
234
|
* EXPLICIT WHITELIST shared by all three legs. UNTRUSTED RAW (§E1: language-server output over workspace files —
|
|
235
235
|
* a diagnostic message can quote file content, a secret-shaped uri/source is possible) → `redactSecrets` on the
|
|
@@ -249,7 +249,7 @@ export declare function diagnosticsEventData(ev: {
|
|
|
249
249
|
eventId?: string;
|
|
250
250
|
parentToolCallId?: string;
|
|
251
251
|
}): Record<string, unknown>;
|
|
252
|
-
/** The `steering_injected` payload([
|
|
252
|
+
/** The `steering_injected` payload([ref]/[ref] 裁定透传;core `TaskEvent` 联合臂 `type: "steering_injected"`,
|
|
253
253
|
* shell 渲染源 = CC 的系统提醒条:core 在 turn 之间给模型注入一条系统提示[todo 提醒/文件变化/日期跨天/
|
|
254
254
|
* 技能列表变化…]时随手抛的展示投影,一附件一帧)。EXPLICIT WHITELIST(source=封闭枚举 verbatim;
|
|
255
255
|
* preview=注入文本的展示摘录,UNTRUSTED[core 未做秘密脱敏]→ `redactSecrets`)。共享三腿(sync 实时 SSE +
|
|
@@ -260,8 +260,8 @@ export declare function steeringInjectedEventData(ev: {
|
|
|
260
260
|
eventId?: string;
|
|
261
261
|
parentToolCallId?: string;
|
|
262
262
|
}): Record<string, unknown>;
|
|
263
|
-
/** `compaction_outcome`(core 2.5.0 [
|
|
264
|
-
* 两条真路)。[
|
|
263
|
+
/** `compaction_outcome`(core 2.5.0 [ref]②:压缩非 compacted 结局——manual /compact 的 mooted/failed
|
|
264
|
+
* 两条真路)。[ref]A-2/C-2:此前它是**唯一**不走共享 builder、只在 live 腿 res.write 内联挑键的
|
|
265
265
|
* 内容帧 ⇒ 两条 durable 腿零 case、回放即消失、三方普查各自失明。收进共享白名单 builder,三腿同源。
|
|
266
266
|
* outcome/trigger=闭枚举 verbatim;reason=引擎说明文本(可能引用配置值)→ redactSecrets;identity 同款。 */
|
|
267
267
|
export declare function compactionOutcomeEventData(ev: {
|
|
@@ -271,7 +271,7 @@ export declare function compactionOutcomeEventData(ev: {
|
|
|
271
271
|
eventId?: unknown;
|
|
272
272
|
parentToolCallId?: unknown;
|
|
273
273
|
}): Record<string, unknown>;
|
|
274
|
-
/** The `workspace_changed` payload([
|
|
274
|
+
/** The `workspace_changed` payload([ref]二 core 裁定:[ref] §E13 旧臂,L1 门本车首次撞见——非新增,
|
|
275
275
|
* 是本门扩 TaskEvent 臂集时第一次显式处置。语义 = bash `cd`/EnterWorktree 移动任务逻辑 cwd 后,在移动
|
|
276
276
|
* 它的工具结算后发一帧,给 shell/宿主 UI 一个路径提示行。cwd 与已展示的工具 args 同信任级[UNTRUSTED,
|
|
277
277
|
* RAW 逻辑路径,symlink 不解析]→ `redactSecrets` + 长度 bound[300,与 brainStatusEventData.detail 同
|
|
@@ -283,13 +283,13 @@ export declare function workspaceChangedEventData(ev: {
|
|
|
283
283
|
parentToolCallId?: string;
|
|
284
284
|
}): Record<string, unknown>;
|
|
285
285
|
/**
|
|
286
|
-
* `wiring_manifest`(core 5.14.0
|
|
286
|
+
* `wiring_manifest`(core 5.14.0 [ref] 新 `TaskEvent` 臂)—— 每条腿(root/child/resume)在 prepare
|
|
287
287
|
* 时自证「我到底接了什么线」的清单帧。
|
|
288
288
|
*
|
|
289
289
|
* 🔴 **本构造器存在的唯一理由是剥掉 `governance` 段**。core 给该段盖了 `audience: "operator"` 并成文
|
|
290
290
|
* 了服务层义务:*a serving layer forwarding this event to a multi-tenant stream MUST project the governance
|
|
291
291
|
* section for operators only; **no projection ⇒ do not disclose***。我方的三条腿(sync SSE / durable 账本 /
|
|
292
|
-
* resume 账本)都是租户可读面,而 operator 投影是
|
|
292
|
+
* resume 账本)都是租户可读面,而 operator 投影是 [ref] 的独立大件——按 core 写死的失败方向,**没有投影
|
|
293
293
|
* 就不得披露**,所以本批先把整段剥掉止泄(此前 sync 腿的裸 catch-all 会把它连同 `lockedConfig` /
|
|
294
294
|
* `compliance` / `memoryAdmission` / `retention` 四个治理面在场位原样透传给任意订阅者)。
|
|
295
295
|
* operator 投影是**另一个**构造器({@link wiringManifestOperatorEventData},live 腿按调用方身份挑),
|
|
@@ -301,23 +301,23 @@ export declare function workspaceChangedEventData(ev: {
|
|
|
301
301
|
* 顺着 spread 裸上线,尤其当新段可能又是一个 audience 受限面时)。所有值都是引擎派生的闭枚举/布尔/
|
|
302
302
|
* 有限数/不透明摘要串,**非用户内容 ⇒ 不脱敏**;畸形值一律按缺席处理(不铸假值,与 compacted 同规)。
|
|
303
303
|
*
|
|
304
|
-
* 🔴 **未标签面的准入裁定逐面记录在此,缺省不是「放行」**(
|
|
304
|
+
* 🔴 **未标签面的准入裁定逐面记录在此,缺省不是「放行」**([ref] 裁定 C)。core 只给 `governance` 标了
|
|
305
305
|
* audience,其余段没有标签 —— 没标签**不等于**可以默认投给租户,每一段都要有一次人的裁定,写在这里:
|
|
306
306
|
* · `interaction.posture`(三值:interactive / headless / absent)—— **裁:租户可见**。它是部署形的
|
|
307
307
|
* 自述(这条腿有没有人能答问题),消费端据此决定渲不渲交互面;不是治理秘密,也不构成任何治理位的
|
|
308
308
|
* 侧信道(它不参与 governance 那 4 个布尔的还原)。
|
|
309
|
-
* · `permissionRules.storeWired`(布尔;core 5.18.0
|
|
309
|
+
* · `permissionRules.storeWired`(布尔;core 5.18.0 [ref] 新段)—— **裁:租户可见**。同族判据:
|
|
310
310
|
* 它与 `parkLane.capable` / `elicit.seamWired` / `fleet.backgroundAgentStore` 是同一类「这条腿接没接
|
|
311
311
|
* 某个可选设施」的部署形自述,而那三个早已租户可见。消费端的真需求也在租户侧:审批卡要不要渲染
|
|
312
312
|
* 「不再询问」这一格,取决于这台 worker 有没有规则店 —— 剥掉它,客户端只能靠试(提交后被拒)才知道。
|
|
313
313
|
* 它**不在** `governance` 段里(core 自己把它放在段外),也不构成那 4 个治理布尔的侧信道。
|
|
314
314
|
* ⚠️ 恒在段(core 侧 `permissionRules` 无 `?`):两个真值都可能出现,**别把 false 读成缺席**。
|
|
315
|
-
* 本仓自
|
|
315
|
+
* 本仓自 [ref] 车二 / [ref] 起真接了规则店(`main.ts` 在 `PERMISSION_RULES_ENABLED` 为真 ∧
|
|
316
316
|
* backend 在场时把 `permissionRuleStore` 装进 `RunnerDeps`,SQL 与 File 两形)⇒ 那样的部署报
|
|
317
317
|
* `storeWired: true`;旋钮关掉或后端缺席的部署仍报 `false`。消费端读到 false 就是「这台 worker
|
|
318
318
|
* 今天没有这条车道」,不许当成「这版引擎还没这个概念」。
|
|
319
|
-
* · `permissionRules.syncWired` / `permissionRules.orgGoverned`(布尔两位;core 5.23.0
|
|
320
|
-
* 给**同一段**加的员,[
|
|
319
|
+
* · `permissionRules.syncWired` / `permissionRules.orgGoverned`(布尔两位;core 5.23.0 [ref] §9/§7
|
|
320
|
+
* 给**同一段**加的员,[ref] 提货批 codex 复审 high 抓获——首版把它们静默剥了,正是本仓建这份台账要防
|
|
321
321
|
* 的「投影白名单剥键」病)—— **裁:租户可见,与同段的 `storeWired` 同待遇**。判据三条:
|
|
322
322
|
* ① **同段同类**:core 把它们放进 `permissionRules` 而不是 `governance`(唯一带 audience 标签的段),
|
|
323
323
|
* 且形状与 `storeWired` 逐字同构(恒在的布尔,present-and-false 表示「有这个概念,这里没开」);
|
|
@@ -328,7 +328,7 @@ export declare function workspaceChangedEventData(ev: {
|
|
|
328
328
|
* ③ **不是治理侧信道**:两位都不参与 `governance` 那 4 个布尔的还原(它们描述规则店这条车道自身的
|
|
329
329
|
* 形状,与 lockedConfig/compliance/memoryAdmission/retention 无函数关系)。
|
|
330
330
|
* ⚠️ 与 `storeWired` **不同**:本仓这两条至今未接(`RunnerDeps.permissionRuleSyncWired` /
|
|
331
|
-
* `permissionRuleOrg` 全树零声明点,2026-08-10
|
|
331
|
+
* `permissionRuleOrg` 全树零声明点,2026-08-10 [ref] 复扫亲验)⇒ 今天恒 `false`,这是**真值**不是
|
|
332
332
|
* 缺席。哪天接上其中任一条,连本句一起改 —— 这一行是它的登记处。
|
|
333
333
|
* 未来 core 加一段而它没有 audience 标签时,**先在这里补一条裁定再决定挑不挑键** —— 段级完备性钉
|
|
334
334
|
* (test/wiring-manifest-projection.test.ts)会在那一刻先把人拦下来。
|
|
@@ -339,7 +339,7 @@ export declare function wiringManifestEventData(ev: {
|
|
|
339
339
|
parentToolCallId?: unknown;
|
|
340
340
|
}): Record<string, unknown>;
|
|
341
341
|
/**
|
|
342
|
-
* `wiring_manifest` 的 **operator 投影**(
|
|
342
|
+
* `wiring_manifest` 的 **operator 投影**([ref] 件一)—— {@link wiringManifestEventData} 的租户形加上
|
|
343
343
|
* `governance` 段与 core 的真 `configFingerprint`。
|
|
344
344
|
*
|
|
345
345
|
* 🔴 分叉发生在**读口**,不在账本:两条 durable 腿(ledger-sink / resume)恒存剥后形,因为账本写的那一刻
|
|
@@ -365,7 +365,7 @@ export declare function wiringManifestOperatorEventData(ev: {
|
|
|
365
365
|
parentToolCallId?: unknown;
|
|
366
366
|
}): Record<string, unknown>;
|
|
367
367
|
/**
|
|
368
|
-
* `human_input`(core 5.14.0
|
|
368
|
+
* `human_input`(core 5.14.0 [ref] 新 `TaskEvent` 臂)—— 「谁把什么喂进了这条 run」的生命周期账本
|
|
369
369
|
* 帧(objective / 实时 steer / nextTurn / parked-steer 续跑 / wake 五个载体共用一个投影点)。
|
|
370
370
|
*
|
|
371
371
|
* 信任划线(与 tool_approval 帧同族):
|
|
@@ -408,6 +408,7 @@ export declare function brainStatusEventData(ev: {
|
|
|
408
408
|
retryInMs?: number;
|
|
409
409
|
errClass?: string;
|
|
410
410
|
retryAtMs?: number;
|
|
411
|
+
errorStatus?: number;
|
|
411
412
|
eventId?: string;
|
|
412
413
|
parentToolCallId?: string;
|
|
413
414
|
}): Record<string, unknown>;
|
|
@@ -444,7 +445,7 @@ export interface TraceTurn {
|
|
|
444
445
|
ts: string;
|
|
445
446
|
role: "system" | "user" | "assistant" | "tool";
|
|
446
447
|
blocks: TraceBlock[];
|
|
447
|
-
/** core 3.0.0([
|
|
448
|
+
/** core 3.0.0([ref] 装车单 S3,§DESIGN-V2 V2-②):这是**本服务自有的投影契约**,不是 core wire 帧的
|
|
448
449
|
* verbatim 转发——`in` 刻意保持它历史上的「总量」语义不变(旧帧/新帧读端零伤),不随 core 的
|
|
449
450
|
* `promptTokens`/`turn_end.usage.inputTokens` 翻转为 cache-MISS。新增 `uncachedIn` 承接 core 3.0.0 才有的
|
|
450
451
|
* cache-MISS 分量(命名取自 core `uncachedInputTokensOf`),只在能确认自己踩在新契约帧上时才发
|
|
@@ -458,7 +459,7 @@ export interface TraceTurn {
|
|
|
458
459
|
};
|
|
459
460
|
}
|
|
460
461
|
/**
|
|
461
|
-
* `context_usage` 的白名单投影(core 1.414 新增一等 `TaskEvent` 分支;server [
|
|
462
|
+
* `context_usage` 的白名单投影(core 1.414 新增一等 `TaskEvent` 分支;server [ref]⑥ 点名要的上下文用量面)。
|
|
462
463
|
*
|
|
463
464
|
* 🔴 两条 core 明确交代的口径,必须原样传下去、不要在服务端"聪明地"重算:
|
|
464
465
|
* · `usedTokens > compactAtTokens` **就是引擎自己喂 `shouldCompact` 的谓词** —— 消费方直接用,别重新推导阈值。
|
|
@@ -482,7 +483,7 @@ export declare function contextUsageEventData(ev: {
|
|
|
482
483
|
* · `stopReason` —— **这一轮为什么停**(max_tokens / stop_sequence / …);
|
|
483
484
|
* · `usageMissing: true` —— **用量不可信**的诚实标记。缺了它,"没有 usage"会被读成"用量是 0",
|
|
484
485
|
* 而不是"未知";这正是那种"回放后看起来一切正常"的丢失。
|
|
485
|
-
* 两者**在 live 腿看得见、durable 腿回放后永久消失** —— 与 [
|
|
486
|
+
* 两者**在 live 腿看得见、durable 腿回放后永久消失** —— 与 [ref] 的 `label`、[ref] 的 workflowRunId 同一族
|
|
486
487
|
* (白名单没跟上 core 新增字段)。补 builder 的同时也就把它纳入了 `wire-whitelist-exhaustiveness` 的编译期差集门。
|
|
487
488
|
*/
|
|
488
489
|
export declare function turnEndEventData(ev: {
|
|
@@ -496,13 +497,13 @@ export declare function turnEndEventData(ev: {
|
|
|
496
497
|
* costMicroUsd; core 3.0.0 adds required `totalInputTokens`) → the contract's `TraceTurn.tokens`.
|
|
497
498
|
* Absent/empty → undefined.
|
|
498
499
|
*
|
|
499
|
-
* core 3.0.0([
|
|
500
|
+
* core 3.0.0([ref] 装车单 S3,§DESIGN-V2 V2-②,codex 复审「异议」采纳):`TraceTurn.tokens` 是本服务自有
|
|
500
501
|
* 的投影契约,不是 wire verbatim——`in` 保持它一直以来的**总量**语义,3.0.0 起改取 `totalInputTokens`
|
|
501
502
|
* (归一化总输入含 cache)优先,`inputTokens` 回落(旧帧/尚未升级的 core 下 `totalInputTokens` 缺席时,
|
|
502
503
|
* `in` 落回旧值,读端零伤)。`uncachedIn` 只在**能确认自己踩在新契约帧上**(`totalInputTokens` 在场)时
|
|
503
504
|
* 才发——旧帧的 `inputTokens` 是族依赖的旧语义,标成「uncachedIn(cache-MISS)」会是谎言。 */
|
|
504
505
|
export declare function toContractTokens(usage: unknown): TraceTurn["tokens"] | undefined;
|
|
505
|
-
/** [
|
|
506
|
+
/** [ref]C-13:tool_start/tool_end 的**共享挑键**——`projectEvents`(turns 面)与 `mapTraceEvent`
|
|
506
507
|
* (trace SSE 面)对同一账本行的字段选择逐字同构,此前两处独立手写,structured/totalChars/label
|
|
507
508
|
* 三次扩字段各改两遍(见两处对偶注)。收一份:两面各自包装键名皮(id/name/input vs 同名),
|
|
508
509
|
* 字段集合从此单点演进。 */
|
|
@@ -544,7 +545,7 @@ export interface TaskSummary {
|
|
|
544
545
|
/** A run record → the cheap list summary (contract 2.1). Token/cost/turns come from the terminal result.stats;
|
|
545
546
|
* scenario isn't denormalized on the run row (omitted — a later push-index/column refinement). */
|
|
546
547
|
export declare function taskSummary(run: RunRecord, latestEventType?: string): TaskSummary;
|
|
547
|
-
/**
|
|
548
|
+
/** [ref] B2(lens4 N8)—— 重放边界的**读旧**归一:把历史账本里的 `brain_status` 行改叫 `status`。
|
|
548
549
|
*
|
|
549
550
|
* 同一条「大脑存活性」观测曾在两条腿上叫两个名字:live 腿(`POST /v1/tasks/stream`)发 `type:"status"`,
|
|
550
551
|
* durable 腿的账本行落 `brain_status`,而 SDK 的公开 `AgentEvent` 联合**只有** `status` —— 于是走
|
package/dist/trace/project.js
CHANGED
|
@@ -305,6 +305,7 @@ export function brainStatusEventData(ev) {
|
|
|
305
305
|
...(num(ev.maxRetries) ? { maxRetries: ev.maxRetries } : {}),
|
|
306
306
|
...(num(ev.retryInMs) ? { retryInMs: ev.retryInMs } : {}),
|
|
307
307
|
...(num(ev.retryAtMs) ? { retryAtMs: ev.retryAtMs } : {}),
|
|
308
|
+
...(num(ev.errorStatus) ? { errorStatus: ev.errorStatus } : {}),
|
|
308
309
|
...(typeof ev.errClass === "string" && ev.errClass.length > 0 ? { errClass: ev.errClass } : {}),
|
|
309
310
|
...identityFields(ev),
|
|
310
311
|
};
|
package/dist/turn-activity.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] S1([ref] 决策卡死墙攻关):进程内 per-task「turn 最后活性时刻」——running 形 409 与
|
|
3
3
|
* GET /v1/runs/:id 读面的判别材料 `msSinceLastActivity` 的唯一数据源。
|
|
4
4
|
*
|
|
5
5
|
* 【为什么需要它】run 行的 `updatedAt` 由 liveness heartbeat(独立 `setInterval`,runs.ts)推进——
|
|
6
|
-
* 它只证明 **server 进程**活着;turn 卡死在某个 await 上时心跳照走([
|
|
6
|
+
* 它只证明 **server 进程**活着;turn 卡死在某个 await 上时心跳照走([ref] 推理缺陷的公开更正)。
|
|
7
7
|
* 「turn 真在推进」的证据 = ledger sink 的 durable append(text/tool/status/park/done 全族都过那一条
|
|
8
|
-
* 单写串行链)。cli 的 running 形保守臂([
|
|
8
|
+
* 单写串行链)。cli 的 running 形保守臂([ref] C3)缺的就是这一维:没有它,「真忙的后台 run」与
|
|
9
9
|
* 「断连僵局」在 wire 上不可分辨,只能猜。
|
|
10
10
|
*
|
|
11
11
|
* 【语义边界(与消费端约定,勿漂)】
|
|
12
12
|
* - **同副本 best-effort**:记录只活在本进程。跨副本命中(claim 持有者在别的副本)或本副本重启后
|
|
13
13
|
* ⇒ 读不到 ⇒ wire 键**诚实缺席**——缺席 = 「无法证明」,不是「不活」。绝不铸 0(0 会被读成
|
|
14
|
-
* 「刚刚还活着」,错误方向与 [
|
|
14
|
+
* 「刚刚还活着」,错误方向与 [ref] 「宁缺毋假」纪律同族)。
|
|
15
15
|
* - 不落库、不进 SQL 面:这是分诊提示,不是状态机输入;任何门/CAS/resume 判定都不许读它。
|
|
16
16
|
*
|
|
17
17
|
* 【生命周期】终局**不主动清**——409 只在 `running` 行上消费本记录,终局行不进那个分支,残留无害;
|
|
@@ -31,7 +31,7 @@ export interface UsageRow {
|
|
|
31
31
|
/**
|
|
32
32
|
* 一行 per-model echo。**五键逐个可选**——本类型描述的不是本进程铸的对象,而是 **DB 里 result JSON 的一段**:
|
|
33
33
|
* 旧版本写的行、别的 producer 写的行、以及 wire 契约本身(SDK `ModelUsageDelta` 五键全可选 + `[k]:unknown`
|
|
34
|
-
* 开放)都可能少键。#59([
|
|
34
|
+
* 开放)都可能少键。#59([ref]①):此处原先声明成「全必填」,`projectUsageStats` 又对任意 JSON 做裸 cast,
|
|
35
35
|
* 于是 fold 侧的裸算术遇缺席就产出 NaN,**一行毒一整窗**(NaN 沿 Σ 传染,JSON.stringify(NaN)==="null",
|
|
36
36
|
* 消费端读到的是「没有数」而不是「少了一行」)。声明改诚实 + fold 侧 {@link numOf} 数值守卫。
|
|
37
37
|
*/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 墙钟阶跃守卫 —— 给「按墙钟绝对 deadline 做终局判定」的清算腿加一道**单调钟佐证**。
|
|
3
3
|
*
|
|
4
|
-
* 病灶(test [
|
|
4
|
+
* 病灶(test [ref] 场景①,libfaketime 真实构造,宿主真钟全程未碰):审批 SLA=45s,把进程内墙钟
|
|
5
5
|
* **前拨 1 小时**,真实只等了约 14 秒审批卡就被 D-D deny-sweep 判超时自动拒绝。链条是清楚的:
|
|
6
6
|
* `checkpoint.deadline` 是 core 在 `put` 时按**当时的墙钟**铸的绝对时刻(必须是墙钟——它要跨进程
|
|
7
7
|
* 重启存活,单调基准一重启就没了),而 sweep 每拍拿 `Date.now()` 去比 `deadline <= cutoff`。墙钟凭空
|
|
8
8
|
* 前跳 J 毫秒 ⇒ 判定钟凭空多走 J 毫秒 ⇒ 人还没走开,窗就没了。
|
|
9
9
|
*
|
|
10
|
-
* [
|
|
10
|
+
* [ref] core 半场三定性把判定半场划给本仓:`totalWaitMs` 的墙钟**记账**是设计如此(要跨 durable
|
|
11
11
|
* resume 延续),不改形;**判定**侧可以在进程内用单调钟做窗口佐证,与账面字段互不牵连。本模块就是那道佐证。
|
|
12
12
|
*
|
|
13
13
|
* ## 判据(为什么是「宽限一个完整 SLA」)
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
* 不稳的钟判,也不让 fail-closed 腿永远不跑。绝对兜底始终另有一层:`checkpoint.terminal_at_ms` 由别的
|
|
38
38
|
* reap 腿执行、不经本守卫。
|
|
39
39
|
*
|
|
40
|
-
* ## 方向与响亮度(
|
|
40
|
+
* ## 方向与响亮度([ref] 安全轴)
|
|
41
41
|
* 宽限只会**推迟**一个 fail-closed 动作(deny),绝不会放行任何东西 —— 方向安全。但它必须**响亮**:
|
|
42
42
|
* 检出即 warn(带跳变量与宽限量),宽限期内每拍 info。绝对兜底仍在:`checkpoint.terminal_at_ms`
|
|
43
43
|
* (put 时写死的绝对上限)由另一条 reap 腿执行,不经本守卫 ⇒ 悬挂不可能无限。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/server",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.54.0",
|
|
4
4
|
"description": "Sema Server — the server/API implementation layer for Sema, wiring core, registry, model providers, and cloud agent execution. Built on @sema-agent/core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"typecheck": "tsc --noEmit -p tsconfig.typecheck.json",
|
|
39
|
-
"build": "rm -rf dist && tsc -p tsconfig.build-js.json && tsc -p tsconfig.build-dts.json",
|
|
40
|
-
"prepublishOnly": "npm run build",
|
|
39
|
+
"build": "rm -rf dist && tsc -p tsconfig.build-js.json && tsc -p tsconfig.build-dts.json && node scripts/scrub-dist-refs.mjs dist",
|
|
40
|
+
"prepublishOnly": "npm run build && vitest run test/pack-hygiene.test.ts",
|
|
41
41
|
"start": "node dist/main.js",
|
|
42
42
|
"dev": "tsx src/main.ts",
|
|
43
43
|
"run-local": "node dist/run-local.js",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"build:binary:run-local:darwin-arm64": "bun build --compile --target=bun-darwin-arm64 src/run-local.ts --outfile dist/run-local-darwin-arm64"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@sema-agent/core": "7.0
|
|
58
|
-
"@sema-agent/settings-schema": "1.
|
|
57
|
+
"@sema-agent/core": "7.1.0",
|
|
58
|
+
"@sema-agent/settings-schema": "1.3.0",
|
|
59
59
|
"e2b": "^2.28.0",
|
|
60
60
|
"libsodium-wrappers": "^0.8.4",
|
|
61
61
|
"mysql2": "^3.22.4",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"sharp": "^0.35.3"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@sema-agent/sdk": "7.
|
|
72
|
+
"@sema-agent/sdk": "7.4.0",
|
|
73
73
|
"@types/libsodium-wrappers": "^0.7.14",
|
|
74
74
|
"@types/node": "22.10.2",
|
|
75
75
|
"@types/pg": "^8.20.0",
|