wowok_agent 1.6.6 → 2.1.9

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 (181) hide show
  1. package/README.md +20 -40
  2. package/dist/index.d.ts +6 -27
  3. package/dist/index.js +1026 -27
  4. package/dist/schema/call/allocation.d.ts +8 -0
  5. package/dist/schema/call/allocation.js +27 -0
  6. package/dist/schema/call/arbitration.d.ts +27 -0
  7. package/dist/schema/call/arbitration.js +106 -0
  8. package/dist/schema/call/base.d.ts +41 -0
  9. package/dist/schema/call/base.js +152 -0
  10. package/dist/schema/call/contact.d.ts +9 -0
  11. package/dist/schema/call/contact.js +41 -0
  12. package/dist/schema/call/demand.d.ts +10 -0
  13. package/dist/schema/call/demand.js +51 -0
  14. package/dist/schema/call/guard.d.ts +15 -0
  15. package/dist/schema/call/guard.js +67 -0
  16. package/dist/schema/call/handler.d.ts +80 -0
  17. package/dist/schema/call/handler.js +177 -0
  18. package/dist/schema/call/index.d.ts +18 -0
  19. package/dist/schema/call/index.js +19 -0
  20. package/dist/schema/call/machine.d.ts +23 -0
  21. package/dist/schema/call/machine.js +164 -0
  22. package/dist/schema/call/order.d.ts +11 -0
  23. package/dist/schema/call/order.js +39 -0
  24. package/dist/schema/call/payment.d.ts +7 -0
  25. package/dist/schema/call/payment.js +20 -0
  26. package/dist/schema/call/permission.d.ts +27 -0
  27. package/dist/schema/call/permission.js +118 -0
  28. package/dist/schema/call/personal.d.ts +27 -0
  29. package/dist/schema/call/personal.js +81 -0
  30. package/dist/schema/call/progress.d.ts +6 -0
  31. package/dist/schema/call/progress.js +37 -0
  32. package/dist/schema/call/proof.d.ts +7 -0
  33. package/dist/schema/call/proof.js +27 -0
  34. package/dist/schema/call/repository.d.ts +15 -0
  35. package/dist/schema/call/repository.js +85 -0
  36. package/dist/schema/call/reward.d.ts +7 -0
  37. package/dist/schema/call/reward.js +46 -0
  38. package/dist/schema/call/service.d.ts +7 -0
  39. package/dist/schema/call/service.js +87 -0
  40. package/dist/schema/call/treasury.d.ts +6 -0
  41. package/dist/schema/call/treasury.js +76 -0
  42. package/dist/schema/common/index.d.ts +57 -0
  43. package/dist/schema/common/index.js +331 -0
  44. package/dist/schema/index.d.ts +7 -0
  45. package/dist/schema/index.js +8 -0
  46. package/dist/schema/local/index.d.ts +120 -0
  47. package/dist/schema/local/index.js +913 -0
  48. package/dist/schema/local/wip.d.ts +33 -0
  49. package/dist/schema/local/wip.js +229 -0
  50. package/dist/schema/messenger/index.d.ts +34 -0
  51. package/dist/schema/messenger/index.js +407 -0
  52. package/dist/schema/query/index.d.ts +240 -0
  53. package/dist/schema/query/index.js +1313 -0
  54. package/dist/schema/utils/guard-parser.d.ts +20 -0
  55. package/dist/schema/utils/guard-parser.js +410 -0
  56. package/dist/schema/utils/guard-query-utils.d.ts +5 -0
  57. package/dist/schema/utils/guard-query-utils.js +22 -0
  58. package/dist/schema/utils/node-parser.d.ts +59 -0
  59. package/dist/schema/utils/node-parser.js +382 -0
  60. package/dist/schema/utils/permission-index-utils.d.ts +2 -0
  61. package/dist/schema/utils/permission-index-utils.js +10 -0
  62. package/package.json +31 -49
  63. package/LICENSE +0 -201
  64. package/dist/call/arbitration.d.ts +0 -57
  65. package/dist/call/arbitration.d.ts.map +0 -1
  66. package/dist/call/arbitration.js +0 -245
  67. package/dist/call/arbitration.js.map +0 -1
  68. package/dist/call/base.d.ts +0 -85
  69. package/dist/call/base.d.ts.map +0 -1
  70. package/dist/call/base.js +0 -231
  71. package/dist/call/base.js.map +0 -1
  72. package/dist/call/call.d.ts +0 -95
  73. package/dist/call/call.d.ts.map +0 -1
  74. package/dist/call/call.js +0 -149
  75. package/dist/call/call.js.map +0 -1
  76. package/dist/call/demand.d.ts +0 -46
  77. package/dist/call/demand.d.ts.map +0 -1
  78. package/dist/call/demand.js +0 -201
  79. package/dist/call/demand.js.map +0 -1
  80. package/dist/call/guard.d.ts +0 -53
  81. package/dist/call/guard.d.ts.map +0 -1
  82. package/dist/call/guard.js +0 -386
  83. package/dist/call/guard.js.map +0 -1
  84. package/dist/call/machine.d.ts +0 -97
  85. package/dist/call/machine.d.ts.map +0 -1
  86. package/dist/call/machine.js +0 -342
  87. package/dist/call/machine.js.map +0 -1
  88. package/dist/call/object_permission.d.ts +0 -14
  89. package/dist/call/object_permission.d.ts.map +0 -1
  90. package/dist/call/object_permission.js +0 -59
  91. package/dist/call/object_permission.js.map +0 -1
  92. package/dist/call/permission.d.ts +0 -63
  93. package/dist/call/permission.d.ts.map +0 -1
  94. package/dist/call/permission.js +0 -137
  95. package/dist/call/permission.js.map +0 -1
  96. package/dist/call/personal.d.ts +0 -47
  97. package/dist/call/personal.d.ts.map +0 -1
  98. package/dist/call/personal.js +0 -119
  99. package/dist/call/personal.js.map +0 -1
  100. package/dist/call/repository.d.ts +0 -117
  101. package/dist/call/repository.d.ts.map +0 -1
  102. package/dist/call/repository.js +0 -408
  103. package/dist/call/repository.js.map +0 -1
  104. package/dist/call/service.d.ts +0 -115
  105. package/dist/call/service.d.ts.map +0 -1
  106. package/dist/call/service.js +0 -550
  107. package/dist/call/service.js.map +0 -1
  108. package/dist/call/treasury.d.ts +0 -46
  109. package/dist/call/treasury.d.ts.map +0 -1
  110. package/dist/call/treasury.js +0 -222
  111. package/dist/call/treasury.js.map +0 -1
  112. package/dist/common.d.ts +0 -12
  113. package/dist/common.d.ts.map +0 -1
  114. package/dist/common.js +0 -71
  115. package/dist/common.js.map +0 -1
  116. package/dist/index.d.ts.map +0 -1
  117. package/dist/index.js.map +0 -1
  118. package/dist/local/.d.ts +0 -20
  119. package/dist/local/.d.ts.map +0 -1
  120. package/dist/local/.js +0 -76
  121. package/dist/local/.js.map +0 -1
  122. package/dist/local/account.d.ts +0 -42
  123. package/dist/local/account.d.ts.map +0 -1
  124. package/dist/local/account.js +0 -335
  125. package/dist/local/account.js.map +0 -1
  126. package/dist/local/cache.d.ts +0 -32
  127. package/dist/local/cache.d.ts.map +0 -1
  128. package/dist/local/cache.js +0 -77
  129. package/dist/local/cache.js.map +0 -1
  130. package/dist/local/coin.d.ts +0 -22
  131. package/dist/local/coin.d.ts.map +0 -1
  132. package/dist/local/coin.js +0 -123
  133. package/dist/local/coin.js.map +0 -1
  134. package/dist/local/config.d.ts +0 -20
  135. package/dist/local/config.d.ts.map +0 -1
  136. package/dist/local/config.js +0 -75
  137. package/dist/local/config.js.map +0 -1
  138. package/dist/local/index.d.ts +0 -110
  139. package/dist/local/index.d.ts.map +0 -1
  140. package/dist/local/index.js +0 -122
  141. package/dist/local/index.js.map +0 -1
  142. package/dist/local/local.d.ts +0 -55
  143. package/dist/local/local.d.ts.map +0 -1
  144. package/dist/local/local.js +0 -248
  145. package/dist/local/local.js.map +0 -1
  146. package/dist/query/events.d.ts +0 -65
  147. package/dist/query/events.d.ts.map +0 -1
  148. package/dist/query/events.js +0 -75
  149. package/dist/query/events.js.map +0 -1
  150. package/dist/query/objects.d.ts +0 -346
  151. package/dist/query/objects.d.ts.map +0 -1
  152. package/dist/query/objects.js +0 -472
  153. package/dist/query/objects.js.map +0 -1
  154. package/dist/query/permission.d.ts +0 -15
  155. package/dist/query/permission.d.ts.map +0 -1
  156. package/dist/query/permission.js +0 -45
  157. package/dist/query/permission.js.map +0 -1
  158. package/dist/query/received.d.ts +0 -16
  159. package/dist/query/received.d.ts.map +0 -1
  160. package/dist/query/received.js +0 -16
  161. package/dist/query/received.js.map +0 -1
  162. package/dist/schema/call.d.ts +0 -13005
  163. package/dist/schema/call.d.ts.map +0 -1
  164. package/dist/schema/call.js +0 -997
  165. package/dist/schema/call.js.map +0 -1
  166. package/dist/schema/const.d.ts +0 -254
  167. package/dist/schema/const.d.ts.map +0 -1
  168. package/dist/schema/const.js +0 -305
  169. package/dist/schema/const.js.map +0 -1
  170. package/dist/schema/local.d.ts +0 -702
  171. package/dist/schema/local.d.ts.map +0 -1
  172. package/dist/schema/local.js +0 -150
  173. package/dist/schema/local.js.map +0 -1
  174. package/dist/schema/query.d.ts +0 -1465
  175. package/dist/schema/query.d.ts.map +0 -1
  176. package/dist/schema/query.js +0 -224
  177. package/dist/schema/query.js.map +0 -1
  178. package/dist/schema/util.d.ts +0 -71
  179. package/dist/schema/util.d.ts.map +0 -1
  180. package/dist/schema/util.js +0 -139
  181. package/dist/schema/util.js.map +0 -1
@@ -0,0 +1,80 @@
1
+ import type { CallEnv } from "wowok";
2
+ import type { CallOutput } from "./base.js";
3
+ /**
4
+ * Process Call result and return unified MCP output format
5
+ * @param result Call operation result
6
+ * @returns Unified MCP output format
7
+ */
8
+ export declare function handleCallResult(result: any): {
9
+ content: any[];
10
+ structuredContent: CallOutput;
11
+ };
12
+ /**
13
+ * Create standard MCP Server configuration
14
+ * @param packageJson package.json content
15
+ * @returns MCP Server configuration
16
+ */
17
+ export declare function createServerConfig(packageJson: any): {
18
+ name: any;
19
+ version: any;
20
+ description: any;
21
+ };
22
+ /**
23
+ * Create MCP Server capabilities configuration
24
+ * @returns Capabilities configuration
25
+ */
26
+ export declare function createCapabilitiesConfig(): {
27
+ capabilities: {
28
+ prompts: {};
29
+ resources: {};
30
+ tools: {
31
+ listChanged: boolean;
32
+ };
33
+ logging: {};
34
+ };
35
+ };
36
+ /**
37
+ * Create standard tool metadata
38
+ * @param category Tool category
39
+ * @param tags Tool tags
40
+ * @returns Tool metadata
41
+ */
42
+ export declare function createToolMeta(category: string, tags: string[]): {
43
+ author: string;
44
+ createdAt: string;
45
+ lastUpdated: string;
46
+ category: string;
47
+ tags: string[];
48
+ requiresAuth: boolean;
49
+ };
50
+ /**
51
+ * Create standard tool annotations
52
+ * @param readOnlyHint Whether read-only
53
+ * @param destructiveHint Whether destructive
54
+ * @returns Tool annotations
55
+ */
56
+ export declare function createToolAnnotations(readOnlyHint?: boolean, destructiveHint?: boolean): {
57
+ readOnlyHint: boolean;
58
+ destructiveHint: boolean;
59
+ idempotentHint: boolean;
60
+ openWorldHint: boolean;
61
+ };
62
+ /**
63
+ * Process submission parameter transformation
64
+ * @param submission submission parameter
65
+ * @returns Transformed submission parameter
66
+ */
67
+ export declare function transformSubmission(submission: any): any;
68
+ /**
69
+ * Validate input data
70
+ * @param data Input data
71
+ * @param schema Zod schema
72
+ * @returns Validated data
73
+ */
74
+ export declare function validateInput<T>(data: any, schema: any): T;
75
+ /**
76
+ * Get environment configuration
77
+ * @param env Environment parameters
78
+ * @returns Environment configuration
79
+ */
80
+ export declare function getEnvConfig(env?: any): CallEnv;
@@ -0,0 +1,177 @@
1
+ // Copyright (c) Wowok.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { ResponseData } from "wowok";
4
+ /**
5
+ * Process Call result and return unified MCP output format
6
+ * @param result Call operation result
7
+ * @returns Unified MCP output format
8
+ */
9
+ export function handleCallResult(result) {
10
+ // Handle error result
11
+ if (result && "error" in result) {
12
+ const output = {
13
+ message: `Error: ${result.error}`,
14
+ result: { type: "error", error: result.error },
15
+ };
16
+ return {
17
+ content: [{ type: "text", text: output.message }],
18
+ structuredContent: output,
19
+ };
20
+ }
21
+ // Handle transaction result (contains digest field)
22
+ if (result && "digest" in result) {
23
+ const r = ResponseData(result);
24
+ const output = {
25
+ message: "Transaction completed successfully",
26
+ result: { type: "transaction", ...result },
27
+ };
28
+ return {
29
+ content: [
30
+ { type: "text", text: output.message },
31
+ { type: "text", text: JSON.stringify(r) },
32
+ ],
33
+ structuredContent: output,
34
+ };
35
+ }
36
+ // Handle submission result (contains guard and submission fields)
37
+ if (result && "guard" in result && "submission" in result) {
38
+ const output = {
39
+ message: "Submission required for Guard verification",
40
+ result: { type: "submission", ...result },
41
+ };
42
+ return {
43
+ content: [
44
+ { type: "text", text: output.message },
45
+ { type: "text", text: JSON.stringify(result) },
46
+ ],
47
+ structuredContent: output,
48
+ };
49
+ }
50
+ // Handle array result
51
+ if (Array.isArray(result)) {
52
+ const output = {
53
+ message: "Operation completed",
54
+ result: { type: "data", data: result },
55
+ };
56
+ return {
57
+ content: [
58
+ { type: "text", text: output.message },
59
+ { type: "text", text: JSON.stringify(result) },
60
+ ],
61
+ structuredContent: output,
62
+ };
63
+ }
64
+ // Handle empty or null result
65
+ if (result === undefined || result === null) {
66
+ const output = {
67
+ message: "Operation completed",
68
+ result: { type: "null" },
69
+ };
70
+ return {
71
+ content: [{ type: "text", text: output.message }],
72
+ structuredContent: output,
73
+ };
74
+ }
75
+ // Default handling for other result types - treat as transaction
76
+ const output = {
77
+ message: "Operation completed",
78
+ result: { type: "transaction", ...result },
79
+ };
80
+ return {
81
+ content: [{ type: "text", text: output.message }],
82
+ structuredContent: output,
83
+ };
84
+ }
85
+ /**
86
+ * Create standard MCP Server configuration
87
+ * @param packageJson package.json content
88
+ * @returns MCP Server configuration
89
+ */
90
+ export function createServerConfig(packageJson) {
91
+ return {
92
+ name: packageJson.name,
93
+ version: packageJson.version,
94
+ description: packageJson.description,
95
+ };
96
+ }
97
+ /**
98
+ * Create MCP Server capabilities configuration
99
+ * @returns Capabilities configuration
100
+ */
101
+ export function createCapabilitiesConfig() {
102
+ return {
103
+ capabilities: {
104
+ prompts: {},
105
+ resources: {},
106
+ tools: { listChanged: true },
107
+ logging: {},
108
+ },
109
+ };
110
+ }
111
+ /**
112
+ * Create standard tool metadata
113
+ * @param category Tool category
114
+ * @param tags Tool tags
115
+ * @returns Tool metadata
116
+ */
117
+ export function createToolMeta(category, tags) {
118
+ return {
119
+ author: "WOWOK Team",
120
+ createdAt: "2026-02-01",
121
+ lastUpdated: "2026-02-01",
122
+ category,
123
+ tags,
124
+ requiresAuth: false,
125
+ };
126
+ }
127
+ /**
128
+ * Create standard tool annotations
129
+ * @param readOnlyHint Whether read-only
130
+ * @param destructiveHint Whether destructive
131
+ * @returns Tool annotations
132
+ */
133
+ export function createToolAnnotations(readOnlyHint = false, destructiveHint = false) {
134
+ return {
135
+ readOnlyHint,
136
+ destructiveHint,
137
+ idempotentHint: true,
138
+ openWorldHint: false,
139
+ };
140
+ }
141
+ /**
142
+ * Process submission parameter transformation
143
+ * @param submission submission parameter
144
+ * @returns Transformed submission parameter
145
+ */
146
+ export function transformSubmission(submission) {
147
+ if (!submission)
148
+ return undefined;
149
+ return {
150
+ type: "submission",
151
+ guard: (submission.guard || []).map((g) => ({
152
+ object: g.object || "",
153
+ impack: g.impack || false,
154
+ })),
155
+ submission: (submission.submission || []).map((s) => ({
156
+ guard: s.guard || "",
157
+ submission: s.submission || [],
158
+ })),
159
+ };
160
+ }
161
+ /**
162
+ * Validate input data
163
+ * @param data Input data
164
+ * @param schema Zod schema
165
+ * @returns Validated data
166
+ */
167
+ export function validateInput(data, schema) {
168
+ return schema.parse(data);
169
+ }
170
+ /**
171
+ * Get environment configuration
172
+ * @param env Environment parameters
173
+ * @returns Environment configuration
174
+ */
175
+ export function getEnvConfig(env) {
176
+ return env || {};
177
+ }
@@ -0,0 +1,18 @@
1
+ export * from './base.js';
2
+ export * from './handler.js';
3
+ export * from './contact.js';
4
+ export * from './demand.js';
5
+ export * from './guard.js';
6
+ export * from './machine.js';
7
+ export * from './arbitration.js';
8
+ export * from './allocation.js';
9
+ export * from './order.js';
10
+ export * from './payment.js';
11
+ export * from './permission.js';
12
+ export * from './personal.js';
13
+ export * from './proof.js';
14
+ export * from './progress.js';
15
+ export * from './repository.js';
16
+ export * from './reward.js';
17
+ export * from './service.js';
18
+ export * from './treasury.js';
@@ -0,0 +1,19 @@
1
+ // Export all schema definitions
2
+ export * from './base.js';
3
+ export * from './handler.js';
4
+ export * from './contact.js';
5
+ export * from './demand.js';
6
+ export * from './guard.js';
7
+ export * from './machine.js';
8
+ export * from './arbitration.js';
9
+ export * from './allocation.js';
10
+ export * from './order.js';
11
+ export * from './payment.js';
12
+ export * from './permission.js';
13
+ export * from './personal.js';
14
+ export * from './proof.js';
15
+ export * from './progress.js';
16
+ export * from './repository.js';
17
+ export * from './reward.js';
18
+ export * from './service.js';
19
+ export * from './treasury.js';
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ export declare const ProgressNamedOperatorSchema: any;
3
+ export declare const ProgressNewSchema: any;
4
+ export declare const NodeAddForwardDataSchema: any;
5
+ export declare const NodeRemoveForwardDataSchema: any;
6
+ export declare const NodeRemovePriorNodeDataSchema: any;
7
+ export declare const NodeSchema: any;
8
+ export declare const NodeJsonOrMarkdownFileSchema: any;
9
+ export declare const NodeFieldSchema: any;
10
+ export declare const CallMachine_DataSchema: any;
11
+ export declare const CallMachine_InputSchema: any;
12
+ export declare const MachineNode2File_InputSchema: any;
13
+ export declare const MachineNode2File_OutputSchema: any;
14
+ export declare const MachineNode2File_OutputWrappedSchema: any;
15
+ export type CallMachine_Data = z.infer<typeof CallMachine_DataSchema>;
16
+ export type ProgressNew = z.infer<typeof ProgressNewSchema>;
17
+ export type ProgressNamedOperator = z.infer<typeof ProgressNamedOperatorSchema>;
18
+ export type Node = z.infer<typeof NodeSchema>;
19
+ export type NodeJsonOrMarkdownFile = z.infer<typeof NodeJsonOrMarkdownFileSchema>;
20
+ export type NodeField = z.infer<typeof NodeFieldSchema>;
21
+ export type MachineNode2File_Input = z.infer<typeof MachineNode2File_InputSchema>;
22
+ export type MachineNode2File_Output = z.infer<typeof MachineNode2File_OutputSchema>;
23
+ export type MachineNode2File_OutputWrapped = z.infer<typeof MachineNode2File_OutputWrappedSchema>;
@@ -0,0 +1,164 @@
1
+ import { z } from 'zod';
2
+ import { WithPermissionObjectSchema, NamedObjectSchema, ObjectsSchema, CallEnvSchema, SubmissionCallSchema, } from './base.js';
3
+ import { MachineNodeSchema, PermissionIndexTypeSchema } from '../query/index.js';
4
+ import { ManyAccountOrMark_AddressSchema, NameOrAddressSchema, NameSchema, NotEmptyNameSchema, ReceivedObjectsOrRecentlySchema } from '../common/index.js';
5
+ // progress_new的progress_namedOperator字段类型
6
+ export const ProgressNamedOperatorSchema = z.object({
7
+ op: z.union([z.literal('add'), z.literal('set'), z.literal('remove')]),
8
+ name: NotEmptyNameSchema,
9
+ operators: ManyAccountOrMark_AddressSchema,
10
+ }).strict();
11
+ // progress_new字段类型
12
+ export const ProgressNewSchema = z.object({
13
+ task: z.union([NameOrAddressSchema, z.null()]).optional().describe('Task bound to the Progress object. It is an object ID or name'),
14
+ repository: ObjectsSchema.optional().describe('Set repository list for the Progress object. Used for consensus data management.'),
15
+ progress_namedOperator: ProgressNamedOperatorSchema.optional().describe('Add, set, and remove operators for the permission namespace of the Progress object.'),
16
+ namedNew: NamedObjectSchema.optional(),
17
+ }).strict();
18
+ // node字段的add forward类型
19
+ export const NodeAddForwardDataSchema = z.object({
20
+ prior_node_name: NameSchema.describe('Name of the previous node.'),
21
+ node_name: NameSchema.describe('Name of the next node.'),
22
+ forward: z.array(z.object({
23
+ name: NameSchema.describe('Name of the operation'),
24
+ namedOperator: z.union([NotEmptyNameSchema, z.null()]).optional().describe('One of the operation permissions: use operators within the permission space name in the Machine object. Each Progress object can manage operators independently.'),
25
+ permissionIndex: z.union([PermissionIndexTypeSchema, z.null()]).optional().describe('Second operation permission: use operators specified by the permission index of the Permission object in the Machine object. All Progress objects share the same operators.'),
26
+ weight: z.number().min(0).max(65535).int().describe('Weight of the operation'),
27
+ }).strict()).describe('List of operations between the previous and next nodes.'),
28
+ threshold: z.union([z.number().int().min(0), z.null()]).optional().describe('Threshold of operations that need to be completed to migrate from the previous node to the next node.'),
29
+ }).strict();
30
+ // node字段的remove forward类型
31
+ export const NodeRemoveForwardDataSchema = z.object({
32
+ prior_node_name: NameSchema.describe('Name of the previous node.'),
33
+ node_name: NameSchema.describe('Name of the next node.'),
34
+ forward_name: z.array(NameSchema).describe('List of operation names to delete.'),
35
+ }).strict();
36
+ // node字段的remove prior node类型
37
+ export const NodeRemovePriorNodeDataSchema = z.object({
38
+ prior_node_name: z.array(NameSchema).describe('List of previous node names to delete.'),
39
+ node_name: NameSchema.describe('Name of the next node.'),
40
+ }).strict();
41
+ // node字段类型
42
+ export const NodeSchema = z.discriminatedUnion('op', [
43
+ z.object({
44
+ op: z.literal('add'),
45
+ nodes: z.array(MachineNodeSchema).describe('List of nodes to add or set.'),
46
+ bReplace: z.boolean().optional().describe('Whether to replace existing nodes. If true, existing nodes will be replaced; if false, nodes will be added by merging.'),
47
+ }).strict().describe('Add nodes.'),
48
+ z.object({
49
+ op: z.literal('set'),
50
+ nodes: z.array(MachineNodeSchema).describe('List of nodes to add or set.'),
51
+ bReplace: z.boolean().optional().describe('Whether to replace existing nodes. If true, existing nodes will be replaced; if false, nodes will be added by merging.'),
52
+ }).strict().describe('Set nodes.'),
53
+ z.object({
54
+ op: z.literal('remove'),
55
+ nodes: z.array(NameSchema).describe('List of node names to delete.'),
56
+ }).strict().describe('Delete nodes.'),
57
+ z.object({
58
+ op: z.literal('clear'),
59
+ }).strict().describe('Clear all nodes.'),
60
+ z.object({
61
+ op: z.literal('exchange'),
62
+ node_one: NameSchema.describe('Name of the first node.'),
63
+ node_other: NameSchema.describe('Name of the second node.'),
64
+ }).strict().describe('Exchange the positions of two nodes.'),
65
+ z.object({
66
+ op: z.literal('rename'),
67
+ node_name_old: NameSchema.describe('Name of thenode.'),
68
+ node_name_new: NameSchema.describe('New name of the node.'),
69
+ }).strict().describe('Rename node.'),
70
+ z.object({
71
+ op: z.literal('remove prior node'),
72
+ pairs: z.array(NodeRemovePriorNodeDataSchema).describe('List of previous-next node pairs to delete.'),
73
+ }).strict().describe('Delete previous-next node pairs.'),
74
+ z.object({
75
+ op: z.literal('add forward'),
76
+ data: z.array(NodeAddForwardDataSchema).describe('List of operations to add.'),
77
+ }).strict().describe('Add operations.'),
78
+ z.object({
79
+ op: z.literal('remove forward'),
80
+ data: z.array(NodeRemoveForwardDataSchema).describe('List of operations to delete.'),
81
+ }).strict().describe('Delete operations.'),
82
+ ]);
83
+ // json_or_markdown_file 模式:从文件读取并完全替换节点定义
84
+ export const NodeJsonOrMarkdownFileSchema = z.object({
85
+ json_or_markdown_file: z.string().describe(`Path to a JSON or Markdown file containing node array for COMPLETE REPLACEMENT of all nodes.
86
+
87
+ **File Format Requirements:**
88
+ - Must contain a JSON ARRAY of node objects: [{"name": "...", "pairs": [...]}, {...}]
89
+ - NOT an operation object with "op" field (use NodeSchema for operations)
90
+ - Supports JSON or Markdown (with \`\`\`json code blocks)
91
+
92
+ **Node Structure:**
93
+ Each node is a directed graph element representing workflow states and transitions:
94
+ - name: Node identifier
95
+ - pairs: Array of {prior_node, forwards, threshold} defining connections
96
+ - forwards: Operations available from this node
97
+ - threshold: Required weight to advance
98
+
99
+ **Behavior:**
100
+ - COMPLETELY REPLACES all existing nodes (equivalent to "set" with bReplace=true)
101
+ - Auto-detects format based on file content
102
+ - If parsing fails, error includes line number and column information`),
103
+ }).strict();
104
+ // node 字段支持两种模式
105
+ export const NodeFieldSchema = z.union([
106
+ NodeSchema,
107
+ NodeJsonOrMarkdownFileSchema,
108
+ ]);
109
+ // CallMachine_Data类型
110
+ export const CallMachine_DataSchema = z.object({
111
+ object: WithPermissionObjectSchema,
112
+ progress_new: ProgressNewSchema.optional().describe('Generate new Progress object.'),
113
+ description: z.string().optional().describe('Description of the object.'),
114
+ repository: ObjectsSchema.optional().describe('Set repository list for the object. Used for consensus data management.'),
115
+ node: NodeFieldSchema.optional().describe(`CRITICAL: Choose ONE of two mutually exclusive modes:
116
+
117
+ **Mode 1: NodeSchema (incremental operations)**
118
+ Use for partial modifications: add, set, remove, clear, exchange, rename, remove prior node, add forward, remove forward.
119
+ Format: { "op": "add", "nodes": [...], "bReplace": false }
120
+ This mode modifies existing nodes incrementally.
121
+
122
+ **Mode 2: NodeJsonOrMarkdownFileSchema (complete replacement)**
123
+ Use for complete node redefinition from file.
124
+ Format: { "json_or_markdown_file": "/path/to/nodes.json" }
125
+ IMPORTANT: This COMPLETELY REPLACES all existing nodes. File must contain node array [{...}, {...}], NOT an operation object with "op" field.
126
+ Supported formats: JSON array or Markdown with code blocks.
127
+ If parsing fails, error includes line number and column information.`),
128
+ pause: z.boolean().optional().describe('Whether to pause generating new Progress objects.'),
129
+ publish: z.boolean().optional().describe('Whether to publish the object. After the object is published, new Progress objects can be generated; and node settings will no longer be changeable.'),
130
+ 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.'),
131
+ um: z.union([z.string(), z.null()]).optional().describe('Contact object.'),
132
+ }).strict().describe("On-chain Machine operations. USAGE: (1) CREATE NEW: Set 'object' field with {name, permission, ...} to create a Machine. 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 object ID or name. The 'object' field is CRITICAL and REQUIRED in both cases.");
133
+ export const CallMachine_InputSchema = z.object({
134
+ data: CallMachine_DataSchema,
135
+ env: CallEnvSchema.optional(),
136
+ submission: SubmissionCallSchema.optional(),
137
+ }).strict();
138
+ // MachineNode2File_InputSchema - 用于 machineNode2file 函数
139
+ export const MachineNode2File_InputSchema = z.object({
140
+ machine: NameOrAddressSchema.describe("Machine object ID or name to export"),
141
+ file_path: z.string().describe("Output file path (absolute or relative)"),
142
+ format: z.enum(["json", "markdown"]).optional().describe("Output format: 'json' (default) or 'markdown'"),
143
+ env: CallEnvSchema.optional(),
144
+ }).strict().describe("Query a Machine object from the blockchain and export its node definition to a JSON or Markdown file. The exported file can be edited and used to create new Machine objects.");
145
+ // MachineNode2File_OutputSchema - machineNode2file 输出 schema
146
+ export const MachineNode2File_OutputSchema = z.discriminatedUnion("status", [
147
+ z.object({
148
+ status: z.literal("success"),
149
+ data: z.object({
150
+ file_path: z.string().describe("Absolute path of the exported file"),
151
+ format: z.enum(["json", "markdown"]).describe("Export format"),
152
+ machine_object: NameOrAddressSchema.describe("Machine object ID"),
153
+ node_count: z.number().describe("Number of nodes exported"),
154
+ }).strict().describe("Success result data"),
155
+ }).strict(),
156
+ z.object({
157
+ status: z.literal("error"),
158
+ error: z.string().describe("Error message"),
159
+ }).strict(),
160
+ ]).describe("MachineNode2File operation output");
161
+ // MachineNode2File_OutputWrappedSchema - 包装后的输出 schema
162
+ export const MachineNode2File_OutputWrappedSchema = z.object({
163
+ result: MachineNode2File_OutputSchema,
164
+ }).strict().describe("MachineNode2File operation output wrapped schema");
@@ -0,0 +1,11 @@
1
+ import { z } from "zod";
2
+ export declare const ArbConfirmSchema: any;
3
+ export declare const ArbObjectionSchema: any;
4
+ export declare const ArbClaimCompensationSchema: any;
5
+ export declare const CallOrder_DataSchema: any;
6
+ export declare const CallOrder_InputSchema: any;
7
+ export type ArbConfirm = z.infer<typeof ArbConfirmSchema>;
8
+ export type ArbObjection = z.infer<typeof ArbObjectionSchema>;
9
+ export type ArbClaimCompensation = z.infer<typeof ArbClaimCompensationSchema>;
10
+ export type CallOrder_Data = z.infer<typeof CallOrder_DataSchema>;
11
+ export type CallOrder_Input = z.infer<typeof CallOrder_InputSchema>;
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ import { CallEnvSchema, SubmissionCallSchema } from "./base.js";
3
+ import { OperateSchema } from "./progress.js";
4
+ import { AccountOrMark_AddressSchema, DescriptionSchema, LongNameSchema, ManyAccountOrMark_AddressSchema, NameOrAddressSchema } from "../common/index.js";
5
+ import { QueryReceivedResultSchema } from "../common/index.js";
6
+ // 定义arb_confirm schema
7
+ export const ArbConfirmSchema = z.object({
8
+ arb: NameOrAddressSchema.describe("Arb object ID or name."),
9
+ confirm: z.boolean().describe("Whether to confirm that the submitted arbitration materials are valid for arbitration."),
10
+ description: DescriptionSchema.optional().describe("Message description for compensation application."),
11
+ proposition: z.array(LongNameSchema).optional().describe("Compensation claims.")
12
+ }).strict();
13
+ // 定义arb_objection schema
14
+ export const ArbObjectionSchema = z.object({
15
+ arb: NameOrAddressSchema.describe("Arb object ID or name."),
16
+ objection: DescriptionSchema.describe("Oppose and appeal the arbitration result, request re-arbitration"),
17
+ }).strict();
18
+ // 定义arb_claim_compensation schema
19
+ export const ArbClaimCompensationSchema = z.object({
20
+ arb: NameOrAddressSchema.describe("Arb object ID or name."),
21
+ }).strict();
22
+ // 定义CallOrder_Data schema
23
+ export const CallOrder_DataSchema = z.object({
24
+ object: NameOrAddressSchema.describe("Order object ID or name."),
25
+ agents: ManyAccountOrMark_AddressSchema.optional().describe("Order agents. Agents can operate the order, such as canceling the order, modifying the order status, etc.; but cannot receive the funds received by the order."),
26
+ required_info: z.union([NameOrAddressSchema, z.null()]).optional().describe("Contact object ID (recipient) or WTS Proof object (delivery proof) that information has been delivered via Wowok Messenger."),
27
+ progress: OperateSchema.optional().describe("Advance order process"),
28
+ arb_confirm: ArbConfirmSchema.optional().describe("Submit compensation request and apply for arbitration"),
29
+ arb_objection: ArbObjectionSchema.optional().describe("Oppose and appeal the arbitration result, request re-arbitration."),
30
+ arb_claim_compensation: ArbClaimCompensationSchema.optional().describe("Specify the adjudicated Arb object to obtain order compensation."),
31
+ receive: QueryReceivedResultSchema.optional().describe("Unwrap CoinWrapper objects or other objects received by the order and transfer them to the order owner"),
32
+ transfer_to: AccountOrMark_AddressSchema.optional().describe("Set new owner of the order. Requires order owner permission to set."),
33
+ }).strict().describe("On-chain, operate on an Order object.");
34
+ // 定义输入schema
35
+ export const CallOrder_InputSchema = z.object({
36
+ data: CallOrder_DataSchema,
37
+ env: CallEnvSchema.optional(),
38
+ submission: SubmissionCallSchema.optional(),
39
+ }).strict();
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+ export declare const RevenueSchema: any;
3
+ export declare const CallPayment_DataSchema: any;
4
+ export declare const CallPayment_InputSchema: any;
5
+ export type Revenue = z.infer<typeof RevenueSchema>;
6
+ export type CallPayment_Data = z.infer<typeof CallPayment_DataSchema>;
7
+ export type CallPayment_Input = z.infer<typeof CallPayment_InputSchema>;
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ import { PaymentInfoSchema } from "../query/index.js";
3
+ import { CoinParamSchema, CallEnvSchema, TypeNamedObjectSchema } from "./base.js";
4
+ import { AccountOrMark_AddressSchema } from "../common/index.js";
5
+ // 定义Revenue schema
6
+ export const RevenueSchema = z.object({
7
+ recipient: AccountOrMark_AddressSchema,
8
+ amount: CoinParamSchema
9
+ }).strict().describe("Payment recipient and amount");
10
+ // 定义CallPayment_Data schema
11
+ export const CallPayment_DataSchema = z.object({
12
+ object: TypeNamedObjectSchema,
13
+ revenue: z.array(RevenueSchema).describe("Array of payment recipients and amounts"),
14
+ info: PaymentInfoSchema
15
+ }).strict().describe("On-chain Payment creation. USAGE: Set 'object' field with {name, type, ...} to create a named Payment. NOTE: 'name' goes INSIDE 'object', NOT at the data root level. Payment is an immutable object - it can only be created, not modified. The 'object' field is CRITICAL and REQUIRED.");
16
+ // 定义输入schema
17
+ export const CallPayment_InputSchema = z.object({
18
+ data: CallPayment_DataSchema,
19
+ env: CallEnvSchema.optional(),
20
+ }).strict();
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
2
+ export declare const RemarkSetSchema: any;
3
+ export declare const RemarkRemoveSchema: any;
4
+ export declare const RemarkClearSchema: any;
5
+ export declare const RemarkSchema: any;
6
+ export declare const TablePermByIndexSchema: any;
7
+ export declare const TablePermByEntitySchema: any;
8
+ export declare const TableSchema: any;
9
+ export declare const EntitySwapReplaceCopySchema: any;
10
+ export declare const EntityDelSchema: any;
11
+ export declare const EntitySchema: any;
12
+ export declare const AdminSchema: any;
13
+ export declare const CallPermission_DataSchema: any;
14
+ export declare const CallPermission_InputSchema: any;
15
+ export type RemarkSet = z.infer<typeof RemarkSetSchema>;
16
+ export type RemarkRemove = z.infer<typeof RemarkRemoveSchema>;
17
+ export type RemarkClear = z.infer<typeof RemarkClearSchema>;
18
+ export type Remark = z.infer<typeof RemarkSchema>;
19
+ export type TablePermByIndex = z.infer<typeof TablePermByIndexSchema>;
20
+ export type TablePermByEntity = z.infer<typeof TablePermByEntitySchema>;
21
+ export type Table = z.infer<typeof TableSchema>;
22
+ export type EntitySwapReplaceCopy = z.infer<typeof EntitySwapReplaceCopySchema>;
23
+ export type EntityDel = z.infer<typeof EntityDelSchema>;
24
+ export type Entity = z.infer<typeof EntitySchema>;
25
+ export type Admin = z.infer<typeof AdminSchema>;
26
+ export type CallPermission_Data = z.infer<typeof CallPermission_DataSchema>;
27
+ export type CallPermission_Input = z.infer<typeof CallPermission_InputSchema>;