@wowok/agent-mcp 2.7.10 → 3.0.1

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 (334) hide show
  1. package/dist/communication/evidence.d.ts +6 -0
  2. package/dist/communication/evidence.js +1 -0
  3. package/dist/evaluation/acceptance.d.ts +24 -0
  4. package/dist/evaluation/acceptance.js +1 -0
  5. package/dist/evaluation/builtins/demand-match.d.ts +3 -2
  6. package/dist/evaluation/builtins/demand-match.js +1 -1
  7. package/dist/evaluation/builtins/service-risk.d.ts +2 -1
  8. package/dist/evaluation/builtins/service-risk.js +1 -1
  9. package/dist/evaluation/index.d.ts +1 -0
  10. package/dist/evaluation/index.js +1 -1
  11. package/dist/evaluation/match-operation.d.ts +14 -0
  12. package/dist/evaluation/match-operation.js +1 -0
  13. package/dist/experience/realtime-feedback.js +1 -1
  14. package/dist/extensions/capability-manifest.d.ts +1 -82
  15. package/dist/extensions/capability-manifest.js +1 -1
  16. package/dist/extensions/constraint-registry.d.ts +6 -4
  17. package/dist/extensions/constraint-registry.js +1 -1
  18. package/dist/extensions/index.d.ts +4 -5
  19. package/dist/extensions/index.js +1 -1
  20. package/dist/extensions/industry-pack.js +1 -1
  21. package/dist/extensions/metric-registry.d.ts +6 -4
  22. package/dist/extensions/metric-registry.js +1 -1
  23. package/dist/extensions/mode-evaluator.d.ts +2 -3
  24. package/dist/extensions/mode-evaluator.js +1 -1
  25. package/dist/extensions/modes.js +1 -1
  26. package/dist/extensions/registry.d.ts +3 -25
  27. package/dist/extensions/registry.js +1 -1
  28. package/dist/extensions/types.d.ts +0 -68
  29. package/dist/goal/GoalClassifier.js +1 -1
  30. package/dist/goal/GoalEngine.d.ts +44 -1
  31. package/dist/goal/GoalEngine.js +1 -1
  32. package/dist/goal/types.d.ts +5 -1
  33. package/dist/harness/auto-escalation.d.ts +0 -12
  34. package/dist/harness/auto-escalation.js +1 -1
  35. package/dist/harness/index.d.ts +1 -14
  36. package/dist/harness/index.js +1 -1
  37. package/dist/harness/types.d.ts +0 -38
  38. package/dist/keeper/KeeperScan.d.ts +39 -0
  39. package/dist/keeper/KeeperScan.js +1 -0
  40. package/dist/keeper/KeeperStore.d.ts +43 -0
  41. package/dist/keeper/KeeperStore.js +1 -0
  42. package/dist/keeper/detectors.d.ts +23 -0
  43. package/dist/keeper/detectors.js +1 -0
  44. package/dist/keeper/keeper.spec.d.ts +1 -0
  45. package/dist/keeper/keeper.spec.js +1 -0
  46. package/dist/keeper/types.d.ts +65 -0
  47. package/dist/keeper/types.js +1 -0
  48. package/dist/knowledge/account-marks.d.ts +1 -0
  49. package/dist/knowledge/account-marks.js +1 -1
  50. package/dist/knowledge/demand-risk.js +1 -1
  51. package/dist/knowledge/event-semantics.d.ts +3 -0
  52. package/dist/knowledge/event-semantics.js +1 -1
  53. package/dist/knowledge/event-semantics.spec.d.ts +1 -0
  54. package/dist/knowledge/event-semantics.spec.js +1 -0
  55. package/dist/knowledge/evidence-review.d.ts +23 -0
  56. package/dist/knowledge/evidence-review.js +1 -1
  57. package/dist/knowledge/examples-scanner-cli.js +1 -1
  58. package/dist/knowledge/examples-scanner.js +1 -1
  59. package/dist/knowledge/fund-layer.d.ts +13 -9
  60. package/dist/knowledge/fund-layer.js +1 -1
  61. package/dist/knowledge/goal-completion.js +1 -1
  62. package/dist/knowledge/guard-bindings.d.ts +21 -0
  63. package/dist/knowledge/guard-bindings.js +1 -0
  64. package/dist/knowledge/guard-bytecode-spec.d.ts +82 -0
  65. package/dist/knowledge/guard-bytecode-spec.js +1 -0
  66. package/dist/knowledge/guard-design-patterns.d.ts +1 -1
  67. package/dist/knowledge/guard-design-patterns.js +1 -1
  68. package/dist/knowledge/index.d.ts +13 -7
  69. package/dist/knowledge/index.js +1 -1
  70. package/dist/knowledge/industry-registry.js +1 -1
  71. package/dist/knowledge/mcp-schema-audit-cli.js +1 -1
  72. package/dist/knowledge/mcp-schema-audit.js +1 -1
  73. package/dist/knowledge/reward-risk.d.ts +1 -1
  74. package/dist/knowledge/reward-risk.js +1 -1
  75. package/dist/knowledge/safety-rules.d.ts +2 -1
  76. package/dist/knowledge/safety-rules.js +1 -1
  77. package/dist/knowledge/scenario-modes.d.ts +1 -1
  78. package/dist/knowledge/scenario-modes.js +1 -1
  79. package/dist/knowledge/scenario-topology.d.ts +43 -0
  80. package/dist/knowledge/scenario-topology.js +1 -0
  81. package/dist/knowledge/supply-chain.js +1 -1
  82. package/dist/knowledge/template-registry.js +1 -1
  83. package/dist/knowledge/tools-reference.js +1 -1
  84. package/dist/knowledge/workflow-guidance.d.ts +55 -0
  85. package/dist/knowledge/workflow-guidance.js +1 -1
  86. package/dist/knowledge/workspace-lists.d.ts +1 -0
  87. package/dist/knowledge/workspace-lists.js +1 -1
  88. package/dist/monitor/MonitorLoop.d.ts +3 -0
  89. package/dist/monitor/MonitorLoop.js +1 -1
  90. package/dist/monitor/ScopeResolver.js +1 -1
  91. package/dist/monitor/SuggestionBridge.d.ts +38 -0
  92. package/dist/monitor/SuggestionBridge.js +1 -0
  93. package/dist/monitor/SuggestionBridge.spec.d.ts +1 -0
  94. package/dist/monitor/SuggestionBridge.spec.js +1 -0
  95. package/dist/monitor/types.d.ts +0 -1
  96. package/dist/monitor/types.js +1 -1
  97. package/dist/participation/arbitrator-interest.d.ts +20 -0
  98. package/dist/participation/arbitrator-interest.js +1 -0
  99. package/dist/participation/demander-interest.d.ts +23 -0
  100. package/dist/participation/demander-interest.js +1 -0
  101. package/dist/participation/employee-kpi.d.ts +12 -0
  102. package/dist/participation/employee-kpi.js +1 -1
  103. package/dist/participation/employee-kpi.spec.d.ts +1 -0
  104. package/dist/participation/employee-kpi.spec.js +1 -0
  105. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  106. package/dist/playbooks/service-build/context-assembly.js +1 -1
  107. package/dist/playbooks/service-build/machine-nodes.js +1 -1
  108. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  109. package/dist/playbooks/service-build/merchant-guide.d.ts +20 -0
  110. package/dist/playbooks/service-build/merchant-guide.js +1 -1
  111. package/dist/playbooks/service-build/mode-actions.d.ts +30 -12
  112. package/dist/playbooks/service-build/mode-actions.js +1 -1
  113. package/dist/playbooks/service-build/object-panorama.js +1 -1
  114. package/dist/playbooks/service-build/participation-radar.js +1 -1
  115. package/dist/playbooks/service-build/relationship-profile.d.ts +2 -0
  116. package/dist/playbooks/service-build/relationship-profile.js +1 -0
  117. package/dist/playbooks/service-build/semantic-graph.d.ts +5 -1
  118. package/dist/playbooks/service-build/semantic-graph.js +1 -1
  119. package/dist/playbooks/service-build/service-panorama.js +1 -1
  120. package/dist/relationship/derivation.d.ts +94 -0
  121. package/dist/relationship/derivation.js +1 -0
  122. package/dist/relationship/derivation.spec.d.ts +1 -0
  123. package/dist/relationship/derivation.spec.js +1 -0
  124. package/dist/relationship/incentive.d.ts +38 -0
  125. package/dist/relationship/incentive.js +1 -0
  126. package/dist/relationship/index.d.ts +4 -0
  127. package/dist/relationship/index.js +1 -0
  128. package/dist/relationship/registry.d.ts +13 -0
  129. package/dist/relationship/registry.js +1 -0
  130. package/dist/relationship/types.d.ts +45 -0
  131. package/dist/relationship/types.js +1 -0
  132. package/dist/review/progress.js +1 -1
  133. package/dist/role/index.d.ts +2 -2
  134. package/dist/role/index.js +1 -1
  135. package/dist/role/model.d.ts +2 -1
  136. package/dist/role/model.js +1 -1
  137. package/dist/role/types.d.ts +5 -0
  138. package/dist/rules.d.ts +1 -1
  139. package/dist/safety/confirm-gate.js +1 -1
  140. package/dist/safety/preview.js +1 -1
  141. package/dist/schema/call/bridge.d.ts +25 -3
  142. package/dist/schema/call/bridge.js +1 -1
  143. package/dist/schema/call/semantic.js +1 -1
  144. package/dist/schema/common/index.js +1 -1
  145. package/dist/schema/employee/index.d.ts +61 -1
  146. package/dist/schema/employee/index.js +1 -1
  147. package/dist/schema/evaluation/index.d.ts +70 -5
  148. package/dist/schema/evaluation/index.js +1 -1
  149. package/dist/schema/goal/index.d.ts +40 -14
  150. package/dist/schema/goal/index.js +1 -1
  151. package/dist/schema/goal/planning.d.ts +6 -6
  152. package/dist/schema/index.d.ts +1 -0
  153. package/dist/schema/index.js +1 -1
  154. package/dist/schema/industry-pack/index.d.ts +59 -7
  155. package/dist/schema/industry-pack/index.js +1 -1
  156. package/dist/schema/industry-pack/modes.d.ts +59 -7
  157. package/dist/schema/industry-pack/modes.js +1 -1
  158. package/dist/schema/intent-radar/index.d.ts +19 -19
  159. package/dist/schema/keeper/index.d.ts +475 -0
  160. package/dist/schema/keeper/index.js +1 -0
  161. package/dist/schema/local/index.d.ts +11 -0
  162. package/dist/schema/local/index.js +1 -1
  163. package/dist/schema/messenger/index.d.ts +2 -0
  164. package/dist/schema/messenger/index.js +1 -1
  165. package/dist/schema/operations.d.ts +64 -16
  166. package/dist/schema/persona/index.d.ts +1 -1
  167. package/dist/schema/query/bi.d.ts +244 -16
  168. package/dist/schema/query/bi.js +1 -1
  169. package/dist/schema/query/index.d.ts +2 -2
  170. package/dist/schema/schema-query/index.d.ts +2 -11
  171. package/dist/schema/schema-query/index.js +1 -1
  172. package/dist/schema/schema-version.js +1 -1
  173. package/dist/schema/utils/skills-recommendation.js +1 -1
  174. package/dist/schema/watch/index.d.ts +4 -0
  175. package/dist/schema/watch/index.js +1 -1
  176. package/dist/schema-query-impl/index.d.ts +33 -14
  177. package/dist/schema-query-impl/index.js +1 -1
  178. package/dist/schemas/account_operation.output.json +29 -0
  179. package/dist/schemas/account_operation.schema.json +6 -2
  180. package/dist/schemas/bridge_operation.output.json +24 -1
  181. package/dist/schemas/bridge_operation.schema.json +73 -1
  182. package/dist/schemas/employee_operation.output.json +100 -0
  183. package/dist/schemas/employee_operation.schema.json +148 -5
  184. package/dist/schemas/evaluation_operation.output.json +135 -9
  185. package/dist/schemas/evaluation_operation.schema.json +176 -7
  186. package/dist/schemas/goal_operation.schema.json +76 -0
  187. package/dist/schemas/index.json +7 -1
  188. package/dist/schemas/industry_pack_operation.output.json +172 -27
  189. package/dist/schemas/industry_pack_operation.schema.json +19 -0
  190. package/dist/schemas/keeper_operation.output.json +1274 -0
  191. package/dist/schemas/keeper_operation.schema.json +359 -0
  192. package/dist/schemas/messenger_operation.schema.json +8 -0
  193. package/dist/schemas/onchain_events.output.json +1 -1
  194. package/dist/schemas/onchain_operations.schema.json +41 -41
  195. package/dist/schemas/onchain_operations_allocation.schema.json +4 -4
  196. package/dist/schemas/onchain_operations_arbitration.schema.json +3 -3
  197. package/dist/schemas/onchain_operations_contact.schema.json +2 -2
  198. package/dist/schemas/onchain_operations_demand.schema.json +2 -2
  199. package/dist/schemas/onchain_operations_machine.schema.json +2 -2
  200. package/dist/schemas/onchain_operations_order.schema.json +2 -2
  201. package/dist/schemas/onchain_operations_payment.schema.json +1 -1
  202. package/dist/schemas/onchain_operations_permission.schema.json +2 -2
  203. package/dist/schemas/onchain_operations_progress.schema.json +2 -2
  204. package/dist/schemas/onchain_operations_repository.schema.json +2 -2
  205. package/dist/schemas/onchain_operations_reward.schema.json +6 -6
  206. package/dist/schemas/onchain_operations_service.schema.json +7 -7
  207. package/dist/schemas/onchain_operations_treasury.schema.json +6 -6
  208. package/dist/schemas/onchain_table_data.output.json +71 -0
  209. package/dist/schemas/query_toolkit.output.json +485 -7
  210. package/dist/schemas/query_toolkit.schema.json +71 -0
  211. package/dist/schemas/schema_query.output.json +1 -64
  212. package/dist/schemas/schema_query.schema.json +18 -3
  213. package/dist/schemas/watch_operation.output.json +21 -1
  214. package/dist/task/ProcessStore.d.ts +18 -1
  215. package/dist/task/ProcessStore.js +1 -1
  216. package/dist/task/playbook.js +1 -1
  217. package/dist/task/types.d.ts +24 -0
  218. package/dist/tools/handlers/bridge.js +1 -1
  219. package/dist/tools/handlers/config.js +1 -1
  220. package/dist/tools/handlers/employee.d.ts +6 -0
  221. package/dist/tools/handlers/employee.js +1 -1
  222. package/dist/tools/handlers/employee.spec.d.ts +1 -0
  223. package/dist/tools/handlers/employee.spec.js +1 -0
  224. package/dist/tools/handlers/evaluation.js +1 -1
  225. package/dist/tools/handlers/evaluation.spec.d.ts +1 -0
  226. package/dist/tools/handlers/evaluation.spec.js +1 -0
  227. package/dist/tools/handlers/goal.js +1 -1
  228. package/dist/tools/handlers/industry-pack.js +1 -1
  229. package/dist/tools/handlers/keeper.d.ts +12 -0
  230. package/dist/tools/handlers/keeper.js +1 -0
  231. package/dist/tools/handlers/local.d.ts +4 -3
  232. package/dist/tools/handlers/local.js +1 -1
  233. package/dist/tools/handlers/messenger.js +1 -1
  234. package/dist/tools/handlers/onchain.js +1 -1
  235. package/dist/tools/handlers/permission.js +1 -1
  236. package/dist/tools/handlers/query.js +1 -1
  237. package/dist/tools/handlers/schema-query.js +1 -1
  238. package/dist/tools/handlers/watch.js +1 -1
  239. package/dist/tools/handlers/workflow.js +1 -1
  240. package/dist/tools/index.js +1 -1
  241. package/dist/tools/registry/agent.d.ts +2 -0
  242. package/dist/tools/registry/agent.js +1 -0
  243. package/dist/tools/registry/bridge.d.ts +2 -0
  244. package/dist/tools/registry/bridge.js +1 -0
  245. package/dist/tools/registry/business.d.ts +2 -0
  246. package/dist/tools/registry/business.js +1 -0
  247. package/dist/tools/registry/config.d.ts +2 -0
  248. package/dist/tools/registry/config.js +1 -0
  249. package/dist/tools/registry/files.d.ts +2 -0
  250. package/dist/tools/registry/files.js +1 -0
  251. package/dist/tools/registry/identity.d.ts +2 -0
  252. package/dist/tools/registry/identity.js +1 -0
  253. package/dist/tools/registry/local.d.ts +2 -0
  254. package/dist/tools/registry/local.js +1 -0
  255. package/dist/tools/registry/messenger.d.ts +2 -0
  256. package/dist/tools/registry/messenger.js +1 -0
  257. package/dist/tools/registry/monitor.d.ts +2 -0
  258. package/dist/tools/registry/monitor.js +1 -0
  259. package/dist/tools/registry/onchain.d.ts +2 -0
  260. package/dist/tools/registry/onchain.js +1 -0
  261. package/dist/tools/registry/query.d.ts +2 -0
  262. package/dist/tools/registry/query.js +1 -0
  263. package/dist/tools/registry/trust.d.ts +2 -0
  264. package/dist/tools/registry/trust.js +1 -0
  265. package/dist/tools/rules-hook.d.ts +1 -0
  266. package/dist/tools/rules-hook.js +1 -1
  267. package/dist/tools/shared.js +1 -1
  268. package/dist/tools/wrap.js +1 -1
  269. package/package.json +2 -2
  270. package/dist/examples/arbitration-dispute-create.json +0 -41
  271. package/dist/examples/arbitration-vote-weighted.json +0 -35
  272. package/dist/examples/arbitration-voting-guard-add.json +0 -38
  273. package/dist/examples/demand-present-service.json +0 -33
  274. package/dist/examples/education-contact-create.json +0 -40
  275. package/dist/examples/freelance-contact-create.json +0 -40
  276. package/dist/examples/gen-passport-verify-guard.json +0 -48
  277. package/dist/examples/guard-template-balance-check.json +0 -59
  278. package/dist/examples/guard-template-time-lock.json +0 -60
  279. package/dist/examples/insurance-guard-claim-timelock.json +0 -75
  280. package/dist/examples/insurance-guard-withdraw-allocation.json +0 -96
  281. package/dist/examples/insurance-machine-create.json +0 -75
  282. package/dist/examples/insurance-service-allocators.json +0 -55
  283. package/dist/examples/machine-multisig-threshold.json +0 -87
  284. package/dist/examples/machine-publish.json +0 -30
  285. package/dist/examples/machine-template-7node-rental.json +0 -119
  286. package/dist/examples/payment-scenario-bound.json +0 -45
  287. package/dist/examples/rental-ziroom-machine-create.json +0 -148
  288. package/dist/examples/rental-ziroom-permission-create.json +0 -41
  289. package/dist/examples/rental-ziroom-service-create.json +0 -36
  290. package/dist/examples/retail-adv-guard-customer-win-create.json +0 -80
  291. package/dist/examples/retail-adv-guard-messenger-proof-create.json +0 -65
  292. package/dist/examples/retail-adv-guard-reward-timeout-create.json +0 -92
  293. package/dist/examples/retail-adv-reward-guard-add.json +0 -51
  294. package/dist/examples/retail-myshop-allocation-activate.json +0 -55
  295. package/dist/examples/retail-myshop-arbitration-create.json +0 -40
  296. package/dist/examples/retail-myshop-contact-create.json +0 -43
  297. package/dist/examples/retail-myshop-order-create.json +0 -56
  298. package/dist/examples/retail-myshop-progress-operate.json +0 -38
  299. package/dist/examples/retail-myshop-reward-create.json +0 -35
  300. package/dist/examples/retail-myshop-service-create.json +0 -38
  301. package/dist/examples/retail-myshop-service-customer-required.json +0 -31
  302. package/dist/examples/service-discount-issue.json +0 -46
  303. package/dist/examples/subscription-contact-create.json +0 -40
  304. package/dist/examples/threebody-guard-create.json +0 -56
  305. package/dist/examples/threebody-machine-create.json +0 -71
  306. package/dist/examples/threebody-permission-create.json +0 -38
  307. package/dist/examples/threebody-service-allocators.json +0 -48
  308. package/dist/examples/travel-guard-time-lock.json +0 -69
  309. package/dist/examples/travel-guard-weather-oracle.json +0 -70
  310. package/dist/examples/travel-machine-create.json +0 -135
  311. package/dist/examples/travel-repository-create.json +0 -47
  312. package/dist/examples/travel-service-create.json +0 -34
  313. package/dist/examples/travel-treasury-create.json +0 -34
  314. package/dist/examples/treasury-deposit.json +0 -37
  315. package/dist/examples/treasury-withdraw.json +0 -38
  316. package/dist/harness/plan.d.ts +0 -33
  317. package/dist/harness/plan.js +0 -1
  318. package/dist/knowledge/demand-matching.d.ts +0 -29
  319. package/dist/knowledge/demand-matching.js +0 -1
  320. package/dist/knowledge/guard-context.d.ts +0 -56
  321. package/dist/knowledge/guard-context.js +0 -1
  322. package/dist/knowledge/guard-migration.d.ts +0 -48
  323. package/dist/knowledge/guard-migration.js +0 -1
  324. package/dist/mode-market/index.d.ts +0 -3
  325. package/dist/mode-market/index.js +0 -1
  326. package/dist/mode-market/registry.d.ts +0 -53
  327. package/dist/mode-market/registry.js +0 -1
  328. package/dist/mode-market/review.d.ts +0 -27
  329. package/dist/mode-market/review.js +0 -1
  330. package/dist/mode-market/submission.d.ts +0 -25
  331. package/dist/mode-market/submission.js +0 -1
  332. package/dist/schemas/guard-node-schema.json +0 -1000
  333. package/dist/task/stage-gate.d.ts +0 -22
  334. package/dist/task/stage-gate.js +0 -1
@@ -0,0 +1,6 @@
1
+ export type CommunicationEvidenceKind = "negotiation" | "confirmation" | "evidence";
2
+ export interface CommunicationEvidence {
3
+ kind: CommunicationEvidenceKind;
4
+ title: string;
5
+ }
6
+ export declare function classifyCommunicationEvidence(operation: string): CommunicationEvidence | null;
@@ -0,0 +1 @@
1
+ const EVIDENCE_OPERATIONS={'send_message':{'kind':'negotiation','title':'Negotiation/communication'},'send_required_info':{'kind':'confirmation','title':'Required-info\x20confirmation'},'send_file':{'kind':'evidence','title':'Evidence\x20file'},'generate_wts':{'kind':'evidence','title':'Evidence\x20packet\x20(WTS)'},'verify_wts':{'kind':'evidence','title':'Evidence\x20verification\x20(WTS)'},'sign_wts':{'kind':'evidence','title':'Evidence\x20signing\x20(WTS)'},'proof_message':{'kind':'evidence','title':'On-chain\x20proof'}};export function classifyCommunicationEvidence(a){return EVIDENCE_OPERATIONS[a]??null;}
@@ -0,0 +1,24 @@
1
+ import type { EvaluationRule } from "./types.js";
2
+ export declare const PRESENTER_HISTORY_KEY = "presenter_history";
3
+ export interface PresenterAcceptanceRecord {
4
+ demand_id?: string;
5
+ acceptance_score: number | null;
6
+ feedback_time?: number;
7
+ }
8
+ export interface AcceptanceSummary {
9
+ score: number | null;
10
+ rated: number;
11
+ total: number;
12
+ average: number | null;
13
+ }
14
+ export declare function summarizeAcceptance(records: PresenterAcceptanceRecord[]): AcceptanceSummary;
15
+ export declare function presenterHistoryFromEntities(entities: Record<string, unknown>): PresenterAcceptanceRecord[];
16
+ export interface AcceptanceRuleOptions {
17
+ weight: number;
18
+ dimension?: string;
19
+ redFlag?: {
20
+ below: number;
21
+ minRated: number;
22
+ };
23
+ }
24
+ export declare function createAcceptanceRule(evaluationId: string, opts: AcceptanceRuleOptions): EvaluationRule;
@@ -0,0 +1 @@
1
+ export const PRESENTER_HISTORY_KEY='presenter_history';export function summarizeAcceptance(a){const b=a['map'](d=>d['acceptance_score'])['filter'](d=>typeof d==='number'&&Number['isFinite'](d))['map'](d=>Math['max'](0x0,Math['min'](0x64,d)));if(b['length']===0x0)return{'score':null,'rated':0x0,'total':a['length'],'average':null};const c=b['reduce']((d,e)=>d+e,0x0)/b['length'];return{'score':Math['round'](c),'rated':b['length'],'total':a['length'],'average':Math['round'](c*0x64)/0x64};}export function presenterHistoryFromEntities(a){const b=a[PRESENTER_HISTORY_KEY];if(!Array['isArray'](b))return[];return b['filter'](c=>typeof c==='object'&&c!==null&&c['acceptance_score']!==undefined);}export function createAcceptanceRule(a,b){return{'id':'acceptance','description':'Presenter\x20historical\x20acceptance\x20score\x20backflow\x20(demand-side\x20feedback)','dimension':b['dimension']??'acceptance','weight':b['weight'],'evaluation_ids':[a],'evaluate':c=>{const d=summarizeAcceptance(presenterHistoryFromEntities(c['entities']));if(d['score']===null)return{'score':0x32,'weight':b['weight'],'reason':d['total']>0x0?'acceptance:\x20'+d['total']+'\x20presentation(s),\x20none\x20rated\x20(neutral)':'acceptance:\x20no\x20history\x20(neutral)'};const e=b['redFlag']!==undefined&&d['rated']>=b['redFlag']['minRated']&&d['average']!==null&&d['average']<b['redFlag']['below'];return{'score':d['score'],'weight':b['weight'],'reason':'acceptance\x20avg\x20'+d['average']+'\x20over\x20'+d['rated']+'\x20rated\x20presentation(s)','red_flag':e||undefined};}};}
@@ -1,3 +1,4 @@
1
+ import { type PresenterAcceptanceRecord } from "../acceptance.js";
1
2
  import { type CapabilityVector } from "../capability.js";
2
3
  import { type DemandExtractInput, type ServiceExtractInput } from "../extract.js";
3
4
  import type { EvaluationResult, UserInjection } from "../types.js";
@@ -7,9 +8,9 @@ export interface DemandMatch {
7
8
  service: ServiceExtractInput;
8
9
  result: EvaluationResult;
9
10
  }
10
- export declare function matchDemandToServices(demandCap: CapabilityVector, services: ServiceExtractInput[], injection?: UserInjection, limit?: number): Promise<DemandMatch[]>;
11
+ export declare function matchDemandToServices(demandCap: CapabilityVector, services: ServiceExtractInput[], injection?: UserInjection, limit?: number, presenterHistory?: PresenterAcceptanceRecord[]): Promise<DemandMatch[]>;
11
12
  export interface ServiceMatch {
12
13
  demand: DemandExtractInput;
13
14
  result: EvaluationResult;
14
15
  }
15
- export declare function matchServiceToDemands(serviceCap: CapabilityVector, demands: DemandExtractInput[], injection?: UserInjection, limit?: number): Promise<ServiceMatch[]>;
16
+ export declare function matchServiceToDemands(serviceCap: CapabilityVector, demands: DemandExtractInput[], injection?: UserInjection, limit?: number, presenterHistory?: PresenterAcceptanceRecord[]): Promise<ServiceMatch[]>;
@@ -1 +1 @@
1
- import{requiredCapabilities}from'../capability.js';import{getEvaluationEngine}from'../engine.js';import{extractDemandCapability,extractServiceCapability}from'../extract.js';import{relateRegion}from'../region.js';export const DEMAND_MATCH_EVALUATION='demand_match';const REGION_SCORE={'exact':0x64,'contains':0x55,'compatible':0x3c,'overlap':0x28,'mismatch':0x0},dsCaps={'id':'ds_caps','description':'Extract\x20demand\x20+\x20service\x20capability\x20vectors\x20(either\x20may\x20be\x20pre-computed\x20or\x20raw)','evaluation_ids':[DEMAND_MATCH_EVALUATION],'extract':a=>({'demand_cap':a['entities']['demand_cap']??extractDemandCapability(a['entities']['demand']),'service_cap':a['entities']['service_cap']??extractServiceCapability(a['entities']['service'])})},regionRule={'id':'region','description':'Geographic\x20region\x20relation\x20between\x20demand\x20and\x20service','dimension':'region','weight':0xf,'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=a['facts']['demand_cap'],c=a['facts']['service_cap'],e=relateRegion(b['region'],c['region']);return{'score':REGION_SCORE[e],'weight':0xf,'reason':'region\x20'+e};}},industryRule={'id':'industry','description':'Industry\x20scenario\x20match','dimension':'industry','weight':0x14,'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=a['facts']['demand_cap'],c=a['facts']['service_cap'];if(b['industry']==='general'||c['industry']==='general')return{'score':0x32,'weight':0x14,'reason':'industry\x20unknown\x20(neutral)'};const e=b['industry']===c['industry']?0x64:0x0;return{'score':e,'weight':0x14,'reason':b['industry']+'\x20vs\x20'+c['industry']};}},priceRule={'id':'price','description':'Service\x20price\x20within\x20demand\x20budget','dimension':'price','weight':0xf,'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=a['facts']['demand_cap'],c=a['facts']['service_cap'];if(b['price_max']===undefined||c['price_min']===undefined)return{'score':0x32,'weight':0xf,'reason':'price\x20unknown\x20(neutral)'};if(c['price_min']<=b['price_max'])return{'score':0x64,'weight':0xf,'reason':'within\x20budget'};if(c['price_min']<=b['price_max']*0x6en/0x64n)return{'score':0x32,'weight':0xf,'reason':'slightly\x20over\x20budget'};return{'score':0x0,'weight':0xf,'reason':'over\x20budget'};}},trustRule={'id':'trust','description':'Service\x20trust\x20score','dimension':'trust','weight':0xf,'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=a['facts']['service_cap'],c=b['trust_score'],d=c>=0x4b?0x64:c>=0x32?0x3c:c>=0x19?0x1e:0x0;return{'score':d,'weight':0xf,'reason':'trust\x20'+c};}},capabilitiesRule={'id':'capabilities','description':'Demand\x20capability\x20requirements\x20covered\x20by\x20the\x20service','dimension':'capabilities','weight':0x1e,'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=a['facts']['demand_cap'],c=a['facts']['service_cap'],e=requiredCapabilities(b['capabilities']);if(e['length']===0x0)return{'score':0x32,'weight':0x1e,'reason':'no\x20capability\x20requirement\x20(neutral)'};const f=e['filter'](g=>c['capabilities'][g]);return{'score':Math['round'](f['length']/e['length']*0x64),'weight':0x1e,'matched':f,'mismatched':e['filter'](g=>!c['capabilities'][g]),'reason':f['length']+'/'+e['length']+'\x20required\x20capabilities\x20covered'};}},tagsRule={'id':'tags','description':'Keyword/tag\x20overlap','dimension':'tags','weight':0x5,'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=a['facts']['demand_cap'],c=a['facts']['service_cap'],e=new Set((b['keywords']??[])['map'](h=>h['toLowerCase']())),f=new Set([...c['tags']??[],...c['keywords']??[]]['map'](h=>h['toLowerCase']()));if(e['size']===0x0)return{'score':0x32,'weight':0x5,'reason':'no\x20keywords\x20(neutral)'};const g=[...e]['filter'](h=>f['has'](h))['length'];return{'score':Math['round'](g/e['size']*0x64),'weight':0x5,'reason':g+'/'+e['size']+'\x20keywords'};}};export function registerDemandMatchEvaluation(a=getEvaluationEngine()){a['registerDataSource'](dsCaps);for(const b of[regionRule,industryRule,priceRule,trustRule,capabilitiesRule,tagsRule]){a['registerRule'](b);}}export async function matchDemandToServices(a,b,c,d=0x5){const e=getEvaluationEngine(),f=[];for(const g of b){const h=await e['evaluate'](DEMAND_MATCH_EVALUATION,{'demand_cap':a,'service':g},c);f['push']({'service':g,'result':h});}return f['sort']((i,j)=>j['result']['total']-i['result']['total']),f['slice'](0x0,d);}export async function matchServiceToDemands(a,b,c,d=0x5){const e=getEvaluationEngine(),f=[];for(const g of b){const h=await e['evaluate'](DEMAND_MATCH_EVALUATION,{'service_cap':a,'demand':g},c);f['push']({'demand':g,'result':h});}return f['sort']((i,j)=>j['result']['total']-i['result']['total']),f['slice'](0x0,d);}
1
+ import{createAcceptanceRule}from'../acceptance.js';import{requiredCapabilities}from'../capability.js';import{getEvaluationEngine}from'../engine.js';import{extractDemandCapability,extractServiceCapability}from'../extract.js';import{relateRegion}from'../region.js';export const DEMAND_MATCH_EVALUATION='demand_match';const REGION_SCORE={'exact':0x64,'contains':0x55,'compatible':0x3c,'overlap':0x28,'mismatch':0x0},dsCaps={'id':'ds_caps','description':'Extract\x20demand\x20+\x20service\x20capability\x20vectors\x20(either\x20may\x20be\x20pre-computed\x20or\x20raw)','evaluation_ids':[DEMAND_MATCH_EVALUATION],'extract':a=>({'demand_cap':a['entities']['demand_cap']??extractDemandCapability(a['entities']['demand']),'service_cap':a['entities']['service_cap']??extractServiceCapability(a['entities']['service'])})},regionRule={'id':'region','description':'Geographic\x20region\x20relation\x20between\x20demand\x20and\x20service','dimension':'region','weight':0xf,'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=a['facts']['demand_cap'],c=a['facts']['service_cap'],e=relateRegion(b['region'],c['region']);return{'score':REGION_SCORE[e],'weight':0xf,'reason':'region\x20'+e};}},industryRule={'id':'industry','description':'Industry\x20scenario\x20match','dimension':'industry','weight':0x14,'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=a['facts']['demand_cap'],c=a['facts']['service_cap'];if(b['industry']==='general'||c['industry']==='general')return{'score':0x32,'weight':0x14,'reason':'industry\x20unknown\x20(neutral)'};const e=b['industry']===c['industry']?0x64:0x0;return{'score':e,'weight':0x14,'reason':b['industry']+'\x20vs\x20'+c['industry']};}},priceRule={'id':'price','description':'Service\x20price\x20within\x20demand\x20budget','dimension':'price','weight':0xf,'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=a['facts']['demand_cap'],c=a['facts']['service_cap'];if(b['price_max']===undefined||c['price_min']===undefined)return{'score':0x32,'weight':0xf,'reason':'price\x20unknown\x20(neutral)'};if(c['price_min']<=b['price_max'])return{'score':0x64,'weight':0xf,'reason':'within\x20budget'};if(c['price_min']<=b['price_max']*0x6en/0x64n)return{'score':0x32,'weight':0xf,'reason':'slightly\x20over\x20budget'};return{'score':0x0,'weight':0xf,'reason':'over\x20budget'};}},trustRule={'id':'trust','description':'Service\x20trust\x20score','dimension':'trust','weight':0xf,'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=a['facts']['service_cap'],c=b['trust_score'],d=c>=0x4b?0x64:c>=0x32?0x3c:c>=0x19?0x1e:0x0;return{'score':d,'weight':0xf,'reason':'trust\x20'+c};}},capabilitiesRule={'id':'capabilities','description':'Demand\x20capability\x20requirements\x20covered\x20by\x20the\x20service','dimension':'capabilities','weight':0x1e,'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=a['facts']['demand_cap'],c=a['facts']['service_cap'],e=requiredCapabilities(b['capabilities']);if(e['length']===0x0)return{'score':0x32,'weight':0x1e,'reason':'no\x20capability\x20requirement\x20(neutral)'};const f=e['filter'](g=>c['capabilities'][g]);return{'score':Math['round'](f['length']/e['length']*0x64),'weight':0x1e,'matched':f,'mismatched':e['filter'](g=>!c['capabilities'][g]),'reason':f['length']+'/'+e['length']+'\x20required\x20capabilities\x20covered'};}},tagsRule={'id':'tags','description':'Keyword/tag\x20overlap','dimension':'tags','weight':0x5,'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=a['facts']['demand_cap'],c=a['facts']['service_cap'],e=new Set((b['keywords']??[])['map'](h=>h['toLowerCase']())),f=new Set([...c['tags']??[],...c['keywords']??[]]['map'](h=>h['toLowerCase']()));if(e['size']===0x0)return{'score':0x32,'weight':0x5,'reason':'no\x20keywords\x20(neutral)'};const g=[...e]['filter'](h=>f['has'](h))['length'];return{'score':Math['round'](g/e['size']*0x64),'weight':0x5,'reason':g+'/'+e['size']+'\x20keywords'};}},acceptanceRule=createAcceptanceRule(DEMAND_MATCH_EVALUATION,{'weight':0xa});export function registerDemandMatchEvaluation(a=getEvaluationEngine()){a['registerDataSource'](dsCaps);for(const b of[regionRule,industryRule,priceRule,trustRule,capabilitiesRule,tagsRule,acceptanceRule]){a['registerRule'](b);}}export async function matchDemandToServices(a,b,c,d=0x5,e){const f=getEvaluationEngine(),g=[];for(const h of b){const i=await f['evaluate'](DEMAND_MATCH_EVALUATION,{'demand_cap':a,'service':h,'presenter_history':e??[]},c);g['push']({'service':h,'result':i});}return g['sort']((j,k)=>k['result']['total']-j['result']['total']),g['slice'](0x0,d);}export async function matchServiceToDemands(a,b,c,d=0x5,e){const f=getEvaluationEngine(),g=[];for(const h of b){const i=await f['evaluate'](DEMAND_MATCH_EVALUATION,{'service_cap':a,'demand':h,'presenter_history':e??[]},c);g['push']({'demand':h,'result':i});}return g['sort']((j,k)=>k['result']['total']-j['result']['total']),g['slice'](0x0,d);}
@@ -1,6 +1,7 @@
1
+ import { type PresenterAcceptanceRecord } from "../acceptance.js";
1
2
  import { type PuzzleRawData } from "../../customer/info-puzzle.js";
2
3
  import type { PuzzleDepth } from "../../customer/types.js";
3
4
  import type { EvaluationResult, UserInjection } from "../types.js";
4
5
  export declare const SERVICE_RISK_EVALUATION = "service_risk";
5
6
  export declare function registerServiceRiskEvaluation(engine?: import("../engine.js").EvaluationEngine): void;
6
- export declare function assessServiceRisk(serviceId: string, raw: PuzzleRawData, injection?: UserInjection, depth?: PuzzleDepth): Promise<EvaluationResult>;
7
+ export declare function assessServiceRisk(serviceId: string, raw: PuzzleRawData, injection?: UserInjection, depth?: PuzzleDepth, presenterHistory?: PresenterAcceptanceRecord[]): Promise<EvaluationResult>;
@@ -1 +1 @@
1
- import{assembleInfoPuzzle}from'../../customer/info-puzzle.js';import{assessWorkflowRisk,assessFundRisk,assessTrustRisk,assessBehaviorRisk}from'../../customer/risk-assessment.js';import{getEvaluationEngine}from'../engine.js';export const SERVICE_RISK_EVALUATION='service_risk';const dsPuzzle={'id':'ds_puzzle','description':'Assemble\x20the\x20service\x20info\x20puzzle\x20from\x20raw\x20chain\x20data','evaluation_ids':[SERVICE_RISK_EVALUATION],'extract':a=>{const b=a['entities']['service_id'],c=a['entities']['puzzle_raw'],d=a['entities']['depth']??'preorder';return{'puzzle':assembleInfoPuzzle(b,c,d)};}};function dimensionRule(a,b,c,d){return{'id':a,'description':b+'\x20risk\x20dimension','dimension':b,'weight':c,'evaluation_ids':[SERVICE_RISK_EVALUATION],'evaluate':e=>{const f=e['facts']['puzzle'],g=d(f),h=g['max_score']>0x0?Math['round'](g['score']/g['max_score']*0x64):0x0,i=g['checks']['filter'](l=>l['passed']),j=g['checks']['filter'](l=>!l['passed']),k=j['filter'](l=>l['advice']?.['startsWith']('🔴'));return{'score':h,'weight':c,'reason':k['length']>0x0?k['map'](l=>'['+g['name']+']\x20'+l['description']+':\x20'+l['advice'])['join'](';\x20'):g['name']+'\x20'+g['score']+'/'+g['max_score'],'matched':i['map'](l=>l['id']),'mismatched':j['map'](l=>l['id']),'red_flag':k['length']>0x0};}};}const workflowRule=dimensionRule('workflow','workflow',0x23,assessWorkflowRisk),fundRule=dimensionRule('fund','fund',0x19,assessFundRisk),trustRule=dimensionRule('trust','trust',0x14,assessTrustRisk),behaviorRule=dimensionRule('behavior','behavior',0x14,assessBehaviorRisk);export function registerServiceRiskEvaluation(a=getEvaluationEngine()){a['registerDataSource'](dsPuzzle);for(const b of[workflowRule,fundRule,trustRule,behaviorRule]){a['registerRule'](b);}}export async function assessServiceRisk(a,b,c,d='preorder'){return getEvaluationEngine()['evaluate'](SERVICE_RISK_EVALUATION,{'service_id':a,'puzzle_raw':b,'depth':d},c);}
1
+ import{createAcceptanceRule}from'../acceptance.js';import{assembleInfoPuzzle}from'../../customer/info-puzzle.js';import{assessWorkflowRisk,assessFundRisk,assessTrustRisk,assessBehaviorRisk}from'../../customer/risk-assessment.js';import{getEvaluationEngine}from'../engine.js';export const SERVICE_RISK_EVALUATION='service_risk';const dsPuzzle={'id':'ds_puzzle','description':'Assemble\x20the\x20service\x20info\x20puzzle\x20from\x20raw\x20chain\x20data','evaluation_ids':[SERVICE_RISK_EVALUATION],'extract':a=>{const b=a['entities']['service_id'],c=a['entities']['puzzle_raw'],d=a['entities']['depth']??'preorder';return{'puzzle':assembleInfoPuzzle(b,c,d)};}};function dimensionRule(a,b,c,d){return{'id':a,'description':b+'\x20risk\x20dimension','dimension':b,'weight':c,'evaluation_ids':[SERVICE_RISK_EVALUATION],'evaluate':e=>{const f=e['facts']['puzzle'],g=d(f),h=g['max_score']>0x0?Math['round'](g['score']/g['max_score']*0x64):0x0,i=g['checks']['filter'](l=>l['passed']),j=g['checks']['filter'](l=>!l['passed']),k=j['filter'](l=>l['advice']?.['startsWith']('🔴'));return{'score':h,'weight':c,'reason':k['length']>0x0?k['map'](l=>'['+g['name']+']\x20'+l['description']+':\x20'+l['advice'])['join'](';\x20'):g['name']+'\x20'+g['score']+'/'+g['max_score'],'matched':i['map'](l=>l['id']),'mismatched':j['map'](l=>l['id']),'red_flag':k['length']>0x0};}};}const workflowRule=dimensionRule('workflow','workflow',0x23,assessWorkflowRisk),fundRule=dimensionRule('fund','fund',0x19,assessFundRisk),trustRule=dimensionRule('trust','trust',0x14,assessTrustRisk),behaviorRule=dimensionRule('behavior','behavior',0x14,assessBehaviorRisk),acceptanceRule=createAcceptanceRule(SERVICE_RISK_EVALUATION,{'weight':0xa,'dimension':'trust','redFlag':{'below':0x1e,'minRated':0x2}});export function registerServiceRiskEvaluation(a=getEvaluationEngine()){a['registerDataSource'](dsPuzzle);for(const b of[workflowRule,fundRule,trustRule,behaviorRule,acceptanceRule]){a['registerRule'](b);}}export async function assessServiceRisk(a,b,c,d='preorder',e){return getEvaluationEngine()['evaluate'](SERVICE_RISK_EVALUATION,{'service_id':a,'puzzle_raw':b,'depth':d,'presenter_history':e??[]},c);}
@@ -1,5 +1,6 @@
1
1
  export * from "./types.js";
2
2
  export * from "./user-injection.js";
3
+ export * from "./acceptance.js";
3
4
  export * from "./region.js";
4
5
  export * from "./capability.js";
5
6
  export * from "./extract.js";
@@ -1 +1 @@
1
- export*from'./types.js';export*from'./user-injection.js';export*from'./region.js';export*from'./capability.js';export*from'./extract.js';export*from'./gap.js';export*from'./composer.js';export*from'./game-strategy.js';export*from'./node-game.js';export*from'./arbitration-game.js';export*from'./path-reasoning.js';export*from'./builtins/index.js';export{EvaluationEngine,getEvaluationEngine,levelFromScore}from'./engine.js';
1
+ export*from'./types.js';export*from'./user-injection.js';export*from'./acceptance.js';export*from'./region.js';export*from'./capability.js';export*from'./extract.js';export*from'./gap.js';export*from'./composer.js';export*from'./game-strategy.js';export*from'./node-game.js';export*from'./arbitration-game.js';export*from'./path-reasoning.js';export*from'./builtins/index.js';export{EvaluationEngine,getEvaluationEngine,levelFromScore}from'./engine.js';
@@ -0,0 +1,14 @@
1
+ import type { DemandExtractInput, ServiceExtractInput } from "./extract.js";
2
+ export declare const OP_DEMAND_PRESENT_SERVICE = "demand.present_service";
3
+ export declare const OP_DEMAND_PRESENT_SERVICE_WITH_PASSPORT = "demand.present_service_with_passport";
4
+ export declare const OP_DEMAND_PUBLISH = "demand.publish";
5
+ export declare const OP_SERVICE_ORDER_NEW = "service.order_new";
6
+ export interface OperationBridge {
7
+ operation: string;
8
+ operation_type: "demand" | "service";
9
+ preconditions: string[];
10
+ rationale: string;
11
+ }
12
+ export declare function nextOperationForServiceMatch(demand: DemandExtractInput, guarded: boolean | null): OperationBridge;
13
+ export declare function nextOperationForDemandMatch(service: ServiceExtractInput): OperationBridge;
14
+ export declare function nextOperationForServiceOrder(service: ServiceExtractInput): OperationBridge;
@@ -0,0 +1 @@
1
+ export const OP_DEMAND_PRESENT_SERVICE='demand.present_service';export const OP_DEMAND_PRESENT_SERVICE_WITH_PASSPORT='demand.present_service_with_passport';export const OP_DEMAND_PUBLISH='demand.publish';export const OP_SERVICE_ORDER_NEW='service.order_new';export function nextOperationForServiceMatch(a,b){return{'operation':b===!![]?OP_DEMAND_PRESENT_SERVICE_WITH_PASSPORT:OP_DEMAND_PRESENT_SERVICE,'operation_type':'demand','preconditions':['Demand\x20is\x20still\x20open\x20(not\x20expired)\x20and\x20this\x20supplier\x20has\x20not\x20already\x20presented.','Service\x20is\x20published\x20and\x20not\x20paused.',b===null?'Verify\x20Demand.guards:\x20if\x20non-empty\x20use\x20present_with_passport\x20with\x20a\x20by_guard\x20from\x20Demand.guards;\x20if\x20empty\x20use\x20plain\x20present.':b?'Select\x20a\x20by_guard\x20present\x20in\x20Demand.guards\x20for\x20present_with_passport\x20(guard\x20verification\x20runs\x20at\x20present\x20time).':'Demand.guards\x20is\x20empty\x20→\x20plain\x20present\x20is\x20valid.'],'rationale':'Present\x20this\x20service\x20to\x20demand\x20'+a['object']+';\x20the\x20demander\x20then\x20gives\x20feedback\x20(acceptance_score)\x20and\x20selects\x20→\x20Order\x20via\x20'+OP_SERVICE_ORDER_NEW+'\x20(see\x20nextOperationForServiceOrder).'};}export function nextOperationForDemandMatch(a){return{'operation':OP_DEMAND_PUBLISH,'operation_type':'demand','preconditions':['Service\x20is\x20published\x20and\x20not\x20paused\x20(eligible\x20to\x20be\x20presented\x20into\x20the\x20Demand).','This\x20account\x20holds\x20the\x20Demand\x27s\x20Permission\x20(owner)\x20to\x20publish\x20and\x20later\x20score/select\x20presenters.'],'rationale':'Publish\x20a\x20Demand\x20encoding\x20the\x20requirement\x20so\x20'+a['object']+'\x20(and\x20peers)\x20can\x20present\x20(demand.present_service*);\x20then\x20feedback\x20(acceptance_score)\x20+\x20select\x20forms\x20the\x20Order\x20via\x20'+OP_SERVICE_ORDER_NEW+'\x20(see\x20nextOperationForServiceOrder).'};}export function nextOperationForServiceOrder(a){return{'operation':OP_SERVICE_ORDER_NEW,'operation_type':'service','preconditions':['Service\x20is\x20published\x20and\x20not\x20paused\x20(E1\x20gate\x20of\x20pre-purchase\x20due\x20diligence).','Pin\x20each\x20sale\x20item\x27s\x20wip_hash\x20in\x20the\x20buy\x20items\x20—\x20prevents\x20WIP\x20swap\x20between\x20viewing\x20and\x20ordering.','If\x20Service.buy_guard\x20is\x20non-empty,\x20obtain\x20a\x20valid\x20passport\x20first\x20(buy\x20requires\x20guard\x20validation).','If\x20Service.customer_required\x20is\x20non-empty,\x20deliver\x20the\x20required\x20info\x20to\x20the\x20Service\x27s\x20Contact\x20via\x20Messenger\x20and\x20attach\x20the\x20Contact\x20/\x20WTS\x20Proof\x20as\x20order_required_info.','If\x20this\x20selection\x20follows\x20a\x20Demand\x20you\x20published\x20with\x20presenters:\x20score\x20the\x20presenters\x20first\x20(demand\x20feedback\x20→\x20acceptance_score)\x20—\x20skipping\x20feedback\x20damages\x20your\x20acceptance_score\x20reputation.','Sufficient\x20balance\x20for\x20the\x20total\x20price\x20plus\x20gas;\x20payment\x20is\x20escrowed\x20in\x20the\x20Order\x20until\x20Allocation\x20settlement.'],'rationale':'Create\x20the\x20Order\x20on\x20the\x20chosen\x20service\x20'+a['object']+'\x20('+OP_SERVICE_ORDER_NEW+')\x20—\x20the\x20transaction-formation\x20step:\x20Order\x20+\x20Progress\x20+\x20Allocation\x20are\x20created\x20atomically,\x20then\x20Progress\x20advances\x20through\x20the\x20Machine\x20and\x20Allocation\x20settles\x20the\x20payment.'};}
@@ -1 +1 @@
1
- import{distillIntent,extractSignals}from'./intent-distill.js';import{getProfile,updateFromOperation}from'./user-profile.js';import{findMatches,recordSignature}from'./experience-reuse.js';import{EXPERIENCE_LAYER_VERSION}from'./types.js';import{isEnabled as a39a}from'../config/index.js';import{recordIndustrySignal}from'../knowledge/flywheel-loop.js';export{EXPERIENCE_LAYER_VERSION};export function getExperienceFeedback(a,b,c){try{const d=distillIntent(a,b,c),e=findMatches(d['primary_intent'],a,b,0x3);if(e['length']===0x0)return undefined;const f=e[0x0],g=getProfile();return formatFeedback(f,e,d['scenario'],g);}catch{return undefined;}}export function recordOperationOutcome(a,b,c,d,e,f=[]){try{const g=distillIntent(a,b,c),h=extractSignals(a,b);recordSignature({'intent':g['primary_intent'],'scenario':g['scenario'],'signals':h,'timestamp':Date['now'](),'outcome':d,'error_code':e}),updateFromOperation(g['primary_intent'],g['scenario'],d,e,f);try{if(a39a('industry_evolution')){const i=typeof b?.['industry']==='string'&&b['industry']['trim']()?b['industry']['trim']():undefined;if(i){const j=d==='success'?{'success':!![]}:{'success':![],'error_code':e};recordIndustrySignal(i,{'type':a,'data':b},j);}}}catch{}}catch{}}function formatFeedback(a,b,c,d){const e=buildAdviceText(a,b,d),f=collectAvoidList(b,d),g=a['relevance'],h=c??a['signature']['scenario'],i={};if(e)i['advice']=e;if(f['length']>0x0)i['avoid']=f;if(g>0x0)i['relevance']=Math['round'](g*0x64)/0x64;if(h)i['matched_scenario']=h;return i;}function buildAdviceText(a,b,c){const d=[];if(a['signature']['outcome']==='success')d['push']('Historically,\x20'+a['signature']['intent']+'\x20operation\x20succeeded');else a['signature']['outcome']==='failed'&&d['push']('Historically,\x20'+a['signature']['intent']+'\x20operation\x20failed\x20('+(a['signature']['error_code']??'unknown\x20error')+'),\x20pay\x20special\x20attention\x20to\x20parameters');return c['expertise_tier']==='novice'&&b['length']>0x0&&d['push']('It\x20is\x20recommended\x20to\x20carefully\x20check\x20parameters\x20before\x20executing'),d['join'](';\x20')||a['advice'];}function collectAvoidList(b,c){const d=new Set();for(const e of b){for(const f of e['avoid']){d['add'](f);}}for(const g of c['frequent_pitfalls']){d['add']('You\x20often\x20make\x20mistakes\x20at\x20the\x20'+g+'\x20step,\x20please\x20be\x20especially\x20careful');}return Array['from'](d)['slice'](0x0,0x5);}
1
+ import{distillIntent,extractSignals}from'./intent-distill.js';import{getProfile,updateFromOperation}from'./user-profile.js';import{findMatches,recordSignature}from'./experience-reuse.js';import{EXPERIENCE_LAYER_VERSION}from'./types.js';import{isEnabled as a42a}from'../config/index.js';import{recordIndustrySignal}from'../knowledge/flywheel-loop.js';export{EXPERIENCE_LAYER_VERSION};export function getExperienceFeedback(a,b,c){try{const d=distillIntent(a,b,c),e=findMatches(d['primary_intent'],a,b,0x3);if(e['length']===0x0)return undefined;const f=e[0x0],g=getProfile();return formatFeedback(f,e,d['scenario'],g);}catch{return undefined;}}export function recordOperationOutcome(a,b,c,d,e,f=[]){try{const g=distillIntent(a,b,c),h=extractSignals(a,b);recordSignature({'intent':g['primary_intent'],'scenario':g['scenario'],'signals':h,'timestamp':Date['now'](),'outcome':d,'error_code':e}),updateFromOperation(g['primary_intent'],g['scenario'],d,e,f);try{if(a42a('industry_evolution')){const i=typeof b?.['industry']==='string'&&b['industry']['trim']()?b['industry']['trim']():undefined;if(i){const j=d==='success'?{'success':!![]}:{'success':![],'error_code':e};recordIndustrySignal(i,{'type':a,'data':b},j);}}}catch{}}catch{}}function formatFeedback(a,b,c,d){const e=buildAdviceText(a,b,d),f=collectAvoidList(b,d),g=a['relevance'],h=c??a['signature']['scenario'],i={};if(e)i['advice']=e;if(f['length']>0x0)i['avoid']=f;if(g>0x0)i['relevance']=Math['round'](g*0x64)/0x64;if(h)i['matched_scenario']=h;return i;}function buildAdviceText(a,b,c){const d=[];if(a['signature']['outcome']==='success')d['push']('Historically,\x20'+a['signature']['intent']+'\x20operation\x20succeeded');else a['signature']['outcome']==='failed'&&d['push']('Historically,\x20'+a['signature']['intent']+'\x20operation\x20failed\x20('+(a['signature']['error_code']??'unknown\x20error')+'),\x20pay\x20special\x20attention\x20to\x20parameters');return c['expertise_tier']==='novice'&&b['length']>0x0&&d['push']('It\x20is\x20recommended\x20to\x20carefully\x20check\x20parameters\x20before\x20executing'),d['join'](';\x20')||a['advice'];}function collectAvoidList(b,c){const d=new Set();for(const e of b){for(const f of e['avoid']){d['add'](f);}}for(const g of c['frequent_pitfalls']){d['add']('You\x20often\x20make\x20mistakes\x20at\x20the\x20'+g+'\x20step,\x20please\x20be\x20especially\x20careful');}return Array['from'](d)['slice'](0x0,0x5);}
@@ -18,9 +18,6 @@ export interface CapabilityBenefitProfile {
18
18
  export interface CapabilityConstraints {
19
19
  must_pair_with?: string[];
20
20
  conflicts_with?: string[];
21
- max_single_transaction?: number;
22
- requires_evidence?: boolean;
23
- other_constraints?: string[];
24
21
  }
25
22
  export interface CapabilityCard {
26
23
  capability_id: string;
@@ -30,96 +27,18 @@ export interface CapabilityCard {
30
27
  module: CapabilityModule;
31
28
  category: CapabilityCategory;
32
29
  industry_agnostic: IndustryAgnostic;
33
- config_template: Record<string, unknown>;
34
- industry_overrides?: Record<string, Record<string, unknown>>;
35
- observed_in_industries: Record<string, number>;
36
- success_count: number;
37
- failure_count: number;
38
- known_failure_modes: string[];
39
- depends_on_capabilities?: string[];
40
- referenced_by_skills?: string[];
41
30
  risk_profile?: CapabilityRiskProfile;
42
31
  benefit_profile?: CapabilityBenefitProfile;
43
32
  constraints?: CapabilityConstraints;
44
- version: string;
45
- superseded_by?: string;
46
- }
47
- export interface CapabilityGraphEdge {
48
- from: string;
49
- to: string;
50
- edge_kind: "requires" | "optional" | "conflicts";
51
- phase: "create" | "publish" | "runtime";
52
- description?: string;
53
- }
54
- export interface CapabilityGraph {
55
- nodes: Map<string, CapabilityCard>;
56
- edges: CapabilityGraphEdge[];
57
- }
58
- export interface MigrationEvaluation {
59
- feasibility_score: number;
60
- covered_capabilities: string[];
61
- missing_capabilities: string[];
62
- conflicting_capabilities: Array<{
63
- capability_id: string;
64
- source_config: unknown;
65
- target_config: unknown;
66
- diff_summary: string;
67
- }>;
68
- recommendations: string[];
69
- }
70
- export interface CoverageReport {
71
- industry: string;
72
- declared_count: number;
73
- expected_count: number;
74
- coverage_percentage: number;
75
- missing_capabilities: string[];
76
- }
77
- export interface ExperienceUpdate {
78
- capability_id: string;
79
- update_type: "config_template" | "industry_overrides" | "known_failure_modes" | "new_card";
80
- payload: unknown;
81
- source: string;
82
- }
83
- export interface VerificationReport {
84
- project_id: string;
85
- industry: string;
86
- result: "success" | "failure" | "partial";
87
- capabilities_used: string[];
88
- failure_reasons?: string[];
89
33
  }
90
34
  export declare class CapabilityRegistry {
91
35
  private static instance;
92
36
  private cards;
93
- private edges;
94
- private initialized;
95
37
  static Instance(): CapabilityRegistry;
96
38
  private constructor();
97
39
  registerCard(card: CapabilityCard): boolean;
98
40
  getCard(capabilityId: string): CapabilityCard | undefined;
99
- listCards(filter?: {
100
- objectType?: ProjectObjectType;
101
- module?: CapabilityModule;
102
- industryAgnostic?: IndustryAgnostic;
103
- industry?: string;
104
- }): CapabilityCard[];
105
- registerEdge(edge: CapabilityGraphEdge): void;
106
- getGraph(): CapabilityGraph;
107
- getDependencies(capabilityId: string): CapabilityCard[];
108
- getDependents(capabilityId: string): CapabilityCard[];
109
- getCapabilitiesByIndustry(industry: string): CapabilityCard[];
110
- getCapabilitiesByObject(objectType: ProjectObjectType): CapabilityCard[];
111
- evaluateMigration(source: string, target: string): MigrationEvaluation;
112
- findPurityViolations(): CapabilityCard[];
113
- recordUsage(capabilityId: string, industry: string): void;
114
- recordSuccess(capabilityId: string): void;
115
- recordFailure(capabilityId: string, reason: string): void;
116
- recordVerificationReport(report: VerificationReport): void;
117
- getCapabilitiesForExtension(capabilitiesUsed: string[]): CapabilityCard[];
118
- evaluateExtensionCoverage(industry: string, capabilitiesUsed: string[]): CoverageReport;
119
41
  private registerBuiltins;
120
- private registerBuiltinEdges;
121
- private computeConfigDiff;
122
42
  }
123
43
  export declare function getCapabilityRegistry(): CapabilityRegistry;
124
- export declare const CAPABILITY_MANIFEST_VERSION = 1;
125
- export declare function recordCapabilitiesUsed(industry: string, capabilitiesUsed: string[]): void;
44
+ export declare const CAPABILITY_MANIFEST_VERSION = 2;
@@ -1 +1 @@
1
- export class CapabilityRegistry{static ['instance'];['cards']=new Map();['edges']=[];['initialized']=![];static['Instance'](){return!CapabilityRegistry['instance']&&(CapabilityRegistry['instance']=new CapabilityRegistry()),CapabilityRegistry['instance'];}constructor(){this['registerBuiltins'](),this['registerBuiltinEdges'](),this['initialized']=!![];}['registerCard'](a){if(!a['capability_id']||!a['object_type']||!a['module'])return![];return this['cards']['set'](a['capability_id'],a),!![];}['getCard'](a){return this['cards']['get'](a);}['listCards'](a){let b=Array['from'](this['cards']['values']());if(!a)return b;if(a['objectType'])b=b['filter'](d=>d['object_type']===a['objectType']);if(a['module'])b=b['filter'](d=>d['module']===a['module']);if(a['industryAgnostic'])b=b['filter'](d=>d['industry_agnostic']===a['industryAgnostic']);if(a['industry'])b=b['filter'](d=>d['observed_in_industries'][a['industry']]!==undefined||d['industry_overrides']?.[a['industry']]!==undefined);return b;}['registerEdge'](a){this['edges']['push'](a);}['getGraph'](){return{'nodes':new Map(this['cards']),'edges':[...this['edges']]};}['getDependencies'](a){const b=new Set(),c=[],d=e=>{if(b['has'](e))return;b['add'](e);for(const f of this['edges']){if(f['from']===e&&f['edge_kind']==='requires'){const g=this['cards']['get'](f['to']);g&&!b['has'](g['capability_id'])&&(c['push'](g),d(f['to']));}}};return d(a),c;}['getDependents'](a){const b=[];for(const c of this['edges']){if(c['to']===a&&c['edge_kind']==='requires'){const d=this['cards']['get'](c['from']);if(d)b['push'](d);}}return b;}['getCapabilitiesByIndustry'](a){return this['listCards']({'industry':a});}['getCapabilitiesByObject'](a){return this['listCards']({'objectType':a});}['evaluateMigration'](a,b){const c=this['getCapabilitiesByIndustry'](a),d=this['getCapabilitiesByIndustry'](b),e=new Set(c['map'](l=>l['capability_id'])),f=new Set(d['map'](l=>l['capability_id'])),g=[],h=[],i=[];for(const l of e){if(f['has'](l)){g['push'](l);const m=c['find'](p=>p['capability_id']===l),n=d['find'](p=>p['capability_id']===l),o=this['computeConfigDiff'](m['industry_overrides']?.[a]??m['config_template'],n['industry_overrides']?.[b]??n['config_template']);o['diff_ratio']>0.5&&i['push']({'capability_id':l,'source_config':m['industry_overrides']?.[a]??m['config_template'],'target_config':n['industry_overrides']?.[b]??n['config_template'],'diff_summary':o['summary']});}}for(const p of f){if(!e['has'](p))h['push'](p);}const j=g['length']===0x0&&h['length']===0x0?0x0:Math['round']((g['length']-i['length'])/(g['length']+h['length'])*0x64),k=[];h['length']>0x0&&k['push']('Missing\x20'+h['length']+'\x20capabilities,\x20need\x20to\x20add:\x20'+h['slice'](0x0,0x5)['join'](',\x20')+(h['length']>0x5?'...':''));i['length']>0x0&&k['push']('Detected\x20'+i['length']+'\x20capabilities\x20with\x20large\x20parameter\x20differences,\x20need\x20to\x20rewrite\x20configuration');if(j>=0x50)k['push']('Migration\x20feasibility\x20is\x20high,\x20most\x20capabilities\x20can\x20be\x20reused\x20directly');else j>=0x32?k['push']('Migration\x20feasibility\x20is\x20medium,\x20need\x20to\x20supplement\x20or\x20rewrite\x20some\x20capabilities'):k['push']('Migration\x20feasibility\x20is\x20low,\x20recommend\x20regenerating\x20the\x20plan\x20based\x20on\x20the\x20target\x20industry\x20template');return{'feasibility_score':j,'covered_capabilities':g,'missing_capabilities':h,'conflicting_capabilities':i,'recommendations':k};}['findPurityViolations'](){return Array['from'](this['cards']['values']())['filter'](a=>{if(a['industry_agnostic']!=='high')return![];const b=a['industry_overrides']?Object['keys'](a['industry_overrides'])['length']:0x0;return b>=0x3;});}['recordUsage'](a,b){const c=this['cards']['get'](a);if(!c)return;!c['observed_in_industries'][b]&&(c['observed_in_industries'][b]=0x0),c['observed_in_industries'][b]++;}['recordSuccess'](a){const b=this['cards']['get'](a);if(b)b['success_count']++;}['recordFailure'](a,b){const c=this['cards']['get'](a);if(!c)return;c['failure_count']++,b&&!c['known_failure_modes']['includes'](b)&&c['known_failure_modes']['push'](b);}['recordVerificationReport'](a){for(const b of a['capabilities_used']){this['recordUsage'](b,a['industry']);if(a['result']==='success')this['recordSuccess'](b);else{if(a['result']==='failure'){const c=a['failure_reasons']?.[0x0]??'unknown\x20failure';this['recordFailure'](b,c);}}}}['getCapabilitiesForExtension'](a){return a['map'](b=>this['cards']['get'](b))['filter'](b=>b!==undefined);}['evaluateExtensionCoverage'](a,b){const c=b['length'],d=this['getCapabilitiesByIndustry'](a),e=d['length']||c,f=d['filter'](h=>!b['includes'](h['capability_id']))['map'](h=>h['capability_id']),g=e===0x0?0x64:Math['round'](c/e*0x64);return{'industry':a,'declared_count':c,'expected_count':e,'coverage_percentage':Math['min'](g,0x64),'missing_capabilities':f};}['registerBuiltins'](){this['registerCard']({'capability_id':'permission.index_create','display_name':'Permission\x20Index\x20Create','description':'Create\x20role\x20permission\x20index,\x20supports\x20multi-role\x20permission\x20assignment\x20such\x20as\x20merchant/customer/arbiter','object_type':'permission','module':'handler','category':'trust','industry_agnostic':'high','config_template':{'permission_indexes':[{'name':'merchant','description':'Service\x20owner'},{'name':'customer','description':'Service\x20buyer'}]},'industry_overrides':{'education':{'permission_indexes':[{'name':'teacher','description':'Course\x20provider'},{'name':'student','description':'Course\x20consumer'},{'name':'parent','description':'Guardian\x20(minor)'}]},'travel':{'permission_indexes':[{'name':'guide','description':'Tour\x20guide'},{'name':'tourist','description':'Tour\x20participant'}]}},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':[],'depends_on_capabilities':[],'version':'v1','risk_profile':{'funds_risk':'low','trust_risk':'low','delivery_risk':'low','compliance_risk':'low','known_risks':['Index\x20proliferation\x20without\x20naming\x20convention\x20makes\x20permission\x20audits\x20harder']},'benefit_profile':{'automation_level':'medium','trust_boost':'high','efficiency_gain':'medium','benefits':['Role-based\x20governance\x20foundation\x20for\x20all\x20other\x20objects']}}),this['registerCard']({'capability_id':'permission.role_assign','display_name':'Permission\x20Role\x20Assign','description':'Assign\x20role\x20permission\x20index\x20to\x20objects\x20(Machine/Service/Allocation)','object_type':'permission','module':'handler','category':'trust','industry_agnostic':'high','config_template':{'target_object':'<obj>','role':'<role_name>'},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':[],'depends_on_capabilities':['permission.index_create'],'version':'v1','risk_profile':{'funds_risk':'low','trust_risk':'medium','delivery_risk':'low','compliance_risk':'low','known_risks':['Mis-assigned\x20role\x20grants\x20unintended\x20operational\x20authority']},'benefit_profile':{'automation_level':'high','trust_boost':'high','efficiency_gain':'medium','benefits':['Binds\x20governance\x20roles\x20to\x20concrete\x20objects']}}),this['registerCard']({'capability_id':'guard.validate_buy','display_name':'Guard\x20Validate\x20Buy','description':'Order\x20validation:\x20check\x20buyer\x20eligibility,\x20order\x20parameters,\x20inventory\x20and\x20other\x20conditions','object_type':'guard','module':'handler','category':'validation','industry_agnostic':'medium','config_template':{'host':'service','templates':[]},'industry_overrides':{'retail':{'templates':['tpl_check_inventory','tpl_check_buyer_address']},'freelance':{'templates':['tpl_check_buyer_budget','tpl_check_freelancer_available']},'rental':{'templates':['tpl_check_deposit','tpl_check_item_available']}},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':[],'depends_on_capabilities':['permission.index_create'],'version':'v1','risk_profile':{'funds_risk':'low','trust_risk':'medium','delivery_risk':'medium','compliance_risk':'low','known_risks':['Over-strict\x20buy\x20validation\x20blocks\x20legitimate\x20orders;\x20over-loose\x20validation\x20admits\x20fraud']},'benefit_profile':{'automation_level':'high','trust_boost':'high','efficiency_gain':'high','benefits':['Automated\x20purchase\x20gating\x20without\x20manual\x20review']}}),this['registerCard']({'capability_id':'guard.validate_wip_hash','display_name':'Guard\x20Validate\x20WIP\x20Hash','description':'Validate\x20WIP\x20(Work-In-Progress)\x20hash,\x20used\x20for\x20milestone\x20validation\x20of\x20digital\x20deliverables','object_type':'guard','module':'handler','category':'evidence','industry_agnostic':'low','config_template':{'host':'machine','templates':['tpl_validate_wip_hash']},'industry_overrides':{'freelance':{'templates':['tpl_validate_wip_hash','tpl_validate_deliverable_format']}},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':['milestone\x20mode\x20requires\x20WIP\x20hash\x20evidence\x20—\x20without\x20WIP,\x20allocation\x20cannot\x20advance'],'depends_on_capabilities':['guard.validate_buy'],'version':'v1','risk_profile':{'funds_risk':'low','trust_risk':'medium','delivery_risk':'high','compliance_risk':'low','known_risks':['Wrong\x20hash\x20algorithm\x20or\x20field\x20mapping\x20stalls\x20milestone\x20release']},'benefit_profile':{'automation_level':'high','trust_boost':'medium','efficiency_gain':'medium','benefits':['Tamper-proof\x20delivery\x20evidence\x20for\x20digital\x20deliverables']}}),this['registerCard']({'capability_id':'machine.node_topology','display_name':'Machine\x20Node\x20Topology','description':'Workflow\x20node\x20topology:\x20define\x20the\x20state\x20machine\x20from\x20order\x20creation\x20to\x20completion','object_type':'machine','module':'templates','category':'workflow','industry_agnostic':'low','config_template':{'nodes':[{'name':'paid','role':'Entry:\x20order\x20created\x20and\x20paid'},{'name':'delivering','role':'Service\x20delivery\x20in\x20progress'},{'name':'delivered','role':'Deliverable\x20available\x20for\x20review'},{'name':'completed','role':'Service\x20completed,\x20funds\x20released'},{'name':'cancelled','role':'Pre-delivery\x20cancellation\x20—\x20triggers\x20refund\x20Allocator'}]},'industry_overrides':{'retail':{'nodes':[{'name':'paid','role':'Order\x20paid'},{'name':'shipped','role':'Goods\x20shipped'},{'name':'delivered','role':'Goods\x20delivered'},{'name':'confirmed','role':'Buyer\x20confirms\x20receipt'},{'name':'completed','role':'Funds\x20released'},{'name':'returned','role':'Buyer\x20ships\x20goods\x20back\x20—\x20triggers\x20refund\x20Allocator\x20(R-M1-11)'},{'name':'cancelled','role':'Pre-ship\x20cancellation'}]},'freelance':{'nodes':[{'name':'paid','role':'Order\x20paid\x20(escrow)'},{'name':'in_progress','role':'Freelancer\x20working'},{'name':'submitted','role':'Work\x20submitted\x20for\x20review'},{'name':'accepted','role':'Buyer\x20accepts\x20deliverable'},{'name':'completed','role':'Funds\x20released'},{'name':'revision','role':'Revision\x20requested'},{'name':'cancelled','role':'Pre-start\x20cancellation\x20—\x20triggers\x20refund\x20Allocator\x20(R-M1-11)'}]}},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':[],'depends_on_capabilities':['permission.index_create'],'version':'v1','risk_profile':{'funds_risk':'low','trust_risk':'medium','delivery_risk':'high','compliance_risk':'low','known_risks':['Dead-end\x20nodes\x20or\x20missing\x20refund\x20paths\x20trap\x20order\x20funds']},'benefit_profile':{'automation_level':'medium','trust_boost':'medium','efficiency_gain':'high','benefits':['Declarative\x20workflow\x20from\x20order\x20creation\x20to\x20completion']}}),this['registerCard']({'capability_id':'treasury.owner_receive','display_name':'Treasury\x20Owner\x20Receive','description':'Fund\x20escrow:\x20supports\x20owner_receive\x20mode,\x20funds\x20go\x20directly\x20into\x20the\x20object\x20owner\x20wallet','object_type':'treasury','module':'handler','category':'fund_flow','industry_agnostic':'high','config_template':{'owner_receive':!![]},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':[],'depends_on_capabilities':[],'version':'v1','risk_profile':{'funds_risk':'high','trust_risk':'medium','delivery_risk':'low','compliance_risk':'low','known_risks':['Direct\x20fund\x20custody\x20—\x20misconfigured\x20owner\x20diverts\x20all\x20proceeds']},'benefit_profile':{'automation_level':'high','trust_boost':'medium','efficiency_gain':'medium','benefits':['Automated\x20escrow\x20and\x20owner\x20settlement']}}),this['registerCard']({'capability_id':'allocation.distribute','display_name':'Multi-tier\x20Allocation\x20Distribution','description':'Multi-tier\x20allocation:\x20supports\x20distributing\x20funds\x20to\x20multiple\x20recipients\x20by\x20ratio\x20/\x20by\x20order\x20/\x20by\x20condition','object_type':'allocation','module':'handler','category':'fund_flow','industry_agnostic':'medium','config_template':{'strategy':{'recipient':'entity','count':0x1,'mode':'surplus','description':'Default:\x20all\x20to\x20service\x20owner'}},'industry_overrides':{'retail':{'strategy':{'recipient':'entity','count':0x2,'mode':'rate','description':'Platform\x2010%\x20+\x20Merchant\x2090%'}},'freelance':{'strategy':{'recipient':'entity','count':0x2,'mode':'milestone','description':'50%\x20upfront\x20+\x2050%\x20on\x20delivery'}},'travel':{'strategy':{'recipient':'entity','count':0x3,'mode':'rate','description':'Guide\x2060%\x20+\x20Platform\x2030%\x20+\x20Insurance\x2010%'}}},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':['milestone\x20mode\x20requires\x20WIP\x20hash\x20evidence\x20—\x20without\x20WIP,\x20allocation\x20cannot\x20advance'],'depends_on_capabilities':['treasury.owner_receive','guard.validate_buy'],'version':'v1','risk_profile':{'funds_risk':'high','trust_risk':'low','delivery_risk':'medium','compliance_risk':'low','known_risks':['Wrong\x20split\x20ratios\x20or\x20recipient\x20addresses\x20misdirect\x20settlement\x20funds']},'benefit_profile':{'automation_level':'high','trust_boost':'medium','efficiency_gain':'high','benefits':['Multi-recipient\x20settlement\x20without\x20manual\x20transfers']}}),this['registerCard']({'capability_id':'allocation.distribute_milestone','display_name':'Milestone-based\x20Allocation','description':'Milestone\x20allocation:\x20release\x20funds\x20by\x20delivery\x20milestones,\x20each\x20milestone\x20requires\x20WIP\x20hash\x20validation','object_type':'allocation','module':'handler','category':'fund_flow','industry_agnostic':'low','config_template':{'strategy':{'recipient':'entity','count':0x2,'mode':'milestone','description':'Milestone-based\x20release'}},'industry_overrides':{'freelance':{'strategy':{'recipient':'entity','count':0x2,'mode':'milestone','description':'50%\x20upfront\x20+\x2050%\x20on\x20delivery'}},'education':{'strategy':{'recipient':'entity','count':0x2,'mode':'milestone','description':'Per\x20session\x20release'}}},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':[],'depends_on_capabilities':['allocation.distribute','guard.validate_wip_hash'],'version':'v1','risk_profile':{'funds_risk':'high','trust_risk':'medium','delivery_risk':'medium','compliance_risk':'low','known_risks':['Stuck\x20milestone\x20gates\x20lock\x20buyer\x20funds\x20until\x20evidence\x20is\x20supplied']},'benefit_profile':{'automation_level':'medium','trust_boost':'high','efficiency_gain':'medium','benefits':['Evidence-gated\x20release\x20protects\x20both\x20buyer\x20and\x20provider']}}),this['registerCard']({'capability_id':'service.publish','display_name':'Service\x20Publish','description':'Publish\x20Service\x20object\x20on-chain,\x20bind\x20Machine/Guard/Permission/Allocation\x20and\x20other\x20dependencies','object_type':'service','module':'handler','category':'lifecycle','industry_agnostic':'high','config_template':{'machine':'<machine_name>','buy_guard':'<guard_name>','permission':'<permission_name>','order_allocators':['<allocation_name>'],'compensation_fund_balance':0x0,'compensation_fund_add_hint':'Post-publish:\x20call\x20service.compensation_fund_add\x20with\x20Coin<T>.\x20Recommend\x203-10×\x20max\x20single-order\x20amount\x20(industry-specific:\x20subscription\x203×,\x20retail\x205×,\x20rental\x2010×).'},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':[],'depends_on_capabilities':['machine.node_topology','guard.validate_buy','permission.index_create','allocation.distribute','treasury.owner_receive'],'version':'v1','risk_profile':{'funds_risk':'medium','trust_risk':'medium','delivery_risk':'medium','compliance_risk':'medium','known_risks':['Publish\x20freezes\x20machine\x20binding\x20and\x20order_allocators\x20permanently\x20(E_ALREADY_PUBLISHED)']},'benefit_profile':{'automation_level':'medium','trust_boost':'medium','efficiency_gain':'medium','benefits':['On-chain\x20discoverability\x20and\x20order\x20intake']}}),this['registerCard']({'capability_id':'progress.advance','display_name':'Progress\x20Advance','description':'Order\x20fulfillment\x20progress\x20advance:\x20advance\x20to\x20next\x20state\x20based\x20on\x20Machine\x20node\x20topology','object_type':'progress','module':'handler','category':'workflow','industry_agnostic':'medium','config_template':{'parent':'<machine_name>'},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':[],'depends_on_capabilities':['machine.node_topology'],'version':'v1','risk_profile':{'funds_risk':'medium','trust_risk':'low','delivery_risk':'high','compliance_risk':'low','known_risks':['Forward\x20without\x20authorized\x20executor\x20permanently\x20stalls\x20the\x20order']},'benefit_profile':{'automation_level':'high','trust_boost':'medium','efficiency_gain':'high','benefits':['Deterministic\x20order\x20state\x20progression']}}),this['registerCard']({'capability_id':'arb.vote_weighted','display_name':'Arbitration\x20Vote\x20Weighted','description':'guard-based\x20weighted\x20voting\x20arbitration:\x20vote\x20by\x20Guard\x20weight\x20to\x20determine\x20arbitration\x20result','object_type':'arb','module':'handler','category':'trust','industry_agnostic':'medium','config_template':{'guard':'<guard_name>','voting_rule':'guard_weighted'},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':[],'depends_on_capabilities':['guard.validate_buy'],'version':'v1','risk_profile':{'funds_risk':'low','trust_risk':'high','delivery_risk':'medium','compliance_risk':'medium','known_risks':['Shared\x20permission\x20with\x20Service\x20destroys\x20dispute\x20independence\x20(E_ARBITRATION_PERMISSION_CONFLICT)']},'benefit_profile':{'automation_level':'medium','trust_boost':'high','efficiency_gain':'low','benefits':['Neutral\x20third-party\x20dispute\x20resolution']}}),this['registerCard']({'capability_id':'reward.claim_guard','display_name':'Reward\x20Claim\x20Guard','description':'Reward\x20claim:\x20release\x20reward\x20after\x20validating\x20claim\x20conditions\x20(such\x20as\x20positive\x20review,\x20repurchase)\x20via\x20Guard','object_type':'reward','module':'handler','category':'fund_flow','industry_agnostic':'medium','config_template':{'claim_guard':'<guard_name>','max_guard_count':0x1},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':[],'depends_on_capabilities':['guard.validate_buy'],'version':'v1','risk_profile':{'funds_risk':'medium','trust_risk':'low','delivery_risk':'low','compliance_risk':'low','known_risks':['Loose\x20claim\x20conditions\x20drain\x20the\x20reward\x20pool']},'benefit_profile':{'automation_level':'high','trust_boost':'medium','efficiency_gain':'medium','benefits':['Incentivizes\x20reviews\x20and\x20repurchase']}}),this['registerCard']({'capability_id':'contact.im_create','display_name':'Contact\x20IM\x20Create','description':'Create\x20IM\x20contact\x20object:\x20buyer\x20and\x20seller\x20communicate\x20via\x20Messenger','object_type':'contact','module':'handler','category':'communication','industry_agnostic':'high','config_template':{},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':[],'depends_on_capabilities':[],'version':'v1','risk_profile':{'funds_risk':'low','trust_risk':'low','delivery_risk':'low','compliance_risk':'low','known_risks':['Unattended\x20IM\x20channel\x20degrades\x20dispute\x20response\x20time']},'benefit_profile':{'automation_level':'medium','trust_boost':'medium','efficiency_gain':'medium','benefits':['Direct\x20buyer-seller\x20encrypted\x20communication']}}),this['registerCard']({'capability_id':'demand.matching','display_name':'Demand\x20Matching','description':'Demand\x20matching:\x20match\x20corresponding\x20Service\x20based\x20on\x20user\x20demand','object_type':'demand','module':'handler','category':'query','industry_agnostic':'high','config_template':{},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':[],'depends_on_capabilities':['service.publish'],'version':'v1','risk_profile':{'funds_risk':'low','trust_risk':'low','delivery_risk':'low','compliance_risk':'low','known_risks':['Poor\x20matching\x20signals\x20bury\x20quality\x20services']},'benefit_profile':{'automation_level':'medium','trust_boost':'low','efficiency_gain':'medium','benefits':['Demand-side\x20discovery\x20channel']}}),this['registerCard']({'capability_id':'repository.write_validate','display_name':'Repository\x20Write\x20Validate','description':'Knowledge\x20base\x20write\x20validation:\x20validate\x20write\x20permissions\x20and\x20data\x20format\x20via\x20Guard','object_type':'repository','module':'handler','category':'validation','industry_agnostic':'high','config_template':{},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':[],'depends_on_capabilities':['guard.validate_buy'],'version':'v1','risk_profile':{'funds_risk':'low','trust_risk':'medium','delivery_risk':'low','compliance_risk':'medium','known_risks':['Unvalidated\x20writes\x20pollute\x20the\x20knowledge\x20base\x20with\x20unverifiable\x20claims']},'benefit_profile':{'automation_level':'medium','trust_boost':'high','efficiency_gain':'medium','benefits':['Guard-gated\x20attestation\x20for\x20off-chain\x20data']}}),this['registerCard']({'capability_id':'proof.evidence_anchor','display_name':'Proof\x20Evidence\x20Anchor','description':'Evidence\x20on-chain:\x20anchor\x20delivery\x20evidence\x20(hash)\x20to\x20on-chain\x20Progress\x20node','object_type':'proof','module':'handler','category':'evidence','industry_agnostic':'medium','config_template':{},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':[],'depends_on_capabilities':['progress.advance'],'version':'v1','risk_profile':{'funds_risk':'low','trust_risk':'medium','delivery_risk':'low','compliance_risk':'low','known_risks':['Anchored\x20evidence\x20is\x20immutable\x20—\x20wrong\x20hash\x20cannot\x20be\x20corrected']},'benefit_profile':{'automation_level':'high','trust_boost':'high','efficiency_gain':'medium','benefits':['Immutable\x20WTS\x20evidence\x20for\x20Messenger\x20confirmations']}}),this['registerCard']({'capability_id':'personal.profile_manage','display_name':'Personal\x20Profile\x20Manage','description':'Personal\x20profile\x20management:\x20user\x20identity/preference/history\x20management','object_type':'personal','module':'handler','category':'data_model','industry_agnostic':'high','config_template':{},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':[],'depends_on_capabilities':[],'version':'v1','risk_profile':{'funds_risk':'low','trust_risk':'low','delivery_risk':'low','compliance_risk':'medium','known_risks':['Profile\x20data\x20may\x20fall\x20under\x20privacy\x20regulation\x20(PII)']},'benefit_profile':{'automation_level':'medium','trust_boost':'low','efficiency_gain':'low','benefits':['Portable\x20user\x20identity\x20across\x20services']}}),this['registerCard']({'capability_id':'payment.settle','display_name':'Payment\x20Settle','description':'Payment\x20settlement:\x20complete\x20fund\x20settlement\x20in\x20collaboration\x20with\x20Allocation','object_type':'payment','module':'handler','category':'fund_flow','industry_agnostic':'high','config_template':{},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':[],'depends_on_capabilities':['allocation.distribute','treasury.owner_receive'],'version':'v1','risk_profile':{'funds_risk':'high','trust_risk':'low','delivery_risk':'low','compliance_risk':'medium','known_risks':['Settlement\x20errors\x20are\x20irreversible\x20once\x20funds\x20transfer']},'benefit_profile':{'automation_level':'high','trust_boost':'low','efficiency_gain':'high','benefits':['Atomic\x20settlement\x20in\x20collaboration\x20with\x20Allocation']}}),this['registerCard']({'capability_id':'guard.validate_withdraw','display_name':'Guard\x20Validate\x20Withdraw','description':'Withdrawal\x20validation:\x20gate\x20fund\x20release\x20from\x20Allocation\x20escrow\x20on\x20delivery\x20confirmation','object_type':'guard','module':'handler','category':'validation','industry_agnostic':'medium','config_template':{'host':'service','templates':['tpl_withdraw_on_completed']},'industry_overrides':{'retail_d2c':{'templates':['tpl_withdraw_on_completed']}},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':['Withdraw\x20gate\x20on\x20wrong\x20node\x20lets\x20merchant\x20pull\x20funds\x20before\x20delivery'],'depends_on_capabilities':['allocation.distribute'],'version':'v1','risk_profile':{'funds_risk':'high','trust_risk':'medium','delivery_risk':'medium','compliance_risk':'low','known_risks':['Mis-gated\x20withdrawal\x20releases\x20escrowed\x20funds\x20prematurely']},'benefit_profile':{'automation_level':'high','trust_boost':'high','efficiency_gain':'high','benefits':['Contract-enforced\x20delivery\x20gate\x20replaces\x20platform\x20custody']}}),this['registerCard']({'capability_id':'guard.validate_refund','display_name':'Guard\x20Validate\x20Refund','description':'Refund\x20validation:\x20gate\x20buyer\x20refund\x20on\x20cancellation\x20or\x20return\x20conditions','object_type':'guard','module':'handler','category':'validation','industry_agnostic':'medium','config_template':{'host':'service','templates':['tpl_refund_on_cancelled']},'industry_overrides':{'retail_d2c':{'templates':['tpl_refund_on_cancelled']}},'observed_in_industries':{},'success_count':0x0,'failure_count':0x0,'known_failure_modes':['Missing\x20refund\x20path\x20on\x20pre-delivery\x20cancellation\x20traps\x20buyer\x20funds'],'depends_on_capabilities':['guard.validate_buy'],'version':'v1','risk_profile':{'funds_risk':'medium','trust_risk':'medium','delivery_risk':'medium','compliance_risk':'low','known_risks':['Over-broad\x20refund\x20conditions\x20enable\x20buyer\x20abuse']},'benefit_profile':{'automation_level':'high','trust_boost':'high','efficiency_gain':'high','benefits':['Trustless\x20buyer\x20refund\x20without\x20merchant\x20approval']}});}['registerBuiltinEdges'](){const a=['machine.node_topology','guard.validate_buy','permission.index_create','allocation.distribute','treasury.owner_receive'];for(const b of a){this['registerEdge']({'from':'service.publish','to':b,'edge_kind':'requires','phase':'publish','description':'Service\x20publish\x20requires\x20this\x20capability'});}this['registerEdge']({'from':'service.publish','to':'arb.vote_weighted','edge_kind':'optional','phase':'publish','description':'Optional:\x20arbitration\x20for\x20dispute\x20resolution'}),this['registerEdge']({'from':'service.publish','to':'reward.claim_guard','edge_kind':'optional','phase':'publish','description':'Optional:\x20reward\x20for\x20positive\x20behavior'}),this['registerEdge']({'from':'service.publish','to':'contact.im_create','edge_kind':'optional','phase':'publish','description':'Optional:\x20IM\x20contact\x20between\x20buyer\x20and\x20seller'}),this['registerEdge']({'from':'permission.role_assign','to':'permission.index_create','edge_kind':'requires','phase':'create','description':'Role\x20assignment\x20requires\x20permission\x20index'}),this['registerEdge']({'from':'machine.node_topology','to':'permission.index_create','edge_kind':'requires','phase':'create','description':'Machine\x20requires\x20permission\x20for\x20role-based\x20node\x20access'}),this['registerEdge']({'from':'allocation.distribute','to':'treasury.owner_receive','edge_kind':'requires','phase':'runtime','description':'Allocation\x20distributes\x20via\x20treasury'}),this['registerEdge']({'from':'allocation.distribute','to':'guard.validate_buy','edge_kind':'requires','phase':'runtime','description':'Allocation\x20requires\x20guard\x20validation'}),this['registerEdge']({'from':'allocation.distribute_milestone','to':'allocation.distribute','edge_kind':'requires','phase':'create','description':'Milestone\x20allocation\x20extends\x20base\x20allocation'}),this['registerEdge']({'from':'allocation.distribute_milestone','to':'guard.validate_wip_hash','edge_kind':'requires','phase':'runtime','description':'Milestone\x20allocation\x20requires\x20WIP\x20hash\x20validation'}),this['registerEdge']({'from':'progress.advance','to':'machine.node_topology','edge_kind':'requires','phase':'runtime','description':'Progress\x20advances\x20based\x20on\x20machine\x20topology'}),this['registerEdge']({'from':'arb.vote_weighted','to':'guard.validate_buy','edge_kind':'requires','phase':'runtime','description':'Arbitration\x20voting\x20requires\x20guard\x20for\x20weight\x20validation'}),this['registerEdge']({'from':'reward.claim_guard','to':'guard.validate_buy','edge_kind':'requires','phase':'runtime','description':'Reward\x20claim\x20requires\x20guard\x20validation'}),this['registerEdge']({'from':'proof.evidence_anchor','to':'progress.advance','edge_kind':'requires','phase':'runtime','description':'Proof\x20anchors\x20to\x20progress\x20node'}),this['registerEdge']({'from':'payment.settle','to':'allocation.distribute','edge_kind':'requires','phase':'runtime','description':'Payment\x20settles\x20via\x20allocation'}),this['registerEdge']({'from':'demand.matching','to':'service.publish','edge_kind':'requires','phase':'runtime','description':'Demand\x20matching\x20requires\x20published\x20services'}),this['registerEdge']({'from':'repository.write_validate','to':'guard.validate_buy','edge_kind':'requires','phase':'runtime','description':'Repository\x20write\x20requires\x20guard\x20validation'});}['computeConfigDiff'](a,b){if(typeof a!=='object'||typeof b!=='object'||a===null||b===null)return a===b?{'diff_ratio':0x0,'summary':'identical'}:{'diff_ratio':0x1,'summary':'type\x20mismatch'};const c=a,d=b,e=new Set(Object['keys'](c)),f=new Set(Object['keys'](d)),g=new Set([...e,...f]);if(g['size']===0x0)return{'diff_ratio':0x0,'summary':'empty\x20configs'};let h=0x0;const i=[];for(const m of g){const n=c[m],o=d[m];JSON['stringify'](n)!==JSON['stringify'](o)&&(h++,i['push'](m));}const j=h/g['size'],l=h+'/'+g['size']+'\x20fields\x20differ:\x20'+i['slice'](0x0,0x3)['join'](',\x20')+(i['length']>0x3?'...':'');return{'diff_ratio':j,'summary':l};}}export function getCapabilityRegistry(){return CapabilityRegistry['Instance']();}export const CAPABILITY_MANIFEST_VERSION=0x1;export function recordCapabilitiesUsed(a,b){const c=CapabilityRegistry['Instance']();for(const d of b){c['recordUsage'](d,a);}}
1
+ export class CapabilityRegistry{static ['instance'];['cards']=new Map();static['Instance'](){return!CapabilityRegistry['instance']&&(CapabilityRegistry['instance']=new CapabilityRegistry()),CapabilityRegistry['instance'];}constructor(){this['registerBuiltins']();}['registerCard'](a){if(!a['capability_id']||!a['object_type']||!a['module'])return![];return this['cards']['set'](a['capability_id'],a),!![];}['getCard'](a){return this['cards']['get'](a);}['registerBuiltins'](){this['registerCard']({'capability_id':'permission.index_create','display_name':'Permission\x20Index\x20Create','description':'Create\x20role\x20permission\x20index,\x20supports\x20multi-role\x20permission\x20assignment\x20such\x20as\x20merchant/customer/arbiter','object_type':'permission','module':'handler','category':'trust','industry_agnostic':'high','risk_profile':{'funds_risk':'low','trust_risk':'low','delivery_risk':'low','compliance_risk':'low','known_risks':['Index\x20proliferation\x20without\x20naming\x20convention\x20makes\x20permission\x20audits\x20harder']},'benefit_profile':{'automation_level':'medium','trust_boost':'high','efficiency_gain':'medium','benefits':['Role-based\x20governance\x20foundation\x20for\x20all\x20other\x20objects']}}),this['registerCard']({'capability_id':'permission.role_assign','display_name':'Permission\x20Role\x20Assign','description':'Assign\x20role\x20permission\x20index\x20to\x20objects\x20(Machine/Service/Allocation)','object_type':'permission','module':'handler','category':'trust','industry_agnostic':'high','risk_profile':{'funds_risk':'low','trust_risk':'medium','delivery_risk':'low','compliance_risk':'low','known_risks':['Mis-assigned\x20role\x20grants\x20unintended\x20operational\x20authority']},'benefit_profile':{'automation_level':'high','trust_boost':'high','efficiency_gain':'medium','benefits':['Binds\x20governance\x20roles\x20to\x20concrete\x20objects']}}),this['registerCard']({'capability_id':'guard.validate_buy','display_name':'Guard\x20Validate\x20Buy','description':'Order\x20validation:\x20check\x20buyer\x20eligibility,\x20order\x20parameters,\x20inventory\x20and\x20other\x20conditions','object_type':'guard','module':'handler','category':'validation','industry_agnostic':'medium','risk_profile':{'funds_risk':'low','trust_risk':'medium','delivery_risk':'medium','compliance_risk':'low','known_risks':['Over-strict\x20buy\x20validation\x20blocks\x20legitimate\x20orders;\x20over-loose\x20validation\x20admits\x20fraud']},'benefit_profile':{'automation_level':'high','trust_boost':'high','efficiency_gain':'high','benefits':['Automated\x20purchase\x20gating\x20without\x20manual\x20review']}}),this['registerCard']({'capability_id':'guard.validate_wip_hash','display_name':'Guard\x20Validate\x20WIP\x20Hash','description':'Validate\x20WIP\x20(Work-In-Progress)\x20hash,\x20used\x20for\x20milestone\x20validation\x20of\x20digital\x20deliverables','object_type':'guard','module':'handler','category':'evidence','industry_agnostic':'low','risk_profile':{'funds_risk':'low','trust_risk':'medium','delivery_risk':'high','compliance_risk':'low','known_risks':['Wrong\x20hash\x20algorithm\x20or\x20field\x20mapping\x20stalls\x20milestone\x20release']},'benefit_profile':{'automation_level':'high','trust_boost':'medium','efficiency_gain':'medium','benefits':['Tamper-proof\x20delivery\x20evidence\x20for\x20digital\x20deliverables']}}),this['registerCard']({'capability_id':'machine.node_topology','display_name':'Machine\x20Node\x20Topology','description':'Workflow\x20node\x20topology:\x20define\x20the\x20state\x20machine\x20from\x20order\x20creation\x20to\x20completion','object_type':'machine','module':'templates','category':'workflow','industry_agnostic':'low','risk_profile':{'funds_risk':'low','trust_risk':'medium','delivery_risk':'high','compliance_risk':'low','known_risks':['Dead-end\x20nodes\x20or\x20missing\x20refund\x20paths\x20trap\x20order\x20funds']},'benefit_profile':{'automation_level':'medium','trust_boost':'medium','efficiency_gain':'high','benefits':['Declarative\x20workflow\x20from\x20order\x20creation\x20to\x20completion']}}),this['registerCard']({'capability_id':'treasury.owner_receive','display_name':'Treasury\x20Owner\x20Receive','description':'Fund\x20escrow:\x20supports\x20owner_receive\x20mode,\x20funds\x20go\x20directly\x20into\x20the\x20object\x20owner\x20wallet','object_type':'treasury','module':'handler','category':'fund_flow','industry_agnostic':'high','risk_profile':{'funds_risk':'high','trust_risk':'medium','delivery_risk':'low','compliance_risk':'low','known_risks':['Direct\x20fund\x20custody\x20—\x20misconfigured\x20owner\x20diverts\x20all\x20proceeds']},'benefit_profile':{'automation_level':'high','trust_boost':'medium','efficiency_gain':'medium','benefits':['Automated\x20escrow\x20and\x20owner\x20settlement']}}),this['registerCard']({'capability_id':'allocation.distribute','display_name':'Multi-tier\x20Allocation\x20Distribution','description':'Multi-tier\x20allocation:\x20supports\x20distributing\x20funds\x20to\x20multiple\x20recipients\x20by\x20ratio\x20/\x20by\x20order\x20/\x20by\x20condition','object_type':'allocation','module':'handler','category':'fund_flow','industry_agnostic':'medium','risk_profile':{'funds_risk':'high','trust_risk':'low','delivery_risk':'medium','compliance_risk':'low','known_risks':['Wrong\x20split\x20ratios\x20or\x20recipient\x20addresses\x20misdirect\x20settlement\x20funds']},'benefit_profile':{'automation_level':'high','trust_boost':'medium','efficiency_gain':'high','benefits':['Multi-recipient\x20settlement\x20without\x20manual\x20transfers']}}),this['registerCard']({'capability_id':'allocation.distribute_milestone','display_name':'Milestone-based\x20Allocation','description':'Milestone\x20allocation:\x20release\x20funds\x20by\x20delivery\x20milestones,\x20each\x20milestone\x20requires\x20WIP\x20hash\x20validation','object_type':'allocation','module':'handler','category':'fund_flow','industry_agnostic':'low','risk_profile':{'funds_risk':'high','trust_risk':'medium','delivery_risk':'medium','compliance_risk':'low','known_risks':['Stuck\x20milestone\x20gates\x20lock\x20buyer\x20funds\x20until\x20evidence\x20is\x20supplied']},'benefit_profile':{'automation_level':'medium','trust_boost':'high','efficiency_gain':'medium','benefits':['Evidence-gated\x20release\x20protects\x20both\x20buyer\x20and\x20provider']}}),this['registerCard']({'capability_id':'service.publish','display_name':'Service\x20Publish','description':'Publish\x20Service\x20object\x20on-chain,\x20bind\x20Machine/Guard/Permission/Allocation\x20and\x20other\x20dependencies','object_type':'service','module':'handler','category':'lifecycle','industry_agnostic':'high','risk_profile':{'funds_risk':'medium','trust_risk':'medium','delivery_risk':'medium','compliance_risk':'medium','known_risks':['Publish\x20freezes\x20machine\x20binding\x20and\x20order_allocators\x20permanently\x20(E_ALREADY_PUBLISHED)']},'benefit_profile':{'automation_level':'medium','trust_boost':'medium','efficiency_gain':'medium','benefits':['On-chain\x20discoverability\x20and\x20order\x20intake']}}),this['registerCard']({'capability_id':'progress.advance','display_name':'Progress\x20Advance','description':'Order\x20fulfillment\x20progress\x20advance:\x20advance\x20to\x20next\x20state\x20based\x20on\x20Machine\x20node\x20topology','object_type':'progress','module':'handler','category':'workflow','industry_agnostic':'medium','risk_profile':{'funds_risk':'medium','trust_risk':'low','delivery_risk':'high','compliance_risk':'low','known_risks':['Forward\x20without\x20authorized\x20executor\x20permanently\x20stalls\x20the\x20order']},'benefit_profile':{'automation_level':'high','trust_boost':'medium','efficiency_gain':'high','benefits':['Deterministic\x20order\x20state\x20progression']}}),this['registerCard']({'capability_id':'arb.vote_weighted','display_name':'Arbitration\x20Vote\x20Weighted','description':'guard-based\x20weighted\x20voting\x20arbitration:\x20vote\x20by\x20Guard\x20weight\x20to\x20determine\x20arbitration\x20result','object_type':'arb','module':'handler','category':'trust','industry_agnostic':'medium','risk_profile':{'funds_risk':'low','trust_risk':'high','delivery_risk':'medium','compliance_risk':'medium','known_risks':['Shared\x20permission\x20with\x20Service\x20destroys\x20dispute\x20independence\x20(E_ARBITRATION_PERMISSION_CONFLICT)']},'benefit_profile':{'automation_level':'medium','trust_boost':'high','efficiency_gain':'low','benefits':['Neutral\x20third-party\x20dispute\x20resolution']}}),this['registerCard']({'capability_id':'reward.claim_guard','display_name':'Reward\x20Claim\x20Guard','description':'Reward\x20claim:\x20release\x20reward\x20after\x20validating\x20claim\x20conditions\x20(such\x20as\x20positive\x20review,\x20repurchase)\x20via\x20Guard','object_type':'reward','module':'handler','category':'fund_flow','industry_agnostic':'medium','risk_profile':{'funds_risk':'medium','trust_risk':'low','delivery_risk':'low','compliance_risk':'low','known_risks':['Loose\x20claim\x20conditions\x20drain\x20the\x20reward\x20pool']},'benefit_profile':{'automation_level':'high','trust_boost':'medium','efficiency_gain':'medium','benefits':['Incentivizes\x20reviews\x20and\x20repurchase']}}),this['registerCard']({'capability_id':'contact.im_create','display_name':'Contact\x20IM\x20Create','description':'Create\x20IM\x20contact\x20object:\x20buyer\x20and\x20seller\x20communicate\x20via\x20Messenger','object_type':'contact','module':'handler','category':'communication','industry_agnostic':'high','risk_profile':{'funds_risk':'low','trust_risk':'low','delivery_risk':'low','compliance_risk':'low','known_risks':['Unattended\x20IM\x20channel\x20degrades\x20dispute\x20response\x20time']},'benefit_profile':{'automation_level':'medium','trust_boost':'medium','efficiency_gain':'medium','benefits':['Direct\x20buyer-seller\x20encrypted\x20communication']}}),this['registerCard']({'capability_id':'demand.matching','display_name':'Demand\x20Matching','description':'Demand\x20matching:\x20match\x20corresponding\x20Service\x20based\x20on\x20user\x20demand','object_type':'demand','module':'handler','category':'query','industry_agnostic':'high','risk_profile':{'funds_risk':'low','trust_risk':'low','delivery_risk':'low','compliance_risk':'low','known_risks':['Poor\x20matching\x20signals\x20bury\x20quality\x20services']},'benefit_profile':{'automation_level':'medium','trust_boost':'low','efficiency_gain':'medium','benefits':['Demand-side\x20discovery\x20channel']}}),this['registerCard']({'capability_id':'repository.write_validate','display_name':'Repository\x20Write\x20Validate','description':'Knowledge\x20base\x20write\x20validation:\x20validate\x20write\x20permissions\x20and\x20data\x20format\x20via\x20Guard','object_type':'repository','module':'handler','category':'validation','industry_agnostic':'high','risk_profile':{'funds_risk':'low','trust_risk':'medium','delivery_risk':'low','compliance_risk':'medium','known_risks':['Unvalidated\x20writes\x20pollute\x20the\x20knowledge\x20base\x20with\x20unverifiable\x20claims']},'benefit_profile':{'automation_level':'medium','trust_boost':'high','efficiency_gain':'medium','benefits':['Guard-gated\x20attestation\x20for\x20off-chain\x20data']}}),this['registerCard']({'capability_id':'proof.evidence_anchor','display_name':'Proof\x20Evidence\x20Anchor','description':'Evidence\x20on-chain:\x20anchor\x20delivery\x20evidence\x20(hash)\x20to\x20on-chain\x20Progress\x20node','object_type':'proof','module':'handler','category':'evidence','industry_agnostic':'medium','risk_profile':{'funds_risk':'low','trust_risk':'medium','delivery_risk':'low','compliance_risk':'low','known_risks':['Anchored\x20evidence\x20is\x20immutable\x20—\x20wrong\x20hash\x20cannot\x20be\x20corrected']},'benefit_profile':{'automation_level':'high','trust_boost':'high','efficiency_gain':'medium','benefits':['Immutable\x20WTS\x20evidence\x20for\x20Messenger\x20confirmations']}}),this['registerCard']({'capability_id':'personal.profile_manage','display_name':'Personal\x20Profile\x20Manage','description':'Personal\x20profile\x20management:\x20user\x20identity/preference/history\x20management','object_type':'personal','module':'handler','category':'data_model','industry_agnostic':'high','risk_profile':{'funds_risk':'low','trust_risk':'low','delivery_risk':'low','compliance_risk':'medium','known_risks':['Profile\x20data\x20may\x20fall\x20under\x20privacy\x20regulation\x20(PII)']},'benefit_profile':{'automation_level':'medium','trust_boost':'low','efficiency_gain':'low','benefits':['Portable\x20user\x20identity\x20across\x20services']}}),this['registerCard']({'capability_id':'payment.settle','display_name':'Payment\x20Settle','description':'Payment\x20settlement:\x20complete\x20fund\x20settlement\x20in\x20collaboration\x20with\x20Allocation','object_type':'payment','module':'handler','category':'fund_flow','industry_agnostic':'high','risk_profile':{'funds_risk':'high','trust_risk':'low','delivery_risk':'low','compliance_risk':'medium','known_risks':['Settlement\x20errors\x20are\x20irreversible\x20once\x20funds\x20transfer']},'benefit_profile':{'automation_level':'high','trust_boost':'low','efficiency_gain':'high','benefits':['Atomic\x20settlement\x20in\x20collaboration\x20with\x20Allocation']}}),this['registerCard']({'capability_id':'guard.validate_withdraw','display_name':'Guard\x20Validate\x20Withdraw','description':'Withdrawal\x20validation:\x20gate\x20fund\x20release\x20from\x20Allocation\x20escrow\x20on\x20delivery\x20confirmation','object_type':'guard','module':'handler','category':'validation','industry_agnostic':'medium','risk_profile':{'funds_risk':'high','trust_risk':'medium','delivery_risk':'medium','compliance_risk':'low','known_risks':['Mis-gated\x20withdrawal\x20releases\x20escrowed\x20funds\x20prematurely']},'benefit_profile':{'automation_level':'high','trust_boost':'high','efficiency_gain':'high','benefits':['Contract-enforced\x20delivery\x20gate\x20replaces\x20platform\x20custody']}}),this['registerCard']({'capability_id':'guard.validate_refund','display_name':'Guard\x20Validate\x20Refund','description':'Refund\x20validation:\x20gate\x20buyer\x20refund\x20on\x20cancellation\x20or\x20return\x20conditions','object_type':'guard','module':'handler','category':'validation','industry_agnostic':'medium','risk_profile':{'funds_risk':'medium','trust_risk':'medium','delivery_risk':'medium','compliance_risk':'low','known_risks':['Over-broad\x20refund\x20conditions\x20enable\x20buyer\x20abuse']},'benefit_profile':{'automation_level':'high','trust_boost':'high','efficiency_gain':'high','benefits':['Trustless\x20buyer\x20refund\x20without\x20merchant\x20approval']}});}}export function getCapabilityRegistry(){return CapabilityRegistry['Instance']();}export const CAPABILITY_MANIFEST_VERSION=0x2;
@@ -3,18 +3,20 @@ import type { CapabilityRegistry } from "./capability-manifest.js";
3
3
  export declare class ConstraintRegistry {
4
4
  private static instance;
5
5
  private constraints;
6
- private initialized;
6
+ private persistence;
7
+ private customConstraintsLoaded;
7
8
  static Instance(): ConstraintRegistry;
8
9
  private constructor();
10
+ ensureLoaded(): Promise<void>;
9
11
  registerConstraint(constraint: ModeConstraint): boolean;
10
- registerCustomConstraint(constraint_id: string, display_name: string, description: string, rule: ConstraintRule, owner: string, severity?: ConstraintSeverity, on_violation?: ConstraintViolationAction): boolean;
12
+ registerCustomConstraint(constraint_id: string, display_name: string, description: string, rule: ConstraintRule, owner: string, severity?: ConstraintSeverity, on_violation?: ConstraintViolationAction): Promise<boolean>;
11
13
  getConstraint(constraint_id: string): ModeConstraint | undefined;
12
14
  listConstraints(filter?: {
13
15
  scope?: "builtin" | "custom";
14
16
  owner?: string;
15
17
  severity?: ConstraintSeverity;
16
- }): ModeConstraint[];
17
- unregisterConstraint(constraint_id: string, owner: string): boolean;
18
+ }): Promise<ModeConstraint[]>;
19
+ unregisterConstraint(constraint_id: string, owner: string): Promise<boolean>;
18
20
  checkConstraints(mode: IndustryMode, _capabilityRegistry: CapabilityRegistry, extraConstraints?: ModeConstraint[]): ConstraintViolation[];
19
21
  private checkConstraint;
20
22
  private getNumericField;
@@ -1 +1 @@
1
- const BUILTIN_CONSTRAINTS=[{'constraint_id':'require_arbitration','display_name':'Require\x20Arbitration','description':'Mode\x20must\x20include\x20arbitration\x20capability\x20(arb.*)\x20for\x20dispute\x20resolution','rule':{'type':'capability_required','capability_id':'arb.vote_weighted'},'severity':'hard','on_violation':'block','scope':'builtin'},{'constraint_id':'require_compensation_fund','display_name':'Require\x20Compensation\x20Fund','description':'Mode\x20must\x20include\x20fund\x20escrow\x20capability\x20(treasury.*)\x20for\x20compensation\x20fund','rule':{'type':'capability_required','capability_id':'treasury.owner_receive'},'severity':'hard','on_violation':'block','scope':'builtin'},{'constraint_id':'require_wip_evidence','display_name':'Require\x20WIP\x20Evidence','description':'Mode\x20must\x20include\x20WIP\x20evidence\x20capability\x20(guard.validate_wip_hash)\x20for\x20digital\x20delivery\x20validation','rule':{'type':'capability_required','capability_id':'guard.validate_wip_hash'},'severity':'soft','on_violation':'warn','scope':'builtin'},{'constraint_id':'max_single_transaction_limit','display_name':'Single\x20Transaction\x20Limit','description':'Single\x20transaction\x20amount\x20must\x20not\x20exceed\x2010000\x20WOW\x20(default\x20value,\x20can\x20be\x20overridden\x20by\x20mode)','rule':{'type':'numeric_limit','field':'max_single_transaction','max':0x2710},'severity':'soft','on_violation':'warn','scope':'builtin'}];export class ConstraintRegistry{static ['instance'];['constraints']=new Map();['initialized']=![];static['Instance'](){return!ConstraintRegistry['instance']&&(ConstraintRegistry['instance']=new ConstraintRegistry()),ConstraintRegistry['instance'];}constructor(){this['registerBuiltinConstraints'](),this['initialized']=!![];}['registerConstraint'](a){if(!a['constraint_id']||!a['rule'])return![];if(this['constraints']['has'](a['constraint_id']))return![];return this['constraints']['set'](a['constraint_id'],a),!![];}['registerCustomConstraint'](a,b,c,d,e,f='soft',g='warn'){return this['registerConstraint']({'constraint_id':a,'display_name':b,'description':c,'rule':d,'severity':f,'on_violation':g,'scope':'custom','owner':e});}['getConstraint'](a){return this['constraints']['get'](a);}['listConstraints'](a){let b=Array['from'](this['constraints']['values']());if(!a)return b;if(a['scope'])b=b['filter'](d=>d['scope']===a['scope']);if(a['owner'])b=b['filter'](d=>d['owner']===a['owner']);if(a['severity'])b=b['filter'](d=>d['severity']===a['severity']);return b;}['unregisterConstraint'](a,b){const c=this['constraints']['get'](a);if(!c||c['scope']!=='custom'||c['owner']!==b)return![];return this['constraints']['delete'](a);}['checkConstraints'](a,b,d){const e=new Set(a['disabled_builtin_constraints']??[]),f=[...this['constraints']['values']()]['filter'](h=>!(h['scope']==='builtin'&&e['has'](h['constraint_id'])));if(d)for(const h of d){!f['some'](i=>i['constraint_id']===h['constraint_id'])&&f['push'](h);}const g=[];for(const i of f){const j=this['checkConstraint'](a,i);j&&g['push'](j);}return g;}['checkConstraint'](a,b){const c=b['rule'];switch(c['type']){case'capability_required':{if(!a['capabilities_used']['includes'](c['capability_id']))return{'constraint_id':b['constraint_id'],'display_name':b['display_name'],'violation':'Missing\x20required\x20capability:\x20'+c['capability_id'],'severity':b['severity'],'action':b['on_violation'],'recommendation':'Add\x20\x22'+c['capability_id']+'\x22\x20to\x20capabilities_used'};return null;}case'capability_forbidden':{if(a['capabilities_used']['includes'](c['capability_id']))return{'constraint_id':b['constraint_id'],'display_name':b['display_name'],'violation':'Contains\x20forbidden\x20capability:\x20'+c['capability_id'],'severity':b['severity'],'action':b['on_violation'],'recommendation':'Remove\x20\x22'+c['capability_id']+'\x22\x20from\x20capabilities_used'};return null;}case'numeric_limit':{const d=this['getNumericField'](a,c['field']);if(d===undefined)return null;if(c['max']!==undefined&&d>c['max'])return{'constraint_id':b['constraint_id'],'display_name':b['display_name'],'violation':c['field']+'='+d+'\x20exceeds\x20upper\x20limit\x20'+c['max'],'severity':b['severity'],'action':b['on_violation'],'recommendation':'Reduce\x20'+c['field']+'\x20below\x20'+c['max']};if(c['min']!==undefined&&d<c['min'])return{'constraint_id':b['constraint_id'],'display_name':b['display_name'],'violation':c['field']+'='+d+'\x20below\x20lower\x20limit\x20'+c['min'],'severity':b['severity'],'action':b['on_violation'],'recommendation':'Increase\x20'+c['field']+'\x20above\x20'+c['min']};return null;}case'condition_required':{return{'constraint_id':b['constraint_id'],'display_name':b['display_name'],'violation':'Natural\x20language\x20condition\x20pending\x20AI\x20evaluation:\x20\x22'+c['condition']+'\x22','severity':b['severity'],'action':b['on_violation'],'recommendation':'Please\x20have\x20AI\x20evaluate\x20whether\x20this\x20condition\x20is\x20satisfied,\x20and\x20update\x20the\x20mode\x20configuration'};}default:return null;}}['getNumericField'](a,b){if(b==='max_single_transaction')return a['risk_constraints']['max_single_transaction'];return undefined;}['registerBuiltinConstraints'](){for(const a of BUILTIN_CONSTRAINTS){this['registerConstraint'](a);}}}export function getConstraintRegistry(){return ConstraintRegistry['Instance']();}export const BUILTIN_CONSTRAINTS_COUNT=BUILTIN_CONSTRAINTS['length'];
1
+ import{OwnedRecordStorage}from'@wowok/wowok';const BUILTIN_CONSTRAINTS=[{'constraint_id':'require_arbitration','display_name':'Require\x20Arbitration','description':'Mode\x20must\x20include\x20arbitration\x20capability\x20(arb.*)\x20for\x20dispute\x20resolution','rule':{'type':'capability_required','capability_id':'arb.vote_weighted'},'severity':'hard','on_violation':'block','scope':'builtin'},{'constraint_id':'require_compensation_fund','display_name':'Require\x20Compensation\x20Fund','description':'Mode\x20must\x20include\x20fund\x20escrow\x20capability\x20(treasury.*)\x20for\x20compensation\x20fund','rule':{'type':'capability_required','capability_id':'treasury.owner_receive'},'severity':'hard','on_violation':'block','scope':'builtin'},{'constraint_id':'require_wip_evidence','display_name':'Require\x20WIP\x20Evidence','description':'Mode\x20must\x20include\x20WIP\x20evidence\x20capability\x20(guard.validate_wip_hash)\x20for\x20digital\x20delivery\x20validation','rule':{'type':'capability_required','capability_id':'guard.validate_wip_hash'},'severity':'soft','on_violation':'warn','scope':'builtin'},{'constraint_id':'max_single_transaction_limit','display_name':'Single\x20Transaction\x20Limit','description':'Single\x20transaction\x20amount\x20must\x20not\x20exceed\x2010000\x20WOW\x20(default\x20value,\x20can\x20be\x20overridden\x20by\x20mode)','rule':{'type':'numeric_limit','field':'max_single_transaction','max':0x2710},'severity':'soft','on_violation':'warn','scope':'builtin'}];export class ConstraintRegistry{static ['instance'];['constraints']=new Map();['persistence']=new OwnedRecordStorage('custom_constraints');['customConstraintsLoaded']=![];static['Instance'](){return!ConstraintRegistry['instance']&&(ConstraintRegistry['instance']=new ConstraintRegistry()),ConstraintRegistry['instance'];}constructor(){this['registerBuiltinConstraints']();}async['ensureLoaded'](){if(this['customConstraintsLoaded'])return;this['customConstraintsLoaded']=!![];try{const a=await this['persistence']['list']();for(const b of a){try{const c=JSON['parse'](b['data']);c?.['constraint_id']&&c['scope']==='custom'&&this['constraints']['set'](c['constraint_id'],c);}catch{console['warn']('[ConstraintRegistry]\x20Skipping\x20corrupt\x20custom_constraints\x20row\x20\x27'+b['owner']+':'+b['name']+'\x27.');}}}catch(d){console['warn']('[ConstraintRegistry]\x20Failed\x20to\x20load\x20persisted\x20custom\x20constraints:',d['message']);}}['registerConstraint'](a){if(!a['constraint_id']||!a['rule'])return![];if(this['constraints']['has'](a['constraint_id']))return![];return this['constraints']['set'](a['constraint_id'],a),!![];}async['registerCustomConstraint'](a,b,c,d,e,f='soft',g='warn'){await this['ensureLoaded']();const h={'constraint_id':a,'display_name':b,'description':c,'rule':d,'severity':f,'on_violation':g,'scope':'custom','owner':e},i=this['registerConstraint'](h);if(i)try{await this['persistence']['save'](e,a,JSON['stringify'](h));}catch(j){console['warn']('[ConstraintRegistry]\x20Failed\x20to\x20persist\x20custom\x20constraint\x20\x27'+a+'\x27:',j['message']);}return i;}['getConstraint'](a){return this['constraints']['get'](a);}async['listConstraints'](a){await this['ensureLoaded']();let b=Array['from'](this['constraints']['values']());if(!a)return b;if(a['scope'])b=b['filter'](d=>d['scope']===a['scope']);if(a['owner'])b=b['filter'](d=>d['owner']===a['owner']);if(a['severity'])b=b['filter'](d=>d['severity']===a['severity']);return b;}async['unregisterConstraint'](a,b){await this['ensureLoaded']();const c=this['constraints']['get'](a);if(!c||c['scope']!=='custom'||c['owner']!==b)return![];const d=this['constraints']['delete'](a);if(d)try{await this['persistence']['delete'](b,a);}catch(e){console['warn']('[ConstraintRegistry]\x20Failed\x20to\x20delete\x20persisted\x20custom\x20constraint\x20\x27'+a+'\x27:',e['message']);}return d;}['checkConstraints'](a,b,d){const e=new Set(a['disabled_builtin_constraints']??[]),f=[...this['constraints']['values']()]['filter'](h=>!(h['scope']==='builtin'&&e['has'](h['constraint_id'])));if(d)for(const h of d){!f['some'](i=>i['constraint_id']===h['constraint_id'])&&f['push'](h);}const g=[];for(const i of f){const j=this['checkConstraint'](a,i);j&&g['push'](j);}return g;}['checkConstraint'](a,b){const c=b['rule'];switch(c['type']){case'capability_required':{if(!a['capabilities_used']['includes'](c['capability_id']))return{'constraint_id':b['constraint_id'],'display_name':b['display_name'],'violation':'Missing\x20required\x20capability:\x20'+c['capability_id'],'severity':b['severity'],'action':b['on_violation'],'recommendation':'Add\x20\x22'+c['capability_id']+'\x22\x20to\x20capabilities_used'};return null;}case'capability_forbidden':{if(a['capabilities_used']['includes'](c['capability_id']))return{'constraint_id':b['constraint_id'],'display_name':b['display_name'],'violation':'Contains\x20forbidden\x20capability:\x20'+c['capability_id'],'severity':b['severity'],'action':b['on_violation'],'recommendation':'Remove\x20\x22'+c['capability_id']+'\x22\x20from\x20capabilities_used'};return null;}case'numeric_limit':{const d=this['getNumericField'](a,c['field']);if(d===undefined)return null;if(c['max']!==undefined&&d>c['max'])return{'constraint_id':b['constraint_id'],'display_name':b['display_name'],'violation':c['field']+'='+d+'\x20exceeds\x20upper\x20limit\x20'+c['max'],'severity':b['severity'],'action':b['on_violation'],'recommendation':'Reduce\x20'+c['field']+'\x20below\x20'+c['max']};if(c['min']!==undefined&&d<c['min'])return{'constraint_id':b['constraint_id'],'display_name':b['display_name'],'violation':c['field']+'='+d+'\x20below\x20lower\x20limit\x20'+c['min'],'severity':b['severity'],'action':b['on_violation'],'recommendation':'Increase\x20'+c['field']+'\x20above\x20'+c['min']};return null;}case'condition_required':{return{'constraint_id':b['constraint_id'],'display_name':b['display_name'],'violation':'Natural\x20language\x20condition\x20pending\x20AI\x20evaluation:\x20\x22'+c['condition']+'\x22','severity':b['severity'],'action':b['on_violation'],'recommendation':'Please\x20have\x20AI\x20evaluate\x20whether\x20this\x20condition\x20is\x20satisfied,\x20and\x20update\x20the\x20mode\x20configuration'};}default:return null;}}['getNumericField'](a,b){if(b==='max_single_transaction')return a['risk_constraints']['max_single_transaction'];return undefined;}['registerBuiltinConstraints'](){for(const a of BUILTIN_CONSTRAINTS){this['registerConstraint'](a);}}}export function getConstraintRegistry(){return ConstraintRegistry['Instance']();}export const BUILTIN_CONSTRAINTS_COUNT=BUILTIN_CONSTRAINTS['length'];
@@ -1,10 +1,9 @@
1
- export type { Blueprint, BlueprintObject, BlueprintEdge, BlueprintStep, BlueprintScenario, ProjectContext, } from "./types.js";
2
- export type { IndustryMode, IndustryModeRegistration, UserDefinedMode, DeriveModeOptions, EvolveModeOptions, } from "./types.js";
3
- export type { ExpectedBenefit, RiskAppetite, ModeRiskConstraints, ModeApplicableConditions, ConfigOverrideRule, ModeEvaluation, ModeMigrationEvaluation, } from "./types.js";
1
+ export type { IndustryMode, IndustryModeRegistration, UserDefinedMode, } from "./types.js";
2
+ export type { ExpectedBenefit, RiskAppetite, ModeRiskConstraints, ModeApplicableConditions, ConfigOverrideRule, ModeEvaluation, } from "./types.js";
4
3
  export type { BaseMetric, MetricType, MetricScale, MetricValue, CapabilityMetricValue, MetricEvaluation, } from "./types.js";
5
4
  export type { ModeConstraint, ConstraintRule, ConstraintSeverity, ConstraintViolationAction, ConstraintViolation, } from "./types.js";
6
- export { CapabilityRegistry, getCapabilityRegistry, recordCapabilitiesUsed, CAPABILITY_MANIFEST_VERSION, } from "./capability-manifest.js";
7
- export type { CapabilityCard, CapabilityGraph, CapabilityGraphEdge, CapabilityModule, CapabilityCategory, IndustryAgnostic, MigrationEvaluation, CoverageReport, ExperienceUpdate, VerificationReport, CapabilityRiskProfile, CapabilityBenefitProfile, CapabilityConstraints, } from "./capability-manifest.js";
5
+ export { CapabilityRegistry, getCapabilityRegistry, CAPABILITY_MANIFEST_VERSION, } from "./capability-manifest.js";
6
+ export type { CapabilityCard, CapabilityModule, CapabilityCategory, IndustryAgnostic, CapabilityRiskProfile, CapabilityBenefitProfile, CapabilityConstraints, } from "./capability-manifest.js";
8
7
  export { IndustryModeRegistry, getIndustryModeRegistry, INDUSTRY_MODE_REGISTRY_VERSION, } from "./registry.js";
9
8
  export { MetricRegistry, getMetricRegistry, BUILTIN_METRICS_COUNT, } from "./metric-registry.js";
10
9
  export { ConstraintRegistry, getConstraintRegistry, BUILTIN_CONSTRAINTS_COUNT, } from "./constraint-registry.js";
@@ -1 +1 @@
1
- export{CapabilityRegistry,getCapabilityRegistry,recordCapabilitiesUsed,CAPABILITY_MANIFEST_VERSION}from'./capability-manifest.js';export{IndustryModeRegistry,getIndustryModeRegistry,INDUSTRY_MODE_REGISTRY_VERSION}from'./registry.js';export{MetricRegistry,getMetricRegistry,BUILTIN_METRICS_COUNT}from'./metric-registry.js';export{ConstraintRegistry,getConstraintRegistry,BUILTIN_CONSTRAINTS_COUNT}from'./constraint-registry.js';export{ModeEvaluator}from'./mode-evaluator.js';export{BUILTIN_MODES}from'./modes.js';export{registerIndustryPack,validatePackManifest,listRegisteredPacks,unregisterIndustryPack,scanPacks,rescanPack,resolveIndustryPackDir,scanDefaultIndustryPacks,scaffoldIndustryPack,seedBuiltinIndustryTemplates,diffIndustryPack,resetIndustryPath,readMergedPackIfPresent,buildPristineMergedPack,locatePackAndRemainder,ensureIndustryReadme,industryReadmeContent}from'./industry-pack.js';export{registerDisputeRules,registerComplianceRules,registerSupplyRules,registerIndustryRules,registerIndustryPlaybook,resolveDisputeRules,resolveComplianceRules,resolveSupplyRules,resolveIndustryRules,resolveIndustryPlaybook,listRegisteredDisputeCategories,listRegisteredComplianceCategories,listRegisteredSupplyCategories,listRegisteredIndustryRuleCategories,listRegisteredPlaybookCategories,compileIndustryRule,compileIndustryRules,registerIndustryRulesToEngine,unregisterIndustryRulesFromEngine}from'./industry-layers.js';export{registerIndustryPersonae,getIndustryPersona,listPersonaeIndustries,unregisterIndustryPersonae}from'../persona/pack-personae.js';
1
+ export{CapabilityRegistry,getCapabilityRegistry,CAPABILITY_MANIFEST_VERSION}from'./capability-manifest.js';export{IndustryModeRegistry,getIndustryModeRegistry,INDUSTRY_MODE_REGISTRY_VERSION}from'./registry.js';export{MetricRegistry,getMetricRegistry,BUILTIN_METRICS_COUNT}from'./metric-registry.js';export{ConstraintRegistry,getConstraintRegistry,BUILTIN_CONSTRAINTS_COUNT}from'./constraint-registry.js';export{ModeEvaluator}from'./mode-evaluator.js';export{BUILTIN_MODES}from'./modes.js';export{registerIndustryPack,validatePackManifest,listRegisteredPacks,unregisterIndustryPack,scanPacks,rescanPack,resolveIndustryPackDir,scanDefaultIndustryPacks,scaffoldIndustryPack,seedBuiltinIndustryTemplates,diffIndustryPack,resetIndustryPath,readMergedPackIfPresent,buildPristineMergedPack,locatePackAndRemainder,ensureIndustryReadme,industryReadmeContent}from'./industry-pack.js';export{registerDisputeRules,registerComplianceRules,registerSupplyRules,registerIndustryRules,registerIndustryPlaybook,resolveDisputeRules,resolveComplianceRules,resolveSupplyRules,resolveIndustryRules,resolveIndustryPlaybook,listRegisteredDisputeCategories,listRegisteredComplianceCategories,listRegisteredSupplyCategories,listRegisteredIndustryRuleCategories,listRegisteredPlaybookCategories,compileIndustryRule,compileIndustryRules,registerIndustryRulesToEngine,unregisterIndustryRulesFromEngine}from'./industry-layers.js';export{registerIndustryPersonae,getIndustryPersona,listPersonaeIndustries,unregisterIndustryPersonae}from'../persona/pack-personae.js';