@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
|
@@ -31,7 +31,7 @@ export type CommandRule = {
|
|
|
31
31
|
decision: "allow" | "ask" | "deny";
|
|
32
32
|
};
|
|
33
33
|
/** True when `name` names a DELEGATION tool — the subagent tool(CC-187 canonical `"Agent"`,core
|
|
34
|
-
* `DEFAULT_SUBAGENT_TOOL_NAME`)。5.0.0
|
|
34
|
+
* `DEFAULT_SUBAGENT_TOOL_NAME`)。5.0.0 [ref]:折叠面退役,RAW 比对 core 单源常量——旧名("Task")
|
|
35
35
|
* 在 core roster 层响亮 miss,不再需要归一;单源常量本身就防了当年 1.202 改名时裸字符串失配的
|
|
36
36
|
* fail-open(那个教训的解=引用常量,不是折叠)。 */
|
|
37
37
|
export declare function isDelegationToolName(name: string): boolean;
|
|
@@ -94,7 +94,7 @@ export declare function compileCommandPolicy(rules: CommandRule[] | undefined):
|
|
|
94
94
|
*/
|
|
95
95
|
export declare function autonomyOverrides(autonomy: Autonomy | undefined): Partial<TaskSpec>;
|
|
96
96
|
/**
|
|
97
|
-
*
|
|
97
|
+
* [ref]:**部署级**判据 —— 本部署的治理层自己是否把 shellGate 抬到 `"always"`。
|
|
98
98
|
*
|
|
99
99
|
* 用途 = 持久门(park 行)的出身归因。活卡腿判「这只 ask 是治理层产的」靠 ALS 标记表(见本文件
|
|
100
100
|
* `createGovernanceAskMarkingPolicy` / `createGovernanceShellGateMarkPolicy`),而 park 腿天然跨副本、
|
|
@@ -134,23 +134,23 @@ export declare function governanceMandatesShellGateAlways(governance: {
|
|
|
134
134
|
* override would LOOSEN a stricter base safety field — surfacing a misconfiguration loudly instead of silently
|
|
135
135
|
* weakening the gate. Returns `base` untouched when there is nothing to apply.
|
|
136
136
|
*
|
|
137
|
-
*
|
|
137
|
+
* [ref]([ref] server 分单②):`MANUAL_MODE_SHELL_GATE` 从 settings 折叠搬到这里**无条件施加**。旧家
|
|
138
138
|
* (task-settings deriveSettingsPolicy 的 default/auto/acceptEdits 三臂)让一个**部署级 tighten-only 旋钮
|
|
139
139
|
* 的生死由客户端表态在场性决定**:body 无 settings/permissionMode(cli print/headless 腿按设计不 stamp)
|
|
140
140
|
* ⇒ 旋钮静默失效(clay 实机 Monitor 案「门根本没铸」);bypassPermissions 一句话掀掉部署闸;非 host lane
|
|
141
141
|
* fsWriteGate wiring 不建 ⇒ 沙箱 lane 全失效。governance 层与 autonomy 同拍施加后三者全闭。rank 合成:
|
|
142
142
|
* autonomy 派生值与旋钮取大(ask→"always" 压过 "classify"),再对 base 只升不降(防 tightenTaskSpec throw)。
|
|
143
143
|
*
|
|
144
|
-
*
|
|
144
|
+
* [ref]([ref] issue #29,**邻仓 test AI 的 46 格真机矩阵**实证——不是本仓的钉,别到本仓文件里数 46;
|
|
145
145
|
* 本仓的类级门是 test/operator-knob-client-posture-matrix.test.ts 的 旋钮×表态×lane 矩阵):
|
|
146
|
-
* `SENSITIVE_WRITE_PATTERNS` 是
|
|
146
|
+
* `SENSITIVE_WRITE_PATTERNS` 是 [ref] 那次搬家漏下的兄弟旋钮——同一个病灶原样复发在 sensitive-path
|
|
147
147
|
* DENY 腿上(唯一合成点在 deriveSettingsPolicy 的 fsWriteGate 闭包,bypassPermissions/键缺席/settings
|
|
148
148
|
* 整缺席三形整条腿不建)。同方修:调用方(resolve-spec)把 operator 守卫集预铸成 `sensitivePathPolicy`
|
|
149
149
|
* 从这里**无条件施加**——它只在守卫段上产 deny(core 语义 deny/"safety"),对其余目标返回的是
|
|
150
150
|
* `action:"allow"`(**不是**「无意见」这种第三态:core 的 ToolPolicy 没有弃权值。它在
|
|
151
151
|
* `combinePolicies` 的 deny/ask 优先折叠里不构成一票,所以在**折叠语境**下等价于弃权;若日后有人把
|
|
152
152
|
* 这条策略单独当成唯一 policy 用,那个 allow 就是真放行——别照抄这句话去别的语境)。于是对 bypass
|
|
153
|
-
* 只挡守卫段、不给普通目标加 ask 门([
|
|
153
|
+
* 只挡守卫段、不给普通目标加 ask 门([ref] 表第四行「bypass=不加门非开门」保持逐字)。策略在这里
|
|
154
154
|
* 只组合不构造:裁决 env 的 lane 分形(host 真 fs / 沙箱 deferred 代理)是 resolve-spec 的属主知识,
|
|
155
155
|
* governance 层不重复它。
|
|
156
156
|
*/
|
|
@@ -159,7 +159,7 @@ export declare function applyRuntimeGovernance(base: TaskSpec, governance: {
|
|
|
159
159
|
commandPolicy?: CommandRule[];
|
|
160
160
|
manualModeShellGate?: "always" | "classify";
|
|
161
161
|
sensitivePathPolicy?: ToolPolicy;
|
|
162
|
-
/** [
|
|
162
|
+
/** [ref]/[ref] `governanceForced` 的标记表(缺省 = **当前 run 腿的 ALS 表**,见
|
|
163
163
|
* `governance-ask-marks.ts` 顶注「作用域」段)。注入口只为测试与将来的多实例形。 */
|
|
164
164
|
askMarks?: GovernanceAskMarks;
|
|
165
165
|
}): TaskSpec;
|
package/dist/security.d.ts
CHANGED
|
@@ -38,17 +38,17 @@ export interface SessionListItem {
|
|
|
38
38
|
* 不含读面,也不含 `POST /v1/tasks` 那条提交腿 —— 它有自己的同族门(别重复拦,双拦会让错误归因变糊)。
|
|
39
39
|
*/
|
|
40
40
|
export declare function isDestructiveSessionWrite(method: string, url: string): boolean;
|
|
41
|
-
/** [
|
|
42
|
-
* 也是壳 [
|
|
41
|
+
/** [ref] 窄互认第二臂的租户键字面量 —— 单机形下 core 写侧 `spec.principal ?? "default"` 铸出的那一个,
|
|
42
|
+
* 也是壳 [ref]G1 翻面后随请求带的那一个。**不是哨兵**([ref] 措辞):它是单机形的真租户键。 */
|
|
43
43
|
export declare const LEGACY_UNOWNED_AMNESTY_TENANT = "default";
|
|
44
44
|
/**
|
|
45
|
-
* [
|
|
45
|
+
* [ref] 窄互认**第二臂**(clay 裁 A / [ref] 下达;cli [ref] 表态即发)—— `legacyShellOwner`
|
|
46
46
|
* (本文件 createAuthorizer 内 + http/server.ts `runOwnerOk`)的对称孪生。
|
|
47
47
|
*
|
|
48
48
|
* 病灶:7.8.0 第一臂承接的是 `owner === "anon:shell-live"` 哨兵行;此后壳把无主表示法归一为
|
|
49
49
|
* **缺席**,于是 1.0.82 及更早留下的存量会话 owner 列是 **null**。壳 1.0.83 起随请求带
|
|
50
|
-
* `default` 主([
|
|
51
|
-
* **列表不出现 / fork 404 / delete 静默 {deleted:false} / workspace 404**(三面矩阵 [
|
|
50
|
+
* `default` 主([ref] G1 闸口),`null !== "default"` ⇒ 存量会话在 session 面
|
|
51
|
+
* **列表不出现 / fork 404 / delete 静默 {deleted:false} / workspace 404**(三面矩阵 [ref] 面3;
|
|
52
52
|
* fleet 面与 run 读面天然连续,面1/面2 零施工)。
|
|
53
53
|
*
|
|
54
54
|
* 🔒 **三条件缺一不放行**(与第一臂同源,不是兼容臂):
|
|
@@ -62,13 +62,13 @@ export declare const LEGACY_UNOWNED_AMNESTY_TENANT = "default";
|
|
|
62
62
|
*
|
|
63
63
|
* ── 逐面判过、**刻意不放行**的三处(免得后人当遗漏再补一次)────────────────────────────────
|
|
64
64
|
* · `runOwnerOk` 三读面(head / audit 单读 / events):`owner === null` 那一支**本来就放行**
|
|
65
|
-
* (判据是 `owner !== null && principal !== owner`),不需要本臂。[
|
|
65
|
+
* (判据是 `owner !== null && principal !== owner`),不需要本臂。[ref] 帖文里「单读 404」一句
|
|
66
66
|
* 经亲读实现行**不成立**,已加现状钉(session-head-probe.test.ts)锁住这个事实。
|
|
67
67
|
* · `PUT /v1/sessions/:id/policy` 的 `owner === null ⇒ 409 conflict.session_ownerless`:那是**有意的
|
|
68
68
|
* fail-closed** —— 无主会话没有稳定的 run-principal,存下去的规则读不到、静默失效。放宽它等于制造
|
|
69
69
|
* 一条 fail-open,不在本臂辖域。
|
|
70
70
|
* · `…/sync/*`(PULL/PUSH/import):PULL 虽是只读、形同 workspace,但这一族**带一条破坏性 import 腿**
|
|
71
|
-
* (`isDestructiveSessionWrite` 明列),而 [
|
|
71
|
+
* (`isDestructiveSessionWrite` 明列),而 [ref]/[ref] 裁的是会话**读面与生命周期**四门。放宽一个
|
|
72
72
|
* 写面族超出裁定射程 —— 要做另立一次表态,不在本臂里顺手带过。
|
|
73
73
|
*
|
|
74
74
|
* @param requirePrincipal `config.requirePrincipal`(条件①)
|
|
@@ -89,7 +89,7 @@ export type OwnerAwareSessionStore = SessionStore & {
|
|
|
89
89
|
ownerOf?: (sessionId: string) => Promise<string | null | undefined>;
|
|
90
90
|
register?: (sessionId: string, owner: string | null) => Promise<void>;
|
|
91
91
|
/** E16 — enumerate the caller's sessions (owner-filtered on the session store's OWN owner column).
|
|
92
|
-
* `includeUnowned` = [
|
|
92
|
+
* `includeUnowned` = [ref] 窄互认第二臂的**第三条件**(`owner IS NULL`)的 SQL 承载位:置真时
|
|
93
93
|
* 谓词放宽为 `owner = ? OR owner IS NULL`。只在 `owner` 在场时有意义(路由已判①③);`owner` 缺席
|
|
94
94
|
* (fleet-wide)时本位无效——那一面本来就不钉 owner。 */
|
|
95
95
|
listSessions?: (opts: {
|
|
@@ -107,7 +107,7 @@ export type OwnerAwareSessionStore = SessionStore & {
|
|
|
107
107
|
/** E18 — the session's current leaf `SessionTreeEntry.id` (a cache-bypassing single read), so the resume-at
|
|
108
108
|
* turn-capture can pair it with the turn's message eventId. null when the session has no leaf / does not exist. */
|
|
109
109
|
getLeafId?: (sessionId: string) => Promise<string | null>;
|
|
110
|
-
/** [
|
|
110
|
+
/** [ref] 六轮复审:owner+leafId 单行原子快照(SSE watch 探针租户围栏读;两独立读在 delete/reclaim
|
|
111
111
|
* 缝里可拼出混世代组合)。undefined=无此会话。 */
|
|
112
112
|
getHead?: (sessionId: string) => Promise<{
|
|
113
113
|
owner: string | null;
|
|
@@ -190,7 +190,7 @@ export interface AuthContext {
|
|
|
190
190
|
/** Long-term memory scope, derived from the principal (not the body). Undefined disables memory. */
|
|
191
191
|
memoryScope?: string;
|
|
192
192
|
/** 142-S4:the request's SHAPE-VALIDATED **且已归一(小写)** 的 projectId(body.projectId 过 core
|
|
193
|
-
* `PROJECT_ID_REGEX` 门后折小写回传;
|
|
193
|
+
* `PROJECT_ID_REGEX` 门后折小写回传;[ref]/[ref] 宽读严写 —— 词法带 /i 收下大写形,但派生 scope 键
|
|
194
194
|
* 与 config.projects 查表都只认这一个归一形,否则同一个项目会按大小写分成两只记忆盘)。
|
|
195
195
|
* 身份半场(scope 的 tenant 段)永远来自 verified principal — projectId 只选「哪个项目盘/哪条登记」
|
|
196
196
|
* (config.projects 查表键 + proj: 键的 projectId 段),不是 capability。main.ts 拿它查 defaultScopes。 */
|
|
@@ -252,7 +252,7 @@ export declare function assertPrincipalShape(principal: string): void;
|
|
|
252
252
|
* each call site re-deriving the "_" ⇄ no-principal mapping inline. */
|
|
253
253
|
export declare const CHECKPOINT_PUBLIC_SCOPE: "_";
|
|
254
254
|
/**
|
|
255
|
-
* 🔴
|
|
255
|
+
* 🔴 [ref](2026-08-19)—— **后台子代注册簿的匿名租户键**,与上面那只 checkpoint 哨兵是
|
|
256
256
|
* 「同一件事(没有 principal)的两套写法」。
|
|
257
257
|
*
|
|
258
258
|
* 写侧不是本仓能单方面改的:core 的 `treeScope = reviveClaim?.row.scope ?? ctx.principal ??
|
|
@@ -265,7 +265,7 @@ export declare const CHECKPOINT_PUBLIC_SCOPE: "_";
|
|
|
265
265
|
*/
|
|
266
266
|
export declare const BACKGROUND_REGISTRY_ANON_SCOPE: "default";
|
|
267
267
|
/**
|
|
268
|
-
* checkpoint 的 scope → 该在哪些 **bg 注册簿分区**里找它的 parked 子代(
|
|
268
|
+
* checkpoint 的 scope → 该在哪些 **bg 注册簿分区**里找它的 parked 子代([ref])。
|
|
269
269
|
*
|
|
270
270
|
* 匿名(`"_"`)⇒ 两个都查:`"_"`(将来若统一了写侧)与 `"default"`(今天 core 真写下去的那个)。
|
|
271
271
|
* 其余 ⇒ 原样单查:有 principal 时两套约定折出**同一个**串(`encodeCheckpointScope` 只在 null/undefined
|
|
@@ -286,7 +286,7 @@ export declare const PRINCIPAL_TOKEN_HEADER = "x-approval-principal-token";
|
|
|
286
286
|
/**
|
|
287
287
|
* direct-door 决策证明三件套的另外两个头名(JWT 在上面那个常量里)。
|
|
288
288
|
*
|
|
289
|
-
* 为什么也具名(2026-08-08
|
|
289
|
+
* 为什么也具名(2026-08-08,[ref] 二轮扫描 finding):这三个头名此前在
|
|
290
290
|
* `http/routes/approvals-assistant.ts` 的两个 `verifyDirectDoorProof` 调用点、以及 `http/server.ts` 的
|
|
291
291
|
* CORS `access-control-allow-headers` 串里**各手抄一份**——而 CORS 那一行同一句里已经在用
|
|
292
292
|
* `${principalHeader}` 插值另一个头名,证明具名写法在该处本就可用。改任一头名时漏改 CORS 串的后果
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Session leaf-advance bus — the S2 fast path of the session-level SSE subscription
|
|
3
|
-
* ([
|
|
3
|
+
* ([ref]/[ref]③: an append that lands on THIS replica fans out to watchers synchronously,
|
|
4
4
|
* zero latency on single-replica deployments; cross-replica watchers still ride the probe lane).
|
|
5
5
|
*
|
|
6
6
|
* Deliberately a REPLICA-LOCAL singleton (module state), not a constructor-threaded dependency:
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* 「同 id、异载荷」结构上完全可能(wire 本身就收调用方给的 entries)。第一半的后果已知:Phase A 判 `identical`
|
|
8
8
|
* ⇒ 整段跳过、调用方拿 200 而目的端仍是自己那份内容(真 HTTP 复现过)。
|
|
9
9
|
*
|
|
10
|
-
* 🔴 **第二半是我一开始判错的地方**:我在黑板 [
|
|
10
|
+
* 🔴 **第二半是我一开始判错的地方**:我在黑板 [ref] 说「server 单方面修不了」。那句只对 **Phase A** 成立
|
|
11
11
|
* (那时 server 手上没有源端内容,必须靠调用方送摘要)。但 **commit 时 server 同时握着两份日志**
|
|
12
12
|
* (staged + dst),所以内容比较**根本不需要调用方配合** —— 而 4 处 commit/import 路径当时都写着
|
|
13
13
|
* 「`relation === "identical"` ⇒ 跳过 entries 写入」,把「id 集合相等」当成了「内容相同」。
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* 因为这里**分叉的代价是多同步一趟,不是错答案、也不是拒绝**(审批路径上分叉会拒掉一个合法的人类决定,
|
|
21
21
|
* 方向相反)。
|
|
22
22
|
*
|
|
23
|
-
* ── ⚠️ v1 摘要下本判据的**退化行为**(core 黑板 [
|
|
23
|
+
* ── ⚠️ v1 摘要下本判据的**退化行为**(core 黑板 [ref];1.415.0 已修,现行下限已远高于此 ——
|
|
24
24
|
* 承重下限与理由见 `test/core-dependency-floor.test.ts`,别在这里记版本号)────────────────
|
|
25
25
|
* v1 的摘要区分 `{a: undefined}` 与 `{}`,而 core 自己成规模产 own-key=undefined 的 entry ⇒ 同一份日志的
|
|
26
26
|
* 内存形与 JSON 往返形摘要必然不同。本函数在 commit 处比的是 **staged**(刚从 wire 解析,JSON 形)与 **dst**
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* 换成「依赖下限 + 行为门」—— 名字门只认识旧名字,守不住这条性质;见 server.ts Phase A 段注释与
|
|
33
33
|
* `test/sync-content-digest.test.ts`。)
|
|
34
34
|
*
|
|
35
|
-
* ⚠️ 抽成共享函数而不是在 4 处各写一遍:core [
|
|
35
|
+
* ⚠️ 抽成共享函数而不是在 4 处各写一遍:core [ref] [ref] 的教训(宣布"同族类修完成"而三个实现只落了一个),
|
|
36
36
|
* 本仓今天也刚在 33 处 exec→FileError 包装上吃过同款。判据收成一处,才谈得上机器看守。
|
|
37
37
|
*/
|
|
38
38
|
import { type SessionTreeEntry } from "@sema-agent/core";
|
|
@@ -47,7 +47,7 @@ import { type SessionTreeEntry } from "@sema-agent/core";
|
|
|
47
47
|
*/
|
|
48
48
|
export declare function identicalIdsAlsoIdenticalContent(staged: readonly SessionTreeEntry[], dst: readonly SessionTreeEntry[] | null): boolean;
|
|
49
49
|
/**
|
|
50
|
-
* `fast_forward` 的**内容判据**([
|
|
50
|
+
* `fast_forward` 的**内容判据**([ref] 审计 A5/F2,2-i)——id 分类器的另一格盲区:
|
|
51
51
|
* `dst ⊆ src` 只说明 **id 集合**是子集,共享 id 的**载荷**可能已分叉(目的端把某条 entry
|
|
52
52
|
* 补写/纠正过、id 不变,源端拿着旧版本 + 新追加)。此时按「clean append」整段换装,
|
|
53
53
|
* 目的端那几条纠正会被**静默销毁** —— §7「会丢目的端历史必须 409(除非显式 overwrite-dst)」
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 2c session-sync KERNEL (
|
|
2
|
+
* 2c session-sync KERNEL ([ref] A2) — the PURE half of session-sync: the §7 relation classifier, the staging-id
|
|
3
3
|
* scheme, the {@link StagingHandle}/{@link ImportStagingStore} contracts and the {@link SyncConflictError} type.
|
|
4
4
|
* Moved VERBATIM out of session-sync.ts (which keeps the StoreBackend-coupled ORCHESTRATION: exportSession/
|
|
5
5
|
* importSession/planSync) so the three DB session adapters (local/pg/tidb) and security.ts can depend on these
|
|
@@ -72,7 +72,7 @@ export declare function realIdOfStaging(stagingId: string): string | null;
|
|
|
72
72
|
* Mirrors the file-snapshot store's `BLOB_GC_GRACE_MS` discipline (an in-flight import must never be reaped
|
|
73
73
|
* mid-stream).
|
|
74
74
|
*
|
|
75
|
-
* 🔴 住在 kernel 里而不是任一个店里(2026-08-08
|
|
75
|
+
* 🔴 住在 kernel 里而不是任一个店里(2026-08-08,[ref] 二轮扫描 finding):TiDB 与 PG 两个孪生店原先**各
|
|
76
76
|
* 抄一份**同值常量,PG 那份的注释甚至自称「twin of the TiDB store's STAGING_GC_GRACE_MS」——明知孪生却
|
|
77
77
|
* 不共享。单边改值的后果是两个后端对「同一个中断的导入还能不能收」判定分家,而两边都按自己的常量静默
|
|
78
78
|
* 正确工作。这里是两个店**本就都 import** 的那个叶子模块(店契约纪律:适配器不许 import 自己的孪生,
|
package/dist/session-sync.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* `StoreBackend` (sema-internal server/docs/DESIGN-session-sync.md §5–§10, §15). The PUSH half is the two-phase
|
|
4
4
|
* staged streamed import in `src/http/routes/session-sync.ts` (§8 fanout re-implemented there, entries-off-the-wire).
|
|
5
5
|
*
|
|
6
|
-
* 🪦 **TOMBSTONE (2026-08-06, mechanical removal car, [
|
|
6
|
+
* 🪦 **TOMBSTONE (2026-08-06, mechanical removal car, [ref] 2-i precondition + #51 死码判定)**: this module used to
|
|
7
7
|
* ALSO export a whole-bundle `exportSession`/`importSession` orchestrator pair (the P1b one-shot in-memory move:
|
|
8
8
|
* read entries+snapshots+policy+anchors into one {@link SessionBundle}, replay them across backends in the §8
|
|
9
9
|
* atomic order). #51's audit (src git history around this date; see `test/session-sync-routes.test.ts`'s former
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* call sites** — PULL uses `exportSessionManifest` below + the keyset-paged NDJSON `/sync/entries` stream; PUSH uses
|
|
12
12
|
* the two-phase staging route, which reimplements the §8 fanout itself (`handle.commit` / `importManifest` /
|
|
13
13
|
* `putRules` / `resumeAnchorStore().put`) and never called `importSession`. The only consumers were three test
|
|
14
|
-
* files. [
|
|
14
|
+
* files. [ref] 2-i's precondition for removal (B4/G1 re-anchored to the live streaming path) was met, so this car
|
|
15
15
|
* deleted both functions + the tests that existed solely to exercise them.
|
|
16
16
|
*
|
|
17
17
|
* ⚠️ **Two invariants the deleted `importSession` uniquely protected have NO live-route equivalent** (verified by
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
* bundle carries, never deletes a dst-only row. A dangling anchor pointing at a purged entry, or a
|
|
33
33
|
* dst-only-principal policy row from the abandoned branch, can survive an overwrite-dst PUSH on the live
|
|
34
34
|
* route. The deleted tests (fanout-characterization §C C1/C1b, `session-sync-routes.test.ts`'s deleted
|
|
35
|
-
* "[
|
|
35
|
+
* "[ref] 同族: overwrite-dst wipe" describe) pinned this ONLY on the dead function.
|
|
36
36
|
* Neither gap is fixed by this car (mechanical removal, no behavior changes) — they are reported here + in the
|
|
37
37
|
* removal's final report for separate triage (port the fix to the live route, or explicitly accept the regression).
|
|
38
38
|
*
|
|
39
|
-
* ✅ **STATUS UPDATE (2026-08-06
|
|
40
|
-
* 两个保护都已移植到活路由(本文件尾部
|
|
39
|
+
* ✅ **STATUS UPDATE (2026-08-06 同日,[ref] 红先修绿)**:上面两条「NO live-route equivalent」已作废——
|
|
40
|
+
* 两个保护都已移植到活路由(本文件尾部 [ref] 段:`sameRulesContent`/`replayPolicyRecords`/
|
|
41
41
|
* `overwriteWipeIncapable`/`wipeSessionAttendants`;路由接线=src/http/routes/session-sync.ts 的两条重放腿
|
|
42
|
-
* + commit 后擦除步 + commit 前能力预检 501)。判据钉=fanout-characterization
|
|
42
|
+
* + commit 后擦除步 + commit 前能力预检 501)。判据钉=fanout-characterization「[ref] live 路由无等价物
|
|
43
43
|
* 缺口」describe(L1 rev 零漂移+反向臂 / L2 三子系统擦除+共享 key 换源端字节 / L3 缺 seam fail-loud),
|
|
44
44
|
* L1/L2 先红后绿,两处变异抽验(擦除步禁用⇒L2 红、等值跳过禁用⇒L1 红)。原文保留供考古。
|
|
45
45
|
*/
|
|
@@ -56,7 +56,7 @@ export type BlobGetter = (hash: string) => Promise<Uint8Array | undefined>;
|
|
|
56
56
|
export interface FileHistoryImportFace {
|
|
57
57
|
importHistory(scope: string, data: FileHistoryExport, srcGetBlob: BlobGetter): Promise<FileHistoryResult>;
|
|
58
58
|
}
|
|
59
|
-
/** Single-point capability probe (
|
|
59
|
+
/** Single-point capability probe ([ref] R7): does `fs` carry the optional `importHistory` seam?
|
|
60
60
|
* Returns the bound method (never a naked function reference — `this` inside must resolve to `fs`) or
|
|
61
61
|
* `undefined` when absent. Callers gate on the RETURN VALUE, not a separate `typeof` check, so there is
|
|
62
62
|
* exactly one place that knows the shape of the probe. */
|
|
@@ -90,7 +90,7 @@ export interface SessionBundle {
|
|
|
90
90
|
entries: SessionTreeEntry[];
|
|
91
91
|
/** The session's per-edited-file rewind history graph (core's versioned `FileHistoryExport` envelope —
|
|
92
92
|
* tracked set + version chains + boundaries; blob BYTES travel separately, content-addressed). `null` =
|
|
93
|
-
* no history / the source store cannot export. Replaces the retired E19 `snapshots` manifests (
|
|
93
|
+
* no history / the source store cannot export. Replaces the retired E19 `snapshots` manifests ([ref]). */
|
|
94
94
|
fileHistory: FileHistoryExport | null;
|
|
95
95
|
/** Every (principal, rules) record for the session, across ALL principals (E6 `listBySession`). */
|
|
96
96
|
policy: SessionRulesRecord[];
|
|
@@ -117,7 +117,7 @@ export interface SessionManifest {
|
|
|
117
117
|
entryCount: number;
|
|
118
118
|
/** The session's current leaf `SessionTreeEntry.id` (session_meta.leaf_id), or null if it has none. */
|
|
119
119
|
leafId: string | null;
|
|
120
|
-
/** The per-edited-file rewind history envelope (
|
|
120
|
+
/** The per-edited-file rewind history envelope ([ref]; see {@link SessionBundle.fileHistory}). EXACTLY as the bundle. */
|
|
121
121
|
fileHistory: FileHistoryExport | null;
|
|
122
122
|
/** Every (principal, rules) record across ALL principals (E6 `listBySession`). EXACTLY as the bundle. */
|
|
123
123
|
policy: SessionRulesRecord[];
|
|
@@ -152,24 +152,24 @@ export declare function exportSessionManifest(sessionId: string, srcBackend: Sto
|
|
|
152
152
|
* between the source's full durable log and the destination's current log (a `null` dst log ⇒ `fresh`). No writes.
|
|
153
153
|
*/
|
|
154
154
|
export declare function planSync(sessionId: string, srcBackend: StoreBackend, dstBackend: StoreBackend): Promise<SyncRelation | null>;
|
|
155
|
-
/**
|
|
155
|
+
/** [ref] ①(死码 A6 修的移植):同内容判据 —— 比较「归一化、去 rev」后的字节形。putRules 每次
|
|
156
156
|
* 无条件写都 rev+1,而 rev 是 operator 乐观锁的 CAS 令牌(`PutRulesOptions.expectedRev`),
|
|
157
157
|
* 幂等重试/无害重复同步不该把在途 CAS 打失败。归一化用 core 的 `normalizeRules`(store 落盘
|
|
158
158
|
* 前走同一函数 ⇒ 两侧同坐标);`stripRev` 去掉记录内嵌的 rev(`listBySession` 的 rules 含 rev,
|
|
159
159
|
* 它不是内容)。 */
|
|
160
160
|
export declare function sameRulesContent(stored: StoredSessionRules | null, incoming: SessionPermissionRules): boolean;
|
|
161
|
-
/**
|
|
161
|
+
/** [ref] ① 的重放腿共享实现:PUSH 路由的两条 policy 重放腿(Phase A identical 短路支 / Phase B
|
|
162
162
|
* commit 后支)都从这里走 —— 等内容跳过(rev 零漂移),真变更照常落地(E6 tighten-only 门在
|
|
163
163
|
* putRules 内部,此处不重述)。 */
|
|
164
164
|
export declare function replayPolicyRecords(store: Pick<SessionPolicyStore, "getRules" | "putRules">, sessionId: string, records: readonly SessionRulesRecord[], operatorOk: boolean): Promise<void>;
|
|
165
|
-
/**
|
|
165
|
+
/** [ref] ② 能力预检(fail-loud 方向,[ref] 判据:保护型能力缺席=fail-closed):consented
|
|
166
166
|
* overwrite-dst 需要 policy 店的 `deleteBySession` purge seam 才能不留混合态;缺席=true,路由在
|
|
167
167
|
* commit **之前**用它干净中止(此时零写入落地),wire 拒因字面量归路由所有(api-error-text-freeze
|
|
168
168
|
* 锚字面站点)。anchor 店的 deleteBySession 是类型必填、history 店有 core 必填的 `reap` 兜底(+
|
|
169
169
|
* {@link replayFileHistory} 的 conflict 收敛臂),都不构成缺席面;唯一可缺的就是 policy 这条
|
|
170
170
|
* (core 接口上是可选方法)。 */
|
|
171
171
|
export declare function overwriteWipeIncapable(policyStore: ServiceSessionPolicyStore | undefined): boolean;
|
|
172
|
-
/**
|
|
172
|
+
/** [ref] ②(死码 ⓪ 擦除步的移植):consented overwrite-dst = keep-source,结果必须是**源端那
|
|
173
173
|
* 一份**,不得混成「源端对话 + 目的端遗留 policy/anchor/历史」(混合态比丢历史更危险:悬空
|
|
174
174
|
* anchor 指向已 purge 的 entry、被放弃分支的 policy 行继续 gating、目的端旧历史图挡住源端图的
|
|
175
175
|
* importHistory 空目标法则)。调用时点=commit(原子 swap)成功**之后**、附随物重放**之前**:
|
package/dist/session-titler.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export interface SessionTitlerDeps {
|
|
|
48
48
|
}
|
|
49
49
|
export interface SessionTitler {
|
|
50
50
|
/** Fire-and-forget: maybe generate + persist a title for this session. Never throws, never blocks the caller. */
|
|
51
|
-
/** `model`([
|
|
51
|
+
/** `model`([ref]②)= 本 turn 真实驱动的模型——带上则标题 hook 同链路,不再裸落 env 缺省。 */
|
|
52
52
|
maybeTitle(sessionId: string, objective: string, model?: string): void;
|
|
53
53
|
}
|
|
54
54
|
export declare const TITLE_MAX_CHARS = 80;
|
package/dist/session-watch.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Session-watch registry — the server half of the session-level SSE subscription
|
|
3
|
-
* (design: sema-internal `server/docs/SESSION-SSE-DESIGN.md`, 黑板 [
|
|
3
|
+
* (design: sema-internal `server/docs/SESSION-SSE-DESIGN.md`, 黑板 [ref]①/[ref]).
|
|
4
4
|
*
|
|
5
5
|
* One entry per watched session; N subscribers SHARE one probe loop (this is the whole point:
|
|
6
6
|
* it converts web-side per-client polling into one per-replica probe). Two change channels:
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* invariant): no PG LISTEN/NOTIFY specialization, no shared bus. Latest-wins semantics: subscribers
|
|
21
21
|
* converge on the newest leafId; intermediate hops may be dropped (content still comes from tail faces).
|
|
22
22
|
*/
|
|
23
|
-
/** [
|
|
23
|
+
/** [ref] 二轮复审:SSE 资源旋钮的 env 解析——有界正整数,坏形(NaN/0/负/超界)一律回缺省并可观测
|
|
24
24
|
* (坏 `SESSION_EVENTS_MAX_PROBES=foo` 若直进 Number() 会把帽谓词变恒假=无帽,拍距 NaN 进 setTimeout
|
|
25
25
|
* =0ms 紧循环打爆存储)。 */
|
|
26
26
|
export declare function posIntEnv(raw: string | undefined, fallback: number, max?: number): number;
|
|
@@ -62,7 +62,7 @@ export declare class SessionWatchRegistry {
|
|
|
62
62
|
* newest value (connection-level dedupe absorbs any overlap with the caller's own read).
|
|
63
63
|
*/
|
|
64
64
|
subscribe(sessionId: string, owner: string | null, onHead: (leafId: string | null) => void, onEnd?: () => void): (() => void) | undefined;
|
|
65
|
-
/** [
|
|
65
|
+
/** [ref] 三轮复审(租户轮转围栏,同副本半场):session 删除即终结条目——通知全部订阅者(onEnd,
|
|
66
66
|
* 路由据此断流)+ 停探针 + 弃缓存 head(新租户同键重订阅=全新世代,旧 replay 不可能渗入)。 */
|
|
67
67
|
dropSession(sessionId: string): void;
|
|
68
68
|
/** S2 fast path: an append that landed on THIS replica. Safe to call for unwatched sessions (no-op).
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] v2/F4 —— shared-memory 读面的**授权折叠**:principal → 可读 org scope 集。
|
|
3
3
|
*
|
|
4
4
|
* 为什么复用 {@link OrgMemoryDirectory} 而不是另立一张表:「谁属于 org:acme」在一个进程里必须只有一个
|
|
5
5
|
* 答案。core 的记忆准入 seam、`/v1/memory/*` 的属主门、以及这里的共享库读面读的是**同一个目录实例**
|
|
6
6
|
* (`createOrgMemoryAdmissionWiring` 的产物),因此共享同一份 TTL 缓存 / 退避窗 / gen 高水位——吊销窗内
|
|
7
|
-
* 三面不会公开分歧。各建各的目录 = 三个答案,那正是
|
|
7
|
+
* 三面不会公开分歧。各建各的目录 = 三个答案,那正是 [ref] §7 收编要消灭的东西。
|
|
8
8
|
*
|
|
9
9
|
* 🔴 判别联合原样透传(N3/C5 裁定的下游一致性):目录说 `unavailable` 时**绝不**折成「你不属于任何
|
|
10
10
|
* org」。前者在模型面渲染成「连接不可用,恢复前拒读」(可重试),后者渲染成「本会话没有连接任何记忆库」
|
|
@@ -22,7 +22,7 @@ export interface SharedMemoryScopeAuthorizerOptions {
|
|
|
22
22
|
/** 目录实例。**必须**与 core 准入 seam / memory-policy 面同一只(见头注)。 */
|
|
23
23
|
directory: OrgMemoryDirectory;
|
|
24
24
|
/**
|
|
25
|
-
* 部署自证的 org scope —— **取值口而非值**(
|
|
25
|
+
* 部署自证的 org scope —— **取值口而非值**([ref])。
|
|
26
26
|
*
|
|
27
27
|
* 🔴 类型上是函数是刻意的,不是风格:这组 scope 的真源是 `config.projects` 的 `defaultScopes`,
|
|
28
28
|
* 而 `config.projects` 被 config-center **就地热应用**(`mutateInPlace`,整表替换),env 腿恒空
|
|
@@ -32,7 +32,7 @@ export interface SharedMemoryScopeAuthorizerOptions {
|
|
|
32
32
|
* stores:[]}`,对模型面是「本会话没有连接任何记忆库」这种**终局式**空集(不是可重试的
|
|
33
33
|
* unavailable),运维以为配好了;
|
|
34
34
|
* · **撤销**方向更糟:项目/scope 下架后,principal-less 的单用户请求仍按旧快照继续被放行 ——
|
|
35
|
-
* 一次运维撤销动作**静默不生效**(
|
|
35
|
+
* 一次运维撤销动作**静默不生效**([ref] 点名的静默类型),方向是 fail-OPEN。
|
|
36
36
|
* 而且它没被登进 `config-center/restart-signal.ts` 的 `RESTART_SLICES` ⇒ `/health` 连一句
|
|
37
37
|
* 「该重启了」都不会说。⇒ 收口是把读取时机对齐消费时机:每次 `resolve` 现取。
|
|
38
38
|
* (缺席 = 部署没有任何自证 scope,与传 `() => []` 等价。)
|
package/dist/sighup-idle.d.ts
CHANGED
package/dist/spec-fields.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { type AgentDefinition, type TaskSpec } from "@sema-agent/core";
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function normalizeSuggestNextPrompts(v: unknown): TaskSpec["suggestNextPrompts"];
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* [ref] (core 1.246) — normalize `body.resilience` → `TaskSpec.resilience`. INTENT flags only:
|
|
15
15
|
* `allowDegrade:false` / `allowFailover:false` let a bench/eval or critical task say "fail rather than fall back".
|
|
16
16
|
* `bypassBreaker` is OPERATOR-FACING (不给 wire 用户直开 — it punches through a shared circuit breaker,
|
|
17
17
|
* which exists to protect the provider): honored only when the request principal is an explicit operator; silently
|
|
@@ -21,7 +21,7 @@ export declare function normalizeSuggestNextPrompts(v: unknown): TaskSpec["sugge
|
|
|
21
21
|
*/
|
|
22
22
|
export declare function normalizeResilience(v: unknown, operator: boolean): TaskSpec["resilience"];
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* [ref] (core 1.251) — normalize `body.attachments` → `TaskSpec.attachments`. Core's contract is
|
|
25
25
|
* literal-true unions ("关闭=删 key,勿传 false"): only `true` (or, for changedFiles, an object with a sane
|
|
26
26
|
* `maxFiles`) survives; `false`/garbage per key is DROPPED, not forwarded. maxFiles clamped 1..100 (core caps its
|
|
27
27
|
* own stat cost at 20 by default; the clamp only guards against a resume replaying a wild persisted value).
|
|
@@ -30,29 +30,29 @@ export declare function normalizeResilience(v: unknown, operator: boolean): Task
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function normalizeAttachments(v: unknown): TaskSpec["attachments"];
|
|
32
32
|
/**
|
|
33
|
-
* [
|
|
33
|
+
* [ref] rewind exclusive mode (core 1.292) — normalize `body.resumeAtMode` → `TaskSpec.resumeAtMode`. DEFENSIVE
|
|
34
34
|
* (the resume path re-runs resolveSpec WITHOUT the HTTP 400 gate): only the two enum values survive, and only when
|
|
35
35
|
* the resume-at handle actually RESOLVED (core ignores the field without `resumeAt`; keep the spec tight instead of
|
|
36
36
|
* shipping a dangling qualifier). Absent/garbage ⇒ undefined = core default "at" (zero regression).
|
|
37
37
|
*/
|
|
38
38
|
export declare function normalizeResumeAtMode(v: unknown, resumeAtResolved: boolean): "at" | "before" | undefined;
|
|
39
|
-
/** [
|
|
39
|
+
/** [ref] 防御上限:一份请求最多带多少个 agent 定义。core 侧无上限;这里封一个防御值 —— 每个定义都进
|
|
40
40
|
* 系统提示(whenToUse/skills/systemPrompt 全是 prompt 载荷),不设界就是 per-turn token 成本洞(与
|
|
41
41
|
* MAX_USER_SKILLS 同轴)。32 足够覆盖 CC 式 `.claude/agents/` 全家桶还有余量。 */
|
|
42
42
|
export declare const MAX_TASK_AGENTS = 32;
|
|
43
|
-
/** [
|
|
43
|
+
/** [ref] 单条 agent 定义的形状裁决:null=合法;否则一句可 400 的英文错误(不带索引,调用方自己加)。
|
|
44
44
|
* 白名单外键 fail-loud —— 与 resilience/limits 的「容忍未知键」相反:agents 是能力定义,静默丢字段 =
|
|
45
45
|
* 定义被悄悄削(一个丢掉的 isolation 就是放宽),比 400 更危险,故整条拒。⚠️ 已知残账(core 半场):
|
|
46
46
|
* core 只对 allowTools 未知项 fail-loud,denyTools 未知项(如 typo)静默失效 —— 已上板请 core 镜像。
|
|
47
47
|
* ⚠️ 键判断必须 Object.hasOwn:`in` 走原型链,JSON 里的 "toString"/"constructor"/"__proto__" 键会被
|
|
48
48
|
* 误判为白名单字段,随后 SHAPES[k].ok 不是函数 ⇒ TypeError(fresh 500 / resume 砖;cross-review 复现)。 */
|
|
49
49
|
export declare function taskAgentIssue(item: unknown): string | null;
|
|
50
|
-
/** [
|
|
50
|
+
/** [ref] HTTP 门(fresh submit,server.ts prepareSpec):body.agents 在场必须是非空数组、每条过
|
|
51
51
|
* {@link taskAgentIssue}、name 数组内唯一、条数 ≤ {@link MAX_TASK_AGENTS}。返回 400 错误串或 null。
|
|
52
52
|
* RESUME 重放不过这道门 —— {@link taskAgentsFromBody} defensive(按条 DROP+warn,不砖 resume)。 */
|
|
53
53
|
export declare function validateTaskAgents(v: unknown): string | null;
|
|
54
|
-
/** [
|
|
55
|
-
* - 🔒 TOB 租户门:多租户(requirePrincipal===true)暂不放行 —— [
|
|
54
|
+
/** [ref] body.agents → `TaskSpec.agents`(resolveSpec 的唯一装配点;main.ts 只 spread)。两层门:
|
|
55
|
+
* - 🔒 TOB 租户门:多租户(requirePrincipal===true)暂不放行 —— [ref] 原文「TOB 面按租户 caps 门」,
|
|
56
56
|
* 当前没有 per-tenant caps 面可挂,先 fail-closed 关多租(warn `task_agents_ignored`,capabilities
|
|
57
57
|
* 的 `taskAgents` 同步 advertise false);单机/单用户直通(caller 是自己 worker 的 super-admin,
|
|
58
58
|
* 与 mcpInjection/hooks 同一姿势)。
|
|
@@ -60,14 +60,14 @@ export declare function validateTaskAgents(v: unknown): string | null;
|
|
|
60
60
|
* `task_agent_dropped`(绝不 throw 砖 resume);重名后到者 DROP;超上限截断。幸存字段按白名单拷贝
|
|
61
61
|
* (不透传未知键 —— 非法项已整条 drop,这里只是让持久化 body 的杂键不上 spec)。全空 ⇒ undefined。 */
|
|
62
62
|
export declare function taskAgentsFromBody(raw: unknown, requirePrincipal: boolean | undefined, warn: (event: string, fields: Record<string, unknown>) => void): AgentDefinition[] | undefined;
|
|
63
|
-
/** [
|
|
63
|
+
/** [ref]②/[ref](cli 认领消费)—— fresh-submit 的 agents[].model **目录成员资格**门(形状门
|
|
64
64
|
* {@link validateTaskAgents} 通过之后跑;调用方铸 400 `request.unknown_reference` + `available` 枚举)。
|
|
65
65
|
* 病灶=报错太晚太远:server 持目录却不查,错到 core prepare 才炸 `config.agent.unknown_model`
|
|
66
66
|
* (dist/agents/subagent.js:1258),以「run failed」形出现而非 400;cli resolver 只挡词法形,目录
|
|
67
67
|
* 成员资格只有 server 持有。
|
|
68
68
|
* 三条判定纪律(全部 core dist 亲读):
|
|
69
69
|
* - **只查 string 形**:core 只对 `typeof a.model === "string"` 走 `resolveModel`(subagent.js:1253);
|
|
70
|
-
* Model 对象形 core 原样信任不查目录([
|
|
70
|
+
* Model 对象形 core 原样信任不查目录([ref]④ 契约:自带完整 Model 配置,其 id 本就不必在目录)——
|
|
71
71
|
* 对象形没有「晚失败」病灶,这里同拒会是射程外的行为收紧,不做。
|
|
72
72
|
* - **`catalog` 必须是 tier 展开形**(调用方传 `expandTiers(config.models, config.tiers) ?? config.models`,
|
|
73
73
|
* resolve-spec.ts wireCatalog 同源纪律):core Runner 构造期把 deps.models 换成展开目录
|
|
@@ -81,31 +81,31 @@ export declare function unknownTaskAgentModelRef(agents: readonly unknown[], cat
|
|
|
81
81
|
index: number;
|
|
82
82
|
ref: string;
|
|
83
83
|
} | undefined;
|
|
84
|
-
/** [
|
|
84
|
+
/** [ref] main.ts resolveSpec 的 agents 装配片段(可 import 真 fold,[1.211 codex L]:此前 main.ts 用内联
|
|
85
85
|
* 闭包,测试只能 SOURCE PIN 文本+重写同构表达式——文本锚可被「移出 resolveSpec 但保留同文」静默骗过;
|
|
86
86
|
* 现在行为测试直接调这个真出口,main.ts 只剩一次调用点可锚)。语义=taskAgentsFromBody 的条件 spread:
|
|
87
87
|
* 有幸存 agents 才挂键(absent/全 drop ⇒ 空对象,spec byte-compat)。 */
|
|
88
88
|
export declare function taskAgentsSpecFragment(raw: unknown, requirePrincipal: boolean | undefined, warn: (event: string, fields: Record<string, unknown>) => void): {
|
|
89
89
|
agents?: AgentDefinition[];
|
|
90
90
|
};
|
|
91
|
-
/** [
|
|
91
|
+
/** [ref]② — body.retainBackgroundProcesses → `TaskSpec.retainBackgroundProcesses`。core 语义(1.295
|
|
92
92
|
* runtask/task-registry dist 亲读):`=== true` 时任务收尾不主动收割 session 后台进程 —— host lane 上是
|
|
93
93
|
* 资源驻留授予,与 backgroundShell 同款单用户闸:多租户 warn 忽略(`task_retain_bg_ignored`,capability
|
|
94
94
|
* 同步 advertise false)。只 literal `true` 上 spec(false=core 缺省,不挂键保持 byte-compat);非 boolean
|
|
95
95
|
* 由 HTTP 门 400,resume 重放这里 defensive DROP(不 throw)。 */
|
|
96
96
|
export declare function retainBackgroundProcessesFromBody(raw: unknown, requirePrincipal: boolean | undefined, warn: (event: string, fields: Record<string, unknown>) => void): true | undefined;
|
|
97
|
-
/** [
|
|
97
|
+
/** [ref]② — body.{excludeTools,deferTools} → `TaskSpec.{excludeTools,deferTools}`(core 1.314 工具面
|
|
98
98
|
* 控制批)。语义:excludeTools=roster 真卸载(schema 字节不上 wire,manifest 如实收窄);deferTools=
|
|
99
|
-
*
|
|
99
|
+
* [ref] 延迟披露(占位上 wire,ToolSearch 激活 materialize)。两位 tighten-only(core 继承不变量:
|
|
100
100
|
* union 进全部子 spawn 路径),per-run 工具面收窄无跨租户面 ⇒ 无租户门(interactiveTools 同姿势)。
|
|
101
101
|
* DEFENSIVE(resume 重放不过 HTTP 400 门):非数组 ⇒ undefined;项非非空字符串 ⇒ 逐项 DROP;空数组 ⇒
|
|
102
102
|
* undefined(不挂键=core 缺省,byte-compat)。HTTP 门另有 fail-loud 400(提交面邻居姿势)。 */
|
|
103
103
|
export declare function toolNameListFromBody(raw: unknown): string[] | undefined;
|
|
104
|
-
/** [
|
|
104
|
+
/** [ref]/[ref] — body.promptProfile → `TaskSpec.promptProfile`(core 1.328 R2 主件,CC LT(model_id)
|
|
105
105
|
* 同构双形轴)。语义:纯呈现轴不碰策略(simple=CC 212 短形面缺省;classic=长形面,可按任务/模型试分)
|
|
106
106
|
* ⇒ 无租户门(deferTools 同姿势);全委托树继承由 core 管。缺省不挂键(引擎缺省 simple,byte-compat)。
|
|
107
107
|
*
|
|
108
|
-
* ⚠️ **这不是一条 defer 注**(
|
|
108
|
+
* ⚠️ **这不是一条 defer 注**([ref] 件⑤ 对表结论,core [ref] 同判):本段说的是 `promptProfile` 这根
|
|
109
109
|
* **呈现**轴,它与 `deferMode` / `deferTools` 的延迟披露轴**无耦合** —— 上一行提 deferTools 只是在借它
|
|
110
110
|
* 的「无租户门」姿势作类比。「引擎缺省 simple」这句本身在 core 5.40.0 上仍逐字为真
|
|
111
111
|
* (`core/types.d.ts:133`:default "simple"),本批亲验未变。
|
|
@@ -113,11 +113,11 @@ export declare function toolNameListFromBody(raw: unknown): string[] | undefined
|
|
|
113
113
|
* `src/capabilities/tool-defer.ts` 的头注 —— 别把两根轴的结论写到一处。
|
|
114
114
|
* DEFENSIVE(resume 重放不过 HTTP 400 门):非法值 ⇒ undefined;提交面另有 fail-loud 400(邻居姿势)。 */
|
|
115
115
|
export declare function promptProfileFromBody(raw: unknown): "simple" | "classic" | undefined;
|
|
116
|
-
/** [
|
|
116
|
+
/** [ref]②(core 5.14.0 `TaskSpec.toolMaterializeStrategy`):deferred 工具激活后的 schema 供给策略。
|
|
117
117
|
* 与 {@link promptProfileFromBody} 同姿势的**防御性归一**——提交面的 fail-loud 400 在 HTTP 门,这里
|
|
118
118
|
* 只负责 resume 重放存量 body 时把不认识的值静默 DROP(回落 core 的 env/缺省链),而不是把它带上 spec。 */
|
|
119
119
|
export declare function toolMaterializeStrategyFromBody(raw: unknown): "static" | "swap" | undefined;
|
|
120
|
-
/** [
|
|
120
|
+
/** [ref]④ — 每键的运营方上限旋钮(env,缺省不设=不封顶)。 */
|
|
121
121
|
export interface TaskLimitCaps {
|
|
122
122
|
/** TASK_TIMEOUT_MAX_SEC(env 名不动,仍按**秒**配置;core 5.8.0 起封顶对象是 limits.maxWalltimeMs,
|
|
123
123
|
* 封顶比较时 ×1000 换算——运维面零迁移)。 */ timeoutSec?: number;
|
|
@@ -125,7 +125,7 @@ export interface TaskLimitCaps {
|
|
|
125
125
|
/** TASK_MAX_TURNS_MAX */ maxTurns?: number;
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
|
-
* [
|
|
128
|
+
* [ref]④ — normalize `body.limits` → 请求方配速意图 {maxWalltimeMs?, maxOutputTokens?, maxTurns?}。DEFENSIVE
|
|
129
129
|
* (resume 重放持久化 body 不过 HTTP 400 门):仅正的有限数字存活(floor 取整),0/负/垃圾按键 DROP —— core 侧
|
|
130
130
|
* 墙钟 > 0 才生效(0=不设墙,会跳过运营方封顶)、maxTurns/maxOutputTokens 的 0 无意义。每键各自被
|
|
131
131
|
* 运营方上限旋钮 clamp(Math.min;旋钮缺省不设=不封顶)。全空 ⇒ undefined。
|
|
@@ -144,7 +144,7 @@ export declare function normalizeApproachNotice(raw: unknown): false | {
|
|
|
144
144
|
at?: [number, number];
|
|
145
145
|
} | undefined;
|
|
146
146
|
/**
|
|
147
|
-
* [
|
|
147
|
+
* [ref]④ — body.limits 与 env 墙钟的合成规则(resolveSpec 的唯一 limits 装配点;run-local 无 body 车道不经此):
|
|
148
148
|
* - `timeoutSec`:body 给了就用 body(caller 明确配速;已在 normalizeLimits 里被 TASK_TIMEOUT_MAX_SEC 封顶)。
|
|
149
149
|
* body 缺席保持既有姿势 = tenancy 墙钟 + env `TASK_TIMEOUT_SEC` 只抬不降(taskWallClockSec 内 Math.max,
|
|
150
150
|
* 误配低值不能砍 council 预算)。注意两条纪律不叠加:「只抬不降」是 env 对内建缺省墙的规则,body 是
|
package/dist/ssh-host-key.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref]([ref];clay 裁定 **[ref]** 形:「响亮警告继续连」)—— SSH lane 的**主机密钥校验**两旋钮。
|
|
3
3
|
*
|
|
4
4
|
* ## 病灶(修前逐字形)
|
|
5
5
|
* `connectOnce` 的 `ConnectConfig` 从来不设 `hostVerifier`,而 ssh2 在缺席时**不做任何主机密钥校验** ——
|
|
6
6
|
* 这条 lane 于是恒等于 `ssh -o StrictHostKeyChecking=no`:握手对面是谁都照连、照把 agent 的命令与
|
|
7
|
-
* sftp 写入交出去。适配器持有的是控制面注入的私钥(
|
|
7
|
+
* sftp 写入交出去。适配器持有的是控制面注入的私钥([ref] §5 #2),中间人拿不到私钥,但**拿得到
|
|
8
8
|
* 这次会话的全部命令、全部产物、以及 agent 在那台机器上的全部动作**。
|
|
9
9
|
*
|
|
10
10
|
* ## 为什么不是「一律拒连」(裁定形)
|
|
11
11
|
* 本 lane 的既有部署形是「AI 编排批量部署到一批 SSH 可达的机器」,那些机器的密钥指纹通常不在任何
|
|
12
|
-
* known_hosts 里。默认拒连 = 一次静默的**可用性**断裂,而
|
|
12
|
+
* known_hosts 里。默认拒连 = 一次静默的**可用性**断裂,而 [ref] 裁的是:**在场即严格,缺席即响亮**。
|
|
13
13
|
* 缺席那一格是登记在案的 fail-open(`server.exec-lane.ssh-host-key-unverified`,census §1),不是遗漏。
|
|
14
14
|
*
|
|
15
|
-
* ## 两旋钮(config 面 `SSH_HOST_FINGERPRINT` / `SSH_KNOWN_HOSTS`,坏值拒启 ——
|
|
15
|
+
* ## 两旋钮(config 面 `SSH_HOST_FINGERPRINT` / `SSH_KNOWN_HOSTS`,坏值拒启 —— [ref] 律)
|
|
16
16
|
* · `fingerprintSha256` —— 主机公钥的 **SHA256 base64** 指纹(`ssh-keyscan` + `ssh-keygen -lf` 打印的
|
|
17
17
|
* 那一串)。归一后存**裸 base64**(无 `SHA256:` 前缀、无 `=` 填充);
|
|
18
18
|
* · `knownHostsPath` —— known_hosts 文件路径,按 `host` / `[host]:port` **逐字**匹配行。
|
|
@@ -48,7 +48,7 @@ export declare function normalizeSshFingerprint(raw: string): string;
|
|
|
48
48
|
/** ssh2 交来的**主机公钥 wire blob** → `SHA256:<base64>`(OpenSSH 打印的同一形,无 `=` 填充)。 */
|
|
49
49
|
export declare function sshHostKeyFingerprint(key: Buffer): string;
|
|
50
50
|
/**
|
|
51
|
-
* 主机密钥判官(
|
|
51
|
+
* 主机密钥判官([ref] / [ref])。返回一个**收 ssh2 的公钥 blob、给判词**的闭包(有捕获行为 ⇒ `create*`)。
|
|
52
52
|
*
|
|
53
53
|
* 缺席那一格调用 `onUnverified` —— **每连接一次**,不是每进程一次:一台长期未配旋钮的机器上,
|
|
54
54
|
* 「这条 lane 一直在裸连」必须在每一条连接上都看得见,否则它会随第一条日志滚出视野。
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - 翻转披露(§M):live→dead warn `store_probe_dead`、dead→live info `store_probe_recovered`,
|
|
12
12
|
* 只在翻转拍记(连续死不逐拍刷日志——down 的 DB 不该制造日志风暴);
|
|
13
13
|
* - 诚实缺席:首拍落地前 state() = undefined(/health 键缺席=「还没探过」,不冒充「活」)。
|
|
14
|
-
* - 面分级(
|
|
14
|
+
* - 面分级([ref]):`state().error` 是**原始** message —— 它只喂给凭证后/本机的消费面;免鉴权的
|
|
15
15
|
* `/health` 一格由 wire 装配点过 {@link publicStoreProbeError} 换成闭集词(理由见该常量头注)。
|
|
16
16
|
*
|
|
17
17
|
* 探针原语:调用方给 `probe`(main.ts 传 `() => backend.dbNowMs!()`——既有 S10 时钟探针的真 DB
|
|
@@ -31,7 +31,7 @@ export interface StoreLiveProbe {
|
|
|
31
31
|
stop: () => void;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* [ref](安全轴):`/health` 免鉴权面上 `storeProbe.error` 可披露的**闭集词表**。
|
|
35
35
|
*
|
|
36
36
|
* 为什么必须是闭集而不是「脱敏后的原文」:`/health` 排在 `http/server.ts` 的鉴权门**之前**、缺省全网卡
|
|
37
37
|
* 监听 ⇒ 任何能连到这个端口的人都读得到这一格;而它此前装的是**驱动原始异常 message 逐字**,DB 驱动
|