@wowok/agent-mcp 3.4.1 → 3.4.3

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 (323) hide show
  1. package/dist/.build-stamp.json +5 -0
  2. package/dist/chain-semantics/composition-truth.js +1 -1
  3. package/dist/chain-semantics/eval-order.js +1 -1
  4. package/dist/chain-semantics/field-capability.js +1 -1
  5. package/dist/chain-semantics/freeze-map.js +1 -1
  6. package/dist/chain-semantics/fund-flow.js +1 -1
  7. package/dist/chain-semantics/guard-verbs.js +1 -1
  8. package/dist/chain-semantics/object-graph.js +1 -1
  9. package/dist/composition/audit.js +1 -1
  10. package/dist/composition/compile.d.ts +10 -3
  11. package/dist/composition/compile.js +1 -1
  12. package/dist/composition/emit-phases.d.ts +30 -2
  13. package/dist/composition/emit-phases.js +1 -1
  14. package/dist/composition/guard-fill.d.ts +8 -0
  15. package/dist/composition/guard-fill.js +1 -1
  16. package/dist/composition/inflight.js +1 -1
  17. package/dist/composition/input-normalize.js +1 -1
  18. package/dist/composition/materialize.d.ts +2 -0
  19. package/dist/composition/materialize.js +1 -1
  20. package/dist/composition/mode-gates.js +1 -1
  21. package/dist/composition/param-disclosure.js +1 -1
  22. package/dist/composition/plan-retry-ledger.d.ts +16 -0
  23. package/dist/composition/plan-retry-ledger.js +1 -1
  24. package/dist/composition/plan.d.ts +15 -1
  25. package/dist/composition/plan.js +1 -1
  26. package/dist/config/config-audit.spec.js +1 -1
  27. package/dist/config/judgment.d.ts +5 -0
  28. package/dist/config/judgment.js +1 -1
  29. package/dist/evaluation/builtins/arbitration-score.d.ts +1 -0
  30. package/dist/evaluation/builtins/arbitration-score.js +1 -1
  31. package/dist/evaluation/builtins/demand-match.js +1 -1
  32. package/dist/evaluation/builtins/graph-service.d.ts +8 -0
  33. package/dist/evaluation/builtins/graph-service.js +1 -1
  34. package/dist/evaluation/capability.d.ts +9 -0
  35. package/dist/evaluation/engine.js +1 -1
  36. package/dist/evaluation/extract.d.ts +9 -1
  37. package/dist/evaluation/extract.js +1 -1
  38. package/dist/evaluation/match-operation.js +1 -1
  39. package/dist/evaluation/match-policy.d.ts +5 -3
  40. package/dist/evaluation/match-policy.js +1 -1
  41. package/dist/evaluation/standards.d.ts +1 -0
  42. package/dist/evaluation/standards.js +1 -1
  43. package/dist/evaluation/structured-lines.js +1 -1
  44. package/dist/evaluation/types.d.ts +1 -0
  45. package/dist/extensions/capability.js +1 -1
  46. package/dist/extensions/industry-pack.js +1 -1
  47. package/dist/extensions/modes.js +1 -1
  48. package/dist/harness/recover.js +1 -1
  49. package/dist/index.js +1 -1
  50. package/dist/intent/types.d.ts +1 -1
  51. package/dist/intent/types.js +1 -1
  52. package/dist/knowledge/allocation-ledger.js +1 -1
  53. package/dist/knowledge/allocator-rail-verifier.d.ts +17 -1
  54. package/dist/knowledge/allocator-rail-verifier.js +1 -1
  55. package/dist/knowledge/arb-fund-facts.d.ts +7 -0
  56. package/dist/knowledge/arb-fund-facts.js +1 -1
  57. package/dist/knowledge/arbitration-rail-verifier.d.ts +35 -0
  58. package/dist/knowledge/arbitration-rail-verifier.js +1 -0
  59. package/dist/knowledge/arbitration-templates.js +1 -1
  60. package/dist/knowledge/audit-rules.d.ts +13 -1
  61. package/dist/knowledge/audit-rules.js +1 -1
  62. package/dist/knowledge/baselines/judgment-baselines.json +1 -0
  63. package/dist/knowledge/baselines/rules/guard.json +7 -6
  64. package/dist/knowledge/baselines/rules/progress.json +4 -4
  65. package/dist/knowledge/baselines/rules/reward.json +118 -3
  66. package/dist/knowledge/builtin-templates.d.ts +19 -2
  67. package/dist/knowledge/builtin-templates.js +1 -1
  68. package/dist/knowledge/chain-query-registry.d.ts +14 -0
  69. package/dist/knowledge/chain-query-registry.js +1 -0
  70. package/dist/knowledge/event-semantics.js +1 -1
  71. package/dist/knowledge/fee-param-bindings.d.ts +2 -0
  72. package/dist/knowledge/fee-param-bindings.js +1 -1
  73. package/dist/knowledge/getting-started.js +1 -1
  74. package/dist/knowledge/guard-binding-table.js +1 -1
  75. package/dist/knowledge/guard-binding-verifier.d.ts +7 -0
  76. package/dist/knowledge/guard-binding-verifier.js +1 -1
  77. package/dist/knowledge/guard-bindings.js +1 -1
  78. package/dist/knowledge/guard-design-patterns.d.ts +1 -1
  79. package/dist/knowledge/guard-design-patterns.js +1 -1
  80. package/dist/knowledge/guard-field-cognition.js +1 -1
  81. package/dist/knowledge/guard-host-context.js +1 -1
  82. package/dist/knowledge/guard-lint.js +1 -1
  83. package/dist/knowledge/guard-node-gates.d.ts +3 -1
  84. package/dist/knowledge/guard-node-gates.js +1 -1
  85. package/dist/knowledge/guard-puzzle.js +1 -1
  86. package/dist/knowledge/guard-render.js +1 -1
  87. package/dist/knowledge/guard-risk.js +1 -1
  88. package/dist/knowledge/guard-templates.d.ts +2 -1
  89. package/dist/knowledge/guard-templates.js +1 -1
  90. package/dist/knowledge/guard-translation.js +1 -1
  91. package/dist/knowledge/index.d.ts +2 -0
  92. package/dist/knowledge/index.js +1 -1
  93. package/dist/knowledge/industry-registry.js +1 -1
  94. package/dist/knowledge/jsonrpc-enum.js +1 -1
  95. package/dist/knowledge/knob-docs.js +1 -1
  96. package/dist/knowledge/param-schema.d.ts +1 -1
  97. package/dist/knowledge/param-schema.js +1 -1
  98. package/dist/knowledge/param-tiers.d.ts +2 -0
  99. package/dist/knowledge/param-tiers.js +1 -1
  100. package/dist/knowledge/path-oracle/products/food-delivery.js +1 -1
  101. package/dist/knowledge/pattern-resolutions.d.ts +2 -0
  102. package/dist/knowledge/pattern-resolutions.js +1 -1
  103. package/dist/knowledge/product-detail-source.d.ts +37 -0
  104. package/dist/knowledge/product-detail-source.js +1 -0
  105. package/dist/knowledge/product-doc-b5.d.ts +16 -0
  106. package/dist/knowledge/product-doc-b5.js +1 -0
  107. package/dist/knowledge/progress-ledger.js +1 -1
  108. package/dist/knowledge/projection.spec.js +1 -1
  109. package/dist/knowledge/publish-gate.d.ts +20 -0
  110. package/dist/knowledge/publish-gate.js +1 -0
  111. package/dist/knowledge/publish-readiness.d.ts +25 -0
  112. package/dist/knowledge/publish-readiness.js +1 -0
  113. package/dist/knowledge/publish-surface-contract.d.ts +16 -0
  114. package/dist/knowledge/publish-surface-contract.js +1 -0
  115. package/dist/knowledge/rail-exit-satisfiability.d.ts +25 -0
  116. package/dist/knowledge/rail-exit-satisfiability.js +1 -0
  117. package/dist/knowledge/reward-ledger.d.ts +1 -1
  118. package/dist/knowledge/reward-ledger.js +1 -1
  119. package/dist/knowledge/reward-risk.d.ts +1 -1
  120. package/dist/knowledge/reward-risk.js +1 -1
  121. package/dist/knowledge/scenario-modes.js +1 -1
  122. package/dist/knowledge/service-ledger.d.ts +3 -1
  123. package/dist/knowledge/service-ledger.js +1 -1
  124. package/dist/knowledge/template-loader.d.ts +41 -2
  125. package/dist/knowledge/template-loader.js +1 -1
  126. package/dist/knowledge/template-registry.js +1 -1
  127. package/dist/knowledge/template-scanner.d.ts +17 -0
  128. package/dist/knowledge/template-scanner.js +1 -1
  129. package/dist/knowledge/template-test-profiles.js +1 -1
  130. package/dist/knowledge/workflow-guidance.d.ts +4 -0
  131. package/dist/knowledge/workflow-guidance.js +1 -1
  132. package/dist/monitor/MonitorLoop.js +1 -1
  133. package/dist/monitor/normalize.d.ts +1 -1
  134. package/dist/monitor/normalize.js +1 -1
  135. package/dist/monitor/types.js +1 -1
  136. package/dist/participation/customer-interest.d.ts +4 -0
  137. package/dist/participation/customer-interest.js +1 -1
  138. package/dist/participation/game-context.js +1 -1
  139. package/dist/participation/node-action-advisor.d.ts +4 -0
  140. package/dist/participation/node-action-advisor.js +1 -1
  141. package/dist/participation/radar-core.js +1 -1
  142. package/dist/participation/time-window.d.ts +11 -0
  143. package/dist/participation/time-window.js +1 -1
  144. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  145. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  146. package/dist/playbooks/service-build/merchant-guide.d.ts +28 -3
  147. package/dist/playbooks/service-build/merchant-guide.js +1 -1
  148. package/dist/playbooks/service-build/object-panorama.d.ts +4 -0
  149. package/dist/playbooks/service-build/object-panorama.js +1 -1
  150. package/dist/playbooks/service-build/participation-radar.js +1 -1
  151. package/dist/playbooks/service-build/relationship-profile.js +1 -1
  152. package/dist/playbooks/service-build/service-panorama.js +1 -1
  153. package/dist/playbooks/service-build/service-quote.js +1 -1
  154. package/dist/review/index.js +1 -1
  155. package/dist/review/order.js +1 -1
  156. package/dist/safety/confirm-gate.js +1 -1
  157. package/dist/schema/benchmark-migration/index.d.ts +24 -0
  158. package/dist/schema/benchmark-migration/index.js +1 -1
  159. package/dist/schema/call/allocation.d.ts +11 -7
  160. package/dist/schema/call/allocation.js +1 -1
  161. package/dist/schema/call/arbitration.d.ts +4 -0
  162. package/dist/schema/call/arbitration.js +1 -1
  163. package/dist/schema/call/base.d.ts +28 -0
  164. package/dist/schema/call/base.js +1 -1
  165. package/dist/schema/call/bridge.d.ts +21 -0
  166. package/dist/schema/call/contact.d.ts +4 -0
  167. package/dist/schema/call/demand.d.ts +4 -0
  168. package/dist/schema/call/guard.d.ts +12 -0
  169. package/dist/schema/call/handler.d.ts +1 -0
  170. package/dist/schema/call/handler.js +1 -1
  171. package/dist/schema/call/machine.d.ts +16 -8
  172. package/dist/schema/call/normalize-error.d.ts +1 -0
  173. package/dist/schema/call/normalize-error.js +1 -0
  174. package/dist/schema/call/order.d.ts +7 -3
  175. package/dist/schema/call/order.js +1 -1
  176. package/dist/schema/call/payment.d.ts +7 -3
  177. package/dist/schema/call/permission.d.ts +4 -0
  178. package/dist/schema/call/personal.d.ts +4 -0
  179. package/dist/schema/call/progress.d.ts +4 -0
  180. package/dist/schema/call/progress.js +1 -1
  181. package/dist/schema/call/proof.d.ts +8 -0
  182. package/dist/schema/call/proof.js +1 -1
  183. package/dist/schema/call/receipt.js +1 -1
  184. package/dist/schema/call/repository.d.ts +4 -0
  185. package/dist/schema/call/reward.d.ts +6 -2
  186. package/dist/schema/call/reward.js +1 -1
  187. package/dist/schema/call/semantic.d.ts +2 -2
  188. package/dist/schema/call/semantic.js +1 -1
  189. package/dist/schema/call/service.d.ts +21 -7
  190. package/dist/schema/call/service.js +1 -1
  191. package/dist/schema/call/treasury.d.ts +10 -6
  192. package/dist/schema/common/index.js +1 -1
  193. package/dist/schema/envelope-unify.d.ts +1 -0
  194. package/dist/schema/envelope-unify.js +1 -1
  195. package/dist/schema/evaluation/index.d.ts +43 -0
  196. package/dist/schema/evaluation/index.js +1 -1
  197. package/dist/schema/goal/index.d.ts +14 -2
  198. package/dist/schema/goal/planning.d.ts +18 -0
  199. package/dist/schema/goal/planning.js +1 -1
  200. package/dist/schema/intent-radar/index.d.ts +12 -0
  201. package/dist/schema/intent-radar/index.js +1 -1
  202. package/dist/schema/keeper/index.d.ts +1 -0
  203. package/dist/schema/local/index.d.ts +10 -0
  204. package/dist/schema/local/index.js +1 -1
  205. package/dist/schema/local/wip.js +1 -1
  206. package/dist/schema/messenger/index.d.ts +1 -0
  207. package/dist/schema/messenger/index.js +1 -1
  208. package/dist/schema/operations.d.ts +98 -13
  209. package/dist/schema/operations.js +1 -1
  210. package/dist/schema/persona/index.d.ts +22 -0
  211. package/dist/schema/query/bi.d.ts +28 -2
  212. package/dist/schema/query/bi.js +1 -1
  213. package/dist/schema/query/index.d.ts +67 -61
  214. package/dist/schema/query/index.js +1 -1
  215. package/dist/schema/schema-version.js +1 -1
  216. package/dist/schema/workflow/index.js +1 -1
  217. package/dist/schema-query-impl/index.d.ts +1 -0
  218. package/dist/schema-query-impl/index.js +1 -1
  219. package/dist/schemas/account_operation.output.json +2 -1
  220. package/dist/schemas/benchmark_migration_operation.output.json +74 -0
  221. package/dist/schemas/benchmark_migration_operation.schema.json +33 -1
  222. package/dist/schemas/bridge_operation.output.json +2 -1
  223. package/dist/schemas/bridge_operation.schema.json +40 -0
  224. package/dist/schemas/evaluation_operation.output.json +96 -0
  225. package/dist/schemas/evaluation_operation.schema.json +39 -0
  226. package/dist/schemas/goal_operation.schema.json +32 -0
  227. package/dist/schemas/guard2file.schema.json +8 -0
  228. package/dist/schemas/index.json +1 -1
  229. package/dist/schemas/intent_radar.output.json +10 -2
  230. package/dist/schemas/intent_radar.schema.json +5 -1
  231. package/dist/schemas/keeper_operation.output.json +2 -1
  232. package/dist/schemas/local_cache_operation.output.json +2 -1
  233. package/dist/schemas/local_history_operation.output.json +2 -1
  234. package/dist/schemas/local_info_operation.output.json +2 -1
  235. package/dist/schemas/local_mark_operation.output.json +2 -1
  236. package/dist/schemas/local_mark_operation.schema.json +10 -1
  237. package/dist/schemas/machineNode2file.schema.json +8 -0
  238. package/dist/schemas/messenger_operation.output.json +2 -1
  239. package/dist/schemas/messenger_operation.schema.json +2 -1
  240. package/dist/schemas/monitor_events.output.json +2 -1
  241. package/dist/schemas/monitor_subscription.output.json +2 -1
  242. package/dist/schemas/onchain_events.output.json +206 -13
  243. package/dist/schemas/onchain_events.schema.json +16 -0
  244. package/dist/schemas/onchain_operations.output.json +22 -3
  245. package/dist/schemas/onchain_operations.schema.json +982 -327
  246. package/dist/schemas/onchain_operations_allocation.schema.json +20 -13
  247. package/dist/schemas/onchain_operations_arbitration.schema.json +9 -1
  248. package/dist/schemas/onchain_operations_contact.schema.json +8 -0
  249. package/dist/schemas/onchain_operations_demand.schema.json +8 -0
  250. package/dist/schemas/onchain_operations_gen_passport.schema.json +8 -0
  251. package/dist/schemas/onchain_operations_gen_proof.schema.json +8 -0
  252. package/dist/schemas/onchain_operations_guard.schema.json +655 -115
  253. package/dist/schemas/onchain_operations_machine.schema.json +11 -3
  254. package/dist/schemas/onchain_operations_order.schema.json +14 -11
  255. package/dist/schemas/onchain_operations_payment.schema.json +12 -9
  256. package/dist/schemas/onchain_operations_permission.schema.json +8 -0
  257. package/dist/schemas/onchain_operations_personal.schema.json +8 -0
  258. package/dist/schemas/onchain_operations_progress.schema.json +9 -1
  259. package/dist/schemas/onchain_operations_proof.schema.json +9 -1
  260. package/dist/schemas/onchain_operations_repository.schema.json +8 -0
  261. package/dist/schemas/onchain_operations_reward.schema.json +14 -11
  262. package/dist/schemas/onchain_operations_service.schema.json +25 -12
  263. package/dist/schemas/onchain_operations_treasury.schema.json +17 -19
  264. package/dist/schemas/onchain_table_data.output.json +52 -10
  265. package/dist/schemas/persona_operation.output.json +57 -0
  266. package/dist/schemas/persona_operation.schema.json +9 -0
  267. package/dist/schemas/query_toolkit.output.json +326 -23
  268. package/dist/schemas/query_toolkit.schema.json +18 -5
  269. package/dist/schemas/wip_file.output.json +2 -2
  270. package/dist/schemas/wip_file.schema.json +2 -2
  271. package/dist/schemas/workflow_operation.schema.json +1 -1
  272. package/dist/tools/error-catalog.d.ts +17 -0
  273. package/dist/tools/error-catalog.js +1 -0
  274. package/dist/tools/handlers/benchmark-migration.d.ts +29 -8
  275. package/dist/tools/handlers/benchmark-migration.js +1 -1
  276. package/dist/tools/handlers/config.js +1 -1
  277. package/dist/tools/handlers/entry-edge-recipe.d.ts +101 -0
  278. package/dist/tools/handlers/entry-edge-recipe.js +1 -0
  279. package/dist/tools/handlers/escrow-deficit.d.ts +10 -0
  280. package/dist/tools/handlers/escrow-deficit.js +1 -0
  281. package/dist/tools/handlers/evaluation.js +1 -1
  282. package/dist/tools/handlers/fund-rail-recipe.d.ts +10 -0
  283. package/dist/tools/handlers/fund-rail-recipe.js +1 -0
  284. package/dist/tools/handlers/intent-radar.js +1 -1
  285. package/dist/tools/handlers/local.js +1 -1
  286. package/dist/tools/handlers/mark-namespace.d.ts +30 -0
  287. package/dist/tools/handlers/mark-namespace.js +1 -0
  288. package/dist/tools/handlers/messenger.js +1 -1
  289. package/dist/tools/handlers/onchain-name-registration.d.ts +1 -0
  290. package/dist/tools/handlers/onchain-name-registration.js +1 -1
  291. package/dist/tools/handlers/onchain-name-registration.spec.js +1 -1
  292. package/dist/tools/handlers/onchain.d.ts +40 -1
  293. package/dist/tools/handlers/onchain.js +1 -1
  294. package/dist/tools/handlers/publish-binding-echo.d.ts +22 -0
  295. package/dist/tools/handlers/publish-binding-echo.js +1 -0
  296. package/dist/tools/handlers/query.d.ts +1 -1
  297. package/dist/tools/handlers/query.js +1 -1
  298. package/dist/tools/handlers/review-chain.d.ts +1 -0
  299. package/dist/tools/handlers/review-chain.js +1 -1
  300. package/dist/tools/handlers/schema-query.js +1 -1
  301. package/dist/tools/handlers/stale-build-check.d.ts +9 -0
  302. package/dist/tools/handlers/stale-build-check.js +1 -0
  303. package/dist/tools/handlers/submission-assembly.d.ts +55 -0
  304. package/dist/tools/handlers/submission-assembly.js +1 -0
  305. package/dist/tools/handlers/wip.js +1 -1
  306. package/dist/tools/index.d.ts +1 -0
  307. package/dist/tools/index.js +1 -1
  308. package/dist/tools/move-fn-index.gen.js +1 -1
  309. package/dist/tools/publish-gate-state.d.ts +5 -0
  310. package/dist/tools/publish-gate-state.js +1 -0
  311. package/dist/tools/registry/business.js +1 -1
  312. package/dist/tools/registry/onchain.js +1 -1
  313. package/dist/tools/registry/query.js +1 -1
  314. package/dist/tools/retry.js +1 -1
  315. package/dist/tools/runtime-health.js +1 -1
  316. package/dist/tools/shared.js +1 -1
  317. package/dist/tools/upgrade-check.d.ts +1 -0
  318. package/dist/tools/upgrade-check.js +1 -1
  319. package/dist/tools/wip-verify-ledger.d.ts +2 -0
  320. package/dist/tools/wip-verify-ledger.js +1 -1
  321. package/dist/tools/wrap.d.ts +15 -1
  322. package/dist/tools/wrap.js +1 -1
  323. package/package.json +5 -3
@@ -1 +1 @@
1
- export const MS_PER_DAY=0x5265c00;export const MS_PER_HOUR=0x36ee80;export const TIME_GUARD_INSTANTIATIONS=[{'template':'retail/scale-marketplace','guard_key':'claim_filed','direction':'upper','anchor':'claim_window','days':'claim_window_days','note':'buyer\x20files\x20a\x20claim\x20only\x20inside\x20the\x20claim\x20window'},{'template':'retail/scale-marketplace','guard_key':'review_window','direction':'upper','anchor':'delivered','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20delivery'},{'template':'retail/scale-marketplace','guard_key':'return_window','direction':'upper','anchor':'delivered','days':'return_window_days','note':'return\x20request\x20inside\x20the\x20policy\x20window'},{'template':'retail/scale-marketplace','guard_key':'deliver_confirm_timeout','direction':'lower','anchor':'shipped','days':'auto_confirm_days','note':'auto-confirm\x20N\x20days\x20after\x20shipment'},{'template':'retail/warehouse-club','guard_key':'claim_filed','direction':'upper','anchor':'claim_window','days':'claim_window_days','note':'buyer\x20files\x20a\x20claim\x20only\x20inside\x20the\x20claim\x20window'},{'template':'retail/warehouse-club','guard_key':'review_window','direction':'upper','anchor':'delivered','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20delivery'},{'template':'retail/warehouse-club','guard_key':'return_window','direction':'upper','anchor':'delivered','days':'return_window_days','note':'return\x20request\x20inside\x20the\x20policy\x20window'},{'template':'retail/warehouse-club','guard_key':'deliver_confirm_timeout','direction':'lower','anchor':'shipped','days':'auto_confirm_days','note':'auto-confirm\x20N\x20days\x20after\x20shipment'},{'template':'retail/preorder-deposit','guard_key':'balance_window_open','direction':'lower','anchor':'deposit_paid','days':'production_lead_days','note':'balance\x20window\x20opens\x20after\x20the\x20production\x20lead'},{'template':'retail/preorder-deposit','guard_key':'balance_deadline','direction':'lower','anchor':'balance_due','days':'balance_window_days','note':'balance-window\x20timeout'},{'template':'retail/preorder-deposit','guard_key':'review_window','direction':'upper','anchor':'delivered','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20delivery'},{'template':'retail/preorder-deposit','guard_key':'deliver_confirm_timeout','direction':'lower','anchor':'shipped','days':'auto_confirm_days','note':'auto-confirm\x20N\x20days\x20after\x20shipment'},{'template':'retail/restock-supply','guard_key':'deliver_confirm_timeout','direction':'lower','anchor':'shipped','days':'auto_confirm_days','note':'auto-confirm\x20N\x20days\x20after\x20shipment'},{'template':'retail/restock-supply','guard_key':'restock_confirm_timeout','direction':'lower','anchor':'delivered','days':'restock_confirm_days','note':'restock\x20confirmation\x20timeout'},{'template':'retail/vertical-handmade','guard_key':'ship_timeout','direction':'lower','anchor':'confirmed','days':'processing_time_days','note':'unshipped\x20order\x20cancels\x20after\x20the\x20processing\x20time'},{'template':'retail/vertical-handmade','guard_key':'deliver_confirm_timeout','direction':'lower','anchor':'shipped','days':'auto_confirm_days','note':'auto-confirm\x20N\x20days\x20after\x20shipment'},{'template':'freelance/enterprise-talent-market','guard_key':'review_settle_clock','direction':'lower','anchor':'reviewed','days':'settlement_delay_days','note':'settle\x20N\x20days\x20after\x20review'},{'template':'freelance/enterprise-talent-market','guard_key':'accept_timeout','direction':'lower','anchor':'delivered','days':'escrow_release_days','note':'keeper\x20auto-accepts\x20the\x20delivery\x20N\x20days\x20after\x20submission\x20(the\x20timeout\x20branch\x20of\x20the\x20dual-branch\x20acceptance)'},{'template':'freelance/enterprise-talent-market','guard_key':'review_window','direction':'upper','anchor':'accepted','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20acceptance'},{'template':'freelance/catalog-tiers','guard_key':'requirements_timeout_48h','direction':'lower','anchor':'in_progress','hours':'requirements_timeout_hours','note':'requirements\x20timeout'},{'template':'freelance/catalog-tiers','guard_key':'cancel_response_timeout','direction':'lower','anchor':'cancel_requested','hours':'response_timeout_hours','note':'keeper\x20auto-cancel\x20after\x20the\x20seller\x27s\x20silence'},{'template':'freelance/catalog-tiers','guard_key':'refund_response_timeout','direction':'lower','anchor':'refund_requested','hours':'refund_response_hours','note':'keeper\x20auto-cancel\x20after\x20the\x20seller\x27s\x20silence\x20on\x20a\x20refund\x20request'},{'template':'freelance/catalog-tiers','guard_key':'accept_timeout','direction':'lower','anchor':'delivered','days':'escrow_release_days','note':'auto-accept\x20N\x20days\x20after\x20delivery\x20(buyer\x20silence)'},{'template':'freelance/catalog-tiers','guard_key':'review_window','direction':'upper','anchor':'accepted','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20acceptance'},{'template':'freelance/catalog-tiers','guard_key':'review_settle_clock','direction':'lower','anchor':'reviewed','days':'settlement_delay_days','note':'settle\x20N\x20days\x20after\x20review'},{'template':'freelance/creator-zero-commission','guard_key':'accept_timeout','direction':'lower','anchor':'delivered','hours':'acceptance_timeout_hours','note':'delivery\x20acceptance\x20timeout'},{'template':'freelance/creator-zero-commission','guard_key':'defect_report_window','direction':'upper','anchor':'delivered','hours':'defect_report_window_hours','note':'defect\x20report\x20window\x20after\x20delivery'},{'template':'freelance/creator-zero-commission','guard_key':'review_window','direction':'upper','anchor':'accepted','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20acceptance'},{'template':'freelance/design-contest','guard_key':'submission_window','direction':'lower','anchor':'funded','days':'submission_window_days','note':'submissions\x20close\x20N\x20days\x20after\x20funding'},{'template':'freelance/design-contest','guard_key':'appeal_window','direction':'lower','anchor':'placement_provisional','days':'appeal_window_days','note':'placement\x20finalizes\x20after\x20the\x20appeal\x20window'},{'template':'freelance/design-contest','guard_key':'delivery_window','direction':'lower','anchor':'final_delivery','days':'delivery_window_days','note':'final\x20delivery\x20acceptance\x20timeout'},{'template':'rental/p2p-shortstay','guard_key':'confirm_expire','direction':'lower','anchor':'reserved','hours':'confirm_window_hours','note':'unconfirmed\x20booking\x20expires'},{'template':'rental/p2p-shortstay','guard_key':'claim_window_closed','direction':'lower','anchor':'claim_window','days':'claim_window_days','note':'no-claim\x20release\x20after\x20the\x20claim\x20window'},{'template':'rental/p2p-shortstay','guard_key':'guest_claim_window_open','direction':'upper','anchor':'claim_window','days':'claim_window_days','note':'guest\x20files\x20a\x20claim\x20inside\x20the\x20claim\x20window'},{'template':'rental/institutional-longstay','guard_key':'return_notice','direction':'lower','anchor':'in_use','days':'return_notice_days','note':'return\x20notice\x20lead\x20time'},{'template':'rental/institutional-longstay','guard_key':'nofault_window','direction':'upper','anchor':'deposit_paid','multimount':!![],'days':'no_fault_exit_days','note':'no-fault\x20exit\x20within\x20no_fault_exit_days\x20of\x20signing,\x20on\x20both\x20buyer\x20exits\x20into\x20closed_cancel\x20(pre-handover\x20and\x20mid-lease\x20—\x20in_use\x20is\x20only\x20entered\x20from\x20deposit_paid,\x20whose\x20entry\x20IS\x20the\x20signing)'},{'template':'rental/institutional-longstay','guard_key':'review_window','direction':'upper','anchor':'inspected','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20the\x20passing\x20inspection'},{'template':'travel/destination-experience','guard_key':'free_cancel','direction':'upper','anchor':'paid','hours':'free_cancel_hours','note':'free\x20cancellation\x20window'},{'template':'travel/destination-experience','guard_key':'poststay_claim_window','direction':'upper','anchor':'claim_window','days':'claim_window_days','note':'post-stay\x20claim\x20window'},{'template':'travel/destination-experience','guard_key':'release_no_claim_clock','direction':'lower','anchor':'claim_window','days':'claim_window_days','note':'no-claim\x20release\x20after\x20the\x20claim\x20window'},{'template':'delivery/on-demand-errand','guard_key':'deliver_confirm_timeout','direction':'lower','anchor':'delivered','hours':'auto_confirm_hours','note':'auto-confirm\x20N\x20hours\x20after\x20delivery'},{'template':'delivery/on-demand-errand','guard_key':'claim_filed','direction':'upper','anchor':'claim_window','hours':'claim_window_hours','note':'claim\x20window'},{'template':'delivery/on-demand-errand','guard_key':'return_request','direction':'upper','anchor':'delivered','hours':'return_window_hours','note':'after-sales\x20return\x20request\x20closes\x20N\x20hours\x20after\x20the\x20delivered\x20FIRST\x20entry'},{'template':'delivery/restaurant-marketplace','guard_key':'return_request','direction':'upper','anchor':'delivered','hours':'return_window_hours','note':'after-sales\x20return\x20request\x20closes\x20N\x20hours\x20after\x20the\x20delivered\x20FIRST\x20entry'},{'template':'group_buy/leader-sourced-community','guard_key':'claim_filed','direction':'upper','anchor':'claim_window','hours':'claim_window_hours','note':'buyer\x20files\x20a\x20claim\x20only\x20inside\x20the\x20claim\x20window'},{'template':'subscription/delivery-membership','guard_key':'period_end','direction':'lower','anchor':'active','days':'period_days','note':'membership\x20period\x20clock:\x20active\x20entry\x20+\x20period_days\x20before\x20the\x20keeper\x20may\x20complete'},{'template':'subscription/creator-membership','guard_key':'period_expiry','direction':'lower','anchor':'delivered','multimount':!![],'days':'period_days','plus_days':'grace_days','note':'period\x20expiry\x20=\x20delivery\x20+\x20period_days\x20+\x20grace_days,\x20on\x20every\x20keeper\x20lapse'},{'template':'subscription/direct-fan-subscription','guard_key':'period_expiry','direction':'lower','anchor':'delivered','multimount':!![],'days':'period_days','plus_days':'grace_days','note':'period\x20expiry\x20=\x20delivery\x20+\x20period_days\x20+\x20grace_days,\x20on\x20every\x20keeper\x20lapse'},{'template':'education/live-class-cohort','guard_key':'review_window','direction':'upper','anchor':'completed_ready','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20completion\x20readiness'},{'template':'education/mooc-single-course','guard_key':'review_window','direction':'upper','anchor':'certified','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20certification'},{'template':'subscription/creator-membership','guard_key':'review_window','direction':'upper','anchor':'delivered','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20period\x20delivery'},{'template':'subscription/direct-fan-subscription','guard_key':'review_window','direction':'upper','anchor':'delivered','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20period\x20delivery\x20—\x20keep\x20period_days\x20+\x20grace_days\x20>\x20review_window_days\x20or\x20the\x20keeper\x20expire\x20kills\x20the\x20open\x20window'},{'template':'retail/preorder-deposit','guard_key':'return_window_presale','direction':'upper','anchor':'delivered','multimount':!![],'days':'return_window_days','note':'return\x20requested\x20within\x20N\x20days\x20of\x20delivery,\x20from\x20delivered\x20or\x20from\x20reviewed'},{'template':'rental/p2p-shortstay','guard_key':'review_window','direction':'upper','anchor':'checked_out','multimount':!![],'days':'review_window_days','note':'review\x20within\x20N\x20days\x20of\x20checkout,\x20including\x20once\x20the\x20claim\x20window\x20has\x20opened'},{'template':'education/mooc-single-course','guard_key':'return_window','direction':'upper','anchor':'paid','multimount':!![],'days':'refund_window_days','note':'refund\x20requested\x20within\x20N\x20days\x20of\x20purchase,\x20from\x20any\x20pre-delivery\x20stage'},{'template':'retail/scale-marketplace','guard_key':'settle_window_gate','direction':'lower','anchor':'claim_window','days':'settlement_days','plus_days':['reserve_days','return_window_days'],'note':'settlement\x20opens\x20after\x20the\x20MERGED\x20lock:\x20settlement_days\x20+\x20reserve_days\x20+\x20return_window_days\x20(the\x20declaration\x20settlement_window_merge;\x2014\x20+\x207\x20+\x2030\x20=\x2051\x20days\x20by\x20default)\x20—\x20the\x20release\x20cannot\x20fire\x20while\x20the\x20return\x20window\x20can\x20still\x20draw\x20the\x20escrow'},{'template':'retail/warehouse-club','guard_key':'settle_window_gate','direction':'lower','anchor':'claim_window','days':'settlement_delay_days','note':'settlement\x20opens\x20N\x20days\x20after\x20the\x20claim\x20window\x20(coupled\x20to\x20the\x20return\x20window)'},{'template':'retail/preorder-deposit','guard_key':'settle_window_gate','direction':'lower','anchor':'delivered','multimount':!![],'days':'settlement_days','note':'balance\x20settlement\x20opens\x20N\x20days\x20after\x20delivery,\x20from\x20delivered\x20or\x20from\x20reviewed'},{'template':'retail/vertical-handmade','guard_key':'settle_clock','direction':'lower','anchor':'delivered','multimount':!![],'days':'settlement_delay_days','note':'settlement\x20opens\x20N\x20days\x20after\x20delivery,\x20from\x20delivered\x20or\x20from\x20reviewed'},{'template':'delivery/on-demand-errand','guard_key':'settle_window_gate','direction':'lower','anchor':'claim_window','hours':'settle_hours','note':'settlement\x20opens\x20N\x20hours\x20after\x20the\x20claim\x20window'},{'template':'group_buy/leader-sourced-community','guard_key':'settle_window_gate','direction':'lower','anchor':'claim_window','hours':'settle_hours','note':'settlement\x20opens\x20N\x20hours\x20after\x20the\x20claim\x20window,\x20past\x20the\x20after-sales\x20track'},{'template':'group_buy/leader-sourced-community','guard_key':'claim_window_open','direction':'lower','anchor':'delivered','hours':'claim_window_open_min_hold_hours','note':'claim\x20window\x20opens\x20N\x20hours\x20after\x20delivery\x20(the\x20buyer\x27s\x20dispute\x20clock\x20cannot\x20start\x20at\x20the\x20delivery\x20instant)'}];export const TWIN_PARAM={'days':'claim_window_days','hours':'duration_ms'};export function twinFor(a,b){if(b==='days')return a==='upper'?'tpl_time_window_upper_progress_days':'tpl_time_lock_progress_days';return a==='upper'?'tpl_time_window_upper':'tpl_time_lock_progress';}export const MULTI_MOUNT_TWIN='tpl_time_window_upper_history_days';export const MULTI_MOUNT_OPENING_TWIN='tpl_time_lock_history_days';export function multiMountTwin(a){return a==='upper'?MULTI_MOUNT_TWIN:MULTI_MOUNT_OPENING_TWIN;}export function unitScale(a){return a==='days'?0x1:MS_PER_HOUR;}const BY_SPEC=new Map();for(const row of TIME_GUARD_INSTANTIATIONS)BY_SPEC['set'](row['template']+'\x00'+row['guard_key'],row);export function timeInstantiationFor(a,b){return BY_SPEC['get'](a+'\x00'+b);}export function patternDefaultResolution(a,b){const c=timeInstantiationFor(a,b);if(c===undefined)return undefined;const d=c['days']!==undefined?'days':'hours';if(c['multimount']===!![])return{'kind':'template','template_id':multiMountTwin(c['direction']),'params':{'anchor_node':c['anchor']}};return{'kind':'template','template_id':twinFor(c['direction'],d),'params':{'expected_node':c['anchor']}};}function mountInfo(a,b){const c=[];for(const d of a['machine_shape']??[]){const f=d['from']??[];for(const g of f){const h=typeof g==='string'?{'prev':g}:g;if(h['guard_key']!==b)continue;const i=h['operator']??d['operator']??(h['prev']===''?'order_payer':'merchant');c['push']({'prev':h['prev']??'','operator':i});}}return c;}export const IDENTITY_PATTERN='pattern.identity_check_order_holder';export const IDENTITY_TWIN='tpl_forward_order_holder';export const IDENTITY_RECOVER_RAIL_TWIN='tpl_allocator_node_gate_recover';export const IDENTITY_REFUND_RAIL_TWIN='tpl_allocator_identity_set_order_holder';function railTracks(a,b){return(a['allocator']?.['rows']??[])['filter'](c=>c['guard_key']===b)['map'](c=>c['track']??'');}function hasAwardRailSibling(a,b){return a['guards']['some'](c=>{if(c['template_id']===IDENTITY_RECOVER_RAIL_TWIN)return!![];const d=c['key'];if(d===undefined||d===b)return![];if(!/recover|award/i['test'](d))return![];if(!/pattern\./i['test'](c['template_id']))return![];return edgeMounts(a,d)['length']===0x0&&railTracks(a,d)['length']>0x0;});}function edgeMounts(a,b){return mountInfo(a,b);}export function identitySkipReason(a,b){if(b['template_id']!==IDENTITY_PATTERN)return'not\x20an\x20identity\x20design';if(b['key']===undefined)return'declared\x20without\x20a\x20key:\x20it\x20names\x20a\x20policy,\x20not\x20a\x20rail';const c=b['key'],d=railTracks(a,c),e=edgeMounts(a,c);if(e['length']===0x0){if(d['length']===0x0)return'no\x20mount\x20in\x20the\x20declared\x20graph';if(/recover|award/i['test'](c))return undefined;if(/refund/i['test'](c)&&d['every'](g=>/refund/i['test'](g))){if(hasAwardRailSibling(a,c))return'rail-bound\x20refund\x20next\x20to\x20an\x20award/recover\x20rail:\x20the\x20order-holder\x20refund\x20set\x20is\x20node-free,\x20so\x20instantiating\x20both\x20gives\x20one\x20escrow\x20two\x20live\x20fund\x20exits\x20(RAIL-03)\x20—\x20legal\x20but\x20a\x20merchant\x20choice\x20(disclosed\x20double\x20collection),\x20resolve\x20the\x20refund\x20rail\x20explicitly';return undefined;}return'bound\x20to\x20an\x20allocator\x20row\x20only:\x20no\x20executable\x20twin\x20matches\x20this\x20key/track\x20pair\x20(a\x20settlement\x20rail\x20asks\x20a\x20different\x20question)';}if(d['length']>0x0)return'also\x20bound\x20to\x20an\x20allocator\x20row:\x20one\x20design\x20cannot\x20serve\x20a\x20forward\x20and\x20a\x20rail';const f=e['filter'](g=>g['operator']!=='order_payer');if(f['length']>0x0)return'mounted\x20on\x20'+f['length']+'\x20non-buyer\x20forward(s)\x20('+[...new Set(f['map'](g=>g['operator']))]['join']('/')+'):\x20'+'an\x20order-holder\x20leg\x20is\x20unsatisfiable\x20on\x20a\x20permission-index\x20rail';return undefined;}export function identityDefaultResolution(a,b){if(identitySkipReason(a,b)!==undefined)return undefined;const c=b['key'];if(edgeMounts(a,c)['length']===0x0){if(/recover|award/i['test'](c))return{'kind':'template','template_id':IDENTITY_RECOVER_RAIL_TWIN,'params':{}};return{'kind':'template','template_id':IDENTITY_REFUND_RAIL_TWIN,'params':{}};}return{'kind':'template','template_id':IDENTITY_TWIN,'params':{}};}export function identityCensus(a){const b=[];for(const c of a){c['guards']['forEach']((d,e)=>{if(d['template_id']!==IDENTITY_PATTERN)return;const f=d['key']??d['template_id']+'#'+e,h=identitySkipReason(c,d);b['push']({'template':c['id'],'key':f,...h!==undefined?{'skipped':h}:{}});});}return b;}export const PROGRESS_PATTERN='pattern.progress_state_check';export const PROGRESS_NODE_CHECK_TWIN='tpl_forward_node_check';export const PROGRESS_RECOVER_RAIL_TWIN='tpl_allocator_node_gate_recover';export function progressSkipReason(a,b){if(b['template_id']!==PROGRESS_PATTERN)return'not\x20a\x20progress-state\x20design';if(b['key']===undefined)return'declared\x20without\x20a\x20key:\x20it\x20names\x20a\x20policy,\x20not\x20a\x20rail';const c=b['key'],d=railTracks(a,c),e=edgeMounts(a,c);if(/recover|award/i['test'](c)){if(e['length']===0x0&&d['length']===0x0)return'no\x20mount\x20in\x20the\x20declared\x20graph';return undefined;}if(d['length']>0x0)return e['length']>0x0?'bound\x20to\x20BOTH\x20a\x20forward\x20and\x20an\x20allocator\x20rail:\x20a\x20node-gated\x20twin\x20cannot\x20serve\x20the\x20pre-advance\x20forward\x20and\x20the\x20post-advance\x20allocator\x20(D8)':'rail-bound\x20with\x20no\x20forward\x20mount:\x20the\x20graph\x20cannot\x20say\x20which\x20node\x20the\x20order\x20occupies\x20when\x20the\x20rail\x20fires\x20(pinning\x20one\x20strands\x20the\x20escrow\x20below\x20it\x20—\x20UPWC-K1)';if(e['length']===0x0)return'no\x20mount\x20in\x20the\x20declared\x20graph';const f=[...new Set(e['map'](g=>g['prev']))];if(f['length']>0x1)return'mounted\x20on\x20'+e['length']+'\x20forwards\x20from\x20DIFFERENT\x20prev\x20nodes\x20('+f['join']('/')+'):\x20one\x20expected_node\x20cannot\x20serve\x20them';return undefined;}export function progressStateDefaultResolution(a,b){if(progressSkipReason(a,b)!==undefined)return undefined;if(/recover|award/i['test'](b['key']))return{'kind':'template','template_id':PROGRESS_RECOVER_RAIL_TWIN,'params':{}};return{'kind':'template','template_id':PROGRESS_NODE_CHECK_TWIN,'params':{'expected_node':edgeMounts(a,b['key'])[0x0]['prev']}};}export function progressCensus(a){const b=[];for(const c of a){c['guards']['forEach']((d,e)=>{if(d['template_id']!==PROGRESS_PATTERN)return;const f=d['key']??d['template_id']+'#'+e,h=progressSkipReason(c,d);b['push']({'template':c['id'],'key':f,...h!==undefined?{'skipped':h}:{}});});}return b;}export function timeInstantiationIssues(a,b){const c=[],d=new Map(a['map'](f=>[f['id'],f])),e=new Set();for(const f of TIME_GUARD_INSTANTIATIONS){const h=f['template']+'\x00'+f['guard_key'];if(e['has'](h))c['push']({'row':f,'problem':'duplicate\x20row'});e['add'](h);const i=d['get'](f['template']);if(i===undefined){c['push']({'row':f,'problem':'template\x20\x27'+f['template']+'\x27\x20does\x20not\x20exist'});continue;}const j=i['guards']['find'](u=>u['key']===f['guard_key']);if(j===undefined){c['push']({'row':f,'problem':'guard\x20\x27'+f['guard_key']+'\x27\x20is\x20not\x20declared\x20by\x20'+f['template']});continue;}const k=f['direction']==='upper'?'pattern.time_window_upper_bound':'pattern.time_lock_progress';j['template_id']!==k&&c['push']({'row':f,'problem':'guard\x20declares\x20\x27'+j['template_id']+'\x27,\x20expected\x20\x27'+k+'\x27\x20for\x20a\x20'+f['direction']+'\x20window'});const l=(i['allocator']?.['rows']??[])['filter'](u=>u['guard_key']===f['guard_key'])['length'];if(l>0x0){c['push']({'row':f,'problem':'guard\x20is\x20also\x20bound\x20to\x20'+l+'\x20allocator\x20row(s):\x20a\x20node-gated\x20twin\x20cannot\x20serve\x20the\x20'+'pre-advance\x20forward\x20and\x20the\x20post-advance\x20allocator\x20(and\x20a\x20second\x20mount\x20would\x20double\x20the\x20wait)'});continue;}const m=mountInfo(i,f['guard_key']);if(f['multimount']!==!![]){if(m['length']!==0x1){c['push']({'row':f,'problem':'guard\x20has\x20'+m['length']+'\x20mounts;\x20a\x20shared\x20expected_node\x20needs\x20exactly\x20one'});continue;}m[0x0]['prev']!==f['anchor']&&c['push']({'row':f,'problem':'anchor\x20\x27'+f['anchor']+'\x27\x20!=\x20mount\x20prev\x20\x27'+m[0x0]['prev']+'\x27'});const u=f['direction']==='upper'?'order_payer':'merchant';m[0x0]['operator']!==u&&c['push']({'row':f,'problem':'mount\x20operator\x20\x27'+m[0x0]['operator']+'\x27\x20!=\x20\x27'+u+'\x27:\x20an\x20'+f['direction']+'\x20window\x20on\x20the\x20wrong\x20'+'signer\x20set\x20is\x20either\x20callable\x20by\x20anyone\x20(upper)\x20or\x20unsatisfiable\x20(identity\x20leg\x20over\x20a\x20permission-index\x20rail)'});}else{(f['days']===undefined||f['hours']!==undefined)&&c['push']({'row':f,'problem':'the\x20pin-free\x20twin\x20takes\x20a\x20day\x20window;\x20declare\x20days\x20and\x20no\x20hours'});m['length']===0x0&&c['push']({'row':f,'problem':'guard\x20is\x20bound\x20to\x20no\x20forward\x20—\x20a\x20window\x20nobody\x20mounts\x20is\x20not\x20a\x20rail'});const v=f['direction']==='upper'?'order_payer':'merchant',w=m['filter'](x=>x['operator']!==v);w['length']>0x0&&c['push']({'row':f,'problem':w['length']+'\x20mount(s)\x20ride\x20\x27'+[...new Set(w['map'](x=>x['operator']))]['join']('/')+'\x27\x20but\x20a\x20'+f['direction']+'\x20'+('multi-mount\x20twin\x20needs\x20\x27'+v+'\x27\x20')+(f['direction']==='upper'?'(the\x20twin\x27s\x20order-holder\x20leg\x20is\x20unsatisfiable\x20on\x20a\x20permission-index\x20rail)':'(the\x20opening\x20twin\x20ships\x20no\x20signer\x20leg,\x20so\x20a\x20buyer\x20rail\x20would\x20be\x20left\x20unauthenticated)')}),m['length']>0x0&&!m['some'](x=>x['prev']===f['anchor'])&&c['push']({'row':f,'problem':'no\x20mount\x20starts\x20at\x20anchor\x20\x27'+f['anchor']+'\x27\x20(mounts:\x20'+m['map'](x=>x['prev'])['join'](',\x20')+'):\x20'+'the\x20anchor\x20must\x20be\x20the\x20entry\x20that\x20opens\x20the\x20window\x20on\x20at\x20least\x20one\x20path'});}const n=f['days']!==undefined?'days':f['hours']!==undefined?'hours':undefined;if(n===undefined||f['days']!==undefined&&f['hours']!==undefined){c['push']({'row':f,'problem':'exactly\x20one\x20of\x20days/hours\x20must\x20be\x20declared'});continue;}const o=f['days']??f['hours'];i['fee_params'][o]===undefined&&c['push']({'row':f,'problem':'fee_param\x20\x27'+o+'\x27\x20is\x20not\x20declared\x20by\x20'+f['template']});for(const x of f['plus_days']===undefined?[]:typeof f['plus_days']==='string'?[f['plus_days']]:f['plus_days']){i['fee_params'][x]===undefined&&c['push']({'row':f,'problem':'fee_param\x20\x27'+x+'\x27\x20(plus_days)\x20is\x20not\x20declared\x20by\x20'+f['template']});}const p=f['multimount']===!![]?multiMountTwin(f['direction']):twinFor(f['direction'],n),q=b['get'](p);if(q===undefined){c['push']({'row':f,'problem':'twin\x20template\x20\x27'+p+'\x27\x20is\x20not\x20in\x20the\x20guard-template\x20registry'});continue;}const r=new Set(q['map'](y=>y['name'])),s=f['multimount']===!![]?'anchor_node':'expected_node';for(const y of[s,TWIN_PARAM[n]]){if(!r['has'](y))c['push']({'row':f,'problem':'twin\x20\x27'+p+'\x27\x20declares\x20no\x20param\x20\x27'+y+'\x27'});}}return c;}
1
+ export const MS_PER_DAY=0x5265c00;export const MS_PER_HOUR=0x36ee80;export const TIME_GUARD_INSTANTIATIONS=[{'template':'retail/scale-marketplace','guard_key':'claim_filed','direction':'upper','anchor':'claim_window','days':'claim_window_days','note':'buyer\x20files\x20a\x20claim\x20only\x20inside\x20the\x20claim\x20window'},{'template':'retail/scale-marketplace','guard_key':'review_window','direction':'upper','anchor':'delivered','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20delivery'},{'template':'retail/scale-marketplace','guard_key':'return_window','direction':'upper','anchor':'delivered','multimount':!![],'days':'return_window_days','note':'return\x20request\x20inside\x20the\x20policy\x20window,\x20from\x20delivered\x20or\x20from\x20reviewed'},{'template':'retail/scale-marketplace','guard_key':'deliver_confirm_timeout','direction':'lower','anchor':'shipped','days':'auto_confirm_days','note':'auto-confirm\x20N\x20days\x20after\x20shipment'},{'template':'retail/scale-marketplace','guard_key':'return_response_timeout','direction':'lower','anchor':'return_in_transit','days':'return_response_days','note':'keeper\x20deems\x20the\x20return\x20parcel\x20received\x20after\x20the\x20merchant\x27s\x20silence\x20(F-TBPM9-O5-02)'},{'template':'retail/warehouse-club','guard_key':'claim_filed','direction':'upper','anchor':'claim_window','days':'claim_window_days','note':'buyer\x20files\x20a\x20claim\x20only\x20inside\x20the\x20claim\x20window'},{'template':'retail/warehouse-club','guard_key':'review_window','direction':'upper','anchor':'delivered','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20delivery'},{'template':'retail/warehouse-club','guard_key':'return_window','direction':'upper','anchor':'delivered','multimount':!![],'days':'return_window_days','note':'return\x20request\x20inside\x20the\x20policy\x20window,\x20from\x20delivered\x20or\x20from\x20reviewed'},{'template':'retail/warehouse-club','guard_key':'deliver_confirm_timeout','direction':'lower','anchor':'shipped','days':'auto_confirm_days','note':'auto-confirm\x20N\x20days\x20after\x20shipment'},{'template':'retail/warehouse-club','guard_key':'return_response_timeout','direction':'lower','anchor':'return_in_transit','days':'return_response_days','note':'keeper\x20deems\x20the\x20return\x20parcel\x20received\x20after\x20the\x20merchant\x27s\x20silence\x20(F-TBPM9-O5-02)'},{'template':'retail/preorder-deposit','guard_key':'balance_window_open','direction':'lower','anchor':'deposit_paid','days':'production_lead_days','note':'balance\x20window\x20opens\x20after\x20the\x20production\x20lead'},{'template':'retail/preorder-deposit','guard_key':'balance_deadline','direction':'lower','anchor':'balance_due','days':'balance_window_days','note':'balance-window\x20timeout'},{'template':'retail/preorder-deposit','guard_key':'review_window','direction':'upper','anchor':'delivered','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20delivery'},{'template':'retail/preorder-deposit','guard_key':'deliver_confirm_timeout','direction':'lower','anchor':'shipped','days':'auto_confirm_days','note':'auto-confirm\x20N\x20days\x20after\x20shipment'},{'template':'retail/preorder-deposit','guard_key':'return_response_timeout','direction':'lower','anchor':'return_in_transit','days':'return_response_days','note':'keeper\x20deems\x20the\x20return\x20parcel\x20received\x20after\x20the\x20merchant\x27s\x20silence\x20(F-TBPM9-O5-02)'},{'template':'retail/restock-supply','guard_key':'deliver_confirm_timeout','direction':'lower','anchor':'shipped','days':'auto_confirm_days','note':'auto-confirm\x20N\x20days\x20after\x20shipment'},{'template':'retail/restock-supply','guard_key':'restock_confirm_timeout','direction':'lower','anchor':'delivered','days':'restock_confirm_days','note':'restock\x20confirmation\x20timeout'},{'template':'retail/vertical-handmade','guard_key':'ship_timeout','direction':'lower','anchor':'confirmed','days':'processing_time_days','note':'unshipped\x20order\x20cancels\x20after\x20the\x20processing\x20time'},{'template':'retail/vertical-handmade','guard_key':'deliver_confirm_timeout','direction':'lower','anchor':'shipped','days':'auto_confirm_days','note':'auto-confirm\x20N\x20days\x20after\x20shipment'},{'template':'retail/vertical-handmade','guard_key':'return_response_timeout','direction':'lower','anchor':'return_requested','days':'return_response_days','note':'keeper\x20deems\x20the\x20return\x20accepted\x20(returnless\x20approval)\x20after\x20the\x20maker\x27s\x20silence\x20(F-TBPM9-O5-02)'},{'template':'freelance/enterprise-talent-market','guard_key':'review_settle_clock','direction':'lower','anchor':'reviewed','days':'settlement_delay_days','note':'settle\x20N\x20days\x20after\x20review'},{'template':'freelance/enterprise-talent-market','guard_key':'accept_timeout','direction':'lower','anchor':'delivered','days':'escrow_release_days','note':'keeper\x20auto-accepts\x20the\x20delivery\x20N\x20days\x20after\x20submission\x20(the\x20timeout\x20branch\x20of\x20the\x20dual-branch\x20acceptance)'},{'template':'freelance/enterprise-talent-market','guard_key':'review_window','direction':'upper','anchor':'accepted','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20acceptance'},{'template':'freelance/catalog-tiers','guard_key':'requirements_timeout_48h','direction':'lower','anchor':'in_progress','hours':'requirements_timeout_hours','note':'requirements\x20timeout'},{'template':'freelance/catalog-tiers','guard_key':'cancel_response_timeout','direction':'lower','anchor':'cancel_requested','hours':'response_timeout_hours','note':'keeper\x20auto-cancel\x20after\x20the\x20seller\x27s\x20silence'},{'template':'freelance/catalog-tiers','guard_key':'refund_response_timeout','direction':'lower','anchor':'refund_requested','hours':'refund_response_hours','note':'keeper\x20auto-cancel\x20after\x20the\x20seller\x27s\x20silence\x20on\x20a\x20refund\x20request'},{'template':'freelance/catalog-tiers','guard_key':'accept_timeout','direction':'lower','anchor':'delivered','days':'escrow_release_days','note':'auto-accept\x20N\x20days\x20after\x20delivery\x20(buyer\x20silence)'},{'template':'freelance/catalog-tiers','guard_key':'review_window','direction':'upper','anchor':'accepted','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20acceptance'},{'template':'freelance/catalog-tiers','guard_key':'review_settle_clock','direction':'lower','anchor':'reviewed','days':'settlement_delay_days','note':'settle\x20N\x20days\x20after\x20review'},{'template':'freelance/creator-zero-commission','guard_key':'accept_timeout','direction':'lower','anchor':'delivered','hours':'acceptance_timeout_hours','note':'delivery\x20acceptance\x20timeout'},{'template':'freelance/creator-zero-commission','guard_key':'defect_report_window','direction':'upper','anchor':'delivered','hours':'defect_report_window_hours','note':'defect\x20report\x20window\x20after\x20delivery'},{'template':'freelance/creator-zero-commission','guard_key':'review_window','direction':'upper','anchor':'accepted','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20acceptance'},{'template':'freelance/design-contest','guard_key':'submission_window','direction':'lower','anchor':'funded','days':'submission_window_days','note':'submissions\x20close\x20N\x20days\x20after\x20funding'},{'template':'freelance/design-contest','guard_key':'appeal_window','direction':'lower','anchor':'placement_provisional','days':'appeal_window_days','note':'placement\x20finalizes\x20after\x20the\x20appeal\x20window'},{'template':'freelance/design-contest','guard_key':'delivery_window','direction':'lower','anchor':'final_delivery','days':'delivery_window_days','note':'final\x20delivery\x20acceptance\x20timeout'},{'template':'freelance/design-contest','guard_key':'revision_span','direction':'upper','anchor':'final_delivery','days':'revision_span_days','note':'T-6:\x20revision\x20requests\x20close\x20N\x20days\x20after\x20the\x20FIRST\x20final-delivery\x20entry\x20(find=first\x20—\x20a\x20Redeliver\x20can\x20never\x20re-arm\x20it),\x20the\x20chain-enforceable\x20half\x20of\x20the\x20revision\x20cap'},{'template':'freelance/design-contest','guard_key':'review_window','direction':'upper','anchor':'settled','days':'review_window_days','note':'T-4:\x20the\x20sponsor\x27s\x20rating\x20closes\x20N\x20days\x20after\x20the\x20FIRST\x20settled\x20entry\x20(the\x20keeper\x20review-bounce\x20never\x20re-arms\x20it)'},{'template':'freelance/design-contest','guard_key':'return_window','direction':'upper','anchor':'settled','multimount':!![],'days':'return_window_days','note':'T-5:\x20the\x20sponsor\x20return\x20request\x20closes\x20N\x20days\x20after\x20the\x20FIRST\x20settled\x20entry,\x20mountable\x20from\x20settled\x20or\x20from\x20reviewed\x20(CSTC2-05\x20—\x20reviewing\x20never\x20kills\x20the\x20return\x20right;\x20the\x20pin-free\x20window\x20never\x20re-arms\x20on\x20the\x20review\x20detour)'},{'template':'freelance/design-contest','guard_key':'return_response_timeout','direction':'lower','anchor':'return_requested','days':'return_response_days','note':'T-5:\x20keeper\x20deems\x20the\x20return\x20APPROVED\x20after\x20the\x20merchant\x27s\x20silence\x20(the\x20F-TBPM9-O5-02/F-42\x20buyer-favouring\x20cure)\x20—\x20a\x20silent\x20merchant\x20cannot\x20hold\x20the\x20escrow\x20at\x20return_requested'},{'template':'rental/p2p-shortstay','guard_key':'confirm_expire','direction':'lower','anchor':'reserved','hours':'confirm_window_hours','note':'unconfirmed\x20booking\x20expires'},{'template':'rental/p2p-shortstay','guard_key':'claim_window_closed','direction':'lower','anchor':'claim_window','days':'claim_window_days','note':'no-claim\x20release\x20after\x20the\x20claim\x20window'},{'template':'rental/p2p-shortstay','guard_key':'guest_claim_window_open','direction':'upper','anchor':'claim_window','days':'claim_window_days','note':'guest\x20files\x20a\x20claim\x20inside\x20the\x20claim\x20window'},{'template':'rental/institutional-longstay','guard_key':'return_notice','direction':'lower','anchor':'in_use','days':'return_notice_days','note':'return\x20notice\x20lead\x20time'},{'template':'rental/institutional-longstay','guard_key':'nofault_window','direction':'upper','anchor':'deposit_paid','multimount':!![],'days':'no_fault_exit_days','note':'no-fault\x20exit\x20within\x20no_fault_exit_days\x20of\x20signing,\x20on\x20both\x20buyer\x20exits\x20into\x20closed_cancel\x20(pre-handover\x20and\x20mid-lease\x20—\x20in_use\x20is\x20only\x20entered\x20from\x20deposit_paid,\x20whose\x20entry\x20IS\x20the\x20signing)'},{'template':'rental/institutional-longstay','guard_key':'review_window','direction':'upper','anchor':'inspected','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20the\x20passing\x20inspection'},{'template':'travel/destination-experience','guard_key':'free_cancel','direction':'upper','anchor':'paid','hours':'free_cancel_hours','note':'free\x20cancellation\x20window'},{'template':'travel/destination-experience','guard_key':'poststay_claim_window','direction':'upper','anchor':'claim_window','days':'claim_window_days','note':'post-stay\x20claim\x20window'},{'template':'travel/destination-experience','guard_key':'release_no_claim_clock','direction':'lower','anchor':'claim_window','days':'claim_window_days','note':'no-claim\x20release\x20after\x20the\x20claim\x20window'},{'template':'delivery/on-demand-errand','guard_key':'deliver_confirm_timeout','direction':'lower','anchor':'delivered','hours':'auto_confirm_hours','note':'auto-confirm\x20N\x20hours\x20after\x20delivery'},{'template':'delivery/on-demand-errand','guard_key':'claim_filed','direction':'upper','anchor':'claim_window','hours':'claim_window_hours','note':'claim\x20window'},{'template':'delivery/on-demand-errand','guard_key':'return_request','direction':'upper','anchor':'delivered','hours':'return_window_hours','note':'after-sales\x20return\x20request\x20closes\x20N\x20hours\x20after\x20the\x20delivered\x20FIRST\x20entry'},{'template':'delivery/restaurant-marketplace','guard_key':'return_request','direction':'upper','anchor':'delivered','hours':'return_window_hours','note':'after-sales\x20return\x20request\x20closes\x20N\x20hours\x20after\x20the\x20delivered\x20FIRST\x20entry'},{'template':'group_buy/leader-sourced-community','guard_key':'claim_filed','direction':'upper','anchor':'claim_window','hours':'claim_window_hours','note':'buyer\x20files\x20a\x20claim\x20only\x20inside\x20the\x20claim\x20window'},{'template':'group_buy/leader-sourced-community','guard_key':'return_response_timeout','direction':'lower','anchor':'return_in_transit','days':'return_response_days','note':'keeper\x20deems\x20the\x20return\x20parcel\x20received\x20after\x20the\x20leader\x27s\x20silence\x20(F-TBPM9-O5-02)'},{'template':'group_buy/platform-supplied-pickup','guard_key':'return_response_timeout','direction':'lower','anchor':'return_in_transit','days':'return_response_days','note':'keeper\x20deems\x20the\x20return\x20parcel\x20received\x20after\x20the\x20point\x27s\x20silence\x20(F-TBPM9-O5-02)'},{'template':'crowdfunding/reward-campaign-fulfillment','guard_key':'return_response_timeout','direction':'lower','anchor':'return_in_transit','days':'return_response_days','note':'keeper\x20deems\x20the\x20return\x20parcel\x20received\x20after\x20the\x20project\x27s\x20silence\x20(F-TBPM9-O5-02)'},{'template':'subscription/delivery-membership','guard_key':'period_end','direction':'lower','anchor':'active','days':'period_days','note':'membership\x20period\x20clock:\x20active\x20entry\x20+\x20period_days\x20before\x20the\x20keeper\x20may\x20complete'},{'template':'subscription/creator-membership','guard_key':'period_expiry','direction':'lower','anchor':'delivered','multimount':!![],'days':'period_days','plus_days':'grace_days','note':'period\x20expiry\x20=\x20delivery\x20+\x20period_days\x20+\x20grace_days,\x20on\x20every\x20keeper\x20lapse'},{'template':'subscription/direct-fan-subscription','guard_key':'period_expiry','direction':'lower','anchor':'delivered','multimount':!![],'days':'period_days','plus_days':'grace_days','note':'period\x20expiry\x20=\x20delivery\x20+\x20period_days\x20+\x20grace_days,\x20on\x20every\x20keeper\x20lapse'},{'template':'education/live-class-cohort','guard_key':'review_window','direction':'upper','anchor':'completed_ready','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20completion\x20readiness'},{'template':'education/mooc-single-course','guard_key':'review_window','direction':'upper','anchor':'certified','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20certification'},{'template':'subscription/creator-membership','guard_key':'review_window','direction':'upper','anchor':'delivered','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20period\x20delivery'},{'template':'subscription/direct-fan-subscription','guard_key':'review_window','direction':'upper','anchor':'delivered','days':'review_window_days','note':'review\x20closes\x20N\x20days\x20after\x20period\x20delivery\x20—\x20keep\x20period_days\x20+\x20grace_days\x20>\x20review_window_days\x20or\x20the\x20keeper\x20expire\x20kills\x20the\x20open\x20window'},{'template':'retail/preorder-deposit','guard_key':'return_window_presale','direction':'upper','anchor':'delivered','multimount':!![],'days':'return_window_days','note':'return\x20requested\x20within\x20N\x20days\x20of\x20delivery,\x20from\x20delivered\x20or\x20from\x20reviewed'},{'template':'rental/p2p-shortstay','guard_key':'review_window','direction':'upper','anchor':'checked_out','multimount':!![],'days':'review_window_days','note':'review\x20within\x20N\x20days\x20of\x20checkout,\x20including\x20once\x20the\x20claim\x20window\x20has\x20opened'},{'template':'education/mooc-single-course','guard_key':'return_window','direction':'upper','anchor':'paid','multimount':!![],'days':'refund_window_days','note':'refund\x20requested\x20within\x20N\x20days\x20of\x20purchase,\x20from\x20any\x20pre-delivery\x20stage'},{'template':'retail/scale-marketplace','guard_key':'settle_window_gate','direction':'lower','anchor':'claim_window','days':'settlement_days','plus_days':['reserve_days','return_window_days'],'note':'settlement\x20opens\x20after\x20the\x20MERGED\x20lock:\x20settlement_days\x20+\x20reserve_days\x20+\x20return_window_days\x20(the\x20declaration\x20settlement_window_merge;\x2014\x20+\x207\x20+\x2030\x20=\x2051\x20days\x20by\x20default)\x20—\x20the\x20release\x20cannot\x20fire\x20while\x20the\x20return\x20window\x20can\x20still\x20draw\x20the\x20escrow'},{'template':'retail/warehouse-club','guard_key':'settle_window_gate','direction':'lower','anchor':'claim_window','days':'settlement_delay_days','note':'settlement\x20opens\x20N\x20days\x20after\x20the\x20claim\x20window\x20(coupled\x20to\x20the\x20return\x20window)'},{'template':'retail/preorder-deposit','guard_key':'settle_window_gate','direction':'lower','anchor':'delivered','multimount':!![],'days':'settlement_days','note':'balance\x20settlement\x20opens\x20N\x20days\x20after\x20delivery,\x20from\x20delivered\x20or\x20from\x20reviewed'},{'template':'retail/vertical-handmade','guard_key':'settle_clock','direction':'lower','anchor':'delivered','multimount':!![],'days':'settlement_delay_days','note':'settlement\x20opens\x20N\x20days\x20after\x20delivery,\x20from\x20delivered\x20or\x20from\x20reviewed'},{'template':'delivery/on-demand-errand','guard_key':'settle_window_gate','direction':'lower','anchor':'claim_window','hours':'settle_hours','note':'settlement\x20opens\x20N\x20hours\x20after\x20the\x20claim\x20window'},{'template':'group_buy/leader-sourced-community','guard_key':'settle_window_gate','direction':'lower','anchor':'claim_window','hours':'settle_hours','note':'settlement\x20opens\x20N\x20hours\x20after\x20the\x20claim\x20window,\x20past\x20the\x20after-sales\x20track'},{'template':'group_buy/leader-sourced-community','guard_key':'claim_window_open','direction':'lower','anchor':'delivered','hours':'claim_window_open_min_hold_hours','note':'claim\x20window\x20opens\x20N\x20hours\x20after\x20delivery\x20(the\x20buyer\x27s\x20dispute\x20clock\x20cannot\x20start\x20at\x20the\x20delivery\x20instant)'}];export const TWIN_PARAM={'days':'claim_window_days','hours':'duration_ms'};export function twinFor(a,b){if(b==='days')return a==='upper'?'tpl_time_window_upper_progress_days':'tpl_time_lock_progress_days';return a==='upper'?'tpl_time_window_upper':'tpl_time_lock_progress';}export const MULTI_MOUNT_TWIN='tpl_time_window_upper_history_days';export const MULTI_MOUNT_OPENING_TWIN='tpl_time_lock_history_days';export function multiMountTwin(a){return a==='upper'?MULTI_MOUNT_TWIN:MULTI_MOUNT_OPENING_TWIN;}export function unitScale(a){return a==='days'?0x1:MS_PER_HOUR;}const BY_SPEC=new Map();for(const row of TIME_GUARD_INSTANTIATIONS)BY_SPEC['set'](row['template']+'\x00'+row['guard_key'],row);export function timeInstantiationFor(a,b){return BY_SPEC['get'](a+'\x00'+b);}export function patternDefaultResolution(a,b){const c=timeInstantiationFor(a,b);if(c===undefined)return undefined;const d=c['days']!==undefined?'days':'hours';if(c['multimount']===!![])return{'kind':'template','template_id':multiMountTwin(c['direction']),'params':{'anchor_node':c['anchor']}};return{'kind':'template','template_id':twinFor(c['direction'],d),'params':{'expected_node':c['anchor']}};}export function msKnobOf(a){return/_days$/['test'](a)?a['slice'](0x0,-'_days'['length'])+'_ms':undefined;}export function timeWindowMsResolution(a,b,c,d){const e=timeInstantiationFor(a,b);if(e===undefined||e['days']===undefined||e['multimount']===!![])return undefined;const f=msKnobOf(e['days']);if(f===undefined)return undefined;const g=c[f]??d?.[f];if(g===undefined||g===null)return undefined;return{'kind':'template','template_id':twinFor(e['direction'],'hours'),'params':{'expected_node':e['anchor']}};}function mountInfo(a,b){const c=[];for(const d of a['machine_shape']??[]){const f=d['from']??[];for(const g of f){const h=typeof g==='string'?{'prev':g}:g;if(h['guard_key']!==b)continue;const i=h['operator']??d['operator']??(h['prev']===''?'order_payer':'merchant');c['push']({'prev':h['prev']??'','operator':i});}}return c;}export const IDENTITY_PATTERN='pattern.identity_check_order_holder';export const IDENTITY_TWIN='tpl_forward_order_holder';export const IDENTITY_RECOVER_RAIL_TWIN='tpl_allocator_node_gate_recover';export const IDENTITY_REFUND_RAIL_TWIN='tpl_allocator_identity_set_order_holder';function railTracks(a,b){return(a['allocator']?.['rows']??[])['filter'](c=>c['guard_key']===b)['map'](c=>c['track']??'');}function hasAwardRailSibling(a,b){return a['guards']['some'](c=>{if(c['template_id']===IDENTITY_RECOVER_RAIL_TWIN)return!![];const d=c['key'];if(d===undefined||d===b)return![];if(!/recover|award/i['test'](d))return![];if(!/pattern\./i['test'](c['template_id']))return![];return edgeMounts(a,d)['length']===0x0&&railTracks(a,d)['length']>0x0;});}function edgeMounts(a,b){return mountInfo(a,b);}export function identitySkipReason(a,b){if(b['template_id']!==IDENTITY_PATTERN)return'not\x20an\x20identity\x20design';if(b['key']===undefined)return'declared\x20without\x20a\x20key:\x20it\x20names\x20a\x20policy,\x20not\x20a\x20rail';const c=b['key'],d=railTracks(a,c),e=edgeMounts(a,c);if(e['length']===0x0){if(d['length']===0x0)return'no\x20mount\x20in\x20the\x20declared\x20graph';if(/recover|award/i['test'](c))return undefined;if(/refund/i['test'](c)&&d['every'](g=>/refund/i['test'](g))){if(hasAwardRailSibling(a,c))return'rail-bound\x20refund\x20next\x20to\x20an\x20award/recover\x20rail:\x20the\x20order-holder\x20refund\x20set\x20is\x20node-free,\x20so\x20instantiating\x20both\x20gives\x20one\x20escrow\x20two\x20live\x20fund\x20exits\x20(RAIL-03)\x20—\x20legal\x20but\x20a\x20merchant\x20choice\x20(disclosed\x20double\x20collection),\x20resolve\x20the\x20refund\x20rail\x20explicitly';return undefined;}return'bound\x20to\x20an\x20allocator\x20row\x20only:\x20no\x20executable\x20twin\x20matches\x20this\x20key/track\x20pair\x20(a\x20settlement\x20rail\x20asks\x20a\x20different\x20question)';}if(d['length']>0x0)return'also\x20bound\x20to\x20an\x20allocator\x20row:\x20one\x20design\x20cannot\x20serve\x20a\x20forward\x20and\x20a\x20rail';const f=e['filter'](g=>g['operator']!=='order_payer');if(f['length']>0x0)return'mounted\x20on\x20'+f['length']+'\x20non-buyer\x20forward(s)\x20('+[...new Set(f['map'](g=>g['operator']))]['join']('/')+'):\x20'+'an\x20order-holder\x20leg\x20is\x20unsatisfiable\x20on\x20a\x20permission-index\x20rail';return undefined;}export function identityDefaultResolution(a,b){if(identitySkipReason(a,b)!==undefined)return undefined;const c=b['key'];if(edgeMounts(a,c)['length']===0x0){if(/recover|award/i['test'](c))return{'kind':'template','template_id':IDENTITY_RECOVER_RAIL_TWIN,'params':{}};return{'kind':'template','template_id':IDENTITY_REFUND_RAIL_TWIN,'params':{}};}return{'kind':'template','template_id':IDENTITY_TWIN,'params':{}};}export function identityCensus(a){const b=[];for(const c of a){c['guards']['forEach']((d,e)=>{if(d['template_id']!==IDENTITY_PATTERN)return;const f=d['key']??d['template_id']+'#'+e,h=identitySkipReason(c,d);b['push']({'template':c['id'],'key':f,...h!==undefined?{'skipped':h}:{}});});}return b;}export const PROGRESS_PATTERN='pattern.progress_state_check';export const PROGRESS_NODE_CHECK_TWIN='tpl_forward_node_check';export const PROGRESS_RECOVER_RAIL_TWIN='tpl_allocator_node_gate_recover';export function progressSkipReason(a,b){if(b['template_id']!==PROGRESS_PATTERN)return'not\x20a\x20progress-state\x20design';if(b['key']===undefined)return'declared\x20without\x20a\x20key:\x20it\x20names\x20a\x20policy,\x20not\x20a\x20rail';const c=b['key'],d=railTracks(a,c),e=edgeMounts(a,c);if(/recover|award/i['test'](c)){if(e['length']===0x0&&d['length']===0x0)return'no\x20mount\x20in\x20the\x20declared\x20graph';return undefined;}if(d['length']>0x0)return e['length']>0x0?'bound\x20to\x20BOTH\x20a\x20forward\x20and\x20an\x20allocator\x20rail:\x20a\x20node-gated\x20twin\x20cannot\x20serve\x20the\x20pre-advance\x20forward\x20and\x20the\x20post-advance\x20allocator\x20(D8)':'rail-bound\x20with\x20no\x20forward\x20mount:\x20the\x20graph\x20cannot\x20say\x20which\x20node\x20the\x20order\x20occupies\x20when\x20the\x20rail\x20fires\x20(pinning\x20one\x20strands\x20the\x20escrow\x20below\x20it\x20—\x20UPWC-K1)';if(e['length']===0x0)return'no\x20mount\x20in\x20the\x20declared\x20graph';const f=[...new Set(e['map'](g=>g['prev']))];if(f['length']>0x1)return'mounted\x20on\x20'+e['length']+'\x20forwards\x20from\x20DIFFERENT\x20prev\x20nodes\x20('+f['join']('/')+'):\x20one\x20expected_node\x20cannot\x20serve\x20them';return undefined;}export function progressStateDefaultResolution(a,b){if(progressSkipReason(a,b)!==undefined)return undefined;if(/recover|award/i['test'](b['key']))return{'kind':'template','template_id':PROGRESS_RECOVER_RAIL_TWIN,'params':{}};return{'kind':'template','template_id':PROGRESS_NODE_CHECK_TWIN,'params':{'expected_node':edgeMounts(a,b['key'])[0x0]['prev']}};}export function progressCensus(a){const b=[];for(const c of a){c['guards']['forEach']((d,e)=>{if(d['template_id']!==PROGRESS_PATTERN)return;const f=d['key']??d['template_id']+'#'+e,h=progressSkipReason(c,d);b['push']({'template':c['id'],'key':f,...h!==undefined?{'skipped':h}:{}});});}return b;}export function timeInstantiationIssues(a,b){const c=[],d=new Map(a['map'](f=>[f['id'],f])),e=new Set();for(const f of TIME_GUARD_INSTANTIATIONS){const h=f['template']+'\x00'+f['guard_key'];if(e['has'](h))c['push']({'row':f,'problem':'duplicate\x20row'});e['add'](h);const i=d['get'](f['template']);if(i===undefined){c['push']({'row':f,'problem':'template\x20\x27'+f['template']+'\x27\x20does\x20not\x20exist'});continue;}const j=i['guards']['find'](u=>u['key']===f['guard_key']);if(j===undefined){c['push']({'row':f,'problem':'guard\x20\x27'+f['guard_key']+'\x27\x20is\x20not\x20declared\x20by\x20'+f['template']});continue;}const k=f['direction']==='upper'?'pattern.time_window_upper_bound':'pattern.time_lock_progress';j['template_id']!==k&&c['push']({'row':f,'problem':'guard\x20declares\x20\x27'+j['template_id']+'\x27,\x20expected\x20\x27'+k+'\x27\x20for\x20a\x20'+f['direction']+'\x20window'});const l=(i['allocator']?.['rows']??[])['filter'](u=>u['guard_key']===f['guard_key'])['length'];if(l>0x0){c['push']({'row':f,'problem':'guard\x20is\x20also\x20bound\x20to\x20'+l+'\x20allocator\x20row(s):\x20a\x20node-gated\x20twin\x20cannot\x20serve\x20the\x20'+'pre-advance\x20forward\x20and\x20the\x20post-advance\x20allocator\x20(and\x20a\x20second\x20mount\x20would\x20double\x20the\x20wait)'});continue;}const m=mountInfo(i,f['guard_key']);if(f['multimount']!==!![]){if(m['length']!==0x1){c['push']({'row':f,'problem':'guard\x20has\x20'+m['length']+'\x20mounts;\x20a\x20shared\x20expected_node\x20needs\x20exactly\x20one'});continue;}m[0x0]['prev']!==f['anchor']&&c['push']({'row':f,'problem':'anchor\x20\x27'+f['anchor']+'\x27\x20!=\x20mount\x20prev\x20\x27'+m[0x0]['prev']+'\x27'});const u=f['direction']==='upper'?'order_payer':'merchant';m[0x0]['operator']!==u&&c['push']({'row':f,'problem':'mount\x20operator\x20\x27'+m[0x0]['operator']+'\x27\x20!=\x20\x27'+u+'\x27:\x20an\x20'+f['direction']+'\x20window\x20on\x20the\x20wrong\x20'+'signer\x20set\x20is\x20either\x20callable\x20by\x20anyone\x20(upper)\x20or\x20unsatisfiable\x20(identity\x20leg\x20over\x20a\x20permission-index\x20rail)'});}else{(f['days']===undefined||f['hours']!==undefined)&&c['push']({'row':f,'problem':'the\x20pin-free\x20twin\x20takes\x20a\x20day\x20window;\x20declare\x20days\x20and\x20no\x20hours'});m['length']===0x0&&c['push']({'row':f,'problem':'guard\x20is\x20bound\x20to\x20no\x20forward\x20—\x20a\x20window\x20nobody\x20mounts\x20is\x20not\x20a\x20rail'});const v=f['direction']==='upper'?'order_payer':'merchant',w=m['filter'](x=>x['operator']!==v);w['length']>0x0&&c['push']({'row':f,'problem':w['length']+'\x20mount(s)\x20ride\x20\x27'+[...new Set(w['map'](x=>x['operator']))]['join']('/')+'\x27\x20but\x20a\x20'+f['direction']+'\x20'+('multi-mount\x20twin\x20needs\x20\x27'+v+'\x27\x20')+(f['direction']==='upper'?'(the\x20twin\x27s\x20order-holder\x20leg\x20is\x20unsatisfiable\x20on\x20a\x20permission-index\x20rail)':'(the\x20opening\x20twin\x20ships\x20no\x20signer\x20leg,\x20so\x20a\x20buyer\x20rail\x20would\x20be\x20left\x20unauthenticated)')}),m['length']>0x0&&!m['some'](x=>x['prev']===f['anchor'])&&c['push']({'row':f,'problem':'no\x20mount\x20starts\x20at\x20anchor\x20\x27'+f['anchor']+'\x27\x20(mounts:\x20'+m['map'](x=>x['prev'])['join'](',\x20')+'):\x20'+'the\x20anchor\x20must\x20be\x20the\x20entry\x20that\x20opens\x20the\x20window\x20on\x20at\x20least\x20one\x20path'});}const n=f['days']!==undefined?'days':f['hours']!==undefined?'hours':undefined;if(n===undefined||f['days']!==undefined&&f['hours']!==undefined){c['push']({'row':f,'problem':'exactly\x20one\x20of\x20days/hours\x20must\x20be\x20declared'});continue;}const o=f['days']??f['hours'];i['fee_params'][o]===undefined&&c['push']({'row':f,'problem':'fee_param\x20\x27'+o+'\x27\x20is\x20not\x20declared\x20by\x20'+f['template']});for(const x of f['plus_days']===undefined?[]:typeof f['plus_days']==='string'?[f['plus_days']]:f['plus_days']){i['fee_params'][x]===undefined&&c['push']({'row':f,'problem':'fee_param\x20\x27'+x+'\x27\x20(plus_days)\x20is\x20not\x20declared\x20by\x20'+f['template']});}const p=f['multimount']===!![]?multiMountTwin(f['direction']):twinFor(f['direction'],n),q=b['get'](p);if(q===undefined){c['push']({'row':f,'problem':'twin\x20template\x20\x27'+p+'\x27\x20is\x20not\x20in\x20the\x20guard-template\x20registry'});continue;}const r=new Set(q['map'](y=>y['name'])),s=f['multimount']===!![]?'anchor_node':'expected_node';for(const y of[s,TWIN_PARAM[n]]){if(!r['has'](y))c['push']({'row':f,'problem':'twin\x20\x27'+p+'\x27\x20declares\x20no\x20param\x20\x27'+y+'\x27'});}}return c;}
@@ -0,0 +1,37 @@
1
+ export declare const PRODUCT_DETAIL_SOURCE_KEY = "product_detail_source";
2
+ export interface WipSourceStep {
3
+ id: string;
4
+ when: string;
5
+ action: string;
6
+ miss_consequence: string;
7
+ }
8
+ export interface ProductDetailResolution {
9
+ provided: boolean;
10
+ mode: "url" | "local" | "per_sku" | undefined;
11
+ enriched: Array<{
12
+ sku: string;
13
+ wip: string;
14
+ wip_hash: string;
15
+ origin: "url" | "local";
16
+ }>;
17
+ unresolved_skus: string[];
18
+ kept_pinned_skus: string[];
19
+ steps: WipSourceStep[];
20
+ warnings: string[];
21
+ }
22
+ export declare function parseProductDetailSource(raw: unknown): {
23
+ perSku: Record<string, string> | null;
24
+ single: string | null;
25
+ error: string | null;
26
+ };
27
+ export declare function readLocalWipHash(path: string): {
28
+ hash: string | null;
29
+ error: string | null;
30
+ };
31
+ export declare function resolveProductDetailSource(raw: unknown, sales: unknown): Promise<ProductDetailResolution>;
32
+ export interface SalesWipGateFinding {
33
+ rule_id: "R-SALES-WIP-MISSING";
34
+ missing_wip_skus: string[];
35
+ blocker: string;
36
+ }
37
+ export declare function salesWipGate(plan: unknown): SalesWipGateFinding | undefined;
@@ -0,0 +1 @@
1
+ import{readFileSync}from'node:fs';export const PRODUCT_DETAIL_SOURCE_KEY='product_detail_source';function isHttpUrl(a){return/^https?:\/\//i['test'](a);}function isDataUrl(a){return/^data:/i['test'](a);}export function parseProductDetailSource(a){if(typeof a!=='string'||a['trim']()==='')return{'perSku':null,'single':null,'error':null};const b=a['trim']();if(isHttpUrl(b)||isDataUrl(b))return{'perSku':null,'single':b,'error':null};if(b['startsWith']('{'))try{const c=JSON['parse'](b);if(c!==null&&typeof c==='object'&&!Array['isArray'](c)){const d={};for(const [e,f]of Object['entries'](c)){if(typeof f==='string'&&f['trim']()!=='')d[e]=f['trim']();}if(Object['keys'](d)['length']>0x0)return{'perSku':d,'single':null,'error':null};}}catch{return{'perSku':null,'single':null,'error':PRODUCT_DETAIL_SOURCE_KEY+'\x20looks\x20like\x20JSON\x20but\x20does\x20not\x20parse\x20as\x20an\x20object\x20—\x20treated\x20as\x20unanswered'};}return{'perSku':null,'single':b,'error':null};}export function readLocalWipHash(a){try{const b=JSON['parse'](readFileSync(a,'utf8')),c=b?.['meta'],d=c?.['hash'];if(typeof d==='string'&&d['trim']()!=='')return{'hash':d['trim'](),'error':null};return{'hash':null,'error':'local\x20file\x20\x27'+a+'\x27\x20has\x20no\x20meta.hash\x20—\x20it\x20is\x20not\x20a\x20wip_file-generated\x20.wip\x20file;\x20run\x20wip_file\x20generate\x20on\x20it\x20first'};}catch(f){return{'hash':null,'error':'local\x20file\x20\x27'+a+'\x27\x20is\x20unreadable\x20as\x20.wip\x20JSON\x20('+(f instanceof Error?f['message']:String(f))+')\x20—\x20run\x20wip_file\x20generate\x20on\x20it\x20first'};}}const SDK_REFUSAL='the\x20SDK\x20refuses\x20a\x20sale\x20created\x20without\x20wip\x20(abort\x20at\x20the\x20service_sales\x20configure)\x20—\x20'+('provide\x20fee_overrides[\x27'+PRODUCT_DETAIL_SOURCE_KEY+'\x27]\x20(a\x20public\x20https\x20URL\x20or\x20local\x20path\x20of\x20the\x20per-SKU\x20.wip\x20file,\x20or\x20a\x20JSON\x20object\x20mapping\x20SKU\x20name\x20to\x20either)\x20')+'or\x20upload\x20manually\x20via\x20wip_file\x20before\x20publish';export async function resolveProductDetailSource(a,b){const c=Array['isArray'](b)?b:[],d=parseProductDetailSource(a),e=[];if(d['error']!==null)e['push'](PRODUCT_DETAIL_SOURCE_KEY+':\x20'+d['error']+'.');const f={'provided':d['perSku']!==null||d['single']!==null,'mode':d['perSku']!==null?'per_sku':d['single']!==undefined&&d['single']!==null?isHttpUrl(d['single'])||isDataUrl(d['single'])?'url':'local':undefined,'enriched':[],'unresolved_skus':[],'kept_pinned_skus':[],'steps':[],'warnings':e};if(c['length']===0x0)return f;for(const g of c){const h=typeof g?.['name']==='string'?g['name']:'',i=g?.['wip'];if(typeof i==='string'&&i['trim']()!==''){f['kept_pinned_skus']['push'](h);continue;}const j=d['perSku']!==null?d['perSku'][h]:d['single'];if(j===undefined||j===null||j===''){f['unresolved_skus']['push'](h);continue;}if(isHttpUrl(j)||isDataUrl(j))f['enriched']['push']({'sku':h,'wip':j,'wip_hash':'','origin':'url'}),f['steps']['push']({'id':'wip_pin_'+(h||'sku'),'when':'AFTER\x20the\x20service_sales\x20configure\x20(first\x20order\x20window\x20is\x20fine,\x20but\x20pin\x20before\x20selling)','action':'verify\x20the\x20wip\x20file\x20at\x20'+j+'\x20(wip_file\x20action:\x27verify\x27)\x20and\x20pin\x20the\x20returned\x20meta.hash\x20onto\x20sale\x20\x27'+h+'\x27\x20(onchain_operations\x20sales.op:\x27wip_set\x27,\x20wip_hash:\x27<meta.hash>\x27)','miss_consequence':'sale\x20\x27'+h+'\x27\x20stays\x20UNPINNED\x20—\x20buyers\x20get\x20no\x20WYSIWYG\x20detail\x20pin\x20(the\x20listing\x27s\x20current\x20wip_hash\x20is\x20\x22\x22\x20and\x20buy-side\x20auto-fill\x20is\x20dropped)'});else{const k=readLocalWipHash(j);k['hash']!==null?(f['enriched']['push']({'sku':h,'wip':j,'wip_hash':k['hash'],'origin':'local'}),f['steps']['push']({'id':'wip_host_'+(h||'sku'),'when':'BEFORE\x20selling\x20(the\x20stored\x20local\x20path\x20is\x20unreachable\x20for\x20customers)','action':'host\x20the\x20local\x20.wip\x20file\x20\x27'+j+'\x27\x20at\x20a\x20public\x20https\x20URL\x20(wip_file\x20generate+upload),\x20then\x20rebind\x20sale\x20\x27'+h+'\x27\x20(onchain_operations\x20sales.op:\x27wip_set\x27,\x20wip:\x27<public\x20URL>\x27,\x20wip_hash:\x27'+k['hash']+'\x27)','miss_consequence':'sale\x20\x27'+h+'\x27\x20keeps\x20a\x20LOCAL\x20wip\x20path\x20on-chain\x20—\x20it\x20passes\x20the\x20merchant-side\x20configure,\x20but\x20order_new\x20aborts\x20100%\x20for\x20customers\x20(they\x20cannot\x20fetch\x20it)'})):(f['unresolved_skus']['push'](h),e['push'](PRODUCT_DETAIL_SOURCE_KEY+':\x20'+k['error']+'.\x20Sale\x20\x27'+h+'\x27\x20was\x20left\x20without\x20wip\x20—\x20'+SDK_REFUSAL+'.'));}}if(f['unresolved_skus']['length']>0x0&&!f['provided'])e['push'](PRODUCT_DETAIL_SOURCE_KEY+'\x20unanswered:\x20sales\x20step(s)\x20for\x20['+f['unresolved_skus']['join'](',\x20')+']\x20carry\x20no\x20wip\x20—\x20'+SDK_REFUSAL+'.');else f['unresolved_skus']['length']>0x0&&e['push'](PRODUCT_DETAIL_SOURCE_KEY+':\x20no\x20source\x20resolved\x20for\x20['+f['unresolved_skus']['join'](',\x20')+']\x20(per-SKU\x20map\x20miss\x20or\x20unreadable\x20file)\x20—\x20these\x20sale\x20rows\x20stay\x20without\x20wip;\x20'+SDK_REFUSAL+'.');return f;}function salesSteps(a){try{return readSalesSteps(a);}catch{return[];}}function readSalesSteps(a){if(a===null||typeof a!=='object')return[];const b=a,c=b['plan']!==null&&typeof b['plan']==='object'?b['plan']['steps']:undefined,d=b['creation_plan']!==null&&typeof b['creation_plan']==='object'?b['creation_plan']['steps']:undefined,e=Array['isArray'](b['steps'])?b['steps']:Array['isArray'](c)?c:Array['isArray'](d)?d:null;if(e===null)return[];const f=[];for(const g of e){if(g===null||typeof g!=='object')continue;const h=g['id'],i=g['params'];if(h!=='service_sales'||i===null||typeof i!=='object')continue;const j=i['sales'];if(!Array['isArray'](j))continue;f['push']({'stepId':typeof h==='string'?h:'service_sales','sales':j['filter'](k=>k!==null&&typeof k==='object')});}return f;}export function salesWipGate(a){const b=salesSteps(a);if(b['length']===0x0)return undefined;const c=[];let d=![],e=![];for(const {sales:f}of b){for(const g of f){d=!![];const h=g['wip'];if(typeof h==='string'&&h['trim']()!==''){e=!![];continue;}const i=typeof g['name']==='string'?g['name']:'sku';if(!c['includes'](String(i)))c['push'](String(i));}}if(!d||e)return undefined;return{'rule_id':'R-SALES-WIP-MISSING','missing_wip_skus':c,'blocker':'SALES\x20WITHOUT\x20WIP\x20(R-SALES-WIP-MISSING):\x20every\x20service_sales\x20row\x20['+c['join'](',\x20')+']\x20carries\x20an\x20empty\x20wip\x20—\x20'+(SDK_REFUSAL+'.\x20The\x20plan\x20would\x20abort\x20at\x20the\x20first\x20execute\x20attempt.')};}
@@ -0,0 +1,16 @@
1
+ export interface ProductDocViolation {
2
+ doc: string;
3
+ rule: string;
4
+ detail: string;
5
+ }
6
+ export declare const B5_PATH_DEBT_BASELINE: Record<string, number>;
7
+ export declare function isPlatformFinanceRow(cells: string[]): boolean;
8
+ export interface MetricPathMeasurement {
9
+ opsRows: number;
10
+ debt: number;
11
+ debtRows: string[];
12
+ hasFactorColumn: boolean;
13
+ hasLandingColumn: boolean;
14
+ }
15
+ export declare function measureMetricPaths(text: string): MetricPathMeasurement;
16
+ export declare function checkMetricPaths(doc: string, text: string): ProductDocViolation[];
@@ -0,0 +1 @@
1
+ export const B5_PATH_DEBT_BASELINE={'crowdfunding/gamefound.md':0xa,'crowdfunding/kickstarter.md':0xb,'education/coursera.md':0xb,'rental/airbnb.md':0x12,'rental/ziroom.md':0xb,'retail/alibaba-1688.md':0xa,'retail/amazon.md':0xd,'retail/costco.md':0xb,'retail/etsy.md':0xa,'retail/taobao-presale.md':0xe,'subscription/onlyfans.md':0x1,'travel/booking-com.md':0xd,'travel/klook.md':0xc};function section(a,b){const c=new RegExp('^##\x5cs*§?'+b+'\x5cb'),d=[];let e=![];for(const f of a['split'](/\r?\n/)){if(c['test'](f)){e=!![];continue;}if(e&&/^##\s/['test'](f))break;if(e)d['push'](f);}return d;}function tableRows(a){return a['filter'](b=>/^\|/['test'](b)&&!/^\|[\s:-]+\|/['test'](b))['map'](b=>b['split']('|')['slice'](0x1,-0x1)['map'](d=>d['trim']()));}export function isPlatformFinanceRow(a){return(a[0x0]??'')['includes']('[平台财务]')||a['some'](b=>b['replace'](/[`\s]/g,'')==='[平台财务]');}const FACTOR_ID=/(?<![-\w])F\d{1,2}\b/g,PROMISE_ID=/\bP-[A-Z0-9]+-[A-Z]\b/g,DIVIDEND_REF=/\u7ea2\u5229\s*(\d{1,2})/g;function factorsDefinedIn(a){const b=new Set();for(const c of tableRows(a)){const d=/^(F\d{1,2})$/['exec'](c[0x0]??'');if(d)b['add'](d[0x1]);}return b;}function promisesDefinedIn(a){const b=new Set();for(const c of a){if(!/\u627f\u8bfa/['test'](c))continue;for(const d of c['matchAll'](PROMISE_ID))b['add'](d[0x0]);}return b;}function dividendsDefinedIn(a){const b=new Set();let c=![];for(const d of a){const e=/^\s*(\d{1,2})\.\s/['exec'](d);if(c&&e){b['add'](Number(e[0x1]));continue;}if(/\u7ea2\u5229/['test'](d)){c=!![];continue;}if(d['trim']()==='')continue;c=![];}return b;}function b5TableRows(a){const b=a['findIndex'](f=>/B5\s*\u6307\u6807\u8def\u5f84\u94fe/['test'](f));if(b<0x0)return null;const c=[];let d=![];for(const f of a['slice'](b+0x1)){if(/^\|/['test'](f)){c['push'](f),d=!![];continue;}if(d&&f['trim']()!=='')break;}const e=tableRows(c);return e['length']>0x0?e['slice'](0x1):e;}function landingRefs(a,b){const c=b?a['replace'](/\uff08[^\uff09]*\uff09/g,'\x20'):a;return{'promises':[...c['matchAll'](PROMISE_ID)]['map'](d=>d[0x0]),'dividends':[...c['matchAll'](DIVIDEND_REF)]['map'](d=>Number(d[0x1]))};}const DASH=new Set(['—','-','–','','N/A','n/a']),normalizeKpi=a=>a['replace'](/`/g,'')['replace'](/\[\u5e73\u53f0\u8d22\u52a1\]/g,'')['replace'](/\s+/g,'');export function measureMetricPaths(a){const b={'opsRows':0x0,'debt':0x0,'debtRows':[],'hasFactorColumn':![],'hasLandingColumn':![]},c=section(a,0x8),d=tableRows(c);if(d['length']<0x2)return b;const [e,...f]=d,g=e['findIndex'](n=>/\u56e0\u5b50/['test'](n)),h=e['findIndex'](n=>/\u843d\u70b9/['test'](n)),i=factorsDefinedIn(section(a,0x9)),j=promisesDefinedIn(section(a,0xb)),k=dividendsDefinedIn(section(a,0xb)),l=[];let m=0x0;for(const n of f){if(isPlatformFinanceRow(n))continue;m++;const o=n[0x0]??'',p=g>=0x0?n[g]??'':'',q=h>=0x0?n[h]??'':'',r=[...p['matchAll'](FACTOR_ID)]['map'](v=>v[0x0]),s=r['length']>0x0&&r['every'](v=>i['has'](v)),t=landingRefs(q,!![]),u=!DASH['has'](q['trim']())&&t['promises']['length']+t['dividends']['length']>0x0&&t['promises']['every'](v=>j['has'](v))&&t['dividends']['every'](v=>k['has'](v));if(!(s&&u))l['push'](o);}return{'opsRows':m,'debt':l['length'],'debtRows':l,'hasFactorColumn':g>=0x0,'hasLandingColumn':h>=0x0};}export function checkMetricPaths(a,b){const c=[],e=section(b,0x8),f=tableRows(e);if(f['length']<0x2)return c;const [,...g]=f,h=section(b,0x9),i=section(b,0xb),j=factorsDefinedIn(h),k=promisesDefinedIn(i),l=dividendsDefinedIn(i),n=measureMetricPaths(b),o=B5_PATH_DEBT_BASELINE[a]??0x0;if(n['debt']>o){const r=!n['hasFactorColumn']&&!n['hasLandingColumn']?'§8\x20declares\x20neither\x20canonical\x20link\x20column\x20(`→\x20§9\x20因子`,\x20`→\x20§11\x20落点`)':!n['hasFactorColumn']?'§8\x20declares\x20no\x20`→\x20§9\x20因子`\x20column':!n['hasLandingColumn']?'§8\x20declares\x20no\x20`→\x20§11\x20落点`\x20column':'some\x20rows\x20leave\x20a\x20link\x20column\x20empty\x20or\x20unresolvable';c['push']({'doc':a,'rule':'§8-B5-01','detail':n['debt']+'\x20of\x20'+n['opsRows']+'\x20operations\x20rows\x20carry\x20no\x20complete\x20metric→factor→landing\x20path\x20'+('(baseline\x20'+o+'):\x20'+r+'.\x20B5\x20is\x20the\x20connectivity\x20of\x20the\x20metric\x20path,\x20not\x20the\x20length\x20')+'of\x20the\x20metric\x20table\x20—\x20a\x20KPI\x20with\x20no\x20§9\x20factor\x20has\x20no\x20driver\x20to\x20migrate\x20and\x20no\x20§11\x20landing\x20to\x20'+'fund\x20it.\x20Add\x20the\x20two\x20columns\x20and\x20fill\x20every\x20operations\x20row;\x20a\x20`[平台财务]`\x20row\x20may\x20keep\x20`—`.\x20'+('First\x20offenders:\x20'+n['debtRows']['slice'](0x0,0x4)['map'](s=>'\x22'+s+'\x22')['join'](',\x20'))+(''+(n['debtRows']['length']>0x4?'\x20…\x20(+'+(n['debtRows']['length']-0x4)+')':''))});}for(const s of g){const u=s[0x0]??'',v=s['join']('\x20|\x20');for(const x of new Set([...v['matchAll'](FACTOR_ID)]['map'](y=>y[0x0]))){!j['has'](x)&&c['push']({'doc':a,'rule':'§8-B5-02','detail':'§8\x20row\x20\x22'+u+'\x22\x20cites\x20factor\x20'+x+',\x20which\x20§9\x20does\x20not\x20define\x20'+('(§9\x20defines\x20'+([...j]['join'](',\x20')||'nothing')+').\x20A\x20dangling\x20factor\x20id\x20is\x20a\x20')+'broken\x20hop,\x20not\x20missing\x20work\x20—\x20the\x20path\x20points\x20at\x20a\x20driver\x20that\x20does\x20not\x20exist.'});}const w=landingRefs(v,![]);for(const y of new Set(w['promises'])){!k['has'](y)&&c['push']({'doc':a,'rule':'§8-B5-03','detail':'§8\x20row\x20\x22'+u+'\x22\x20cites\x20landing\x20promise\x20'+y+',\x20which\x20§11\x20never\x20anchors\x20as\x20`承诺\x20'+y+'`.\x20'+'The\x20metric\x20claims\x20a\x20migration\x20landing\x20that\x20the\x20document\x20does\x20not\x20actually\x20promise.'});}for(const z of new Set(w['dividends'])){!l['has'](z)&&c['push']({'doc':a,'rule':'§8-B5-04','detail':'§8\x20row\x20\x22'+u+'\x22\x20cites\x20红利\x20'+z+',\x20but\x20§11\x27s\x20红利\x20list\x20defines\x20'+(([...l]['sort']((A,B)=>A-B)['join'](',\x20')||'no\x20numbered\x20items')+'.\x20')+'The\x20metric\x20points\x20at\x20a\x20cost-dividend\x20landing\x20that\x20does\x20not\x20exist.'});}}const q=b5TableRows(i);if(q){const A=g['map'](B=>normalizeKpi(B[0x0]??''));for(const B of q){const C=normalizeKpi(B[0x0]??''),D=(B[0x1]??'')['trim']();if(!C)continue;!A['some'](E=>E&&(E['includes'](C)||C['includes'](E)))&&c['push']({'doc':a,'rule':'§8-B5-05','detail':'§11\x27s\x20B5\x20path\x20table\x20lists\x20KPI\x20\x22'+B[0x0]+'\x22,\x20which\x20no\x20§8\x20row\x20carries\x20—\x20the\x20restatement\x20'+'has\x20drifted\x20from\x20the\x20table\x20it\x20restates,\x20so\x20a\x20reader\x20following\x20the\x20path\x20lands\x20nowhere.'});for(const E of new Set([...D['matchAll'](FACTOR_ID)]['map'](F=>F[0x0]))){!j['has'](E)&&c['push']({'doc':a,'rule':'§8-B5-05','detail':'§11\x27s\x20B5\x20path\x20table\x20cites\x20factor\x20'+E+'\x20for\x20\x22'+B[0x0]+'\x22,\x20which\x20§9\x20does\x20not\x20define.'});}}}return c;}
@@ -1 +1 @@
1
- import{MAX_NAMED_OPERATOR_COUNT,MAX_NAMED_OPERATOR_ADDRESS_COUNT,MAX_CONTEXT_REPOSITORY_COUNT}from'@wowok/wowok';export{MAX_NAMED_OPERATOR_COUNT,MAX_NAMED_OPERATOR_ADDRESS_COUNT,MAX_CONTEXT_REPOSITORY_COUNT};export const PROGRESS_NEW={'index':0xdc,'name':'PROGRESS_NEW','description':'Create\x20new\x20Progress\x20(asserted\x20on\x20direct\x20Progress\x20creation)','governed_operations':['direct\x20Progress\x20creation','passport-guarded\x20Progress\x20creation'],'sdk_exposed':![]};export const PROGRESS_NAMED_OPERATOR={'index':0xdd,'name':'PROGRESS_NAMED_OPERATOR','description':'Manage\x20named\x20operators\x20(add/set/remove)\x20for\x20the\x20namedOperator\x20namespace','governed_operations':['progress::namedOperator_add','progress::namedOperator_set','progress::namedOperator_remove','progress::namedOperator_add_with_passport','progress::namedOperator_set_with_passport','progress::namedOperator_remove_with_passport'],'sdk_exposed':!![]};export const PROGRESS_TASK={'index':0xde,'name':'PROGRESS_TASK','description':'Submit\x20task\x20(one-time,\x20immutable\x20once\x20set\x20—\x20E_TASK_ALREADY_SET)','governed_operations':['submit\x20the\x20task\x20(one-time)','submit\x20the\x20task\x20with\x20a\x20passport'],'sdk_exposed':!![]};export const PROGRESS_CONTEXT_REPOSITORY={'index':0xdf,'name':'PROGRESS_CONTEXT_REPOSITORY','description':'Bind/unbind\x20context\x20Repository\x20(≤\x20MAX_CONTEXT_REPOSITORY_COUNT=30)','governed_operations':['bind\x20a\x20context\x20repository','unbind\x20a\x20context\x20repository','clear\x20all\x20context\x20repositories','bind\x20a\x20context\x20repository\x20(passport-guarded)','unbind\x20a\x20context\x20repository\x20(passport-guarded)','clear\x20all\x20context\x20repositories\x20(passport-guarded)'],'sdk_exposed':!![]};export const PROGRESS_UNHOLD={'index':0xe0,'name':'PROGRESS_UNHOLD','description':'Force\x20unhold\x20(adminUnhold)\x20—\x20bypasses\x20holder\x20check,\x20releases\x20blocked\x20forward','governed_operations':['force\x20unhold\x20(adminUnhold)','force\x20unhold\x20via\x20passport'],'sdk_exposed':!![]};export const PROGRESS_OWNER_RECEIVE={'index':0xe1,'name':'PROGRESS_OWNER_RECEIVE','description':'Owner\x20receives\x20objects/coins\x20(unwrap\x20Receiving<K>\x20→\x20owner)','governed_operations':['owner\x20receives\x20coins','owner\x20receives\x20a\x20generic\x20object','owner\x20receives\x20coins\x20via\x20passport','owner\x20receives\x20a\x20generic\x20object\x20via\x20passport'],'sdk_exposed':![]};export const PROGRESS_PERMISSIONS=[PROGRESS_NEW,PROGRESS_NAMED_OPERATOR,PROGRESS_TASK,PROGRESS_CONTEXT_REPOSITORY,PROGRESS_UNHOLD,PROGRESS_OWNER_RECEIVE];export const PROGRESS_SCENES=[{'id':'progress_task_submit','name':'Task\x20submission\x20&\x20binding\x20workflow','industry':['universal','ecommerce','logistics','education'],'scenario':'Submit\x20a\x20task\x20(Order/Reward/etc.)\x20to\x20Progress\x20via\x20task\x20submission.\x20'+'Task\x20is\x20one-time,\x20immutable\x20—\x20once\x20set,\x20E_TASK_ALREADY_SET\x20blocks\x20any\x20re-assignment.\x20'+'Binds\x20Progress\x201:1\x20to\x20the\x20task\x20object\x20for\x20the\x20rest\x20of\x20its\x20lifecycle.','phases':['task_binding','forward_advance'],'requires_published_machine':!![],'requires_order_bound':!![],'named_operator_roles':[],'builtin_indexes_consumed':[PROGRESS_TASK],'typical_context_repository_count':0x0,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['Task\x20submission\x20is\x20one-time:\x20verify\x20task\x20address\x20before\x20submission\x20(E_TASK_ALREADY_SET\x20blocks\x20reset)','task\x20is\x20usually\x20an\x20Order\x20created\x20by\x20the\x20buy\x20flow\x20→\x20Progress.task\x20=\x20Order\x20address','Without\x20task,\x20Forward\x20advancement\x20falls\x20back\x20to\x20non-order\x20next()/hold()\x20paths'],'recommended_templates':['T-PR-01']},{'id':'progress_named_operator','name':'Named\x20operator\x20namespace\x20management','industry':['universal','logistics','arbitration','freelance'],'scenario':'Manage\x20named_operator\x20namespace\x20for\x20a\x20Progress.\x20Each\x20named\x20operator\x20is\x20a\x20(name\x20→\x20address\x20list)\x20'+'binding\x20used\x20by\x20Machine.forward.namedOperator\x20to\x20gate\x20next()/hold()\x20advancement.\x20'+'Up\x20to\x2060\x20named\x20operators\x20per\x20Progress,\x20up\x20to\x2080\x20addresses\x20per\x20operator.','phases':['named_operator_mgmt'],'requires_published_machine':!![],'requires_order_bound':![],'named_operator_roles':[{'role':'seller','typical_count':0x1},{'role':'logistics','typical_count':0x1},{'role':'reviewer','typical_count':0x3},{'role':'arbitrator','typical_count':0x5}],'builtin_indexes_consumed':[PROGRESS_NAMED_OPERATOR],'typical_context_repository_count':0x0,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['namedOperator\x20name=\x27\x27:\x20special\x20case\x20—\x20means\x20OrderHolder\x20(order.owner/agent),\x20NOT\x20a\x20real\x20named\x20operator','add/set/remove\x20are\x20idempotent\x20on\x20duplicate\x20addresses\x20(vector::contains\x20check\x20before\x20push)','Use\x20\x27set\x27\x20to\x20REPLACE\x20an\x20operator\x27s\x20address\x20list;\x20use\x20\x27add\x27\x20to\x20extend;\x20\x27remove\x27\x20to\x20subtract','Names\x20must\x20satisfy\x20common::NAME\x20(isValidName)\x20—\x20non-empty,\x20length-bounded'],'recommended_templates':['T-PR-01','T-PR-02']},{'id':'progress_unhold','name':'Hold\x20release\x20(unhold\x20/\x20adminUnhold)\x20workflow','industry':['content','rental','arbitration','subscription'],'scenario':'Release\x20a\x20forward\x20that\x20was\x20previously\x20held.\x20Two\x20paths:\x20'+'(a)\x20unhold\x20by\x20original\x20holder\x20(named_operator\x20match);\x20'+'(b)\x20adminUnhold\x20(224)\x20by\x20permission-table\x20holder\x20—\x20bypasses\x20holder\x20check.\x20'+'adminUnhold\x20is\x20the\x20deadlock-resolution\x20escape\x20hatch\x20when\x20a\x20holder\x20is\x20unresponsive.','phases':['hold_state','unhold_state'],'requires_published_machine':!![],'requires_order_bound':!![],'named_operator_roles':[{'role':'holder','typical_count':0x1},{'role':'admin','typical_count':0x1}],'builtin_indexes_consumed':[PROGRESS_UNHOLD],'typical_context_repository_count':0x0,'uses_hold_mechanism':!![],'uses_admin_unhold':!![],'common_patterns':['unhold\x20checks\x20whether\x20the\x20sender\x20holds\x20permission\x20index\x20224:\x20if\x20yes,\x20force\x20release;\x20if\x20no,\x20require\x20holder\x20match','adminUnhold\x20has\x20wider\x20blast\x20radius\x20—\x20only\x20grant\x20224\x20to\x20trusted\x20recovery\x20operators','If\x20forward\x20already\x20accomplished,\x20E_FORWARD_ALREADY_ACCOMPLISHED\x20blocks\x20re-hold','Repeated\x20hold/unhold\x20cycles\x20indicate\x20a\x20stuck\x20workflow\x20—\x20surface\x20to\x20order-monitor'],'recommended_templates':['T-PR-05']},{'id':'progress_context_repository','name':'Context\x20Repository\x20binding\x20workflow','industry':['education','content','rental','cross_chain'],'scenario':'Bind/unbind\x20Repository\x20objects\x20as\x20Progress\x20context_repositories.\x20'+'Used\x20to\x20provide\x20query-time\x20context\x20(learning\x20progress,\x20inspection\x20records,\x20bridge\x20state).\x20'+'Up\x20to\x20MAX_CONTEXT_REPOSITORY_COUNT=30\x20repositories\x20per\x20Progress.','phases':['context_binding'],'requires_published_machine':!![],'requires_order_bound':![],'named_operator_roles':[],'builtin_indexes_consumed':[PROGRESS_CONTEXT_REPOSITORY],'typical_context_repository_count':0x3,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['Binding\x20a\x20context\x20repository\x20registers\x20the\x20link\x20through\x20an\x20affiliation\x20transaction\x20(enables\x20cross-object\x20queries)','Unbinding\x20disaffiliates\x20the\x20link\x20—\x20Repository\x20may\x20be\x20garbage-collected\x20if\x20no\x20other\x20refs','Clearing\x20empties\x20the\x20entire\x20list\x20in\x20one\x20transaction','add\x20is\x20idempotent:\x20if\x20Repository\x20already\x20in\x20list,\x20no-op\x20(vector::contains\x20check)','Bind\x20before\x20forward\x20advance\x20so\x20on-chain\x20guards\x20can\x20read\x20context\x20data'],'recommended_templates':['T-PR-03']},{'id':'progress_owner_receive','name':'Owner\x20receive\x20(unwrap)\x20workflow','industry':['finance','treasury','rental','freelance'],'scenario':'Owner\x20receives\x20Receiving<K>\x20objects\x20or\x20CoinWrapper<T>\x20coins\x20sent\x20to\x20the\x20Progress\x20object.\x20'+'unwrap\x20→\x20forwarded\x20to\x20the\x20Permission\x20owner\x20through\x20the\x20permission\x20owner-receive\x20path.\x20'+'Used\x20at\x20terminal\x20nodes\x20(return_approved,\x20completed,\x20enforced)\x20to\x20disburse\x20funds.','phases':['owner_receive'],'requires_published_machine':!![],'requires_order_bound':!![],'named_operator_roles':[],'builtin_indexes_consumed':[PROGRESS_OWNER_RECEIVE],'typical_context_repository_count':0x0,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['owner_receive\x20unwraps\x20CoinWrapper<T>\x20via\x20the\x20payment\x27s\x20type-checked\x20unwrap\x20(amount\x20validation)','Receiving\x20a\x20generic\x20K:key+store\x20object\x20forwards\x20it\x20to\x20the\x20Permission\x20owner','Triggered\x20at\x20terminal\x20nodes\x20(e.g.\x20\x27return_approved\x27\x20in\x20rental,\x20\x27enforced\x27\x20in\x20arbitration)','Permission\x20owner\x20≠\x20Progress\x20creator:\x20receives\x20flow\x20to\x20whoever\x20owns\x20the\x20bound\x20Machine\x27s\x20Permission'],'recommended_templates':['T-PR-06']},{'id':'progress_completed','name':'Forward\x20advancement\x20&\x20session\x20completion','industry':['universal'],'scenario':'Advance\x20Progress\x20via\x20next()\x20/\x20the\x20order-holder\x20advancement\x20path\x20—\x20accumulates\x20weights\x20in\x20session.forwards,\x20'+'and\x20when\x20weights\x20≥\x20threshold,\x20moves\x20session\x20into\x20history\x20and\x20updates\x20Progress.current.\x20'+'This\x20is\x20the\x20canonical\x20Forward\x20advancement\x20path\x20for\x20ALL\x20non-hold\x20operations.','phases':['forward_advance','completed'],'requires_published_machine':!![],'requires_order_bound':!![],'named_operator_roles':[{'role':'OrderHolder','typical_count':0x1},{'role':'next_node_operator','typical_count':0x1}],'builtin_indexes_consumed':[],'typical_context_repository_count':0x0,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['Forward\x20guard\x20(Some):\x20requires\x20Passport;\x20the\x20passport\x20verification\x20against\x20the\x20guard\x20must\x20pass','Forward\x20guard\x20(None):\x20requires\x20permissionIndex\x20(Some)\x20or\x20namedOperator\x20match\x20(ASSERT_PERMISSION)','session.weights\x20+=\x20forward.weight;\x20when\x20≥\x20threshold,\x20push\x20session\x20into\x20ParentTableVec<History>','Progress.current\x20=\x20next_node\x20only\x20after\x20session\x20completes\x20(atomic\x20update)','E_NOT_THE_HOLDER:\x20if\x20forward\x20was\x20held\x20by\x20another\x20address,\x20next()\x20aborts','E_FORWARD_ALREADY_ACCOMPLISHED:\x20re-hold\x20on\x20completed\x20forward\x20is\x20blocked','E_ORDER_PAYER_REQUIRED\x20(abort\x2013):\x20a\x20\x22\x22-namedOperator\x20forward\x20is\x20payer-only\x20—\x20advance\x20as\x20the\x20'+'order\x20payer\x20on\x20the\x20order-bound\x20entry;\x20a\x20taskless\x20Progress\x20fails\x20closed\x20on\x20any\x20entry','⚠\x20ROUTING\x20FACT:\x20Forward.namedOperator=\x22\x22\x20(empty)\x20→\x20order-bound\x20entry\x20only\x20(order.progress,\x20or\x20'+'progress.operate\x20which\x20auto-routes\x20when\x20the\x20Progress\x20task\x20is\x20an\x20Order).\x20Non-empty\x20namedOperator\x20or\x20'+'permissionIndex-only\x20→\x20either\x20entry\x20(identical\x20checks).\x20A\x20standalone\x20Progress\x20cannot\x20advance\x20\x22\x22\x20'+'forwards\x20at\x20all\x20(abort\x2013\x20—\x20E_ORDER_PAYER_REQUIRED,\x20fail-closed:\x20no\x20payer\x20to\x20name;\x20a\x20task-bound\x20'+'Progress\x20driven\x20off\x20the\x20order\x20path\x20by\x20a\x20non-payer\x20aborts\x20with\x20the\x20same\x20code).\x20See\x20file\x20header\x20ROUTING\x20FACTS.'],'recommended_templates':['T-PR-04']}];export const PROGRESS_LEDGER_VERSION='1.0.0';export function getScenesByPhase(a){return PROGRESS_SCENES['filter'](b=>b['phases']['includes'](a));}export function findSceneById(a){return PROGRESS_SCENES['find'](b=>b['id']===a);}export function getScenesByIndustry(a){return PROGRESS_SCENES['filter'](b=>b['industry']['includes'](a)||b['industry']['includes']('universal'));}export function getBuiltinPermissionByIndex(a){return PROGRESS_PERMISSIONS['find'](b=>b['index']===a);}export function isProgressBuiltinPermission(a){return getBuiltinPermissionByIndex(a)!==undefined;}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[['adminunhold','progress_unhold'],['admin\x20unhold','progress_unhold'],['force\x20unhold','progress_unhold'],['unhold','progress_unhold'],['release\x20hold','progress_unhold'],['owner_receive','progress_owner_receive'],['owner\x20receive','progress_owner_receive'],['unwrap','progress_owner_receive'],['context_repository','progress_context_repository'],['context\x20repository','progress_context_repository'],['repository\x20binding','progress_context_repository'],['named_operator','progress_named_operator'],['named\x20operator','progress_named_operator'],['namedoperator','progress_named_operator'],['task\x20set','progress_task_submit'],['submit\x20task','progress_task_submit'],['next','progress_completed'],['advance','progress_completed'],['complete','progress_completed']];for(const [d,e]of c){if(b['includes'](d)){const f=findSceneById(e);if(f)return f;}}return undefined;}export function getAllBuiltinPermissions(){return[...PROGRESS_PERMISSIONS];}export function getProgressScenesCount(){return PROGRESS_SCENES['length'];}export function validateNamedOperatorAddressList(b){const c=[];b['length']>MAX_NAMED_OPERATOR_ADDRESS_COUNT&&c['push']('Named\x20operator\x20address\x20count\x20'+b['length']+'\x20exceeds\x20MAX_NAMED_OPERATOR_ADDRESS_COUNT\x20'+MAX_NAMED_OPERATOR_ADDRESS_COUNT);const d=new Set();for(const e of b){if(d['has'](e)){c['push']('Duplicate\x20address\x20in\x20list:\x20'+e+'\x20(Move\x20will\x20dedupe\x20silently)');break;}d['add'](e);}return{'ok':c['length']===0x0,'violations':c};}export function validateNamedOperatorCount(a){if(a>=MAX_NAMED_OPERATOR_COUNT)return{'ok':![],'violation':'Named\x20operator\x20count\x20'+a+'\x20would\x20exceed\x20MAX_NAMED_OPERATOR_COUNT\x20'+MAX_NAMED_OPERATOR_COUNT};return{'ok':!![]};}export function validateContextRepositoryCount(a,b){const c=a+b;if(c>MAX_CONTEXT_REPOSITORY_COUNT)return{'ok':![],'violation':'Context\x20repository\x20count\x20'+c+'\x20would\x20exceed\x20MAX_CONTEXT_REPOSITORY_COUNT\x20'+MAX_CONTEXT_REPOSITORY_COUNT};return{'ok':!![]};}export const PROGRESS_CROSS_OBJECT_REFS=[{'object':'Machine','phase':'universal','relationship':'Progress.machine\x20(immutable\x20bind,\x20E_MACHINE_NOT_MATCH\x20on\x20every\x20op)'},{'object':'Order','phase':'forward_advance','relationship':'Progress.task\x20=\x20Order.address\x20(1:1,\x20set\x20via\x20task\x20submission\x20or\x20the\x20buy\x20flow)'},{'object':'Order','phase':'forward_advance','relationship':'order-holder\x20paths\x20(advance\x20/\x20hold):\x20the\x20order\x20owner-or-agent\x20permission\x20check\x20gates\x20Forward\x20advance'},{'object':'Permission','phase':'universal','relationship':'Machine.permission\x20is\x20borrowed\x20for\x20ALL\x20220-225\x20assertions'},{'object':'Repository','phase':'context_binding','relationship':'context_repositories:\x20vector<address>\x20(≤\x2030),\x20bound\x20via\x20an\x20affiliation\x20transaction'},{'object':'Service','phase':'creation','relationship':'the\x20buy\x20flow\x20creates\x20the\x20Progress\x20internally\x20(bypasses\x20220\x20assertion\x20—\x20package-internal\x20entry)'},{'object':'Passport','phase':'forward_advance','relationship':'Forward.guard\x20(Some)\x20requires\x20Passport\x20+\x20passing\x20the\x20passport\x20verification'},{'object':'Passport','phase':'unhold_state','relationship':'passport-based\x20unhold:\x20224\x20check\x20via\x20passport\x20(fallback\x20when\x20the\x20sender\x27s\x20direct\x20224\x20permission\x20check\x20fails)'},{'object':'Payment','phase':'owner_receive','relationship':'owner_receive\x20unwraps\x20CoinWrapper<T>\x20via\x20the\x20payment\x27s\x20type-checked\x20unwrap'},{'object':'Allocation','phase':'completed','relationship':'Terminal\x20node\x20triggers\x20Allocation\x20alloc\x20(e.g.\x20\x27completed\x27,\x20\x27enforced\x27,\x20\x27return_approved\x27)'}];
1
+ import{MAX_NAMED_OPERATOR_COUNT,MAX_NAMED_OPERATOR_ADDRESS_COUNT,MAX_CONTEXT_REPOSITORY_COUNT}from'@wowok/wowok';export{MAX_NAMED_OPERATOR_COUNT,MAX_NAMED_OPERATOR_ADDRESS_COUNT,MAX_CONTEXT_REPOSITORY_COUNT};export const PROGRESS_NEW={'index':0xdc,'name':'PROGRESS_NEW','description':'Create\x20new\x20Progress\x20(asserted\x20on\x20direct\x20Progress\x20creation)','governed_operations':['direct\x20Progress\x20creation','passport-guarded\x20Progress\x20creation'],'sdk_exposed':![]};export const PROGRESS_NAMED_OPERATOR={'index':0xdd,'name':'PROGRESS_NAMED_OPERATOR','description':'Manage\x20named\x20operators\x20(add/set/remove)\x20for\x20the\x20namedOperator\x20namespace','governed_operations':['progress::namedOperator_add','progress::namedOperator_set','progress::namedOperator_remove','progress::namedOperator_add_with_passport','progress::namedOperator_set_with_passport','progress::namedOperator_remove_with_passport'],'sdk_exposed':!![]};export const PROGRESS_TASK={'index':0xde,'name':'PROGRESS_TASK','description':'Submit\x20task\x20(one-time,\x20immutable\x20once\x20set\x20—\x20E_TASK_ALREADY_SET)','governed_operations':['submit\x20the\x20task\x20(one-time)','submit\x20the\x20task\x20with\x20a\x20passport'],'sdk_exposed':!![]};export const PROGRESS_CONTEXT_REPOSITORY={'index':0xdf,'name':'PROGRESS_CONTEXT_REPOSITORY','description':'Bind/unbind\x20context\x20Repository\x20(≤\x20MAX_CONTEXT_REPOSITORY_COUNT=30)','governed_operations':['bind\x20a\x20context\x20repository','unbind\x20a\x20context\x20repository','clear\x20all\x20context\x20repositories','bind\x20a\x20context\x20repository\x20(passport-guarded)','unbind\x20a\x20context\x20repository\x20(passport-guarded)','clear\x20all\x20context\x20repositories\x20(passport-guarded)'],'sdk_exposed':!![]};export const PROGRESS_UNHOLD={'index':0xe0,'name':'PROGRESS_UNHOLD','description':'Force\x20unhold\x20(adminUnhold)\x20—\x20bypasses\x20holder\x20check,\x20releases\x20blocked\x20forward','governed_operations':['force\x20unhold\x20(adminUnhold)','force\x20unhold\x20via\x20passport'],'sdk_exposed':!![]};export const PROGRESS_OWNER_RECEIVE={'index':0xe1,'name':'PROGRESS_OWNER_RECEIVE','description':'Owner\x20receives\x20objects/coins\x20(unwrap\x20Receiving<K>\x20→\x20owner)','governed_operations':['owner\x20receives\x20coins','owner\x20receives\x20a\x20generic\x20object','owner\x20receives\x20coins\x20via\x20passport','owner\x20receives\x20a\x20generic\x20object\x20via\x20passport'],'sdk_exposed':![]};export const PROGRESS_PERMISSIONS=[PROGRESS_NEW,PROGRESS_NAMED_OPERATOR,PROGRESS_TASK,PROGRESS_CONTEXT_REPOSITORY,PROGRESS_UNHOLD,PROGRESS_OWNER_RECEIVE];export const PROGRESS_SCENES=[{'id':'progress_task_submit','name':'Task\x20submission\x20&\x20binding\x20workflow','industry':['universal','ecommerce','logistics','education'],'scenario':'Submit\x20a\x20task\x20(Order/Reward/etc.)\x20to\x20Progress\x20via\x20task\x20submission.\x20'+'Task\x20is\x20one-time,\x20immutable\x20—\x20once\x20set,\x20E_TASK_ALREADY_SET\x20blocks\x20any\x20re-assignment.\x20'+'Binds\x20Progress\x201:1\x20to\x20the\x20task\x20object\x20for\x20the\x20rest\x20of\x20its\x20lifecycle.','phases':['task_binding','forward_advance'],'requires_published_machine':!![],'requires_order_bound':!![],'named_operator_roles':[],'builtin_indexes_consumed':[PROGRESS_TASK],'typical_context_repository_count':0x0,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['Task\x20submission\x20is\x20one-time:\x20verify\x20task\x20address\x20before\x20submission\x20(E_TASK_ALREADY_SET\x20blocks\x20reset)','task\x20is\x20usually\x20an\x20Order\x20created\x20by\x20the\x20buy\x20flow\x20→\x20Progress.task\x20=\x20Order\x20address','Without\x20task,\x20Forward\x20advancement\x20falls\x20back\x20to\x20non-order\x20next()/hold()\x20paths'],'recommended_templates':['T-PR-01']},{'id':'progress_named_operator','name':'Named\x20operator\x20namespace\x20management','industry':['universal','logistics','arbitration','freelance'],'scenario':'Manage\x20named_operator\x20namespace\x20for\x20a\x20Progress.\x20Each\x20named\x20operator\x20is\x20a\x20(name\x20→\x20address\x20list)\x20'+'binding\x20used\x20by\x20Machine.forward.namedOperator\x20to\x20gate\x20next()/hold()\x20advancement.\x20'+'Up\x20to\x2060\x20named\x20operators\x20per\x20Progress,\x20up\x20to\x2080\x20addresses\x20per\x20operator.','phases':['named_operator_mgmt'],'requires_published_machine':!![],'requires_order_bound':![],'named_operator_roles':[{'role':'seller','typical_count':0x1},{'role':'logistics','typical_count':0x1},{'role':'reviewer','typical_count':0x3},{'role':'arbitrator','typical_count':0x5}],'builtin_indexes_consumed':[PROGRESS_NAMED_OPERATOR],'typical_context_repository_count':0x0,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['namedOperator\x20name=\x27\x27:\x20special\x20case\x20—\x20means\x20OrderHolder\x20(order.owner/agent),\x20NOT\x20a\x20real\x20named\x20operator','add/set/remove\x20are\x20idempotent\x20on\x20duplicate\x20addresses\x20(vector::contains\x20check\x20before\x20push)','Use\x20\x27set\x27\x20to\x20REPLACE\x20an\x20operator\x27s\x20address\x20list;\x20use\x20\x27add\x27\x20to\x20extend;\x20\x27remove\x27\x20to\x20subtract','Names\x20must\x20satisfy\x20common::NAME\x20(isValidName)\x20—\x20non-empty,\x20length-bounded'],'recommended_templates':['T-PR-01','T-PR-02']},{'id':'progress_unhold','name':'Hold\x20release\x20(unhold\x20/\x20adminUnhold)\x20workflow','industry':['content','rental','arbitration','subscription'],'scenario':'Release\x20a\x20forward\x20that\x20was\x20previously\x20held.\x20Two\x20paths:\x20'+'(a)\x20unhold\x20by\x20original\x20holder\x20(named_operator\x20match);\x20'+'(b)\x20adminUnhold\x20(224)\x20by\x20permission-table\x20holder\x20—\x20bypasses\x20holder\x20check.\x20'+'adminUnhold\x20is\x20the\x20deadlock-resolution\x20escape\x20hatch\x20when\x20a\x20holder\x20is\x20unresponsive.','phases':['hold_state','unhold_state'],'requires_published_machine':!![],'requires_order_bound':!![],'named_operator_roles':[{'role':'holder','typical_count':0x1},{'role':'admin','typical_count':0x1}],'builtin_indexes_consumed':[PROGRESS_UNHOLD],'typical_context_repository_count':0x0,'uses_hold_mechanism':!![],'uses_admin_unhold':!![],'common_patterns':['unhold\x20checks\x20whether\x20the\x20sender\x20holds\x20permission\x20index\x20224:\x20if\x20yes,\x20force\x20release;\x20if\x20no,\x20require\x20holder\x20match','adminUnhold\x20has\x20wider\x20blast\x20radius\x20—\x20only\x20grant\x20224\x20to\x20trusted\x20recovery\x20operators','If\x20forward\x20already\x20accomplished,\x20E_FORWARD_ALREADY_ACCOMPLISHED\x20blocks\x20re-hold','Repeated\x20hold/unhold\x20cycles\x20indicate\x20a\x20stuck\x20workflow\x20—\x20surface\x20to\x20order-monitor'],'recommended_templates':['T-PR-05']},{'id':'progress_context_repository','name':'Context\x20Repository\x20binding\x20workflow','industry':['education','content','rental','cross_chain'],'scenario':'Bind/unbind\x20Repository\x20objects\x20as\x20Progress\x20context_repositories.\x20'+'Used\x20to\x20provide\x20query-time\x20context\x20(learning\x20progress,\x20inspection\x20records,\x20bridge\x20state).\x20'+'Up\x20to\x20MAX_CONTEXT_REPOSITORY_COUNT=30\x20repositories\x20per\x20Progress.','phases':['context_binding'],'requires_published_machine':!![],'requires_order_bound':![],'named_operator_roles':[],'builtin_indexes_consumed':[PROGRESS_CONTEXT_REPOSITORY],'typical_context_repository_count':0x3,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['Binding\x20a\x20context\x20repository\x20registers\x20the\x20link\x20through\x20an\x20affiliation\x20transaction\x20(enables\x20cross-object\x20queries)','Unbinding\x20disaffiliates\x20the\x20link\x20—\x20Repository\x20may\x20be\x20garbage-collected\x20if\x20no\x20other\x20refs','Clearing\x20empties\x20the\x20entire\x20list\x20in\x20one\x20transaction','add\x20is\x20idempotent:\x20if\x20Repository\x20already\x20in\x20list,\x20no-op\x20(vector::contains\x20check)','Bind\x20before\x20forward\x20advance\x20so\x20on-chain\x20guards\x20can\x20read\x20context\x20data'],'recommended_templates':['T-PR-03']},{'id':'progress_owner_receive','name':'Owner\x20receive\x20(unwrap)\x20workflow','industry':['finance','treasury','rental','freelance'],'scenario':'Owner\x20receives\x20Receiving<K>\x20objects\x20or\x20CoinWrapper<T>\x20coins\x20sent\x20to\x20the\x20Progress\x20object.\x20'+'unwrap\x20→\x20forwarded\x20to\x20the\x20Permission\x20owner\x20through\x20the\x20permission\x20owner-receive\x20path.\x20'+'Used\x20at\x20terminal\x20nodes\x20(return_approved,\x20completed,\x20enforced)\x20to\x20disburse\x20funds.','phases':['owner_receive'],'requires_published_machine':!![],'requires_order_bound':!![],'named_operator_roles':[],'builtin_indexes_consumed':[PROGRESS_OWNER_RECEIVE],'typical_context_repository_count':0x0,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['owner_receive\x20unwraps\x20CoinWrapper<T>\x20via\x20the\x20payment\x27s\x20type-checked\x20unwrap\x20(amount\x20validation)','Receiving\x20a\x20generic\x20K:key+store\x20object\x20forwards\x20it\x20to\x20the\x20Permission\x20owner','Triggered\x20at\x20terminal\x20nodes\x20(e.g.\x20\x27return_approved\x27\x20in\x20rental,\x20\x27enforced\x27\x20in\x20arbitration)','Permission\x20owner\x20≠\x20Progress\x20creator:\x20receives\x20flow\x20to\x20whoever\x20owns\x20the\x20bound\x20Machine\x27s\x20Permission'],'recommended_templates':['T-PR-06']},{'id':'progress_completed','name':'Forward\x20advancement\x20&\x20session\x20completion','industry':['universal'],'scenario':'Advance\x20Progress\x20via\x20next()\x20/\x20the\x20order-holder\x20advancement\x20path\x20—\x20accumulates\x20weights\x20in\x20session.forwards,\x20'+'and\x20when\x20weights\x20≥\x20threshold,\x20moves\x20session\x20into\x20history\x20and\x20updates\x20Progress.current.\x20'+'This\x20is\x20the\x20canonical\x20Forward\x20advancement\x20path\x20for\x20ALL\x20non-hold\x20operations.','phases':['forward_advance','completed'],'requires_published_machine':!![],'requires_order_bound':!![],'named_operator_roles':[{'role':'OrderHolder','typical_count':0x1},{'role':'next_node_operator','typical_count':0x1}],'builtin_indexes_consumed':[],'typical_context_repository_count':0x0,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['Forward\x20guard\x20(Some):\x20requires\x20Passport;\x20the\x20passport\x20verification\x20against\x20the\x20guard\x20must\x20pass','Forward\x20guard\x20(None):\x20requires\x20permissionIndex\x20(Some)\x20or\x20namedOperator\x20match\x20(ASSERT_PERMISSION)','session.weights\x20+=\x20forward.weight;\x20when\x20≥\x20threshold,\x20push\x20session\x20into\x20ParentTableVec<History>','Progress.current\x20=\x20next_node\x20only\x20after\x20session\x20completes\x20(atomic\x20update)','E_NOT_THE_HOLDER:\x20if\x20forward\x20was\x20held\x20by\x20another\x20address,\x20next()\x20aborts','E_FORWARD_ALREADY_ACCOMPLISHED:\x20re-hold\x20on\x20completed\x20forward\x20is\x20blocked','E_ORDER_PAYER_REQUIRED\x20(abort\x2013):\x20a\x20\x22\x22-namedOperator\x20forward\x20is\x20payer-only\x20—\x20advance\x20as\x20the\x20'+'order\x20payer\x20on\x20the\x20order-bound\x20entry;\x20a\x20taskless\x20Progress\x20fails\x20closed\x20on\x20any\x20entry\x20(abort\x2014)','⚠\x20ROUTING\x20FACT:\x20Forward.namedOperator=\x22\x22\x20(empty)\x20→\x20order-bound\x20entry\x20only\x20(order.progress,\x20or\x20'+'progress.operate\x20which\x20auto-routes\x20when\x20the\x20Progress\x20task\x20is\x20an\x20Order).\x20Non-empty\x20namedOperator\x20or\x20'+'permissionIndex-only\x20→\x20either\x20entry\x20(identical\x20checks).\x20A\x20standalone\x20Progress\x20cannot\x20advance\x20\x22\x22\x20'+'forwards\x20at\x20all\x20(abort\x2014\x20—\x20E_ORDER_TASK_REQUIRED,\x20fail-closed:\x20no\x20task\x20to\x20bind;\x20a\x20task-bound\x20'+'Progress\x20driven\x20off\x20the\x20order\x20path\x20by\x20a\x20non-payer\x20aborts\x2013\x20(E_ORDER_PAYER_REQUIRED)\x20instead).\x20See\x20file\x20header\x20ROUTING\x20FACTS.'],'recommended_templates':['T-PR-04']}];export const PROGRESS_LEDGER_VERSION='1.0.0';export function getScenesByPhase(a){return PROGRESS_SCENES['filter'](b=>b['phases']['includes'](a));}export function findSceneById(a){return PROGRESS_SCENES['find'](b=>b['id']===a);}export function getScenesByIndustry(a){return PROGRESS_SCENES['filter'](b=>b['industry']['includes'](a)||b['industry']['includes']('universal'));}export function getBuiltinPermissionByIndex(a){return PROGRESS_PERMISSIONS['find'](b=>b['index']===a);}export function isProgressBuiltinPermission(a){return getBuiltinPermissionByIndex(a)!==undefined;}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[['adminunhold','progress_unhold'],['admin\x20unhold','progress_unhold'],['force\x20unhold','progress_unhold'],['unhold','progress_unhold'],['release\x20hold','progress_unhold'],['owner_receive','progress_owner_receive'],['owner\x20receive','progress_owner_receive'],['unwrap','progress_owner_receive'],['context_repository','progress_context_repository'],['context\x20repository','progress_context_repository'],['repository\x20binding','progress_context_repository'],['named_operator','progress_named_operator'],['named\x20operator','progress_named_operator'],['namedoperator','progress_named_operator'],['task\x20set','progress_task_submit'],['submit\x20task','progress_task_submit'],['next','progress_completed'],['advance','progress_completed'],['complete','progress_completed']];for(const [d,e]of c){if(b['includes'](d)){const f=findSceneById(e);if(f)return f;}}return undefined;}export function getAllBuiltinPermissions(){return[...PROGRESS_PERMISSIONS];}export function getProgressScenesCount(){return PROGRESS_SCENES['length'];}export function validateNamedOperatorAddressList(b){const c=[];b['length']>MAX_NAMED_OPERATOR_ADDRESS_COUNT&&c['push']('Named\x20operator\x20address\x20count\x20'+b['length']+'\x20exceeds\x20MAX_NAMED_OPERATOR_ADDRESS_COUNT\x20'+MAX_NAMED_OPERATOR_ADDRESS_COUNT);const d=new Set();for(const e of b){if(d['has'](e)){c['push']('Duplicate\x20address\x20in\x20list:\x20'+e+'\x20(Move\x20will\x20dedupe\x20silently)');break;}d['add'](e);}return{'ok':c['length']===0x0,'violations':c};}export function validateNamedOperatorCount(a){if(a>=MAX_NAMED_OPERATOR_COUNT)return{'ok':![],'violation':'Named\x20operator\x20count\x20'+a+'\x20would\x20exceed\x20MAX_NAMED_OPERATOR_COUNT\x20'+MAX_NAMED_OPERATOR_COUNT};return{'ok':!![]};}export function validateContextRepositoryCount(a,b){const c=a+b;if(c>MAX_CONTEXT_REPOSITORY_COUNT)return{'ok':![],'violation':'Context\x20repository\x20count\x20'+c+'\x20would\x20exceed\x20MAX_CONTEXT_REPOSITORY_COUNT\x20'+MAX_CONTEXT_REPOSITORY_COUNT};return{'ok':!![]};}export const PROGRESS_CROSS_OBJECT_REFS=[{'object':'Machine','phase':'universal','relationship':'Progress.machine\x20(immutable\x20bind,\x20E_MACHINE_NOT_MATCH\x20on\x20every\x20op)'},{'object':'Order','phase':'forward_advance','relationship':'Progress.task\x20=\x20Order.address\x20(1:1,\x20set\x20via\x20task\x20submission\x20or\x20the\x20buy\x20flow)'},{'object':'Order','phase':'forward_advance','relationship':'order-holder\x20paths\x20(advance\x20/\x20hold):\x20the\x20order\x20owner-or-agent\x20permission\x20check\x20gates\x20Forward\x20advance'},{'object':'Permission','phase':'universal','relationship':'Machine.permission\x20is\x20borrowed\x20for\x20ALL\x20220-225\x20assertions'},{'object':'Repository','phase':'context_binding','relationship':'context_repositories:\x20vector<address>\x20(≤\x2030),\x20bound\x20via\x20an\x20affiliation\x20transaction'},{'object':'Service','phase':'creation','relationship':'the\x20buy\x20flow\x20creates\x20the\x20Progress\x20internally\x20(bypasses\x20220\x20assertion\x20—\x20package-internal\x20entry)'},{'object':'Passport','phase':'forward_advance','relationship':'Forward.guard\x20(Some)\x20requires\x20Passport\x20+\x20passing\x20the\x20passport\x20verification'},{'object':'Passport','phase':'unhold_state','relationship':'passport-based\x20unhold:\x20224\x20check\x20via\x20passport\x20(fallback\x20when\x20the\x20sender\x27s\x20direct\x20224\x20permission\x20check\x20fails)'},{'object':'Payment','phase':'owner_receive','relationship':'owner_receive\x20unwraps\x20CoinWrapper<T>\x20via\x20the\x20payment\x27s\x20type-checked\x20unwrap'},{'object':'Allocation','phase':'completed','relationship':'Terminal\x20node\x20triggers\x20Allocation\x20alloc\x20(e.g.\x20\x27completed\x27,\x20\x27enforced\x27,\x20\x27return_approved\x27)'}];
@@ -1 +1 @@
1
- import{describe,it,expect,beforeAll,afterAll}from'vitest';import*as a316a from'node:fs';import*as a316b from'node:os';import*as a316c from'node:path';import{projectionUpsert,projectionServe,projectionStats,__projectionSetWriteClock}from'./projection.js';const SCRATCH_DB=a316c['join'](a316b['tmpdir'](),'wowok-projection-spec-'+process['pid']+'-'+Date['now']()+'.db'),PREV_DB=process['env']['WOWOK_PROJECTION_DB'],PREV_TTL=process['env']['WOWOK_PROJECTION_TTL_MS'];beforeAll(()=>{process['env']['WOWOK_PROJECTION_DB']=SCRATCH_DB,process['env']['WOWOK_PROJECTION_TTL_MS']='120000',__projectionSetWriteClock(0x0);}),afterAll(()=>{if(PREV_DB===undefined)delete process['env']['WOWOK_PROJECTION_DB'];else process['env']['WOWOK_PROJECTION_DB']=PREV_DB;if(PREV_TTL===undefined)delete process['env']['WOWOK_PROJECTION_TTL_MS'];else process['env']['WOWOK_PROJECTION_TTL_MS']=PREV_TTL;__projectionSetWriteClock(undefined);try{a316a['rmSync'](SCRATCH_DB,{'force':!![]}),a316a['rmSync'](SCRATCH_DB+'-wal',{'force':!![]}),a316a['rmSync'](SCRATCH_DB+'-shm',{'force':!![]});}catch{}});function svcRow(a,b={}){const {payloadJson:c,...d}=b;return{'object_id':a,'payload':JSON['stringify']({'object':a,...c??{}}),...d};}describe('projection\x20cache\x20(K5\x20doc\x2017\x20B-tier)',()=>{it('returns\x20undefined\x20without\x20a\x20watermark\x20(never\x20fabricates\x20coverage)',()=>{const a=projectionServe('chain-empty-proj','Service',{},0xc8);expect(a)['toBeUndefined'](),expect(projectionStats('chain-empty-proj')['every'](b=>b['rows']===0x0))['toBe'](!![]);}),it('serves\x20a\x20fresh\x20projection\x20with\x20SQL\x20filters\x20and\x20pre-filter\x20totals',()=>{const a='chain-proj-serve',b=[svcRow('0xa1',{'name':'Alpha\x20Music','location':'Shanghai,\x20CN','coin_type':'0x2::wow::WOW','published':0x1,'paused':0x0,'payloadJson':{'object':'0xa1','name':'Alpha\x20Music','location':'Shanghai,\x20CN'}}),svcRow('0xa2',{'name':'Beta\x20Design','location':'Beijing,\x20CN','coin_type':'0x2::wow::WOW','published':0x1,'paused':0x0,'payloadJson':{'object':'0xa2','name':'Beta\x20Design','location':'Beijing,\x20CN'}}),svcRow('0xa3',{'name':'Gamma\x20Food','location':'Shanghai,\x20CN','coin_type':'0x2::sui::SUI','published':0x1,'paused':0x0,'payloadJson':{'object':'0xa3','name':'Gamma\x20Food','location':'Shanghai,\x20CN'}})];projectionUpsert(a,'Service',b,{'hasMore':![],'maxObjects':0xc8});const c=projectionServe(a,'Service',{},0xc8);expect(c)['toBeDefined'](),expect(c['items'])['toHaveLength'](0x3),expect(c['meta']['total_rows'])['toBe'](0x3),expect(c['meta']['watermark']['has_more'])['toBe'](0x0),expect(c['items']['map'](h=>h['object'])['sort']())['toEqual'](['0xa1','0xa2','0xa3']);const d=projectionServe(a,'Service',{'coin_type':'0x2::wow::WOW'},0xc8);expect(d['items']['map'](h=>h['object'])['sort']())['toEqual'](['0xa1','0xa2']),expect(d['meta']['total_rows'])['toBe'](0x3);const e=projectionServe(a,'Service',{'name_contains':'beta'},0xc8);expect(e['items']['map'](h=>h['object']))['toEqual'](['0xa2']);const f=projectionServe(a,'Service',{'location_any':['shanghai']},0xc8);expect(f['items']['map'](h=>h['object'])['sort']())['toEqual'](['0xa1','0xa3']);const g=projectionServe(a,'Service',{'location_any':['paris']},0xc8);expect(g['items'])['toHaveLength'](0x0),expect(g['meta']['total_rows'])['toBe'](0x3),expect(projectionStats(a)['find'](h=>h['kind']==='Service')?.['rows'])['toBe'](0x3),expect(projectionStats(a)['find'](h=>h['kind']==='Service')?.['refreshed_at'])['toBeGreaterThan'](0x0);}),it('upserts\x20cumulatively:\x20rows\x20update\x20in\x20place\x20and\x20accumulate\x20across\x20windows',()=>{const a='chain-proj-cumulative';projectionUpsert(a,'Demand',[{'object_id':'0xd1','payload':JSON['stringify']({'object':'0xd1','description':'v1'})}],{'hasMore':!![],'maxObjects':0xc8}),projectionUpsert(a,'Demand',[{'object_id':'0xd1','payload':JSON['stringify']({'object':'0xd1','description':'v2'})},{'object_id':'0xd2','payload':JSON['stringify']({'object':'0xd2','description':'new'})}],{'hasMore':![],'maxObjects':0xc8});const b=projectionServe(a,'Demand',{},0xc8);expect(b['items'])['toHaveLength'](0x2);const c=b['items']['find'](d=>d['object']==='0xd1');expect(c?.['description'])['toBe']('v2'),expect(b['meta']['watermark']['has_more'])['toBe'](0x0);}),it('declines\x20to\x20serve\x20when\x20stale\x20by\x20TTL',async()=>{const a='chain-proj-stale-ttl',b=process['env']['WOWOK_PROJECTION_TTL_MS'];process['env']['WOWOK_PROJECTION_TTL_MS']='60000';try{projectionUpsert(a,'Service',[svcRow('0xs1')],{'hasMore':![],'maxObjects':0xc8}),expect(projectionServe(a,'Service',{},0xc8))['toBeDefined'](),process['env']['WOWOK_PROJECTION_TTL_MS']='20',await new Promise(c=>setTimeout(c,0x3c)),expect(projectionServe(a,'Service',{},0xc8))['toBeUndefined']();}finally{process['env']['WOWOK_PROJECTION_TTL_MS']=b;}}),it('declines\x20to\x20serve\x20when\x20a\x20local\x20on-chain\x20write\x20postdates\x20the\x20watermark',()=>{const a='chain-proj-stale-write';projectionUpsert(a,'Service',[svcRow('0xs2')],{'hasMore':![],'maxObjects':0xc8}),__projectionSetWriteClock(Date['now']()+0x1);try{expect(projectionServe(a,'Service',{},0xc8))['toBeUndefined']();}finally{__projectionSetWriteClock(0x0);}}),it('filters\x20arb\x20payloads\x20post-SQL\x20for\x20parity\x20with\x20the\x20legacy\x20post-hydration\x20filter',()=>{const a='chain-proj-arb';projectionUpsert(a,'Arb',[{'object_id':'0xb1','payload':JSON['stringify']({'object':'0xb1','arbitration':'0xarb1','order':'0xo1','status':0x2})},{'object_id':'0xb2','payload':JSON['stringify']({'object':'0xb2','arbitration':'0xarb1','order':'0xo2','status':0x5})},{'object_id':'0xb3','payload':JSON['stringify']({'object':'0xb3','arbitration':'0xarb2','order':'0xo1','status':0x2})}],{'hasMore':![],'maxObjects':0xc8});const b=projectionServe(a,'Arb',{'arbitration':'0xarb1'},0xc8);expect(b['items']['map'](f=>f['object'])['sort']())['toEqual'](['0xb1','0xb2']),expect(b['meta']['total_rows'])['toBe'](0x3);const c=projectionServe(a,'Arb',{'order':'0xo1'},0xc8);expect(c['items']['map'](f=>f['object'])['sort']())['toEqual'](['0xb1','0xb3']);const d=projectionServe(a,'Arb',{'status':[0x5]},0xc8);expect(d['items']['map'](f=>f['object']))['toEqual'](['0xb2']);const e=projectionServe(a,'Arb',{'arbitration':'0xarb2','status':[0x5]},0xc8);expect(e['items'])['toHaveLength'](0x0);}),it('respects\x20the\x20limit\x20on\x20the\x20SQL\x20path',()=>{const a='chain-proj-limit';projectionUpsert(a,'Demand',Array['from']({'length':0x5},(c,d)=>({'object_id':'0xL'+d,'payload':JSON['stringify']({'object':'0xL'+d})})),{'hasMore':![],'maxObjects':0xc8});const b=projectionServe(a,'Demand',{},0x3);expect(b['items'])['toHaveLength'](0x3),expect(b['meta']['total_rows'])['toBe'](0x5);});});
1
+ import{describe,it,expect,beforeAll,afterAll}from'vitest';import*as a320a from'node:fs';import*as a320b from'node:os';import*as a320c from'node:path';import{projectionUpsert,projectionServe,projectionStats,__projectionSetWriteClock}from'./projection.js';const SCRATCH_DB=a320c['join'](a320b['tmpdir'](),'wowok-projection-spec-'+process['pid']+'-'+Date['now']()+'.db'),PREV_DB=process['env']['WOWOK_PROJECTION_DB'],PREV_TTL=process['env']['WOWOK_PROJECTION_TTL_MS'];beforeAll(()=>{process['env']['WOWOK_PROJECTION_DB']=SCRATCH_DB,process['env']['WOWOK_PROJECTION_TTL_MS']='120000',__projectionSetWriteClock(0x0);}),afterAll(()=>{if(PREV_DB===undefined)delete process['env']['WOWOK_PROJECTION_DB'];else process['env']['WOWOK_PROJECTION_DB']=PREV_DB;if(PREV_TTL===undefined)delete process['env']['WOWOK_PROJECTION_TTL_MS'];else process['env']['WOWOK_PROJECTION_TTL_MS']=PREV_TTL;__projectionSetWriteClock(undefined);try{a320a['rmSync'](SCRATCH_DB,{'force':!![]}),a320a['rmSync'](SCRATCH_DB+'-wal',{'force':!![]}),a320a['rmSync'](SCRATCH_DB+'-shm',{'force':!![]});}catch{}});function svcRow(a,b={}){const {payloadJson:c,...d}=b;return{'object_id':a,'payload':JSON['stringify']({'object':a,...c??{}}),...d};}describe('projection\x20cache\x20(K5\x20doc\x2017\x20B-tier)',()=>{it('returns\x20undefined\x20without\x20a\x20watermark\x20(never\x20fabricates\x20coverage)',()=>{const a=projectionServe('chain-empty-proj','Service',{},0xc8);expect(a)['toBeUndefined'](),expect(projectionStats('chain-empty-proj')['every'](b=>b['rows']===0x0))['toBe'](!![]);}),it('serves\x20a\x20fresh\x20projection\x20with\x20SQL\x20filters\x20and\x20pre-filter\x20totals',()=>{const a='chain-proj-serve',b=[svcRow('0xa1',{'name':'Alpha\x20Music','location':'Shanghai,\x20CN','coin_type':'0x2::wow::WOW','published':0x1,'paused':0x0,'payloadJson':{'object':'0xa1','name':'Alpha\x20Music','location':'Shanghai,\x20CN'}}),svcRow('0xa2',{'name':'Beta\x20Design','location':'Beijing,\x20CN','coin_type':'0x2::wow::WOW','published':0x1,'paused':0x0,'payloadJson':{'object':'0xa2','name':'Beta\x20Design','location':'Beijing,\x20CN'}}),svcRow('0xa3',{'name':'Gamma\x20Food','location':'Shanghai,\x20CN','coin_type':'0x2::sui::SUI','published':0x1,'paused':0x0,'payloadJson':{'object':'0xa3','name':'Gamma\x20Food','location':'Shanghai,\x20CN'}})];projectionUpsert(a,'Service',b,{'hasMore':![],'maxObjects':0xc8});const c=projectionServe(a,'Service',{},0xc8);expect(c)['toBeDefined'](),expect(c['items'])['toHaveLength'](0x3),expect(c['meta']['total_rows'])['toBe'](0x3),expect(c['meta']['watermark']['has_more'])['toBe'](0x0),expect(c['items']['map'](h=>h['object'])['sort']())['toEqual'](['0xa1','0xa2','0xa3']);const d=projectionServe(a,'Service',{'coin_type':'0x2::wow::WOW'},0xc8);expect(d['items']['map'](h=>h['object'])['sort']())['toEqual'](['0xa1','0xa2']),expect(d['meta']['total_rows'])['toBe'](0x3);const e=projectionServe(a,'Service',{'name_contains':'beta'},0xc8);expect(e['items']['map'](h=>h['object']))['toEqual'](['0xa2']);const f=projectionServe(a,'Service',{'location_any':['shanghai']},0xc8);expect(f['items']['map'](h=>h['object'])['sort']())['toEqual'](['0xa1','0xa3']);const g=projectionServe(a,'Service',{'location_any':['paris']},0xc8);expect(g['items'])['toHaveLength'](0x0),expect(g['meta']['total_rows'])['toBe'](0x3),expect(projectionStats(a)['find'](h=>h['kind']==='Service')?.['rows'])['toBe'](0x3),expect(projectionStats(a)['find'](h=>h['kind']==='Service')?.['refreshed_at'])['toBeGreaterThan'](0x0);}),it('upserts\x20cumulatively:\x20rows\x20update\x20in\x20place\x20and\x20accumulate\x20across\x20windows',()=>{const a='chain-proj-cumulative';projectionUpsert(a,'Demand',[{'object_id':'0xd1','payload':JSON['stringify']({'object':'0xd1','description':'v1'})}],{'hasMore':!![],'maxObjects':0xc8}),projectionUpsert(a,'Demand',[{'object_id':'0xd1','payload':JSON['stringify']({'object':'0xd1','description':'v2'})},{'object_id':'0xd2','payload':JSON['stringify']({'object':'0xd2','description':'new'})}],{'hasMore':![],'maxObjects':0xc8});const b=projectionServe(a,'Demand',{},0xc8);expect(b['items'])['toHaveLength'](0x2);const c=b['items']['find'](d=>d['object']==='0xd1');expect(c?.['description'])['toBe']('v2'),expect(b['meta']['watermark']['has_more'])['toBe'](0x0);}),it('declines\x20to\x20serve\x20when\x20stale\x20by\x20TTL',async()=>{const a='chain-proj-stale-ttl',b=process['env']['WOWOK_PROJECTION_TTL_MS'];process['env']['WOWOK_PROJECTION_TTL_MS']='60000';try{projectionUpsert(a,'Service',[svcRow('0xs1')],{'hasMore':![],'maxObjects':0xc8}),expect(projectionServe(a,'Service',{},0xc8))['toBeDefined'](),process['env']['WOWOK_PROJECTION_TTL_MS']='20',await new Promise(c=>setTimeout(c,0x3c)),expect(projectionServe(a,'Service',{},0xc8))['toBeUndefined']();}finally{process['env']['WOWOK_PROJECTION_TTL_MS']=b;}}),it('declines\x20to\x20serve\x20when\x20a\x20local\x20on-chain\x20write\x20postdates\x20the\x20watermark',()=>{const a='chain-proj-stale-write';projectionUpsert(a,'Service',[svcRow('0xs2')],{'hasMore':![],'maxObjects':0xc8}),__projectionSetWriteClock(Date['now']()+0x1);try{expect(projectionServe(a,'Service',{},0xc8))['toBeUndefined']();}finally{__projectionSetWriteClock(0x0);}}),it('filters\x20arb\x20payloads\x20post-SQL\x20for\x20parity\x20with\x20the\x20legacy\x20post-hydration\x20filter',()=>{const a='chain-proj-arb';projectionUpsert(a,'Arb',[{'object_id':'0xb1','payload':JSON['stringify']({'object':'0xb1','arbitration':'0xarb1','order':'0xo1','status':0x2})},{'object_id':'0xb2','payload':JSON['stringify']({'object':'0xb2','arbitration':'0xarb1','order':'0xo2','status':0x5})},{'object_id':'0xb3','payload':JSON['stringify']({'object':'0xb3','arbitration':'0xarb2','order':'0xo1','status':0x2})}],{'hasMore':![],'maxObjects':0xc8});const b=projectionServe(a,'Arb',{'arbitration':'0xarb1'},0xc8);expect(b['items']['map'](f=>f['object'])['sort']())['toEqual'](['0xb1','0xb2']),expect(b['meta']['total_rows'])['toBe'](0x3);const c=projectionServe(a,'Arb',{'order':'0xo1'},0xc8);expect(c['items']['map'](f=>f['object'])['sort']())['toEqual'](['0xb1','0xb3']);const d=projectionServe(a,'Arb',{'status':[0x5]},0xc8);expect(d['items']['map'](f=>f['object']))['toEqual'](['0xb2']);const e=projectionServe(a,'Arb',{'arbitration':'0xarb2','status':[0x5]},0xc8);expect(e['items'])['toHaveLength'](0x0);}),it('respects\x20the\x20limit\x20on\x20the\x20SQL\x20path',()=>{const a='chain-proj-limit';projectionUpsert(a,'Demand',Array['from']({'length':0x5},(c,d)=>({'object_id':'0xL'+d,'payload':JSON['stringify']({'object':'0xL'+d})})),{'hasMore':![],'maxObjects':0xc8});const b=projectionServe(a,'Demand',{},0x3);expect(b['items'])['toHaveLength'](0x3),expect(b['meta']['total_rows'])['toBe'](0x5);});});
@@ -0,0 +1,20 @@
1
+ export declare function findRegistryDeadLegs(root: unknown): string[];
2
+ export interface ClosureInput {
3
+ refs: Iterable<string>;
4
+ resolvedLowerKeys: Iterable<string>;
5
+ readError?: string;
6
+ unreadableRefs?: Iterable<string>;
7
+ softRefs?: Iterable<string>;
8
+ }
9
+ export declare function closureFindings(input: ClosureInput, opts?: {
10
+ strictAudit?: boolean;
11
+ }): {
12
+ blockers: string[];
13
+ disclosures: string[];
14
+ outage?: string;
15
+ };
16
+ export declare function nettingFindings(railGuardObjects: unknown[]): string[];
17
+ export declare function opsReadyFindings(arbRefs: string[], perm?: {
18
+ entity_count?: number;
19
+ permission_indexes?: number[];
20
+ }): string[];
@@ -0,0 +1 @@
1
+ import{CHAIN_QUERY_REGISTRY,getChainQuery}from'./chain-query-registry.js';function children(a){if(Array['isArray'](a['nodes']))return a['nodes'];if(a['node'])return[a['node']];return[];}function walk(a,b){if(!a||typeof a!=='object')return;const d=a;b(d);for(const e of children(d))walk(e,b);}function isPseudoQuery(a){const b=a['toLowerCase']();return b['startsWith']('context')||b['includes']('signer');}const REGISTRY_HEADS=new Set(CHAIN_QUERY_REGISTRY['map'](a=>a['name']['split'](/[. ]/,0x1)[0x0]));export function findRegistryDeadLegs(a){const b=new Set();return walk(a,c=>{const d=c?.['query'];if(typeof d!=='string'||d['trim']()===''||isPseudoQuery(d))return;if(getChainQuery(d))return;const e=d['split'](/[. ]/,0x1)[0x0];if(REGISTRY_HEADS['has'](e))b['add'](d);}),[...b];}export function closureFindings(a,b){const c=[],d=[],e=new Set();for(const i of a['resolvedLowerKeys'])e['add'](i['toLowerCase']());const f=new Set();for(const j of a['unreadableRefs']??[])f['add'](j['toLowerCase']());if(a['readError']!==undefined)return{'blockers':[],'disclosures':[],'outage':b?.['strictAudit']?'PG-CLOSURE-01\x20(strict\x20audit\x20report):\x20could\x20not\x20query\x20the\x20referenced\x20guard\x20object(s)\x20'+('('+a['readError']+')\x20—\x20the\x20outage\x20PROVES\x20NOTHING\x20about\x20chain\x20state;\x20it\x20is\x20reported\x20for\x20YOUR\x20')+'decision,\x20and\x20whether\x20to\x20publish\x20remains\x20yours.\x20If\x20you\x20want\x20this\x20audit\x20to\x20pass,\x20retry\x20when\x20the\x20'+'network\x20is\x20stable.\x20If\x20you\x20publish\x20anyway,\x20the\x20SAME\x20finding\x20rides\x20the\x20formal\x20publish\x20as\x20a\x20warning\x20'+'and\x20you\x20own\x20the\x20unverified-rail\x20risk:\x20a\x20guard\x20ref\x20that\x20is\x20actually\x20dangling\x20would\x20be\x20frozen\x20into\x20'+'the\x20immutable\x20machine\x20(F-10;\x20nodes/pairs/forwards\x20immutable\x20after\x20publish)':'PG-CLOSURE-01:\x20could\x20not\x20query\x20the\x20referenced\x20guard\x20object(s)\x20('+a['readError']+')\x20—\x20'+'reference\x20closure\x20UNVERIFIABLE\x20from\x20this\x20call.\x20A\x20transient\x20outage\x20proves\x20nothing\x20about\x20chain\x20state,\x20so\x20'+'this\x20does\x20NOT\x20block\x20the\x20publish\x20by\x20itself\x20—\x20but\x20publishing\x20WITHOUT\x20verification\x20risks\x20freezing\x20a\x20'+'dangling\x20guard\x20ref\x20into\x20the\x20immutable\x20machine\x20(F-10;\x20nodes/pairs/forwards\x20are\x20immutable\x20after\x20publish).\x20'+'Re-run\x20the\x20SAME\x20publish\x20with\x20env\x20dry_run:true\x20for\x20the\x20strict\x20pre-publish\x20audit\x20(an\x20outage\x20blocks\x20there),\x20'+'or\x20retry\x20when\x20the\x20network\x20is\x20stable'};const g=[];for(const l of a['refs']){const m=l['trim']();if(m==='')continue;const n=m['toLowerCase']();if(e['has'](n))continue;if(f['has'](n)){d['push']('PG-CLOSURE-01:\x20guard\x20\x22'+m+'\x22\x20fetched\x20but\x20NOT\x20readable\x20as\x20a\x20Guard\x20envelope\x20(tooling/version\x20skew)\x20—\x20'+'its\x20semantics\x20are\x20UNVERIFIED.\x20Verify\x20via\x20analyze_guard_semantics\x20before\x20publish;\x20the\x20binding\x20freezes\x20at\x20publish');continue;}g['push'](m);}g['length']>0x0&&c['push']('PG-CLOSURE-01:\x20guard\x20reference(s)\x20'+g['map'](o=>'\x22'+o+'\x22')['join'](',\x20')+'\x20did\x20NOT\x20resolve\x20to\x20a\x20Guard\x20'+'on-chain\x20—\x20the\x20publish\x20would\x20freeze\x20dangling\x20reference(s)\x20into\x20an\x20immutable\x20object:\x20the\x20rail\x20each\x20one\x20carries\x20'+'is\x20unverifiable\x20at\x20best\x20and\x20permanently\x20dead\x20at\x20worst\x20(F-10).\x20Create/repair\x20the\x20guard\x20FIRST,\x20then\x20re-publish\x20'+'(immutable\x20after\x20publish:\x20IMMUT-001/IMMUT-002)');const h=[...a['softRefs']??[]]['filter'](o=>o['trim']()!=='');return h['length']>0x0&&d['push']('PG-CLOSURE-01:\x20name-referenced\x20guard(s)\x20'+h['map'](o=>'\x22'+o+'\x22')['join'](',\x20')+'\x20did\x20not\x20resolve\x20'+'through\x20the\x20id-based\x20read\x20channel\x20—\x20absence\x20is\x20NOT\x20proven\x20for\x20name\x20refs.\x20Confirm\x20each\x20resolves\x20to\x20a\x20live\x20'+'Guard\x20before\x20publish;\x20a\x20dangling\x20ref\x20freezes\x20into\x20an\x20immutable\x20object\x20(IMMUT-001/IMMUT-002)'),{'blockers':c,'disclosures':d};}function readsArbitration(a){let b=![];return walk(a,c=>{if(typeof c?.['query']==='string'&&/^(arb|arbitration)\b/i['test'](c['query']))b=!![];}),b;}export function nettingFindings(a){const b=[];for(const c of a){const d=c;if(d?.['type']!=='Guard')continue;const e=d['data']??d;if(readsArbitration(e?.['root'])){const f=typeof d['object']==='string'&&d['object']!==''?d['object']:'#'+(b['length']+0x1);b['push'](f);}}if(b['length']===0x0)return[];return['PG-NETTING-01:\x20allocator\x20rail\x20guard(s)\x20'+b['map'](h=>'\x22'+h+'\x22')['join'](',\x20')+'\x20read\x20the\x20ARBITRATION\x20namespace\x20—\x20'+'this\x20order\x27s\x20rail\x20set\x20carries\x20an\x20arbitration/compensation\x20rail\x20ALONGSIDE\x20its\x20principal\x20rails,\x20so\x20ONE\x20order\x20can\x20'+'release\x20compensation\x20AND\x20principal\x20independently\x20(dual-payout\x20window;\x20gf32\x20F-47\x20mainnet:\x201.00\x20pledge\x20paid\x200.30\x20'+'compensation\x20+\x201.00\x20refund).\x20The\x20on-chain\x20dual-payout\x20flag\x20(claimed_by)\x20only\x20records\x20that\x20a\x20payout\x20HAPPENED\x20and\x20the\x20'+'MCP\x20acknowledge_dual_payout\x20gate\x20only\x20sees\x20ALREADY-released\x20funds\x20—\x20the\x20netting\x20decision\x20(pay\x20both\x20/\x20net\x20/\x20pay\x20one)\x20'+'is\x20a\x20MANUAL\x20business\x20call\x20at\x20dispute\x20time.\x20Disclosed\x20by\x20design\x20(not\x20a\x20gate);\x20document\x20the\x20intended\x20netting\x20policy\x20'+'in\x20the\x20service\x20terms\x20so\x20buyers\x20and\x20arbitrators\x20share\x20the\x20same\x20expectation'];}export function opsReadyFindings(a,b){if(a['length']===0x0)return[];const c=b?.['entity_count']!==undefined,d=c&&b['entity_count']===0x0,e=b?.['permission_indexes']?.['filter'](f=>f>=0x3e8)??[];return['PG-OPS-READY-01:\x20this\x20publish\x20binds\x20arbitration\x20venue(s)\x20'+a['map'](f=>'\x22'+f+'\x22')['join'](',\x20')+'\x20—\x20'+'day-1\x20operations\x20are\x20decided\x20by\x20THAT\x20venue\x27s\x20Permission\x20entity\x20table,\x20not\x20by\x20the\x20merchant\x27s\x20own\x20permission\x20face:\x20'+'who\x20can\x20vote/conclude\x20(permission\x20358\x20on\x20the\x20arb\x20Permission),\x20and\x20whether\x20the\x20MERCHANT\x20can\x20pause\x20the\x20venue\x20'+'(permission\x20356\x20—\x20gf32\x20F-52:\x20the\x20pause\x20required\x20the\x20ARBITRATOR\x27s\x20signature,\x20the\x20merchant\x20could\x20not\x20pause\x20its\x20own\x20'+'store)\x20are\x20whatever\x20the\x20arb\x20Permission\x20granted\x20on\x20day\x201.\x20'+(c?d?'The\x20arb\x20Permission\x20entity\x20table\x20is\x20EMPTY\x20(entity_count\x20=\x200)\x20—\x20NO\x20ONE\x20can\x20vote,\x20conclude\x20or\x20pause\x20until\x20'+'entities\x20are\x20granted;\x20configure\x20the\x20venue\x27s\x20Permission\x20BEFORE\x20the\x20first\x20dispute\x20(F-52\x20family).':'Current\x20face:\x20entity_count\x20=\x20'+b['entity_count']+(e['length']>0x0?',\x20custom\x20grants\x20on\x20indexes\x20['+e['join'](',\x20')+']':'')+'.\x20Verify\x20the\x20grants\x20cover\x20voters,\x20the\x20concluding\x20role\x20and\x20the\x20pause\x20role\x20you\x20intend.':'The\x20arb\x20Permission\x20face\x20was\x20not\x20readable\x20in\x20this\x20call\x20—\x20verify\x20its\x20entity\x20table\x20(onchain_table\x20on\x20the\x20'+'arb\x20Permission\x27s\x20perm\x20entries)\x20BEFORE\x20the\x20first\x20dispute.')+'\x20Disclosed\x20by\x20design\x20(not\x20a\x20gate);\x20the\x20venue\x20config\x20is\x20mutable,\x20but\x20disputes\x20filed\x20BEFORE\x20the\x20fix\x20run\x20on\x20day-1\x20rules'];}
@@ -0,0 +1,25 @@
1
+ import { type PublishFace, type PublishGateContractEntry } from "./publish-surface-contract.js";
2
+ export declare const PUBLISH_READINESS_SCHEMA = "wowok.publish-readiness/1";
3
+ export interface PublishReadinessFinding {
4
+ gate: string;
5
+ severity: "critical" | "warning";
6
+ message: string;
7
+ }
8
+ export interface PublishReadinessVerdict {
9
+ schema: typeof PUBLISH_READINESS_SCHEMA;
10
+ contract_version: string;
11
+ face: PublishFace;
12
+ outcome: "blocked" | "pass_with_advisories" | "pass";
13
+ gates_evaluated: string[];
14
+ critical: PublishReadinessFinding[];
15
+ warnings: PublishReadinessFinding[];
16
+ authority: string;
17
+ generated_at: number;
18
+ }
19
+ export declare function contractIdForGate(gate: string, registry?: PublishGateContractEntry[]): string;
20
+ export declare function buildPublishReadinessVerdict(face: PublishFace, gateOutcomes: Array<{
21
+ gate: string;
22
+ critical: string[];
23
+ warnings: string[];
24
+ }>, declaredGates?: string[]): PublishReadinessVerdict;
25
+ export declare function summarizeVerdict(v: PublishReadinessVerdict): string;
@@ -0,0 +1 @@
1
+ import{PUBLISH_SURFACE_CONTRACT,PUBLISH_SURFACE_CONTRACT_VERSION}from'./publish-surface-contract.js';export const PUBLISH_READINESS_SCHEMA='wowok.publish-readiness/1';export function contractIdForGate(a,b=PUBLISH_SURFACE_CONTRACT){const c=b['find'](d=>d['gate']===a);return c?c['id']:'adhoc';}export function buildPublishReadinessVerdict(a,b,d){const e=[],f=[];for(const h of b){const i=contractIdForGate(h['gate']);for(const j of h['critical'])e['push']({'gate':i,'severity':'critical','message':j});for(const k of h['warnings'])f['push']({'gate':i,'severity':'warning','message':k});}const g=e['length']>0x0?'blocked':f['length']>0x0?'pass_with_advisories':'pass';return{'schema':PUBLISH_READINESS_SCHEMA,'contract_version':PUBLISH_SURFACE_CONTRACT_VERSION,'face':a,'outcome':g,'gates_evaluated':d??b['map'](l=>contractIdForGate(l['gate'])),'critical':e,'warnings':f,'authority':'compile\x20blockers\x20+\x20verifier\x20findings\x20+\x20pre-publish\x20gates\x20(ledger\x20rule\x208\x20authoritative\x20blocking\x20surface)','generated_at':Date['now']()};}export function summarizeVerdict(a){return'publish_readiness['+a['face']+']:\x20'+a['outcome']+'\x20('+a['gates_evaluated']['length']+'\x20gates,\x20'+(a['critical']['length']+'\x20critical,\x20'+a['warnings']['length']+'\x20advisories)\x20contract\x20v'+a['contract_version']);}
@@ -0,0 +1,16 @@
1
+ export type PublishFace = "machine_publish" | "service_publish" | "guard_binding";
2
+ export type GateEnforcement = "always" | "strict_audit_only" | "advisory";
3
+ export interface PublishGateContractEntry {
4
+ id: string;
5
+ gate: string;
6
+ faces: PublishFace[];
7
+ enforcement: GateEnforcement;
8
+ defect_class: string;
9
+ origin: string;
10
+ wired_in: "wrap" | "compile" | "audit-rules" | "onchain";
11
+ }
12
+ export declare const PUBLISH_SURFACE_CONTRACT_VERSION = "1.3.0";
13
+ export declare const PUBLISH_SURFACE_CONTRACT: PublishGateContractEntry[];
14
+ export declare const PUBLISH_SURFACE_EXEMPT_GATES: Record<string, string>;
15
+ export declare function gatesForFace(face: PublishFace): PublishGateContractEntry[];
16
+ export declare function blockingGatesForFace(face: PublishFace): PublishGateContractEntry[];