@wowok/agent-mcp 2.6.3 → 2.6.6

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 (193) hide show
  1. package/README.md +13 -9
  2. package/dist/customer/customer-advice.d.ts +31 -0
  3. package/dist/customer/customer-advice.js +129 -0
  4. package/dist/customer/index.d.ts +2 -0
  5. package/dist/customer/index.js +2 -0
  6. package/dist/customer/info-puzzle.d.ts +8 -1
  7. package/dist/customer/info-puzzle.js +30 -5
  8. package/dist/customer/order-monitor.d.ts +2 -0
  9. package/dist/customer/order-monitor.js +3 -2
  10. package/dist/customer/post-purchase.d.ts +2 -0
  11. package/dist/customer/post-purchase.js +6 -5
  12. package/dist/customer/preorder-compare.d.ts +24 -0
  13. package/dist/customer/preorder-compare.js +34 -0
  14. package/dist/customer/reminder-system.d.ts +2 -0
  15. package/dist/customer/reminder-system.js +2 -1
  16. package/dist/customer/risk-assessment.js +4 -3
  17. package/dist/customer/types.d.ts +5 -0
  18. package/dist/examples/arbitration-dispute-create.json +41 -0
  19. package/dist/examples/arbitration-vote-weighted.json +35 -0
  20. package/dist/examples/arbitration-voting-guard-add.json +38 -0
  21. package/dist/examples/demand-present-service.json +33 -0
  22. package/dist/examples/gen-passport-verify-guard.json +48 -0
  23. package/dist/examples/guard-template-balance-check.json +36 -15
  24. package/dist/examples/guard-template-time-lock.json +33 -12
  25. package/dist/examples/insurance-guard-claim-timelock.json +75 -0
  26. package/dist/examples/insurance-guard-withdraw-allocation.json +96 -0
  27. package/dist/examples/insurance-machine-create-publish.json +75 -0
  28. package/dist/examples/insurance-service-allocators-publish.json +56 -0
  29. package/dist/examples/machine-multisig-threshold.json +86 -0
  30. package/dist/examples/machine-template-7node-rental.json +99 -94
  31. package/dist/examples/payment-scenario-bound.json +45 -0
  32. package/dist/examples/rental-ziroom-machine-create.json +126 -114
  33. package/dist/examples/rental-ziroom-permission-create.json +10 -3
  34. package/dist/examples/rental-ziroom-service-create.json +27 -18
  35. package/dist/examples/retail-adv-guard-customer-win-create.json +80 -0
  36. package/dist/examples/retail-adv-guard-messenger-proof-create.json +65 -0
  37. package/dist/examples/retail-adv-guard-reward-timeout-create.json +92 -0
  38. package/dist/examples/retail-adv-reward-guard-add.json +51 -0
  39. package/dist/examples/retail-myshop-allocation-activate.json +55 -0
  40. package/dist/examples/retail-myshop-arbitration-create.json +40 -0
  41. package/dist/examples/retail-myshop-contact-create.json +43 -0
  42. package/dist/examples/retail-myshop-order-create.json +56 -0
  43. package/dist/examples/retail-myshop-progress-operate.json +38 -0
  44. package/dist/examples/retail-myshop-reward-create.json +35 -0
  45. package/dist/examples/service-discount-issue.json +46 -0
  46. package/dist/examples/threebody-guard-create.json +56 -0
  47. package/dist/examples/threebody-machine-create.json +72 -0
  48. package/dist/examples/threebody-permission-create.json +38 -0
  49. package/dist/examples/threebody-service-allocators.json +49 -0
  50. package/dist/examples/travel-guard-time-lock.json +69 -0
  51. package/dist/examples/travel-guard-weather-oracle.json +70 -0
  52. package/dist/examples/travel-machine-create.json +136 -0
  53. package/dist/examples/travel-repository-create.json +47 -0
  54. package/dist/examples/travel-service-create.json +102 -0
  55. package/dist/examples/travel-treasury-create.json +34 -0
  56. package/dist/examples/treasury-deposit.json +37 -0
  57. package/dist/examples/treasury-withdraw.json +38 -0
  58. package/dist/extensions/business-modules.d.ts +49 -0
  59. package/dist/extensions/business-modules.js +287 -0
  60. package/dist/extensions/capability-manifest.js +192 -5
  61. package/dist/extensions/constraint-registry.js +3 -1
  62. package/dist/extensions/modes.js +10 -4
  63. package/dist/extensions/registry.d.ts +14 -9
  64. package/dist/extensions/registry.js +69 -14
  65. package/dist/extensions/types.d.ts +1 -0
  66. package/dist/knowledge/fund-layer.d.ts +67 -1
  67. package/dist/knowledge/fund-layer.js +561 -12
  68. package/dist/knowledge/guard-templates.d.ts +10 -0
  69. package/dist/knowledge/guard-templates.js +50 -0
  70. package/dist/knowledge/index.d.ts +2 -2
  71. package/dist/knowledge/index.js +2 -2
  72. package/dist/knowledge/machine-risk.js +4 -1
  73. package/dist/knowledge/progress-context.js +1 -1
  74. package/dist/knowledge/progress-ledger.js +3 -3
  75. package/dist/knowledge/progress-templates.js +1 -1
  76. package/dist/knowledge/progress-translation.js +1 -1
  77. package/dist/knowledge/safety-rules.d.ts +83 -1
  78. package/dist/knowledge/safety-rules.js +166 -2
  79. package/dist/knowledge/scenario-modes.d.ts +1 -1
  80. package/dist/knowledge/scenario-modes.js +13 -11
  81. package/dist/knowledge/template-registry.d.ts +48 -0
  82. package/dist/knowledge/template-registry.js +341 -0
  83. package/dist/knowledge/tool-constraints.js +6 -6
  84. package/dist/knowledge/tools-reference.js +11 -8
  85. package/dist/participation/merchant-interest.d.ts +32 -0
  86. package/dist/participation/merchant-interest.js +100 -0
  87. package/dist/participation/radar-core.d.ts +104 -0
  88. package/dist/participation/radar-core.js +269 -0
  89. package/dist/project/context-assembly.js +8 -0
  90. package/dist/project/edit-planner.js +27 -56
  91. package/dist/project/evaluation.d.ts +36 -0
  92. package/dist/project/evaluation.js +422 -56
  93. package/dist/project/game-theory.d.ts +43 -0
  94. package/dist/project/game-theory.js +177 -0
  95. package/dist/project/graph-builder.js +1 -0
  96. package/dist/project/handlers.d.ts +38 -0
  97. package/dist/project/handlers.js +65 -35
  98. package/dist/project/intent-analyzer.d.ts +71 -0
  99. package/dist/project/intent-analyzer.js +149 -0
  100. package/dist/project/machine-nodes.d.ts +2 -0
  101. package/dist/project/machine-nodes.js +36 -0
  102. package/dist/project/merchant-guide.d.ts +165 -0
  103. package/dist/project/merchant-guide.js +264 -0
  104. package/dist/project/mode-actions.d.ts +199 -0
  105. package/dist/project/mode-actions.js +309 -0
  106. package/dist/project/participation-radar.d.ts +18 -0
  107. package/dist/project/participation-radar.js +428 -0
  108. package/dist/project/pipeline-actions.d.ts +101 -0
  109. package/dist/project/pipeline-actions.js +109 -0
  110. package/dist/project/semantic-graph.d.ts +95 -0
  111. package/dist/project/semantic-graph.js +245 -0
  112. package/dist/schema/call/allocation.d.ts +11 -11
  113. package/dist/schema/call/allocation.js +11 -1
  114. package/dist/schema/call/arbitration.d.ts +21 -21
  115. package/dist/schema/call/arbitration.js +17 -9
  116. package/dist/schema/call/base.d.ts +2 -2
  117. package/dist/schema/call/base.js +1 -1
  118. package/dist/schema/call/bridge.d.ts +127 -127
  119. package/dist/schema/call/bridge.js +12 -12
  120. package/dist/schema/call/contact.d.ts +3 -3
  121. package/dist/schema/call/demand.d.ts +3 -3
  122. package/dist/schema/call/guard.d.ts +11 -11
  123. package/dist/schema/call/guard.js +1 -1
  124. package/dist/schema/call/machine.d.ts +216 -21
  125. package/dist/schema/call/machine.js +1 -1
  126. package/dist/schema/call/order.d.ts +7 -7
  127. package/dist/schema/call/payment.d.ts +3 -3
  128. package/dist/schema/call/permission.d.ts +3 -3
  129. package/dist/schema/call/personal.d.ts +337 -3
  130. package/dist/schema/call/personal.js +10 -0
  131. package/dist/schema/call/progress.d.ts +177 -9
  132. package/dist/schema/call/progress.js +7 -3
  133. package/dist/schema/call/proof.d.ts +6 -6
  134. package/dist/schema/call/repository.d.ts +3 -3
  135. package/dist/schema/call/reward.d.ts +57 -57
  136. package/dist/schema/call/semantic.js +41 -1
  137. package/dist/schema/call/service.d.ts +114 -114
  138. package/dist/schema/call/service.js +11 -2
  139. package/dist/schema/call/treasury.d.ts +57 -57
  140. package/dist/schema/messenger/index.js +4 -1
  141. package/dist/schema/operations.d.ts +713 -291
  142. package/dist/schema/operations.js +33 -0
  143. package/dist/schema/project/index.d.ts +4635 -100
  144. package/dist/schema/project/index.js +868 -1
  145. package/dist/schema/query/index.d.ts +363 -19
  146. package/dist/schema/query/index.js +25 -3
  147. package/dist/schema/schema-query/index.d.ts +13 -7
  148. package/dist/schema/schema-query/index.js +29 -5
  149. package/dist/schema/trust/index.d.ts +1012 -6
  150. package/dist/schema/trust/index.js +212 -11
  151. package/dist/schema/utils/skills-recommendation.js +1 -0
  152. package/dist/schema-query/index.d.ts +4 -1
  153. package/dist/schema-query/index.js +255 -1
  154. package/dist/schemas/bridge_operation.schema.json +14 -7
  155. package/dist/schemas/guard2file.schema.json +2 -0
  156. package/dist/schemas/index.json +1 -1
  157. package/dist/schemas/machineNode2file.schema.json +2 -0
  158. package/dist/schemas/messenger_operation.schema.json +1 -1
  159. package/dist/schemas/onchain_operations.schema.json +143 -15
  160. package/dist/schemas/onchain_operations_allocation.schema.json +2 -1
  161. package/dist/schemas/onchain_operations_arbitration.schema.json +7 -5
  162. package/dist/schemas/onchain_operations_contact.schema.json +1 -0
  163. package/dist/schemas/onchain_operations_demand.schema.json +1 -0
  164. package/dist/schemas/onchain_operations_gen_passport.schema.json +2 -0
  165. package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -0
  166. package/dist/schemas/onchain_operations_guard.schema.json +578 -0
  167. package/dist/schemas/onchain_operations_machine.schema.json +1 -0
  168. package/dist/schemas/onchain_operations_order.schema.json +4 -3
  169. package/dist/schemas/onchain_operations_payment.schema.json +1 -0
  170. package/dist/schemas/onchain_operations_permission.schema.json +1 -0
  171. package/dist/schemas/onchain_operations_personal.schema.json +37 -0
  172. package/dist/schemas/onchain_operations_progress.schema.json +90 -3
  173. package/dist/schemas/onchain_operations_proof.schema.json +1 -0
  174. package/dist/schemas/onchain_operations_repository.schema.json +1 -0
  175. package/dist/schemas/onchain_operations_reward.schema.json +1 -0
  176. package/dist/schemas/onchain_operations_service.schema.json +4 -3
  177. package/dist/schemas/onchain_operations_treasury.schema.json +1 -0
  178. package/dist/schemas/project_operation.output.json +2243 -1
  179. package/dist/schemas/project_operation.schema.json +683 -1
  180. package/dist/schemas/query_toolkit.output.json +1 -1
  181. package/dist/schemas/query_toolkit.schema.json +37 -0
  182. package/dist/schemas/schema_query.output.json +1 -1
  183. package/dist/schemas/schema_query.schema.json +30 -5
  184. package/dist/schemas/trust_score.output.json +392 -1
  185. package/dist/schemas/trust_score.schema.json +275 -1
  186. package/dist/tools/handlers/onchain.js +73 -8
  187. package/dist/tools/handlers/project.js +46 -0
  188. package/dist/tools/handlers/query.js +117 -2
  189. package/dist/tools/handlers/schema-query.js +41 -0
  190. package/dist/tools/handlers/trust.js +192 -6
  191. package/dist/tools/index.js +52 -9
  192. package/dist/tools/wrap.js +194 -15
  193. package/package.json +2 -2
@@ -0,0 +1,38 @@
1
+ {
2
+ "title": "Configure Weighted Voting Guard on Arbitration",
3
+ "description": "Add an eligibility Guard to the Arbitration's voting_guard list with a fixed vote weight, enabling guard-based weighted voting for dispute cases.",
4
+ "tags": ["arbitration", "voting_guard", "guard", "governance"],
5
+ "industry": "retail",
6
+ "operation_type": "arbitration",
7
+ "source": "constructed under T-09 authorization; grounded in VotingGuardActionSchema + VoteWeightSchema + arbitration.move voting_guard_fixed_add — schema-validated, not chain-verified",
8
+ "verified": false,
9
+ "network": "testnet",
10
+ "call": {
11
+ "tool": "onchain_operations",
12
+ "operation_type": "arbitration",
13
+ "data": {
14
+ "object": "myshop_arbitration_v2",
15
+ "voting_guard": {
16
+ "op": "add",
17
+ "guards": [
18
+ {
19
+ "guard": "arbitrator_eligibility_guard",
20
+ "vote_weight": { "FixedValue": 1 }
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ "env": {
26
+ "network": "testnet",
27
+ "no_cache": true,
28
+ "confirmed": true
29
+ }
30
+ },
31
+ "notes": [
32
+ "Two voting modes exist (arbitration.move): OPEN voting (voting_guard list EMPTY — any permission-358 holder votes with weight 1 via vote_imp) and GUARD-WEIGHTED voting (list non-empty — only listed Guards can vote, via vote_with_voting_guard). This call switches the Arbitration to guard-weighted mode.",
33
+ "vote_weight variants (VoteWeightSchema): {FixedValue: n} gives every verified voter weight n (u32, max 65535 in schema); {GuardIdentifier: i} reads the weight dynamically from the voter's Passport submission value at Guard table index i (e.g. reputation-score-weighted voting).",
34
+ "The Guard itself ('arbitrator_eligibility_guard') must exist beforehand (operation_type:'guard') — e.g. a Guard checking the voter holds an arbitrator credential or stake.",
35
+ "op variants: 'add'/'set' take VotingGuard objects; 'remove' takes plain guard names/addresses; 'clear' empties the list (returning to open voting). Requires Arbitration permission index 354 (ARBITRATION_VOTING_GUARD).",
36
+ "Once ANY voting_guard is configured, plain vote (no guard) aborts with E_VOTING_GUARD_USED — every voter must verify through one of the listed Guards."
37
+ ]
38
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "title": "Present Service to a Demand (Recommendation)",
3
+ "description": "Recommend myshop_service_v2 to an open Demand object with a recommendation letter, entering the Demand's presenter list for reward eligibility.",
4
+ "tags": ["demand", "present", "recommendation", "service"],
5
+ "industry": "retail",
6
+ "operation_type": "demand",
7
+ "source": "constructed under T-09 authorization; grounded in DemandPresentSchema + demand.ts SDK — schema-validated, not chain-verified",
8
+ "verified": false,
9
+ "network": "testnet",
10
+ "call": {
11
+ "tool": "onchain_operations",
12
+ "operation_type": "demand",
13
+ "data": {
14
+ "object": "toy_repair_demand_v1",
15
+ "present": {
16
+ "recommend": "Our toy repair service matches this demand: 7-day turnaround, WOW escrow payment, independent arbitration coverage.",
17
+ "service": "myshop_service_v2"
18
+ }
19
+ },
20
+ "env": {
21
+ "network": "testnet",
22
+ "no_cache": true,
23
+ "confirmed": true
24
+ }
25
+ },
26
+ "notes": [
27
+ "present makes the CALLER a Presenter on the Demand: the recommendation letter (recommend, REQUIRED) plus an optional service reference. Presenters become eligible to claim the Demand's reward pool when the demander accepts their recommendation.",
28
+ "If the Demand has guards configured (ServiceGuard list), the presented Service is verified against them — a Guard may filter which Services qualify (e.g. must have arbitration bound, must be in a category). Use by_guard to select which configured Guard to verify through when several are present.",
29
+ "service is optional but recommended — a bare recommendation without a Service reference gives the demander nothing to inspect.",
30
+ "Follow-up flow: the demander reviews presenters (query_table on DemandPresenter), buys the presented Service, and may leave feedback (FeedbackInfo: acceptance_score 0-255 + feedback text) which updates the presenter's on-chain reputation.",
31
+ "PREREQUISITE: 'toy_repair_demand_v1' exists (created via operation_type:'demand' with object {name, permission, rewards...}) and 'myshop_service_v2' is a published Service."
32
+ ]
33
+ }
@@ -0,0 +1,48 @@
1
+ {
2
+ "title": "Generate Passport from Guard Verification (KYC Credential)",
3
+ "description": "End-to-end gen_passport: verify a KYC-level Guard with runtime submission data and mint an immutable on-chain Passport credential for the signer.",
4
+ "tags": ["passport", "guard", "kyc", "credential", "gen_passport"],
5
+ "industry": "general",
6
+ "operation_type": "gen_passport",
7
+ "source": "constructed under T-09 authorization; grounded in CallGenPassport_InputSchema + SDK gen_passport — schema-validated, not chain-verified",
8
+ "verified": false,
9
+ "network": "testnet",
10
+ "call": {
11
+ "tool": "onchain_operations",
12
+ "operation_type": "gen_passport",
13
+ "guard": ["kyc_level_guard"],
14
+ "info": {
15
+ "type": "submission",
16
+ "guard": [
17
+ { "object": "kyc_level_guard", "impack": true }
18
+ ],
19
+ "submission": [
20
+ {
21
+ "guard": "kyc_level_guard",
22
+ "submission": [
23
+ {
24
+ "identifier": 0,
25
+ "b_submission": true,
26
+ "value_type": "U64",
27
+ "value": 1000,
28
+ "name": ""
29
+ }
30
+ ]
31
+ }
32
+ ]
33
+ },
34
+ "env": {
35
+ "network": "testnet",
36
+ "no_cache": true,
37
+ "confirmed": true
38
+ }
39
+ },
40
+ "notes": [
41
+ "UNIQUE SHAPE: gen_passport has NO 'data' field — 'guard' is a TOP-LEVEL sibling of operation_type (string or string[] of Guard names/addresses). Do not wrap parameters inside a data object.",
42
+ "info is optional. When omitted, the SDK reuses submissions already recorded on the Guard (from a prior verification). Provide info when the Guard has b_submission=true table items whose values must be supplied at verification time — as here (identifier 0, a U64 KYC score).",
43
+ "info structure = SubmissionCallSchema: {type:'submission', guard:[{object, impack}], submission:[{guard, submission:[GuardTableItem...]}]}. impack:true means this Guard's result counts in the Passport's final AND result.",
44
+ "Each submission entry mirrors the Guard's table definition: identifier must match the table item being filled, value_type must match its declared type ('U64' string form accepted alongside numeric 6), and b_submission entries carry the runtime value.",
45
+ "The resulting Passport object records per-Guard results, the final AND result, signer, and timestamp (ObjectPassportSchema). It is the credential consumed by vote_with_voting_guard, alloc_by_guard, and buy flows that require Guard verification.",
46
+ "PREREQUISITE: 'kyc_level_guard' must already exist (created via operation_type:'guard') with a table item identifier:0, value_type U64, b_submission:true. Multiple Guards can be verified in one call by passing an array and one submission entry per Guard."
47
+ ]
48
+ }
@@ -1,31 +1,48 @@
1
1
  {
2
- "title": "Guard Template: Balance Check Validation",
3
- "description": "Guard that validates order balance >= threshold",
4
- "tags": ["guard", "template", "balance", "validation"],
2
+ "title": "Guard Template: Minimum Order Amount Validation",
3
+ "description": "Guard that passes only when the Order's paid amount meets a minimum threshold. Bind to an Allocator (fund release) or a Machine forward to gate high-value transitions.",
4
+ "tags": ["guard", "template", "balance", "amount", "validation"],
5
5
  "industry": "general",
6
6
  "operation_type": "guard",
7
7
  "source": "template",
8
8
  "verified": true,
9
+ "network": "testnet",
9
10
  "call": {
10
11
  "tool": "onchain_operations",
11
12
  "operation_type": "guard",
12
13
  "data": {
13
- "object": {
14
+ "namedNew": {
14
15
  "name": "balance_check_guard"
15
16
  },
16
- "root": {
17
- "type": "logic_greater_equal",
18
- "left": {
19
- "type": "query",
20
- "name": "balance",
21
- "parameters": [],
22
- "objectType": "Order"
17
+ "description": "Passes when order.amount >= min_amount (table identifier 1).",
18
+ "table": [
19
+ {
20
+ "identifier": 0,
21
+ "b_submission": true,
22
+ "value_type": "Address",
23
+ "name": "order"
23
24
  },
24
- "right": {
25
- "type": "identifier",
25
+ {
26
+ "identifier": 1,
27
+ "b_submission": false,
26
28
  "value_type": "U64",
27
- "index": 0
29
+ "value": "1000000000",
30
+ "name": "min_amount"
28
31
  }
32
+ ],
33
+ "root": {
34
+ "type": "logic_as_u256_greater_or_equal",
35
+ "nodes": [
36
+ {
37
+ "type": "query",
38
+ "query": "order.amount",
39
+ "object": { "identifier": 0 }
40
+ },
41
+ {
42
+ "type": "identifier",
43
+ "identifier": 1
44
+ }
45
+ ]
29
46
  }
30
47
  },
31
48
  "env": {
@@ -33,6 +50,10 @@
33
50
  }
34
51
  },
35
52
  "notes": [
36
- "Use for minimum payment validation, deposit threshold checks"
53
+ "order.amount (id 1561) returns the TOTAL amount paid for the order (U64, smallest unit). Do NOT confuse with the order's residual escrow balance.",
54
+ "Root MUST return Bool — logic_as_u256_greater_or_equal compares the first node (query result) against all subsequent nodes (threshold from the table).",
55
+ "The threshold (identifier 1) is fixed at Guard creation (b_submission=false); the Order address is submitted per trigger (identifier 0, b_submission=true).",
56
+ "Amounts use the token's smallest unit: 1000000000 = 1 WOW (9 decimals).",
57
+ "Use for minimum payment validation, deposit threshold checks, or gating Allocator release on order value."
37
58
  ]
38
59
  }
@@ -1,32 +1,49 @@
1
1
  {
2
2
  "title": "Guard Template: Time-Lock Validation",
3
- "description": "Guard that validates a time-based condition (e.g., rental period elapsed)",
3
+ "description": "Guard that passes only after the Progress object's current-node entry timestamp reaches a deadline (e.g., rental period elapsed, escrow release timing). Bind to a Machine forward or an Allocator to gate time-locked transitions.",
4
4
  "tags": ["guard", "template", "time-lock", "validation"],
5
5
  "industry": "general",
6
6
  "operation_type": "guard",
7
7
  "source": "template",
8
8
  "verified": true,
9
+ "network": "testnet",
9
10
  "call": {
10
11
  "tool": "onchain_operations",
11
12
  "operation_type": "guard",
12
13
  "data": {
13
- "object": {
14
+ "namedNew": {
14
15
  "name": "time_lock_guard",
15
16
  "tags": ["template", "time-lock"]
16
17
  },
17
- "root": {
18
- "type": "logic_equal",
19
- "left": {
20
- "type": "query",
21
- "name": "time_now",
22
- "parameters": [],
23
- "objectType": "Order"
18
+ "description": "Passes when progress.current_time >= release_after_ms (table identifier 1).",
19
+ "table": [
20
+ {
21
+ "identifier": 0,
22
+ "b_submission": true,
23
+ "value_type": "Address",
24
+ "name": "progress"
24
25
  },
25
- "right": {
26
- "type": "identifier",
26
+ {
27
+ "identifier": 1,
28
+ "b_submission": false,
27
29
  "value_type": "U64",
28
- "index": 0
30
+ "value": "1735689600000",
31
+ "name": "release_after_ms"
29
32
  }
33
+ ],
34
+ "root": {
35
+ "type": "logic_as_u256_greater_or_equal",
36
+ "nodes": [
37
+ {
38
+ "type": "query",
39
+ "query": "progress.current_time",
40
+ "object": { "identifier": 0 }
41
+ },
42
+ {
43
+ "type": "identifier",
44
+ "identifier": 1
45
+ }
46
+ ]
30
47
  }
31
48
  },
32
49
  "env": {
@@ -34,6 +51,10 @@
34
51
  }
35
52
  },
36
53
  "notes": [
54
+ "Root MUST return Bool: comparison/logic nodes (logic_*, logic_as_u256_*) qualify; a bare query returning U64 does NOT.",
55
+ "Comparison nodes carry a 'nodes' array (first node compared against all subsequent). Query nodes carry 'query' (instruction id or name) + 'object' (Guard-table identifier of the queried object). Identifier nodes carry 'identifier' (Guard-table index).",
56
+ "progress.current_time (id 1272) returns the current-node entry timestamp in milliseconds (U64) — compare against a deadline stored in the table (identifier 1, b_submission=false so it is fixed at creation).",
57
+ "The Progress address is submitted at trigger time (identifier 0, b_submission=true) — the caller supplies it via submissions[].",
37
58
  "Use for rental period expiry, escrow release timing, etc."
38
59
  ]
39
60
  }
@@ -0,0 +1,75 @@
1
+ {
2
+ "title": "Create Time-Lock Claim Completion Guard (Insurance)",
3
+ "description": "Create a Guard that enforces a time-lock on insurance claim completion: the on-chain clock must be later than the order Progress's current-node entry time plus a lock duration. The submitted Order ID is converted to its Progress via convert_witness=\"OrderProgress\" to query progress.current_time.",
4
+ "tags": ["guard", "insurance", "time-lock", "claim", "convert_witness"],
5
+ "industry": "insurance",
6
+ "operation_type": "guard",
7
+ "source": "docs/examples/Insurance — schema-validated, not chain-verified",
8
+ "verified": false,
9
+ "network": "testnet",
10
+ "call": {
11
+ "tool": "onchain_operations",
12
+ "operation_type": "guard",
13
+ "data": {
14
+ "namedNew": {
15
+ "name": "insurance_complete_guard_v1",
16
+ "tags": ["insurance", "time-lock", "complete"],
17
+ "replaceExistName": true
18
+ },
19
+ "description": "Time-lock guard for insurance claim completion. Requires current clock > progress.current_time + 10000ms (10 seconds for TESTING; in production set to a reasonable duration like 8 hours). Progress is accessed via Order with convert_witness=\"OrderProgress\" (100).",
20
+ "table": [
21
+ {
22
+ "identifier": 0,
23
+ "b_submission": true,
24
+ "value_type": "Address",
25
+ "name": "Order ID (submitted at runtime)"
26
+ },
27
+ {
28
+ "identifier": 1,
29
+ "b_submission": false,
30
+ "value_type": "U64",
31
+ "value": 10000
32
+ }
33
+ ],
34
+ "root": {
35
+ "type": "logic_as_u256_greater",
36
+ "nodes": [
37
+ {
38
+ "type": "context",
39
+ "context": "Clock"
40
+ },
41
+ {
42
+ "type": "calc_number_add",
43
+ "nodes": [
44
+ {
45
+ "type": "query",
46
+ "query": "progress.current_time",
47
+ "object": {
48
+ "identifier": 0,
49
+ "convert_witness": "OrderProgress"
50
+ },
51
+ "parameters": []
52
+ },
53
+ {
54
+ "type": "identifier",
55
+ "identifier": 1
56
+ }
57
+ ]
58
+ }
59
+ ]
60
+ }
61
+ },
62
+ "env": {
63
+ "account": "insurance_provider_v1",
64
+ "network": "testnet"
65
+ }
66
+ },
67
+ "notes": [
68
+ "Unique pattern vs the existing guard-template-time-lock.json: that template queries progress.current_time on a Progress submitted DIRECTLY; this insurance Guard submits the ORDER and uses convert_witness='OrderProgress' (WitnessType 100) to hop from Order to its associated Progress before querying — the canonical claim-eligibility pattern when only the Order ID is available at trigger time.",
69
+ "Schema check (call/guard.ts CallGuard_DataSchema + query/index.ts GuardNodeSchema): root type 'logic_as_u256_greater' is in the Bool-returning allowed list; 'context' node uses context enum 'Clock'; 'calc_number_add' wraps the U64 query + identifier so the comparison operands are numeric; query node carries object {identifier, convert_witness} and optional parameters [] (may be omitted for parameter-less queries).",
70
+ "convert_witness 'OrderProgress' validated against WitnessTypeSchema (query/index.ts L736-746): string name form, 'Type' prefix optional, case-insensitive.",
71
+ "Table validated against GuardTableItemBaseSchema (common/index.ts L365-399): identifier 0 is b_submission=true (runtime-submitted Order address, 'value' omitted); identifier 1 is b_submission=false with value_type 'U64' and numeric value 10000. No 'object_type' field (output-only, rejected on input).",
72
+ "10000 ms (10 s) is a TESTING lock duration; production should use e.g. 8 hours (28800000 ms).",
73
+ "Desensitization: doc payload already uses generic local-mark names (insurance_provider_v1, insurance_complete_guard_v1) and contains no real personal names/phones/addresses; nothing further to replace."
74
+ ]
75
+ }
@@ -0,0 +1,96 @@
1
+ {
2
+ "title": "Create Withdraw Guard for Order Allocation (Insurance, Project-Bound)",
3
+ "description": "Create a withdraw Guard for merchant fund collection after an insurance order completes. The Guard requires the submitted Order to be at the 'Complete' node (via convert_witness OrderProgress) AND to belong to this specific Service (project binding, preventing cross-service order theft). Bind it to a Service order_allocators entry.",
4
+ "tags": ["guard", "insurance", "withdraw", "allocation", "project-binding"],
5
+ "industry": "insurance",
6
+ "operation_type": "guard",
7
+ "source": "docs/examples/Insurance — schema-validated, not chain-verified",
8
+ "verified": false,
9
+ "network": "testnet",
10
+ "call": {
11
+ "tool": "onchain_operations",
12
+ "operation_type": "guard",
13
+ "data": {
14
+ "namedNew": {
15
+ "name": "insurance_withdraw_guard_treasury_v1",
16
+ "tags": ["insurance", "withdraw", "treasury"],
17
+ "replaceExistName": true
18
+ },
19
+ "description": "Allow fund allocation to Treasury after order is completed. RISK ELIMINATION: order must be at Complete node AND belong to insurance_service_v1 (prevents cross-service theft). Funds flow to fixed Treasury Entity (safe — no Signer binding needed).",
20
+ "table": [
21
+ {
22
+ "identifier": 0,
23
+ "b_submission": true,
24
+ "value_type": "Address",
25
+ "name": "order_id (Order object submitted at runtime)"
26
+ },
27
+ {
28
+ "identifier": 1,
29
+ "b_submission": false,
30
+ "value_type": "String",
31
+ "value": "Complete",
32
+ "name": "Expected Complete node name (case-sensitive)"
33
+ },
34
+ {
35
+ "identifier": 2,
36
+ "b_submission": false,
37
+ "value_type": "Address",
38
+ "value": "insurance_service_v1",
39
+ "name": "Expected service address (prevents cross-service fund theft)"
40
+ }
41
+ ],
42
+ "root": {
43
+ "type": "logic_and",
44
+ "nodes": [
45
+ {
46
+ "type": "logic_equal",
47
+ "nodes": [
48
+ {
49
+ "type": "query",
50
+ "query": "progress.current",
51
+ "object": {
52
+ "identifier": 0,
53
+ "convert_witness": "OrderProgress"
54
+ },
55
+ "parameters": []
56
+ },
57
+ {
58
+ "type": "identifier",
59
+ "identifier": 1
60
+ }
61
+ ]
62
+ },
63
+ {
64
+ "type": "logic_equal",
65
+ "nodes": [
66
+ {
67
+ "type": "query",
68
+ "query": "order.service",
69
+ "object": {
70
+ "identifier": 0
71
+ },
72
+ "parameters": []
73
+ },
74
+ {
75
+ "type": "identifier",
76
+ "identifier": 2
77
+ }
78
+ ]
79
+ }
80
+ ]
81
+ }
82
+ },
83
+ "env": {
84
+ "account": "insurance_provider_v1",
85
+ "network": "testnet"
86
+ }
87
+ },
88
+ "notes": [
89
+ "Withdraw-guard pattern the library previously lacked: logic_and of (1) workflow-state check — progress.current == 'Complete' via Order + convert_witness='OrderProgress' — and (2) project binding — order.service == insurance_service_v1 — so a completed Order from ANOTHER Service cannot be submitted to trigger this Service's allocation.",
90
+ "CIRCULAR-REFERENCE WORKFLOW (DOC-01): the Guard's static table stores the Service as a LocalMark NAME ('insurance_service_v1', identifier 2, value_type Address). The name must resolve at transaction build time, so create the Service FIRST (unpublished), then this Guard, then update the Service with order_allocators + publish. GuardTableItemBaseSchema explicitly allows a LocalMark name as an Address value (resolved at evaluation/build time).",
91
+ "Schema check (call/guard.ts + query/index.ts GuardNodeSchema): root 'logic_and' has exactly 2 children (min 2 enforced); both children are Bool-returning 'logic_equal' nodes; query nodes use parameter-less queries progress.current / order.service with optional parameters [].",
92
+ "Doc creates TWO such Guards (treasury + personal collection) with identical logic but different names/descriptions, because allocators require unique Guard addresses. Only the Treasury variant is extracted here; to use the personal-collection approach, duplicate with namedNew.name 'insurance_withdraw_guard_personal_v1' and adjust tags/description.",
93
+ "The node name comparison is CASE-SENSITIVE ('Complete' != 'complete') — the table value must exactly match the Machine node name.",
94
+ "Desensitization: doc payload already uses generic local-mark names only (insurance_provider_v1, insurance_service_v1, insurance_withdraw_guard_treasury_v1); no real personal data present, nothing replaced."
95
+ ]
96
+ }
@@ -0,0 +1,75 @@
1
+ {
2
+ "title": "Create and Publish Insurance Claim Machine (Start -> Complete)",
3
+ "description": "Create a two-node insurance claim workflow Machine and publish it in a single transaction: entry forward 'start_claim' into Start (permissionIndex 1000), and 'complete_claim' from Start into Complete (permissionIndex 1001) gated by the time-lock Guard insurance_complete_guard_v1.",
4
+ "tags": ["machine", "insurance", "claim", "workflow", "publish"],
5
+ "industry": "insurance",
6
+ "operation_type": "machine",
7
+ "source": "docs/examples/Insurance — schema-validated, not chain-verified",
8
+ "verified": false,
9
+ "network": "testnet",
10
+ "call": {
11
+ "tool": "onchain_operations",
12
+ "operation_type": "machine",
13
+ "data": {
14
+ "object": {
15
+ "name": "insurance_machine_v1",
16
+ "permission": "insurance_permission_v1",
17
+ "replaceExistName": true
18
+ },
19
+ "description": "Insurance claim processing workflow: Start -> Complete (with time-lock guard)",
20
+ "node": {
21
+ "op": "add",
22
+ "nodes": [
23
+ {
24
+ "name": "Start",
25
+ "pairs": [
26
+ {
27
+ "prev_node": "",
28
+ "threshold": 0,
29
+ "forwards": [
30
+ {
31
+ "name": "start_claim",
32
+ "permissionIndex": 1000,
33
+ "weight": 1
34
+ }
35
+ ]
36
+ }
37
+ ]
38
+ },
39
+ {
40
+ "name": "Complete",
41
+ "pairs": [
42
+ {
43
+ "prev_node": "Start",
44
+ "threshold": 1,
45
+ "forwards": [
46
+ {
47
+ "name": "complete_claim",
48
+ "permissionIndex": 1001,
49
+ "weight": 1,
50
+ "guard": {
51
+ "guard": "insurance_complete_guard_v1"
52
+ }
53
+ }
54
+ ]
55
+ }
56
+ ]
57
+ }
58
+ ]
59
+ },
60
+ "publish": true
61
+ },
62
+ "env": {
63
+ "account": "insurance_provider_v1",
64
+ "network": "testnet"
65
+ }
66
+ },
67
+ "notes": [
68
+ "Insurance-claim Machine pattern: a minimal two-node Start -> Complete workflow where the completion forward is gated by a time-lock Guard. Demonstrates create-with-nodes + publish in ONE transaction (nodes become immutable after publish).",
69
+ "Schema check (call/machine.ts CallMachine_DataSchema): 'object' uses the OBJECT form of WithPermissionObjectSchema (NamedObjectWithPermissionSchema — name, permission, replaceExistName); node uses NodeSchema op='add' with nodes array; publish=true on NEW machine creation triggers the FIX-02 entry-forward refine — satisfied because the Start pair has prev_node='' with at least one forward (FIX-002 also requires the initial pair to have a non-empty forwards list).",
70
+ "Forward check (query/index.ts MachineForwardSchema): every forward provides permissionIndex (1000/1001) satisfying the one-of namedOperator/permissionIndex rule; the Complete forward uses the OBJECT guard form {guard: 'insurance_complete_guard_v1'} (MachineForwardGuardSchema; a plain string shorthand is also accepted via preprocess).",
71
+ "The referenced Guard (insurance_complete_guard_v1) and Permission (insurance_permission_v1, with indexes 1000/1001 granted to the operator) must exist before this call — see the sibling insurance-guard-claim-timelock example and the Insurance doc Steps 1/3.",
72
+ "PREREQUISITE for advancing claims: the Permission must grant index 1000 (start_claim) and 1001 (complete_claim) to the operating account, otherwise progress advancement aborts with MoveAbort code 7.",
73
+ "Desensitization: doc payload already uses generic local-mark names only (insurance_provider_v1, insurance_machine_v1, insurance_permission_v1); no real personal data present, nothing replaced."
74
+ ]
75
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "title": "Add Entity-Sharing Order Allocators and Publish Insurance Service",
3
+ "description": "Update the unpublished insurance Service with two alternative order_allocators (Treasury collection and personal collection, first-match-wins) whose sharing recipients are FIXED Entity addresses — the fund-theft-safe pattern — then publish the Service in the same transaction.",
4
+ "tags": ["service", "insurance", "order_allocators", "entity-sharing", "publish"],
5
+ "industry": "insurance",
6
+ "operation_type": "service",
7
+ "source": "docs/examples/Insurance — schema-validated, not chain-verified",
8
+ "verified": false,
9
+ "network": "testnet",
10
+ "call": {
11
+ "tool": "onchain_operations",
12
+ "operation_type": "service",
13
+ "data": {
14
+ "object": "insurance_service_v1",
15
+ "order_allocators": {
16
+ "description": "Insurance order revenue allocation — 2 alternative merchant collection approaches (first-match-wins means only the first passing allocator executes)",
17
+ "threshold": 0,
18
+ "allocators": [
19
+ {
20
+ "guard": "insurance_withdraw_guard_treasury_v1",
21
+ "sharing": [
22
+ {
23
+ "who": { "Entity": { "name_or_address": "insurance_treasury_v1" } },
24
+ "sharing": 10000,
25
+ "mode": "Rate"
26
+ }
27
+ ]
28
+ },
29
+ {
30
+ "guard": "insurance_withdraw_guard_personal_v1",
31
+ "sharing": [
32
+ {
33
+ "who": { "Entity": { "name_or_address": "insurance_provider_v1" } },
34
+ "sharing": 10000,
35
+ "mode": "Rate"
36
+ }
37
+ ]
38
+ }
39
+ ]
40
+ },
41
+ "publish": true
42
+ },
43
+ "env": {
44
+ "account": "insurance_provider_v1",
45
+ "network": "testnet"
46
+ }
47
+ },
48
+ "notes": [
49
+ "Fund-safety pattern the library previously lacked: who = {Entity: {name_or_address: ...}} pins the recipient to a FIXED address (Treasury object or provider account) resolved via LocalMark at build time. Even if the withdraw Guard were bypassed or a forged Order submitted, funds still flow to the fixed Entity — the caller cannot redirect them. NEVER use {Signer: 'signer'} for merchant collection (funds would go to whoever triggers allocation).",
50
+ "first-match-wins: the TWO allocators illustrate the 2 alternative collection designs (Treasury vs personal); only the FIRST allocator whose Guard passes executes. In production pick ONE and delete the other. Each allocator's Guard must be a UNIQUE Guard object — hence two Guards with identical logic in the doc (see sibling insurance-guard-withdraw-allocation example).",
51
+ "Schema check (call/service.ts CallService_DataSchema + query/index.ts AllocatorsSchema/AllocatorSchema/AllocationSharingSchema/RecipientSchema): object is the STRING form (existing service); order_allocators = {description, threshold, allocators[]} with per-allocator {guard: NameOrAddress, sharing: [{who: {Entity: {name_or_address}}, sharing, mode}]}; mode 'Rate' with a single sharing of 10000 satisfies the Rate-sum == 10000 (basis points, 100%) rule with no Surplus item; threshold 0 allows any balance.",
52
+ "IMMUTABILITY (L1-locked): order_allocators can ONLY be set before publish=true (service.move E_ALREADY_PUBLISHED); after publish it is permanently frozen — this call sets allocators and publishes in one transaction, which is the standard finalize step.",
53
+ "PREREQUISITES: insurance_service_v1 created UNPUBLISHED with machine + sales (so its name resolves in the Guards' static tables); both withdraw Guards and insurance_treasury_v1 created; Machine published. This is Step 7 of the Insurance doc flow.",
54
+ "Desensitization: doc payload already uses generic local-mark names only (insurance_service_v1, insurance_treasury_v1, insurance_provider_v1, insurance_withdraw_guard_*_v1); no real personal data present, nothing replaced."
55
+ ]
56
+ }