@wowok/agent-mcp 2.6.1 → 2.6.4

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 (246) hide show
  1. package/dist/customer/customer-advice.d.ts +31 -0
  2. package/dist/customer/customer-advice.js +129 -0
  3. package/dist/customer/index.d.ts +2 -0
  4. package/dist/customer/index.js +2 -0
  5. package/dist/customer/info-puzzle.d.ts +9 -2
  6. package/dist/customer/info-puzzle.js +34 -7
  7. package/dist/customer/order-monitor.d.ts +2 -0
  8. package/dist/customer/order-monitor.js +3 -2
  9. package/dist/customer/post-purchase.d.ts +2 -0
  10. package/dist/customer/post-purchase.js +6 -5
  11. package/dist/customer/preorder-compare.d.ts +24 -0
  12. package/dist/customer/preorder-compare.js +34 -0
  13. package/dist/customer/reminder-system.d.ts +2 -0
  14. package/dist/customer/reminder-system.js +2 -1
  15. package/dist/customer/risk-assessment.js +30 -7
  16. package/dist/customer/types.d.ts +7 -0
  17. package/dist/examples/arbitration-dispute-create.json +41 -0
  18. package/dist/examples/arbitration-vote-weighted.json +35 -0
  19. package/dist/examples/arbitration-voting-guard-add.json +38 -0
  20. package/dist/examples/demand-present-service.json +33 -0
  21. package/dist/examples/gen-passport-verify-guard.json +48 -0
  22. package/dist/examples/guard-template-balance-check.json +59 -0
  23. package/dist/examples/guard-template-time-lock.json +60 -0
  24. package/dist/examples/insurance-guard-claim-timelock.json +75 -0
  25. package/dist/examples/insurance-guard-withdraw-allocation.json +96 -0
  26. package/dist/examples/insurance-machine-create-publish.json +75 -0
  27. package/dist/examples/insurance-service-allocators-publish.json +56 -0
  28. package/dist/examples/machine-multisig-threshold.json +86 -0
  29. package/dist/examples/machine-template-7node-rental.json +119 -0
  30. package/dist/examples/payment-scenario-bound.json +45 -0
  31. package/dist/examples/rental-ziroom-machine-create.json +149 -0
  32. package/dist/examples/rental-ziroom-permission-create.json +42 -0
  33. package/dist/examples/rental-ziroom-service-create.json +89 -0
  34. package/dist/examples/retail-adv-guard-customer-win-create.json +80 -0
  35. package/dist/examples/retail-adv-guard-messenger-proof-create.json +65 -0
  36. package/dist/examples/retail-adv-guard-reward-timeout-create.json +92 -0
  37. package/dist/examples/retail-adv-reward-guard-add.json +51 -0
  38. package/dist/examples/retail-myshop-allocation-activate.json +55 -0
  39. package/dist/examples/retail-myshop-arbitration-create.json +40 -0
  40. package/dist/examples/retail-myshop-contact-create.json +43 -0
  41. package/dist/examples/retail-myshop-order-create.json +56 -0
  42. package/dist/examples/retail-myshop-progress-operate.json +38 -0
  43. package/dist/examples/retail-myshop-reward-create.json +35 -0
  44. package/dist/examples/retail-myshop-service-create.json +88 -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 +216 -29
  61. package/dist/extensions/constraint-registry.js +21 -19
  62. package/dist/extensions/metric-registry.js +14 -14
  63. package/dist/extensions/mode-evaluator.js +16 -16
  64. package/dist/extensions/modes.js +141 -49
  65. package/dist/extensions/registry.d.ts +16 -9
  66. package/dist/extensions/registry.js +132 -44
  67. package/dist/extensions/types.d.ts +2 -0
  68. package/dist/index.js +50 -0
  69. package/dist/knowledge/deployment-scanner.js +1 -1
  70. package/dist/knowledge/fund-layer.d.ts +138 -0
  71. package/dist/knowledge/fund-layer.js +969 -0
  72. package/dist/knowledge/guard-render.d.ts +57 -0
  73. package/dist/knowledge/guard-render.js +700 -0
  74. package/dist/knowledge/guard-submission-prompt.d.ts +31 -0
  75. package/dist/knowledge/guard-submission-prompt.js +171 -0
  76. package/dist/knowledge/guard-templates.d.ts +10 -0
  77. package/dist/knowledge/guard-templates.js +50 -0
  78. package/dist/knowledge/index.d.ts +2 -2
  79. package/dist/knowledge/index.js +2 -2
  80. package/dist/knowledge/machine-ledger.js +1 -1
  81. package/dist/knowledge/machine-render.d.ts +41 -0
  82. package/dist/knowledge/machine-render.js +565 -0
  83. package/dist/knowledge/machine-risk.js +4 -1
  84. package/dist/knowledge/machine-templates.js +4 -4
  85. package/dist/knowledge/progress-context.js +1 -1
  86. package/dist/knowledge/progress-ledger.js +3 -3
  87. package/dist/knowledge/progress-templates.js +1 -1
  88. package/dist/knowledge/progress-translation.js +1 -1
  89. package/dist/knowledge/reward-confirm.js +2 -2
  90. package/dist/knowledge/reward-puzzle.js +1 -1
  91. package/dist/knowledge/reward-risk.js +9 -9
  92. package/dist/knowledge/reward-templates.js +2 -2
  93. package/dist/knowledge/safety-rules.d.ts +83 -1
  94. package/dist/knowledge/safety-rules.js +166 -2
  95. package/dist/knowledge/scenario-modes.d.ts +1 -1
  96. package/dist/knowledge/scenario-modes.js +13 -11
  97. package/dist/knowledge/service-confirm.d.ts +1 -1
  98. package/dist/knowledge/service-confirm.js +3 -3
  99. package/dist/knowledge/service-context.js +1 -1
  100. package/dist/knowledge/service-ledger.js +1 -1
  101. package/dist/knowledge/service-risk.d.ts +1 -1
  102. package/dist/knowledge/service-risk.js +3 -3
  103. package/dist/knowledge/service-templates.js +2 -2
  104. package/dist/knowledge/service-translation.d.ts +1 -1
  105. package/dist/knowledge/service-translation.js +7 -7
  106. package/dist/knowledge/template-registry.d.ts +48 -0
  107. package/dist/knowledge/template-registry.js +341 -0
  108. package/dist/knowledge/tool-constraints.js +6 -6
  109. package/dist/knowledge/tools-reference.js +11 -8
  110. package/dist/participation/merchant-interest.d.ts +32 -0
  111. package/dist/participation/merchant-interest.js +100 -0
  112. package/dist/participation/radar-core.d.ts +104 -0
  113. package/dist/participation/radar-core.js +269 -0
  114. package/dist/project/context-assembly.js +8 -0
  115. package/dist/project/deployment-bridge.js +6 -5
  116. package/dist/project/deployment-doc.js +5 -5
  117. package/dist/project/edit-planner.d.ts +123 -0
  118. package/dist/project/edit-planner.js +1342 -0
  119. package/dist/project/evaluation.d.ts +36 -0
  120. package/dist/project/evaluation.js +734 -68
  121. package/dist/project/game-theory.d.ts +43 -0
  122. package/dist/project/game-theory.js +177 -0
  123. package/dist/project/graph-builder.js +7 -1
  124. package/dist/project/handlers.d.ts +137 -2
  125. package/dist/project/handlers.js +423 -51
  126. package/dist/project/intent-analyzer.d.ts +71 -0
  127. package/dist/project/intent-analyzer.js +149 -0
  128. package/dist/project/machine-nodes.d.ts +2 -0
  129. package/dist/project/machine-nodes.js +36 -0
  130. package/dist/project/merchant-guide.d.ts +165 -0
  131. package/dist/project/merchant-guide.js +264 -0
  132. package/dist/project/mode-actions.d.ts +199 -0
  133. package/dist/project/mode-actions.js +309 -0
  134. package/dist/project/participation-radar.d.ts +18 -0
  135. package/dist/project/participation-radar.js +428 -0
  136. package/dist/project/pipeline-actions.d.ts +101 -0
  137. package/dist/project/pipeline-actions.js +109 -0
  138. package/dist/project/semantic-graph.d.ts +95 -0
  139. package/dist/project/semantic-graph.js +245 -0
  140. package/dist/project/stage-gate.js +4 -4
  141. package/dist/schema/call/allocation.d.ts +11 -11
  142. package/dist/schema/call/allocation.js +13 -3
  143. package/dist/schema/call/arbitration.d.ts +21 -21
  144. package/dist/schema/call/arbitration.js +30 -9
  145. package/dist/schema/call/base.d.ts +2 -2
  146. package/dist/schema/call/base.js +1 -1
  147. package/dist/schema/call/bridge.d.ts +127 -127
  148. package/dist/schema/call/bridge.js +12 -12
  149. package/dist/schema/call/contact.d.ts +3 -3
  150. package/dist/schema/call/contact.js +2 -2
  151. package/dist/schema/call/demand.d.ts +3 -3
  152. package/dist/schema/call/demand.js +2 -2
  153. package/dist/schema/call/guard.d.ts +11 -11
  154. package/dist/schema/call/guard.js +2 -2
  155. package/dist/schema/call/machine.d.ts +2072 -679
  156. package/dist/schema/call/machine.js +51 -5
  157. package/dist/schema/call/order.d.ts +7 -7
  158. package/dist/schema/call/order.js +3 -6
  159. package/dist/schema/call/payment.d.ts +3 -3
  160. package/dist/schema/call/permission.d.ts +3 -3
  161. package/dist/schema/call/permission.js +2 -2
  162. package/dist/schema/call/personal.d.ts +337 -3
  163. package/dist/schema/call/personal.js +10 -0
  164. package/dist/schema/call/progress.d.ts +177 -9
  165. package/dist/schema/call/progress.js +7 -3
  166. package/dist/schema/call/proof.d.ts +6 -6
  167. package/dist/schema/call/repository.d.ts +3 -3
  168. package/dist/schema/call/repository.js +2 -2
  169. package/dist/schema/call/reward.d.ts +57 -57
  170. package/dist/schema/call/reward.js +3 -3
  171. package/dist/schema/call/semantic.js +48 -2
  172. package/dist/schema/call/service.d.ts +285 -113
  173. package/dist/schema/call/service.js +92 -28
  174. package/dist/schema/call/treasury.d.ts +57 -57
  175. package/dist/schema/call/treasury.js +3 -3
  176. package/dist/schema/common/index.d.ts +2 -0
  177. package/dist/schema/common/index.js +46 -10
  178. package/dist/schema/local/index.js +5 -1
  179. package/dist/schema/messenger/index.js +4 -1
  180. package/dist/schema/operations.d.ts +1318 -317
  181. package/dist/schema/operations.js +76 -7
  182. package/dist/schema/project/index.d.ts +5662 -164
  183. package/dist/schema/project/index.js +1136 -5
  184. package/dist/schema/query/index.d.ts +580 -19
  185. package/dist/schema/query/index.js +88 -36
  186. package/dist/schema/schema-query/index.d.ts +59 -3
  187. package/dist/schema/schema-query/index.js +45 -6
  188. package/dist/schema/trust/index.d.ts +1012 -6
  189. package/dist/schema/trust/index.js +212 -11
  190. package/dist/schema/utils/node-parser.js +13 -0
  191. package/dist/schema/utils/object-type-utils.d.ts +12 -0
  192. package/dist/schema/utils/object-type-utils.js +35 -0
  193. package/dist/schema/utils/permission-machine-check.d.ts +49 -0
  194. package/dist/schema/utils/permission-machine-check.js +121 -0
  195. package/dist/schema/utils/skills-recommendation.d.ts +2 -0
  196. package/dist/schema/utils/skills-recommendation.js +77 -0
  197. package/dist/schema-query/index.d.ts +17 -1
  198. package/dist/schema-query/index.js +359 -3
  199. package/dist/schemas/account_operation.schema.json +1 -1
  200. package/dist/schemas/bridge_operation.schema.json +14 -7
  201. package/dist/schemas/guard2file.schema.json +2 -0
  202. package/dist/schemas/index.json +1 -1
  203. package/dist/schemas/machineNode2file.schema.json +2 -0
  204. package/dist/schemas/messenger_operation.schema.json +1 -1
  205. package/dist/schemas/onchain_events.output.json +1 -1
  206. package/dist/schemas/onchain_operations.output.json +2820 -0
  207. package/dist/schemas/onchain_operations.schema.json +255 -65
  208. package/dist/schemas/onchain_operations_allocation.schema.json +7 -6
  209. package/dist/schemas/onchain_operations_arbitration.schema.json +14 -10
  210. package/dist/schemas/onchain_operations_contact.schema.json +4 -3
  211. package/dist/schemas/onchain_operations_demand.schema.json +4 -3
  212. package/dist/schemas/onchain_operations_gen_passport.schema.json +4 -2
  213. package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -0
  214. package/dist/schemas/onchain_operations_guard.schema.json +579 -1
  215. package/dist/schemas/onchain_operations_machine.schema.json +5 -4
  216. package/dist/schemas/onchain_operations_order.schema.json +7 -6
  217. package/dist/schemas/onchain_operations_payment.schema.json +2 -1
  218. package/dist/schemas/onchain_operations_permission.schema.json +3 -2
  219. package/dist/schemas/onchain_operations_personal.schema.json +37 -0
  220. package/dist/schemas/onchain_operations_progress.schema.json +91 -4
  221. package/dist/schemas/onchain_operations_proof.schema.json +2 -1
  222. package/dist/schemas/onchain_operations_repository.schema.json +4 -3
  223. package/dist/schemas/onchain_operations_reward.schema.json +7 -6
  224. package/dist/schemas/onchain_operations_service.schema.json +80 -19
  225. package/dist/schemas/onchain_operations_treasury.schema.json +5 -4
  226. package/dist/schemas/onchain_table_data.output.json +1 -1
  227. package/dist/schemas/onchain_table_data.schema.json +10 -9
  228. package/dist/schemas/project_operation.output.json +3318 -57
  229. package/dist/schemas/project_operation.schema.json +728 -4
  230. package/dist/schemas/query_toolkit.output.json +16 -16
  231. package/dist/schemas/query_toolkit.schema.json +40 -3
  232. package/dist/schemas/schema_query.output.json +65 -2
  233. package/dist/schemas/schema_query.schema.json +31 -5
  234. package/dist/schemas/trust_score.output.json +392 -1
  235. package/dist/schemas/trust_score.schema.json +275 -1
  236. package/dist/schemas/wowok_buildin_info.output.json +81 -8
  237. package/dist/schemas/wowok_buildin_info.schema.json +46 -2
  238. package/dist/tools/handlers/onchain.js +636 -6
  239. package/dist/tools/handlers/project.js +71 -2
  240. package/dist/tools/handlers/query.js +117 -2
  241. package/dist/tools/handlers/schema-query.js +65 -1
  242. package/dist/tools/handlers/trust.js +192 -6
  243. package/dist/tools/index.d.ts +8 -0
  244. package/dist/tools/index.js +229 -15
  245. package/dist/tools/wrap.js +194 -15
  246. package/package.json +2 -2
@@ -310,6 +310,15 @@ export declare const CallReward_DataSchema: z.ZodObject<{
310
310
  } | {
311
311
  coin: string;
312
312
  } | undefined;
313
+ receive?: {
314
+ received: {
315
+ id: string;
316
+ balance: string | number;
317
+ payment: string;
318
+ }[];
319
+ balance: string | number;
320
+ token_type: string;
321
+ } | "recently" | undefined;
313
322
  claim?: string | undefined;
314
323
  um?: string | null | undefined;
315
324
  owner_receive?: {
@@ -325,15 +334,6 @@ export declare const CallReward_DataSchema: z.ZodObject<{
325
334
  id: string;
326
335
  content_raw?: any;
327
336
  }[] | undefined;
328
- receive?: {
329
- received: {
330
- id: string;
331
- balance: string | number;
332
- payment: string;
333
- }[];
334
- balance: string | number;
335
- token_type: string;
336
- } | "recently" | undefined;
337
337
  guard_add?: {
338
338
  amount: {
339
339
  value: number;
@@ -379,6 +379,15 @@ export declare const CallReward_DataSchema: z.ZodObject<{
379
379
  } | {
380
380
  coin: string;
381
381
  } | undefined;
382
+ receive?: {
383
+ received: {
384
+ id: string;
385
+ balance: string | number;
386
+ payment: string;
387
+ }[];
388
+ balance: string | number;
389
+ token_type: string;
390
+ } | "recently" | undefined;
382
391
  claim?: string | undefined;
383
392
  um?: string | null | undefined;
384
393
  owner_receive?: {
@@ -394,15 +403,6 @@ export declare const CallReward_DataSchema: z.ZodObject<{
394
403
  id: string;
395
404
  content_raw?: any;
396
405
  }[] | undefined;
397
- receive?: {
398
- received: {
399
- id: string;
400
- balance: string | number;
401
- payment: string;
402
- }[];
403
- balance: string | number;
404
- token_type: string;
405
- } | "recently" | undefined;
406
406
  guard_add?: {
407
407
  amount: {
408
408
  value: number;
@@ -702,6 +702,15 @@ export declare const CallReward_InputSchema: z.ZodObject<{
702
702
  } | {
703
703
  coin: string;
704
704
  } | undefined;
705
+ receive?: {
706
+ received: {
707
+ id: string;
708
+ balance: string | number;
709
+ payment: string;
710
+ }[];
711
+ balance: string | number;
712
+ token_type: string;
713
+ } | "recently" | undefined;
705
714
  claim?: string | undefined;
706
715
  um?: string | null | undefined;
707
716
  owner_receive?: {
@@ -717,15 +726,6 @@ export declare const CallReward_InputSchema: z.ZodObject<{
717
726
  id: string;
718
727
  content_raw?: any;
719
728
  }[] | undefined;
720
- receive?: {
721
- received: {
722
- id: string;
723
- balance: string | number;
724
- payment: string;
725
- }[];
726
- balance: string | number;
727
- token_type: string;
728
- } | "recently" | undefined;
729
729
  guard_add?: {
730
730
  amount: {
731
731
  value: number;
@@ -771,6 +771,15 @@ export declare const CallReward_InputSchema: z.ZodObject<{
771
771
  } | {
772
772
  coin: string;
773
773
  } | undefined;
774
+ receive?: {
775
+ received: {
776
+ id: string;
777
+ balance: string | number;
778
+ payment: string;
779
+ }[];
780
+ balance: string | number;
781
+ token_type: string;
782
+ } | "recently" | undefined;
774
783
  claim?: string | undefined;
775
784
  um?: string | null | undefined;
776
785
  owner_receive?: {
@@ -786,15 +795,6 @@ export declare const CallReward_InputSchema: z.ZodObject<{
786
795
  id: string;
787
796
  content_raw?: any;
788
797
  }[] | undefined;
789
- receive?: {
790
- received: {
791
- id: string;
792
- balance: string | number;
793
- payment: string;
794
- }[];
795
- balance: string | number;
796
- token_type: string;
797
- } | "recently" | undefined;
798
798
  guard_add?: {
799
799
  amount: {
800
800
  value: number;
@@ -830,10 +830,11 @@ export declare const CallReward_InputSchema: z.ZodObject<{
830
830
  user_intent_phrases: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
831
831
  project: z.ZodOptional<z.ZodString>;
832
832
  client_schema_version: z.ZodOptional<z.ZodString>;
833
- schema_strict_mode: z.ZodOptional<z.ZodBoolean>;
833
+ schema_strict_mode: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
834
834
  dry_run: z.ZodOptional<z.ZodBoolean>;
835
835
  }, "strict", z.ZodTypeAny, {
836
836
  account: string;
837
+ schema_strict_mode: boolean;
837
838
  no_cache?: boolean | undefined;
838
839
  network?: import("@wowok/wowok").ENTRYPOINT | undefined;
839
840
  permission_guard?: string[] | undefined;
@@ -842,7 +843,6 @@ export declare const CallReward_InputSchema: z.ZodObject<{
842
843
  user_intent_phrases?: string[] | undefined;
843
844
  project?: string | undefined;
844
845
  client_schema_version?: string | undefined;
845
- schema_strict_mode?: boolean | undefined;
846
846
  dry_run?: boolean | undefined;
847
847
  }, {
848
848
  no_cache?: boolean | undefined;
@@ -1059,6 +1059,15 @@ export declare const CallReward_InputSchema: z.ZodObject<{
1059
1059
  } | {
1060
1060
  coin: string;
1061
1061
  } | undefined;
1062
+ receive?: {
1063
+ received: {
1064
+ id: string;
1065
+ balance: string | number;
1066
+ payment: string;
1067
+ }[];
1068
+ balance: string | number;
1069
+ token_type: string;
1070
+ } | "recently" | undefined;
1062
1071
  claim?: string | undefined;
1063
1072
  um?: string | null | undefined;
1064
1073
  owner_receive?: {
@@ -1074,15 +1083,6 @@ export declare const CallReward_InputSchema: z.ZodObject<{
1074
1083
  id: string;
1075
1084
  content_raw?: any;
1076
1085
  }[] | undefined;
1077
- receive?: {
1078
- received: {
1079
- id: string;
1080
- balance: string | number;
1081
- payment: string;
1082
- }[];
1083
- balance: string | number;
1084
- token_type: string;
1085
- } | "recently" | undefined;
1086
1086
  guard_add?: {
1087
1087
  amount: {
1088
1088
  value: number;
@@ -1137,6 +1137,7 @@ export declare const CallReward_InputSchema: z.ZodObject<{
1137
1137
  } | undefined;
1138
1138
  env?: {
1139
1139
  account: string;
1140
+ schema_strict_mode: boolean;
1140
1141
  no_cache?: boolean | undefined;
1141
1142
  network?: import("@wowok/wowok").ENTRYPOINT | undefined;
1142
1143
  permission_guard?: string[] | undefined;
@@ -1145,7 +1146,6 @@ export declare const CallReward_InputSchema: z.ZodObject<{
1145
1146
  user_intent_phrases?: string[] | undefined;
1146
1147
  project?: string | undefined;
1147
1148
  client_schema_version?: string | undefined;
1148
- schema_strict_mode?: boolean | undefined;
1149
1149
  dry_run?: boolean | undefined;
1150
1150
  } | undefined;
1151
1151
  }, {
@@ -1170,6 +1170,15 @@ export declare const CallReward_InputSchema: z.ZodObject<{
1170
1170
  } | {
1171
1171
  coin: string;
1172
1172
  } | undefined;
1173
+ receive?: {
1174
+ received: {
1175
+ id: string;
1176
+ balance: string | number;
1177
+ payment: string;
1178
+ }[];
1179
+ balance: string | number;
1180
+ token_type: string;
1181
+ } | "recently" | undefined;
1173
1182
  claim?: string | undefined;
1174
1183
  um?: string | null | undefined;
1175
1184
  owner_receive?: {
@@ -1185,15 +1194,6 @@ export declare const CallReward_InputSchema: z.ZodObject<{
1185
1194
  id: string;
1186
1195
  content_raw?: any;
1187
1196
  }[] | undefined;
1188
- receive?: {
1189
- received: {
1190
- id: string;
1191
- balance: string | number;
1192
- payment: string;
1193
- }[];
1194
- balance: string | number;
1195
- token_type: string;
1196
- } | "recently" | undefined;
1197
1197
  guard_add?: {
1198
1198
  amount: {
1199
1199
  value: number;
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { TypedPermissionObjectSchema, CoinParamSchema, CallEnvSchema, SubmissionCallSchema, } from "./base.js";
3
3
  import { RewardGuardSchema } from "../query/index.js";
4
- import { BalanceTypeSchema, ReceivedObjectsOrRecentlySchema, ReceivedBalanceOrRecentlySchema, NameOrAddressSchema, DescriptionSchema } from "../common/index.js";
4
+ import { BalanceTypeSchema, ReceivedObjectsOrRecentlySchema, ReceivedBalanceOrRecentlySchema, NameOrAddressSchema, DescriptionSchema, RECEIVE_FORMAT_BLOCK_OBJECTS, RECEIVE_FORMAT_BLOCK_BALANCE } from "../common/index.js";
5
5
  export const RewardRecordSchema = z.object({
6
6
  amount: BalanceTypeSchema,
7
7
  time: z.number().int(),
@@ -16,11 +16,11 @@ export const CallReward_DataSchema = z.object({
16
16
  claim: NameOrAddressSchema.optional().describe("Guard object ID. Used to verify Guard and start the reward distribution process corresponding to this Guard."),
17
17
  description: DescriptionSchema.optional(),
18
18
  coin_add: CoinParamSchema.optional().describe("Add amount to Reward object."),
19
- receive: ReceivedBalanceOrRecentlySchema.optional().describe("Unwrap CoinWrapper objects received by Reward object and store them in pending balance."),
19
+ receive: ReceivedBalanceOrRecentlySchema.optional().describe("Unwrap CoinWrapper objects received by Reward object and store them in pending balance." + RECEIVE_FORMAT_BLOCK_BALANCE),
20
20
  guard_add: z.array(RewardGuardSchema).optional().describe("Add Guard to Reward object."),
21
21
  guard_remove_expired: z.boolean().optional().describe("Whether to remove expired Guard."),
22
22
  guard_expiration_time: z.union([z.number().int().min(1), z.null()]).optional().describe("Add expiration time(ms). Before this time expires, new Guard and fund allocation rules cannot be added."),
23
- owner_receive: ReceivedObjectsOrRecentlySchema.optional().describe("Unwrap CoinWrapper objects and other objects received by this object and send them to the owner of its Permission object."),
23
+ owner_receive: ReceivedObjectsOrRecentlySchema.optional().describe("Unwrap CoinWrapper objects and other objects received by this Reward object and send them to the owner of its Permission object." + RECEIVE_FORMAT_BLOCK_OBJECTS),
24
24
  um: z.union([NameOrAddressSchema, z.null()]).optional().describe("Contact object ID or name."),
25
25
  }).strict().describe("On-chain Reward operations. USAGE: (1) CREATE NEW: Set 'object' field with OBJECT format {name, type_parameter, permission, ...} to create a Reward. NOTE: 'name' goes INSIDE 'object', NOT at the data root level.'permission' can be a new Permission object or reference an existing one - check 'object' field description for details. (2) OPERATE EXISTING: Set 'object' field with STRING format (object ID or name). The 'object' field is CRITICAL and REQUIRED in both cases. STRING for existing, OBJECT for new creation.");
26
26
  export const CallReward_InputSchema = z.object({
@@ -9,6 +9,7 @@ import { GUARDQUERY } from "@wowok/wowok";
9
9
  import { assessGuardRisksForOperation, getRiskSummary } from "../../knowledge/guard-risk.js";
10
10
  import { derivePuzzleFromCallData, getPuzzleStatusBooleans, getPendingQuestions, generateConfirmationText, } from "../../knowledge/guard-puzzle.js";
11
11
  import { inferSceneFromAction } from "../../knowledge/guard-ledger.js";
12
+ import { extractGenericTokenType, registryDisplayHint, } from "../../knowledge/fund-layer.js";
12
13
  import { matchSemanticPattern } from "../../knowledge/guard-translation.js";
13
14
  function booleanFromSignals(positive, negative) {
14
15
  if (positive)
@@ -17,6 +18,30 @@ function booleanFromSignals(positive, negative) {
17
18
  return false;
18
19
  return undefined;
19
20
  }
21
+ function deriveAdviceRole(operationType, data) {
22
+ switch (operationType) {
23
+ case "order":
24
+ case "personal":
25
+ case "demand":
26
+ return "user";
27
+ case "service":
28
+ case "machine":
29
+ case "permission":
30
+ case "reward":
31
+ case "repository":
32
+ case "allocator":
33
+ case "treasury":
34
+ return "merchant";
35
+ case "arbitration":
36
+ if (data?.vote !== undefined)
37
+ return "arbitrator";
38
+ if (data?.dispute !== undefined)
39
+ return "user";
40
+ return undefined;
41
+ default:
42
+ return undefined;
43
+ }
44
+ }
20
45
  const ERROR_RULES = [
21
46
  {
22
47
  patterns: [
@@ -453,7 +478,8 @@ const INTENT_RULES = [
453
478
  { operation_type: "progress", intent: "update_progress", confidence: 0.9 },
454
479
  { operation_type: "order", signals: (d) => !!d?.arb, intent: "apply_arbitration", confidence: 0.9 },
455
480
  { operation_type: "order", intent: "manage_order", confidence: 0.85 },
456
- { operation_type: "payment", intent: "send_payment", confidence: 0.95 },
481
+ { operation_type: "payment", signals: (d) => d?.receive === true, intent: "claim_escrow_payment", confidence: 0.95 },
482
+ { operation_type: "payment", intent: "send_payment", confidence: 0.9 },
457
483
  { operation_type: "reward", intent: "manage_reward", confidence: 0.9 },
458
484
  { operation_type: "demand", intent: "post_demand", confidence: 0.9 },
459
485
  { operation_type: "treasury", intent: "manage_treasury", confidence: 0.9 },
@@ -599,6 +625,11 @@ const FUND_ROLE_RULES = [
599
625
  role: "release",
600
626
  confidence: 0.9,
601
627
  },
628
+ {
629
+ when: (ctx) => ctx.operation_type === "payment" && ctx.data?.receive === true,
630
+ role: "release",
631
+ confidence: 0.95,
632
+ },
602
633
  {
603
634
  when: (ctx) => ctx.operation_type === "payment" && isNegative(ctx.amount),
604
635
  role: "payment",
@@ -1111,11 +1142,26 @@ function buildCustomerAdvice(operation_type, data, safeResult) {
1111
1142
  const profile = getProfile();
1112
1143
  const userMinTrust = profile.risk_appetite === "conservative" ? 70
1113
1144
  : profile.risk_appetite === "aggressive" ? 30 : 50;
1145
+ let tokenHint;
1146
+ const moneyDisplay = safeResult?._money_display ??
1147
+ (Array.isArray(safeResult?.objects) ? safeResult.objects[0]?._money_display : undefined);
1148
+ const mdEntry = moneyDisplay ? Object.values(moneyDisplay)[0] : undefined;
1149
+ if (mdEntry?.precision_known === true) {
1150
+ tokenHint = { decimals: mdEntry.decimals, symbol: mdEntry.symbol };
1151
+ }
1152
+ else {
1153
+ const typeRaw = safeResult?.type_raw ??
1154
+ (Array.isArray(safeResult?.objects) ? safeResult.objects[0]?.type_raw : undefined);
1155
+ tokenHint =
1156
+ registryDisplayHint(extractGenericTokenType(typeRaw)) ??
1157
+ registryDisplayHint(typeof data?.type_parameter === "string" ? data.type_parameter : undefined);
1158
+ }
1114
1159
  const ctx = {
1115
1160
  stage,
1116
1161
  service_id: serviceId,
1117
1162
  order_id: orderId,
1118
1163
  service_price: servicePrice,
1164
+ token: tokenHint,
1119
1165
  has_arbitration: hasArbitration,
1120
1166
  has_compensation: hasCompensation,
1121
1167
  has_refund_path: hasRefundPath,
@@ -1457,7 +1503,7 @@ export function buildSemantic(safeResult, context) {
1457
1503
  recordIndustrySignal(industryHint, { type: context.operation_type, data: context.data }, outcome);
1458
1504
  }
1459
1505
  if (industryHint) {
1460
- const evoCtx = injectEvolutionContext(undefined, industryHint);
1506
+ const evoCtx = injectEvolutionContext(undefined, industryHint, deriveAdviceRole(context.operation_type, context.data));
1461
1507
  if (evoCtx && (evoCtx.industry_signal || evoCtx.evolution_advice || evoCtx.confidence > 0)) {
1462
1508
  evolution_context = evoCtx;
1463
1509
  }