@sema-agent/server 7.52.0 → 7.53.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 +22 -5
- 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 +2 -0
- 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/device-lane.js +2 -0
- 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/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/retention-lane.d.ts +1 -1
- package/dist/boot/runner-deps.d.ts +33 -27
- package/dist/boot/runner-deps.js +2 -1
- 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/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 +3 -3
- 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 +20 -7
- package/dist/config-center/apply-effective.js +45 -0
- package/dist/config-center/apply-ledger.d.ts +6 -6
- package/dist/config-center/facade.d.ts +3 -2
- 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 +1 -1
- 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 +23 -19
- package/dist/config-invariants.d.ts +1 -1
- package/dist/config-provider.d.ts +2 -2
- package/dist/config-types.d.ts +157 -134
- package/dist/config.d.ts +32 -24
- package/dist/config.js +48 -6
- package/dist/degenerate-instrument.d.ts +1 -1
- package/dist/deployment-governance.d.ts +13 -13
- package/dist/device-store.d.ts +2 -2
- package/dist/device-ws-hub.d.ts +6 -4
- package/dist/device-ws-hub.js +9 -3
- 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 +56 -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 +12 -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 +23 -21
- 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-bundle.js +2 -3
- 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 +61 -1
- 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 +25 -12
- 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 +38 -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 +9 -9
- 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 +13 -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 +20 -35
- package/dist/memory-origin-fence.js +41 -1
- 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 +1 -5
- package/dist/observability/fail-open.js +0 -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.js +5 -0
- 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 +2 -2
- 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 +5 -5
- 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 +4 -0
- 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.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/run-local.js +28 -4
- package/dist/runs.d.ts +19 -19
- package/dist/runtime-caps-resolver.d.ts +6 -6
- package/dist/runtime-governance.d.ts +7 -7
- 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 +171 -160
- package/dist/tool-approval.js +33 -28
- package/dist/trace/core-keyset-guard.d.ts +21 -7
- package/dist/trace/engine-notice-wire.d.ts +6 -6
- package/dist/trace/injection-tier.d.ts +2 -2
- package/dist/trace/ledger-events.d.ts +3 -3
- package/dist/trace/ledger-sink.d.ts +7 -7
- package/dist/trace/project.d.ts +35 -30
- package/dist/trace/project.js +9 -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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] [CONFIRMED high](2026-08-19 三轴组复审,真机探针复现)—— WebFetch 摘要面的
|
|
3
3
|
* **per-model key plane**,与 `boot/side-query-lane.ts` 同一只 wrapper、同一条纪律。
|
|
4
4
|
*
|
|
5
|
-
* ## 病灶(
|
|
5
|
+
* ## 病灶([ref] 的第四面,逐字同形)
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* [ref] 的头注写「side-query 是 key plane 三面里**唯一**缺席的那一面」—— 那句话是假的。
|
|
8
8
|
* `createWebFetchSummarizer(brain, model)` 的 `brain` 是 `RunnerDeps.brain` 那只**裸网关 brain**
|
|
9
9
|
* (`boot/budget-tracing.ts` 的 `createBrain(config, …)`,`get apiKey()` 恒回 `config.gatewayApiKey`),
|
|
10
10
|
* 而 core 的摘要腿(`dist/tools/web.js`)铸 options 只放 `{ signal }`——`WebFetchSummarizerOptions`
|
|
@@ -12,31 +12,31 @@
|
|
|
12
12
|
* `const apiKey = options?.apiKey ?? config.apiKey;` ← 缺席即回落**主网关 key**
|
|
13
13
|
* `const root = (model.baseUrl || config.baseUrl || "")` ← 却**按模型**选路
|
|
14
14
|
* ⇒ summarize 角色解析到一只带自有 `baseUrl` + `apiKeyEnv/sealedApiKey` 的模型时,**主网关 key 被发到
|
|
15
|
-
* 那只模型自己的外部 URL**;而且这不落在
|
|
15
|
+
* 那只模型自己的外部 URL**;而且这不落在 [ref] 已具名接受的那条残余里(那条说的是「**没有** per-model
|
|
16
16
|
* key 的 off-route 模型仍收网关 key」)—— 这只模型**有**自己的 key,却拿不到。
|
|
17
17
|
*
|
|
18
18
|
* 第二半同样成立:毒丸(sealed key 解不开)在本面**静默回落网关账号** —— 本面根本不经
|
|
19
19
|
* `resolveModelApiKey`,`key-resolver.ts` 顶注那句「a broken sealed key must NEVER silently burn the
|
|
20
20
|
* shared gateway account」在这条路上不成立。
|
|
21
21
|
*
|
|
22
|
-
* ## 修形 = 照
|
|
22
|
+
* ## 修形 = 照 [ref] 的配方接第四面(不是新造语义)
|
|
23
23
|
*
|
|
24
24
|
* brain 换成 `createPerModelKeyBrain(brain, getKeyResolver)`:
|
|
25
25
|
* · 有 per-model key ⇒ 注入 `options.apiKey`,请求带模型自己的凭据;
|
|
26
26
|
* · 无 ⇒ 不注入 ⇒ 交回 core 按它自己的 key↔URL 配对法判(core 5.57.0 起:部署根声明了而 entry URL
|
|
27
27
|
* 不在那个根上 ⇒ `route.credential_mismatch` 响亮拒;未声明部署根 = `"unpinned"` 快速起步姿态 ⇒
|
|
28
|
-
* 照旧回落网关 key。
|
|
29
|
-
* · 毒丸 ⇒ **上抛**,一个字节都不发(CLAUDE.md
|
|
28
|
+
* 照旧回落网关 key。[ref] 的具名残余与其 P-DEBT 腿已在源头清偿,见 side-query-lane.ts 顶注);
|
|
29
|
+
* · 毒丸 ⇒ **上抛**,一个字节都不发(CLAUDE.md [ref] 安全轴 fail-closed)。
|
|
30
30
|
* wrapper 只包本席这一只引用,`RunnerDeps.brain` 零扰动(与 side-query 席同形)。
|
|
31
31
|
*
|
|
32
32
|
* ## 为什么住在 `boot/` 而不是继续躺在 `main()` 的闭包里
|
|
33
33
|
*
|
|
34
34
|
* ① 这是一条**可发射的 LLM 面**,必须能被黑盒探针(真 fetchImpl 捕 Authorization)直接驱动 —— 躺在
|
|
35
|
-
* `main()` 里只能靠源码字面锚,而本仓已成文「源码字面锚有致命假绿形」(
|
|
35
|
+
* `main()` 里只能靠源码字面锚,而本仓已成文「源码字面锚有致命假绿形」([ref]/.11 那一族);
|
|
36
36
|
* ② 发射面枚举门(`test/per-model-key.test.ts` 的 `DIRECT_EMISSION_FACES`)按**文件**登记在册,第四面
|
|
37
37
|
* 有自己的文件才登记得住。
|
|
38
38
|
*
|
|
39
|
-
* 原地保留的两条既有语义(E-MED-2/E-MED-3,[
|
|
39
|
+
* 原地保留的两条既有语义(E-MED-2/E-MED-3,[ref]/[ref] 复审批):
|
|
40
40
|
* · **惰性解析**:模型每次调用现取 —— `config.models`/`config.roles` 会被 center 的 effective 热应用
|
|
41
41
|
* `mutateInPlace` 整表替换,boot 期急求值会把摘要器永久 pin 在占位/旧模型上;
|
|
42
42
|
* · **fail-soft**:`resolveTaskModel` 在无可解析角色时 throw,这是全仓唯一 boot 期裸调用点;解析失败
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] A10:composition root 分段 —— workflow 编排面(run store / notify 门 / completion inbox /
|
|
3
3
|
* fleet 总线 / 可 steer 句柄注册表)。
|
|
4
4
|
*
|
|
5
5
|
* 纯搬运:函数体逐字来自 `main.ts`(原 1315-1441 行),缩进不变;新增的只有 import 与包壳。
|
|
@@ -21,7 +21,7 @@ export declare class BoundedSessionMap<V> {
|
|
|
21
21
|
set(sessionId: string, value: V): void;
|
|
22
22
|
/** `undefined` sessionId or an unregistered session both → `undefined` (non-removing read). */
|
|
23
23
|
get(sessionId: string | undefined): V | undefined;
|
|
24
|
-
/**
|
|
24
|
+
/** [ref]:显式逐出(会话删除级联要它 —— 会话没了,它的进程内缓存条目也必须跟着没)。
|
|
25
25
|
* 返回是否真删掉了一条(幂等:未登记的 session 返回 false)。 */
|
|
26
26
|
delete(sessionId: string): boolean;
|
|
27
27
|
}
|
package/dist/brain.d.ts
CHANGED
|
@@ -15,11 +15,11 @@ export declare const FAST_FAIL_MAX_RETRIES = 2;
|
|
|
15
15
|
* - **Tiered timeouts** (1.38, `connectTimeoutMs`/`firstTokenTimeoutMs`) are passed into each
|
|
16
16
|
* openai-compatible brain at creation — they bound "gateway never accepts the connection" and
|
|
17
17
|
* "stream opened but hangs without a token" as retryable `[network]` failures. Default ON
|
|
18
|
-
* (30s/120s, [
|
|
18
|
+
* (30s/120s, [ref] fleet audit; env =0 disables).
|
|
19
19
|
* - **Circuit breaker** (`createCircuitBreakerBrain`) wraps the *primary* gateway route(s) when
|
|
20
20
|
* `MODEL_CIRCUIT_BREAKER=true`: after N transient failures it opens and fast-fails, so failover
|
|
21
21
|
* switches to the bare backup immediately instead of waiting out each timeout. The last gateway
|
|
22
|
-
* route stays bare (last-resort) — matching core
|
|
22
|
+
* route stays bare (last-resort) — matching core [ref]. State is core's in-process Map (each
|
|
23
23
|
* replica trips independently; cross-replica shared state via a TiDB adapter is a follow-up).
|
|
24
24
|
* - **Failover** (`createFailoverBrain`) stacks the primary gateway with optional
|
|
25
25
|
* `MODEL_GATEWAY_FALLBACK_URLS` — same protocol, same model id, tried in order.
|
|
@@ -29,7 +29,7 @@ export declare const FAST_FAIL_MAX_RETRIES = 2;
|
|
|
29
29
|
*
|
|
30
30
|
* When no fallback URL, no Anthropic key, and no resilience thresholds are configured, this returns the
|
|
31
31
|
* bare openai brain (carrying the default-on watchdog timeouts — set the three env knobs to 0 for the
|
|
32
|
-
* pre-[
|
|
32
|
+
* pre-[ref] fully-bare shape). The Model itself (id / contextWindow / maxTokens / provider) flows
|
|
33
33
|
* per-request through `Runner({ models })`.
|
|
34
34
|
*/
|
|
35
35
|
export declare function createBrain(config: ServiceConfig, deps?: {
|
package/dist/budget.d.ts
CHANGED
|
@@ -41,12 +41,12 @@ export interface ModelUsageDelta {
|
|
|
41
41
|
outputTokens: number;
|
|
42
42
|
cacheReadTokens: number;
|
|
43
43
|
cacheWriteTokens: number;
|
|
44
|
-
/** 🔴
|
|
44
|
+
/** 🔴 [ref](core 2.3.0 起)**可选 = 缺席表示「未知」,不是 0**。unpriced 部署(目录里该模型没配
|
|
45
45
|
* `cost`、也没注 `pricing`)下 core 在 `brain.call` 帧上**整键缺席**,我们如实透传;显式全零 `cost`
|
|
46
46
|
* = 运营者声明免费 ⇒ 键在场且为 0。两者可区分,这正是 #59 折零案的源头修复。
|
|
47
47
|
* 与 SDK `ModelUsageDelta`(五键全可选)/ `usage-analytics.UsageModelEntry` 同轨。 */
|
|
48
48
|
costMicroUsd?: number;
|
|
49
|
-
/** core 3.0.0([
|
|
49
|
+
/** core 3.0.0([ref] 装车单 S10,§DESIGN-V2 V2-⑤)可选口径标记:标出这一行的 token 分量是在哪套记账
|
|
50
50
|
* 基准下写的(当前唯一值 = `"uncached-components-v1"`:`inputTokens` = cache-MISS 分量,`cacheRead`/
|
|
51
51
|
* `cacheWrite` 分列)。**写点在 `trace/project.ts` 的 durable 行构造处**(`appendModelUsageDelta`),
|
|
52
52
|
* 不在这里 —— {@link ModelUsageTracker.record} 的累加逻辑本身零改动,永远不设置这个键(它只在 drain
|
|
@@ -91,7 +91,7 @@ export { type PromptManifestRecord, promptManifestRecordOf, configAssembledRecor
|
|
|
91
91
|
*/
|
|
92
92
|
export declare function createTracer(metrics: Pick<Metrics, "inc" | "observe">, costQuota?: QuotaTracker, modelUsage?: ModelUsageTracker, fleetUsage?: Pick<FleetUsageAccumulator, "record">, fleetLease?: Pick<FleetLeaseManager, "recordSpend">, quotaWeightFor?: (model: string) => number, promptManifests?: PromptManifestTracker): TracerHook;
|
|
93
93
|
/**
|
|
94
|
-
* [
|
|
94
|
+
* [ref] side-query 记账 seam(codex R3 high:sideQuery 不走 core tracer——brain.stream 直调不发
|
|
95
95
|
* brain.call——createTracer 的四路 sink(costQuota/model_cost 指标/fleetUsage 批报/fleetLease 本地扣减)
|
|
96
96
|
* 全部旁路)。本 seam 与 createTracer 的 brain.call 臂**同语义**喂同一组 sink:weightedTokens 同式
|
|
97
97
|
* (tokens×quotaWeight,weight-at-burn 固化)、micro-USD 同轴。装配点与 createTracer 同一处(main.ts),
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical JSON(键递归排序、零空白、数组保序)—— 本仓所有「先序列化再 sha256 / 指纹自比」站点的**单一序列化器**
|
|
3
|
+
* ([ref] / [ref],2026-08-31 合并批)。
|
|
4
|
+
*
|
|
5
|
+
* ## 为什么只能有一个
|
|
6
|
+
* 合并前本仓有 **5 处**手写复刻(memory-origin-fence / permission-rule-store-sql / bench-l8 artifact /
|
|
7
|
+
* config-center restart-signal / mcp-revocation),每处一份「排 key、递归、拼串」——同一个算法五份实现,
|
|
8
|
+
* 语义在边缘(undefined 值键、函数成员、非有限数)各自漂了一点。指纹型代码的病灶恰恰在边缘:同一份内容算出
|
|
9
|
+
* 两个指纹 = 落库 checksum 失配 / 误签 restart / 包完整性自校验对不上。
|
|
10
|
+
*
|
|
11
|
+
* ## 语义 = core `canonicalJsonStringify` 的**逐字港**(fidelity 高于「更漂亮」)
|
|
12
|
+
* 治理携出包(`POST /v1/memory/export`)的 `integrity.sectionHashes.entries` 必须与 core 铸包/校验时算的
|
|
13
|
+
* 哈希**逐字节相同**(core `memoryBundleInvalid` 三向对账),而 core 公共面只出口 `computeMemoryBundleHash`
|
|
14
|
+
* (Record 特化),不出口这只序列化器(`dist/core/memory-engine/file-backend.js#canonicalJsonStringify`,
|
|
15
|
+
* exports 封死)——所以本仓必须持有一份逐字港,且**不得**在下游「修」它的边缘行为(源头修复纪律:
|
|
16
|
+
* core 若改形,港随之改;本仓不做第二个写者)。防漂移钉 = `test/memory-origin-fence.test.ts` §④(期望哈希全
|
|
17
|
+
* 经 core 出口独立算出)。
|
|
18
|
+
*
|
|
19
|
+
* 语义表(与 core 逐字同;`test/canonical-json.test.ts` 逐行钉):
|
|
20
|
+
* · 对象:own 可枚举键,**值为 `undefined` 的键省略**(与 `JSON.stringify` 同),其余按 UTF-16 码元序排序
|
|
21
|
+
* (`Object.keys().sort()`,数字形键同样按字符串序:`"10" < "2"`);键经 `JSON.stringify` 转义。
|
|
22
|
+
* · 数组:保序;元素 `undefined` / 函数 / symbol ⇒ `null`(与 `JSON.stringify` 同)。
|
|
23
|
+
* · 标量:`JSON.stringify`(`NaN`/`±Infinity` ⇒ `null`、`-0` ⇒ `0`、字符串转义与 `JSON.stringify` 同)。
|
|
24
|
+
* · **非 JSON 输入的港继承形(不是本仓的设计,是 core 的形,如实记)**:对象成员为函数/symbol 时,键**保留**
|
|
25
|
+
* 而值经 `JSON.stringify` 得 `undefined` ⇒ 拼出字面 `undefined`(非法 JSON 文本);顶层 `undefined`/函数/symbol
|
|
26
|
+
* ⇒ 返回 `undefined`(非字符串)。五个站点的真实输入全是 JSON 形(JSON.parse 产物 / DB 行 / zod 解析产物),
|
|
27
|
+
* 这两条**不可达**;需要「非法输入响亮拒」的站点用 {@link canonicalJsonStrict}。
|
|
28
|
+
* · `Date`/`Map`/`Set`/类实例:按普通对象处理(own 可枚举键 ⇒ `Date` 成 `{}`),**不调 `toJSON`**——与 core 同。
|
|
29
|
+
* · `bigint`:`JSON.stringify` 抛 TypeError,原样上抛。
|
|
30
|
+
*
|
|
31
|
+
* ## 不在本文件里的第二形(如实登记)
|
|
32
|
+
* `src/config-center/restart-signal.ts#stableStringify`(mcp-revocation 同源改调)是**另一个语义**:undefined 值键
|
|
33
|
+
* **保留为 `"k":null`**。两族在 JSON 形输入上逐字节相同(golden 交叉读数已证),分歧只在进程内构造的
|
|
34
|
+
* `{k: undefined}` 形——restart 指纹的输入正是进程内切片对象,该形原则上可达,而 `{k:undefined}` 与 `{}` 是否
|
|
35
|
+
* 同指纹是 restart-signal 轴上的**行为**(多签/少签一次 fleet 滚动重启),不是序列化器的私事 ⇒ 本批不并
|
|
36
|
+
* (语义恒等才可合并),golden 各自钉,K→O 统一另立件走三问。
|
|
37
|
+
*/
|
|
38
|
+
/** core `canonicalJsonStringify` 的逐字港(语义表见文件头)。 */
|
|
39
|
+
export declare function canonicalJson(value: unknown): string;
|
|
40
|
+
/**
|
|
41
|
+
* 严格形:先按**同一遍历序**校验,再交 {@link canonicalJson} 序列化 —— 被签名/被内容哈希的载荷(bench/l8 部署
|
|
42
|
+
* 真实性 artifact)不许把 `NaN`/`Infinity` 静默写成 `null`(签名盖在坏字节上),也不许把函数/bigint/顶层
|
|
43
|
+
* `undefined` 当作可序列化。校验通过的输入域上,输出与 {@link canonicalJson} **逐字节相同**(golden 钉);
|
|
44
|
+
* 拒绝集与错误文案 = 合并前 `src/bench/l8/artifact.ts#serialize` 逐字(`test/l8-deploy-contract.test.ts` 钉
|
|
45
|
+
* `/non-finite/`):
|
|
46
|
+
* · 非有限数(任意深度)⇒ `canonicalJson: non-finite number is not serializable`
|
|
47
|
+
* · `undefined`(顶层)/ 函数(任意深度,数组元素亦然)⇒ `canonicalJson: <typeof> is not serializable`
|
|
48
|
+
* · `bigint` ⇒ `canonicalJson: bigint is not serializable`;symbol ⇒ `canonicalJson: unsupported type symbol`
|
|
49
|
+
* · 数组元素 `undefined` ⇒ `null`(放行);对象成员 `undefined` ⇒ 省略(放行)。
|
|
50
|
+
* 遍历序 = 数组下标序、对象**排序后**键序(多处坏值时抛出的是遍历序上第一处——与合并前行为同)。
|
|
51
|
+
*/
|
|
52
|
+
export declare function canonicalJsonStrict(value: unknown): string;
|
|
53
|
+
//# sourceMappingURL=canonical-json.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export function canonicalJson(value) {
|
|
2
|
+
if (Array.isArray(value))
|
|
3
|
+
return `[${value.map((v) => (v === undefined || typeof v === "function" || typeof v === "symbol" ? "null" : canonicalJson(v))).join(",")}]`;
|
|
4
|
+
if (value !== null && typeof value === "object") {
|
|
5
|
+
const rec = value;
|
|
6
|
+
const keys = Object.keys(rec)
|
|
7
|
+
.filter((k) => rec[k] !== undefined)
|
|
8
|
+
.sort();
|
|
9
|
+
return `{${keys.map((k) => `${JSON.stringify(k)}:${canonicalJson(rec[k])}`).join(",")}}`;
|
|
10
|
+
}
|
|
11
|
+
return JSON.stringify(value);
|
|
12
|
+
}
|
|
13
|
+
export function canonicalJsonStrict(value) {
|
|
14
|
+
assertCanonicalJsonSerializable(value);
|
|
15
|
+
return canonicalJson(value);
|
|
16
|
+
}
|
|
17
|
+
function assertCanonicalJsonSerializable(v) {
|
|
18
|
+
if (v === null)
|
|
19
|
+
return;
|
|
20
|
+
const t = typeof v;
|
|
21
|
+
if (t === "number") {
|
|
22
|
+
if (!Number.isFinite(v))
|
|
23
|
+
throw new Error("canonicalJson: non-finite number is not serializable");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (t === "boolean" || t === "string")
|
|
27
|
+
return;
|
|
28
|
+
if (t === "undefined" || t === "function")
|
|
29
|
+
throw new Error(`canonicalJson: ${t} is not serializable`);
|
|
30
|
+
if (Array.isArray(v)) {
|
|
31
|
+
for (const x of v)
|
|
32
|
+
assertCanonicalJsonSerializable(x === undefined ? null : x);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (t === "object") {
|
|
36
|
+
const obj = v;
|
|
37
|
+
const keys = Object.keys(obj)
|
|
38
|
+
.filter((k) => obj[k] !== undefined)
|
|
39
|
+
.sort();
|
|
40
|
+
for (const k of keys)
|
|
41
|
+
assertCanonicalJsonSerializable(obj[k]);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (t === "bigint")
|
|
45
|
+
throw new Error("canonicalJson: bigint is not serializable");
|
|
46
|
+
throw new Error(`canonicalJson: unsupported type ${t}`);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=canonical-json.js.map
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* center prompts 消费投影腿([
|
|
3
|
-
* [
|
|
2
|
+
* center prompts 消费投影腿([ref]④/[ref]③ 分工:web 承存储+covering 解析+下发,server 承本模块;
|
|
3
|
+
* [ref] 下发形定稿 / [ref] registry-core 0.10.16 schema / [ref]⑤「server 零新义务=逐字透传」)。
|
|
4
4
|
*
|
|
5
|
-
* 链路:center(sema-web)把 covering 走完的**基线终形**经 `GET /api/config/effective` 的 additive
|
|
5
|
+
* 链路:center(sema-web-admin,2026-08-26 由 sema-web 改名)把 covering 走完的**基线终形**经 `GET /api/config/effective` 的 additive
|
|
6
6
|
* `prompts` key 下发 → 本模块按任务 scenario 选包(`scenarioOverrides[s] ?? sections`,整包替换非增量,
|
|
7
|
-
* [
|
|
7
|
+
* [ref]①c)→ 声明数组**逐字**(含 opt-in `contentHash`,core 1.315 校验+manifest 透传)喂 core 既有
|
|
8
8
|
* typed `stableBlocks` 钩子。守卫全在 core(id 规范/slot 闭集/core/ 命名空间拒绝/identity 三锚
|
|
9
|
-
* pass-through/锁定槽不可写)——server 不做语义复检([
|
|
9
|
+
* pass-through/锁定槽不可写)——server 不做语义复检([ref]①f:identity 完整角色层由 center 编辑面把关)。
|
|
10
10
|
*
|
|
11
11
|
* 仅有的一层「形校验」不是语义复检,是**防炸底线**(详见其现居所 `src/prompts-domain-validate.ts`——
|
|
12
|
-
* 判形半场已下沉到该中立叶子,本文件 re-export 保兼容;
|
|
12
|
+
* 判形半场已下沉到该中立叶子,本文件 re-export 保兼容;[ref] S6,lens2 §G):core 对坏形声明的
|
|
13
13
|
* 守卫是 THROW(assemble 期),server 在采用前做结构判形,坏形=拒绝采用该候选的 prompts 面。
|
|
14
14
|
*
|
|
15
15
|
* 生效语义(两段史):1.222 时 core 1.315 的 epoch 是 bundled-only(声明不进 descriptor),热换=resume
|
|
16
|
-
* 三失真,故临时 restart-to-apply;core 1.316([
|
|
16
|
+
* 三失真,故临时 restart-to-apply;core 1.316([ref] 裁 a/[ref]d)把声明以 (id,slot,chars,contentHash?)
|
|
17
17
|
* 纳入 artifactDigest——声明变=digest 变=**下任务边界自动重 pin**(既有 legacy_migration 机制接手),
|
|
18
18
|
* 进行中会话 epoch pin 保稳。自此恢复**热采用**(main.ts boot+refresh 双点 adopt),与 center
|
|
19
|
-
* 「发布=新任务生效」产品语义对齐([
|
|
20
|
-
* 防会话可导出面字典预映)——center 链路恒逐 section 铸([
|
|
19
|
+
* 「发布=新任务生效」产品语义对齐([ref]②b)。字节级检测只认 opt-in contentHash(文本不进 digest,
|
|
20
|
+
* 防会话可导出面字典预映)——center 链路恒逐 section 铸([ref]),本投影逐字透传即全强度。
|
|
21
21
|
*/
|
|
22
22
|
import { type PromptProvider, type PublishedPromptArtifactEnvelope } from "@sema-agent/core";
|
|
23
23
|
import { type EffectiveCenterPrompts, type PromptsDomainFaces } from "../prompts-domain-validate.js";
|
|
24
24
|
/** 判形半场(validateCenterPrompts/validatePromptsDomain/CORE_ENGINE_VERSION 及两 interface)已下沉到
|
|
25
|
-
* 中立叶子 `src/prompts-domain-validate.ts`(
|
|
25
|
+
* 中立叶子 `src/prompts-domain-validate.ts`([ref] S6);消费者直引真源([ref] 兼容面全清,
|
|
26
26
|
* 此处兼容 re-export 已删)。 */
|
|
27
|
-
/** [
|
|
27
|
+
/** [ref]b / [ref] — §9.4 by-digest 补拉组合店:local miss ⇒ fetchRaw(digest) 从 center 拉 envelope ⇒
|
|
28
28
|
* core verifyPromptArtifact 全管线 + **回验「拿到的=要的」digest 逐位**(center 答非所问=丢弃)⇒
|
|
29
29
|
* best-effort 回写 inner(下次直命中)。任何失败=undefined(诚实缺席,fail-loud 归 core 的
|
|
30
30
|
* prompt_snapshot_unavailable——绝不拼杂交)。 */
|
|
@@ -37,7 +37,7 @@ export declare function withPromptArtifactBackfill(inner: {
|
|
|
37
37
|
info: (msg: string, meta?: Record<string, unknown>) => void;
|
|
38
38
|
warn: (msg: string, meta?: Record<string, unknown>) => void;
|
|
39
39
|
}): typeof inner;
|
|
40
|
-
/** e/b 接线([
|
|
40
|
+
/** e/b 接线([ref]① seam/[ref]e):catalog 轴的两态过渡推进 core 的 CenterPromptSource——
|
|
41
41
|
* present(且身份变)⇒ applySnapshot(core 重验+落盘+原子换 candidate;validate 已过 core verify,
|
|
42
42
|
* 此处失败=磁盘/状态写问题,warn 不挡 declaration 轴);absent-after-present / prompts 键整体消失
|
|
43
43
|
* ⇒ applyDisabled(闸关=显式撤下语义的 catalog 轴半场,离线重启不复活)。幂等安全:同 envelope
|
|
@@ -69,7 +69,7 @@ export declare function centerPromptProvider(prompts: EffectiveCenterPrompts, sc
|
|
|
69
69
|
* M9 迁移卫在 provider.stableBlocks 的 identity 声明上探同三锚,命中即走 pass-through 臂(其保留集无
|
|
70
70
|
* `core/role.append`,任何 append rider/outputStyle 会被静默丢)。选包与 {@link centerPromptProvider}
|
|
71
71
|
* 同式(`overrides[s] ?? sections`);锚谓词由调用方注入(task-settings `hasConstitutionAnchors` 单真源)。
|
|
72
|
-
* [
|
|
72
|
+
* [ref]①f 的「server 不做语义复检」不动:这不是复检语义,是为 capabilities.appendSystemPrompt 的诚实面
|
|
73
73
|
* 探 core 会走哪条臂。 */
|
|
74
74
|
export declare function centerIdentityAssembled(prompts: EffectiveCenterPrompts, scenarioName: string, isAssembled: (text: unknown) => boolean): boolean;
|
|
75
75
|
//# sourceMappingURL=center-prompts.d.ts.map
|
|
@@ -35,7 +35,7 @@ export interface CollabWorkflowProjection {
|
|
|
35
35
|
export declare function projectCollabToWorkflows(templates: readonly CollabTemplateWire[] | undefined): CollabWorkflowProjection;
|
|
36
36
|
export declare function registerCollabWorkflows(workflows: Record<string, CollabWorkflowEntry>): void;
|
|
37
37
|
/** composite WorkflowScriptStore 的 resolveName 前段:collab 命中 ⇒ 内置 team-discussion 脚本+本模板
|
|
38
|
-
* defaultArgs(同名 SHADOW core 内置,
|
|
38
|
+
* defaultArgs(同名 SHADOW core 内置,[ref] §6 1c)。🔴 Object.hasOwn — `name` 是模型供给的
|
|
39
39
|
* (run-workflow-tool 原样传 rawName):裸索引会让 Object.prototype 成员名("constructor"/"toString"/
|
|
40
40
|
* "__proto__"…)假命中 ⇒ 零模板注册也能烧真讨论、且同名文件 store 条目被遮蔽(交叉评审 2026-07-11 MED)。 */
|
|
41
41
|
export declare function resolveCollabWorkflow(name: string): {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] 场景 hands lane —— 「要手的场景」与「无手的场景」在装配层分家。
|
|
3
3
|
*
|
|
4
|
-
* 根本问题(设计小票 §1,案源 [
|
|
4
|
+
* 根本问题(设计小票 §1,案源 [ref]/[ref]/[ref]):core 的手带工具面是 **per-Runner 表态**
|
|
5
5
|
* (`prepare-task`:`handsEnabled = ownedEnv || deps.executionEnv`,ownedEnv 只要挂了
|
|
6
6
|
* `executionEnvFactory` 就每任务必铸)。server 此前全场景共享一只 runner + 一只 subRunner,
|
|
7
7
|
* 于是任何 REMOTE_EXEC 部署里,声明 clone-free 的 `scan`、只有 `run_council` 的评审团、
|
|
@@ -44,11 +44,11 @@ export declare function pickHandsRunner(hands: ScenarioHands, pair: HandsRunnerP
|
|
|
44
44
|
* ⚠️ 本全集是**观测口径**(用于防漂移对账),**不是** deny 名单 —— deny 用下面的
|
|
45
45
|
* {@link HANDS_EXCLUSIVE_TOOL_NAMES},理由见那里。
|
|
46
46
|
*
|
|
47
|
-
* 🚨 [
|
|
47
|
+
* 🚨 [ref] P0(2026-08-09):派生时必须过滤 core 的 `RETIRED_TOOL_NAMES` —— core 5.21.0 的
|
|
48
48
|
* `HAND_TOOL_EFFECTS` 里残留已退役的 `MultiEdit`,而 core `prepare-task` 的策略名审计见退役名
|
|
49
49
|
* **无条件 throw**(`config.legacy_tool_name`);不过滤,deny 名单一进 `spec.toolPolicy`,
|
|
50
50
|
* `hands: none` 三场景(scan/code-review/team)在**所有部署**上零 turn 全灭。core 5.21.1 已删
|
|
51
|
-
* 那条死条目([
|
|
51
|
+
* 那条死条目([ref]),这道 filter 是结构性防御:将来 core 再退役任何 band 名都不会重演
|
|
52
52
|
* (test/scenario-hands-lane.test.ts 格7/格8 双钉:真 Runner 过审计 + 零交集门)。
|
|
53
53
|
* filter 打在**整表**(effect 表 + 锚定补集)之后 —— caret floor 下装置会解析到更新的 core,
|
|
54
54
|
* 补集名哪天被退役,只滤前半就是同一次故障换个名字(codex 复审 finding,2026-08-09)。
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref](板 [ref]②/[ref]④ 两次点名的 server 接线半场)—— 零记忆面部署形的**持久记忆披露**。
|
|
3
3
|
*
|
|
4
|
-
* 病(core [
|
|
4
|
+
* 病(core [ref] 实测,[ref] 立案):一台没有任何持久记忆面的部署,用户说「请记住 X」,模型回一句
|
|
5
5
|
* 「已经记住了」——落盘处并不存在。用户带着「这条事实已入库」的信念离开,下一次会话才发现是空的。
|
|
6
6
|
*
|
|
7
7
|
* core 5.26.0 的分工:引擎**能自证**只读的两态(engine 侧 `writeScope:null` / runner 侧 `handsReadOnly`)
|
|
@@ -41,7 +41,7 @@ export interface MemoryFaceFacts {
|
|
|
41
41
|
/** 部署声明 `MEMORY_PERSISTENCE_CAPABLE`(三态)。`true` = operator 自证有推断看不见的持久通道
|
|
42
42
|
* (自定义 writer / MCP 记忆服务)⇒ 披露会变成假话,撤回;`false` = 强制披露;缺席 ⇒ 走推断。 */
|
|
43
43
|
declaredCapable: boolean | undefined;
|
|
44
|
-
/** 本请求命中场景的手带表态(
|
|
44
|
+
/** 本请求命中场景的手带表态([ref] 判别位)。`none` = 该场景跑在不挂 `executionEnvFactory` 的 Runner 上,
|
|
45
45
|
* core 的手带 band(Bash/Edit/Write/…)整批不 mount。 */
|
|
46
46
|
hands: ScenarioHands;
|
|
47
47
|
/** 折完 governance+settings 后的最终 `handsReadOnly`(plan 模式 / autonomy 收窄)。手带只剩读腿。 */
|
|
@@ -56,7 +56,7 @@ export interface MemoryFaceFacts {
|
|
|
56
56
|
* `handsEnabled && isRemoteExecutionEnv` 时把 Write/Edit/NotebookEdit/Bash **全部不算**落盘路(沙箱盘
|
|
57
57
|
* 每任务即焚,够不着 host 记忆根)。而 server 在任何 remote 车道上默认让记忆引擎 dark —— 两件事合起来
|
|
58
58
|
* 正是**最常见的云部署形**:引擎不在、手带在,却一份持久面都没有。漏了这一位,那台机器就继续给
|
|
59
|
-
* 「已经记住了」的幻觉式回执 —— 恰恰是
|
|
59
|
+
* 「已经记住了」的幻觉式回执 —— 恰恰是 [ref] 立案要消灭的形态。 */
|
|
60
60
|
remoteExecutionEnv: boolean;
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
@@ -4,12 +4,12 @@ import type { PromptProvider } from "@sema-agent/core";
|
|
|
4
4
|
* `stableSystem` returns ONLY the role layer (base + the task's own systemPrompt) and **core appends
|
|
5
5
|
* the constitution structurally** — harness/safety blocks (Truth/CYBER_RISK/URL_SAFETY), mode blocks,
|
|
6
6
|
* AND the memory safety/hygiene guidance (`constitutionBlocks`), plus the volatile `<user_memory>`
|
|
7
|
-
* tail LAST (
|
|
7
|
+
* tail LAST ([ref] prefix-cache discipline; guarded in CI by `assertPromptCacheFriendly`).
|
|
8
8
|
*
|
|
9
9
|
* History: the pre-1.243 seam made this helper's whole-prompt replacement silently DROP
|
|
10
10
|
* core's constitution — oa/code-review/team ran with zero safety blocks. Same batch also moved
|
|
11
11
|
* MEMORY_SAFETY/MEMORY_HYGIENE into the constitution layer, so the hand-composition this helper used
|
|
12
|
-
* to do (core 1.62,
|
|
12
|
+
* to do (core 1.62, [ref]) would now DOUBLE-inject them — both removed; core owns the discipline
|
|
13
13
|
* (consolidation mutual-exclusion included). This stays a thin role-layer join so scenarios don't
|
|
14
14
|
* re-implement the same two-line body five times.
|
|
15
15
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* when core destroys the env. No core change, no parallel abstraction — pure deployment glue on a seam
|
|
9
9
|
* the deployment already owns.
|
|
10
10
|
*
|
|
11
|
-
* The send itself is the anti-relay shape ([
|
|
11
|
+
* The send itself is the anti-relay shape ([ref]; k8s workspace-snapshot posture): the server presigns a
|
|
12
12
|
* single-object PUT (120s, method-bound, STAGING key — 修3), the SANDBOX `curl -T`s the file straight to S3 — bytes never
|
|
13
13
|
* relay through the server, S3 credentials never enter the sandbox. Tenant isolation = the sandbox can
|
|
14
14
|
* only read its own filesystem, which is exactly the tenant's task workspace; that is why this lane is
|
|
@@ -85,7 +85,7 @@ export declare class TaskEnvRegistry {
|
|
|
85
85
|
* residue of tenant B's task → the isolation premise FAILS. Multi-tenant here would be an
|
|
86
86
|
* arbitrary-host-path-read → public-URL exfil face, so the lane opens ONLY single-user
|
|
87
87
|
* (`requirePrincipal !== true`), the exact gate the host lane uses. NOT a lane to "fix later with a
|
|
88
|
-
* per-task workspace": tasks legitimately operate outside any workspace on a real host (
|
|
88
|
+
* per-task workspace": tasks legitimately operate outside any workspace on a real host ([ref] —
|
|
89
89
|
* batch deployment), so per-task dirs would not restore the boundary anyway.
|
|
90
90
|
* - adb / local-docker / host / unset: no registry (host+unset use the local-fs source in main.ts;
|
|
91
91
|
* adb/local-docker remain a follow-on).
|
|
@@ -19,21 +19,21 @@ export interface ScenarioBundle {
|
|
|
19
19
|
tools: ToolSpec[];
|
|
20
20
|
skills: SkillSpec[];
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* [ref]:本场景对 core 手带工具面(Bash/Edit/Write/Read/Grep/…)的表态 —— **必填闭集**。
|
|
23
23
|
* `full` = 任务跑在挂了 `executionEnvFactory` 的 Runner 上(core 把 band 并集进 roster);
|
|
24
24
|
* `none` = 跑在不挂 factory 的 Runner 上(band 根本不 mount,工具 schema 对模型不可见)。
|
|
25
|
-
* 必填是设计的一半:新场景不表态 = 编译红,而不是静默继承 full(那正是 [
|
|
25
|
+
* 必填是设计的一半:新场景不表态 = 编译红,而不是静默继承 full(那正是 [ref] 的病灶——
|
|
26
26
|
* `scan` 声明 clone-free 四件、实际拿到全量可写手)。
|
|
27
27
|
*/
|
|
28
28
|
hands: ScenarioHands;
|
|
29
29
|
promptProvider?: PromptProvider;
|
|
30
|
-
/** [
|
|
31
|
-
* bench 态差距三件之一。[
|
|
30
|
+
/** [ref] 场景解释层定死的终验开关(core TaskSpec.finalVerification):bench 实测产品默认请求与
|
|
31
|
+
* bench 态差距三件之一。[ref] 起无场景定死(autonomous 退役)——纯 caller 显式旋钮;spec 组装处 OR 折入(场景只会
|
|
32
32
|
* 多加一轮收官验证,绝不收窄 caller 意图),壳/caller 不感知。 */
|
|
33
33
|
finalVerification?: true;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* [ref]:场景工厂的**服务端事实**上下文 —— 与 `req`(= 调用方请求体,不可信)分开的第三个入参。
|
|
37
37
|
* 这里的每一位都由鉴权信道解析,调用方无法自报;新增位一律走本接口,绝不往 `req` 上加。
|
|
38
38
|
*/
|
|
39
39
|
export interface ScenarioContext {
|
|
@@ -55,9 +55,9 @@ export interface ScenarioDeps {
|
|
|
55
55
|
/** In-memory runner for ephemeral sub-tasks (council lenses/arbiter) — keeps them out of TiDB. */
|
|
56
56
|
subRunner: Runner;
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* [ref]:`subRunner` 的无手孪生 —— 同 deps,唯独不挂 `executionEnvFactory`。hands=none 的场景把它交给
|
|
59
59
|
* 自己造的子任务工具(council 的 lens/arbiter、discuss 的成员/synthesizer):那些子任务只该读仓库/讨论,
|
|
60
|
-
* 拿全量可写手是 [
|
|
60
|
+
* 拿全量可写手是 [ref] 病灶里最意外的一支(零工具人格照拿 Bash)。取用一律走 {@link pickHandsRunner},
|
|
61
61
|
* 不在场景体内手挑 —— 判别位是唯一开关。
|
|
62
62
|
*/
|
|
63
63
|
handslessSubRunner: Runner;
|
|
@@ -71,9 +71,9 @@ export interface ScenarioDeps {
|
|
|
71
71
|
/** Deployment-injected WebSearch backend (Brave/Tavily/SearXNG via `WEB_SEARCH_PROVIDER`). When set,
|
|
72
72
|
* `assembleCodeTools` mounts the WebSearch tool; absent ⇒ not assembled (core ships no search backend). */
|
|
73
73
|
webSearch?: WebSearchConfig;
|
|
74
|
-
/** [
|
|
74
|
+
/** [ref]/[ref] WebFetch 摘要器(core `makeWebFetchSummarizer(brain, summarize 角色模型)` 的产物,
|
|
75
75
|
* main.ts 构造一次注入)。在场 ⇒ 装配实参携 `webFetch.summarize`——带 prompt 的 WebFetch 走 cheap
|
|
76
|
-
* 模型摘要而非整页灌上下文([
|
|
76
|
+
* 模型摘要而非整页灌上下文([ref] L1 的 ~660× 放大就是这缝);缺席 ⇒ `webFetch` 键不铸(修前
|
|
77
77
|
* 字节形,core 落「summarization unavailable」诚实兜底)。 */
|
|
78
78
|
webFetchSummarize?: NonNullable<NonNullable<WebFetchConfig["summarize"]>>;
|
|
79
79
|
metrics?: Metrics;
|
|
@@ -97,14 +97,14 @@ export interface ScenarioDeps {
|
|
|
97
97
|
*/
|
|
98
98
|
subagentExtraTools?: (ctx: SubagentSpawnContext) => ToolSpec[];
|
|
99
99
|
/**
|
|
100
|
-
* core 1.364 durable background agents(
|
|
100
|
+
* core 1.364 durable background agents([ref] S1,[ref] 提货单②写半场):后台子代 `a*` 行的
|
|
101
101
|
* durable 执行记录 store。**必须与 `RunnerDeps.backgroundAgentStore` 同实例**(读写双点配对,engine
|
|
102
|
-
* 无法核对——半接=静默死特性,
|
|
102
|
+
* 无法核对——半接=静默死特性,[ref]①)。绝不在这里另起实例。absent ⇒ pre-151 行为(settle 后
|
|
103
103
|
* eager release,读面纯 live)。
|
|
104
104
|
*/
|
|
105
105
|
backgroundAgentStore?: BackgroundAgentStore;
|
|
106
106
|
/**
|
|
107
|
-
* core 1.382(
|
|
107
|
+
* core 1.382([ref] 二拍B 件1+件2,parked 状态机)[ref] 提货单①②:「同车必接」的一对——core
|
|
108
108
|
* `parkEligible` 门要求 checkpointStore 与 ensureChildSessionDurable **全在场**才成立,任一缺席 = 净是
|
|
109
109
|
* pre-153 行为(子代 SAFETY ask 照旧 deny+continue,零回归)。
|
|
110
110
|
* - `checkpointStore` 必须与 `RunnerDeps.checkpointStore`(主 runner 的 per-task spec 面)**同实例**
|
|
@@ -121,7 +121,7 @@ export interface ScenarioDeps {
|
|
|
121
121
|
checkpointStore?: CheckpointStore;
|
|
122
122
|
ensureChildSessionDurable?: (sessionId: string) => Promise<void>;
|
|
123
123
|
/**
|
|
124
|
-
*
|
|
124
|
+
* [ref]([ref] F2 症状 → [ref] 定谳):**会话级**任务清单店解析器,属主 =
|
|
125
125
|
* `boot/task-list-lane.ts` 的 {@link import("../boot/task-list-lane.js").createTaskListLane}
|
|
126
126
|
* (boot 期构造一次,SQL 后端在场接对应 twin、否则进程级 per-session 内存店)。
|
|
127
127
|
*
|
|
@@ -161,10 +161,10 @@ export { SEMA_IDENTITY } from "./prompts/identity.js";
|
|
|
161
161
|
*/
|
|
162
162
|
export declare function semaIdentityProvider(): PromptProvider;
|
|
163
163
|
/**
|
|
164
|
-
* `code` 场景的提示词提供者([
|
|
165
|
-
* {@link CODE_SYSTEM_PROMPT}(core 1.298 [
|
|
164
|
+
* `code` 场景的提示词提供者([ref] 造,[ref] clay 裁定改名 autonomous→code):role 基底 = core
|
|
165
|
+
* {@link CODE_SYSTEM_PROMPT}(core 1.298 [ref] 改名批正名,旧名 FULL_BODY_SYSTEM_PROMPT=恒等
|
|
166
166
|
* 别名过渡窗;CODE_AGENT persona + AUTONOMY_SELF_AUDIT + ANTI_VERBOSITY +
|
|
167
|
-
* TOOL_PARAM_JSON;[
|
|
167
|
+
* TOOL_PARAM_JSON;[ref] 谱系定论 = CC 生产编码提示词的蒸馏去牌版,底本随 CC 版本对表 cc-anchors,
|
|
168
168
|
* 非自研)——与 bench 的请求组装完全同源,引用 core 常量随版本走,绝不复制字符串(tb bench 实测:
|
|
169
169
|
* 产品默认请求与同引擎 bench 态的差距根因就在这三件 persona/自检/终验)。品牌层与
|
|
170
170
|
* {@link semaIdentityProvider} 同构:brandIdentity 开时 SEMA_IDENTITY 叠在 role 基底之上;任务自带
|
|
@@ -48,7 +48,7 @@ export interface LoadSkillsOptions {
|
|
|
48
48
|
export declare function assertConfined(p: string, rootReal: string, label?: string): void;
|
|
49
49
|
export declare function loadSkills(dir: string, opts?: LoadSkillsOptions): LoadedSkill[];
|
|
50
50
|
/** Skills applicable to a scenario: those tagged with it, plus untagged (global) ones.
|
|
51
|
-
*
|
|
51
|
+
* [ref]:alias 窗撤销,单键查询——退役旧名标签不再命中(迁移面在 7.44 发车帖/MIGRATION 记载)。 */
|
|
52
52
|
export declare function skillsForScenario(loaded: LoadedSkill[], scenario: string): SkillSpec[];
|
|
53
53
|
export declare function parseFrontmatter(raw: string): {
|
|
54
54
|
meta: Record<string, string>;
|
|
@@ -5,7 +5,7 @@ import type { Logger } from "../observability/logger.js";
|
|
|
5
5
|
* Packaged as ONE tool the lead calls once (same shape as the code-review council), so the run model is
|
|
6
6
|
* unchanged.
|
|
7
7
|
*
|
|
8
|
-
* ── 词汇(
|
|
8
|
+
* ── 词汇([ref] / [ref],clay 直裁 [ref])──────────────────────────────────────────────────────
|
|
9
9
|
* 「team」= agent-teams(持久具名团队)专用词;一次性多 agent 讨论叫「discuss」。所以**面向调用方/
|
|
10
10
|
* 模型的名字**全部是 discussion:场景 `discuss`、工具 `run_discussion`、协调者提示词。
|
|
11
11
|
* 而**模板注册面**(`BUILTIN_TEAMS` / `registerTeams` / `getTeam` / center 的 `teams` 键)保留 team
|
|
@@ -54,8 +54,8 @@ export declare function teamNames(): string[];
|
|
|
54
54
|
export declare const DISCUSSION_TOOL_NAME = "run_discussion";
|
|
55
55
|
/**
|
|
56
56
|
* Build the discussion tool bound to a template + the consumer's per-call business injection.
|
|
57
|
-
*
|
|
58
|
-
* 部署=「工具不存在」,[
|
|
57
|
+
* [ref]:[ref] 过渡窗的 `run_team` 同款别名已随 `SCENARIO_ALIASES` 同批删(prompts 写死旧名的
|
|
58
|
+
* 部署=「工具不存在」,[ref]/7.44 发车帖点名的预告语义)。
|
|
59
59
|
*/
|
|
60
60
|
export declare function createDiscussionTools(subRunner: Runner, template: TeamTemplate, opts: {
|
|
61
61
|
objective: string;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* [
|
|
2
|
+
* [ref]④ defer face — EXPERIMENTAL long-tail per-tool defer (default OFF, `TOOL_DEFER_LONGTAIL=true`).
|
|
3
3
|
*
|
|
4
4
|
* Mechanics recap (core 1.287+ `tool-disclosure.js`, read for this assessment):
|
|
5
5
|
* - candidates for deferral are ONLY `spec.tools` (scenario/user tools) + MCP tools — core's first-party
|
|
6
6
|
* roster (Bash/Read/Edit/Grep/Glob/Write/…) is structurally NEVER deferred, so the CC "12 core tools
|
|
7
7
|
* inline" posture holds without any server action;
|
|
8
|
-
* ⚠️ **这句在中间那些世代上一度不成立**(
|
|
9
|
-
* 也卷进候选,小窗模型上首用即激活错;core 5.40.0(
|
|
8
|
+
* ⚠️ **这句在中间那些世代上一度不成立**([ref] 件⑤ 对表):`deferMode:"auto"` 的压力阀曾把内建 fs 族
|
|
9
|
+
* 也卷进候选,小窗模型上首用即激活错;core 5.40.0([ref] a 案,判据帖 [ref] 翻面清单 #3)把阀候选
|
|
10
10
|
* 收回 caller specs,**内建恒 inline**,于是这句话重新为真。**对本仓零行为影响**——理由是下一条:
|
|
11
11
|
* 我们从不开 auto。这一段留着是因为它是那次漂移的出处(数字对了而理由没对,是最难查的一类)。
|
|
12
12
|
* - MCP tool names are ALWAYS deferred (unconditional in `classifyDeferred`) — no server knob needed;
|
|
13
13
|
* - `RunnerDeps.deferMode:"auto"` is ALL-OR-NOTHING over the candidates (defers every spec tool once their
|
|
14
14
|
* combined inline chars exceed 10% of the window) — on our default scenario that would defer Agent and the
|
|
15
15
|
* Task quartet too, the OPPOSITE of the CC posture, so we deliberately do NOT enable it;
|
|
16
|
-
* 🔴 该判断在 core 5.40.0 上**逐字仍成立**(
|
|
16
|
+
* 🔴 该判断在 core 5.40.0 上**逐字仍成立**([ref] 件⑤ 亲验):5.40 收窄的是「内建卷不卷进来」,而
|
|
17
17
|
* Agent / Task 四件是 **caller spec 工具**,收窄后照样在候选池里 —— 所以「开了 auto 就会 defer 掉
|
|
18
18
|
* CC 姿势工具」这条不开 auto 的理由没有被这次收窄消解。
|
|
19
19
|
* 我方**从不接线**这个座:全树零 `RunnerDeps.deferMode` 赋值(`deferModelPlane` 是 config-center 的
|
|
20
|
-
* 同形近名,与本轴无关)。机器钉见 test/tool-defer.test.ts 的
|
|
20
|
+
* 同形近名,与本轴无关)。机器钉见 test/tool-defer.test.ts 的 [ref] 件⑤ 格 —— 这条「零接线」正是本仓
|
|
21
21
|
* 在两个 core 世代之间行为逐字不变的**全部**依据,所以它值一根钉而不只是一句注。
|
|
22
22
|
* - per-tool `ToolSpec.defer:true` is the precise instrument — that is what this helper applies.
|
|
23
23
|
*
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* spontaneous "send the user the artifact" behavior it exists for → NOT in the defer set. That leaves
|
|
30
30
|
* SelectEnvironment (~210 tokens; a discover-then-bind verb whose trigger scenario plausibly drives a
|
|
31
31
|
* ToolSearch query) as the only honest candidate — a marginal win, hence experimental + default off, with the
|
|
32
|
-
* final call left on the board ([
|
|
32
|
+
* final call left on the board ([ref]③ honesty-over-preemption).
|
|
33
33
|
*/
|
|
34
34
|
import type { ToolSpec } from "@sema-agent/core";
|
|
35
35
|
/** The long-tail set (names). Deliberately tiny — see the module header for why each other tool is excluded. */
|