@wowok/agent-mcp 2.7.1 → 2.7.2

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 (375) hide show
  1. package/dist/config/index.js +1 -1
  2. package/dist/config/runtime.js +1 -238
  3. package/dist/customer/customer-advice.js +1 -130
  4. package/dist/customer/index.js +1 -11
  5. package/dist/customer/industry-risks.js +1 -438
  6. package/dist/customer/info-puzzle.js +1 -681
  7. package/dist/customer/order-monitor.js +1 -328
  8. package/dist/customer/order-strategy.js +1 -373
  9. package/dist/customer/post-purchase.js +1 -351
  10. package/dist/customer/preorder-compare.js +1 -34
  11. package/dist/customer/reminder-system.js +1 -316
  12. package/dist/customer/risk-assessment.js +1 -397
  13. package/dist/customer/types.js +1 -13
  14. package/dist/customer/user-preferences.js +1 -460
  15. package/dist/evaluation/arbitration-game.d.ts +9 -2
  16. package/dist/evaluation/arbitration-game.js +1 -48
  17. package/dist/evaluation/builtins/demand-match.js +1 -153
  18. package/dist/evaluation/builtins/index.js +1 -10
  19. package/dist/evaluation/builtins/service-risk.js +1 -55
  20. package/dist/evaluation/capability.js +1 -13
  21. package/dist/evaluation/composer.js +1 -40
  22. package/dist/evaluation/engine.js +1 -175
  23. package/dist/evaluation/extract.js +1 -115
  24. package/dist/evaluation/game-strategy.d.ts +27 -0
  25. package/dist/evaluation/game-strategy.js +1 -0
  26. package/dist/evaluation/gap.js +1 -100
  27. package/dist/evaluation/index.d.ts +1 -0
  28. package/dist/evaluation/index.js +1 -11
  29. package/dist/evaluation/node-game.d.ts +31 -3
  30. package/dist/evaluation/node-game.js +1 -57
  31. package/dist/evaluation/region.js +1 -36
  32. package/dist/evaluation/types.d.ts +1 -0
  33. package/dist/evaluation/types.js +1 -1
  34. package/dist/evaluation/user-injection.js +1 -27
  35. package/dist/experience/experience-reuse.js +1 -103
  36. package/dist/experience/index.js +1 -5
  37. package/dist/experience/intent-distill.js +1 -83
  38. package/dist/experience/realtime-feedback.js +1 -94
  39. package/dist/experience/types.js +1 -1
  40. package/dist/experience/user-profile.js +1 -171
  41. package/dist/extensions/business-modules.js +1 -287
  42. package/dist/extensions/capability-manifest.js +1 -781
  43. package/dist/extensions/constraint-registry.js +1 -198
  44. package/dist/extensions/index.js +1 -6
  45. package/dist/extensions/metric-registry.js +1 -257
  46. package/dist/extensions/mode-evaluator.js +1 -170
  47. package/dist/extensions/modes.js +1 -499
  48. package/dist/extensions/registry.js +1 -717
  49. package/dist/extensions/types.js +1 -1
  50. package/dist/harness/auto-escalation.js +1 -68
  51. package/dist/harness/checkpoint.js +1 -129
  52. package/dist/harness/index.js +1 -78
  53. package/dist/harness/plan.js +1 -315
  54. package/dist/harness/recover.js +1 -139
  55. package/dist/harness/types.js +1 -1
  56. package/dist/harness/verify.js +1 -237
  57. package/dist/index.js +1 -273
  58. package/dist/intent/enrich.js +1 -67
  59. package/dist/intent/index.js +1 -60
  60. package/dist/intent/matcher.js +1 -81
  61. package/dist/intent/store.js +1 -55
  62. package/dist/intent/types.js +1 -10
  63. package/dist/knowledge/acquisition-flywheel.js +1 -192
  64. package/dist/knowledge/allocation-confirm.js +1 -534
  65. package/dist/knowledge/allocation-context.js +1 -249
  66. package/dist/knowledge/allocation-ledger.js +1 -463
  67. package/dist/knowledge/allocation-puzzle.js +1 -298
  68. package/dist/knowledge/allocation-risk.js +1 -568
  69. package/dist/knowledge/allocation-templates.js +1 -970
  70. package/dist/knowledge/allocation-translation.js +1 -585
  71. package/dist/knowledge/arb-risk.js +1 -210
  72. package/dist/knowledge/arbitration-confirm.js +1 -559
  73. package/dist/knowledge/arbitration-context.js +1 -505
  74. package/dist/knowledge/arbitration-ledger.js +1 -521
  75. package/dist/knowledge/arbitration-puzzle.js +1 -304
  76. package/dist/knowledge/arbitration-risk.js +1 -423
  77. package/dist/knowledge/arbitration-templates.js +1 -276
  78. package/dist/knowledge/arbitration-translation.js +1 -487
  79. package/dist/knowledge/arbitration-trust.js +1 -117
  80. package/dist/knowledge/audit-rules.js +1 -141
  81. package/dist/knowledge/bridge-risk.js +1 -263
  82. package/dist/knowledge/contact-risk.js +1 -200
  83. package/dist/knowledge/contact-templates.js +1 -60
  84. package/dist/knowledge/demand-confirm.js +1 -206
  85. package/dist/knowledge/demand-matching.js +1 -132
  86. package/dist/knowledge/demand-risk.js +1 -240
  87. package/dist/knowledge/demand-translation.js +1 -354
  88. package/dist/knowledge/deployment-scanner.js +1 -823
  89. package/dist/knowledge/dynamic-pricing.js +1 -87
  90. package/dist/knowledge/examples-scanner-cli.js +1 -26
  91. package/dist/knowledge/examples-scanner.js +1 -843
  92. package/dist/knowledge/flywheel-loop.js +1 -404
  93. package/dist/knowledge/fund-layer.js +1 -973
  94. package/dist/knowledge/glossary.js +1 -211
  95. package/dist/knowledge/guard-confirm.js +1 -406
  96. package/dist/knowledge/guard-context.js +1 -287
  97. package/dist/knowledge/guard-design-patterns.js +1 -360
  98. package/dist/knowledge/guard-ledger.js +1 -260
  99. package/dist/knowledge/guard-lint.js +1 -670
  100. package/dist/knowledge/guard-migration.js +1 -228
  101. package/dist/knowledge/guard-puzzle.js +1 -805
  102. package/dist/knowledge/guard-render.js +1 -700
  103. package/dist/knowledge/guard-risk.js +1 -1879
  104. package/dist/knowledge/guard-submission-prompt.js +1 -171
  105. package/dist/knowledge/guard-templates.js +1 -1105
  106. package/dist/knowledge/guard-translation.js +1 -1119
  107. package/dist/knowledge/index.js +1 -436
  108. package/dist/knowledge/industry-evolution.js +1 -323
  109. package/dist/knowledge/industry-generalizer.js +1 -381
  110. package/dist/knowledge/industry-registry.js +1 -174
  111. package/dist/knowledge/intent-metrics.d.ts +4 -3
  112. package/dist/knowledge/intent-metrics.js +1 -566
  113. package/dist/knowledge/machine-confirm.js +1 -559
  114. package/dist/knowledge/machine-context.js +1 -833
  115. package/dist/knowledge/machine-ledger.js +1 -338
  116. package/dist/knowledge/machine-puzzle.js +1 -494
  117. package/dist/knowledge/machine-render.js +1 -565
  118. package/dist/knowledge/machine-risk.js +1 -669
  119. package/dist/knowledge/machine-templates.js +1 -1597
  120. package/dist/knowledge/machine-topology.js +1 -234
  121. package/dist/knowledge/machine-translation.js +1 -513
  122. package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
  123. package/dist/knowledge/mcp-schema-audit.js +1 -777
  124. package/dist/knowledge/onchain-constants.js +1 -35
  125. package/dist/knowledge/order-confirm.js +1 -573
  126. package/dist/knowledge/order-context.js +1 -390
  127. package/dist/knowledge/order-ledger.js +1 -341
  128. package/dist/knowledge/order-puzzle.js +1 -255
  129. package/dist/knowledge/order-risk.js +1 -653
  130. package/dist/knowledge/order-templates.js +1 -368
  131. package/dist/knowledge/order-translation.js +1 -550
  132. package/dist/knowledge/overrides-loader.js +1 -65
  133. package/dist/knowledge/passport-confirm.js +1 -531
  134. package/dist/knowledge/passport-context.js +1 -306
  135. package/dist/knowledge/passport-ledger.js +1 -282
  136. package/dist/knowledge/passport-puzzle.js +1 -333
  137. package/dist/knowledge/passport-risk.js +1 -450
  138. package/dist/knowledge/passport-templates.js +1 -568
  139. package/dist/knowledge/passport-translation.js +1 -516
  140. package/dist/knowledge/payment-risk.js +1 -249
  141. package/dist/knowledge/permission-confirm.js +1 -426
  142. package/dist/knowledge/permission-context.js +1 -224
  143. package/dist/knowledge/permission-ledger.js +1 -403
  144. package/dist/knowledge/permission-puzzle.js +1 -173
  145. package/dist/knowledge/permission-risk.js +1 -411
  146. package/dist/knowledge/permission-templates.js +1 -234
  147. package/dist/knowledge/permission-translation.js +1 -350
  148. package/dist/knowledge/personal-risk.js +1 -212
  149. package/dist/knowledge/process-model.js +1 -160
  150. package/dist/knowledge/progress-confirm.js +1 -456
  151. package/dist/knowledge/progress-context.js +1 -452
  152. package/dist/knowledge/progress-ledger.js +1 -330
  153. package/dist/knowledge/progress-puzzle.js +1 -219
  154. package/dist/knowledge/progress-risk.js +1 -461
  155. package/dist/knowledge/progress-templates.js +1 -228
  156. package/dist/knowledge/progress-translation.js +1 -405
  157. package/dist/knowledge/proof-confirm.js +1 -187
  158. package/dist/knowledge/proof-risk.js +1 -207
  159. package/dist/knowledge/proof-translation.js +1 -283
  160. package/dist/knowledge/registrar-risk.js +1 -217
  161. package/dist/knowledge/repository-confirm.js +1 -286
  162. package/dist/knowledge/repository-risk.js +1 -373
  163. package/dist/knowledge/repository-translation.js +1 -445
  164. package/dist/knowledge/reputation-rules.js +1 -99
  165. package/dist/knowledge/resource-risk.js +1 -157
  166. package/dist/knowledge/reward-confirm.js +1 -526
  167. package/dist/knowledge/reward-context.js +1 -504
  168. package/dist/knowledge/reward-ledger.js +1 -502
  169. package/dist/knowledge/reward-puzzle.js +1 -300
  170. package/dist/knowledge/reward-risk.js +1 -627
  171. package/dist/knowledge/reward-templates.js +1 -197
  172. package/dist/knowledge/reward-translation.js +1 -501
  173. package/dist/knowledge/safety-rules.js +1 -404
  174. package/dist/knowledge/scenario-modes.js +1 -321
  175. package/dist/knowledge/service-confirm.js +1 -807
  176. package/dist/knowledge/service-context.js +1 -403
  177. package/dist/knowledge/service-ledger.js +1 -609
  178. package/dist/knowledge/service-puzzle.js +1 -236
  179. package/dist/knowledge/service-risk.js +1 -651
  180. package/dist/knowledge/service-templates.js +1 -456
  181. package/dist/knowledge/service-translation.js +1 -622
  182. package/dist/knowledge/template-registry.js +1 -353
  183. package/dist/knowledge/tool-constraints.js +1 -195
  184. package/dist/knowledge/tools-reference.js +1 -178
  185. package/dist/knowledge/treasury-confirm.js +1 -512
  186. package/dist/knowledge/treasury-context.js +1 -363
  187. package/dist/knowledge/treasury-ledger.js +1 -300
  188. package/dist/knowledge/treasury-puzzle.js +1 -216
  189. package/dist/knowledge/treasury-risk.js +1 -440
  190. package/dist/knowledge/treasury-templates.js +1 -358
  191. package/dist/knowledge/treasury-translation.js +1 -498
  192. package/dist/knowledge/trust-metrics.js +1 -198
  193. package/dist/knowledge/util-risk.js +1 -135
  194. package/dist/loop-engineering/aggregate.js +1 -132
  195. package/dist/loop-engineering/context-collect.js +1 -83
  196. package/dist/loop-engineering/diagnose.js +1 -273
  197. package/dist/loop-engineering/improve.js +1 -405
  198. package/dist/loop-engineering/index.js +1 -4
  199. package/dist/loop-engineering/pipeline.js +1 -56
  200. package/dist/mode-market/index.js +1 -3
  201. package/dist/mode-market/registry.js +1 -124
  202. package/dist/mode-market/review.js +1 -214
  203. package/dist/mode-market/submission.js +1 -85
  204. package/dist/participation/collaborator-interest.d.ts +23 -0
  205. package/dist/participation/collaborator-interest.js +1 -0
  206. package/dist/participation/customer-interest.d.ts +25 -0
  207. package/dist/participation/customer-interest.js +1 -0
  208. package/dist/participation/merchant-interest.js +1 -100
  209. package/dist/participation/radar-core.d.ts +13 -3
  210. package/dist/participation/radar-core.js +1 -269
  211. package/dist/participation/supplier-interest.d.ts +25 -0
  212. package/dist/participation/supplier-interest.js +1 -0
  213. package/dist/persona/analyzer.js +1 -66
  214. package/dist/persona/bridge.js +1 -86
  215. package/dist/persona/defaults.js +1 -195
  216. package/dist/persona/experience-bridge.js +1 -23
  217. package/dist/persona/index.js +1 -71
  218. package/dist/persona/model.js +1 -111
  219. package/dist/persona/store.js +1 -62
  220. package/dist/persona/types.d.ts +3 -1
  221. package/dist/persona/types.js +1 -5
  222. package/dist/project/business-puzzle.js +1 -383
  223. package/dist/project/context-assembly.js +1 -254
  224. package/dist/project/deployment-bridge.js +1 -120
  225. package/dist/project/deployment-doc.js +1 -1126
  226. package/dist/project/edit-planner.js +1 -1342
  227. package/dist/project/evaluation.js +1 -2011
  228. package/dist/project/game-theory.js +1 -177
  229. package/dist/project/graph-builder.js +1 -656
  230. package/dist/project/graph.js +1 -340
  231. package/dist/project/handlers.js +1 -1784
  232. package/dist/project/index.d.ts +1 -0
  233. package/dist/project/index.js +1 -301
  234. package/dist/project/intent-analyzer.js +1 -149
  235. package/dist/project/machine-nodes.js +1 -36
  236. package/dist/project/merchant-guide.js +1 -264
  237. package/dist/project/migration.js +1 -125
  238. package/dist/project/mode-actions.js +1 -309
  239. package/dist/project/namespace.js +1 -206
  240. package/dist/project/participation-radar.js +1 -428
  241. package/dist/project/pipeline-actions.js +1 -109
  242. package/dist/project/project-store.js +1 -422
  243. package/dist/project/query.js +1 -153
  244. package/dist/project/reverse-mapping.d.ts +34 -0
  245. package/dist/project/reverse-mapping.js +1 -0
  246. package/dist/project/risk-aggregator.js +1 -295
  247. package/dist/project/rollback-policy.js +1 -290
  248. package/dist/project/semantic-assembler.js +1 -345
  249. package/dist/project/semantic-graph.js +1 -292
  250. package/dist/project/stage-gate.js +1 -369
  251. package/dist/project/substep-trace.js +1 -332
  252. package/dist/project/task-tracker.js +1 -78
  253. package/dist/role/derivation.d.ts +18 -0
  254. package/dist/role/derivation.js +1 -0
  255. package/dist/role/index.d.ts +5 -0
  256. package/dist/role/index.js +1 -0
  257. package/dist/role/model.d.ts +8 -0
  258. package/dist/role/model.js +1 -0
  259. package/dist/role/resolution.d.ts +11 -0
  260. package/dist/role/resolution.js +1 -0
  261. package/dist/role/types.d.ts +11 -0
  262. package/dist/role/types.js +1 -0
  263. package/dist/rules.js +1 -52
  264. package/dist/safety/confirm-gate.js +1 -88
  265. package/dist/safety/index.js +1 -3
  266. package/dist/safety/preview.js +1 -52
  267. package/dist/schema/call/allocation.js +1 -34
  268. package/dist/schema/call/arbitration.js +1 -113
  269. package/dist/schema/call/base.d.ts +15 -15
  270. package/dist/schema/call/base.js +1 -370
  271. package/dist/schema/call/bridge-handler.js +1 -265
  272. package/dist/schema/call/bridge.d.ts +7 -7
  273. package/dist/schema/call/bridge.js +1 -458
  274. package/dist/schema/call/contact.js +1 -37
  275. package/dist/schema/call/demand.js +1 -47
  276. package/dist/schema/call/guard.js +1 -161
  277. package/dist/schema/call/handler.js +1 -322
  278. package/dist/schema/call/index.js +1 -20
  279. package/dist/schema/call/machine.js +1 -193
  280. package/dist/schema/call/order.js +1 -35
  281. package/dist/schema/call/payment.js +1 -37
  282. package/dist/schema/call/permission-handler.js +1 -54
  283. package/dist/schema/call/permission.js +1 -105
  284. package/dist/schema/call/personal.js +1 -78
  285. package/dist/schema/call/progress.js +1 -47
  286. package/dist/schema/call/proof.js +1 -33
  287. package/dist/schema/call/repository.js +1 -77
  288. package/dist/schema/call/reward.js +1 -30
  289. package/dist/schema/call/semantic.js +1 -1679
  290. package/dist/schema/call/service.js +1 -184
  291. package/dist/schema/call/treasury.js +1 -71
  292. package/dist/schema/common/index.js +1 -407
  293. package/dist/schema/config/index.js +1 -68
  294. package/dist/schema/evaluation/index.d.ts +213 -16
  295. package/dist/schema/evaluation/index.js +1 -356
  296. package/dist/schema/index.js +1 -17
  297. package/dist/schema/intent-radar/index.d.ts +13 -13
  298. package/dist/schema/intent-radar/index.js +1 -89
  299. package/dist/schema/local/index.d.ts +21 -21
  300. package/dist/schema/local/index.js +1 -927
  301. package/dist/schema/local/wip.js +1 -187
  302. package/dist/schema/messenger/index.d.ts +7 -7
  303. package/dist/schema/messenger/index.js +1 -475
  304. package/dist/schema/operations.d.ts +7 -7
  305. package/dist/schema/operations.js +1 -520
  306. package/dist/schema/persona/index.d.ts +54 -54
  307. package/dist/schema/persona/index.js +1 -148
  308. package/dist/schema/project/index.d.ts +94 -48
  309. package/dist/schema/project/index.js +1 -2057
  310. package/dist/schema/query/index.d.ts +423 -7
  311. package/dist/schema/query/index.js +1 -1646
  312. package/dist/schema/schema-query/index.js +1 -104
  313. package/dist/schema/schema-version.js +1 -76
  314. package/dist/schema/sync-layer4.js +1 -286
  315. package/dist/schema/task-status.js +1 -36
  316. package/dist/schema/trust/index.js +1 -314
  317. package/dist/schema/utils/guard-parser.js +1 -419
  318. package/dist/schema/utils/guard-query-utils.js +1 -46
  319. package/dist/schema/utils/node-parser.js +1 -369
  320. package/dist/schema/utils/object-type-utils.js +1 -35
  321. package/dist/schema/utils/permission-index-utils.js +1 -7
  322. package/dist/schema/utils/permission-machine-check.js +1 -121
  323. package/dist/schema/utils/skills-recommendation.js +1 -77
  324. package/dist/schema-query/index.js +1 -810
  325. package/dist/schemas/account_operation.output.json +5 -2
  326. package/dist/schemas/bridge_operation.output.json +5 -2
  327. package/dist/schemas/evaluation_operation.output.json +112 -7
  328. package/dist/schemas/evaluation_operation.schema.json +93 -6
  329. package/dist/schemas/index.json +1 -1
  330. package/dist/schemas/intent_radar.output.json +4 -1
  331. package/dist/schemas/intent_radar.schema.json +4 -1
  332. package/dist/schemas/local_info_operation.output.json +5 -2
  333. package/dist/schemas/local_mark_operation.output.json +5 -2
  334. package/dist/schemas/messenger_operation.output.json +5 -2
  335. package/dist/schemas/onchain_events.output.json +5 -2
  336. package/dist/schemas/onchain_operations.output.json +5 -2
  337. package/dist/schemas/onchain_operations.schema.json +4 -4
  338. package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
  339. package/dist/schemas/onchain_operations_machine.schema.json +2 -2
  340. package/dist/schemas/onchain_operations_service.schema.json +1 -1
  341. package/dist/schemas/onchain_table_data.output.json +6 -3
  342. package/dist/schemas/persona_operation.output.json +4 -1
  343. package/dist/schemas/persona_operation.schema.json +4 -1
  344. package/dist/schemas/project_operation.output.json +28 -8
  345. package/dist/schemas/query_toolkit.output.json +8 -5
  346. package/dist/schemas/wowok_buildin_info.output.json +132 -0
  347. package/dist/schemas/wowok_buildin_info.schema.json +14 -0
  348. package/dist/telemetry/index.js +1 -112
  349. package/dist/telemetry/redact.js +1 -23
  350. package/dist/telemetry/storage.js +1 -80
  351. package/dist/tools/handlers/bridge.js +1 -1
  352. package/dist/tools/handlers/config.js +1 -74
  353. package/dist/tools/handlers/evaluation.js +1 -123
  354. package/dist/tools/handlers/file-export.js +1 -90
  355. package/dist/tools/handlers/intent-radar.js +1 -76
  356. package/dist/tools/handlers/local.js +1 -53
  357. package/dist/tools/handlers/messenger.js +1 -188
  358. package/dist/tools/handlers/onchain.js +1 -1180
  359. package/dist/tools/handlers/persona.js +1 -89
  360. package/dist/tools/handlers/project.js +1 -211
  361. package/dist/tools/handlers/query.js +1 -434
  362. package/dist/tools/handlers/schema-query.js +1 -176
  363. package/dist/tools/handlers/task-status.js +1 -26
  364. package/dist/tools/handlers/trust.js +1 -380
  365. package/dist/tools/handlers/wip.js +1 -90
  366. package/dist/tools/index.js +1 -1382
  367. package/dist/tools/retry.js +1 -85
  368. package/dist/tools/rules-hook.js +1 -23
  369. package/dist/tools/shared.js +1 -130
  370. package/dist/tools/types.js +1 -1
  371. package/dist/tools/upgrade-check.d.ts +19 -0
  372. package/dist/tools/upgrade-check.js +1 -0
  373. package/dist/tools/wip-deploy-assist.js +1 -306
  374. package/dist/tools/wrap.js +1 -500
  375. package/package.json +4 -2
@@ -1,456 +1 @@
1
- export const SERVICE_TEMPLATES = [
2
- {
3
- id: "T-S-01",
4
- name: "Retail e-commerce Service",
5
- description: "Standard retail shop with multiple SKUs, WIP-verified products, owner-only allocation",
6
- applicable_scenes: ["service_retail", "service_buy_guard"],
7
- industry_tags: ["retail", "ecommerce", "digital_goods"],
8
- params: [
9
- { name: "owner_address", type: "address", description: "Service owner address (receives payments)", required: true },
10
- { name: "permission_address", type: "address", description: "Permission object address (must be owned by owner)", required: true },
11
- { name: "description", type: "string", description: "Shop description", required: true },
12
- { name: "location", type: "string", description: "Service geographic location (city/region)", required: false, default: "" },
13
- { name: "sales_items", type: "object", description: "Array of {name, price, stock, wip, wip_hash}", required: true },
14
- { name: "buy_guard_address", type: "address", description: "Buyer eligibility Guard (null for public sale)", required: false, default: "" },
15
- ],
16
- body: (p) => {
17
- const result = {
18
- object: null,
19
- description: p.description,
20
- permission: p.permission_address,
21
- location: p.location || undefined,
22
- sales: { op: "add", sales: p.sales_items },
23
- order_allocators: [
24
- {
25
- threshold: "0",
26
- sharing: [{ who: { Object: p.owner_address }, weight: 100 }],
27
- },
28
- ],
29
- };
30
- if (p.buy_guard_address)
31
- result.buy_guard = p.buy_guard_address;
32
- return result;
33
- },
34
- notes: [
35
- "WIP hash is MANDATORY for tamper protection — never leave empty if wip URL is set",
36
- "Use buy_guard for pre-sale whitelist phase, then clear for public sale",
37
- "Single-recipient allocation (owner 100%) — use T-S-08 for multi-party split",
38
- ],
39
- post_publish_considerations: [
40
- "machine/arbitrations/order_allocators become immutable — verify before publish",
41
- "Sales can still be added/removed/updated post-publish",
42
- "buy_guard can be changed post-publish (unusual exception)",
43
- ],
44
- },
45
- {
46
- id: "T-S-02",
47
- name: "Rental Service (deposit + use + return)",
48
- description: "Equipment/asset rental with deposit guarantee, Machine workflow, and arbitration",
49
- applicable_scenes: ["service_rental"],
50
- industry_tags: ["rental", "equipment", "real_estate"],
51
- params: [
52
- { name: "owner_address", type: "address", description: "Service owner (rental company)", required: true },
53
- { name: "permission_address", type: "address", description: "Permission object address", required: true },
54
- { name: "description", type: "string", description: "Rental service description", required: true },
55
- { name: "machine_address", type: "address", description: "Published Machine with Reserve→Pay→Pickup→Return→Refund nodes", required: true },
56
- { name: "arbitration_address", type: "address", description: "Arbitration for deposit disputes", required: true },
57
- { name: "rental_items", type: "object", description: "Array of {name, price, stock=1, wip, wip_hash}", required: true },
58
- { name: "compensation_fund_balance", type: "string", description: "Initial deposit to compensation_fund (in base units)", required: false, default: "0" },
59
- ],
60
- body: (p) => ({
61
- object: null,
62
- description: p.description,
63
- permission: p.permission_address,
64
- machine: p.machine_address,
65
- arbitrations: { op: "add", objects: [p.arbitration_address] },
66
- sales: { op: "add", sales: p.rental_items },
67
- order_allocators: [
68
- {
69
- threshold: "0",
70
- sharing: [{ who: { Object: p.owner_address }, weight: 100 }],
71
- },
72
- ],
73
- compensation_fund_add: p.compensation_fund_balance && p.compensation_fund_balance !== "0"
74
- ? { balance: p.compensation_fund_balance }
75
- : undefined,
76
- }),
77
- notes: [
78
- "stock=1 per rental item (unique items) — once rented, stock becomes 0",
79
- "Machine must define deposit/return/refund nodes for proper rental flow",
80
- "compensation_fund holds deposit guarantees — separate from rental fee",
81
- "Arbitration required if compensation_fund > 0 (F-S-19)",
82
- ],
83
- post_publish_considerations: [
84
- "Machine binding is permanent — verify workflow before publish",
85
- "Arbitration binding is permanent — choose reputable arbiters",
86
- "Sales can be updated (add new rental items, remove deprecated ones)",
87
- ],
88
- },
89
- {
90
- id: "T-S-03",
91
- name: "Subscription Service (tiered plans)",
92
- description: "Recurring-access service with tiered plans (Free/Pro/Enterprise), discount coupons, loyalty rewards",
93
- applicable_scenes: ["service_subscription"],
94
- industry_tags: ["subscription", "saas", "membership"],
95
- params: [
96
- { name: "owner_address", type: "address", description: "Service owner", required: true },
97
- { name: "permission_address", type: "address", description: "Permission object address", required: true },
98
- { name: "description", type: "string", description: "Subscription service description", required: true },
99
- { name: "tier_plans", type: "object", description: "Array of {name, price, stock=999999, wip, wip_hash} for each tier", required: true },
100
- { name: "trial_discount_count", type: "number", description: "Number of trial discount coupons to issue", required: false, default: 0 },
101
- { name: "reward_address", type: "address", description: "Loyalty Reward object address (optional)", required: false, default: "" },
102
- ],
103
- body: (p) => {
104
- const result = {
105
- object: null,
106
- description: p.description,
107
- permission: p.permission_address,
108
- sales: { op: "add", sales: p.tier_plans },
109
- order_allocators: [
110
- {
111
- threshold: "0",
112
- sharing: [{ who: { Object: p.owner_address }, weight: 100 }],
113
- },
114
- ],
115
- };
116
- if (p.reward_address) {
117
- result.rewards = { op: "add", objects: [p.reward_address] };
118
- }
119
- return result;
120
- },
121
- notes: [
122
- "Subscription renewals are handled by repeat orders (no native recurring billing)",
123
- "Use large stock values (e.g. 999999) since subscriptions are not inventory-limited",
124
- "Trial discounts: issue via service::discount (312) post-publish",
125
- "Loyalty rewards: bind via service::reward_add (318) — locked by setting_lock_duration",
126
- ],
127
- post_publish_considerations: [
128
- "Tier prices can be updated via sales_set (existing subscribers unaffected)",
129
- "Discount coupons can be issued/destroyed post-publish",
130
- "Rewards can be added but removal locked by duration",
131
- ],
132
- },
133
- {
134
- id: "T-S-04",
135
- name: "Workflow-bound Service (machine-driven delivery)",
136
- description: "Service with multi-step delivery workflow (e.g. freelance, custom manufacturing, course)",
137
- applicable_scenes: ["service_workflow", "service_rental"],
138
- industry_tags: ["workflow", "freelance", "manufacturing", "education"],
139
- params: [
140
- { name: "owner_address", type: "address", description: "Service owner (provider)", required: true },
141
- { name: "permission_address", type: "address", description: "Permission object address", required: true },
142
- { name: "description", type: "string", description: "Service description", required: true },
143
- { name: "machine_address", type: "address", description: "Published Machine with Pay→Confirm→Deliver→Sign-off nodes", required: true },
144
- { name: "service_items", type: "object", description: "Array of {name, price, stock, wip, wip_hash}", required: true },
145
- { name: "customer_required", type: "string[]", description: "Required info fields (e.g. ['name','project_brief'])", required: false, default: [] },
146
- ],
147
- body: (p) => ({
148
- object: null,
149
- description: p.description,
150
- permission: p.permission_address,
151
- machine: p.machine_address,
152
- sales: { op: "add", sales: p.service_items },
153
- customer_required: p.customer_required,
154
- order_allocators: [
155
- {
156
- threshold: "0",
157
- sharing: [{ who: { Object: p.owner_address }, weight: 100 }],
158
- },
159
- ],
160
- }),
161
- notes: [
162
- "Machine MUST be published before binding (machine::publish)",
163
- "Each order creates a Progress object tracking the workflow",
164
- "Named operators can be assigned per Forward in the Machine",
165
- "Service.bPaused does NOT affect already-created Progress (existing orders continue)",
166
- ],
167
- post_publish_considerations: [
168
- "Machine binding is PERMANENT — cannot upgrade workflow post-publish",
169
- "To change workflow: clone Service with new Machine, migrate customers via discounts",
170
- "customer_required fields can be updated post-publish",
171
- ],
172
- },
173
- {
174
- id: "T-S-05",
175
- name: "Arbitration-bound Service (dispute-ready)",
176
- description: "Service with multiple Arbitration objects for different dispute scopes + compensation_fund",
177
- applicable_scenes: ["service_arbitration", "service_arbitration_binding"],
178
- industry_tags: ["arbitration", "dispute_resolution", "high_value"],
179
- params: [
180
- { name: "owner_address", type: "address", description: "Service owner", required: true },
181
- { name: "permission_address", type: "address", description: "Permission object address", required: true },
182
- { name: "description", type: "string", description: "Service description", required: true },
183
- { name: "arbitration_addresses", type: "string[]", description: "1-3 Arbitration object addresses (different scopes)", required: true },
184
- { name: "compensation_fund_balance", type: "string", description: "Initial compensation_fund deposit (base units)", required: true },
185
- { name: "setting_lock_duration_ms", type: "number", description: "Initial setting_lock_duration in ms (default 30 days)", required: false, default: 2592000000 },
186
- { name: "service_items", type: "object", description: "Array of {name, price, stock, wip, wip_hash}", required: true },
187
- ],
188
- body: (p) => ({
189
- object: null,
190
- description: p.description,
191
- permission: p.permission_address,
192
- arbitrations: { op: "add", objects: p.arbitration_addresses },
193
- compensation_fund_add: { balance: p.compensation_fund_balance },
194
- setting_lock_duration_add: p.setting_lock_duration_ms,
195
- sales: { op: "add", sales: p.service_items },
196
- order_allocators: [
197
- {
198
- threshold: "0",
199
- sharing: [{ who: { Object: p.owner_address }, weight: 100 }],
200
- },
201
- ],
202
- }),
203
- notes: [
204
- "Use 2-3 Arbitration objects: e.g. one for quality disputes, one for delivery disputes",
205
- "compensation_fund > 0 REQUIRES arbitrations non-empty (F-S-19, E_ARBITRATION_NOT_SET_WITH_COMPENSATION_FUND)",
206
- "compensation_fund coin type MUST match Service<T> type parameter",
207
- "setting_lock_duration protects customers — only-increase mechanism",
208
- ],
209
- post_publish_considerations: [
210
- "Arbitration bindings are PERMANENT — verify arb reputation before publish",
211
- "compensation_fund_add (deposit) is always mutable post-publish",
212
- "compensation_fund_withdraw requires bPaused=true + lock_duration expired",
213
- "Cannot add new Arbitration post-publish — only pre-publish",
214
- ],
215
- },
216
- {
217
- id: "T-S-06",
218
- name: "Compensation fund Service (embedded Balance<T>)",
219
- description: "Service focused on compensation_fund management — emphasizes distinction from Treasury",
220
- applicable_scenes: ["service_compensation_fund", "service_arbitration"],
221
- industry_tags: ["finance", "escrow", "guarantee"],
222
- params: [
223
- { name: "owner_address", type: "address", description: "Service owner", required: true },
224
- { name: "permission_address", type: "address", description: "Permission object address", required: true },
225
- { name: "description", type: "string", description: "Service description", required: true },
226
- { name: "arbitration_addresses", type: "string[]", description: "Arbitration objects (required when fund > 0)", required: true },
227
- { name: "initial_deposit", type: "string", description: "Initial compensation_fund deposit (base units)", required: true },
228
- { name: "lock_duration_ms", type: "number", description: "setting_lock_duration (ms)", required: false, default: 2592000000 },
229
- { name: "service_items", type: "object", description: "Sales items", required: true },
230
- ],
231
- body: (p) => ({
232
- object: null,
233
- description: p.description,
234
- permission: p.permission_address,
235
- arbitrations: { op: "add", objects: p.arbitration_addresses },
236
- compensation_fund_add: { balance: p.initial_deposit },
237
- setting_lock_duration_add: p.lock_duration_ms,
238
- sales: { op: "add", sales: p.service_items },
239
- order_allocators: [
240
- {
241
- threshold: "0",
242
- sharing: [{ who: { Object: p.owner_address }, weight: 100 }],
243
- },
244
- ],
245
- }),
246
- notes: [
247
- "⚠️ compensation_fund is INTERNAL Balance<T> — distinct from Treasury (external)",
248
- "Treasury is referenced via order_allocators.sharing.who=Entity (Treasury address)",
249
- "compensation_fund is consumed by arbitration::compensation_claim (driven by arb result)",
250
- "Owner can only withdraw via compensation_fund_withdraw (requires paused + lock expired)",
251
- ],
252
- post_publish_considerations: [
253
- "Deposits (compensation_fund_add) always allowed",
254
- "Withdrawals (compensation_fund_withdraw) require bPaused=true + lock_duration expired",
255
- "Receive (compensation_fund_receive) locked by duration",
256
- "setting_lock_duration only-increase — plan withdrawal timeline carefully",
257
- ],
258
- },
259
- {
260
- id: "T-S-07",
261
- name: "Dynamic pricing Service (discount-driven)",
262
- description: "Service with promotional discount coupons — supports rates (basis points, per 10000) and minus (direct deduction) types",
263
- applicable_scenes: ["service_dynamic_pricing"],
264
- industry_tags: ["retail", "marketing", "promotion"],
265
- params: [
266
- { name: "owner_address", type: "address", description: "Service owner", required: true },
267
- { name: "permission_address", type: "address", description: "Permission object address", required: true },
268
- { name: "description", type: "string", description: "Service description", required: true },
269
- { name: "service_items", type: "object", description: "Array of {name, price, stock, wip, wip_hash}", required: true },
270
- { name: "discount_specs", type: "object", description: "Array of {name, type, data, count, expire_at} for initial discounts", required: false, default: [] },
271
- ],
272
- body: (p) => ({
273
- object: null,
274
- description: p.description,
275
- permission: p.permission_address,
276
- sales: { op: "add", sales: p.service_items },
277
- order_allocators: [
278
- {
279
- threshold: "0",
280
- sharing: [{ who: { Object: p.owner_address }, weight: 100 }],
281
- },
282
- ],
283
- }),
284
- notes: [
285
- "Discounts are issued POST-PUBLISH via service::discount (312) — not in create body",
286
- "discount_type=0 rates (basis points, e.g. 1000=10%); 1=minus (direct deduction, base units)",
287
- "MAX_DISCOUNT_COUNT_ONCE = 1000 per issue call",
288
- "MAX_DISCOUNT_RECEIVER_ONCE = 1000 receivers per call",
289
- "MAX_DISCOUNT_TOTAL_COUNT = 20000 total coupons per Service",
290
- "discount_destroy is holder-only (no SERVICE_DISCOUNT permission needed)",
291
- ],
292
- post_publish_considerations: [
293
- "Discount coupons can be issued/destroyed freely",
294
- "Sales prices can be updated via sales_set (existing orders unaffected)",
295
- "Track discount usage to avoid stockout of promotional items",
296
- ],
297
- },
298
- {
299
- id: "T-S-08",
300
- name: "Multi-allocator Service (tiered fund distribution)",
301
- description: "Service with multiple allocator tiers — first-match-wins distribution based on order value",
302
- applicable_scenes: ["service_multi_allocator", "service_order_allocator", "service_reward"],
303
- industry_tags: ["marketplace", "platform", "logistics"],
304
- params: [
305
- { name: "owner_address", type: "address", description: "Service owner (merchant)", required: true },
306
- { name: "permission_address", type: "address", description: "Permission object address", required: true },
307
- { name: "description", type: "string", description: "Service description", required: true },
308
- { name: "platform_address", type: "address", description: "Platform fee recipient", required: true },
309
- { name: "logistics_address", type: "address", description: "Logistics fee recipient (optional)", required: false, default: "" },
310
- { name: "service_items", type: "object", description: "Array of {name, price, stock, wip, wip_hash}", required: true },
311
- { name: "tier1_threshold", type: "string", description: "Small order threshold (base units, e.g. '0')", required: false, default: "0" },
312
- { name: "tier2_threshold", type: "string", description: "Medium order threshold (base units)", required: false, default: "10000000000" },
313
- { name: "tier3_threshold", type: "string", description: "Large order threshold (base units)", required: false, default: "100000000000" },
314
- ],
315
- body: (p) => {
316
- const allocators = [
317
- {
318
- threshold: p.tier1_threshold,
319
- sharing: [
320
- { who: { Object: p.owner_address }, weight: 90 },
321
- { who: { Object: p.platform_address }, weight: 10 },
322
- ],
323
- },
324
- {
325
- threshold: p.tier2_threshold,
326
- sharing: p.logistics_address
327
- ? [
328
- { who: { Object: p.owner_address }, weight: 80 },
329
- { who: { Object: p.platform_address }, weight: 10 },
330
- { who: { Object: p.logistics_address }, weight: 10 },
331
- ]
332
- : [
333
- { who: { Object: p.owner_address }, weight: 85 },
334
- { who: { Object: p.platform_address }, weight: 15 },
335
- ],
336
- },
337
- {
338
- threshold: p.tier3_threshold,
339
- sharing: p.logistics_address
340
- ? [
341
- { who: { Object: p.owner_address }, weight: 70 },
342
- { who: { Object: p.platform_address }, weight: 10 },
343
- { who: { Object: p.logistics_address }, weight: 20 },
344
- ]
345
- : [
346
- { who: { Object: p.owner_address }, weight: 80 },
347
- { who: { Object: p.platform_address }, weight: 20 },
348
- ],
349
- },
350
- ];
351
- return {
352
- object: null,
353
- description: p.description,
354
- permission: p.permission_address,
355
- sales: { op: "add", sales: p.service_items },
356
- order_allocators: allocators,
357
- };
358
- },
359
- notes: [
360
- "First-match-wins: first allocator whose threshold <= order value handles distribution",
361
- "Each tier can have its own Guard for execution authorization (optional)",
362
- "Thresholds must be ascending (tier1 < tier2 < tier3)",
363
- "MAX_SHARING_COUNT = 100 per allocator (sum of sharing entries)",
364
- "Treasury addresses can be referenced via sharing.who=Entity (Treasury object)",
365
- ],
366
- post_publish_considerations: [
367
- "⚠️ order_allocators is IMMUTABLE post-publish (F-S-22) — verify tiers before publish",
368
- "To change fee split: clone Service with new allocators (cannot migrate existing Orders)",
369
- "Sales can still be updated post-publish (only allocator is locked)",
370
- ],
371
- },
372
- {
373
- id: "T-S-09",
374
- name: "Supply Chain Sub-order Service (milestone unlock via buy_guard)",
375
- description: "Sub-service whose buy_guard verifies the user purchased the main service order. Each milestone = one sub-order. Enables supply chain composition: main service → multiple sub-services with conditional access.",
376
- applicable_scenes: ["service_buy_guard"],
377
- industry_tags: ["travel", "rental", "education", "freelance", "ecommerce", "supply_chain"],
378
- params: [
379
- { name: "owner_address", type: "address", description: "Sub-service owner address", required: true },
380
- { name: "permission_address", type: "address", description: "Permission object address", required: true },
381
- { name: "description", type: "string", description: "Sub-service description (e.g., 'Hotel booking for tour package X')", required: true },
382
- { name: "main_service_address", type: "address", description: "Main Service object address (the parent service)", required: true },
383
- { name: "buy_guard_address", type: "address", description: "Guard address verifying main order ownership (order.owner==Signer AND order.service==main_service)", required: true },
384
- { name: "price", type: "number", description: "Sub-service price", required: true },
385
- { name: "machine_address", type: "address", description: "Machine object for sub-order workflow", required: true },
386
- ],
387
- body: (p) => ({
388
- object: null,
389
- description: p.description,
390
- service_type: "supply_chain_sub",
391
- buy_guard: p.buy_guard_address,
392
- price: p.price,
393
- machine: p.machine_address,
394
- permission: p.permission_address,
395
- }),
396
- notes: [
397
- "VERIFIED: service.move#L173 (buy_guard: Option<address>), L263-268 (buy_with_passport evaluates buy_guard)",
398
- "VERIFIER-EVIDENCE DESIGN: user submits main Order as evidence (b_submission=true), buy_guard verifies order.owner==Signer AND order.service==main_service_address",
399
- "No parent_order field needed — relationship verified via buy_guard querying submitted Order fields",
400
- "Each milestone = one sub-order with its own Service + buy_guard + Machine",
401
- "Main flow Machine can branch to different sub-services based on node progression",
402
- "Use tpl_buy_guard_order_holder (guard-templates.ts) for the buy_guard design",
403
- ],
404
- post_publish_considerations: [
405
- "buy_guard is mutable post-publish (can update the guard address)",
406
- "If main service is unpublished, sub-service buy_guard will fail (order.service won't match)",
407
- "Consider publishing main service before sub-services",
408
- ],
409
- },
410
- ];
411
- export const SERVICE_TEMPLATES_VERSION = "1.0.0";
412
- export function getAllServiceTemplates() {
413
- return [...SERVICE_TEMPLATES];
414
- }
415
- export function getServiceTemplateById(id) {
416
- return SERVICE_TEMPLATES.find(t => t.id === id);
417
- }
418
- export function getServiceTemplatesByScene(sceneId) {
419
- return SERVICE_TEMPLATES.filter(t => t.applicable_scenes.includes(sceneId));
420
- }
421
- export function getServiceTemplatesByIndustry(industry) {
422
- return SERVICE_TEMPLATES.filter(t => t.industry_tags.includes(industry) || t.industry_tags.includes("universal"));
423
- }
424
- export function suggestServiceTemplateForScene(sceneId) {
425
- const matches = getServiceTemplatesByScene(sceneId);
426
- return matches.length > 0 ? matches[0] : undefined;
427
- }
428
- export function listServiceTemplates() {
429
- return SERVICE_TEMPLATES.map(t => ({
430
- id: t.id,
431
- name: t.name,
432
- description: t.description,
433
- scenes: t.applicable_scenes,
434
- }));
435
- }
436
- export function fillServiceTemplate(templateId, params) {
437
- const tpl = getServiceTemplateById(templateId);
438
- if (!tpl)
439
- return { ok: false, error: `Template ${templateId} not found` };
440
- const missing = [];
441
- for (const p of tpl.params) {
442
- if (p.required && !(p.name in params)) {
443
- missing.push(p.name);
444
- }
445
- }
446
- if (missing.length > 0) {
447
- return { ok: false, error: `Missing required params: ${missing.join(", ")}`, missing_required: missing };
448
- }
449
- const filled = { ...params };
450
- for (const p of tpl.params) {
451
- if (!(p.name in filled) && p.default !== undefined) {
452
- filled[p.name] = p.default;
453
- }
454
- }
455
- return { ok: true, body: tpl.body(filled) };
456
- }
1
+ export const SERVICE_TEMPLATES=[{'id':'T-S-01','name':'Retail\x20e-commerce\x20Service','description':'Standard\x20retail\x20shop\x20with\x20multiple\x20SKUs,\x20WIP-verified\x20products,\x20owner-only\x20allocation','applicable_scenes':['service_retail','service_buy_guard'],'industry_tags':['retail','ecommerce','digital_goods'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner\x20address\x20(receives\x20payments)','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address\x20(must\x20be\x20owned\x20by\x20owner)','required':!![]},{'name':'description','type':'string','description':'Shop\x20description','required':!![]},{'name':'location','type':'string','description':'Service\x20geographic\x20location\x20(city/region)','required':![],'default':''},{'name':'sales_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock,\x20wip,\x20wip_hash}','required':!![]},{'name':'buy_guard_address','type':'address','description':'Buyer\x20eligibility\x20Guard\x20(null\x20for\x20public\x20sale)','required':![],'default':''}],'body':a=>{const b={'object':null,'description':a['description'],'permission':a['permission_address'],'location':a['location']||undefined,'sales':{'op':'add','sales':a['sales_items']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]};if(a['buy_guard_address'])b['buy_guard']=a['buy_guard_address'];return b;},'notes':['WIP\x20hash\x20is\x20MANDATORY\x20for\x20tamper\x20protection\x20—\x20never\x20leave\x20empty\x20if\x20wip\x20URL\x20is\x20set','Use\x20buy_guard\x20for\x20pre-sale\x20whitelist\x20phase,\x20then\x20clear\x20for\x20public\x20sale','Single-recipient\x20allocation\x20(owner\x20100%)\x20—\x20use\x20T-S-08\x20for\x20multi-party\x20split'],'post_publish_considerations':['machine/arbitrations/order_allocators\x20become\x20immutable\x20—\x20verify\x20before\x20publish','Sales\x20can\x20still\x20be\x20added/removed/updated\x20post-publish','buy_guard\x20can\x20be\x20changed\x20post-publish\x20(unusual\x20exception)']},{'id':'T-S-02','name':'Rental\x20Service\x20(deposit\x20+\x20use\x20+\x20return)','description':'Equipment/asset\x20rental\x20with\x20deposit\x20guarantee,\x20Machine\x20workflow,\x20and\x20arbitration','applicable_scenes':['service_rental'],'industry_tags':['rental','equipment','real_estate'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner\x20(rental\x20company)','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Rental\x20service\x20description','required':!![]},{'name':'machine_address','type':'address','description':'Published\x20Machine\x20with\x20Reserve→Pay→Pickup→Return→Refund\x20nodes','required':!![]},{'name':'arbitration_address','type':'address','description':'Arbitration\x20for\x20deposit\x20disputes','required':!![]},{'name':'rental_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock=1,\x20wip,\x20wip_hash}','required':!![]},{'name':'compensation_fund_balance','type':'string','description':'Initial\x20deposit\x20to\x20compensation_fund\x20(in\x20base\x20units)','required':![],'default':'0'}],'body':a=>({'object':null,'description':a['description'],'permission':a['permission_address'],'machine':a['machine_address'],'arbitrations':{'op':'add','objects':[a['arbitration_address']]},'sales':{'op':'add','sales':a['rental_items']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}],'compensation_fund_add':a['compensation_fund_balance']&&a['compensation_fund_balance']!=='0'?{'balance':a['compensation_fund_balance']}:undefined}),'notes':['stock=1\x20per\x20rental\x20item\x20(unique\x20items)\x20—\x20once\x20rented,\x20stock\x20becomes\x200','Machine\x20must\x20define\x20deposit/return/refund\x20nodes\x20for\x20proper\x20rental\x20flow','compensation_fund\x20holds\x20deposit\x20guarantees\x20—\x20separate\x20from\x20rental\x20fee','Arbitration\x20required\x20if\x20compensation_fund\x20>\x200\x20(F-S-19)'],'post_publish_considerations':['Machine\x20binding\x20is\x20permanent\x20—\x20verify\x20workflow\x20before\x20publish','Arbitration\x20binding\x20is\x20permanent\x20—\x20choose\x20reputable\x20arbiters','Sales\x20can\x20be\x20updated\x20(add\x20new\x20rental\x20items,\x20remove\x20deprecated\x20ones)']},{'id':'T-S-03','name':'Subscription\x20Service\x20(tiered\x20plans)','description':'Recurring-access\x20service\x20with\x20tiered\x20plans\x20(Free/Pro/Enterprise),\x20discount\x20coupons,\x20loyalty\x20rewards','applicable_scenes':['service_subscription'],'industry_tags':['subscription','saas','membership'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Subscription\x20service\x20description','required':!![]},{'name':'tier_plans','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock=999999,\x20wip,\x20wip_hash}\x20for\x20each\x20tier','required':!![]},{'name':'trial_discount_count','type':'number','description':'Number\x20of\x20trial\x20discount\x20coupons\x20to\x20issue','required':![],'default':0x0},{'name':'reward_address','type':'address','description':'Loyalty\x20Reward\x20object\x20address\x20(optional)','required':![],'default':''}],'body':a=>{const b={'object':null,'description':a['description'],'permission':a['permission_address'],'sales':{'op':'add','sales':a['tier_plans']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]};return a['reward_address']&&(b['rewards']={'op':'add','objects':[a['reward_address']]}),b;},'notes':['Subscription\x20renewals\x20are\x20handled\x20by\x20repeat\x20orders\x20(no\x20native\x20recurring\x20billing)','Use\x20large\x20stock\x20values\x20(e.g.\x20999999)\x20since\x20subscriptions\x20are\x20not\x20inventory-limited','Trial\x20discounts:\x20issue\x20via\x20service::discount\x20(312)\x20post-publish','Loyalty\x20rewards:\x20bind\x20via\x20service::reward_add\x20(318)\x20—\x20locked\x20by\x20setting_lock_duration'],'post_publish_considerations':['Tier\x20prices\x20can\x20be\x20updated\x20via\x20sales_set\x20(existing\x20subscribers\x20unaffected)','Discount\x20coupons\x20can\x20be\x20issued/destroyed\x20post-publish','Rewards\x20can\x20be\x20added\x20but\x20removal\x20locked\x20by\x20duration']},{'id':'T-S-04','name':'Workflow-bound\x20Service\x20(machine-driven\x20delivery)','description':'Service\x20with\x20multi-step\x20delivery\x20workflow\x20(e.g.\x20freelance,\x20custom\x20manufacturing,\x20course)','applicable_scenes':['service_workflow','service_rental'],'industry_tags':['workflow','freelance','manufacturing','education'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner\x20(provider)','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Service\x20description','required':!![]},{'name':'machine_address','type':'address','description':'Published\x20Machine\x20with\x20Pay→Confirm→Deliver→Sign-off\x20nodes','required':!![]},{'name':'service_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock,\x20wip,\x20wip_hash}','required':!![]},{'name':'customer_required','type':'string[]','description':'Required\x20info\x20fields\x20(e.g.\x20[\x27name\x27,\x27project_brief\x27])','required':![],'default':[]}],'body':a=>({'object':null,'description':a['description'],'permission':a['permission_address'],'machine':a['machine_address'],'sales':{'op':'add','sales':a['service_items']},'customer_required':a['customer_required'],'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]}),'notes':['Machine\x20MUST\x20be\x20published\x20before\x20binding\x20(machine::publish)','Each\x20order\x20creates\x20a\x20Progress\x20object\x20tracking\x20the\x20workflow','Named\x20operators\x20can\x20be\x20assigned\x20per\x20Forward\x20in\x20the\x20Machine','Service.bPaused\x20does\x20NOT\x20affect\x20already-created\x20Progress\x20(existing\x20orders\x20continue)'],'post_publish_considerations':['Machine\x20binding\x20is\x20PERMANENT\x20—\x20cannot\x20upgrade\x20workflow\x20post-publish','To\x20change\x20workflow:\x20clone\x20Service\x20with\x20new\x20Machine,\x20migrate\x20customers\x20via\x20discounts','customer_required\x20fields\x20can\x20be\x20updated\x20post-publish']},{'id':'T-S-05','name':'Arbitration-bound\x20Service\x20(dispute-ready)','description':'Service\x20with\x20multiple\x20Arbitration\x20objects\x20for\x20different\x20dispute\x20scopes\x20+\x20compensation_fund','applicable_scenes':['service_arbitration','service_arbitration_binding'],'industry_tags':['arbitration','dispute_resolution','high_value'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Service\x20description','required':!![]},{'name':'arbitration_addresses','type':'string[]','description':'1-3\x20Arbitration\x20object\x20addresses\x20(different\x20scopes)','required':!![]},{'name':'compensation_fund_balance','type':'string','description':'Initial\x20compensation_fund\x20deposit\x20(base\x20units)','required':!![]},{'name':'setting_lock_duration_ms','type':'number','description':'Initial\x20setting_lock_duration\x20in\x20ms\x20(default\x2030\x20days)','required':![],'default':0x9a7ec800},{'name':'service_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock,\x20wip,\x20wip_hash}','required':!![]}],'body':a=>({'object':null,'description':a['description'],'permission':a['permission_address'],'arbitrations':{'op':'add','objects':a['arbitration_addresses']},'compensation_fund_add':{'balance':a['compensation_fund_balance']},'setting_lock_duration_add':a['setting_lock_duration_ms'],'sales':{'op':'add','sales':a['service_items']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]}),'notes':['Use\x202-3\x20Arbitration\x20objects:\x20e.g.\x20one\x20for\x20quality\x20disputes,\x20one\x20for\x20delivery\x20disputes','compensation_fund\x20>\x200\x20REQUIRES\x20arbitrations\x20non-empty\x20(F-S-19,\x20E_ARBITRATION_NOT_SET_WITH_COMPENSATION_FUND)','compensation_fund\x20coin\x20type\x20MUST\x20match\x20Service<T>\x20type\x20parameter','setting_lock_duration\x20protects\x20customers\x20—\x20only-increase\x20mechanism'],'post_publish_considerations':['Arbitration\x20bindings\x20are\x20PERMANENT\x20—\x20verify\x20arb\x20reputation\x20before\x20publish','compensation_fund_add\x20(deposit)\x20is\x20always\x20mutable\x20post-publish','compensation_fund_withdraw\x20requires\x20bPaused=true\x20+\x20lock_duration\x20expired','Cannot\x20add\x20new\x20Arbitration\x20post-publish\x20—\x20only\x20pre-publish']},{'id':'T-S-06','name':'Compensation\x20fund\x20Service\x20(embedded\x20Balance<T>)','description':'Service\x20focused\x20on\x20compensation_fund\x20management\x20—\x20emphasizes\x20distinction\x20from\x20Treasury','applicable_scenes':['service_compensation_fund','service_arbitration'],'industry_tags':['finance','escrow','guarantee'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Service\x20description','required':!![]},{'name':'arbitration_addresses','type':'string[]','description':'Arbitration\x20objects\x20(required\x20when\x20fund\x20>\x200)','required':!![]},{'name':'initial_deposit','type':'string','description':'Initial\x20compensation_fund\x20deposit\x20(base\x20units)','required':!![]},{'name':'lock_duration_ms','type':'number','description':'setting_lock_duration\x20(ms)','required':![],'default':0x9a7ec800},{'name':'service_items','type':'object','description':'Sales\x20items','required':!![]}],'body':a=>({'object':null,'description':a['description'],'permission':a['permission_address'],'arbitrations':{'op':'add','objects':a['arbitration_addresses']},'compensation_fund_add':{'balance':a['initial_deposit']},'setting_lock_duration_add':a['lock_duration_ms'],'sales':{'op':'add','sales':a['service_items']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]}),'notes':['⚠️\x20compensation_fund\x20is\x20INTERNAL\x20Balance<T>\x20—\x20distinct\x20from\x20Treasury\x20(external)','Treasury\x20is\x20referenced\x20via\x20order_allocators.sharing.who=Entity\x20(Treasury\x20address)','compensation_fund\x20is\x20consumed\x20by\x20arbitration::compensation_claim\x20(driven\x20by\x20arb\x20result)','Owner\x20can\x20only\x20withdraw\x20via\x20compensation_fund_withdraw\x20(requires\x20paused\x20+\x20lock\x20expired)'],'post_publish_considerations':['Deposits\x20(compensation_fund_add)\x20always\x20allowed','Withdrawals\x20(compensation_fund_withdraw)\x20require\x20bPaused=true\x20+\x20lock_duration\x20expired','Receive\x20(compensation_fund_receive)\x20locked\x20by\x20duration','setting_lock_duration\x20only-increase\x20—\x20plan\x20withdrawal\x20timeline\x20carefully']},{'id':'T-S-07','name':'Dynamic\x20pricing\x20Service\x20(discount-driven)','description':'Service\x20with\x20promotional\x20discount\x20coupons\x20—\x20supports\x20rates\x20(basis\x20points,\x20per\x2010000)\x20and\x20minus\x20(direct\x20deduction)\x20types','applicable_scenes':['service_dynamic_pricing'],'industry_tags':['retail','marketing','promotion'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Service\x20description','required':!![]},{'name':'service_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock,\x20wip,\x20wip_hash}','required':!![]},{'name':'discount_specs','type':'object','description':'Array\x20of\x20{name,\x20type,\x20data,\x20count,\x20expire_at}\x20for\x20initial\x20discounts','required':![],'default':[]}],'body':a=>({'object':null,'description':a['description'],'permission':a['permission_address'],'sales':{'op':'add','sales':a['service_items']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]}),'notes':['Discounts\x20are\x20issued\x20POST-PUBLISH\x20via\x20service::discount\x20(312)\x20—\x20not\x20in\x20create\x20body','discount_type=0\x20rates\x20(basis\x20points,\x20e.g.\x201000=10%);\x201=minus\x20(direct\x20deduction,\x20base\x20units)','MAX_DISCOUNT_COUNT_ONCE\x20=\x201000\x20per\x20issue\x20call','MAX_DISCOUNT_RECEIVER_ONCE\x20=\x201000\x20receivers\x20per\x20call','MAX_DISCOUNT_TOTAL_COUNT\x20=\x2020000\x20total\x20coupons\x20per\x20Service','discount_destroy\x20is\x20holder-only\x20(no\x20SERVICE_DISCOUNT\x20permission\x20needed)'],'post_publish_considerations':['Discount\x20coupons\x20can\x20be\x20issued/destroyed\x20freely','Sales\x20prices\x20can\x20be\x20updated\x20via\x20sales_set\x20(existing\x20orders\x20unaffected)','Track\x20discount\x20usage\x20to\x20avoid\x20stockout\x20of\x20promotional\x20items']},{'id':'T-S-08','name':'Multi-allocator\x20Service\x20(tiered\x20fund\x20distribution)','description':'Service\x20with\x20multiple\x20allocator\x20tiers\x20—\x20first-match-wins\x20distribution\x20based\x20on\x20order\x20value','applicable_scenes':['service_multi_allocator','service_order_allocator','service_reward'],'industry_tags':['marketplace','platform','logistics'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner\x20(merchant)','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Service\x20description','required':!![]},{'name':'platform_address','type':'address','description':'Platform\x20fee\x20recipient','required':!![]},{'name':'logistics_address','type':'address','description':'Logistics\x20fee\x20recipient\x20(optional)','required':![],'default':''},{'name':'service_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock,\x20wip,\x20wip_hash}','required':!![]},{'name':'tier1_threshold','type':'string','description':'Small\x20order\x20threshold\x20(base\x20units,\x20e.g.\x20\x270\x27)','required':![],'default':'0'},{'name':'tier2_threshold','type':'string','description':'Medium\x20order\x20threshold\x20(base\x20units)','required':![],'default':'10000000000'},{'name':'tier3_threshold','type':'string','description':'Large\x20order\x20threshold\x20(base\x20units)','required':![],'default':'100000000000'}],'body':a=>{const b=[{'threshold':a['tier1_threshold'],'sharing':[{'who':{'Object':a['owner_address']},'weight':0x5a},{'who':{'Object':a['platform_address']},'weight':0xa}]},{'threshold':a['tier2_threshold'],'sharing':a['logistics_address']?[{'who':{'Object':a['owner_address']},'weight':0x50},{'who':{'Object':a['platform_address']},'weight':0xa},{'who':{'Object':a['logistics_address']},'weight':0xa}]:[{'who':{'Object':a['owner_address']},'weight':0x55},{'who':{'Object':a['platform_address']},'weight':0xf}]},{'threshold':a['tier3_threshold'],'sharing':a['logistics_address']?[{'who':{'Object':a['owner_address']},'weight':0x46},{'who':{'Object':a['platform_address']},'weight':0xa},{'who':{'Object':a['logistics_address']},'weight':0x14}]:[{'who':{'Object':a['owner_address']},'weight':0x50},{'who':{'Object':a['platform_address']},'weight':0x14}]}];return{'object':null,'description':a['description'],'permission':a['permission_address'],'sales':{'op':'add','sales':a['service_items']},'order_allocators':b};},'notes':['First-match-wins:\x20first\x20allocator\x20whose\x20threshold\x20<=\x20order\x20value\x20handles\x20distribution','Each\x20tier\x20can\x20have\x20its\x20own\x20Guard\x20for\x20execution\x20authorization\x20(optional)','Thresholds\x20must\x20be\x20ascending\x20(tier1\x20<\x20tier2\x20<\x20tier3)','MAX_SHARING_COUNT\x20=\x20100\x20per\x20allocator\x20(sum\x20of\x20sharing\x20entries)','Treasury\x20addresses\x20can\x20be\x20referenced\x20via\x20sharing.who=Entity\x20(Treasury\x20object)'],'post_publish_considerations':['⚠️\x20order_allocators\x20is\x20IMMUTABLE\x20post-publish\x20(F-S-22)\x20—\x20verify\x20tiers\x20before\x20publish','To\x20change\x20fee\x20split:\x20clone\x20Service\x20with\x20new\x20allocators\x20(cannot\x20migrate\x20existing\x20Orders)','Sales\x20can\x20still\x20be\x20updated\x20post-publish\x20(only\x20allocator\x20is\x20locked)']},{'id':'T-S-09','name':'Supply\x20Chain\x20Sub-order\x20Service\x20(milestone\x20unlock\x20via\x20buy_guard)','description':'Sub-service\x20whose\x20buy_guard\x20verifies\x20the\x20user\x20purchased\x20the\x20main\x20service\x20order.\x20Each\x20milestone\x20=\x20one\x20sub-order.\x20Enables\x20supply\x20chain\x20composition:\x20main\x20service\x20→\x20multiple\x20sub-services\x20with\x20conditional\x20access.','applicable_scenes':['service_buy_guard'],'industry_tags':['travel','rental','education','freelance','ecommerce','supply_chain'],'params':[{'name':'owner_address','type':'address','description':'Sub-service\x20owner\x20address','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Sub-service\x20description\x20(e.g.,\x20\x27Hotel\x20booking\x20for\x20tour\x20package\x20X\x27)','required':!![]},{'name':'main_service_address','type':'address','description':'Main\x20Service\x20object\x20address\x20(the\x20parent\x20service)','required':!![]},{'name':'buy_guard_address','type':'address','description':'Guard\x20address\x20verifying\x20main\x20order\x20ownership\x20(order.owner==Signer\x20AND\x20order.service==main_service)','required':!![]},{'name':'price','type':'number','description':'Sub-service\x20price','required':!![]},{'name':'machine_address','type':'address','description':'Machine\x20object\x20for\x20sub-order\x20workflow','required':!![]}],'body':a=>({'object':null,'description':a['description'],'service_type':'supply_chain_sub','buy_guard':a['buy_guard_address'],'price':a['price'],'machine':a['machine_address'],'permission':a['permission_address']}),'notes':['VERIFIED:\x20service.move#L173\x20(buy_guard:\x20Option<address>),\x20L263-268\x20(buy_with_passport\x20evaluates\x20buy_guard)','VERIFIER-EVIDENCE\x20DESIGN:\x20user\x20submits\x20main\x20Order\x20as\x20evidence\x20(b_submission=true),\x20buy_guard\x20verifies\x20order.owner==Signer\x20AND\x20order.service==main_service_address','No\x20parent_order\x20field\x20needed\x20—\x20relationship\x20verified\x20via\x20buy_guard\x20querying\x20submitted\x20Order\x20fields','Each\x20milestone\x20=\x20one\x20sub-order\x20with\x20its\x20own\x20Service\x20+\x20buy_guard\x20+\x20Machine','Main\x20flow\x20Machine\x20can\x20branch\x20to\x20different\x20sub-services\x20based\x20on\x20node\x20progression','Use\x20tpl_buy_guard_order_holder\x20(guard-templates.ts)\x20for\x20the\x20buy_guard\x20design'],'post_publish_considerations':['buy_guard\x20is\x20mutable\x20post-publish\x20(can\x20update\x20the\x20guard\x20address)','If\x20main\x20service\x20is\x20unpublished,\x20sub-service\x20buy_guard\x20will\x20fail\x20(order.service\x20won\x27t\x20match)','Consider\x20publishing\x20main\x20service\x20before\x20sub-services']}];export const SERVICE_TEMPLATES_VERSION='1.0.0';export function getAllServiceTemplates(){return[...SERVICE_TEMPLATES];}export function getServiceTemplateById(a){return SERVICE_TEMPLATES['find'](b=>b['id']===a);}export function getServiceTemplatesByScene(a){return SERVICE_TEMPLATES['filter'](b=>b['applicable_scenes']['includes'](a));}export function getServiceTemplatesByIndustry(a){return SERVICE_TEMPLATES['filter'](b=>b['industry_tags']['includes'](a)||b['industry_tags']['includes']('universal'));}export function suggestServiceTemplateForScene(a){const b=getServiceTemplatesByScene(a);return b['length']>0x0?b[0x0]:undefined;}export function listServiceTemplates(){return SERVICE_TEMPLATES['map'](a=>({'id':a['id'],'name':a['name'],'description':a['description'],'scenes':a['applicable_scenes']}));}export function fillServiceTemplate(a,b){const c=getServiceTemplateById(a);if(!c)return{'ok':![],'error':'Template\x20'+a+'\x20not\x20found'};const d=[];for(const f of c['params']){f['required']&&!(f['name']in b)&&d['push'](f['name']);}if(d['length']>0x0)return{'ok':![],'error':'Missing\x20required\x20params:\x20'+d['join'](',\x20'),'missing_required':d};const e={...b};for(const g of c['params']){!(g['name']in e)&&g['default']!==undefined&&(e[g['name']]=g['default']);}return{'ok':!![],'body':c['body'](e)};}