@wowok/agent-mcp 2.7.1 → 2.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (597) hide show
  1. package/dist/config/index.js +1 -1
  2. package/dist/config/runtime.js +1 -238
  3. package/dist/customer/account-events.d.ts +32 -0
  4. package/dist/customer/account-events.js +1 -0
  5. package/dist/customer/customer-advice.d.ts +1 -0
  6. package/dist/customer/customer-advice.js +1 -130
  7. package/dist/customer/index.js +1 -11
  8. package/dist/customer/industry-risks.js +1 -438
  9. package/dist/customer/info-puzzle.js +1 -681
  10. package/dist/customer/order-monitor.js +1 -328
  11. package/dist/customer/order-strategy.d.ts +1 -1
  12. package/dist/customer/order-strategy.js +1 -373
  13. package/dist/customer/post-purchase.js +1 -351
  14. package/dist/customer/preorder-compare.js +1 -34
  15. package/dist/customer/reminder-system.d.ts +2 -0
  16. package/dist/customer/reminder-system.js +1 -316
  17. package/dist/customer/risk-assessment.d.ts +1 -0
  18. package/dist/customer/risk-assessment.js +1 -397
  19. package/dist/customer/types.d.ts +2 -0
  20. package/dist/customer/types.js +1 -13
  21. package/dist/customer/user-preferences.js +1 -460
  22. package/dist/evaluation/arbitration-game.d.ts +9 -2
  23. package/dist/evaluation/arbitration-game.js +1 -48
  24. package/dist/evaluation/builtins/arbitration-score.d.ts +41 -0
  25. package/dist/evaluation/builtins/arbitration-score.js +1 -0
  26. package/dist/evaluation/builtins/demand-match.js +1 -153
  27. package/dist/evaluation/builtins/index.d.ts +1 -0
  28. package/dist/evaluation/builtins/index.js +1 -10
  29. package/dist/evaluation/builtins/service-risk.js +1 -55
  30. package/dist/evaluation/capability.js +1 -13
  31. package/dist/evaluation/category-match-rules.d.ts +30 -0
  32. package/dist/evaluation/category-match-rules.js +1 -0
  33. package/dist/evaluation/composer.js +1 -40
  34. package/dist/evaluation/engine.js +1 -175
  35. package/dist/evaluation/extract.js +1 -115
  36. package/dist/evaluation/game-strategy.d.ts +27 -0
  37. package/dist/evaluation/game-strategy.js +1 -0
  38. package/dist/evaluation/gap.js +1 -100
  39. package/dist/evaluation/index.d.ts +2 -0
  40. package/dist/evaluation/index.js +1 -11
  41. package/dist/evaluation/location-match.d.ts +42 -0
  42. package/dist/evaluation/location-match.js +1 -0
  43. package/dist/evaluation/node-game.d.ts +31 -3
  44. package/dist/evaluation/node-game.js +1 -57
  45. package/dist/evaluation/path-reasoning.d.ts +35 -0
  46. package/dist/evaluation/path-reasoning.js +1 -0
  47. package/dist/evaluation/region.d.ts +6 -0
  48. package/dist/evaluation/region.js +1 -36
  49. package/dist/evaluation/types.d.ts +18 -0
  50. package/dist/evaluation/types.js +1 -1
  51. package/dist/evaluation/user-injection.js +1 -27
  52. package/dist/experience/experience-reuse.js +1 -103
  53. package/dist/experience/index.js +1 -5
  54. package/dist/experience/intent-distill.js +1 -83
  55. package/dist/experience/realtime-feedback.js +1 -94
  56. package/dist/experience/types.js +1 -1
  57. package/dist/experience/user-profile.d.ts +1 -1
  58. package/dist/experience/user-profile.js +1 -171
  59. package/dist/extensions/business-modules.js +1 -287
  60. package/dist/extensions/capability-manifest.js +1 -781
  61. package/dist/extensions/constraint-registry.js +1 -198
  62. package/dist/extensions/index.d.ts +6 -0
  63. package/dist/extensions/index.js +1 -6
  64. package/dist/extensions/industry-layers.d.ts +75 -0
  65. package/dist/extensions/industry-layers.js +1 -0
  66. package/dist/extensions/industry-pack.d.ts +105 -0
  67. package/dist/extensions/industry-pack.js +1 -0
  68. package/dist/extensions/metric-registry.js +1 -257
  69. package/dist/extensions/mode-evaluator.d.ts +1 -1
  70. package/dist/extensions/mode-evaluator.js +1 -170
  71. package/dist/extensions/modes.js +1 -499
  72. package/dist/extensions/registry.d.ts +1 -0
  73. package/dist/extensions/registry.js +1 -717
  74. package/dist/extensions/types.js +1 -1
  75. package/dist/graph/base.d.ts +8 -0
  76. package/dist/graph/base.js +1 -0
  77. package/dist/harness/auto-escalation.js +1 -68
  78. package/dist/harness/checkpoint.js +1 -129
  79. package/dist/harness/index.d.ts +1 -0
  80. package/dist/harness/index.js +1 -78
  81. package/dist/harness/plan.d.ts +2 -0
  82. package/dist/harness/plan.js +1 -315
  83. package/dist/harness/recover.d.ts +1 -1
  84. package/dist/harness/recover.js +1 -139
  85. package/dist/harness/types.d.ts +2 -3
  86. package/dist/harness/types.js +1 -1
  87. package/dist/harness/verify.js +1 -237
  88. package/dist/index.js +1 -273
  89. package/dist/intent/enrich.js +1 -67
  90. package/dist/intent/index.js +1 -60
  91. package/dist/intent/matcher.js +1 -81
  92. package/dist/intent/store.js +1 -55
  93. package/dist/intent/types.js +1 -10
  94. package/dist/knowledge/acquisition-flywheel.js +1 -192
  95. package/dist/knowledge/allocation-confirm.js +1 -534
  96. package/dist/knowledge/allocation-context.js +1 -249
  97. package/dist/knowledge/allocation-ledger.js +1 -463
  98. package/dist/knowledge/allocation-puzzle.js +1 -298
  99. package/dist/knowledge/allocation-risk.js +1 -568
  100. package/dist/knowledge/allocation-templates.js +1 -970
  101. package/dist/knowledge/allocation-translation.js +1 -585
  102. package/dist/knowledge/anti-cheat.d.ts +37 -0
  103. package/dist/knowledge/anti-cheat.js +1 -0
  104. package/dist/knowledge/arb-confirm.d.ts +28 -0
  105. package/dist/knowledge/arb-confirm.js +1 -0
  106. package/dist/knowledge/arb-risk.js +1 -210
  107. package/dist/knowledge/arb-translation.d.ts +48 -0
  108. package/dist/knowledge/arb-translation.js +1 -0
  109. package/dist/knowledge/arbitration-confirm.js +1 -559
  110. package/dist/knowledge/arbitration-context.js +1 -505
  111. package/dist/knowledge/arbitration-ledger.js +1 -521
  112. package/dist/knowledge/arbitration-puzzle.js +1 -304
  113. package/dist/knowledge/arbitration-risk.js +1 -423
  114. package/dist/knowledge/arbitration-templates.js +1 -276
  115. package/dist/knowledge/arbitration-translation.js +1 -487
  116. package/dist/knowledge/audit-rules.js +1 -141
  117. package/dist/knowledge/bridge-confirm.d.ts +26 -0
  118. package/dist/knowledge/bridge-confirm.js +1 -0
  119. package/dist/knowledge/bridge-risk.js +1 -263
  120. package/dist/knowledge/bridge-translation.d.ts +37 -0
  121. package/dist/knowledge/bridge-translation.js +1 -0
  122. package/dist/knowledge/contact-confirm.d.ts +27 -0
  123. package/dist/knowledge/contact-confirm.js +1 -0
  124. package/dist/knowledge/contact-risk.js +1 -200
  125. package/dist/knowledge/contact-templates.js +1 -60
  126. package/dist/knowledge/contact-translation.d.ts +39 -0
  127. package/dist/knowledge/contact-translation.js +1 -0
  128. package/dist/knowledge/demand-confirm.js +1 -206
  129. package/dist/knowledge/demand-context.d.ts +17 -0
  130. package/dist/knowledge/demand-context.js +1 -0
  131. package/dist/knowledge/demand-ledger.d.ts +26 -0
  132. package/dist/knowledge/demand-ledger.js +1 -0
  133. package/dist/knowledge/demand-matching.js +1 -132
  134. package/dist/knowledge/demand-puzzle.d.ts +29 -0
  135. package/dist/knowledge/demand-puzzle.js +1 -0
  136. package/dist/knowledge/demand-risk.js +1 -240
  137. package/dist/knowledge/demand-templates.d.ts +12 -0
  138. package/dist/knowledge/demand-templates.js +1 -0
  139. package/dist/knowledge/demand-translation.js +1 -354
  140. package/dist/knowledge/deployment-scanner.js +1 -823
  141. package/dist/knowledge/dynamic-pricing.js +1 -87
  142. package/dist/knowledge/evidence-review.d.ts +12 -0
  143. package/dist/knowledge/evidence-review.js +1 -0
  144. package/dist/knowledge/examples-scanner-cli.js +1 -26
  145. package/dist/knowledge/examples-scanner.js +1 -843
  146. package/dist/knowledge/flywheel-loop.d.ts +0 -1
  147. package/dist/knowledge/flywheel-loop.js +1 -404
  148. package/dist/knowledge/fund-layer.js +1 -973
  149. package/dist/knowledge/glossary.js +1 -211
  150. package/dist/knowledge/guard-confirm.js +1 -406
  151. package/dist/knowledge/guard-context.js +1 -287
  152. package/dist/knowledge/guard-design-patterns.js +1 -360
  153. package/dist/knowledge/guard-ledger.js +1 -260
  154. package/dist/knowledge/guard-lint.js +1 -670
  155. package/dist/knowledge/guard-migration.d.ts +1 -1
  156. package/dist/knowledge/guard-migration.js +1 -228
  157. package/dist/knowledge/guard-puzzle.js +1 -805
  158. package/dist/knowledge/guard-render.js +1 -700
  159. package/dist/knowledge/guard-risk.js +1 -1879
  160. package/dist/knowledge/guard-submission-prompt.js +1 -171
  161. package/dist/knowledge/guard-templates.js +1 -1105
  162. package/dist/knowledge/guard-translation.js +1 -1119
  163. package/dist/knowledge/index.d.ts +71 -3
  164. package/dist/knowledge/index.js +1 -436
  165. package/dist/knowledge/industry-evolution.js +1 -323
  166. package/dist/knowledge/industry-generalizer.js +1 -381
  167. package/dist/knowledge/industry-registry.js +1 -174
  168. package/dist/knowledge/intent-metrics.d.ts +4 -3
  169. package/dist/knowledge/intent-metrics.js +1 -566
  170. package/dist/knowledge/machine-confirm.js +1 -559
  171. package/dist/knowledge/machine-context.js +1 -833
  172. package/dist/knowledge/machine-ledger.js +1 -338
  173. package/dist/knowledge/machine-puzzle.js +1 -494
  174. package/dist/knowledge/machine-render.js +1 -565
  175. package/dist/knowledge/machine-risk.js +1 -669
  176. package/dist/knowledge/machine-templates.js +1 -1597
  177. package/dist/knowledge/machine-topology.js +1 -234
  178. package/dist/knowledge/machine-translation.js +1 -513
  179. package/dist/knowledge/market-metrics.d.ts +12 -0
  180. package/dist/knowledge/market-metrics.js +1 -0
  181. package/dist/knowledge/market-operations.d.ts +46 -0
  182. package/dist/knowledge/market-operations.js +1 -0
  183. package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
  184. package/dist/knowledge/mcp-schema-audit.d.ts +22 -22
  185. package/dist/knowledge/mcp-schema-audit.js +1 -777
  186. package/dist/knowledge/onchain-constants.js +1 -35
  187. package/dist/knowledge/order-confirm.js +1 -573
  188. package/dist/knowledge/order-context.js +1 -390
  189. package/dist/knowledge/order-ledger.js +1 -341
  190. package/dist/knowledge/order-puzzle.js +1 -255
  191. package/dist/knowledge/order-risk.js +1 -653
  192. package/dist/knowledge/order-templates.js +1 -368
  193. package/dist/knowledge/order-translation.js +1 -550
  194. package/dist/knowledge/overrides-loader.js +1 -65
  195. package/dist/knowledge/passport-confirm.js +1 -531
  196. package/dist/knowledge/passport-context.js +1 -306
  197. package/dist/knowledge/passport-ledger.js +1 -282
  198. package/dist/knowledge/passport-puzzle.js +1 -333
  199. package/dist/knowledge/passport-risk.js +1 -450
  200. package/dist/knowledge/passport-templates.js +1 -568
  201. package/dist/knowledge/passport-translation.js +1 -516
  202. package/dist/knowledge/payment-confirm.d.ts +26 -0
  203. package/dist/knowledge/payment-confirm.js +1 -0
  204. package/dist/knowledge/payment-risk.js +1 -249
  205. package/dist/knowledge/payment-translation.d.ts +37 -0
  206. package/dist/knowledge/payment-translation.js +1 -0
  207. package/dist/knowledge/permission-confirm.js +1 -426
  208. package/dist/knowledge/permission-context.js +1 -224
  209. package/dist/knowledge/permission-ledger.d.ts +11 -0
  210. package/dist/knowledge/permission-ledger.js +1 -403
  211. package/dist/knowledge/permission-puzzle.js +1 -173
  212. package/dist/knowledge/permission-risk.js +1 -411
  213. package/dist/knowledge/permission-templates.js +1 -234
  214. package/dist/knowledge/permission-translation.js +1 -350
  215. package/dist/knowledge/personal-confirm.d.ts +29 -0
  216. package/dist/knowledge/personal-confirm.js +1 -0
  217. package/dist/knowledge/personal-risk.js +1 -212
  218. package/dist/knowledge/personal-translation.d.ts +37 -0
  219. package/dist/knowledge/personal-translation.js +1 -0
  220. package/dist/knowledge/process-model.d.ts +1 -11
  221. package/dist/knowledge/process-model.js +1 -160
  222. package/dist/knowledge/progress-confirm.js +1 -456
  223. package/dist/knowledge/progress-context.js +1 -452
  224. package/dist/knowledge/progress-ledger.js +1 -330
  225. package/dist/knowledge/progress-puzzle.js +1 -219
  226. package/dist/knowledge/progress-risk.js +1 -461
  227. package/dist/knowledge/progress-templates.js +1 -228
  228. package/dist/knowledge/progress-translation.js +1 -405
  229. package/dist/knowledge/proof-confirm.js +1 -187
  230. package/dist/knowledge/proof-context.d.ts +17 -0
  231. package/dist/knowledge/proof-context.js +1 -0
  232. package/dist/knowledge/proof-ledger.d.ts +34 -0
  233. package/dist/knowledge/proof-ledger.js +1 -0
  234. package/dist/knowledge/proof-puzzle.d.ts +35 -0
  235. package/dist/knowledge/proof-puzzle.js +1 -0
  236. package/dist/knowledge/proof-risk.js +1 -207
  237. package/dist/knowledge/proof-templates.d.ts +22 -0
  238. package/dist/knowledge/proof-templates.js +1 -0
  239. package/dist/knowledge/proof-translation.js +1 -283
  240. package/dist/knowledge/registrar-confirm.d.ts +26 -0
  241. package/dist/knowledge/registrar-confirm.js +1 -0
  242. package/dist/knowledge/registrar-risk.js +1 -217
  243. package/dist/knowledge/registrar-translation.d.ts +37 -0
  244. package/dist/knowledge/registrar-translation.js +1 -0
  245. package/dist/knowledge/repository-confirm.js +1 -286
  246. package/dist/knowledge/repository-context.d.ts +12 -0
  247. package/dist/knowledge/repository-context.js +1 -0
  248. package/dist/knowledge/repository-ledger.d.ts +25 -0
  249. package/dist/knowledge/repository-ledger.js +1 -0
  250. package/dist/knowledge/repository-puzzle.d.ts +30 -0
  251. package/dist/knowledge/repository-puzzle.js +1 -0
  252. package/dist/knowledge/repository-risk.js +1 -373
  253. package/dist/knowledge/repository-templates.d.ts +14 -0
  254. package/dist/knowledge/repository-templates.js +1 -0
  255. package/dist/knowledge/repository-translation.js +1 -445
  256. package/dist/knowledge/reputation-rules.js +1 -99
  257. package/dist/knowledge/resource-confirm.d.ts +25 -0
  258. package/dist/knowledge/resource-confirm.js +1 -0
  259. package/dist/knowledge/resource-risk.js +1 -157
  260. package/dist/knowledge/resource-translation.d.ts +37 -0
  261. package/dist/knowledge/resource-translation.js +1 -0
  262. package/dist/knowledge/reward-confirm.js +1 -526
  263. package/dist/knowledge/reward-context.d.ts +2 -2
  264. package/dist/knowledge/reward-context.js +1 -504
  265. package/dist/knowledge/reward-ledger.js +1 -502
  266. package/dist/knowledge/reward-puzzle.js +1 -300
  267. package/dist/knowledge/reward-risk.js +1 -627
  268. package/dist/knowledge/reward-templates.js +1 -197
  269. package/dist/knowledge/reward-translation.js +1 -501
  270. package/dist/knowledge/safety-rules.d.ts +1 -0
  271. package/dist/knowledge/safety-rules.js +1 -404
  272. package/dist/knowledge/scenario-modes.js +1 -321
  273. package/dist/knowledge/service-confirm.js +1 -807
  274. package/dist/knowledge/service-context.js +1 -403
  275. package/dist/knowledge/service-ledger.js +1 -609
  276. package/dist/knowledge/service-puzzle.js +1 -236
  277. package/dist/knowledge/service-risk.d.ts +1 -1
  278. package/dist/knowledge/service-risk.js +1 -651
  279. package/dist/knowledge/service-templates.js +1 -456
  280. package/dist/knowledge/service-translation.js +1 -622
  281. package/dist/knowledge/template-registry.js +1 -353
  282. package/dist/knowledge/tool-constraints.js +1 -195
  283. package/dist/knowledge/tools-reference.js +1 -178
  284. package/dist/knowledge/treasury-confirm.js +1 -512
  285. package/dist/knowledge/treasury-context.js +1 -363
  286. package/dist/knowledge/treasury-ledger.js +1 -300
  287. package/dist/knowledge/treasury-puzzle.js +1 -216
  288. package/dist/knowledge/treasury-risk.js +1 -440
  289. package/dist/knowledge/treasury-templates.js +1 -358
  290. package/dist/knowledge/treasury-translation.js +1 -498
  291. package/dist/knowledge/trust-metrics.js +1 -198
  292. package/dist/knowledge/universal-template.d.ts +22 -0
  293. package/dist/knowledge/universal-template.js +1 -0
  294. package/dist/knowledge/util-confirm.d.ts +24 -0
  295. package/dist/knowledge/util-confirm.js +1 -0
  296. package/dist/knowledge/util-risk.js +1 -135
  297. package/dist/knowledge/util-translation.d.ts +38 -0
  298. package/dist/knowledge/util-translation.js +1 -0
  299. package/dist/knowledge/workflow-guidance.d.ts +116 -0
  300. package/dist/knowledge/workflow-guidance.js +1 -0
  301. package/dist/loop-engineering/aggregate.js +1 -132
  302. package/dist/loop-engineering/context-collect.js +1 -83
  303. package/dist/loop-engineering/diagnose.js +1 -273
  304. package/dist/loop-engineering/improve.js +1 -405
  305. package/dist/loop-engineering/index.js +1 -4
  306. package/dist/loop-engineering/pipeline.js +1 -56
  307. package/dist/mode-market/index.js +1 -3
  308. package/dist/mode-market/registry.js +1 -124
  309. package/dist/mode-market/review.js +1 -214
  310. package/dist/mode-market/submission.js +1 -85
  311. package/dist/participation/collaborator-interest.d.ts +23 -0
  312. package/dist/participation/collaborator-interest.js +1 -0
  313. package/dist/participation/customer-interest.d.ts +25 -0
  314. package/dist/participation/customer-interest.js +1 -0
  315. package/dist/participation/employee-kpi.d.ts +25 -0
  316. package/dist/participation/employee-kpi.js +1 -0
  317. package/dist/participation/employee-store.d.ts +16 -0
  318. package/dist/participation/employee-store.js +1 -0
  319. package/dist/participation/index.d.ts +2 -0
  320. package/dist/participation/index.js +1 -0
  321. package/dist/participation/merchant-interest.js +1 -100
  322. package/dist/participation/radar-core.d.ts +13 -3
  323. package/dist/participation/radar-core.js +1 -269
  324. package/dist/participation/supplier-interest.d.ts +25 -0
  325. package/dist/participation/supplier-interest.js +1 -0
  326. package/dist/persona/analyzer.js +1 -66
  327. package/dist/persona/bridge.js +1 -86
  328. package/dist/persona/defaults.js +1 -195
  329. package/dist/persona/experience-bridge.js +1 -23
  330. package/dist/persona/index.d.ts +9 -2
  331. package/dist/persona/index.js +1 -71
  332. package/dist/persona/local-region.d.ts +20 -0
  333. package/dist/persona/local-region.js +1 -0
  334. package/dist/persona/model.js +1 -111
  335. package/dist/persona/overrides.d.ts +10 -0
  336. package/dist/persona/overrides.js +1 -0
  337. package/dist/persona/pack-personae.d.ts +11 -0
  338. package/dist/persona/pack-personae.js +1 -0
  339. package/dist/persona/store.js +1 -62
  340. package/dist/persona/strategy-intent.d.ts +20 -0
  341. package/dist/persona/strategy-intent.js +1 -0
  342. package/dist/persona/types.d.ts +6 -2
  343. package/dist/persona/types.js +1 -5
  344. package/dist/project/business-puzzle.d.ts +1 -1
  345. package/dist/project/business-puzzle.js +1 -383
  346. package/dist/project/context-assembly.js +1 -254
  347. package/dist/project/deployment-bridge.js +1 -120
  348. package/dist/project/deployment-doc.js +1 -1126
  349. package/dist/project/edit-planner.js +1 -1342
  350. package/dist/project/evaluation.d.ts +37 -1
  351. package/dist/project/evaluation.js +1 -2011
  352. package/dist/project/game-theory.js +1 -177
  353. package/dist/project/graph-builder.js +1 -656
  354. package/dist/project/graph.d.ts +3 -6
  355. package/dist/project/graph.js +1 -340
  356. package/dist/project/handlers.d.ts +33 -2
  357. package/dist/project/handlers.js +1 -1784
  358. package/dist/project/index.d.ts +2 -0
  359. package/dist/project/index.js +1 -301
  360. package/dist/project/intent-analyzer.js +1 -149
  361. package/dist/project/machine-nodes.js +1 -36
  362. package/dist/project/merchant-guide.d.ts +19 -0
  363. package/dist/project/merchant-guide.js +1 -264
  364. package/dist/project/migration.js +1 -125
  365. package/dist/project/mode-actions.js +1 -309
  366. package/dist/project/namespace.js +1 -206
  367. package/dist/project/participation-radar.js +1 -428
  368. package/dist/project/pipeline-actions.js +1 -109
  369. package/dist/project/project-store.js +1 -422
  370. package/dist/project/query.js +1 -153
  371. package/dist/project/reverse-mapping.d.ts +34 -0
  372. package/dist/project/reverse-mapping.js +1 -0
  373. package/dist/project/risk-aggregator.js +1 -295
  374. package/dist/project/rollback-policy.js +1 -290
  375. package/dist/project/semantic-assembler.js +1 -345
  376. package/dist/project/semantic-graph.d.ts +3 -5
  377. package/dist/project/semantic-graph.js +1 -292
  378. package/dist/project/stage-gate.js +1 -369
  379. package/dist/project/substep-trace.js +1 -332
  380. package/dist/project/task-tracker.js +1 -78
  381. package/dist/project/workflow-design-assessment.d.ts +24 -0
  382. package/dist/project/workflow-design-assessment.js +1 -0
  383. package/dist/role/derivation.d.ts +18 -0
  384. package/dist/role/derivation.js +1 -0
  385. package/dist/role/index.d.ts +5 -0
  386. package/dist/role/index.js +1 -0
  387. package/dist/role/model.d.ts +8 -0
  388. package/dist/role/model.js +1 -0
  389. package/dist/role/resolution.d.ts +11 -0
  390. package/dist/role/resolution.js +1 -0
  391. package/dist/role/types.d.ts +11 -0
  392. package/dist/role/types.js +1 -0
  393. package/dist/rules.js +1 -52
  394. package/dist/safety/confirm-gate.d.ts +1 -1
  395. package/dist/safety/confirm-gate.js +1 -88
  396. package/dist/safety/index.js +1 -3
  397. package/dist/safety/preview.js +1 -52
  398. package/dist/schema/call/allocation.d.ts +186 -1385
  399. package/dist/schema/call/allocation.js +1 -34
  400. package/dist/schema/call/arbitration.d.ts +272 -1871
  401. package/dist/schema/call/arbitration.js +1 -113
  402. package/dist/schema/call/base.d.ts +1831 -9076
  403. package/dist/schema/call/base.js +1 -370
  404. package/dist/schema/call/bridge.d.ts +911 -3171
  405. package/dist/schema/call/bridge.js +1 -458
  406. package/dist/schema/call/contact.d.ts +135 -931
  407. package/dist/schema/call/contact.js +1 -37
  408. package/dist/schema/call/demand.d.ts +164 -1194
  409. package/dist/schema/call/demand.js +1 -47
  410. package/dist/schema/call/guard.d.ts +298 -1140
  411. package/dist/schema/call/guard.js +1 -161
  412. package/dist/schema/call/handler.js +1 -322
  413. package/dist/schema/call/index.js +1 -20
  414. package/dist/schema/call/machine.d.ts +459 -5403
  415. package/dist/schema/call/machine.js +1 -193
  416. package/dist/schema/call/order.d.ts +137 -844
  417. package/dist/schema/call/order.js +1 -35
  418. package/dist/schema/call/payment.d.ts +74 -561
  419. package/dist/schema/call/payment.js +1 -37
  420. package/dist/schema/call/permission-handler.js +1 -54
  421. package/dist/schema/call/permission.d.ts +335 -2791
  422. package/dist/schema/call/permission.js +1 -105
  423. package/dist/schema/call/personal.d.ts +227 -1814
  424. package/dist/schema/call/personal.js +1 -78
  425. package/dist/schema/call/progress.d.ts +140 -843
  426. package/dist/schema/call/progress.js +1 -47
  427. package/dist/schema/call/proof.d.ts +42 -258
  428. package/dist/schema/call/proof.js +1 -33
  429. package/dist/schema/call/repository.d.ts +324 -2222
  430. package/dist/schema/call/repository.js +1 -77
  431. package/dist/schema/call/reward.d.ts +153 -1183
  432. package/dist/schema/call/reward.js +1 -30
  433. package/dist/schema/call/semantic.js +1 -1679
  434. package/dist/schema/call/service.d.ts +376 -3431
  435. package/dist/schema/call/service.js +1 -184
  436. package/dist/schema/call/treasury.d.ts +252 -2158
  437. package/dist/schema/call/treasury.js +1 -71
  438. package/dist/schema/common/index.d.ts +222 -697
  439. package/dist/schema/common/index.js +1 -407
  440. package/dist/schema/config/index.d.ts +18 -161
  441. package/dist/schema/config/index.js +1 -68
  442. package/dist/schema/employee/index.d.ts +99 -0
  443. package/dist/schema/employee/index.js +1 -0
  444. package/dist/schema/evaluation/index.d.ts +1062 -3748
  445. package/dist/schema/evaluation/index.js +1 -356
  446. package/dist/schema/index.d.ts +3 -0
  447. package/dist/schema/index.js +1 -17
  448. package/dist/schema/industry-pack/index.d.ts +132 -0
  449. package/dist/schema/industry-pack/index.js +1 -0
  450. package/dist/schema/intent-radar/index.d.ts +92 -245
  451. package/dist/schema/intent-radar/index.js +1 -89
  452. package/dist/schema/local/index.d.ts +2045 -18080
  453. package/dist/schema/local/index.js +1 -927
  454. package/dist/schema/local/wip.d.ts +61 -651
  455. package/dist/schema/local/wip.js +1 -187
  456. package/dist/schema/messenger/index.d.ts +949 -5557
  457. package/dist/schema/messenger/index.js +1 -475
  458. package/dist/schema/operations.d.ts +2969 -26518
  459. package/dist/schema/operations.js +1 -520
  460. package/dist/schema/persona/index.d.ts +469 -1820
  461. package/dist/schema/persona/index.js +1 -148
  462. package/dist/schema/project/index.d.ts +1027 -8408
  463. package/dist/schema/project/index.js +1 -2057
  464. package/dist/schema/query/index.d.ts +12041 -75261
  465. package/dist/schema/query/index.js +1 -1646
  466. package/dist/schema/schema-query/index.d.ts +35 -98
  467. package/dist/schema/schema-query/index.js +1 -104
  468. package/dist/schema/schema-version.js +1 -76
  469. package/dist/schema/task-status.d.ts +26 -132
  470. package/dist/schema/task-status.js +1 -36
  471. package/dist/schema/trust/index.d.ts +194 -1290
  472. package/dist/schema/trust/index.js +1 -314
  473. package/dist/schema/utils/guard-parser.js +1 -419
  474. package/dist/schema/utils/guard-query-utils.js +1 -46
  475. package/dist/schema/utils/node-parser.js +1 -369
  476. package/dist/schema/utils/object-type-utils.js +1 -35
  477. package/dist/schema/utils/permission-index-utils.js +1 -7
  478. package/dist/schema/utils/permission-machine-check.js +1 -121
  479. package/dist/schema/utils/skills-recommendation.d.ts +1 -0
  480. package/dist/schema/utils/skills-recommendation.js +1 -77
  481. package/dist/schema/workspace/index.d.ts +69 -0
  482. package/dist/schema/workspace/index.js +1 -0
  483. package/dist/schema-query-impl/index.js +1 -0
  484. package/dist/schemas/account_operation.output.json +3147 -1652
  485. package/dist/schemas/account_operation.schema.json +225 -218
  486. package/dist/schemas/bridge_operation.output.json +1168 -650
  487. package/dist/schemas/bridge_operation.schema.json +736 -504
  488. package/dist/schemas/config_operation.output.json +185 -179
  489. package/dist/schemas/config_operation.schema.json +21 -26
  490. package/dist/schemas/employee_operation.output.json +207 -0
  491. package/dist/schemas/employee_operation.schema.json +176 -0
  492. package/dist/schemas/evaluation_operation.output.json +2329 -557
  493. package/dist/schemas/evaluation_operation.schema.json +2939 -720
  494. package/dist/schemas/guard2file.output.json +58 -64
  495. package/dist/schemas/guard2file.schema.json +79 -81
  496. package/dist/schemas/index.json +29 -11
  497. package/dist/schemas/industry_pack_operation.output.json +594 -0
  498. package/dist/schemas/industry_pack_operation.schema.json +55 -0
  499. package/dist/schemas/intent_radar.output.json +275 -200
  500. package/dist/schemas/intent_radar.schema.json +124 -123
  501. package/dist/schemas/local_info_operation.output.json +1174 -657
  502. package/dist/schemas/local_info_operation.schema.json +119 -125
  503. package/dist/schemas/local_mark_operation.output.json +1239 -689
  504. package/dist/schemas/local_mark_operation.schema.json +91 -96
  505. package/dist/schemas/machineNode2file.output.json +63 -69
  506. package/dist/schemas/machineNode2file.schema.json +79 -81
  507. package/dist/schemas/messenger_operation.output.json +2722 -1528
  508. package/dist/schemas/messenger_operation.schema.json +1482 -1264
  509. package/dist/schemas/onchain_events.output.json +2590 -975
  510. package/dist/schemas/onchain_events.schema.json +117 -99
  511. package/dist/schemas/onchain_operations.output.json +3957 -2309
  512. package/dist/schemas/onchain_operations.schema.json +20799 -9285
  513. package/dist/schemas/onchain_operations_allocation.schema.json +172 -108
  514. package/dist/schemas/onchain_operations_arbitration.schema.json +233 -146
  515. package/dist/schemas/onchain_operations_contact.schema.json +129 -90
  516. package/dist/schemas/onchain_operations_demand.schema.json +170 -112
  517. package/dist/schemas/onchain_operations_gen_passport.schema.json +61 -646
  518. package/dist/schemas/onchain_operations_gen_proof.schema.json +40 -172
  519. package/dist/schemas/onchain_operations_guard.schema.json +3765 -294
  520. package/dist/schemas/onchain_operations_machine.schema.json +537 -164
  521. package/dist/schemas/onchain_operations_order.schema.json +126 -96
  522. package/dist/schemas/onchain_operations_payment.schema.json +82 -67
  523. package/dist/schemas/onchain_operations_permission.schema.json +331 -93
  524. package/dist/schemas/onchain_operations_personal.schema.json +636 -96
  525. package/dist/schemas/onchain_operations_progress.schema.json +125 -92
  526. package/dist/schemas/onchain_operations_proof.schema.json +76 -69
  527. package/dist/schemas/onchain_operations_repository.schema.json +636 -249
  528. package/dist/schemas/onchain_operations_reward.schema.json +218 -108
  529. package/dist/schemas/onchain_operations_service.schema.json +679 -221
  530. package/dist/schemas/onchain_operations_treasury.schema.json +401 -135
  531. package/dist/schemas/onchain_table_data.output.json +6018 -2430
  532. package/dist/schemas/onchain_table_data.schema.json +544 -430
  533. package/dist/schemas/persona_operation.output.json +1568 -265
  534. package/dist/schemas/persona_operation.schema.json +346 -202
  535. package/dist/schemas/project_operation.output.json +6957 -5147
  536. package/dist/schemas/project_operation.schema.json +1050 -1020
  537. package/dist/schemas/query_task_status.output.json +195 -99
  538. package/dist/schemas/query_task_status.schema.json +12 -18
  539. package/dist/schemas/query_toolkit.output.json +18870 -14566
  540. package/dist/schemas/query_toolkit.schema.json +614 -522
  541. package/dist/schemas/schema_query.output.json +127 -129
  542. package/dist/schemas/schema_query.schema.json +64 -69
  543. package/dist/schemas/trust_score.output.json +678 -587
  544. package/dist/schemas/trust_score.schema.json +289 -277
  545. package/dist/schemas/wip_file.output.json +116 -124
  546. package/dist/schemas/wip_file.schema.json +142 -143
  547. package/dist/schemas/workspace_operation.output.json +277 -0
  548. package/dist/schemas/workspace_operation.schema.json +45 -0
  549. package/dist/schemas/wowok_buildin_info.output.json +1693 -723
  550. package/dist/schemas/wowok_buildin_info.schema.json +576 -512
  551. package/dist/telemetry/index.js +1 -112
  552. package/dist/telemetry/redact.js +1 -23
  553. package/dist/telemetry/storage.js +1 -80
  554. package/dist/tools/handlers/bridge.d.ts +8 -1
  555. package/dist/tools/handlers/bridge.js +1 -1
  556. package/dist/tools/handlers/config.js +1 -74
  557. package/dist/tools/handlers/employee.d.ts +2 -0
  558. package/dist/tools/handlers/employee.js +1 -0
  559. package/dist/tools/handlers/evaluation.js +1 -123
  560. package/dist/tools/handlers/file-export.js +1 -90
  561. package/dist/tools/handlers/industry-pack.d.ts +2 -0
  562. package/dist/tools/handlers/industry-pack.js +1 -0
  563. package/dist/tools/handlers/intent-radar.js +1 -76
  564. package/dist/tools/handlers/local.js +1 -53
  565. package/dist/tools/handlers/messenger.js +1 -188
  566. package/dist/tools/handlers/onchain.js +1 -1180
  567. package/dist/tools/handlers/persona.js +1 -89
  568. package/dist/tools/handlers/project.js +1 -211
  569. package/dist/tools/handlers/query.js +1 -434
  570. package/dist/tools/handlers/schema-query.js +1 -176
  571. package/dist/tools/handlers/task-status.js +1 -26
  572. package/dist/tools/handlers/trust.js +1 -380
  573. package/dist/tools/handlers/wip.js +1 -90
  574. package/dist/tools/handlers/workspace.d.ts +2 -0
  575. package/dist/tools/handlers/workspace.js +1 -0
  576. package/dist/tools/index.d.ts +2 -1
  577. package/dist/tools/index.js +1 -1382
  578. package/dist/tools/retry.js +1 -85
  579. package/dist/tools/rules-hook.d.ts +1 -1
  580. package/dist/tools/rules-hook.js +1 -23
  581. package/dist/tools/shared.d.ts +1 -1
  582. package/dist/tools/shared.js +1 -130
  583. package/dist/tools/types.d.ts +2 -1
  584. package/dist/tools/types.js +1 -1
  585. package/dist/tools/upgrade-check.d.ts +19 -0
  586. package/dist/tools/upgrade-check.js +1 -0
  587. package/dist/tools/wip-deploy-assist.js +1 -306
  588. package/dist/tools/wrap.js +1 -500
  589. package/package.json +7 -6
  590. package/dist/knowledge/arbitration-trust.d.ts +0 -24
  591. package/dist/knowledge/arbitration-trust.js +0 -117
  592. package/dist/schema/call/bridge-handler.d.ts +0 -8
  593. package/dist/schema/call/bridge-handler.js +0 -265
  594. package/dist/schema/sync-layer4.d.ts +0 -21
  595. package/dist/schema/sync-layer4.js +0 -286
  596. package/dist/schema-query/index.js +0 -810
  597. /package/dist/{schema-query → schema-query-impl}/index.d.ts +0 -0
@@ -1,214 +1 @@
1
- export const AUDIT_CHECKLIST = [
2
- {
3
- key: "permission_indexes_valid",
4
- label: "Permission indexes are valid (1000-65535 range, no conflicts)",
5
- required: true,
6
- description: "All permission indexes in default_permissions must be in the valid range and not conflict with namedOperator assignments.",
7
- },
8
- {
9
- key: "machine_nodes_min_two",
10
- label: "Machine has at least 2 nodes (entry + terminal)",
11
- required: true,
12
- description: "The scenario template's Machine object must define at least 2 nodes.",
13
- },
14
- {
15
- key: "guards_immutable_flagged",
16
- label: "Immutable objects (Guard) are flagged with risk_flags",
17
- required: true,
18
- description: "All Guard objects must have 'immutable_after_creation' in risk_flags.",
19
- },
20
- {
21
- key: "allocation_sum_correct",
22
- label: "Allocation sharing ratios sum to 10000 basis points",
23
- required: true,
24
- description: "When allocation is defined, the sharing percentages must sum to 100% (10000 bps).",
25
- },
26
- {
27
- key: "dependencies_acyclic",
28
- label: "Object dependencies form a DAG (no cycles)",
29
- required: true,
30
- description: "The object dependency graph must not contain cycles.",
31
- },
32
- {
33
- key: "phases_cover_objects",
34
- label: "All phases reference valid object types",
35
- required: true,
36
- description: "Every phase's object_types must be a subset of the objects defined in the template.",
37
- },
38
- {
39
- key: "description_non_empty",
40
- label: "Template has a non-empty description",
41
- required: false,
42
- description: "The template should have a meaningful description for users.",
43
- },
44
- {
45
- key: "keywords_non_empty",
46
- label: "Template has at least 3 keywords for intent matching",
47
- required: false,
48
- description: "Keywords help the Plan Loop match user intent to this template.",
49
- },
50
- {
51
- key: "arbiter_configured",
52
- label: "Arbiter permission is configured",
53
- required: false,
54
- description: "The template should specify an arbiter role for dispute resolution.",
55
- },
56
- {
57
- key: "no_infinite_loops",
58
- label: "Machine state graph has no infinite loops (terminal node reachable)",
59
- required: true,
60
- description: "The Machine must have a path to a terminal state from every node.",
61
- },
62
- ];
63
- function validatePermissionIndexes(entry) {
64
- const perms = entry.scenario.default_permissions;
65
- if (perms.provider !== undefined) {
66
- if (typeof perms.provider === "number" && (perms.provider < 1000 || perms.provider > 65535)) {
67
- return false;
68
- }
69
- }
70
- if (perms.arbiter !== undefined) {
71
- if (typeof perms.arbiter === "number" && (perms.arbiter < 1000 || perms.arbiter > 65535)) {
72
- return false;
73
- }
74
- }
75
- return true;
76
- }
77
- function validateMachineNodes(entry) {
78
- const machineObjects = entry.scenario.objects.filter((o) => o.type === "Machine");
79
- if (machineObjects.length === 0)
80
- return true;
81
- return true;
82
- }
83
- function validateGuardsFlagged(entry) {
84
- const guardObjects = entry.scenario.objects.filter((o) => o.type === "Guard");
85
- for (const g of guardObjects) {
86
- if (!g.risk_flags || !g.risk_flags.includes("immutable_after_creation")) {
87
- return false;
88
- }
89
- }
90
- return true;
91
- }
92
- function validateAllocationSum(entry) {
93
- const allocObjects = entry.scenario.objects.filter((o) => o.type === "Allocation");
94
- if (allocObjects.length === 0)
95
- return true;
96
- return true;
97
- }
98
- function validateDependenciesAcyclic(entry) {
99
- const objects = entry.scenario.objects;
100
- const visited = new Set();
101
- const recursionStack = new Set();
102
- function hasCycle(objType, path) {
103
- if (recursionStack.has(objType))
104
- return true;
105
- if (visited.has(objType))
106
- return false;
107
- visited.add(objType);
108
- recursionStack.add(objType);
109
- const obj = objects.find((o) => o.type === objType);
110
- if (obj) {
111
- for (const dep of obj.dependencies) {
112
- if (path.has(dep))
113
- continue;
114
- if (hasCycle(dep, new Set([...path, objType])))
115
- return true;
116
- }
117
- }
118
- recursionStack.delete(objType);
119
- return false;
120
- }
121
- for (const obj of objects) {
122
- visited.clear();
123
- recursionStack.clear();
124
- if (hasCycle(obj.type, new Set()))
125
- return false;
126
- }
127
- return true;
128
- }
129
- function validatePhasesCoverObjects(entry) {
130
- const definedTypes = new Set(entry.scenario.objects.map((o) => o.type));
131
- for (const phase of entry.scenario.phases) {
132
- for (const ot of phase.object_types) {
133
- if (!definedTypes.has(ot))
134
- return false;
135
- }
136
- }
137
- return true;
138
- }
139
- function validateDescription(entry) {
140
- return !!entry.description && entry.description.trim().length > 0;
141
- }
142
- function validateKeywords(entry) {
143
- return entry.scenario.keywords.length >= 3;
144
- }
145
- function validateArbiter(entry) {
146
- return entry.scenario.default_permissions.arbiter !== undefined;
147
- }
148
- function validateNoInfiniteLoops(entry) {
149
- return true;
150
- }
151
- const VALIDATORS = {
152
- permission_indexes_valid: validatePermissionIndexes,
153
- machine_nodes_min_two: validateMachineNodes,
154
- guards_immutable_flagged: validateGuardsFlagged,
155
- allocation_sum_correct: validateAllocationSum,
156
- dependencies_acyclic: validateDependenciesAcyclic,
157
- phases_cover_objects: validatePhasesCoverObjects,
158
- description_non_empty: validateDescription,
159
- keywords_non_empty: validateKeywords,
160
- arbiter_configured: validateArbiter,
161
- no_infinite_loops: validateNoInfiniteLoops,
162
- };
163
- export function runAudit(entry, auditor) {
164
- const checklistResults = {};
165
- const failedRequired = [];
166
- for (const item of AUDIT_CHECKLIST) {
167
- const validator = VALIDATORS[item.key];
168
- const passed = validator ? validator(entry) : true;
169
- checklistResults[item.key] = passed;
170
- if (!passed && item.required) {
171
- failedRequired.push(item.key);
172
- }
173
- }
174
- const auditId = `AUDIT-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
175
- const notes = failedRequired.length === 0
176
- ? "All required checklist items passed."
177
- : `Failed required items: ${failedRequired.join(", ")}`;
178
- return {
179
- audit_id: auditId,
180
- template_id: entry.template_id,
181
- auditor,
182
- timestamp: new Date().toISOString(),
183
- checklist_results: checklistResults,
184
- passed: failedRequired.length === 0,
185
- failed_required_items: failedRequired,
186
- notes,
187
- };
188
- }
189
- export const MIN_COMMUNITY_RATING_FOR_APPROVAL = 3.5;
190
- export const MIN_REVIEWS_FOR_APPROVAL = 1;
191
- export function meetsCommunityRatingThreshold(entry) {
192
- if (entry.reviews.length < MIN_REVIEWS_FOR_APPROVAL)
193
- return false;
194
- return entry.average_rating >= MIN_COMMUNITY_RATING_FOR_APPROVAL;
195
- }
196
- export function canApprove(entry, audit) {
197
- return audit.passed && meetsCommunityRatingThreshold(entry);
198
- }
199
- export function getApprovalEligibility(entry, audit) {
200
- const blockers = [];
201
- if (!audit.passed) {
202
- blockers.push(`Official audit failed: ${audit.failed_required_items.join(", ")}`);
203
- }
204
- if (entry.reviews.length < MIN_REVIEWS_FOR_APPROVAL) {
205
- blockers.push(`Insufficient community reviews: ${entry.reviews.length}/${MIN_REVIEWS_FOR_APPROVAL}`);
206
- }
207
- if (entry.average_rating < MIN_COMMUNITY_RATING_FOR_APPROVAL) {
208
- blockers.push(`Community rating too low: ${entry.average_rating.toFixed(1)}/${MIN_COMMUNITY_RATING_FOR_APPROVAL}`);
209
- }
210
- return {
211
- eligible: blockers.length === 0,
212
- blockers,
213
- };
214
- }
1
+ export const AUDIT_CHECKLIST=[{'key':'permission_indexes_valid','label':'Permission\x20indexes\x20are\x20valid\x20(1000-65535\x20range,\x20no\x20conflicts)','required':!![],'description':'All\x20permission\x20indexes\x20in\x20default_permissions\x20must\x20be\x20in\x20the\x20valid\x20range\x20and\x20not\x20conflict\x20with\x20namedOperator\x20assignments.'},{'key':'machine_nodes_min_two','label':'Machine\x20has\x20at\x20least\x202\x20nodes\x20(entry\x20+\x20terminal)','required':!![],'description':'The\x20scenario\x20template\x27s\x20Machine\x20object\x20must\x20define\x20at\x20least\x202\x20nodes.'},{'key':'guards_immutable_flagged','label':'Immutable\x20objects\x20(Guard)\x20are\x20flagged\x20with\x20risk_flags','required':!![],'description':'All\x20Guard\x20objects\x20must\x20have\x20\x27immutable_after_creation\x27\x20in\x20risk_flags.'},{'key':'allocation_sum_correct','label':'Allocation\x20sharing\x20ratios\x20sum\x20to\x2010000\x20basis\x20points','required':!![],'description':'When\x20allocation\x20is\x20defined,\x20the\x20sharing\x20percentages\x20must\x20sum\x20to\x20100%\x20(10000\x20bps).'},{'key':'dependencies_acyclic','label':'Object\x20dependencies\x20form\x20a\x20DAG\x20(no\x20cycles)','required':!![],'description':'The\x20object\x20dependency\x20graph\x20must\x20not\x20contain\x20cycles.'},{'key':'phases_cover_objects','label':'All\x20phases\x20reference\x20valid\x20object\x20types','required':!![],'description':'Every\x20phase\x27s\x20object_types\x20must\x20be\x20a\x20subset\x20of\x20the\x20objects\x20defined\x20in\x20the\x20template.'},{'key':'description_non_empty','label':'Template\x20has\x20a\x20non-empty\x20description','required':![],'description':'The\x20template\x20should\x20have\x20a\x20meaningful\x20description\x20for\x20users.'},{'key':'keywords_non_empty','label':'Template\x20has\x20at\x20least\x203\x20keywords\x20for\x20intent\x20matching','required':![],'description':'Keywords\x20help\x20the\x20Plan\x20Loop\x20match\x20user\x20intent\x20to\x20this\x20template.'},{'key':'arbiter_configured','label':'Arbiter\x20permission\x20is\x20configured','required':![],'description':'The\x20template\x20should\x20specify\x20an\x20arbiter\x20role\x20for\x20dispute\x20resolution.'},{'key':'no_infinite_loops','label':'Machine\x20state\x20graph\x20has\x20no\x20infinite\x20loops\x20(terminal\x20node\x20reachable)','required':!![],'description':'The\x20Machine\x20must\x20have\x20a\x20path\x20to\x20a\x20terminal\x20state\x20from\x20every\x20node.'}];function validatePermissionIndexes(a){const b=a['scenario']['default_permissions'];if(b['provider']!==undefined){if(typeof b['provider']==='number'&&(b['provider']<0x3e8||b['provider']>0xffff))return![];}if(b['arbiter']!==undefined){if(typeof b['arbiter']==='number'&&(b['arbiter']<0x3e8||b['arbiter']>0xffff))return![];}return!![];}function validateMachineNodes(a){const b=a['scenario']['objects']['filter'](c=>c['type']==='Machine');if(b['length']===0x0)return!![];return!![];}function validateGuardsFlagged(a){const b=a['scenario']['objects']['filter'](c=>c['type']==='Guard');for(const c of b){if(!c['risk_flags']||!c['risk_flags']['includes']('immutable_after_creation'))return![];}return!![];}function validateAllocationSum(a){const b=a['scenario']['objects']['filter'](c=>c['type']==='Allocation');if(b['length']===0x0)return!![];return!![];}function validateDependenciesAcyclic(a){const b=a['scenario']['objects'],c=new Set(),d=new Set();function e(f,g){if(d['has'](f))return!![];if(c['has'](f))return![];c['add'](f),d['add'](f);const h=b['find'](i=>i['type']===f);if(h)for(const i of h['dependencies']){if(g['has'](i))continue;if(e(i,new Set([...g,f])))return!![];}return d['delete'](f),![];}for(const f of b){c['clear'](),d['clear']();if(e(f['type'],new Set()))return![];}return!![];}function validatePhasesCoverObjects(a){const b=new Set(a['scenario']['objects']['map'](c=>c['type']));for(const c of a['scenario']['phases']){for(const d of c['object_types']){if(!b['has'](d))return![];}}return!![];}function validateDescription(a){return!!a['description']&&a['description']['trim']()['length']>0x0;}function validateKeywords(a){return a['scenario']['keywords']['length']>=0x3;}function validateArbiter(a){return a['scenario']['default_permissions']['arbiter']!==undefined;}function validateNoInfiniteLoops(a){return!![];}const VALIDATORS={'permission_indexes_valid':validatePermissionIndexes,'machine_nodes_min_two':validateMachineNodes,'guards_immutable_flagged':validateGuardsFlagged,'allocation_sum_correct':validateAllocationSum,'dependencies_acyclic':validateDependenciesAcyclic,'phases_cover_objects':validatePhasesCoverObjects,'description_non_empty':validateDescription,'keywords_non_empty':validateKeywords,'arbiter_configured':validateArbiter,'no_infinite_loops':validateNoInfiniteLoops};export function runAudit(a,b){const c={},d=[];for(const g of AUDIT_CHECKLIST){const h=VALIDATORS[g['key']],i=h?h(a):!![];c[g['key']]=i,!i&&g['required']&&d['push'](g['key']);}const e='AUDIT-'+Date['now']()+'-'+Math['random']()['toString'](0x24)['slice'](0x2,0x6),f=d['length']===0x0?'All\x20required\x20checklist\x20items\x20passed.':'Failed\x20required\x20items:\x20'+d['join'](',\x20');return{'audit_id':e,'template_id':a['template_id'],'auditor':b,'timestamp':new Date()['toISOString'](),'checklist_results':c,'passed':d['length']===0x0,'failed_required_items':d,'notes':f};}export const MIN_COMMUNITY_RATING_FOR_APPROVAL=3.5;export const MIN_REVIEWS_FOR_APPROVAL=0x1;export function meetsCommunityRatingThreshold(a){if(a['reviews']['length']<MIN_REVIEWS_FOR_APPROVAL)return![];return a['average_rating']>=MIN_COMMUNITY_RATING_FOR_APPROVAL;}export function canApprove(a,b){return b['passed']&&meetsCommunityRatingThreshold(a);}export function getApprovalEligibility(a,b){const c=[];return!b['passed']&&c['push']('Official\x20audit\x20failed:\x20'+b['failed_required_items']['join'](',\x20')),a['reviews']['length']<MIN_REVIEWS_FOR_APPROVAL&&c['push']('Insufficient\x20community\x20reviews:\x20'+a['reviews']['length']+'/'+MIN_REVIEWS_FOR_APPROVAL),a['average_rating']<MIN_COMMUNITY_RATING_FOR_APPROVAL&&c['push']('Community\x20rating\x20too\x20low:\x20'+a['average_rating']['toFixed'](0x1)+'/'+MIN_COMMUNITY_RATING_FOR_APPROVAL),{'eligible':c['length']===0x0,'blockers':c};}
@@ -1,85 +1 @@
1
- const VALID_OBJECT_TYPES = [
2
- "Permission", "Service", "Machine", "Guard", "Allocation",
3
- "Progress", "Repository", "Treasury", "Reward", "Demand",
4
- "Order", "Arbitration", "Contact", "Personal", "Payment",
5
- ];
6
- export function validateSubmission(submission) {
7
- const errors = [];
8
- const warnings = [];
9
- if (!submission.template_name || submission.template_name.trim().length === 0) {
10
- errors.push("template_name is required");
11
- }
12
- if (!submission.submitter || submission.submitter.trim().length === 0) {
13
- errors.push("submitter is required");
14
- }
15
- if (!submission.description || submission.description.trim().length === 0) {
16
- errors.push("description is required");
17
- }
18
- if (!submission.scenario) {
19
- errors.push("scenario is required");
20
- }
21
- if (submission.version && !/^\d+\.\d+\.\d+$/.test(submission.version)) {
22
- errors.push("version must be in semver format (e.g., '1.0.0')");
23
- }
24
- if (submission.scenario) {
25
- const s = submission.scenario;
26
- if (!s.name || s.name.trim().length === 0) {
27
- errors.push("scenario.name is required");
28
- }
29
- if (!s.keywords || s.keywords.length === 0) {
30
- warnings.push("scenario.keywords is empty — intent matching will fail");
31
- }
32
- else if (s.keywords.length < 3) {
33
- warnings.push("scenario.keywords has fewer than 3 entries — intent matching may be weak");
34
- }
35
- if (!s.objects || s.objects.length === 0) {
36
- errors.push("scenario.objects must have at least one object");
37
- }
38
- else {
39
- for (const obj of s.objects) {
40
- if (!VALID_OBJECT_TYPES.includes(obj.type)) {
41
- errors.push(`Invalid object type: '${obj.type}'. Valid types: ${VALID_OBJECT_TYPES.join(", ")}`);
42
- }
43
- if (obj.dependencies.includes(obj.type)) {
44
- warnings.push(`Object type '${obj.type}' depends on itself — may cause issues`);
45
- }
46
- }
47
- }
48
- if (!s.phases || s.phases.length === 0) {
49
- warnings.push("scenario.phases is empty — no phased execution plan defined");
50
- }
51
- const perms = s.default_permissions;
52
- if (perms.provider !== undefined && typeof perms.provider === "number") {
53
- if (perms.provider < 1000 || perms.provider > 65535) {
54
- errors.push(`default_permissions.provider index ${perms.provider} is out of range (1000-65535)`);
55
- }
56
- }
57
- if (perms.arbiter !== undefined && typeof perms.arbiter === "number") {
58
- if (perms.arbiter < 1000 || perms.arbiter > 65535) {
59
- errors.push(`default_permissions.arbiter index ${perms.arbiter} is out of range (1000-65535)`);
60
- }
61
- }
62
- }
63
- if (submission.tags && submission.tags.length > 10) {
64
- warnings.push("More than 10 tags — consider trimming for relevance");
65
- }
66
- return {
67
- valid: errors.length === 0,
68
- errors,
69
- warnings,
70
- };
71
- }
72
- export function createSubmission(submitter, templateName, description, scenario, options) {
73
- return {
74
- submission_id: `SUB-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
75
- submitter,
76
- submitted_date: new Date().toISOString(),
77
- template_name: templateName,
78
- version: options?.version || "1.0.0",
79
- description,
80
- tags: options?.tags || [],
81
- scenario,
82
- contact: options?.contact,
83
- license: options?.license,
84
- };
85
- }
1
+ const VALID_OBJECT_TYPES=['Permission','Service','Machine','Guard','Allocation','Progress','Repository','Treasury','Reward','Demand','Order','Arbitration','Contact','Personal','Payment'];export function validateSubmission(a){const b=[],c=[];(!a['template_name']||a['template_name']['trim']()['length']===0x0)&&b['push']('template_name\x20is\x20required');(!a['submitter']||a['submitter']['trim']()['length']===0x0)&&b['push']('submitter\x20is\x20required');(!a['description']||a['description']['trim']()['length']===0x0)&&b['push']('description\x20is\x20required');!a['scenario']&&b['push']('scenario\x20is\x20required');a['version']&&!/^\d+\.\d+\.\d+$/['test'](a['version'])&&b['push']('version\x20must\x20be\x20in\x20semver\x20format\x20(e.g.,\x20\x271.0.0\x27)');if(a['scenario']){const d=a['scenario'];(!d['name']||d['name']['trim']()['length']===0x0)&&b['push']('scenario.name\x20is\x20required');if(!d['keywords']||d['keywords']['length']===0x0)c['push']('scenario.keywords\x20is\x20empty\x20—\x20intent\x20matching\x20will\x20fail');else d['keywords']['length']<0x3&&c['push']('scenario.keywords\x20has\x20fewer\x20than\x203\x20entries\x20—\x20intent\x20matching\x20may\x20be\x20weak');if(!d['objects']||d['objects']['length']===0x0)b['push']('scenario.objects\x20must\x20have\x20at\x20least\x20one\x20object');else for(const f of d['objects']){!VALID_OBJECT_TYPES['includes'](f['type'])&&b['push']('Invalid\x20object\x20type:\x20\x27'+f['type']+'\x27.\x20Valid\x20types:\x20'+VALID_OBJECT_TYPES['join'](',\x20')),f['dependencies']['includes'](f['type'])&&c['push']('Object\x20type\x20\x27'+f['type']+'\x27\x20depends\x20on\x20itself\x20—\x20may\x20cause\x20issues');}(!d['phases']||d['phases']['length']===0x0)&&c['push']('scenario.phases\x20is\x20empty\x20—\x20no\x20phased\x20execution\x20plan\x20defined');const e=d['default_permissions'];e['provider']!==undefined&&typeof e['provider']==='number'&&((e['provider']<0x3e8||e['provider']>0xffff)&&b['push']('default_permissions.provider\x20index\x20'+e['provider']+'\x20is\x20out\x20of\x20range\x20(1000-65535)')),e['arbiter']!==undefined&&typeof e['arbiter']==='number'&&((e['arbiter']<0x3e8||e['arbiter']>0xffff)&&b['push']('default_permissions.arbiter\x20index\x20'+e['arbiter']+'\x20is\x20out\x20of\x20range\x20(1000-65535)'));}return a['tags']&&a['tags']['length']>0xa&&c['push']('More\x20than\x2010\x20tags\x20—\x20consider\x20trimming\x20for\x20relevance'),{'valid':b['length']===0x0,'errors':b,'warnings':c};}export function createSubmission(a,b,c,d,e){return{'submission_id':'SUB-'+Date['now']()+'-'+Math['random']()['toString'](0x24)['slice'](0x2,0x8),'submitter':a,'submitted_date':new Date()['toISOString'](),'template_name':b,'version':e?.['version']||'1.0.0','description':c,'tags':e?.['tags']||[],'scenario':d,'contact':e?.['contact'],'license':e?.['license']};}
@@ -0,0 +1,23 @@
1
+ import type { RadarForward } from "./radar-core.js";
2
+ export interface CollaboratorInterestInput {
3
+ account: string;
4
+ current_node: string;
5
+ operable: RadarForward[];
6
+ waiting_on: Array<{
7
+ role: string;
8
+ forwards: string[];
9
+ }>;
10
+ collaborator_kind?: "permission_entity" | "named_operator";
11
+ arbitration_bound: boolean;
12
+ terminal?: "completed" | "refunded" | null;
13
+ stalled_hours?: number;
14
+ unread_messages?: number;
15
+ }
16
+ export interface CollaboratorInterestAnalysis {
17
+ fund_flow: string[];
18
+ responsibility: string[];
19
+ leverage: string[];
20
+ stakes: string[];
21
+ summary: string;
22
+ }
23
+ export declare function analyzeCollaboratorInterest(input: CollaboratorInterestInput): CollaboratorInterestAnalysis;
@@ -0,0 +1 @@
1
+ export function analyzeCollaboratorInterest(a){const b=[],c=[],d=[],e=[],f=a['collaborator_kind']==='named_operator'?'external\x20named\x20operator':'permission\x20entity\x20(internal\x20staff)';b['push']('As\x20a\x20'+f+',\x20you\x20carry\x20no\x20direct\x20settlement\x20stake\x20in\x20this\x20order\x20—\x20'+'your\x20compensation\x20is\x20typically\x20outside\x20the\x20on-chain\x20order\x20(salary/contract)\x20'+'unless\x20the\x20allocation\x20waterfall\x20explicitly\x20routes\x20a\x20slot\x20to\x20your\x20address.');const g=a['operable']['filter'](j=>j['guard']);a['operable']['length']>0x0&&c['push'](a['operable']['length']+'\x20forward(s)\x20are\x20executable\x20by\x20YOUR\x20role\x20right\x20now\x20'+('('+a['operable']['map'](j=>'\x27'+j['name']+'\x27')['join'](',\x20')+'):\x20your\x20inaction\x20stalls\x20the\x20workflow,\x20')+'and\x20the\x20stall\x20is\x20publicly\x20visible\x20on-chain\x20(flow\x20statistics\x20+\x20stall\x20metrics).');g['length']>0x0&&c['push']('Forward(s)\x20'+g['map'](j=>'\x27'+j['name']+'\x27')['join'](',\x20')+'\x20are\x20guard-gated:\x20YOU\x20must\x20satisfy\x20the\x20guard\x20conditions\x20'+'(evidence,\x20verification,\x20timing)\x20before\x20execution\x20—\x20prepare\x20submissions\x20(proof/repository\x20data)\x20in\x20advance.');a['terminal']==null&&a['operable']['length']===0x0&&a['waiting_on']['length']>0x0&&c['push']('No\x20forward\x20is\x20yours\x20at\x20this\x20node\x20—\x20you\x20carry\x20no\x20execution\x20responsibility\x20here;\x20'+'avoid\x20interfering\x20outside\x20your\x20permission/named-operator\x20scope\x20(creates\x20semantic\x20responsibility\x20without\x20authority).');a['operable']['length']>0x0&&a['terminal']==null&&d['push']('Advancing\x20NOW\x20keeps\x20the\x20workflow\x20flowing\x20and\x20protects\x20your\x20professional\x20reputation\x20'+'(stall\x20metrics\x20and\x20dispute\x20rate\x20are\x20public\x20and\x20read\x20by\x20future\x20counterparties).');g['length']>0x0&&d['push']('Uploading\x20evidence\x20(Repository/proof)\x20BEFORE\x20executing\x20guard-gated\x20forwards\x20reduces\x20dispute\x20probability\x20'+'and\x20pre-builds\x20the\x20merchant\x27s\x20arbitration\x20defense\x20—\x20your\x20diligence\x20is\x20visible\x20on-chain.');(a['unread_messages']??0x0)>0x0&&d['push'](a['unread_messages']+'\x20unread\x20message(s)\x20from\x20this\x20order\x27s\x20counterparties\x20—\x20timely\x20replies\x20protect\x20your\x20position\x20(WTS\x20record).');a['stalled_hours']!=null&&a['stalled_hours']>0x48&&a['terminal']==null&&e['push']('Order\x20stalled\x20'+Math['round'](a['stalled_hours'])+'h:\x20prolonged\x20stalls\x20degrade\x20flow\x20statistics\x20'+'and\x20can\x20trigger\x20timeout\x20penalties\x20or\x20disputes\x20recorded\x20permanently\x20on-chain\x20—\x20the\x20two\x20cheapest\x20reputation\x20losses\x20to\x20avoid.');a['arbitration_bound']&&a['terminal']==null&&g['length']>0x0&&e['push']('A\x20dispute\x20path\x20exists\x20and\x20you\x20hold\x20guard-gated\x20forwards:\x20if\x20the\x20guard\x20fails\x20or\x20you\x20execute\x20out-of-order,\x20'+'the\x20dispute\x20record\x20lands\x20permanently\x20on-chain\x20and\x20names\x20this\x20workflow\x27s\x20operators.');a['terminal']==='refunded'&&e['push']('Refund\x20executed:\x20the\x20order\x20is\x20closed.\x20Your\x20residual\x20exposure\x20is\x20reputational\x20—\x20'+'a\x20clean\x20close-out\x20(evidence\x20archived,\x20no\x20loose\x20ends)\x20protects\x20your\x20professional\x20standing.');const h=a['terminal']==='completed'?'order\x20completed\x20—\x20workflow\x20closed':a['terminal']==='refunded'?'order\x20refunded\x20—\x20workflow\x20closed':a['operable']['length']>0x0?'YOU\x20can\x20advance\x20'+a['operable']['length']+'\x20forward(s)\x20—\x20workflow\x20momentum\x20is\x20in\x20your\x20hands':'waiting\x20on\x20'+(a['waiting_on']['map'](j=>j['role'])['join'](',\x20')||'others')+'\x20—\x20monitor\x20only',i='Collaborator\x20interest\x20('+f+')\x20at\x20node\x20\x27'+(a['current_node']||'(entry)')+'\x27:\x20'+h+'.\x20'+'All\x20options\x20above\x20are\x20informational\x20—\x20the\x20decision\x20is\x20yours.';return{'fund_flow':b,'responsibility':c,'leverage':d,'stakes':e,'summary':i};}
@@ -0,0 +1,25 @@
1
+ import type { RadarForward } from "./radar-core.js";
2
+ export interface CustomerInterestInput {
3
+ account: string;
4
+ current_node: string;
5
+ operable: RadarForward[];
6
+ waiting_on: Array<{
7
+ role: string;
8
+ forwards: string[];
9
+ }>;
10
+ order_amount?: string;
11
+ token_type?: string;
12
+ compensation_fund?: string;
13
+ arbitration_bound: boolean;
14
+ terminal?: "completed" | "refunded" | null;
15
+ stalled_hours?: number;
16
+ unread_messages?: number;
17
+ }
18
+ export interface CustomerInterestAnalysis {
19
+ fund_flow: string[];
20
+ responsibility: string[];
21
+ leverage: string[];
22
+ stakes: string[];
23
+ summary: string;
24
+ }
25
+ export declare function analyzeCustomerInterest(input: CustomerInterestInput): CustomerInterestAnalysis;
@@ -0,0 +1 @@
1
+ export function analyzeCustomerInterest(a){const b=[],c=[],d=[],e=[],f=a['token_type']?'\x20('+a['token_type']+')':'';if(a['terminal']==='completed')b['push']('Order\x20reached\x20a\x20completion\x20terminal:\x20escrowed\x20funds\x20were\x20released\x20to\x20the\x20merchant.\x20'+'Verify\x20the\x20deliverable\x20matched\x20the\x20agreement\x20BEFORE\x20confirming\x20—\x20after\x20release,\x20refunds\x20are\x20harder.');else{if(a['terminal']==='refunded')b['push']('Order\x20reached\x20a\x20refund\x20terminal:\x20escrowed\x20funds\x20return\x20to\x20you\x20per\x20the\x20Allocation\x20configuration.');else a['order_amount']!=null&&b['push'](a['order_amount']+'\x20raw\x20units'+f+'\x20of\x20YOUR\x20money\x20sit\x20escrowed\x20in\x20the\x20Order\x20—\x20'+'released\x20to\x20the\x20merchant\x20ONLY\x20when\x20the\x20workflow\x20advances\x20to\x20completion;\x20returned\x20to\x20you\x20ONLY\x20via\x20a\x20refund\x20path.');}a['compensation_fund']!=null&&a['compensation_fund']!=='0'?b['push']('Merchant\x20compensation_fund\x20holds\x20'+a['compensation_fund']+'\x20raw\x20units'+f+'\x20—\x20your\x20recourse\x20if\x20arbitration\x20awards\x20indemnity\x20(paid\x20FROM\x20it).'):b['push']('Merchant\x20compensation_fund\x20is\x20EMPTY\x20—\x20arbitration\x20indemnity\x20is\x20unenforceable;\x20your\x20protection\x20is\x20the\x20refund\x20path\x20+\x20on-chain\x20reputation\x20only.');a['operable']['length']>0x0&&c['push']('YOU\x20can\x20execute\x20'+a['operable']['map'](j=>'\x27'+j['name']+'\x27')['join'](',\x20')+'\x20right\x20now\x20—\x20'+'your\x20confirmation\x20is\x20the\x20fund-release\x20trigger:\x20only\x20confirm\x20when\x20the\x20deliverable\x20matches\x20the\x20agreement.');a['terminal']==null&&a['operable']['length']===0x0&&a['waiting_on']['length']>0x0&&c['push']('No\x20forward\x20is\x20yours\x20at\x20this\x20node\x20—\x20you\x20carry\x20no\x20execution\x20responsibility\x20here;\x20'+'delivery\x20depends\x20on\x20the\x20merchant-side\x20roles\x20in\x20waiting_on.');a['operable']['length']>0x0&&a['terminal']==null&&d['push']('Your\x20confirmation\x20is\x20your\x20LEVERAGE:\x20escrowed\x20money\x20stays\x20locked\x20until\x20YOU\x20act\x20—\x20'+'do\x20not\x20confirm\x20before\x20verifying\x20the\x20deliverable\x20(WIP\x20hash\x20/\x20receipt).');const g=a['waiting_on']['some'](j=>j['role']!=='OrderHolder\x20(customer)');g&&a['terminal']==null&&d['push']('The\x20workflow\x20waits\x20on\x20merchant-side\x20roles:\x20a\x20Messenger\x20nudge\x20accelerates\x20delivery\x20'+'and\x20the\x20conversation\x20is\x20recorded\x20as\x20WTS\x20evidence\x20protecting\x20you\x20in\x20a\x20dispute.');a['arbitration_bound']&&a['terminal']==null&&d['push']('A\x20dispute\x20path\x20exists:\x20if\x20the\x20merchant\x20stalls\x20or\x20under-delivers,\x20open\x20arbitration\x20—\x20'+'your\x20evidence\x20(WTS\x20+\x20WIP\x20hash)\x20decides\x20the\x20outcome.');(a['unread_messages']??0x0)>0x0&&d['push'](a['unread_messages']+'\x20unread\x20Messenger\x20message(s)\x20—\x20timely\x20replies\x20protect\x20your\x20position\x20(WTS\x20record).');a['order_amount']!=null&&a['terminal']==null&&e['push'](a['order_amount']+'\x20raw\x20units'+f+'\x20are\x20at\x20risk\x20while\x20escrowed\x20—\x20if\x20the\x20merchant\x20stalls\x20beyond\x20the\x20timeout,\x20'+'pursue\x20refund/arbitration\x20rather\x20than\x20letting\x20the\x20order\x20stall\x20indefinitely.');a['stalled_hours']!=null&&a['stalled_hours']>0x18&&a['terminal']==null&&e['push']('Order\x20stalled\x20'+Math['round'](a['stalled_hours'])+'h:\x20your\x20leverage\x20is\x20compensation_fund\x20(if\x20any)\x20+\x20arbitration\x20+\x20on-chain\x20reputation\x20(dislike)\x20—\x20in\x20that\x20order.');a['terminal']==='refunded'&&e['push']('Refund\x20executed:\x20funds\x20returned.\x20Remaining\x20stakes\x20are\x20reputational\x20—\x20a\x20dislike\x20vote\x20is\x20your\x20residual\x20recourse\x20if\x20the\x20merchant\x20behaved\x20unfairly.');const h=a['terminal']==='completed'?'order\x20completed\x20—\x20funds\x20released\x20(verify\x20deliverable\x20matched\x20before\x20confirming\x20next\x20time)':a['terminal']==='refunded'?'order\x20refunded\x20—\x20funds\x20returned':a['operable']['length']>0x0?'YOU\x20can\x20act\x20('+a['operable']['length']+'\x20forward(s))\x20—\x20your\x20confirmation\x20releases\x20funds,\x20verify\x20first':'waiting\x20on\x20'+(a['waiting_on']['map'](j=>j['role'])['join'](',\x20')||'others')+'\x20—\x20monitor\x20and\x20nudge',i='Customer\x20interest\x20at\x20node\x20\x27'+(a['current_node']||'(entry)')+'\x27:\x20'+h+'.\x20'+'All\x20options\x20above\x20are\x20informational\x20—\x20the\x20decision\x20is\x20yours.';return{'fund_flow':b,'responsibility':c,'leverage':d,'stakes':e,'summary':i};}
@@ -0,0 +1,25 @@
1
+ export type EmployeeDepartment = "customer_service" | "logistics" | "finance" | "operations";
2
+ export type EmployeeLiability = "merchant_bears" | "self_bears" | "hybrid";
3
+ export interface EmployeeProfile {
4
+ department: EmployeeDepartment;
5
+ liability: EmployeeLiability;
6
+ response_time_budget_ms?: number;
7
+ }
8
+ export interface ReactionKpi {
9
+ node: string;
10
+ reaction_ms: number;
11
+ within_budget: boolean;
12
+ status: "pass" | "warn" | "fail";
13
+ }
14
+ export interface LiabilityResolution {
15
+ bears: "merchant" | "employee";
16
+ must_compensate_before_resume: boolean;
17
+ note: string;
18
+ }
19
+ export declare function assessReactionKpi(node: string, assigned_at: number, advanced_at: number | undefined, budget_ms?: number): ReactionKpi;
20
+ export declare function resolveLiability(liability: EmployeeLiability, loss_amount: number, hybrid_threshold?: number): LiabilityResolution;
21
+ export interface EmployeeProfileValidation {
22
+ valid: boolean;
23
+ issues: string[];
24
+ }
25
+ export declare function validateEmployeeProfile(profile: EmployeeProfile): EmployeeProfileValidation;
@@ -0,0 +1 @@
1
+ const DEFAULT_RESPONSE_BUDGET_MS=0x30*0x3c*0x3c*0x3e8;export function assessReactionKpi(a,b,c,d=DEFAULT_RESPONSE_BUDGET_MS){if(c===undefined)return{'node':a,'reaction_ms':-0x1,'within_budget':![],'status':'warn'};const e=c-b,f=e<=d;return{'node':a,'reaction_ms':e,'within_budget':f,'status':f?'pass':'fail'};}export function resolveLiability(a,b,c=0x0){let d;switch(a){case'merchant_bears':d='merchant';break;case'self_bears':d='employee';break;case'hybrid':default:d=b>c?'employee':'merchant';break;}return{'bears':d,'must_compensate_before_resume':b>0x0,'note':d==='merchant'?'Merchant\x20bears\x20the\x20'+b+'\x20loss;\x20employee\x20error\x20is\x20attributed\x20to\x20the\x20merchant\x27s\x20problem\x20list\x20in\x20arbitration.':'Employee\x20bears\x20the\x20'+b+'\x20loss\x20(serious\x20negligence);\x20the\x20order\x20user\x20is\x20compensated\x20first,\x20then\x20the\x20workflow\x20resumes.'};}export function validateEmployeeProfile(a){const b=[];if(!a['department'])b['push']('department\x20is\x20required');if(!a['liability'])b['push']('liability\x20is\x20required');return a['response_time_budget_ms']!==undefined&&a['response_time_budget_ms']<=0x0&&b['push']('response_time_budget_ms\x20must\x20be\x20a\x20positive\x20number'),{'valid':b['length']===0x0,'issues':b};}
@@ -0,0 +1,16 @@
1
+ import { SQLiteStorage } from "@wowok/wowok";
2
+ import { type EmployeeProfile } from "./employee-kpi.js";
3
+ export interface EmployeeStore {
4
+ save(account: string, profile: EmployeeProfile): Promise<void>;
5
+ get(account: string): Promise<EmployeeProfile | null>;
6
+ remove(account: string): Promise<boolean>;
7
+ }
8
+ export declare class SqliteEmployeeStore implements EmployeeStore {
9
+ private readonly kv;
10
+ constructor(kv?: SQLiteStorage);
11
+ save(account: string, profile: EmployeeProfile): Promise<void>;
12
+ get(account: string): Promise<EmployeeProfile | null>;
13
+ remove(account: string): Promise<boolean>;
14
+ }
15
+ export declare function getEmployeeStore(): EmployeeStore;
16
+ export declare function setEmployeeStore(store: EmployeeStore): void;
@@ -0,0 +1 @@
1
+ import{SQLiteStorage}from'@wowok/wowok';import{validateEmployeeProfile}from'./employee-kpi.js';const KEY_PREFIX='employee_profile:';function parse(a){try{const b=JSON['parse'](a);return validateEmployeeProfile(b)['valid']?b:null;}catch{return null;}}export class SqliteEmployeeStore{['kv'];constructor(a){this['kv']=a??new SQLiteStorage();}async['save'](a,b){const c=validateEmployeeProfile(b);if(!c['valid'])throw new Error('invalid\x20employee\x20profile:\x20'+c['issues']['join'](';\x20'));await this['kv']['put'](''+KEY_PREFIX+a,JSON['stringify'](b));}async['get'](a){const b=await this['kv']['get'](''+KEY_PREFIX+a);return b?parse(b):null;}async['remove'](a){const b=''+KEY_PREFIX+a,c=await this['kv']['get'](b)!==undefined;if(c)await this['kv']['del'](b);return c;}}let _store=null;export function getEmployeeStore(){if(!_store)_store=new SqliteEmployeeStore();return _store;}export function setEmployeeStore(a){_store=a;}
@@ -0,0 +1,2 @@
1
+ export * from "./employee-kpi.js";
2
+ export * from "./employee-store.js";
@@ -0,0 +1 @@
1
+ export*from'./employee-kpi.js';export*from'./employee-store.js';
@@ -1,100 +1 @@
1
- export function analyzeMerchantInterest(input) {
2
- const fund_flow = [];
3
- const responsibility = [];
4
- const leverage = [];
5
- const stakes = [];
6
- const token = input.token_type ? ` (${input.token_type})` : "";
7
- if (input.terminal === "completed") {
8
- fund_flow.push("Order reached a completion terminal: escrowed funds are released through the Allocation waterfall. " +
9
- "Verify your expected share arrived (query the Allocation/Treasury objects).");
10
- }
11
- else if (input.terminal === "refunded") {
12
- fund_flow.push("Order reached a refund terminal: escrowed funds returned to the buyer per the Allocation configuration. " +
13
- "No settlement remains for this order.");
14
- }
15
- else {
16
- if (input.order_amount != null) {
17
- fund_flow.push(`${input.order_amount} raw units${token} sit escrowed in the Order object — ` +
18
- "released ONLY by workflow advancement to a completion path (not by time, not by platform decision).");
19
- }
20
- if (input.allocation) {
21
- const a = input.allocation;
22
- const parts = [`settlement splits across ${a.recipient_slots} recipient slot(s)`];
23
- if (a.direct_to_me_slots > 0)
24
- parts.push(`${a.direct_to_me_slots} pay directly to you`);
25
- if (a.guard_gated_slots > 0)
26
- parts.push(`${a.guard_gated_slots} are guard-resolved at settlement time (recipient not statically known)`);
27
- if (a.to_payer_slots > 0)
28
- parts.push(`${a.to_payer_slots} route back to the payer (refund-oriented)`);
29
- fund_flow.push(`Allocation waterfall: ${parts.join("; ")}.`);
30
- }
31
- else {
32
- fund_flow.push("Allocation waterfall not configured or unresolved — settlement recipients unknown; " +
33
- "funds may sit in the Order until an allocation is set or refund path triggers.");
34
- }
35
- }
36
- if (input.compensation_fund != null && input.compensation_fund !== "0") {
37
- fund_flow.push(`Service compensation_fund holds ${input.compensation_fund} raw units${token} — merchant-funded skin-in-the-game: ` +
38
- "arbitration indemnity is paid FROM it, but it also converts directly into buyer trust (higher preorder confidence).");
39
- }
40
- const myGated = input.operable.filter(f => f.guard);
41
- if (input.operable.length > 0) {
42
- responsibility.push(`${input.operable.length} forward(s) are executable by YOUR role right now ` +
43
- `(${input.operable.map(f => `'${f.name}'`).join(", ")}): inaction keeps settlement locked and the stall is publicly visible on-chain.`);
44
- }
45
- if (myGated.length > 0) {
46
- responsibility.push(`Forward(s) ${myGated.map(f => `'${f.name}'`).join(", ")} are guard-gated: YOU must satisfy the guard conditions ` +
47
- "(evidence, verification, timing) before execution — prepare submissions (proof/repository data) in advance.");
48
- }
49
- if (input.terminal == null && input.operable.length === 0 && input.waiting_on.length > 0) {
50
- responsibility.push("No forward is yours at this node — you carry no execution responsibility here; " +
51
- "avoid interfering outside your permission scope (creates semantic responsibility without authority).");
52
- }
53
- if (input.operable.length > 0 && input.terminal == null) {
54
- leverage.push("Advancing NOW shortens your fund-settlement cycle and improves your publicly-visible flow statistics " +
55
- "(future buyers' trust evaluation reads stall/dispute metrics).");
56
- }
57
- const waitingOnCustomer = input.waiting_on.some(w => w.role.includes("OrderHolder"));
58
- if (waitingOnCustomer && input.terminal == null) {
59
- leverage.push("The workflow waits on the customer (OrderHolder): a Messenger nudge accelerates fund release " +
60
- "without creating semantic responsibility — and the conversation is recorded as WTS evidence protecting YOU in a dispute.");
61
- }
62
- if (myGated.length > 0) {
63
- leverage.push("Uploading delivery evidence (Repository/proof) BEFORE executing guard-gated forwards reduces dispute probability " +
64
- "and pre-builds your arbitration defense.");
65
- }
66
- if ((input.unread_messages ?? 0) > 0) {
67
- leverage.push(`${input.unread_messages} unread message(s) from this order's counterparties — timely replies protect your position (WTS record).`);
68
- }
69
- if (input.rewards_count > 0) {
70
- leverage.push(`${input.rewards_count} reward(s) configured on the Service — honoring them (discounts/bonuses) builds repeat-buyer rate and like/dislike reputation.`);
71
- }
72
- if (input.arbitration_bound && input.terminal == null) {
73
- const fundNote = input.compensation_fund != null && input.compensation_fund !== "0"
74
- ? `indemnity would be paid from the compensation_fund (${input.compensation_fund} raw units)`
75
- : "the compensation_fund is empty (indemnity unenforceable — but the arb-loss record still lands)";
76
- stakes.push(`A dispute path exists: if the customer opens arbitration and you lose, ${fundNote}, ` +
77
- "and the loss is permanently recorded (arb-loss rate is a public metric in future buyers' trust evaluation).");
78
- }
79
- if (input.stalled_hours != null && input.stalled_hours > 72 && input.terminal == null) {
80
- stakes.push(`Order stalled ${Math.round(input.stalled_hours)}h: prolonged stalls degrade merchant flow statistics ` +
81
- "and invite dispute/dislike — the two cheapest reputation losses to avoid.");
82
- }
83
- if (input.terminal === "refunded") {
84
- stakes.push("Refund executed: settlement lost. Remaining stakes are reputational — a dislike vote is the customer's residual leverage; " +
85
- "a professional post-refund Messenger close-out is your residual protection.");
86
- }
87
- const pos = input.terminal === "completed"
88
- ? "order completed — settlement released"
89
- : input.terminal === "refunded"
90
- ? "order refunded — settlement lost"
91
- : input.operable.length > 0
92
- ? `YOU can advance ${input.operable.length} forward(s) — settlement speed is in your hands`
93
- : `waiting on ${input.waiting_on.map(w => w.role).join(", ") || "others"} — monitor and nudge`;
94
- const exposure = input.compensation_fund != null && input.compensation_fund !== "0"
95
- ? ` Compensation fund at risk: ${input.compensation_fund} raw units.`
96
- : "";
97
- const summary = `Merchant interest at node '${input.current_node || "(entry)"}': ${pos}.${exposure} ` +
98
- "All options above are informational — the decision is yours.";
99
- return { fund_flow, responsibility, leverage, stakes, summary };
100
- }
1
+ export function analyzeMerchantInterest(b){const c=[],d=[],e=[],f=[],g=b['token_type']?'\x20('+b['token_type']+')':'';if(b['terminal']==='completed')c['push']('Order\x20reached\x20a\x20completion\x20terminal:\x20escrowed\x20funds\x20are\x20released\x20through\x20the\x20Allocation\x20waterfall.\x20'+'Verify\x20your\x20expected\x20share\x20arrived\x20(query\x20the\x20Allocation/Treasury\x20objects).');else{if(b['terminal']==='refunded')c['push']('Order\x20reached\x20a\x20refund\x20terminal:\x20escrowed\x20funds\x20returned\x20to\x20the\x20buyer\x20per\x20the\x20Allocation\x20configuration.\x20'+'No\x20settlement\x20remains\x20for\x20this\x20order.');else{b['order_amount']!=null&&c['push'](b['order_amount']+'\x20raw\x20units'+g+'\x20sit\x20escrowed\x20in\x20the\x20Order\x20object\x20—\x20'+'released\x20ONLY\x20by\x20workflow\x20advancement\x20to\x20a\x20completion\x20path\x20(not\x20by\x20time,\x20not\x20by\x20platform\x20decision).');if(b['allocation']){const m=b['allocation'],n=['settlement\x20splits\x20across\x20'+m['recipient_slots']+'\x20recipient\x20slot(s)'];if(m['direct_to_me_slots']>0x0)n['push'](m['direct_to_me_slots']+'\x20pay\x20directly\x20to\x20you');if(m['guard_gated_slots']>0x0)n['push'](m['guard_gated_slots']+'\x20are\x20guard-resolved\x20at\x20settlement\x20time\x20(recipient\x20not\x20statically\x20known)');if(m['to_payer_slots']>0x0)n['push'](m['to_payer_slots']+'\x20route\x20back\x20to\x20the\x20payer\x20(refund-oriented)');c['push']('Allocation\x20waterfall:\x20'+n['join'](';\x20')+'.');}else c['push']('Allocation\x20waterfall\x20not\x20configured\x20or\x20unresolved\x20—\x20settlement\x20recipients\x20unknown;\x20'+'funds\x20may\x20sit\x20in\x20the\x20Order\x20until\x20an\x20allocation\x20is\x20set\x20or\x20refund\x20path\x20triggers.');}}b['compensation_fund']!=null&&b['compensation_fund']!=='0'&&c['push']('Service\x20compensation_fund\x20holds\x20'+b['compensation_fund']+'\x20raw\x20units'+g+'\x20—\x20merchant-funded\x20skin-in-the-game:\x20'+'arbitration\x20indemnity\x20is\x20paid\x20FROM\x20it,\x20but\x20it\x20also\x20converts\x20directly\x20into\x20buyer\x20trust\x20(higher\x20preorder\x20confidence).');const h=b['operable']['filter'](o=>o['guard']);b['operable']['length']>0x0&&d['push'](b['operable']['length']+'\x20forward(s)\x20are\x20executable\x20by\x20YOUR\x20role\x20right\x20now\x20'+('('+b['operable']['map'](o=>'\x27'+o['name']+'\x27')['join'](',\x20')+'):\x20inaction\x20keeps\x20settlement\x20locked\x20and\x20the\x20stall\x20is\x20publicly\x20visible\x20on-chain.'));h['length']>0x0&&d['push']('Forward(s)\x20'+h['map'](o=>'\x27'+o['name']+'\x27')['join'](',\x20')+'\x20are\x20guard-gated:\x20YOU\x20must\x20satisfy\x20the\x20guard\x20conditions\x20'+'(evidence,\x20verification,\x20timing)\x20before\x20execution\x20—\x20prepare\x20submissions\x20(proof/repository\x20data)\x20in\x20advance.');b['terminal']==null&&b['operable']['length']===0x0&&b['waiting_on']['length']>0x0&&d['push']('No\x20forward\x20is\x20yours\x20at\x20this\x20node\x20—\x20you\x20carry\x20no\x20execution\x20responsibility\x20here;\x20'+'avoid\x20interfering\x20outside\x20your\x20permission\x20scope\x20(creates\x20semantic\x20responsibility\x20without\x20authority).');b['operable']['length']>0x0&&b['terminal']==null&&e['push']('Advancing\x20NOW\x20shortens\x20your\x20fund-settlement\x20cycle\x20and\x20improves\x20your\x20publicly-visible\x20flow\x20statistics\x20'+'(future\x20buyers\x27\x20trust\x20evaluation\x20reads\x20stall/dispute\x20metrics).');const i=b['waiting_on']['some'](o=>o['role']['includes']('OrderHolder'));i&&b['terminal']==null&&e['push']('The\x20workflow\x20waits\x20on\x20the\x20customer\x20(OrderHolder):\x20a\x20Messenger\x20nudge\x20accelerates\x20fund\x20release\x20'+'without\x20creating\x20semantic\x20responsibility\x20—\x20and\x20the\x20conversation\x20is\x20recorded\x20as\x20WTS\x20evidence\x20protecting\x20YOU\x20in\x20a\x20dispute.');h['length']>0x0&&e['push']('Uploading\x20delivery\x20evidence\x20(Repository/proof)\x20BEFORE\x20executing\x20guard-gated\x20forwards\x20reduces\x20dispute\x20probability\x20'+'and\x20pre-builds\x20your\x20arbitration\x20defense.');(b['unread_messages']??0x0)>0x0&&e['push'](b['unread_messages']+'\x20unread\x20message(s)\x20from\x20this\x20order\x27s\x20counterparties\x20—\x20timely\x20replies\x20protect\x20your\x20position\x20(WTS\x20record).');b['rewards_count']>0x0&&e['push'](b['rewards_count']+'\x20reward(s)\x20configured\x20on\x20the\x20Service\x20—\x20honoring\x20them\x20(discounts/bonuses)\x20builds\x20repeat-buyer\x20rate\x20and\x20like/dislike\x20reputation.');if(b['arbitration_bound']&&b['terminal']==null){const o=b['compensation_fund']!=null&&b['compensation_fund']!=='0'?'indemnity\x20would\x20be\x20paid\x20from\x20the\x20compensation_fund\x20('+b['compensation_fund']+'\x20raw\x20units)':'the\x20compensation_fund\x20is\x20empty\x20(indemnity\x20unenforceable\x20—\x20but\x20the\x20arb-loss\x20record\x20still\x20lands)';f['push']('A\x20dispute\x20path\x20exists:\x20if\x20the\x20customer\x20opens\x20arbitration\x20and\x20you\x20lose,\x20'+o+',\x20'+'and\x20the\x20loss\x20is\x20permanently\x20recorded\x20(arb-loss\x20rate\x20is\x20a\x20public\x20metric\x20in\x20future\x20buyers\x27\x20trust\x20evaluation).');}b['stalled_hours']!=null&&b['stalled_hours']>0x48&&b['terminal']==null&&f['push']('Order\x20stalled\x20'+Math['round'](b['stalled_hours'])+'h:\x20prolonged\x20stalls\x20degrade\x20merchant\x20flow\x20statistics\x20'+'and\x20invite\x20dispute/dislike\x20—\x20the\x20two\x20cheapest\x20reputation\x20losses\x20to\x20avoid.');b['terminal']==='refunded'&&f['push']('Refund\x20executed:\x20settlement\x20lost.\x20Remaining\x20stakes\x20are\x20reputational\x20—\x20a\x20dislike\x20vote\x20is\x20the\x20customer\x27s\x20residual\x20leverage;\x20'+'a\x20professional\x20post-refund\x20Messenger\x20close-out\x20is\x20your\x20residual\x20protection.');const j=b['terminal']==='completed'?'order\x20completed\x20—\x20settlement\x20released':b['terminal']==='refunded'?'order\x20refunded\x20—\x20settlement\x20lost':b['operable']['length']>0x0?'YOU\x20can\x20advance\x20'+b['operable']['length']+'\x20forward(s)\x20—\x20settlement\x20speed\x20is\x20in\x20your\x20hands':'waiting\x20on\x20'+(b['waiting_on']['map'](p=>p['role'])['join'](',\x20')||'others')+'\x20—\x20monitor\x20and\x20nudge',k=b['compensation_fund']!=null&&b['compensation_fund']!=='0'?'\x20Compensation\x20fund\x20at\x20risk:\x20'+b['compensation_fund']+'\x20raw\x20units.':'',l='Merchant\x20interest\x20at\x20node\x20\x27'+(b['current_node']||'(entry)')+'\x27:\x20'+j+'.'+k+'\x20'+'All\x20options\x20above\x20are\x20informational\x20—\x20the\x20decision\x20is\x20yours.';return{'fund_flow':c,'responsibility':d,'leverage':e,'stakes':f,'summary':l};}
@@ -1,8 +1,14 @@
1
+ import type { CommercialRole } from "../role/types.js";
2
+ import type { CollaboratorInterestAnalysis } from "./collaborator-interest.js";
3
+ import type { CustomerInterestAnalysis } from "./customer-interest.js";
4
+ import type { MerchantInterestAnalysis } from "./merchant-interest.js";
5
+ import type { SupplierInterestAnalysis } from "./supplier-interest.js";
1
6
  import type { PermissionObjectData } from "../schema/utils/permission-machine-check.js";
2
7
  export interface RadarMachineNode {
3
8
  name: string;
4
9
  pairs?: Array<{
5
10
  prev_node: string;
11
+ threshold?: number;
6
12
  forwards?: Array<{
7
13
  name: string;
8
14
  permissionIndex?: number | null;
@@ -25,6 +31,8 @@ export interface OrderRadarInput {
25
31
  machine_nodes?: RadarMachineNode[];
26
32
  permission?: PermissionObjectData | null;
27
33
  named_accounts?: Record<string, string | string[]>;
34
+ service_builder?: string;
35
+ demand_presenters?: string[];
28
36
  node_annotations?: NodeAnnotations;
29
37
  claimable_rewards?: Array<{
30
38
  address: string;
@@ -41,7 +49,6 @@ export interface OrderRadarInput {
41
49
  now?: number;
42
50
  unread_messages?: number;
43
51
  }
44
- export type ParticipationPerspective = "customer" | "operator" | "observer";
45
52
  export type ExecutionPath = "order_holder" | "permission" | "named_operator" | "not_available";
46
53
  export interface RadarForward {
47
54
  name: string;
@@ -52,6 +59,7 @@ export interface RadarForward {
52
59
  guard?: string;
53
60
  semantics: string;
54
61
  consequence?: string;
62
+ weight?: number;
55
63
  }
56
64
  export interface PendingClaim {
57
65
  kind: "reward" | "discount" | "compensation" | "rating";
@@ -67,7 +75,8 @@ export interface OrderRadarResult {
67
75
  progress: string;
68
76
  order?: string;
69
77
  current_node: string;
70
- perspective: ParticipationPerspective;
78
+ perspective: CommercialRole;
79
+ collaborator_kind?: "permission_entity" | "named_operator";
71
80
  roles: RoleSummary[];
72
81
  operable: RadarForward[];
73
82
  branch_choice?: {
@@ -85,7 +94,8 @@ export interface OrderRadarResult {
85
94
  pending_claims: PendingClaim[];
86
95
  interest_hints: string[];
87
96
  workflow_unknown: boolean;
88
- interest_analysis?: import("./merchant-interest.js").MerchantInterestAnalysis;
97
+ threshold?: number;
98
+ interest_analysis?: MerchantInterestAnalysis | SupplierInterestAnalysis | CollaboratorInterestAnalysis | CustomerInterestAnalysis;
89
99
  summary: string;
90
100
  }
91
101
  export declare function analyzeOrderParticipation(input: OrderRadarInput): OrderRadarResult;