@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
package/dist/rules-consent.d.ts
CHANGED
|
@@ -31,14 +31,14 @@ export interface RuleConsentStores {
|
|
|
31
31
|
}): Promise<RuleImportTicket>;
|
|
32
32
|
/** 一次**认领**(不是「已完成」)。语义与「认领之后怎么办」见 {@link RuleConsentStores.tickets.release}。
|
|
33
33
|
* `purpose` = 车道绑定(A7 R1-F2):一条车道的口只认它自己铸的票,不符与「票不存在」同形。
|
|
34
|
-
* `opts.decisionNowMs` = [
|
|
34
|
+
* `opts.decisionNowMs` = [ref]③ 的判定钟覆写(记账列不受影响),见 {@link RuleTicketDecisionClock}。 */
|
|
35
35
|
consume(ticketId: string, principal: string, purpose: RuleTicketPurpose, opts?: RuleTicketDecisionClock): Promise<RuleTicketRedeemResult>;
|
|
36
36
|
/** 把认领**放回去**(认领之后遇到不确定/瞬时失败时)。`claimId` = 本次认领的代次(A7 R1-F1 围栏:
|
|
37
37
|
* 被顶替的旧持有者动不了现持有者的认领);`mustRemainValidMs` = 放回之后这张票至少还要能用多久
|
|
38
38
|
* —— 撑不过就**不算放回成功**(理由逐字见 store 侧 `release` 的头注)。 */
|
|
39
39
|
release(ticketId: string, principal: string, claimId: string, mustRemainValidMs?: number, opts?: RuleTicketDecisionClock): Promise<boolean>;
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* [ref] A7 三态协议的三条口(CLAIMED → SETTLED / 三态快照 / 崩溃窗抢认领)。
|
|
42
42
|
*
|
|
43
43
|
* 🔴 **必填,不给 optional**:它们是 local-import 车道正确性的承重件 —— 一个"没有 settle 的店"上,
|
|
44
44
|
* 一次已经落地的导入会永远答不出终局(属主重放恒 409 到票过期)。把它们写成可选 = 让一台缺实现的
|
|
@@ -59,11 +59,11 @@ export interface RuleConsentStores {
|
|
|
59
59
|
* 路由)一个字都不用知道行躺在哪里。
|
|
60
60
|
*/
|
|
61
61
|
export interface PermissionRuleStoreBundle extends RuleConsentStores {
|
|
62
|
-
/**
|
|
62
|
+
/** [ref] §3:库里已有几只规则桶(一 owner 一桶)。boot 期休眠行审计的**唯一**依赖;
|
|
63
63
|
* 为什么数桶不数规则、以及读失败必须响亮,见 `boot/permission-rules-audit.ts` 与两个实现处的注。 */
|
|
64
64
|
countBuckets(): Promise<number>;
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
66
|
+
* [ref] 保留期腿:清掉**可证已死**的导入票与孤儿 pending 审批记录,返回删掉的总行数。
|
|
67
67
|
* 谓词与「为什么不需要旋钮」逐字见 `plugins/permission-rule-store-sql.ts` 的同名成员。
|
|
68
68
|
*
|
|
69
69
|
* 🔴 **可选**,而缺席是**如实登记**过的:File 车道(`permission-rule-store-file.ts`)的审批/票两面是
|
|
@@ -139,7 +139,7 @@ export interface LocalImportRuleKey {
|
|
|
139
139
|
export type LocalImportRefusalCode =
|
|
140
140
|
/** scope 串读不出形(既不是 `global` 也不是 `project:<非空 root>`)。 */
|
|
141
141
|
"scope_unreadable"
|
|
142
|
-
/** scope 的 project root 里有 bidi 控制符([
|
|
142
|
+
/** scope 的 project root 里有 bidi 控制符([ref]② Trojan Source 族):人看到的射程与机器判据用的
|
|
143
143
|
* 射程不是同一串 —— 一条规则的**作用范围**因此可以被伪装。 */
|
|
144
144
|
| "scope_bidi_controls"
|
|
145
145
|
/** scope 的 project root 里有 **C0/DEL 控制字节**(codex 交叉轮 R9,验真后补)。与 bidi 分家成两个词:
|
|
@@ -169,15 +169,19 @@ export type LocalImportRefusalCode =
|
|
|
169
169
|
* 在 prepare 过了全部内容判据 —— 于是 core 交回的 `refused` 行只剩店侧成因(读不出店 / 写面抛 / OCC
|
|
170
170
|
* 用尽),而那些**都是"不知道落没落"**,不是"这条规则不行"。core 的 `RedeemedBatchMember` 拒绝臂
|
|
171
171
|
* 只带一个**自由文本** `reason`,把它按串去猜「这是裁定还是瞬时」正是本仓明令禁止的自造判读,
|
|
172
|
-
* 所以一律落到 `indeterminate`(安全方向)
|
|
173
|
-
*
|
|
174
|
-
*
|
|
172
|
+
* 所以一律落到 `indeterminate`(安全方向)。词仍留在表里是因为它进了**落盘回执的边界 schema**
|
|
173
|
+
* (`LocalImportOutcomeSchema` 的 z.enum——`redeemed_outcome` 列回读同一张词表,旧行 / 别版本进程写下的
|
|
174
|
+
* `refused` 必须读得回),不是留一个死枝;⚠️ 预览面**不用**这个词:那一面的拒绝形是
|
|
175
|
+
* `admitted:false + LocalImportRefusalCode`({@link LocalImportPreviewMember}),两面词表**不同**。
|
|
176
|
+
* 收窄需要 core 给拒绝臂一个**带类型的**
|
|
177
|
+
* 瞬时/裁定判别位 —— 已作为上游请托登记(server 不在下游造第二份判据,[ref])。 */
|
|
175
178
|
export type LocalImportMemberOutcome =
|
|
176
179
|
/** 这一次真的写进店里了。 */
|
|
177
180
|
"persisted"
|
|
178
181
|
/** 等价规则**已经在店**(引擎的 `deduped`)—— 同意早就生效,这次什么都不用做。 */
|
|
179
182
|
| "no-op"
|
|
180
|
-
/** 这条被拒了(
|
|
183
|
+
/** 这条被拒了(落盘回执 schema 的历史词位——现行两面都不铸它:预览面用 admitted:false +
|
|
184
|
+
* LocalImportRefusalCode,兑付面见上方登记恒折 indeterminate;留词只为旧行回读)。 */
|
|
181
185
|
| "refused"
|
|
182
186
|
/** **不知道落没落**:店在这一条上出了状况。如实编,禁猜(猜"成了"会谎报一次没发生的授权,猜"没成"
|
|
183
187
|
* 会让人以为可以重来一次,而重来会撞上一条其实已经存在的规则)。 */
|
|
@@ -245,7 +249,7 @@ export type LocalImportRedeemed =
|
|
|
245
249
|
outcome: LocalImportOutcome;
|
|
246
250
|
replayed: boolean;
|
|
247
251
|
}
|
|
248
|
-
/**
|
|
252
|
+
/** 五类票拒(不存在 / 别人的 / 错车道 / 过期 / 已用过而无从回放)—— wire 面同形 404。 */
|
|
249
253
|
| {
|
|
250
254
|
ok: false;
|
|
251
255
|
reason: "ticket-unusable";
|
|
@@ -266,7 +270,7 @@ export type LocalImportRedeemed =
|
|
|
266
270
|
detail: string;
|
|
267
271
|
};
|
|
268
272
|
/** 一次导入 prepare 的产物(HTTP 200 体的素材),或**超帽**的拒绝(见 {@link MAX_IMPORT_CANDIDATES})。
|
|
269
|
-
* 5.58(
|
|
273
|
+
* 5.58([ref]):零 importable 候选 ⇒ core **不铸** `approvalId`(「absence says so」)⇒ 无票可铸,
|
|
270
274
|
* 第三臂把 preview(全 skipped 的理由就在里面)原样交给人看——不是错误,是「没有什么可确认」。 */
|
|
271
275
|
export type RuleImportPrepared = {
|
|
272
276
|
ok: true;
|
|
@@ -283,8 +287,10 @@ export type RuleImportPrepared = {
|
|
|
283
287
|
reason: "too-many-candidates";
|
|
284
288
|
candidates: number;
|
|
285
289
|
};
|
|
286
|
-
/** 导入 redeem
|
|
287
|
-
*
|
|
290
|
+
/** 导入 redeem 的结果。wire 口径写死(端点=http/routes/rules.ts):票拒五类(自造 / 别人的 / 错车道 /
|
|
291
|
+
* 过期 / 已用过)与裁定性拒绝(record-unusable / payload-mismatch)同形 404(零存在性 oracle,顶注 ①);
|
|
292
|
+
* `retryable === true` ⇒ 503 `state.rule_import_retry`;`state-unreadable` ⇒ 503
|
|
293
|
+
* `state.rule_ticket_unreadable`。分类保留只为服务端日志/诊断与上述三分支的判据。 */
|
|
288
294
|
export type RuleImportRedeemed = {
|
|
289
295
|
ok: true;
|
|
290
296
|
result: {
|
|
@@ -294,15 +300,16 @@ export type RuleImportRedeemed = {
|
|
|
294
300
|
}
|
|
295
301
|
/** `retryable` = 这次失败**没有裁定任何事**(store 抛错 / CAS 冲突),认领已放回,属主原样重试即可。
|
|
296
302
|
* 它与裁定性拒绝(载荷被改写、记录不存在)分家是承重的:把两者塌成一格,一次数据库抖动就会被
|
|
297
|
-
* 客户端读成「这张票永远不能用了」。⚠️
|
|
298
|
-
*
|
|
303
|
+
* 客户端读成「这张票永远不能用了」。⚠️ wire 面**不再**折 404:`retryable === true` ⇒ 503
|
|
304
|
+
* `state.rule_import_retry` + Retry-After(http/routes/rules.ts;走到这一步的调用方已赢下 principal
|
|
305
|
+
* 绑定的认领,对他说「稍后再试」零存在性泄露——五类票拒仍同形 404,一个字没变)。 */
|
|
299
306
|
| {
|
|
300
307
|
ok: false;
|
|
301
308
|
reason: "ticket-unusable" | "record-unusable" | "payload-mismatch";
|
|
302
309
|
detail: string;
|
|
303
310
|
retryable?: true;
|
|
304
311
|
}
|
|
305
|
-
/**
|
|
312
|
+
/** [ref] 独立复审 件2(codex 轮二、轮三改形):首跳 `consume` 抛错后**结局歧义**的那一支 —— 认领
|
|
306
313
|
* 可能已提交而代次丢了,可能根本没提交,甚至可能**还在途、稍后才提交**(轮三 R3-F2:一次事后
|
|
307
314
|
* peek 读到 MINTED 证明不了在途的写不会迟到落地,同一场店故障也常让 peek 一起挂)。终局宣布不了
|
|
308
315
|
* (可能把活票说死),「票还能用」承诺不了(可能撒谎),断言「在途」也不行(那是冒充知道)——
|
|
@@ -327,7 +334,7 @@ export type CardRuleRedemption =
|
|
|
327
334
|
kind: "edited";
|
|
328
335
|
text: string;
|
|
329
336
|
}
|
|
330
|
-
/**
|
|
337
|
+
/** [ref]:人勾了**合取批**——传的是**行素材上人看到的那只 batch 整只**(不是裸 index),
|
|
331
338
|
* 等式两侧(看到的 / 重铸可兑的)在本车道一个函数里对齐(防漂等式,见 batch 分支行注)。 */
|
|
332
339
|
| {
|
|
333
340
|
kind: "batch";
|
|
@@ -341,13 +348,14 @@ export type CardRuleRedemption =
|
|
|
341
348
|
* `memberIndex` = 这条规则在**人看到的那只 batch offer** 的 `rules[]` 里的下标。它与请求体的
|
|
342
349
|
* `persistRule.batchOfferIndex`(= 帧上 `ruleOffers` 的下标)是**同一个空间**的两级坐标:
|
|
343
350
|
* 「第几只 offer / 那只 offer 的第几个成员」。core 的 `RedeemedBatchMember.candidateIndex`
|
|
344
|
-
* (candidate 空间)**刻意不透**:wire 面只见一个下标空间是 cli [
|
|
351
|
+
* (candidate 空间)**刻意不透**:wire 面只见一个下标空间是 cli [ref] 的定形理由(三端零映射)。
|
|
345
352
|
*/
|
|
346
353
|
export interface RedeemedBatchAnchor {
|
|
347
354
|
memberIndex: number;
|
|
348
355
|
rule: string;
|
|
349
356
|
}
|
|
350
|
-
/** 卡道兑付的结果。`
|
|
357
|
+
/** 卡道兑付的结果。`rule`(旧键名 canonical 已改;single 臂顶层键,批臂在 `members[].rule`)=
|
|
358
|
+
* **真正落盘**的那条规则文本(编辑臂上它可能与人敲的原字节不同 ——
|
|
351
359
|
* core 会把 `Bash(adb *)` 规范成 `Bash(adb:*)`;界面要回显的是这一份,不是输入框里的那一份)。 */
|
|
352
360
|
export type CardRulePersisted = {
|
|
353
361
|
ok: true;
|
|
@@ -356,10 +364,10 @@ export type CardRulePersisted = {
|
|
|
356
364
|
rev: number;
|
|
357
365
|
alreadyRedeemed: boolean;
|
|
358
366
|
}
|
|
359
|
-
/**
|
|
367
|
+
/** [ref] 批臂:全体成员落地(persisted/deduped 都计——等价规则已在店=同意已生效)。
|
|
360
368
|
* `rules` = 规范文本,**展示序**(= 兑付时递进来的那只 batch offer 的成员序,壳逐条回显)。
|
|
361
369
|
*
|
|
362
|
-
* 🔴 **P-39(cli [
|
|
370
|
+
* 🔴 **P-39(cli [ref] 请托 / [ref] 定形):展示序自本版起是承诺,不再是碰巧。**
|
|
363
371
|
* 修前 `rules` 直接是 `redeemRuleBatch` 的 members 走序 = **重铸批**(下面 `prepareCardApproval`
|
|
364
372
|
* 在兑付这一刻重铸的那只)的成员序;而人看到的是**呈卡那一刻**的批,两侧的等式是**集合**等式
|
|
365
373
|
* (防漂等式逐字「序无关」,见 batch 分支行注)⇒ 序从来不在等式里,「回执序=展示序」只是当下
|
|
@@ -367,7 +375,7 @@ export type CardRulePersisted = {
|
|
|
367
375
|
* 那只 offer 的成员序**显式重排**,于是它与壳渲的那张卡逐条对得上,不依赖引擎两次铸形同序。
|
|
368
376
|
*
|
|
369
377
|
* `members` = 逐条**归属锚**(index 与 `rules` 对齐):`memberIndex` = 这条规则在那只展示批
|
|
370
|
-
* `rules[]` 里的位置 —— **offer 空间**,candidate 空间刻意不出现在本类型上(cli [
|
|
378
|
+
* `rules[]` 里的位置 —— **offer 空间**,candidate 空间刻意不出现在本类型上(cli [ref] 裁词:
|
|
371
379
|
* 三端零映射,candidate 空间留在 core 内部)。
|
|
372
380
|
*
|
|
373
381
|
* ⚠️ **可选 = 诚实缺席**:落地成员与展示批成员对不上号(集合等式过了却出现 core 契约级的成员
|
|
@@ -382,15 +390,15 @@ export type CardRulePersisted = {
|
|
|
382
390
|
} | {
|
|
383
391
|
ok: false;
|
|
384
392
|
reason: "no-candidates" | "unknown-candidate" | "confirm-refused" | "redeem-refused"
|
|
385
|
-
/**
|
|
393
|
+
/** [ref]:编辑面**在这只卡上用不了**——卡没有绑定锚(`boundInputHash` 缺席 ⇒ 无从证明「我编辑的
|
|
386
394
|
* 是显示了这条命令的那张卡」),或这台部署没有打开编辑面。与下面那个词刻意分家:这个说的是
|
|
387
395
|
* 「别再渲那个输入框」,那个说的是「你写的这条不行,改一下再来」——壳要做的事完全相反。 */
|
|
388
396
|
| "edit-unsupported"
|
|
389
397
|
/**
|
|
390
|
-
*
|
|
398
|
+
* [ref]:人写的文本**被引擎的门拒了**——共享校验器不认这个拼写,或它不覆盖本次被裁决的命令
|
|
391
399
|
* (「编辑可以更宽,但不许换成另一条授权」)。
|
|
392
400
|
*
|
|
393
|
-
* 🔴 **射程自
|
|
401
|
+
* 🔴 **射程自 [ref] 起收窄**(core 5.57.0 `precheckEditedRuleText` 到货 —— 下面那条上游请托兑现了)。
|
|
394
402
|
* 原话保留作史:「兑付发生在裁决**落定之后**,所以拿到这个词时这张卡已经消费掉了;想做到『同一张
|
|
395
403
|
* 卡上改了再来』需要一次**裁决之前**的预检,而那要求 core 把编辑面的校验(含它自己的拼写规范化)
|
|
396
404
|
* 导出成一只纯函数 —— 在本层照抄一个更严的校验器会把 `Bash(adb *)` 这条**成因形**当场误拒。」
|
|
@@ -406,7 +414,7 @@ export type CardRulePersisted = {
|
|
|
406
414
|
*/
|
|
407
415
|
| "edit-rejected"
|
|
408
416
|
/**
|
|
409
|
-
* core 7.0.0(
|
|
417
|
+
* core 7.0.0([ref]② BREAKING B2,[ref] §4.4):silent-global 死——`prepareCardApproval`
|
|
410
418
|
* 在**既无显式 scope 又无 cwd**时响亮拒(`config.missing_scope`),不再默落 global。本仓的
|
|
411
419
|
* scope 素材=铸卡时 `ruleScopeRootFor` 咨询一次的落点(行列 `rule_scope_root`);resolver 答不出
|
|
412
420
|
* root 的车道(host lane 未注册 launch dir)在 v7 下就是这一形。**刻意不在兑付时刻补一个
|
|
@@ -417,7 +425,7 @@ export type CardRulePersisted = {
|
|
|
417
425
|
*/
|
|
418
426
|
| "scope-unresolved";
|
|
419
427
|
detail: string;
|
|
420
|
-
/**
|
|
428
|
+
/** [ref]:core 的**共享校验器**refusal code(`RuleRejectCode`,开集透传)。覆盖门拒时**缺席** ——
|
|
421
429
|
* 这条在场规则与 core `confirmRuleApproval` 的 `edit_rejected` detail 逐字同源(同一个函数体)。
|
|
422
430
|
* 🔴 不 switch、不翻译、不折叠:词表属主是 core,本仓照转。 */
|
|
423
431
|
code?: string;
|
|
@@ -430,7 +438,7 @@ export interface RuleImportLayerInput {
|
|
|
430
438
|
content: string;
|
|
431
439
|
}
|
|
432
440
|
/**
|
|
433
|
-
* scope 的 **wire 形**:`global` | `project:<root>` 的判别式串(
|
|
441
|
+
* scope 的 **wire 形**:`global` | `project:<root>` 的判别式串([ref] v2 §6 F5「显式成文」)。
|
|
434
442
|
*
|
|
435
443
|
* 🔴 为什么是一个串而不是把 core 的 `{kind, root}` 对象直接上 wire:这一份表示要同时当**列举结果里的
|
|
436
444
|
* 一列**、**查询参数**、**删除请求体的一个字段**和**分页游标的一部分**。四处若各用各的形,「删掉我刚才
|
|
@@ -442,7 +450,7 @@ export interface RuleImportLayerInput {
|
|
|
442
450
|
*/
|
|
443
451
|
export declare function serializeRuleScope(scope: RuleScope): string;
|
|
444
452
|
/**
|
|
445
|
-
* 🔴 判别式串的**上限,由铸侧的尺派生**(
|
|
453
|
+
* 🔴 判别式串的**上限,由铸侧的尺派生**([ref],2026-08-19 合并重扫 confirmed —— 修的是「两个数字
|
|
446
454
|
* 各挑各的」这件事本身,不是把某个数字调大一点)。
|
|
447
455
|
*
|
|
448
456
|
* 病:铸侧 `cardRuleScopeRoot` 对 root 长度零把关(入口尺 = `isValidCwd` 的 {@link MAX_CWD_CHARS}),
|
|
@@ -452,7 +460,7 @@ export declare function serializeRuleScope(scope: RuleScope): string;
|
|
|
452
460
|
* 店行是无墓碑硬删、会被 sync 的 join 复活),所以那是**一条已列出的常驻放行规则在受支持接口上不可撤**;
|
|
453
461
|
* 唯一的钝器补偿是 `PERMISSION_RULES_ENABLED=false`(关掉全部规则,两口自身随之 501)。
|
|
454
462
|
*
|
|
455
|
-
* ⚠️ 可达性在
|
|
463
|
+
* ⚠️ 可达性在 [ref].F-A 之后**变严重**:那批把铸侧出口从 `realpath` 改成 `path.resolve`,而 realpath
|
|
456
464
|
* 要求目录真实存在(macOS PATH_MAX=1024 ⇒ 宿主上 root 恒 ≤1023,结构性免疫);`path.resolve` 纯词法、
|
|
457
465
|
* 不碰盘 ⇒ **任何宿主上** 1081..4096 字符的注册 cwd 都能铸出这样一条规则。
|
|
458
466
|
*
|
|
@@ -461,7 +469,7 @@ export declare function serializeRuleScope(scope: RuleScope): string;
|
|
|
461
469
|
* 的尺,撤侧自动跟。
|
|
462
470
|
*/
|
|
463
471
|
export declare const MAX_RULE_SCOPE_CHARS: number;
|
|
464
|
-
/** durable 面的**二员**窄型(core 7.0.0
|
|
472
|
+
/** durable 面的**二员**窄型(core 7.0.0 [ref] §4.3:consent 面三员、durable 面二员分治)。
|
|
465
473
|
* wire 判别式串只拼得出这两员(session 刻意无 wire 拼法——它的家在引擎的会话 overlay,不在持久店),
|
|
466
474
|
* 所以 parse 产物与本仓筛选行都钉在这个窄型上:`.root` 访问零猜测,session 员漏进来是编译错不是运行病。 */
|
|
467
475
|
export type DurableRuleScope = Exclude<RuleScope, {
|
|
@@ -470,7 +478,7 @@ export type DurableRuleScope = Exclude<RuleScope, {
|
|
|
470
478
|
/** {@link serializeRuleScope} 的逆。读不出形 ⇒ `undefined`(调用方 400,绝不猜一个 global 出来 ——
|
|
471
479
|
* 猜 global 会把一次「删项目内规则」的请求变成一次删不掉任何东西的 no-op,或者更糟)。 */
|
|
472
480
|
export declare function parseRuleScope(text: string): DurableRuleScope | undefined;
|
|
473
|
-
/** 一条规则在 wire 上的行 = 一个逻辑 (rule, scope) 对(
|
|
481
|
+
/** 一条规则在 wire 上的行 = 一个逻辑 (rule, scope) 对([ref] v2 §6 F5)。
|
|
474
482
|
* `adds` **如实上 wire**、不折叠成单值:同一条规则可以被批准过多次(不同 dot、不同来源、不同时刻),
|
|
475
483
|
* 折成「一个 addedAt」会让「这条规则是我导入的还是我点过卡的」在治理面上不可分。 */
|
|
476
484
|
export interface PersistedRuleWireRow {
|
|
@@ -489,12 +497,12 @@ export interface PersistedRuleListing {
|
|
|
489
497
|
rev: number;
|
|
490
498
|
}
|
|
491
499
|
/**
|
|
492
|
-
* 撤销面两口寻址的**桶**(
|
|
500
|
+
* 撤销面两口寻址的**桶**([ref] 收官件,core 5.24.0 提货批 [ref])。
|
|
493
501
|
*
|
|
494
502
|
* 裸串 = principal 简写(既有调用方逐字不变);结构形 {@link RuleOwner} 多出 `{kind:"local-owner"}`
|
|
495
503
|
* —— 身份缺席的单机形自己那只桶。这不是 server 发明的第二种寻址:core 的
|
|
496
|
-
* `PermissionRuleStoreProvider.forLocalOwner()`(
|
|
497
|
-
* 叫不出它的名字** —— 我方 [
|
|
504
|
+
* `PermissionRuleStoreProvider.forLocalOwner()`([ref] §4.5)一直就有这只桶,缺的是**撤销入口
|
|
505
|
+
* 叫不出它的名字** —— 我方 [ref]① 请托、core 5.24.0 把 `removePersistedRule` 的 `principal` 入参扩成
|
|
498
506
|
* `string | RuleOwner` 兑现(d.ts 那段注逐字写着「downstream request, 2026-08-10」)。
|
|
499
507
|
*
|
|
500
508
|
* 🔴 **绝不用哨兵串**表示身份缺席(core 的 `RuleOwner` 头注就是这条纪律的出处):`forPrincipal("")` /
|
|
@@ -521,9 +529,9 @@ export interface RuleConsentLane {
|
|
|
521
529
|
prepareImport(principal: string, layers: readonly RuleImportLayerInput[]): Promise<RuleImportPrepared>;
|
|
522
530
|
/** 导入道:原子消费票 → confirm → redeemRuleBatch。 */
|
|
523
531
|
redeemImport(principal: string, ticket: string): Promise<RuleImportRedeemed>;
|
|
524
|
-
/**
|
|
532
|
+
/** [ref] A7 直通道:逐行校验 → 预览 + pending 记录 + 票(零可导入行 ⇒ 无票)。 */
|
|
525
533
|
prepareLocalImport(principal: string, rows: readonly PersistedRuleWireRow[]): Promise<LocalImportPrepared>;
|
|
526
|
-
/**
|
|
534
|
+
/** [ref] A7 直通道:三态兑付(首兑 / 逐字回放 / 崩溃窗重驱),终局落进票行。 */
|
|
527
535
|
redeemLocalImport(principal: string, ticket: string): Promise<LocalImportRedeemed>;
|
|
528
536
|
/**
|
|
529
537
|
* 撤销面读半场:列出一只桶名下**活着**的规则(墓碑已折算)。
|
|
@@ -536,7 +544,7 @@ export interface RuleConsentLane {
|
|
|
536
544
|
*/
|
|
537
545
|
listRules(bucket: RuleBucketRef): Promise<PersistedRuleListing>;
|
|
538
546
|
/**
|
|
539
|
-
* 撤销面写半场。**恒经 core `removePersistedRule`**(
|
|
547
|
+
* 撤销面写半场。**恒经 core `removePersistedRule`**([ref] §2 裁定)——它产墓碑,而墓碑是
|
|
540
548
|
* `screenRuleSyncState` 的筛子保证「别的副本不把这条规则回灌回来」的唯一凭据。直接删 SQL 行/文件行
|
|
541
549
|
* 是**无墓碑硬删**:sync 的 join 会让它复活,而运维以为自己收回了权限。
|
|
542
550
|
*
|
|
@@ -545,7 +553,7 @@ export interface RuleConsentLane {
|
|
|
545
553
|
* 仍然活着」——那是一个**有名字的真结果**,不是异常,更不是「撤销完成」。
|
|
546
554
|
*
|
|
547
555
|
* `principal` 裸串 = principal 简写(既有调用方逐字不变);{@link RuleBucketRef} 的结构形让
|
|
548
|
-
* local-owner 桶**真可撤**(core 5.24.0 起 `removePersistedRule` 的入参 union
|
|
556
|
+
* local-owner 桶**真可撤**(core 5.24.0 起 `removePersistedRule` 的入参 union 扩,[ref] 收官件)。
|
|
549
557
|
*/
|
|
550
558
|
removeRule(input: {
|
|
551
559
|
principal: RuleBucketRef;
|
|
@@ -556,7 +564,7 @@ export interface RuleConsentLane {
|
|
|
556
564
|
export declare function createRuleConsentLane(stores: RuleConsentStores, opts?: {
|
|
557
565
|
ticketTtlMs?: number;
|
|
558
566
|
newTicketId?: () => string;
|
|
559
|
-
/** [
|
|
567
|
+
/** [ref]③ 的单调钟 seam。缺省 `performance.now()` —— 本仓既定单调域。 */
|
|
560
568
|
monotonic?: () => number;
|
|
561
569
|
/** A7 有界等待的睡眠 seam(缺省真定时器)。等待窗与轮询步长都是**实现常数**,不是旋钮 ——
|
|
562
570
|
* 开成 opts 只是为了让"输者到底等没等"这件事可被确定性地钉住。 */
|
package/dist/run-local.d.ts
CHANGED
|
@@ -34,10 +34,10 @@ export interface RunLocalDeps {
|
|
|
34
34
|
print?: (line: string) => void;
|
|
35
35
|
/** stderr sink for the "you still need to set …" guidance (defaults to console.error). */
|
|
36
36
|
printErr?: (line: string) => void;
|
|
37
|
-
/**
|
|
37
|
+
/** [ref] 件三: override the TTY detection behind the {@link createLocalApprover} seat
|
|
38
38
|
* (defaults to `process.stdin.isTTY === true`) — lets a test drive BOTH arms deterministically. */
|
|
39
39
|
isTty?: boolean;
|
|
40
|
-
/**
|
|
40
|
+
/** [ref] 件三: the TTY arm's prompt (defaults to a readline `y/N` on stdin/stderr);
|
|
41
41
|
* `signal` = core `OnAsk` 的取消(EOF/abort 决断臂见 {@link promptYesNoOnTty})。 */
|
|
42
42
|
askYesNo?: (prompt: string, signal?: AbortSignal) => Promise<boolean>;
|
|
43
43
|
}
|
|
@@ -60,7 +60,7 @@ export declare function missingGatewayRequirements(config: ServiceConfig): strin
|
|
|
60
60
|
export interface LocalGovernanceConfigView extends DeploymentGovernanceConfigView, ApprovalBaselineConfigView {
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
63
|
+
* [ref] 件三:run-local 腿的**部署治理链装配**([ref])。
|
|
64
64
|
*
|
|
65
65
|
* 与另外两条腿(HTTP 的 `resolveSpec`、durable park 的赎回腿)装的是**同一条**链,经**同一个**构造口:
|
|
66
66
|
* 审批基线作 base 的 `toolPolicy` 座,再经**折叠属主** `applyRuntimeGovernance`(→ core `tightenTaskSpec`)
|
|
@@ -73,7 +73,7 @@ export interface LocalGovernanceConfigView extends DeploymentGovernanceConfigVie
|
|
|
73
73
|
* · **裁决 env 恒 host 形,锚 `workspaceDir`**:run-local 的手就跑在这台机器的这个目录上
|
|
74
74
|
* (`--workspace` / config.d workdir / cwd 三选一,调用方已解析好),所以 `cwd` 恒在场 —— 相对形写目标
|
|
75
75
|
* 由 core 按 `rootPath` 解析进真身裁决,构造口的词法补层(沙箱腿那条)在这里自动不铺。
|
|
76
|
-
* ✅ **旧残余面已收口(core 5.19.0
|
|
76
|
+
* ✅ **旧残余面已收口(core 5.19.0 [ref],2026-08-08 校正)**:`rootPath` 是装配期的**静态**值,而 core
|
|
77
77
|
* 的写工具解析相对形用的是被 Bash `cd` 就地改写的活 cwd —— 于是 `cd .git/hooks` 之后
|
|
78
78
|
* `Write("pre-commit")` 落进守卫段却判不出来(两条 host 腿同形,本腿与 resolve-spec)。5.19.0 起守卫
|
|
79
79
|
* 按 `ToolCallRequest.cwd`(引擎每次调用从同一只 tracked cwd 盖戳)解析写目标,本腿零改动即得保护;
|
|
@@ -93,7 +93,7 @@ export interface LocalApproverIo {
|
|
|
93
93
|
readonly printErr: (line: string) => void;
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
|
-
*
|
|
96
|
+
* [ref] 件三:**onAsk 座**(§0 潜雷 / §5 锁 6)。
|
|
97
97
|
*
|
|
98
98
|
* 🔴 为什么这个座位是接治理链的**同窗必做项**:run-local 有 checkpointStore(file backend),所以
|
|
99
99
|
* `AUTONOMY=ask` ⇒ `shellGate:"always"` ⇒ Bash 进 `irreversibleTools` ⇒ park lane effective ⇒ **每一次
|
package/dist/run-local.js
CHANGED
|
@@ -5,7 +5,7 @@ import { realpathSync } from "node:fs";
|
|
|
5
5
|
import { createInterface } from "node:readline/promises";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { loadRemoteExec } from "@sema-agent/settings-schema/node";
|
|
8
|
-
import { Runner, uuidv7, parseModelMention, AdoptionError, FileStorageBackend, NodeExecutionEnv, NodeLspManager, TtlSessionStore, CenterPromptSource, FilePromptArtifactStore, FilePromptSourceStateStore, MemoryPromptArtifactStore, MemoryPromptSourceStateStore } from "@sema-agent/core";
|
|
8
|
+
import { Runner, uuidv7, parseModelMention, AdoptionError, FileStorageBackend, NodeExecutionEnv, NodeLspManager, TtlSessionStore, CenterPromptSource, FilePromptArtifactStore, FilePromptSourceStateStore, MemoryPromptArtifactStore, MemoryPromptSourceStateStore, defaultTaskRegistry } from "@sema-agent/core";
|
|
9
9
|
import { hasOperatorGateIntent } from "./approval.js";
|
|
10
10
|
import { createBrain } from "./brain.js";
|
|
11
11
|
import { assertGuardPatternsUsable, buildOnlySensitiveBaselineWarning, createApprovalBaselinePolicy, createDeploymentGovernanceInputs, } from "./deployment-governance.js";
|
|
@@ -378,9 +378,9 @@ export async function runLocal(argv, deps = {}) {
|
|
|
378
378
|
promptSource,
|
|
379
379
|
executionEnvFactory,
|
|
380
380
|
lspManager,
|
|
381
|
-
backgroundAgentStore:
|
|
382
|
-
mailboxStore:
|
|
383
|
-
rosterStore:
|
|
381
|
+
backgroundAgentStore: fileBackend.backgroundAgentStore,
|
|
382
|
+
mailboxStore: fileBackend.mailboxStore,
|
|
383
|
+
rosterStore: fileBackend.rosterStore,
|
|
384
384
|
deploymentHooks: {
|
|
385
385
|
...createPermissionDeniedMeter(metrics),
|
|
386
386
|
...(config.hooksTimeoutMs !== undefined ? { timeoutMs: config.hooksTimeoutMs } : {}),
|
|
@@ -416,6 +416,7 @@ export async function runLocal(argv, deps = {}) {
|
|
|
416
416
|
const scenarioDeps = {
|
|
417
417
|
runner, subRunner, handslessSubRunner, model: "default", skills, repoClient, metrics, logger,
|
|
418
418
|
...(webSearch ? { webSearch } : {}),
|
|
419
|
+
backgroundAgentStore: fileBackend.backgroundAgentStore,
|
|
419
420
|
taskListStoreFor: taskListLane.storeFor,
|
|
420
421
|
brandIdentity: true,
|
|
421
422
|
};
|
|
@@ -473,6 +474,27 @@ export async function runLocal(argv, deps = {}) {
|
|
|
473
474
|
...(Object.keys(limits).length > 0 ? { limits } : {}),
|
|
474
475
|
}, config, workspaceDir);
|
|
475
476
|
logger.info("run_local_start", { scenario: scenarioName, model: spec.model, sessionId, exec: config.remoteExec?.provider ?? "in-process" });
|
|
477
|
+
const settleSessionBackground = async () => {
|
|
478
|
+
const reaped = defaultTaskRegistry.reapSessionBackground(sessionId, scope);
|
|
479
|
+
if (reaped === 0)
|
|
480
|
+
return;
|
|
481
|
+
const deadline = Date.now() + 5_000;
|
|
482
|
+
try {
|
|
483
|
+
for (;;) {
|
|
484
|
+
const running = (await fileBackend.backgroundAgentStore.listByScope(scope, { status: "running" })).length;
|
|
485
|
+
if (running === 0)
|
|
486
|
+
return;
|
|
487
|
+
if (Date.now() >= deadline) {
|
|
488
|
+
logger.warn("run_local_bg_settle_timeout", { reaped, stillRunning: running });
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
await new Promise((r) => setTimeout(r, 25));
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
catch (err) {
|
|
495
|
+
logger.warn("run_local_bg_settle_readback_failed", { reaped, err: err instanceof Error ? err.message : String(err) });
|
|
496
|
+
}
|
|
497
|
+
};
|
|
476
498
|
let result;
|
|
477
499
|
let exitCode = 0;
|
|
478
500
|
const taskRunner = pickHandsRunner(cap.hands, { full: runner, handsless: handslessRunner });
|
|
@@ -481,6 +503,7 @@ export async function runLocal(argv, deps = {}) {
|
|
|
481
503
|
}
|
|
482
504
|
catch (err) {
|
|
483
505
|
printErr(`task crashed: ${err instanceof Error ? err.message : String(err)}`);
|
|
506
|
+
await settleSessionBackground();
|
|
484
507
|
runner.sessions.dispose();
|
|
485
508
|
subRunner.sessions.dispose();
|
|
486
509
|
void lspManager?.dispose();
|
|
@@ -509,6 +532,7 @@ export async function runLocal(argv, deps = {}) {
|
|
|
509
532
|
logger.warn("memory_sync_failed", { reason: "post-task", err: String(err) });
|
|
510
533
|
}
|
|
511
534
|
}
|
|
535
|
+
await settleSessionBackground();
|
|
512
536
|
runner.sessions.dispose();
|
|
513
537
|
subRunner.sessions.dispose();
|
|
514
538
|
void lspManager?.dispose();
|
package/dist/runs.d.ts
CHANGED
|
@@ -32,14 +32,14 @@ import type { VerifyRoundsSpec } from "./http/verify-rounds.js";
|
|
|
32
32
|
* core's full markable set (background_agent / background_bash / monitor); running-only +
|
|
33
33
|
* first-marker-wins guards live inside the seam.
|
|
34
34
|
*/
|
|
35
|
-
/** [
|
|
35
|
+
/** [ref]③(b) + codex R2: the bg agent-handle OUTPUT read, kind-gated BEFORE any poll. `pollTask` is the
|
|
36
36
|
* generic registry face and polling is NOT side-effect-free for other kinds — a terminal workflow poll
|
|
37
37
|
* fires `onServedTerminal` (acknowledges the completion as served → suppresses its notification) and a
|
|
38
38
|
* bash poll advances the output cursor. `getAccessibleTask` is a pure lookup: resolve + access-check +
|
|
39
39
|
* type-check FIRST; only a `background_agent` row is ever polled (non-blocking). Everything else returns
|
|
40
40
|
* the registry's own not_found shape, indistinguishable from an unknown handle (the route 404s it).
|
|
41
41
|
*
|
|
42
|
-
* 1.250 durable arm (core 1.364, [
|
|
42
|
+
* 1.250 durable arm (core 1.364, [ref] follow-up delivered): a FULL in-process miss (`!row`) falls
|
|
43
43
|
* through to `pollTask(…, { agentStore })` — core's durable arm only fires for `a*`-shaped handles
|
|
44
44
|
* (DURABLE_AGENT_HANDLE_RE) behind `canAccessAgentRecord`, and with NO in-process handle the live
|
|
45
45
|
* workflow/bash branches are unreachable, so the kind-gate's reason (onServedTerminal / cursor advance)
|
|
@@ -63,7 +63,7 @@ export declare function taskHandleOutput(registry: typeof defaultTaskRegistry, h
|
|
|
63
63
|
content: string;
|
|
64
64
|
details: unknown;
|
|
65
65
|
}>;
|
|
66
|
-
/** [
|
|
66
|
+
/** [ref] CC TaskStop 人侧对位 — stop a background task handle (bash kill / monitor stop / agent abort).
|
|
67
67
|
* Same kind gate as the read face (a workflow stops via its own cancel face, never this verb). stopTask is
|
|
68
68
|
* idempotent on a terminal handle (the registry answers honestly); the stop is attributed "user" via the
|
|
69
69
|
* registry's existing markStopSource machinery (an HTTP stop is the human's hand — parity with the shell's
|
|
@@ -83,7 +83,7 @@ export declare function taskHandleStop(registry: typeof defaultTaskRegistry, han
|
|
|
83
83
|
/**
|
|
84
84
|
* Attribute this signal's abort as a USER stop for the owner's task-scoped children.
|
|
85
85
|
*
|
|
86
|
-
* 🔴 已经 abort 的信号在这里**立刻**记账,不是静默无操作(
|
|
86
|
+
* 🔴 已经 abort 的信号在这里**立刻**记账,不是静默无操作([ref] 件3 的配套)。调用点在 [ref] 件3 之后
|
|
87
87
|
* 一律挪到了「run 认领成功之后」—— 认领是一次 await,断连完全可能落在它之前。`addEventListener` 对一个
|
|
88
88
|
* 已 fire 的信号永不回调,那样一次真实的人为断连会被吞成「无归因」(子代 settle 时记成 system)。
|
|
89
89
|
* 语义上这两种时序是同一件事:本请求赢下了这条 session,而这条 session 的连接是被人断掉的。
|
|
@@ -106,24 +106,24 @@ export declare function isSessionConflictResult(result: {
|
|
|
106
106
|
* sync path otherwise 200s a failed result; map these to 4xx so a caller mistake reads as one. `not_found` (the
|
|
107
107
|
* entry is genuinely absent) → 404; everything else (not_a_message / conflicts_resume / no_session) → 422.
|
|
108
108
|
*
|
|
109
|
-
*
|
|
109
|
+
* [ref] Phase3: `requireExistingSession` on a genuinely-missing/purged session ALSO surfaces as a failed result
|
|
110
110
|
* (core prepare-task maps the store's `not_found` → `resume.session_not_found`); map it to 404 (the session is gone),
|
|
111
111
|
* the same "caller mistake reads as a 4xx, not a silent 200 fresh run" discipline.
|
|
112
112
|
*
|
|
113
|
-
* [
|
|
113
|
+
* [ref] rewind exclusive mode (core 1.292 resumeAtMode:"before"): its two edge rejections ride the same `resume_at.*`
|
|
114
114
|
* prefix (before_target_not_user / before_root_unsupported → 422 via the existing branch, errorCode passed through
|
|
115
115
|
* UNCHANGED for the shell). `rewind_snapshot.unresolvable` (rewindFiles + "before": no snapshot at/above the branch
|
|
116
116
|
* point) is core's third rejection with a DIFFERENT prefix — same caller-mistake shape (prepare-throw, nothing
|
|
117
117
|
* billed), map it to 422 explicitly so it doesn't fall through to a 200-with-failed body.
|
|
118
118
|
*
|
|
119
|
-
*
|
|
119
|
+
* [ref] 件A([ref] 件4): core 5.13.0's org-memory admission rides the SAME prepare-throw pipe
|
|
120
120
|
* (GOVERNANCE_CODES). `memory.admission_denied` is TERMINAL — the principal has no grant on that tenant
|
|
121
121
|
* plane → 403 (a retry cannot change the verdict). `memory.admission_required` is TRANSIENT fail-closed —
|
|
122
122
|
* the directory is unreachable / no resolver is wired → 503 (retry later; the sync leg forwards the
|
|
123
123
|
* result's `retryAfterMs` as body `retryAfterSec`, same family shape as usage.window_exhausted). Exact
|
|
124
124
|
* codes only, no memory.* family grab — an unknown sibling stays a 200-with-failed-body until cataloged.
|
|
125
125
|
*
|
|
126
|
-
*
|
|
126
|
+
* [ref] (core 7.0.0 片2/3, [ref] S-3): the session capture opt-out's four prepare-throw refusals ride the
|
|
127
127
|
* same pipe. `memory.capture_optout_denied` is TERMINAL (the principal's `allowMemoryOptOut` verdict is an
|
|
128
128
|
* explicit `false`, or the posture is `capture-required` / `governed`-with-absent-verdict — a retry cannot
|
|
129
129
|
* change it) → 403, the `memory.admission_denied` twin. `memory.capture_optout_unpersisted` is the
|
|
@@ -206,7 +206,7 @@ export declare class TurnAnchorCapture {
|
|
|
206
206
|
* non-secret and intentionally kept.
|
|
207
207
|
*/
|
|
208
208
|
export declare function stripCheckpointToken<T>(result: T): T;
|
|
209
|
-
/** [
|
|
209
|
+
/** [ref] 投影腿的最小 checkpoint 读口(结构型——真店 `CheckpointStore.get` 直接对上)。 */
|
|
210
210
|
type ParkCheckpointReader = {
|
|
211
211
|
get(token: CheckpointToken): Promise<{
|
|
212
212
|
pendingAction?: {
|
|
@@ -216,17 +216,17 @@ type ParkCheckpointReader = {
|
|
|
216
216
|
} | null>;
|
|
217
217
|
};
|
|
218
218
|
/**
|
|
219
|
-
* [
|
|
219
|
+
* [ref](cli 判别子 v3 请托)—— park 结果的**待批工具调用身份**:suspended/needs_review 结果在
|
|
220
220
|
* strip 之前手握 checkpointToken,用它 `cs.get(token)` 换 `pendingAction`,`tool_approval` 臂直读
|
|
221
221
|
* `toolCallId`(与 tool_approval 帧 ≥1.307 同键同义)。核心 `TaskResult` 上没有这个键(CheckpointGate
|
|
222
|
-
* 只带 toolName),checkpoint 本体是 park 的事实源——同源判据(
|
|
222
|
+
* 只带 toolName),checkpoint 本体是 park 的事实源——同源判据([ref] 教训)。
|
|
223
223
|
*
|
|
224
|
-
* 缺席形照 core `CheckpointSummary` 的 [
|
|
224
|
+
* 缺席形照 core `CheckpointSummary` 的 [ref]② OMITTED 契约:tool-less park(resource_limit /
|
|
225
225
|
* plan_review / task_done)回 `undefined` ⇒ 调用方**不铸键**,绝不编 null。读失败=F 类兜底
|
|
226
226
|
* (展示/关联键,缺席=该键到货前的现状),`recordFailOpen` 留痕,绝不挡 done/suspended 终局写链。
|
|
227
227
|
*/
|
|
228
228
|
export declare function parkToolCallId(result: unknown, cs: ParkCheckpointReader | undefined): Promise<string | undefined>;
|
|
229
|
-
/** [
|
|
229
|
+
/** [ref] 整对象形:park 结果顶层 additive 上 `toolCallId` 键(与 `checkpointId` 同位,[ref] 先例;
|
|
230
230
|
* 不塞进 `checkpointGate`——那是 core 的类型,server 不改其形)。非 park / 无 token / tool-less /
|
|
231
231
|
* 读失败 ⇒ **同一引用**原样返回(键缺席)。graft 不负责 strip——组合序恒为 graft → strip。 */
|
|
232
232
|
export declare function graftParkToolCallId<T>(result: T, cs: ParkCheckpointReader | undefined): Promise<T>;
|
|
@@ -244,7 +244,7 @@ export declare function evictIfConflict(runner: Runner, sessionId: string | unde
|
|
|
244
244
|
* `cancel_requested` flag (cross-replica, ≤HEARTBEAT_MS lag). Either way the run settles to
|
|
245
245
|
* status "failed" + errorCode "cancelled" (metric label "cancelled"); the entry is removed in `finally`.
|
|
246
246
|
*
|
|
247
|
-
* Preemption (POST /v1/assistant/tasks/:id/preempt,
|
|
247
|
+
* Preemption (POST /v1/assistant/tasks/:id/preempt, [ref] seam #2): a SECOND, INDEPENDENT controller
|
|
248
248
|
* (`preemptCtrl`, registered in `preemptable`) carries the scheduler's graceful "yield this task" — when raised,
|
|
249
249
|
* core durably SUSPENDS the task at the next clean turn boundary (gate resource_limit, reason "preempt") so it is
|
|
250
250
|
* RESUMABLE, the opposite of cancel's kill. It is wired ONLY on the plain-stream path: the verify/cascade
|
|
@@ -253,7 +253,7 @@ export declare function evictIfConflict(runner: Runner, sessionId: string | unde
|
|
|
253
253
|
* failure. Cross-replica via the `preempt_requested` flag (same heartbeat tick). Eligibility (resourceSuspend +
|
|
254
254
|
* durable store + durable tool-results + remote env) is core's call: an ineligible task's preemptSignal no-ops.
|
|
255
255
|
*
|
|
256
|
-
* Steering (POST /v1/runs/:id/steer,
|
|
256
|
+
* Steering (POST /v1/runs/:id/steer, [ref]): the live core `TaskStream` is registered in `steerable` so the
|
|
257
257
|
* HTTP route can inject a mid-task message via `stream.steer()` (drained at the next turn boundary). Same-replica
|
|
258
258
|
* only — a suspended run is steered durably via the checkpoint's `setPendingSteer` instead, and only the
|
|
259
259
|
* plain-stream path holds a steerable stream (the verify/cascade branches return a result, not a stream).
|
|
@@ -297,11 +297,11 @@ subagentSteer?: {
|
|
|
297
297
|
completionDiagLog?: (msg: string, meta?: Record<string, unknown>) => void,
|
|
298
298
|
/** SendUserFile(切片2):per-run file_link 帧发射 ALS(question/elicitation 同款)。emit=durable append。 */
|
|
299
299
|
sendUserFile?: SendUserFileEmitter,
|
|
300
|
-
/** [
|
|
300
|
+
/** [ref]② the shared prompt-manifest accumulator (tracer records at prepare; this leg drains the pending
|
|
301
301
|
* record into a durable `prompt_assembled` event — turns/stream read it). undefined ⇒ not wired. */
|
|
302
302
|
promptManifests?: PromptManifestTracker,
|
|
303
303
|
/**
|
|
304
|
-
*
|
|
304
|
+
* [ref] 车3 刀 3b:**bg 腿的流内审批 ctx**([ref] §4.3(b))。今天为止这条腿连 approval ALS 都没有
|
|
305
305
|
* ——`deps.onAsk` 拿不到 ctx ⇒ 恒 `"unavailable"` ⇒ durable park,一张卡都不产。接上之后,bg run 的
|
|
306
306
|
* 权限 ask 走本腿的 **durable events tail**(`GET /v1/runs/:id/events`,唯一带 SSE `id:` 的面)。
|
|
307
307
|
*
|
|
@@ -314,7 +314,7 @@ approval?: {
|
|
|
314
314
|
windowMs: number;
|
|
315
315
|
windowMarginMs: number;
|
|
316
316
|
},
|
|
317
|
-
/** [
|
|
317
|
+
/** [ref]:park 投影腿的 checkpoint 读口(`deps.checkpointStore`)。在场时,durable park 的
|
|
318
318
|
* `suspended` 事件带 `toolCallId`(graft 见 {@link parkToolCallId});缺席=旧字节逐字不变。 */
|
|
319
319
|
parkCheckpointReader?: {
|
|
320
320
|
get(token: CheckpointToken): Promise<{
|
|
@@ -326,7 +326,7 @@ parkCheckpointReader?: {
|
|
|
326
326
|
}): Promise<void>;
|
|
327
327
|
/** How often a running instance refreshes its run's updated_at (liveness, independent of events).
|
|
328
328
|
* Must stay strictly below `runStaleSec` (asserted at startup AND on every hot config candidate) or the
|
|
329
|
-
* reaper would race live runs.
|
|
329
|
+
* reaper would race live runs. [ref]:数值的单源是 `config-invariants.ts`(那条不变量的属主),两个消费面
|
|
330
330
|
* ——心跳环与 run-stale 判据——因此不可能各读各的。 */
|
|
331
331
|
export declare const HEARTBEAT_MS = 30000;
|
|
332
332
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Entitlements resolver — the SERVICE-side wiring of core 1.157's `RunnerDeps.runtimeCapsResolver` (
|
|
3
|
-
* (
|
|
2
|
+
* Entitlements resolver — the SERVICE-side wiring of core 1.157's `RunnerDeps.runtimeCapsResolver` ([ref] §K).
|
|
3
|
+
* ([ref] N11: this module's own exports were renamed `*Caps*` → `*Entitlements*` to stop sharing a word
|
|
4
4
|
* root with the UNRELATED `capabilities` face (deployment route discovery, `src/capabilities/`) and
|
|
5
5
|
* `ScenarioBundle` assembly — "caps" meant three different things across those three faces. `RuntimeCaps` /
|
|
6
6
|
* `EntitlementRuntimeCaps` themselves stay as-is below: they are core's / registry-core's own contract type
|
|
@@ -72,12 +72,12 @@ export interface EntitlementsResolverOpts {
|
|
|
72
72
|
*
|
|
73
73
|
* `autoMode`(core 1.276.0 `RuntimeCaps.autoMode`):auto-mode 分类器 per-principal
|
|
74
74
|
* 开闸线,极性同 allowObservers(`=== true` 显式 opt-in,默认 OFF;真执行还要 deployment 装配
|
|
75
|
-
* `RunnerDeps.autoMode` 分类器面=信任门,center 键只是 entitlement 半场)。[
|
|
75
|
+
* `RunnerDeps.autoMode` 分类器面=信任门,center 键只是 entitlement 半场)。[ref]B-6a:registry-core
|
|
76
76
|
* 0.13.0 已把 autoMode 收进 EntitlementRuntimeCaps(types.d.ts:1786)——宽读逃逸期结束,现为类型直读
|
|
77
77
|
* (allowObservers 同款收编先例)。 */
|
|
78
78
|
export declare function toCoreRuntimeCaps(ent: EntitlementRuntimeCaps | null | undefined): RuntimeCaps | undefined;
|
|
79
79
|
/**
|
|
80
|
-
* #A5([
|
|
80
|
+
* #A5([ref] 件2)—— 「这台 worker 上**存在** per-principal entitlement 源吗」的**单一谓词**。
|
|
81
81
|
*
|
|
82
82
|
* 判据逐字 = `boot/runtime-caps.ts` 建 caps 客户端的那一条(**配了 center ∧ 非 dry-run**):dry-run 的部署
|
|
83
83
|
* 拉取并记录 center 配置但**不应用、不执法**(observe-only),所以它解不出任何 per-principal caps —— 把它
|
|
@@ -136,7 +136,7 @@ export declare function createEntitlementsResolver(opts: EntitlementsResolverOpt
|
|
|
136
136
|
/** core's `RunnerDeps.runtimeCapsResolver` seam signature (types.d.ts): sync or async, undefined = no caps. */
|
|
137
137
|
export type EntitlementsResolverFn = (principal: string | undefined) => RuntimeCaps | undefined | Promise<RuntimeCaps | undefined>;
|
|
138
138
|
/**
|
|
139
|
-
*
|
|
139
|
+
* [ref] §3.1([ref] S-1 / [ref] §1.2)—— `RuntimeCaps.allowMemoryOptOut` 的 **verdict 源**(本地腿)。
|
|
140
140
|
* 唯一实现 = `plugins/memory-optout-grant-store-sql.ts`(三层折叠:per-principal 行 → 部署缺省哨兵行 →
|
|
141
141
|
* 代码缺省 allow,所以健康的源**恒答显式 boolean**;`principal` 缺席=匿名/系统 run,只看缺省行)。
|
|
142
142
|
* 契约:答非 boolean 或 throw = **面故障**(见 {@link applyMemoryOptOutGrant} 的处置)。
|
|
@@ -145,7 +145,7 @@ export interface MemoryOptOutVerdictSource {
|
|
|
145
145
|
resolveAllow(principal: string | undefined): Promise<boolean>;
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
|
-
*
|
|
148
|
+
* [ref] §3.1 **F2 例外臂**(server 阻断级,采;core 7.0.0 `RuntimeCaps.allowMemoryOptOut` JSDoc 的
|
|
149
149
|
* FAULT-TRANSIT CONTRACT 逐字):把本地 grant 腿的 verdict 合成进 caps resolver —— **与 allowWorkflows 家族
|
|
150
150
|
* 反向的例外臂,逐字注释**:
|
|
151
151
|
*
|