@wowok/agent-mcp 2.6.0 → 2.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/README.md +5 -3
  2. package/dist/customer/info-puzzle.d.ts +1 -1
  3. package/dist/customer/info-puzzle.js +4 -2
  4. package/dist/customer/risk-assessment.js +26 -4
  5. package/dist/customer/types.d.ts +2 -0
  6. package/dist/examples/guard-template-balance-check.json +38 -0
  7. package/dist/examples/guard-template-time-lock.json +39 -0
  8. package/dist/examples/machine-template-7node-rental.json +114 -0
  9. package/dist/examples/rental-ziroom-machine-create.json +137 -0
  10. package/dist/examples/rental-ziroom-permission-create.json +35 -0
  11. package/dist/examples/rental-ziroom-service-create.json +80 -0
  12. package/dist/examples/retail-myshop-service-create.json +88 -0
  13. package/dist/extensions/capability-manifest.d.ts +125 -0
  14. package/dist/extensions/capability-manifest.js +594 -0
  15. package/dist/extensions/constraint-registry.d.ts +24 -0
  16. package/dist/extensions/constraint-registry.js +196 -0
  17. package/dist/extensions/index.d.ts +12 -0
  18. package/dist/extensions/index.js +6 -0
  19. package/dist/extensions/metric-registry.d.ts +26 -0
  20. package/dist/extensions/metric-registry.js +257 -0
  21. package/dist/extensions/mode-evaluator.d.ts +15 -0
  22. package/dist/extensions/mode-evaluator.js +170 -0
  23. package/dist/extensions/modes.d.ts +2 -0
  24. package/dist/extensions/modes.js +493 -0
  25. package/dist/extensions/registry.d.ts +50 -0
  26. package/dist/extensions/registry.js +662 -0
  27. package/dist/extensions/types.d.ts +219 -0
  28. package/dist/extensions/types.js +1 -0
  29. package/dist/index.js +50 -0
  30. package/dist/knowledge/deployment-scanner.d.ts +3 -0
  31. package/dist/knowledge/deployment-scanner.js +64 -3
  32. package/dist/knowledge/fund-layer.d.ts +72 -0
  33. package/dist/knowledge/fund-layer.js +420 -0
  34. package/dist/knowledge/guard-render.d.ts +57 -0
  35. package/dist/knowledge/guard-render.js +700 -0
  36. package/dist/knowledge/guard-risk.d.ts +13 -0
  37. package/dist/knowledge/guard-risk.js +57 -0
  38. package/dist/knowledge/guard-submission-prompt.d.ts +31 -0
  39. package/dist/knowledge/guard-submission-prompt.js +171 -0
  40. package/dist/knowledge/guard-templates.js +278 -0
  41. package/dist/knowledge/machine-ledger.js +1 -1
  42. package/dist/knowledge/machine-render.d.ts +41 -0
  43. package/dist/knowledge/machine-render.js +565 -0
  44. package/dist/knowledge/machine-templates.js +24 -5
  45. package/dist/knowledge/reward-confirm.js +2 -2
  46. package/dist/knowledge/reward-puzzle.js +1 -1
  47. package/dist/knowledge/reward-risk.js +9 -9
  48. package/dist/knowledge/reward-templates.js +2 -2
  49. package/dist/knowledge/service-confirm.d.ts +15 -6
  50. package/dist/knowledge/service-confirm.js +119 -11
  51. package/dist/knowledge/service-context.js +1 -1
  52. package/dist/knowledge/service-ledger.js +1 -1
  53. package/dist/knowledge/service-risk.d.ts +1 -1
  54. package/dist/knowledge/service-risk.js +3 -3
  55. package/dist/knowledge/service-templates.js +2 -2
  56. package/dist/knowledge/service-translation.d.ts +1 -1
  57. package/dist/knowledge/service-translation.js +7 -7
  58. package/dist/knowledge/tool-constraints.js +6 -2
  59. package/dist/project/deployment-bridge.d.ts +1 -1
  60. package/dist/project/deployment-bridge.js +31 -7
  61. package/dist/project/deployment-doc.d.ts +3 -0
  62. package/dist/project/deployment-doc.js +76 -14
  63. package/dist/project/edit-planner.d.ts +123 -0
  64. package/dist/project/edit-planner.js +1371 -0
  65. package/dist/project/evaluation.d.ts +2 -0
  66. package/dist/project/evaluation.js +873 -88
  67. package/dist/project/graph-builder.d.ts +4 -1
  68. package/dist/project/graph-builder.js +132 -62
  69. package/dist/project/graph.d.ts +1 -0
  70. package/dist/project/handlers.d.ts +317 -6
  71. package/dist/project/handlers.js +1171 -19
  72. package/dist/project/stage-gate.d.ts +4 -0
  73. package/dist/project/stage-gate.js +64 -5
  74. package/dist/project/task-tracker.d.ts +26 -0
  75. package/dist/project/task-tracker.js +78 -0
  76. package/dist/safety/preview.js +16 -0
  77. package/dist/schema/call/allocation.d.ts +16 -16
  78. package/dist/schema/call/allocation.js +2 -2
  79. package/dist/schema/call/arbitration.js +19 -6
  80. package/dist/schema/call/base.d.ts +21 -13
  81. package/dist/schema/call/base.js +27 -6
  82. package/dist/schema/call/bridge.d.ts +5 -5
  83. package/dist/schema/call/bridge.js +3 -1
  84. package/dist/schema/call/contact.js +2 -2
  85. package/dist/schema/call/demand.d.ts +23 -31
  86. package/dist/schema/call/demand.js +2 -2
  87. package/dist/schema/call/guard.js +2 -2
  88. package/dist/schema/call/machine.d.ts +1976 -752
  89. package/dist/schema/call/machine.js +50 -4
  90. package/dist/schema/call/order.d.ts +149 -228
  91. package/dist/schema/call/order.js +4 -3
  92. package/dist/schema/call/payment.d.ts +183 -3
  93. package/dist/schema/call/payment.js +21 -3
  94. package/dist/schema/call/permission.js +2 -2
  95. package/dist/schema/call/personal.d.ts +241 -52
  96. package/dist/schema/call/progress.d.ts +53 -61
  97. package/dist/schema/call/progress.js +18 -4
  98. package/dist/schema/call/repository.d.ts +23 -31
  99. package/dist/schema/call/repository.js +2 -2
  100. package/dist/schema/call/reward.js +3 -3
  101. package/dist/schema/call/semantic.d.ts +1 -1
  102. package/dist/schema/call/semantic.js +37 -2
  103. package/dist/schema/call/service.d.ts +275 -127
  104. package/dist/schema/call/service.js +89 -13
  105. package/dist/schema/call/treasury.js +3 -3
  106. package/dist/schema/common/index.d.ts +13 -2
  107. package/dist/schema/common/index.js +80 -15
  108. package/dist/schema/local/index.d.ts +32 -35
  109. package/dist/schema/local/index.js +28 -6
  110. package/dist/schema/messenger/index.d.ts +274 -46
  111. package/dist/schema/operations.d.ts +1264 -544
  112. package/dist/schema/operations.js +65 -7
  113. package/dist/schema/project/index.d.ts +2846 -167
  114. package/dist/schema/project/index.js +570 -16
  115. package/dist/schema/query/index.d.ts +922 -349
  116. package/dist/schema/query/index.js +205 -42
  117. package/dist/schema/schema-query/index.d.ts +65 -3
  118. package/dist/schema/schema-query/index.js +38 -5
  119. package/dist/schema/utils/node-parser.js +20 -4
  120. package/dist/schema/utils/object-type-utils.d.ts +12 -0
  121. package/dist/schema/utils/object-type-utils.js +35 -0
  122. package/dist/schema/utils/permission-machine-check.d.ts +49 -0
  123. package/dist/schema/utils/permission-machine-check.js +121 -0
  124. package/dist/schema/utils/skills-recommendation.d.ts +2 -0
  125. package/dist/schema/utils/skills-recommendation.js +76 -0
  126. package/dist/schema-query/index.d.ts +20 -1
  127. package/dist/schema-query/index.js +306 -4
  128. package/dist/schemas/account_operation.output.json +7 -1
  129. package/dist/schemas/account_operation.schema.json +3 -3
  130. package/dist/schemas/bridge_operation.output.json +6 -0
  131. package/dist/schemas/bridge_operation.schema.json +1 -1
  132. package/dist/schemas/guard-templates.json +379 -0
  133. package/dist/schemas/guard2file.schema.json +1 -1
  134. package/dist/schemas/index.json +1 -1
  135. package/dist/schemas/local_info_operation.output.json +6 -0
  136. package/dist/schemas/local_mark_operation.output.json +7 -1
  137. package/dist/schemas/local_mark_operation.schema.json +1 -1
  138. package/dist/schemas/machineNode2file.schema.json +1 -1
  139. package/dist/schemas/messenger_operation.schema.json +4 -4
  140. package/dist/schemas/onchain_events.output.json +1 -1
  141. package/dist/schemas/onchain_operations.output.json +2820 -0
  142. package/dist/schemas/onchain_operations.schema.json +444 -330
  143. package/dist/schemas/onchain_operations_allocation.schema.json +37 -28
  144. package/dist/schemas/onchain_operations_arbitration.schema.json +16 -14
  145. package/dist/schemas/onchain_operations_contact.schema.json +10 -10
  146. package/dist/schemas/onchain_operations_demand.schema.json +10 -10
  147. package/dist/schemas/onchain_operations_gen_passport.schema.json +16 -16
  148. package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -2
  149. package/dist/schemas/onchain_operations_guard.schema.json +2 -2
  150. package/dist/schemas/onchain_operations_machine.schema.json +43 -35
  151. package/dist/schemas/onchain_operations_order.schema.json +72 -78
  152. package/dist/schemas/onchain_operations_payment.schema.json +141 -111
  153. package/dist/schemas/onchain_operations_permission.schema.json +3 -3
  154. package/dist/schemas/onchain_operations_personal.schema.json +7 -7
  155. package/dist/schemas/onchain_operations_progress.schema.json +9 -9
  156. package/dist/schemas/onchain_operations_proof.schema.json +8 -8
  157. package/dist/schemas/onchain_operations_repository.schema.json +10 -10
  158. package/dist/schemas/onchain_operations_reward.schema.json +14 -14
  159. package/dist/schemas/onchain_operations_service.schema.json +119 -48
  160. package/dist/schemas/onchain_operations_treasury.schema.json +11 -11
  161. package/dist/schemas/onchain_table_data.output.json +33 -25
  162. package/dist/schemas/onchain_table_data.schema.json +22 -21
  163. package/dist/schemas/project_operation.output.json +2194 -23
  164. package/dist/schemas/project_operation.schema.json +84 -6
  165. package/dist/schemas/query_toolkit.output.json +108 -80
  166. package/dist/schemas/query_toolkit.schema.json +12 -12
  167. package/dist/schemas/schema_query.output.json +70 -3
  168. package/dist/schemas/schema_query.schema.json +18 -3
  169. package/dist/schemas/wowok_buildin_info.output.json +81 -8
  170. package/dist/schemas/wowok_buildin_info.schema.json +46 -2
  171. package/dist/tools/handlers/local.js +20 -5
  172. package/dist/tools/handlers/onchain.js +594 -6
  173. package/dist/tools/handlers/project.js +76 -4
  174. package/dist/tools/handlers/query.js +27 -0
  175. package/dist/tools/handlers/schema-query.js +43 -1
  176. package/dist/tools/handlers/task-status.d.ts +170 -0
  177. package/dist/tools/handlers/task-status.js +55 -0
  178. package/dist/tools/handlers/wip.js +47 -1
  179. package/dist/tools/index.d.ts +8 -0
  180. package/dist/tools/index.js +387 -12
  181. package/dist/tools/retry.d.ts +8 -0
  182. package/dist/tools/retry.js +85 -0
  183. package/dist/tools/wip-deploy-assist.d.ts +28 -0
  184. package/dist/tools/wip-deploy-assist.js +278 -0
  185. package/package.json +2 -2
  186. package/dist/schemas/guard-node-examples.md +0 -199
@@ -1,7 +1,7 @@
1
1
  import { join } from "path";
2
2
  const STANDARD_TOPO_ORDER = [
3
- "permission", "treasury", "allocation", "guard", "machine",
4
- "service", "order", "progress", "arb", "reward",
3
+ "permission", "treasury", "allocation", "service", "guard", "machine",
4
+ "order", "progress", "arb", "reward",
5
5
  "proof", "repository", "demand", "contact",
6
6
  "personal", "payment",
7
7
  ];
@@ -75,33 +75,56 @@ function renderMeta(input) {
75
75
  }
76
76
  function renderODG(input) {
77
77
  const lines = ["## 1. Object Dependency Graph (ODG)", ""];
78
+ const detailLevel = input.detail_level ?? "summary";
78
79
  lines.push("### 1.1 Object List");
79
80
  lines.push("");
80
- lines.push(tableHeader([
81
- "entry_id", "object_type", "name", "reused_from", "publish_required", "description",
82
- ]));
81
+ const showDescription = detailLevel !== "summary";
82
+ if (showDescription) {
83
+ lines.push(tableHeader([
84
+ "entry_id", "object_type", "name", "reused_from", "publish_required", "description",
85
+ ]));
86
+ }
87
+ else {
88
+ lines.push(tableHeader([
89
+ "entry_id", "object_type", "name", "reused_from", "publish_required",
90
+ ]));
91
+ }
83
92
  for (const o of input.objects) {
84
- lines.push(tableRow([
93
+ const row = [
85
94
  o.entry_id,
86
95
  o.object_type,
87
96
  o.name,
88
97
  o.reused_from ?? "",
89
98
  String(o.publish_required),
90
- o.description ?? "",
91
- ]));
99
+ ];
100
+ if (showDescription)
101
+ row.push(o.description ?? "");
102
+ lines.push(tableRow(row));
92
103
  }
93
104
  lines.push("");
105
+ if (!showDescription) {
106
+ lines.push("_Use `detail_level='detailed'` or `'full'` to include object descriptions._");
107
+ lines.push("");
108
+ }
94
109
  lines.push("### 1.2 Dependencies");
95
110
  lines.push("");
96
111
  lines.push(tableHeader([
97
112
  "from", "to", "edge_kind", "field_path", "required_at_publish",
98
113
  ]));
99
- for (const e of input.edges) {
114
+ const visibleEdges = detailLevel === "summary"
115
+ ? input.edges.filter((e) => e.required_at_publish)
116
+ : input.edges;
117
+ for (const e of visibleEdges) {
100
118
  lines.push(tableRow([
101
119
  e.from, e.to, e.edge_kind, e.field_path, String(e.required_at_publish),
102
120
  ]));
103
121
  }
104
122
  lines.push("");
123
+ if (detailLevel === "summary" && input.edges.length > visibleEdges.length) {
124
+ lines.push(`_Showing ${visibleEdges.length} of ${input.edges.length} edges (required_at_publish only). ` +
125
+ `Use \`detail_level='detailed'\` or \`'full'\` to see all edges._`);
126
+ lines.push("");
127
+ }
105
128
  if (input.scenarios && input.scenarios.length > 0) {
106
129
  lines.push("### 1.3 Scenario Matrix");
107
130
  lines.push("");
@@ -160,19 +183,56 @@ function renderNetworkSection(sectionNum, network, input) {
160
183
  lines.push(tableRow(["gas_budget", "100000000"]));
161
184
  lines.push(tableRow(["account", `${input.project_prefix}_merchant_${network}`]));
162
185
  lines.push(tableRow(["dry_run", "false"]));
186
+ lines.push(tableRow(["detail_level", input.detail_level ?? "summary"]));
163
187
  lines.push("");
164
188
  lines.push(`### ${sectionNum}.2 ${network} JSON Operation Sequence`);
165
189
  lines.push("");
190
+ const detailLevel = input.detail_level ?? "summary";
166
191
  for (const step of input.steps) {
167
192
  if (step.network_phase !== "both" && step.network_phase !== network)
168
193
  continue;
194
+ const obj = input.objects.find(o => o.entry_id === step.entry_id);
195
+ const isDraft = obj?.status === "draft";
196
+ const objName = objectNameForStep(step, input);
197
+ const objectData = {
198
+ name: objName,
199
+ replaceExistName: network === "testnet",
200
+ };
201
+ if (isDraft && obj?.config) {
202
+ const summaryFields = new Set([
203
+ "name", "replaceExistName",
204
+ "machine", "permission", "buy_guard", "order_allocators",
205
+ "publish", "pause",
206
+ ]);
207
+ const detailedFields = new Set([
208
+ "sales", "arbitrations", "rewards",
209
+ "repositories", "discount", "discount_destroy",
210
+ ]);
211
+ for (const [k, v] of Object.entries(obj.config)) {
212
+ if (k === "name" || k === "replaceExistName")
213
+ continue;
214
+ if (detailLevel === "full") {
215
+ objectData[k] = v;
216
+ }
217
+ else if (detailLevel === "detailed"
218
+ && (summaryFields.has(k) || detailedFields.has(k))) {
219
+ objectData[k] = v;
220
+ }
221
+ else if (detailLevel === "summary" && summaryFields.has(k)) {
222
+ objectData[k] = v;
223
+ }
224
+ }
225
+ }
169
226
  const block = {
170
227
  step: step.step,
171
228
  operation: "onchain_operations",
172
229
  operation_type: step.object_type,
173
230
  data: {
174
- object: { name: objectNameForStep(step, input), replaceExistName: network === "testnet" },
175
- description: stepDescription(step),
231
+ object: objectData,
232
+ description: isDraft
233
+ ? `${stepDescription(step)} [blueprint: generated from ${input.industry} industry template]`
234
+ : stepDescription(step),
235
+ status: isDraft ? "draft" : "deployed",
176
236
  },
177
237
  env: {
178
238
  account: `${input.project_prefix}_merchant_${network}`,
@@ -427,7 +487,9 @@ function runDCheck(item, input) {
427
487
  }
428
488
  for (const p of publishSteps) {
429
489
  const created = createByType.get(p.object_type);
430
- if (created === undefined || created > p.step) {
490
+ if (created === undefined)
491
+ continue;
492
+ if (created > p.step) {
431
493
  return { status: "FAIL", notes: `publish ${p.step} before create for ${p.object_type}` };
432
494
  }
433
495
  }
@@ -966,8 +1028,8 @@ function renderProjectReadme(input, relations) {
966
1028
  lines.push("| stage 4 (steps) | stage 5 (substeps) | Steps must be defined before substep tracing |");
967
1029
  lines.push("");
968
1030
  lines.push("## §8 Gas / Faucet Rules", "");
969
- lines.push("- testnet: gas is free (faucet) — encourage experimentation,回退无成本");
970
- lines.push("- mainnet: gas is real — 回退后重跑有真实成本, WARN before rollback");
1031
+ lines.push("- testnet: gas is free (faucet) — encourage experimentation, rollback is costless");
1032
+ lines.push("- mainnet: gas is real — re-running after rollback incurs real cost, WARN before rollback");
971
1033
  lines.push("- Reversibility is determined by object lifecycle (§3.2), NOT by network");
972
1034
  lines.push("");
973
1035
  lines.push("## §9 Stage Subdirectory Index", "");
@@ -0,0 +1,123 @@
1
+ import type { z } from "zod";
2
+ import { type MachineNodeForRender, type MachineEdgeForRender } from "../knowledge/machine-render.js";
3
+ import { type GuardNodeForRender } from "../knowledge/guard-render.js";
4
+ import type { ProjectOperationInputSchema } from "../schema/project/index.js";
5
+ type ProjectInput = z.infer<typeof ProjectOperationInputSchema>;
6
+ export declare function handlePlanObjectEdit(v: ProjectInput): Promise<{
7
+ action: "plan_object_edit";
8
+ plan_id: string;
9
+ object_kind: "guard" | "machine";
10
+ object_address: string;
11
+ object_name: string | null;
12
+ expected_hash: string;
13
+ diff: {
14
+ added: string[];
15
+ removed: string[];
16
+ modified: string[];
17
+ summary: string;
18
+ };
19
+ warnings: {
20
+ id: string;
21
+ description: string;
22
+ impact: string;
23
+ }[];
24
+ blocking_errors: {
25
+ id: string;
26
+ description: string;
27
+ impact: string;
28
+ }[];
29
+ can_apply: boolean;
30
+ prepared_call: unknown;
31
+ expires_at: string;
32
+ summary: string;
33
+ }>;
34
+ export declare function handleApplyObjectEdit(v: ProjectInput): Promise<{
35
+ action: "apply_object_edit";
36
+ plan_id: string;
37
+ applied: boolean;
38
+ hash_match: boolean;
39
+ prepared_call: null;
40
+ error: string;
41
+ next_step: string;
42
+ } | {
43
+ action: "apply_object_edit";
44
+ plan_id: string;
45
+ applied: boolean;
46
+ hash_match: boolean;
47
+ prepared_call: unknown;
48
+ error: null;
49
+ next_step: string;
50
+ }>;
51
+ export declare function handlePatchMachineNodes(v: ProjectInput): Promise<{
52
+ action: "patch_machine_nodes";
53
+ machine_address: string;
54
+ machine_name: string | null;
55
+ operations_applied: number;
56
+ operations_failed: {
57
+ operation: string;
58
+ error: string;
59
+ }[];
60
+ patched_nodes: MachineNodeForRender[];
61
+ patched_edges: MachineEdgeForRender[];
62
+ diff: {
63
+ added: string[];
64
+ removed: string[];
65
+ modified: string[];
66
+ summary: string;
67
+ };
68
+ warnings: {
69
+ id: string;
70
+ description: string;
71
+ impact: string;
72
+ }[];
73
+ blocking_errors: {
74
+ id: string;
75
+ description: string;
76
+ impact: string;
77
+ }[];
78
+ can_apply: boolean;
79
+ prepared_call: unknown;
80
+ summary: string;
81
+ }>;
82
+ export declare function handlePatchGuardTree(v: ProjectInput): Promise<{
83
+ action: "patch_guard_tree";
84
+ guard_address: string;
85
+ guard_name: string | null;
86
+ operations_applied: number;
87
+ operations_failed: {
88
+ operation: string;
89
+ error: string;
90
+ }[];
91
+ patched_root: GuardNodeForRender;
92
+ patched_table: {
93
+ identifier: number;
94
+ name?: string;
95
+ value_type: string | number;
96
+ b_submission: boolean;
97
+ value?: unknown;
98
+ }[];
99
+ patched_rely: {
100
+ guards: string[];
101
+ logic_or?: boolean;
102
+ } | null;
103
+ diff: {
104
+ added: string[];
105
+ removed: string[];
106
+ modified: string[];
107
+ summary: string;
108
+ };
109
+ warnings: {
110
+ id: string;
111
+ description: string;
112
+ impact: string;
113
+ }[];
114
+ blocking_errors: {
115
+ id: string;
116
+ description: string;
117
+ impact: string;
118
+ }[];
119
+ can_apply: boolean;
120
+ prepared_call: unknown;
121
+ summary: string;
122
+ }>;
123
+ export {};