@sema-agent/server 7.115.0 → 7.116.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.
Files changed (116) hide show
  1. package/MIGRATION.md +167 -4
  2. package/USAGE.md +6 -3
  3. package/dist/approval-ask-audit-store.d.ts +25 -6
  4. package/dist/approval-ask-audit-store.js +6 -1
  5. package/dist/approval-card.d.ts +8 -4
  6. package/dist/approval-card.js +2 -0
  7. package/dist/approval-crash-convergence.d.ts +60 -0
  8. package/dist/approval-crash-convergence.js +75 -0
  9. package/dist/approval-deny-reasons.d.ts +13 -0
  10. package/dist/approval-deny-reasons.js +2 -0
  11. package/dist/approval.js +2 -1
  12. package/dist/boot/coordinators.js +0 -12
  13. package/dist/boot/execution-env.js +2 -1
  14. package/dist/boot/resolve-spec.js +1 -0
  15. package/dist/boot/stage-07-capability-layer.js +21 -15
  16. package/dist/boot/stores.js +4 -4
  17. package/dist/capabilities/hands-lane.d.ts +0 -23
  18. package/dist/capabilities/hands-lane.js +3 -2
  19. package/dist/capabilities/send-user-file-tool.d.ts +10 -22
  20. package/dist/capabilities/send-user-file-tool.js +1 -8
  21. package/dist/capability-facts.d.ts +296 -0
  22. package/dist/capability-facts.js +354 -0
  23. package/dist/config-center/apply-effective.js +1 -1
  24. package/dist/config.d.ts +16 -13
  25. package/dist/config.js +12 -12
  26. package/dist/http/admission.d.ts +6 -0
  27. package/dist/http/admission.js +22 -5
  28. package/dist/http/principal-gate.d.ts +3 -0
  29. package/dist/http/principal-gate.js +3 -0
  30. package/dist/http/resume-legs.js +10 -1
  31. package/dist/http/retired-skill-manifest.d.ts +23 -0
  32. package/dist/http/retired-skill-manifest.js +22 -0
  33. package/dist/http/route-table.d.ts +3 -2
  34. package/dist/http/route-table.js +5 -5
  35. package/dist/http/routes/a2a-serve.js +14 -21
  36. package/dist/http/routes/admin-config-refresh.js +7 -2
  37. package/dist/http/routes/admin-drain.js +7 -2
  38. package/dist/http/routes/admin-memory-optout.js +20 -6
  39. package/dist/http/routes/adoption.js +19 -5
  40. package/dist/http/routes/agents-roster.js +4 -2
  41. package/dist/http/routes/approvals-assistant.js +41 -18
  42. package/dist/http/routes/background.d.ts +0 -2
  43. package/dist/http/routes/background.js +4 -5
  44. package/dist/http/routes/capabilities.d.ts +2 -1
  45. package/dist/http/routes/capabilities.js +62 -65
  46. package/dist/http/routes/config-catalog.d.ts +4 -5
  47. package/dist/http/routes/config-catalog.js +16 -2
  48. package/dist/http/routes/devices.js +17 -11
  49. package/dist/http/routes/diagnostics.js +6 -1
  50. package/dist/http/routes/fleet.js +4 -2
  51. package/dist/http/routes/images.js +30 -3
  52. package/dist/http/routes/leader.js +7 -1
  53. package/dist/http/routes/mcp-reconnect.js +17 -10
  54. package/dist/http/routes/memory-bundle.js +20 -6
  55. package/dist/http/routes/memory-compliance.js +19 -5
  56. package/dist/http/routes/memory-consolidation.d.ts +9 -12
  57. package/dist/http/routes/memory-consolidation.js +17 -3
  58. package/dist/http/routes/memory-origin.js +19 -5
  59. package/dist/http/routes/notify-wake.js +5 -3
  60. package/dist/http/routes/observability.js +19 -5
  61. package/dist/http/routes/retention-ops.js +6 -1
  62. package/dist/http/routes/rules.js +49 -21
  63. package/dist/http/routes/run-memory-capture.js +5 -2
  64. package/dist/http/routes/runs.js +90 -60
  65. package/dist/http/routes/session-sync.js +64 -53
  66. package/dist/http/routes/sessions-list.js +8 -5
  67. package/dist/http/routes/sessions.js +39 -24
  68. package/dist/http/routes/shared-memory.js +5 -3
  69. package/dist/http/routes/tasks.js +2 -1
  70. package/dist/http/routes/trace-usage.js +18 -11
  71. package/dist/http/routes/workflows.js +36 -13
  72. package/dist/http/server.js +4 -1
  73. package/dist/http/wire-types.d.ts +6 -0
  74. package/dist/namespaced-rule-name.d.ts +54 -0
  75. package/dist/namespaced-rule-name.js +33 -0
  76. package/dist/observability/corrupt-read-seat.d.ts +4 -3
  77. package/dist/observability/corrupt-read-seat.js +4 -3
  78. package/dist/observability/fail-open.d.ts +5 -1
  79. package/dist/observability/fail-open.js +5 -1
  80. package/dist/observability/permission-rule-events.d.ts +3 -0
  81. package/dist/observability/permission-rule-events.js +4 -0
  82. package/dist/plugins/file-run-store.d.ts +7 -1
  83. package/dist/plugins/file-run-store.js +20 -7
  84. package/dist/plugins/memory-run-store.js +2 -1
  85. package/dist/plugins/one-time-migrations.d.ts +4 -2
  86. package/dist/plugins/one-time-migrations.js +26 -3
  87. package/dist/plugins/pg-session-storage.js +1 -1
  88. package/dist/plugins/run-store-sql.js +4 -4
  89. package/dist/plugins/session-policy-store-sql.js +4 -2
  90. package/dist/plugins/store-backend.d.ts +6 -1
  91. package/dist/plugins/store-backend.js +2 -1
  92. package/dist/plugins/store-contracts.d.ts +27 -8
  93. package/dist/plugins/store-contracts.js +12 -3
  94. package/dist/plugins/tidb-session-store.js +1 -1
  95. package/dist/request-key-closure.js +1 -1
  96. package/dist/run-local.d.ts +37 -3
  97. package/dist/run-local.js +48 -5
  98. package/dist/runs.d.ts +0 -58
  99. package/dist/runs.js +15 -20
  100. package/dist/session-policy-wire.d.ts +40 -60
  101. package/dist/session-policy-wire.js +60 -32
  102. package/dist/spec-fields.d.ts +32 -0
  103. package/dist/spec-fields.js +31 -16
  104. package/dist/standing-answer-grant.d.ts +8 -0
  105. package/dist/standing-answer-grant.js +5 -0
  106. package/dist/task-settings.d.ts +13 -3
  107. package/dist/tool-approval.d.ts +16 -0
  108. package/dist/tool-approval.js +29 -7
  109. package/dist/trace/core-keyset-guard.d.ts +4 -4
  110. package/dist/trace/self-minted-wire.d.ts +42 -0
  111. package/dist/trace/self-minted-wire.js +13 -0
  112. package/dist/user-input-ledger.d.ts +8 -5
  113. package/package.json +4 -2
  114. package/scripts/drain-check-local.mjs +115 -25
  115. package/scripts/drain-check.mysql.sql +67 -0
  116. package/scripts/drain-check.pg.sql +71 -0
@@ -0,0 +1,296 @@
1
+ /**
2
+ * 能力事实 —— 「这台部署上,这一面能不能用」的**唯一**判据家。
3
+ *
4
+ * 一条规则,三个读者:
5
+ * · 每个事实 = 这里**一只**纯函数。入 = 服务 deps 的只读切片(签名里的 `Pick` 就是它读哪几格的完整清单);
6
+ * 出 = `{ available: true }` 或 `{ available: false; why }`。零 I/O、零 await、零副作用。
7
+ * · `GET /v1/capabilities` 的位只**投影**事实(布尔位 = `.available`;对象位写明投影规则)。
8
+ * · 回答「这台部署上不可用」的每一道门(HTTP 501;a2a 两条路由的 404)调**同一只**事实;拒句可以按端点各写,
9
+ * 谓词不再写第二遍。
10
+ * 于是「位说有而端点恒拒」在结构上不可能:两边读的是同一个值。
11
+ *
12
+ * `why` 是一张闭集表({@link CAPABILITY_FACT_WHY}):每只事实的 why 类型被约束在这张表的键里(用了表外词 = 编译红),
13
+ * 多 why 的事实在门里按 `switch (f.why)` 收口(给事实添一个 why 而门没跟 = 编译红)。
14
+ *
15
+ * **见证**:携设施的事实在 available 臂上另带被判在场的那只设施引用(结构上仍是 `{ available: true }` 的子型)。
16
+ * 门在拒臂之后从见证取店,不再读 `deps.X` 第二遍 —— 否则只剩两条路:非空断言,或者把谓词再写一遍。
17
+ * 能力位只读 `.available`,见证不上 wire。
18
+ *
19
+ * 复合事实(一个位管一族、族内要几只事实都在)也住这里:能力面只读一只事实的 `.available`,不写 `a && b`。
20
+ */
21
+ import type { FlatServiceDeps } from "./http/server.js";
22
+ import type { ServiceConfig } from "./config.js";
23
+ import type { OwnerAwareSessionStore } from "./security.js";
24
+ import type { ServiceFileHistoryStore } from "./plugins/store-backend.js";
25
+ import { resolveStreamApprovalGate } from "./tool-approval.js";
26
+ /** why 闭集:词 → 给运维看的一句义(诊断 / 测试读它;wire 上的拒句由各门自写)。 */
27
+ export declare const CAPABILITY_FACT_WHY: {
28
+ readonly run_store_absent: "no durable run store is wired (DB_BACKEND=mysql|pg|local)";
29
+ readonly subagent_registry_absent: "the sub-agent steer registry is not wired";
30
+ readonly subagent_output_face_absent: "the background sub-agent output face is not wired";
31
+ readonly task_handle_faces_absent: "the background task-handle output/stop faces are not wired";
32
+ readonly session_owner_face_absent: "the session store has no ownership face (sessionStorage.ownerOf)";
33
+ readonly checkpoint_store_absent: "no durable checkpoint store is wired (DURABLE_APPROVAL)";
34
+ readonly session_audit_absent: "no session audit view is wired (needs a durable session store)";
35
+ readonly session_watch_absent: "the session watch registry is not wired";
36
+ readonly session_leaf_face_absent: "the session store has no leaf-read face (sessionStorage.getLeafId)";
37
+ readonly session_lister_absent: "no session enumerator is wired (session store or run store listSessions)";
38
+ readonly session_fork_face_absent: "the session store has no fork face";
39
+ readonly session_purge_absent: "no session purge coordinator is wired";
40
+ readonly session_policy_store_absent: "no session policy store is wired";
41
+ readonly store_backend_absent: "no store backend is wired (DB_BACKEND=memory, multi-tenant bare boot, or half-configured SQL)";
42
+ readonly file_history_store_absent: "no file-history store is wired";
43
+ readonly session_export_absent: "the session store has no entry export faces (exportEntries / exportEntriesStream)";
44
+ readonly session_import_staging_absent: "the session store has no staged-import face (beginImportStaging)";
45
+ readonly policy_purge_absent: "the session policy store has no deleteBySession purge verb";
46
+ readonly sync_blob_faces_absent: "the file-history store has no blob transfer faces (SQL backends only)";
47
+ readonly device_hub_absent: "the device lane hub is not wired";
48
+ readonly device_store_absent: "the device store is not wired";
49
+ readonly device_enrollment_absent: "device enrollment is not wired";
50
+ readonly fleet_bus_absent: "the fleet event bus is not wired";
51
+ readonly workspace_retired: "the workspace browse face was retired with the whole-tree snapshot epoch";
52
+ readonly leader_endpoint_absent: "the leader endpoint is not wired";
53
+ readonly image_index_absent: "no image index is wired (SQL backends only)";
54
+ readonly shared_memory_store_absent: "no shared memory store provider is wired";
55
+ readonly org_memory_directory_absent: "no org memory directory (membership fold) is wired";
56
+ readonly operator_principals_empty: "OPERATOR_PRINCIPALS is empty, so no caller can ever be an operator";
57
+ readonly adoption_store_absent: "no adoption log store is wired (SQL backends only)";
58
+ readonly memory_bundle_faces_absent: "the memory engine's governance bundle faces are not wired";
59
+ readonly memory_compliance_faces_absent: "the memory engine's provenance/erasure faces are not wired";
60
+ readonly memory_origin_faces_absent: "the memory engine's origin marking faces are not wired";
61
+ readonly consolidation_valve_closed: "the memory consolidation valve is closed (MEMORY_CONSOLIDATION_DRIVER)";
62
+ readonly memory_optout_grant_absent: "no memory-capture opt-out grant store is wired (SQL backends only)";
63
+ readonly outcome_ledger_unqueryable: "the outcome sink has no query face (File sink)";
64
+ readonly config_catalog_disabled: "the config catalog is switched off (CONFIG_CATALOG_ENABLED=false)";
65
+ readonly rule_store_absent: "no permission-rule store is wired";
66
+ readonly caller_principal_absent: "this request carries no verified principal";
67
+ readonly caller_mcp_injection_refused: "this deployment does not honor caller-supplied MCP servers";
68
+ readonly a2a_serve_off: "A2A_SERVE_ENABLED is off";
69
+ readonly elicitation_disabled: "inbound MCP elicitation is off (MCP_ELICITATION_ENABLED)";
70
+ readonly ask_question_disabled: "AskUserQuestion live HITL is off (ASK_QUESTION_ENABLED)";
71
+ readonly tool_approval_disabled: "live tool approval is off (TOOL_APPROVAL_ENABLED)";
72
+ readonly stream_approval_disabled: "the stream approval protocol is off (STREAM_APPROVAL_ENABLED)";
73
+ readonly background_agent_store_absent: "no background-agent store is wired";
74
+ readonly sendfile_ledger_absent: "no SendUserFile ledger is wired";
75
+ readonly workflow_engine_absent: "the workflow engine is not available on this worker";
76
+ readonly entitlement_resolver_absent: "self-orchestration is on for a multi-tenant worker with no per-principal entitlement source";
77
+ readonly workflow_run_store_absent: "no workflow run store is wired (SELF_ORCHESTRATION_ENABLED)";
78
+ readonly workflow_journal_store_absent: "no workflow journal store is wired (needs a store backend)";
79
+ readonly scheduler_disabled: "the self-wake scheduler is off (SCHEDULER_ENABLED)";
80
+ readonly multi_tenant_deployment: "this is a multi-tenant deployment (REQUIRE_PRINCIPAL=true)";
81
+ readonly not_host_lane: "the execution lane is not the single-user host lane (REMOTE_EXEC=host)";
82
+ };
83
+ export type CapabilityFactWhy = keyof typeof CAPABILITY_FACT_WHY;
84
+ /** 不可用臂。 */
85
+ export interface FactUnavailable<Why extends CapabilityFactWhy> {
86
+ readonly available: false;
87
+ readonly why: Why;
88
+ }
89
+ /** 一只事实的出形(`W` = available 臂上的见证;无见证的事实取默认空对象 = 只有 `available: true`)。 */
90
+ export type Fact<Why extends CapabilityFactWhy, W extends object = {}> = ({
91
+ readonly available: true;
92
+ } & Readonly<W>) | FactUnavailable<Why>;
93
+ type Deps = FlatServiceDeps;
94
+ type Store<K extends keyof Deps> = NonNullable<Deps[K]>;
95
+ type WithMethods<T, K extends keyof T> = T & {
96
+ [P in K]-?: NonNullable<T[P]>;
97
+ };
98
+ /** 持久 run 账面在场 —— `/v1/runs/*` 族、trace / 用量统计、assistant 的 preempt / resume / plan-review、
99
+ * 会话 detach、设备换绑都站在这一只事实上。 */
100
+ export declare function durableRuns(d: Pick<Deps, "runStore">): Fact<"run_store_absent", {
101
+ runStore: Store<"runStore">;
102
+ }>;
103
+ export declare function subagentSteer(d: Pick<Deps, "runStore" | "subagentSteerRegistry">): Fact<"run_store_absent" | "subagent_registry_absent", {
104
+ runStore: Store<"runStore">;
105
+ registry: Store<"subagentSteerRegistry">;
106
+ }>;
107
+ export declare function subagentOutput(d: Pick<Deps, "runStore" | "subagentTaskOutput">): Fact<"run_store_absent" | "subagent_output_face_absent", {
108
+ runStore: Store<"runStore">;
109
+ output: Store<"subagentTaskOutput">;
110
+ }>;
111
+ export declare function taskHandles(d: Pick<Deps, "runStore" | "taskHandleOutput" | "taskHandleStop">): Fact<"run_store_absent" | "task_handle_faces_absent", {
112
+ runStore: Store<"runStore">;
113
+ output: Store<"taskHandleOutput">;
114
+ stop: Store<"taskHandleStop">;
115
+ }>;
116
+ type OwnedSessionStore = WithMethods<OwnerAwareSessionStore, "ownerOf">;
117
+ /** 会话属主面在场(入站 owner 门的地基;缺它,带会话的门一律 fail-closed)。 */
118
+ export declare function sessionOwnership(d: Pick<Deps, "sessionStorage">): Fact<"session_owner_face_absent", {
119
+ sessionStorage: OwnedSessionStore;
120
+ }>;
121
+ export declare function mcpReconnect(d: Pick<Deps, "runStore" | "sessionStorage">): Fact<"run_store_absent" | "session_owner_face_absent", {
122
+ runStore: Store<"runStore">;
123
+ sessionStorage: OwnedSessionStore;
124
+ }>;
125
+ export declare function sessionAuditView(d: Pick<Deps, "sessionAudit">): Fact<"session_audit_absent", {
126
+ sessionAudit: Store<"sessionAudit">;
127
+ }>;
128
+ export declare function sessionEventStream(d: Pick<Deps, "sessionWatch" | "sessionStorage">): Fact<"session_watch_absent" | "session_leaf_face_absent" | "session_owner_face_absent", {
129
+ watch: Store<"sessionWatch">;
130
+ sessionStorage: WithMethods<OwnerAwareSessionStore, "ownerOf" | "getLeafId">;
131
+ }>;
132
+ type SessionLister = NonNullable<OwnerAwareSessionStore["listSessions"]>;
133
+ /** 会话枚举面:session 店的 `listSessions`,否则老形 run 店聚合。见证 = 已绑好宿主的那一只。 */
134
+ export declare function sessionList(d: Pick<Deps, "sessionStorage" | "runStore">): Fact<"session_lister_absent", {
135
+ lister: SessionLister;
136
+ }>;
137
+ export declare function sessionFork(d: Pick<Deps, "sessionStorage">): Fact<"session_fork_face_absent" | "session_owner_face_absent", {
138
+ sessionStorage: WithMethods<OwnerAwareSessionStore, "ownerOf" | "fork">;
139
+ }>;
140
+ export declare function sessionDelete(d: Pick<Deps, "purgeSession" | "sessionStorage">): Fact<"session_purge_absent" | "session_owner_face_absent", {
141
+ purge: Store<"purgeSession">;
142
+ sessionStorage: OwnedSessionStore;
143
+ }>;
144
+ export declare function sessionPolicy(d: Pick<Deps, "sessionPolicyStore" | "sessionStorage">): Fact<"session_policy_store_absent" | "session_owner_face_absent", {
145
+ policyStore: Store<"sessionPolicyStore">;
146
+ sessionStorage: OwnedSessionStore;
147
+ }>;
148
+ type SyncSessionStore = WithMethods<OwnerAwareSessionStore, "ownerOf" | "exportEntries" | "exportEntriesStream" | "beginImportStaging">;
149
+ type SessionSyncWhy = "store_backend_absent" | "session_owner_face_absent" | "file_history_store_absent" | "session_export_absent" | "session_import_staging_absent" | "policy_purge_absent";
150
+ /** 会话对等同步的**对话半族**(manifest / entries / plan / import 两相):后端 ∧ 属主面 ∧ 文件历史店 ∧ 导出两面 ∧
151
+ * staged 导入面 ∧ policy 店能清(overwrite-dst 的 commit 要擦目的端旧 policy 行)。文件历史的 blob 搬运是另一只事实。 */
152
+ export declare function sessionSync(d: Pick<Deps, "backend" | "sessionStorage" | "fileHistoryStore" | "sessionPolicyStore">): Fact<SessionSyncWhy, {
153
+ backend: Store<"backend">;
154
+ sessionStorage: SyncSessionStore;
155
+ historyStore: ServiceFileHistoryStore;
156
+ }>;
157
+ /** blob 两面齐备的文件历史店(marker 门,不做名字探测:local 的引擎文件店带一只同名私有助手)。 */
158
+ export type SyncBlobHistoryStore = ServiceFileHistoryStore & {
159
+ readonly syncBlobFaces: true;
160
+ } & {
161
+ [P in "putBlob" | "getBlob"]-?: NonNullable<ServiceFileHistoryStore[P]>;
162
+ };
163
+ /** 会话同步的**文件历史半族**:对话半族 ∧ 文件历史店有 blob 搬运面(只有 SQL 两只店有)。 */
164
+ export declare function sessionSyncFileHistory(d: Pick<Deps, "backend" | "sessionStorage" | "fileHistoryStore" | "sessionPolicyStore">): Fact<SessionSyncWhy | "sync_blob_faces_absent", {
165
+ historyStore: SyncBlobHistoryStore;
166
+ }>;
167
+ /** 持久审批底座(checkpoint 店)在场 —— `/v1/approvals/*` 与 `/v1/assistant/*` 整条车道、会话 wake 都站在它上面。 */
168
+ export declare function checkpointPark(d: Pick<Deps, "checkpointStore">): Fact<"checkpoint_store_absent", {
169
+ checkpointStore: Store<"checkpointStore">;
170
+ }>;
171
+ export declare function elicitation(d: Pick<Deps, "elicitation">): Fact<"elicitation_disabled", {
172
+ coordinator: Store<"elicitation">;
173
+ }>;
174
+ export declare function askUserQuestion(d: Pick<Deps, "question">): Fact<"ask_question_disabled", {
175
+ coordinator: Store<"question">;
176
+ }>;
177
+ export declare function toolApproval(d: Pick<Deps, "toolApproval">): Fact<"tool_approval_disabled", {
178
+ coordinator: Store<"toolApproval">;
179
+ }>;
180
+ type StreamApprovalWhy = "tool_approval_disabled" | "stream_approval_disabled" | "store_backend_absent" | "checkpoint_store_absent";
181
+ type ActiveStreamApproval = Extract<ReturnType<typeof resolveStreamApprovalGate>, {
182
+ active: true;
183
+ }>;
184
+ /** 流内审批协议在场 —— 判据的属主仍是 `resolveStreamApprovalGate`(三条执行腿的装配也读它);本事实把它的拒因译进 why 闭集。 */
185
+ export declare function streamApproval(d: Pick<Deps, "toolApproval" | "config" | "backend" | "checkpointStore">): Fact<StreamApprovalWhy, {
186
+ askStore: ActiveStreamApproval["askStore"];
187
+ }>;
188
+ export declare function deviceLane(d: Pick<Deps, "deviceHub">): Fact<"device_hub_absent", {
189
+ hub: Store<"deviceHub">;
190
+ }>;
191
+ /** 设备管理三动词(列 / 读 / 换绑):hub ∧ 设备店 ∧ 入网 ∧ 持久 run 账面(换绑的「无在飞 run」门要它)。 */
192
+ export declare function deviceManagement(d: Pick<Deps, "deviceHub" | "deviceStore" | "deviceEnrollment" | "runStore">): Fact<"device_hub_absent" | "device_store_absent" | "device_enrollment_absent" | "run_store_absent", {
193
+ hub: Store<"deviceHub">;
194
+ store: Store<"deviceStore">;
195
+ enrollment: Store<"deviceEnrollment">;
196
+ runStore: Store<"runStore">;
197
+ }>;
198
+ export declare function fleetStream(d: Pick<Deps, "fleetBus">): Fact<"fleet_bus_absent", {
199
+ fleetBus: Store<"fleetBus">;
200
+ }>;
201
+ /** workspace 浏览面:随整树快照纪元退役,恒不可用(位恒 false、路由恒 501,两边读这同一句)。**结构上**没有可用臂(型 = `FactUnavailable`,
202
+ * 不是 `Fact`)—— 调用方不写「可用时」那一臂,端点只按 why 穷举作答。 */
203
+ export declare function workspaceBrowse(): FactUnavailable<"workspace_retired">;
204
+ export declare function leaderLane(d: Pick<Deps, "leaderEndpoint">): Fact<"leader_endpoint_absent", {
205
+ endpoint: Store<"leaderEndpoint">;
206
+ }>;
207
+ export declare function imagePool(d: Pick<Deps, "imageIndex">): Fact<"image_index_absent", {
208
+ imageIndex: Store<"imageIndex">;
209
+ }>;
210
+ export declare function agentRoster(d: Pick<Deps, "backgroundAgentStore">): Fact<"background_agent_store_absent", {
211
+ store: Store<"backgroundAgentStore">;
212
+ }>;
213
+ export declare function sendFileLedger(d: Pick<Deps, "sendFileLedger">): Fact<"sendfile_ledger_absent", {
214
+ ledger: Store<"sendFileLedger">;
215
+ }>;
216
+ /** org 共享记忆只读面:供给面 ∧ org 折叠面(没有成员性判据的共享读面比没有更糟)。 */
217
+ export declare function sharedMemoryRead(d: Pick<Deps, "sharedMemoryStore" | "orgMemoryDirectory">): Fact<"shared_memory_store_absent" | "org_memory_directory_absent", {
218
+ provider: Store<"sharedMemoryStore">;
219
+ directory: Store<"orgMemoryDirectory">;
220
+ }>;
221
+ /** operator 名单非空。空名单下 `explicitOperatorOk` 对任何身份恒假 ⇒ 这一族的口对谁都打不通 = 部署不可用(不是鉴权拒)。
222
+ *
223
+ * operator 族的复合事实**先判名单、再判设施**:门序是「身份 → 名单空(501)→ 授权(403)→ 设施缺席(501)」——
224
+ * 名单空时没有人过得了授权,不先判它,这一形就永远答成 403;设施缺席则留在授权之后答(不对非 operator 透露部署形态)。 */
225
+ export declare function operatorLane(d: {
226
+ readonly config: Pick<ServiceConfig, "operatorPrincipals">;
227
+ }): Fact<"operator_principals_empty">;
228
+ type AdoptionCapableBackend = Store<"backend"> & {
229
+ adoptionLog(): ReturnType<NonNullable<Store<"backend">["adoptionLog"]>>;
230
+ };
231
+ export declare function adoption(d: Pick<Deps, "config" | "backend">): Fact<"operator_principals_empty" | "adoption_store_absent", {
232
+ backend: AdoptionCapableBackend;
233
+ }>;
234
+ export declare function memoryBundle(d: Pick<Deps, "config" | "memoryBundleExport" | "memoryBundleImport">): Fact<"operator_principals_empty" | "memory_bundle_faces_absent", {
235
+ exportScopes: Store<"memoryBundleExport">;
236
+ importBundle: Store<"memoryBundleImport">;
237
+ }>;
238
+ export declare function memoryCompliance(d: Pick<Deps, "config" | "memoryCompliance">): Fact<"operator_principals_empty" | "memory_compliance_faces_absent", {
239
+ faces: Store<"memoryCompliance">;
240
+ }>;
241
+ export declare function memoryOrigin(d: Pick<Deps, "config" | "memoryOriginFace">): Fact<"operator_principals_empty" | "memory_origin_faces_absent", {
242
+ faces: Store<"memoryOriginFace">;
243
+ }>;
244
+ /** 记忆整理阀门的两口。阀门关是一句旋钮表态(不是授权问题),所以它**先于**名单判:关着就对谁都答「关着」。 */
245
+ export declare function memoryConsolidation(d: Pick<Deps, "config" | "memoryConsolidation">): Fact<"consolidation_valve_closed" | "operator_principals_empty", {
246
+ valve: Store<"memoryConsolidation">;
247
+ }>;
248
+ export declare function memoryOptOutGrant(d: Pick<Deps, "config" | "memoryOptOutGrant">): Fact<"operator_principals_empty" | "memory_optout_grant_absent", {
249
+ store: Store<"memoryOptOutGrant">;
250
+ }>;
251
+ type QueryableOutcomeSink = WithMethods<Store<"outcomeSink">, "summary">;
252
+ /** 可查询的 outcome 账面 ∧(单用户 ∨ operator 名单非空)—— 单用户形唯一的用户就是 operator,这一口不判名单。 */
253
+ export declare function outcomeLedger(d: Pick<Deps, "config" | "outcomeSink">): Fact<"operator_principals_empty" | "outcome_ledger_unqueryable", {
254
+ sink: QueryableOutcomeSink;
255
+ }>;
256
+ /** 配置目录。旋钮关是一句表态(合规部署不想让部署事实上 wire),先于名单判。 */
257
+ export declare function configCatalog(d: Pick<Deps, "config">): Fact<"config_catalog_disabled" | "operator_principals_empty">;
258
+ export declare function ruleLane(d: Pick<Deps, "ruleConsent">): Fact<"rule_store_absent", {
259
+ lane: Store<"ruleConsent">;
260
+ }>;
261
+ /** 规则车道**对这个调用方**够不够得着:车道在场 ∧ 本请求有已验 principal(规则车道按 principal 寻址,
262
+ * `routes/rules.ts` 的域头对无 principal 一律 401)。按调用方算 —— 同一台 worker 对不同请求答案不同。 */
263
+ export declare function ruleLaneForCaller(d: Pick<Deps, "ruleConsent">, principal: string | undefined): Fact<"rule_store_absent" | "caller_principal_absent">;
264
+ /** 调用方自带 MCP 规格兑不兑现 —— 判据属主仍是 `mcpInjectionHonored`(提交腿的字段门也读它)。 */
265
+ export declare function mcpInjection(d: Pick<Deps, "config">): Fact<"caller_mcp_injection_refused">;
266
+ /** server-as-peer:旋钮开 ∧ 持久 run 账面在场。两只 JSON-RPC 方法(`message/send` / `tasks/get`)都要 run 店 ——
267
+ * 没有它,这个 peer 什么都做不了,对外就不该存在(卡与 RPC 一起 404)。 */
268
+ export declare function a2aServe(d: Pick<Deps, "config" | "runStore">): Fact<"a2a_serve_off" | "run_store_absent", {
269
+ serve: NonNullable<ServiceConfig["a2aServe"]>;
270
+ runStore: Store<"runStore">;
271
+ }>;
272
+ /** 引擎能不能自编排(core 单源 `workflowsCapability`,boot 算好经 `workflowsCapable` 递来;缺席回落行店代理)。 */
273
+ export declare function selfOrchestrationEngine(d: Pick<Deps, "workflowsCapable" | "workflowRunStore">): Fact<"workflow_engine_absent">;
274
+ /** 部署级准入:引擎在、而本部署对任何 principal 都授不出去(多租户 + 没接 entitlement 源)⇒ 不可用。
275
+ * 判据属主仍是 `selfOrchestrationDenial`(与提交面准入同一只)。 */
276
+ export declare function selfOrchestrationAdmission(d: Pick<Deps, "config">): Fact<"entitlement_resolver_absent">;
277
+ /** 「这台机器上真跑得起来」的自编排 = 引擎能 ∧ 准入不拒。 */
278
+ export declare function selfOrchestration(d: Pick<Deps, "config" | "workflowsCapable" | "workflowRunStore">): Fact<"workflow_engine_absent" | "entitlement_resolver_absent">;
279
+ /** workflow run 的持久列举三口(list / detail / stream)= 行店(能力位 `workflowsList` 投影这一只)。 */
280
+ export declare function workflowRuns(d: Pick<Deps, "workflowRunStore">): Fact<"workflow_run_store_absent", {
281
+ store: Store<"workflowRunStore">;
282
+ }>;
283
+ export declare function workflowJournal(d: Pick<Deps, "workflowJournalStore">): Fact<"workflow_journal_store_absent", {
284
+ journal: Store<"workflowJournalStore">;
285
+ }>;
286
+ /** workflow run 的 **journal 口**(`GET /v1/workflows/:id/journal`;能力位 `workflowsJournal` 投影这一只)= 行店 ∧ journal 店 —— journal 口要先按行判属主。
287
+ * 与 `workflowRuns` 是**拆开**的两只(照 `sessionSync` / `sessionSyncFileHistory`):无后端 + 自编排的三形上行店在、journal 店不在,
288
+ * 三口真能用而 journal 口恒 501 —— 合成一位总有一半在说假话。 */
289
+ export declare function workflowsJournal(d: Pick<Deps, "workflowRunStore" | "workflowJournalStore">): Fact<"workflow_run_store_absent" | "workflow_journal_store_absent", {
290
+ store: Store<"workflowRunStore">;
291
+ journal: Store<"workflowJournalStore">;
292
+ }>;
293
+ /** 自唤醒调度器挂在宿主 env 上:`SCHEDULER_ENABLED` ∧ 单用户 ∧ host 车道。装配(`boot/execution-env.ts`)与能力位同调。 */
294
+ export declare function hostScheduler(c: Pick<ServiceConfig, "schedulerEnabled" | "requirePrincipal" | "remoteExec">): Fact<"scheduler_disabled" | "multi_tenant_deployment" | "not_host_lane">;
295
+ export {};
296
+ //# sourceMappingURL=capability-facts.d.ts.map
@@ -0,0 +1,354 @@
1
+ import { mcpInjectionHonored } from "./task-mcp.js";
2
+ import { resolveStreamApprovalGate } from "./tool-approval.js";
3
+ import { selfOrchestrationDenial } from "./task-workflow.js";
4
+ import { centerEntitlementSourceWired } from "./runtime-caps-resolver.js";
5
+ import { overwriteWipeIncapable } from "./session-sync.js";
6
+ export const CAPABILITY_FACT_WHY = {
7
+ run_store_absent: "no durable run store is wired (DB_BACKEND=mysql|pg|local)",
8
+ subagent_registry_absent: "the sub-agent steer registry is not wired",
9
+ subagent_output_face_absent: "the background sub-agent output face is not wired",
10
+ task_handle_faces_absent: "the background task-handle output/stop faces are not wired",
11
+ session_owner_face_absent: "the session store has no ownership face (sessionStorage.ownerOf)",
12
+ checkpoint_store_absent: "no durable checkpoint store is wired (DURABLE_APPROVAL)",
13
+ session_audit_absent: "no session audit view is wired (needs a durable session store)",
14
+ session_watch_absent: "the session watch registry is not wired",
15
+ session_leaf_face_absent: "the session store has no leaf-read face (sessionStorage.getLeafId)",
16
+ session_lister_absent: "no session enumerator is wired (session store or run store listSessions)",
17
+ session_fork_face_absent: "the session store has no fork face",
18
+ session_purge_absent: "no session purge coordinator is wired",
19
+ session_policy_store_absent: "no session policy store is wired",
20
+ store_backend_absent: "no store backend is wired (DB_BACKEND=memory, multi-tenant bare boot, or half-configured SQL)",
21
+ file_history_store_absent: "no file-history store is wired",
22
+ session_export_absent: "the session store has no entry export faces (exportEntries / exportEntriesStream)",
23
+ session_import_staging_absent: "the session store has no staged-import face (beginImportStaging)",
24
+ policy_purge_absent: "the session policy store has no deleteBySession purge verb",
25
+ sync_blob_faces_absent: "the file-history store has no blob transfer faces (SQL backends only)",
26
+ device_hub_absent: "the device lane hub is not wired",
27
+ device_store_absent: "the device store is not wired",
28
+ device_enrollment_absent: "device enrollment is not wired",
29
+ fleet_bus_absent: "the fleet event bus is not wired",
30
+ workspace_retired: "the workspace browse face was retired with the whole-tree snapshot epoch",
31
+ leader_endpoint_absent: "the leader endpoint is not wired",
32
+ image_index_absent: "no image index is wired (SQL backends only)",
33
+ shared_memory_store_absent: "no shared memory store provider is wired",
34
+ org_memory_directory_absent: "no org memory directory (membership fold) is wired",
35
+ operator_principals_empty: "OPERATOR_PRINCIPALS is empty, so no caller can ever be an operator",
36
+ adoption_store_absent: "no adoption log store is wired (SQL backends only)",
37
+ memory_bundle_faces_absent: "the memory engine's governance bundle faces are not wired",
38
+ memory_compliance_faces_absent: "the memory engine's provenance/erasure faces are not wired",
39
+ memory_origin_faces_absent: "the memory engine's origin marking faces are not wired",
40
+ consolidation_valve_closed: "the memory consolidation valve is closed (MEMORY_CONSOLIDATION_DRIVER)",
41
+ memory_optout_grant_absent: "no memory-capture opt-out grant store is wired (SQL backends only)",
42
+ outcome_ledger_unqueryable: "the outcome sink has no query face (File sink)",
43
+ config_catalog_disabled: "the config catalog is switched off (CONFIG_CATALOG_ENABLED=false)",
44
+ rule_store_absent: "no permission-rule store is wired",
45
+ caller_principal_absent: "this request carries no verified principal",
46
+ caller_mcp_injection_refused: "this deployment does not honor caller-supplied MCP servers",
47
+ a2a_serve_off: "A2A_SERVE_ENABLED is off",
48
+ elicitation_disabled: "inbound MCP elicitation is off (MCP_ELICITATION_ENABLED)",
49
+ ask_question_disabled: "AskUserQuestion live HITL is off (ASK_QUESTION_ENABLED)",
50
+ tool_approval_disabled: "live tool approval is off (TOOL_APPROVAL_ENABLED)",
51
+ stream_approval_disabled: "the stream approval protocol is off (STREAM_APPROVAL_ENABLED)",
52
+ background_agent_store_absent: "no background-agent store is wired",
53
+ sendfile_ledger_absent: "no SendUserFile ledger is wired",
54
+ workflow_engine_absent: "the workflow engine is not available on this worker",
55
+ entitlement_resolver_absent: "self-orchestration is on for a multi-tenant worker with no per-principal entitlement source",
56
+ workflow_run_store_absent: "no workflow run store is wired (SELF_ORCHESTRATION_ENABLED)",
57
+ workflow_journal_store_absent: "no workflow journal store is wired (needs a store backend)",
58
+ scheduler_disabled: "the self-wake scheduler is off (SCHEDULER_ENABLED)",
59
+ multi_tenant_deployment: "this is a multi-tenant deployment (REQUIRE_PRINCIPAL=true)",
60
+ not_host_lane: "the execution lane is not the single-user host lane (REMOTE_EXEC=host)",
61
+ };
62
+ const no = (why) => ({ available: false, why });
63
+ const yes = (w) => ({ available: true, ...w });
64
+ const YES = yes({});
65
+ export function durableRuns(d) {
66
+ return d.runStore !== undefined ? yes({ runStore: d.runStore }) : no("run_store_absent");
67
+ }
68
+ export function subagentSteer(d) {
69
+ const runs = durableRuns(d);
70
+ if (!runs.available)
71
+ return runs;
72
+ return d.subagentSteerRegistry !== undefined ? yes({ runStore: runs.runStore, registry: d.subagentSteerRegistry }) : no("subagent_registry_absent");
73
+ }
74
+ export function subagentOutput(d) {
75
+ const runs = durableRuns(d);
76
+ if (!runs.available)
77
+ return runs;
78
+ return d.subagentTaskOutput !== undefined ? yes({ runStore: runs.runStore, output: d.subagentTaskOutput }) : no("subagent_output_face_absent");
79
+ }
80
+ export function taskHandles(d) {
81
+ const runs = durableRuns(d);
82
+ if (!runs.available)
83
+ return runs;
84
+ return d.taskHandleOutput !== undefined && d.taskHandleStop !== undefined
85
+ ? yes({ runStore: runs.runStore, output: d.taskHandleOutput, stop: d.taskHandleStop })
86
+ : no("task_handle_faces_absent");
87
+ }
88
+ export function sessionOwnership(d) {
89
+ const s = d.sessionStorage;
90
+ return s?.ownerOf !== undefined ? yes({ sessionStorage: s }) : no("session_owner_face_absent");
91
+ }
92
+ export function mcpReconnect(d) {
93
+ const runs = durableRuns(d);
94
+ if (!runs.available)
95
+ return runs;
96
+ const owned = sessionOwnership(d);
97
+ if (!owned.available)
98
+ return owned;
99
+ return yes({ runStore: runs.runStore, sessionStorage: owned.sessionStorage });
100
+ }
101
+ export function sessionAuditView(d) {
102
+ return d.sessionAudit !== undefined ? yes({ sessionAudit: d.sessionAudit }) : no("session_audit_absent");
103
+ }
104
+ export function sessionEventStream(d) {
105
+ if (d.sessionWatch === undefined)
106
+ return no("session_watch_absent");
107
+ const s = d.sessionStorage;
108
+ if (s?.getLeafId === undefined)
109
+ return no("session_leaf_face_absent");
110
+ if (s.ownerOf === undefined)
111
+ return no("session_owner_face_absent");
112
+ return yes({ watch: d.sessionWatch, sessionStorage: s });
113
+ }
114
+ export function sessionList(d) {
115
+ const lister = d.sessionStorage?.listSessions?.bind(d.sessionStorage) ?? d.runStore?.listSessions?.bind(d.runStore);
116
+ return lister !== undefined ? yes({ lister }) : no("session_lister_absent");
117
+ }
118
+ export function sessionFork(d) {
119
+ const s = d.sessionStorage;
120
+ if (s?.fork === undefined)
121
+ return no("session_fork_face_absent");
122
+ if (s.ownerOf === undefined)
123
+ return no("session_owner_face_absent");
124
+ return yes({ sessionStorage: s });
125
+ }
126
+ export function sessionDelete(d) {
127
+ if (d.purgeSession === undefined)
128
+ return no("session_purge_absent");
129
+ const owned = sessionOwnership(d);
130
+ if (!owned.available)
131
+ return owned;
132
+ return yes({ purge: d.purgeSession, sessionStorage: owned.sessionStorage });
133
+ }
134
+ export function sessionPolicy(d) {
135
+ if (d.sessionPolicyStore === undefined)
136
+ return no("session_policy_store_absent");
137
+ const owned = sessionOwnership(d);
138
+ if (!owned.available)
139
+ return owned;
140
+ return yes({ policyStore: d.sessionPolicyStore, sessionStorage: owned.sessionStorage });
141
+ }
142
+ export function sessionSync(d) {
143
+ if (d.backend === undefined)
144
+ return no("store_backend_absent");
145
+ const s = d.sessionStorage;
146
+ if (s?.ownerOf === undefined)
147
+ return no("session_owner_face_absent");
148
+ if (d.fileHistoryStore === undefined)
149
+ return no("file_history_store_absent");
150
+ if (s.exportEntries === undefined || s.exportEntriesStream === undefined)
151
+ return no("session_export_absent");
152
+ if (s.beginImportStaging === undefined)
153
+ return no("session_import_staging_absent");
154
+ if (overwriteWipeIncapable(d.sessionPolicyStore))
155
+ return no("policy_purge_absent");
156
+ return yes({ backend: d.backend, sessionStorage: s, historyStore: d.fileHistoryStore });
157
+ }
158
+ export function sessionSyncFileHistory(d) {
159
+ const sync = sessionSync(d);
160
+ if (!sync.available)
161
+ return sync;
162
+ const fs = sync.historyStore;
163
+ return fs.syncBlobFaces === true && typeof fs.putBlob === "function" && typeof fs.getBlob === "function"
164
+ ? yes({ historyStore: fs })
165
+ : no("sync_blob_faces_absent");
166
+ }
167
+ export function checkpointPark(d) {
168
+ return d.checkpointStore !== undefined ? yes({ checkpointStore: d.checkpointStore }) : no("checkpoint_store_absent");
169
+ }
170
+ export function elicitation(d) {
171
+ return d.elicitation !== undefined ? yes({ coordinator: d.elicitation }) : no("elicitation_disabled");
172
+ }
173
+ export function askUserQuestion(d) {
174
+ return d.question !== undefined ? yes({ coordinator: d.question }) : no("ask_question_disabled");
175
+ }
176
+ export function toolApproval(d) {
177
+ return d.toolApproval !== undefined ? yes({ coordinator: d.toolApproval }) : no("tool_approval_disabled");
178
+ }
179
+ export function streamApproval(d) {
180
+ const gate = resolveStreamApprovalGate({
181
+ toolApprovalEnabled: d.toolApproval !== undefined,
182
+ streamApprovalEnabled: d.config.streamApproval?.enabled === true,
183
+ backend: d.backend,
184
+ parkFacility: d.checkpointStore !== undefined,
185
+ });
186
+ if (gate.active)
187
+ return yes({ askStore: gate.askStore });
188
+ switch (gate.reason) {
189
+ case "no_tool_approval":
190
+ return no("tool_approval_disabled");
191
+ case "protocol_disabled":
192
+ return no("stream_approval_disabled");
193
+ case "no_backend":
194
+ return no("store_backend_absent");
195
+ case "no_park_facility":
196
+ return no("checkpoint_store_absent");
197
+ default: {
198
+ const unhandled = gate.reason;
199
+ throw new Error(`unhandled stream-approval gate reason: ${JSON.stringify(unhandled)}`);
200
+ }
201
+ }
202
+ }
203
+ export function deviceLane(d) {
204
+ return d.deviceHub !== undefined ? yes({ hub: d.deviceHub }) : no("device_hub_absent");
205
+ }
206
+ export function deviceManagement(d) {
207
+ const lane = deviceLane(d);
208
+ if (!lane.available)
209
+ return lane;
210
+ if (d.deviceStore === undefined)
211
+ return no("device_store_absent");
212
+ if (d.deviceEnrollment === undefined)
213
+ return no("device_enrollment_absent");
214
+ const runs = durableRuns(d);
215
+ if (!runs.available)
216
+ return runs;
217
+ return yes({ hub: lane.hub, store: d.deviceStore, enrollment: d.deviceEnrollment, runStore: runs.runStore });
218
+ }
219
+ export function fleetStream(d) {
220
+ return d.fleetBus !== undefined ? yes({ fleetBus: d.fleetBus }) : no("fleet_bus_absent");
221
+ }
222
+ export function workspaceBrowse() {
223
+ return no("workspace_retired");
224
+ }
225
+ export function leaderLane(d) {
226
+ return d.leaderEndpoint !== undefined ? yes({ endpoint: d.leaderEndpoint }) : no("leader_endpoint_absent");
227
+ }
228
+ export function imagePool(d) {
229
+ return d.imageIndex !== undefined ? yes({ imageIndex: d.imageIndex }) : no("image_index_absent");
230
+ }
231
+ export function agentRoster(d) {
232
+ return d.backgroundAgentStore !== undefined ? yes({ store: d.backgroundAgentStore }) : no("background_agent_store_absent");
233
+ }
234
+ export function sendFileLedger(d) {
235
+ return d.sendFileLedger !== undefined ? yes({ ledger: d.sendFileLedger }) : no("sendfile_ledger_absent");
236
+ }
237
+ export function sharedMemoryRead(d) {
238
+ if (d.sharedMemoryStore === undefined)
239
+ return no("shared_memory_store_absent");
240
+ if (d.orgMemoryDirectory === undefined)
241
+ return no("org_memory_directory_absent");
242
+ return yes({ provider: d.sharedMemoryStore, directory: d.orgMemoryDirectory });
243
+ }
244
+ export function operatorLane(d) {
245
+ return d.config.operatorPrincipals.length > 0 ? YES : no("operator_principals_empty");
246
+ }
247
+ export function adoption(d) {
248
+ const lane = operatorLane(d);
249
+ if (!lane.available)
250
+ return lane;
251
+ const b = d.backend;
252
+ return b !== undefined && typeof b.adoptionLog === "function" ? yes({ backend: b }) : no("adoption_store_absent");
253
+ }
254
+ export function memoryBundle(d) {
255
+ const lane = operatorLane(d);
256
+ if (!lane.available)
257
+ return lane;
258
+ return d.memoryBundleExport !== undefined && d.memoryBundleImport !== undefined
259
+ ? yes({ exportScopes: d.memoryBundleExport, importBundle: d.memoryBundleImport })
260
+ : no("memory_bundle_faces_absent");
261
+ }
262
+ export function memoryCompliance(d) {
263
+ const lane = operatorLane(d);
264
+ if (!lane.available)
265
+ return lane;
266
+ return d.memoryCompliance !== undefined ? yes({ faces: d.memoryCompliance }) : no("memory_compliance_faces_absent");
267
+ }
268
+ export function memoryOrigin(d) {
269
+ const lane = operatorLane(d);
270
+ if (!lane.available)
271
+ return lane;
272
+ return d.memoryOriginFace !== undefined ? yes({ faces: d.memoryOriginFace }) : no("memory_origin_faces_absent");
273
+ }
274
+ export function memoryConsolidation(d) {
275
+ if (d.memoryConsolidation === undefined)
276
+ return no("consolidation_valve_closed");
277
+ const lane = operatorLane(d);
278
+ return lane.available ? yes({ valve: d.memoryConsolidation }) : lane;
279
+ }
280
+ export function memoryOptOutGrant(d) {
281
+ const lane = operatorLane(d);
282
+ if (!lane.available)
283
+ return lane;
284
+ return d.memoryOptOutGrant !== undefined ? yes({ store: d.memoryOptOutGrant }) : no("memory_optout_grant_absent");
285
+ }
286
+ export function outcomeLedger(d) {
287
+ if (d.config.requirePrincipal === true) {
288
+ const lane = operatorLane(d);
289
+ if (!lane.available)
290
+ return lane;
291
+ }
292
+ const sink = d.outcomeSink;
293
+ return sink?.summary !== undefined ? yes({ sink: sink }) : no("outcome_ledger_unqueryable");
294
+ }
295
+ export function configCatalog(d) {
296
+ if (d.config.configCatalogEnabled !== true)
297
+ return no("config_catalog_disabled");
298
+ return operatorLane(d);
299
+ }
300
+ export function ruleLane(d) {
301
+ return d.ruleConsent !== undefined ? yes({ lane: d.ruleConsent }) : no("rule_store_absent");
302
+ }
303
+ export function ruleLaneForCaller(d, principal) {
304
+ const lane = ruleLane(d);
305
+ if (!lane.available)
306
+ return lane;
307
+ return principal !== undefined ? YES : no("caller_principal_absent");
308
+ }
309
+ export function mcpInjection(d) {
310
+ return mcpInjectionHonored(d.config) ? YES : no("caller_mcp_injection_refused");
311
+ }
312
+ export function a2aServe(d) {
313
+ const serve = d.config.a2aServe;
314
+ if (serve === undefined)
315
+ return no("a2a_serve_off");
316
+ const runs = durableRuns(d);
317
+ return runs.available ? yes({ serve, runStore: runs.runStore }) : runs;
318
+ }
319
+ export function selfOrchestrationEngine(d) {
320
+ return (d.workflowsCapable ?? d.workflowRunStore !== undefined) ? YES : no("workflow_engine_absent");
321
+ }
322
+ export function selfOrchestrationAdmission(d) {
323
+ const denial = selfOrchestrationDenial({ selfOrchestrationEnabled: d.config.selfOrchestrationEnabled, requirePrincipal: d.config.requirePrincipal }, centerEntitlementSourceWired(d.config));
324
+ return denial === null ? YES : no(denial);
325
+ }
326
+ export function selfOrchestration(d) {
327
+ const engine = selfOrchestrationEngine(d);
328
+ if (!engine.available)
329
+ return engine;
330
+ return selfOrchestrationAdmission(d);
331
+ }
332
+ export function workflowRuns(d) {
333
+ return d.workflowRunStore !== undefined ? yes({ store: d.workflowRunStore }) : no("workflow_run_store_absent");
334
+ }
335
+ export function workflowJournal(d) {
336
+ return d.workflowJournalStore !== undefined ? yes({ journal: d.workflowJournalStore }) : no("workflow_journal_store_absent");
337
+ }
338
+ export function workflowsJournal(d) {
339
+ const runs = workflowRuns(d);
340
+ if (!runs.available)
341
+ return runs;
342
+ const journal = workflowJournal(d);
343
+ return journal.available ? yes({ store: runs.store, journal: journal.journal }) : journal;
344
+ }
345
+ export function hostScheduler(c) {
346
+ if (c.schedulerEnabled !== true)
347
+ return no("scheduler_disabled");
348
+ if (c.requirePrincipal === true)
349
+ return no("multi_tenant_deployment");
350
+ if (c.remoteExec?.provider !== "host")
351
+ return no("not_host_lane");
352
+ return YES;
353
+ }
354
+ //# sourceMappingURL=capability-facts.js.map