wowok_agent 2.1.37 → 2.1.39
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.
- package/dist/index.d.ts +45 -2
- package/dist/index.js +1 -1319
- package/dist/schema/call/allocation.js +1 -27
- package/dist/schema/call/arbitration.js +1 -106
- package/dist/schema/call/base.js +1 -152
- package/dist/schema/call/contact.js +1 -41
- package/dist/schema/call/demand.js +1 -51
- package/dist/schema/call/guard.d.ts +6 -6
- package/dist/schema/call/guard.js +1 -67
- package/dist/schema/call/handler.d.ts +0 -45
- package/dist/schema/call/handler.js +1 -214
- package/dist/schema/call/index.js +1 -19
- package/dist/schema/call/machine.js +1 -164
- package/dist/schema/call/order.js +1 -39
- package/dist/schema/call/payment.js +1 -20
- package/dist/schema/call/permission.js +1 -118
- package/dist/schema/call/personal.js +1 -81
- package/dist/schema/call/progress.js +1 -28
- package/dist/schema/call/proof.js +1 -27
- package/dist/schema/call/repository.js +1 -85
- package/dist/schema/call/reward.d.ts +12 -0
- package/dist/schema/call/reward.js +1 -46
- package/dist/schema/call/service.js +1 -88
- package/dist/schema/call/treasury.d.ts +84 -0
- package/dist/schema/call/treasury.js +1 -76
- package/dist/schema/common/index.js +1 -395
- package/dist/schema/index.js +1 -8
- package/dist/schema/local/index.js +1 -913
- package/dist/schema/local/wip.js +1 -230
- package/dist/schema/messenger/index.d.ts +0 -2
- package/dist/schema/messenger/index.js +1 -479
- package/dist/schema/query/index.d.ts +155 -0
- package/dist/schema/query/index.js +1 -1256
- package/dist/schema/utils/guard-parser.js +1 -410
- package/dist/schema/utils/guard-query-utils.js +1 -22
- package/dist/schema/utils/node-parser.d.ts +0 -14
- package/dist/schema/utils/node-parser.js +1 -382
- package/dist/schema/utils/permission-index-utils.js +1 -10
- package/package.json +5 -3
|
@@ -1,29 +1,14 @@
|
|
|
1
1
|
import type { CallEnv } from "wowok";
|
|
2
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
3
|
export declare function handleCallResult(result: any): {
|
|
9
4
|
content: any[];
|
|
10
5
|
structuredContent: CallOutput;
|
|
11
6
|
};
|
|
12
|
-
/**
|
|
13
|
-
* Create standard MCP Server configuration
|
|
14
|
-
* @param packageJson package.json content
|
|
15
|
-
* @param description server description (overrides packageJson.description)
|
|
16
|
-
* @returns MCP Server configuration
|
|
17
|
-
*/
|
|
18
7
|
export declare function createServerConfig(packageJson: any, description?: string): {
|
|
19
8
|
name: any;
|
|
20
9
|
version: any;
|
|
21
10
|
description: any;
|
|
22
11
|
};
|
|
23
|
-
/**
|
|
24
|
-
* Create MCP Server capabilities configuration
|
|
25
|
-
* @returns Capabilities configuration
|
|
26
|
-
*/
|
|
27
12
|
export declare function createCapabilitiesConfig(): {
|
|
28
13
|
capabilities: {
|
|
29
14
|
prompts: {};
|
|
@@ -34,12 +19,6 @@ export declare function createCapabilitiesConfig(): {
|
|
|
34
19
|
logging: {};
|
|
35
20
|
};
|
|
36
21
|
};
|
|
37
|
-
/**
|
|
38
|
-
* Create standard tool metadata
|
|
39
|
-
* @param category Tool category
|
|
40
|
-
* @param tags Tool tags
|
|
41
|
-
* @returns Tool metadata
|
|
42
|
-
*/
|
|
43
22
|
export declare function createToolMeta(category: string, tags: string[]): {
|
|
44
23
|
author: string;
|
|
45
24
|
createdAt: string;
|
|
@@ -48,36 +27,12 @@ export declare function createToolMeta(category: string, tags: string[]): {
|
|
|
48
27
|
tags: string[];
|
|
49
28
|
requiresAuth: boolean;
|
|
50
29
|
};
|
|
51
|
-
/**
|
|
52
|
-
* Create standard tool annotations
|
|
53
|
-
* @param readOnlyHint Whether read-only
|
|
54
|
-
* @param destructiveHint Whether destructive
|
|
55
|
-
* @returns Tool annotations
|
|
56
|
-
*/
|
|
57
30
|
export declare function createToolAnnotations(readOnlyHint?: boolean, destructiveHint?: boolean): {
|
|
58
31
|
readOnlyHint: boolean;
|
|
59
32
|
destructiveHint: boolean;
|
|
60
33
|
idempotentHint: boolean;
|
|
61
34
|
openWorldHint: boolean;
|
|
62
35
|
};
|
|
63
|
-
/**
|
|
64
|
-
* Process submission parameter transformation
|
|
65
|
-
* Resolves Guard names to addresses using LocalMark
|
|
66
|
-
* Throws error if name cannot be resolved to address
|
|
67
|
-
* @param submission submission parameter
|
|
68
|
-
* @returns Transformed submission parameter
|
|
69
|
-
*/
|
|
70
36
|
export declare function transformSubmission(submission: any): Promise<any>;
|
|
71
|
-
/**
|
|
72
|
-
* Validate input data
|
|
73
|
-
* @param data Input data
|
|
74
|
-
* @param schema Zod schema
|
|
75
|
-
* @returns Validated data
|
|
76
|
-
*/
|
|
77
37
|
export declare function validateInput<T>(data: any, schema: any): T;
|
|
78
|
-
/**
|
|
79
|
-
* Get environment configuration
|
|
80
|
-
* @param env Environment parameters
|
|
81
|
-
* @returns Environment configuration
|
|
82
|
-
*/
|
|
83
38
|
export declare function getEnvConfig(env?: any): CallEnv;
|
|
@@ -1,214 +1 @@
|
|
|
1
|
-
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { ResponseData, LocalMark } 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
|
-
* @param description server description (overrides packageJson.description)
|
|
89
|
-
* @returns MCP Server configuration
|
|
90
|
-
*/
|
|
91
|
-
export function createServerConfig(packageJson, description) {
|
|
92
|
-
return {
|
|
93
|
-
name: packageJson.name,
|
|
94
|
-
version: packageJson.version,
|
|
95
|
-
description: description || packageJson.description,
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Create MCP Server capabilities configuration
|
|
100
|
-
* @returns Capabilities configuration
|
|
101
|
-
*/
|
|
102
|
-
export function createCapabilitiesConfig() {
|
|
103
|
-
return {
|
|
104
|
-
capabilities: {
|
|
105
|
-
prompts: {},
|
|
106
|
-
resources: {},
|
|
107
|
-
tools: { listChanged: true },
|
|
108
|
-
logging: {},
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Create standard tool metadata
|
|
114
|
-
* @param category Tool category
|
|
115
|
-
* @param tags Tool tags
|
|
116
|
-
* @returns Tool metadata
|
|
117
|
-
*/
|
|
118
|
-
export function createToolMeta(category, tags) {
|
|
119
|
-
return {
|
|
120
|
-
author: "WOWOK Team",
|
|
121
|
-
createdAt: "2026-02-01",
|
|
122
|
-
lastUpdated: "2026-02-01",
|
|
123
|
-
category,
|
|
124
|
-
tags,
|
|
125
|
-
requiresAuth: false,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Create standard tool annotations
|
|
130
|
-
* @param readOnlyHint Whether read-only
|
|
131
|
-
* @param destructiveHint Whether destructive
|
|
132
|
-
* @returns Tool annotations
|
|
133
|
-
*/
|
|
134
|
-
export function createToolAnnotations(readOnlyHint = false, destructiveHint = false) {
|
|
135
|
-
return {
|
|
136
|
-
readOnlyHint,
|
|
137
|
-
destructiveHint,
|
|
138
|
-
idempotentHint: true,
|
|
139
|
-
openWorldHint: false,
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Process submission parameter transformation
|
|
144
|
-
* Resolves Guard names to addresses using LocalMark
|
|
145
|
-
* Throws error if name cannot be resolved to address
|
|
146
|
-
* @param submission submission parameter
|
|
147
|
-
* @returns Transformed submission parameter
|
|
148
|
-
*/
|
|
149
|
-
export async function transformSubmission(submission) {
|
|
150
|
-
if (!submission)
|
|
151
|
-
return undefined;
|
|
152
|
-
// Collect all guard names/addresses that need resolution
|
|
153
|
-
const guardNames = (submission.guard || []).map((g) => g.object).filter(Boolean);
|
|
154
|
-
const submissionGuardNames = (submission.submission || []).map((s) => s.guard).filter(Boolean);
|
|
155
|
-
const allNames = [...new Set([...guardNames, ...submissionGuardNames])];
|
|
156
|
-
// Batch resolve names to addresses
|
|
157
|
-
const resolvedAddresses = allNames.length > 0
|
|
158
|
-
? await LocalMark.Instance().get_many_address(allNames)
|
|
159
|
-
: [];
|
|
160
|
-
// Create name to address mapping
|
|
161
|
-
const nameToAddress = new Map();
|
|
162
|
-
allNames.forEach((name, index) => {
|
|
163
|
-
const addr = resolvedAddresses[index];
|
|
164
|
-
if (addr) {
|
|
165
|
-
nameToAddress.set(name, addr);
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
// Helper function: get address or throw error if not found
|
|
169
|
-
const getAddress = (name) => {
|
|
170
|
-
// If it's already a valid address, return it
|
|
171
|
-
if (nameToAddress.has(name)) {
|
|
172
|
-
return nameToAddress.get(name);
|
|
173
|
-
}
|
|
174
|
-
// If it was resolved from a name, return the address
|
|
175
|
-
for (const [n, addr] of nameToAddress.entries()) {
|
|
176
|
-
if (n === name)
|
|
177
|
-
return addr;
|
|
178
|
-
}
|
|
179
|
-
// If name looks like an address (starts with 0x), return it directly
|
|
180
|
-
if (name.startsWith("0x") && name.length === 66) {
|
|
181
|
-
return name;
|
|
182
|
-
}
|
|
183
|
-
// Otherwise, throw error
|
|
184
|
-
throw new Error(`Guard name or address not found: ${name}`);
|
|
185
|
-
};
|
|
186
|
-
return {
|
|
187
|
-
type: "submission",
|
|
188
|
-
guard: (submission.guard || []).map((g) => ({
|
|
189
|
-
object: getAddress(g.object),
|
|
190
|
-
impack: g.impack || false,
|
|
191
|
-
})),
|
|
192
|
-
submission: (submission.submission || []).map((s) => ({
|
|
193
|
-
guard: getAddress(s.guard),
|
|
194
|
-
submission: s.submission || [],
|
|
195
|
-
})),
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Validate input data
|
|
200
|
-
* @param data Input data
|
|
201
|
-
* @param schema Zod schema
|
|
202
|
-
* @returns Validated data
|
|
203
|
-
*/
|
|
204
|
-
export function validateInput(data, schema) {
|
|
205
|
-
return schema.parse(data);
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Get environment configuration
|
|
209
|
-
* @param env Environment parameters
|
|
210
|
-
* @returns Environment configuration
|
|
211
|
-
*/
|
|
212
|
-
export function getEnvConfig(env) {
|
|
213
|
-
return env || {};
|
|
214
|
-
}
|
|
1
|
+
import{ResponseData,LocalMark,enrichMoveError}from'wowok';export function handleCallResult(a){if(a&&'error'in a){const c=enrichMoveError(a['error']),d={'message':'Error:\x20'+c,'result':{'type':'error','error':c}};return{'content':[{'type':'text','text':d['message']}],'structuredContent':d};}if(a&&'digest'in a){const e=ResponseData(a),f=a?.['effects']?.['status']?.['status'],g=a?.['effects']?.['status']?.['error'],h=f==='success';if(!h){const j=enrichMoveError(g||f||'unknown\x20error'),k={'message':'Transaction\x20failed:\x20'+j,'result':{'type':'error','error':j}};return{'content':[{'type':'text','text':k['message']},{'type':'text','text':JSON['stringify'](e)}],'structuredContent':k};}const i={'message':'Transaction\x20completed\x20successfully','result':{'type':'transaction',...a}};return{'content':[{'type':'text','text':i['message']},{'type':'text','text':JSON['stringify'](e)}],'structuredContent':i};}if(a&&'guard'in a&&'submission'in a){const l={'message':'Submission\x20required\x20for\x20Guard\x20verification','result':{'type':'submission',...a}};return{'content':[{'type':'text','text':l['message']},{'type':'text','text':JSON['stringify'](a)}],'structuredContent':l};}if(Array['isArray'](a)){const m={'message':'Operation\x20completed','result':{'type':'data','data':a}};return{'content':[{'type':'text','text':m['message']},{'type':'text','text':JSON['stringify'](a)}],'structuredContent':m};}if(a===undefined||a===null){const n={'message':'Operation\x20completed','result':{'type':'null'}};return{'content':[{'type':'text','text':n['message']}],'structuredContent':n};}const b={'message':'Operation\x20completed','result':{'type':'transaction',...a}};return{'content':[{'type':'text','text':b['message']}],'structuredContent':b};}export function createServerConfig(a,b){return{'name':a['name'],'version':a['version'],'description':b||a['description']};}export function createCapabilitiesConfig(){return{'capabilities':{'prompts':{},'resources':{},'tools':{'listChanged':!![]},'logging':{}}};}export function createToolMeta(a,b){return{'author':'WOWOK\x20Team','createdAt':'2026-02-01','lastUpdated':'2026-02-01','category':a,'tags':b,'requiresAuth':![]};}export function createToolAnnotations(a=![],b=![]){return{'readOnlyHint':a,'destructiveHint':b,'idempotentHint':!![],'openWorldHint':![]};}export async function transformSubmission(a){if(!a)return undefined;const b=(a['guard']||[])['map'](h=>h['object'])['filter'](Boolean),c=(a['submission']||[])['map'](h=>h['guard'])['filter'](Boolean),d=[...new Set([...b,...c])],e=d['length']>0x0?await LocalMark['Instance']()['get_many_address'](d):[],f=new Map();d['forEach']((h,i)=>{const j=e[i];j&&f['set'](h,j);});const g=h=>{if(f['has'](h))return f['get'](h);for(const [i,j]of f['entries']()){if(i===h)return j;}if(h['startsWith']('0x')&&h['length']===0x42)return h;throw new Error('Guard\x20name\x20or\x20address\x20not\x20found:\x20'+h);};return{'type':'submission','guard':(a['guard']||[])['map'](h=>({'object':g(h['object']),'impack':h['impack']||![]})),'submission':(a['submission']||[])['map'](h=>({'guard':g(h['guard']),'submission':h['submission']||[]}))};}export function validateInput(a,b){return b['parse'](a);}export function getEnvConfig(a){return a||{};}
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
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';
|
|
1
|
+
export*from'./base.js';export*from'./handler.js';export*from'./contact.js';export*from'./demand.js';export*from'./guard.js';export*from'./machine.js';export*from'./arbitration.js';export*from'./allocation.js';export*from'./order.js';export*from'./payment.js';export*from'./permission.js';export*from'./personal.js';export*from'./proof.js';export*from'./progress.js';export*from'./repository.js';export*from'./reward.js';export*from'./service.js';export*from'./treasury.js';
|
|
@@ -1,164 +1 @@
|
|
|
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. Use empty string "" to indicate the order permission (order owner and agents can operate). When using Order object to operate progress, empty string namedOperator allows order owner/agents to execute the forward without needing other permissions.'),
|
|
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");
|
|
1
|
+
import{z}from'zod';import{WithPermissionObjectSchema,NamedObjectSchema,ObjectsSchema,CallEnvSchema,SubmissionCallSchema}from'./base.js';import{MachineNodeSchema,PermissionIndexTypeSchema}from'../query/index.js';import{ManyAccountOrMark_AddressSchema,NameOrAddressSchema,NameSchema,NotEmptyNameSchema,ReceivedObjectsOrRecentlySchema}from'../common/index.js';export const ProgressNamedOperatorSchema=z['object']({'op':z['union']([z['literal']('add'),z['literal']('set'),z['literal']('remove')]),'name':NotEmptyNameSchema,'operators':ManyAccountOrMark_AddressSchema})['strict']();export const ProgressNewSchema=z['object']({'task':z['union']([NameOrAddressSchema,z['null']()])['optional']()['describe']('Task\x20bound\x20to\x20the\x20Progress\x20object.\x20It\x20is\x20an\x20object\x20ID\x20or\x20name'),'repository':ObjectsSchema['optional']()['describe']('Set\x20repository\x20list\x20for\x20the\x20Progress\x20object.\x20Used\x20for\x20consensus\x20data\x20management.'),'progress_namedOperator':ProgressNamedOperatorSchema['optional']()['describe']('Add,\x20set,\x20and\x20remove\x20operators\x20for\x20the\x20permission\x20namespace\x20of\x20the\x20Progress\x20object.'),'namedNew':NamedObjectSchema['optional']()})['strict']();export const NodeAddForwardDataSchema=z['object']({'prior_node_name':NameSchema['describe']('Name\x20of\x20the\x20previous\x20node.'),'node_name':NameSchema['describe']('Name\x20of\x20the\x20next\x20node.'),'forward':z['array'](z['object']({'name':NameSchema['describe']('Name\x20of\x20the\x20operation'),'namedOperator':z['union']([NotEmptyNameSchema,z['null']()])['optional']()['describe']('One\x20of\x20the\x20operation\x20permissions:\x20use\x20operators\x20within\x20the\x20permission\x20space\x20name\x20in\x20the\x20Machine\x20object.\x20Each\x20Progress\x20object\x20can\x20manage\x20operators\x20independently.\x20Use\x20empty\x20string\x20\x22\x22\x20to\x20indicate\x20the\x20order\x20permission\x20(order\x20owner\x20and\x20agents\x20can\x20operate).\x20When\x20using\x20Order\x20object\x20to\x20operate\x20progress,\x20empty\x20string\x20namedOperator\x20allows\x20order\x20owner/agents\x20to\x20execute\x20the\x20forward\x20without\x20needing\x20other\x20permissions.'),'permissionIndex':z['union']([PermissionIndexTypeSchema,z['null']()])['optional']()['describe']('Second\x20operation\x20permission:\x20use\x20operators\x20specified\x20by\x20the\x20permission\x20index\x20of\x20the\x20Permission\x20object\x20in\x20the\x20Machine\x20object.\x20All\x20Progress\x20objects\x20share\x20the\x20same\x20operators.'),'weight':z['number']()['min'](0x0)['max'](0xffff)['int']()['describe']('Weight\x20of\x20the\x20operation')})['strict']())['describe']('List\x20of\x20operations\x20between\x20the\x20previous\x20and\x20next\x20nodes.'),'threshold':z['union']([z['number']()['int']()['min'](0x0),z['null']()])['optional']()['describe']('Threshold\x20of\x20operations\x20that\x20need\x20to\x20be\x20completed\x20to\x20migrate\x20from\x20the\x20previous\x20node\x20to\x20the\x20next\x20node.')})['strict']();export const NodeRemoveForwardDataSchema=z['object']({'prior_node_name':NameSchema['describe']('Name\x20of\x20the\x20previous\x20node.'),'node_name':NameSchema['describe']('Name\x20of\x20the\x20next\x20node.'),'forward_name':z['array'](NameSchema)['describe']('List\x20of\x20operation\x20names\x20to\x20delete.')})['strict']();export const NodeRemovePriorNodeDataSchema=z['object']({'prior_node_name':z['array'](NameSchema)['describe']('List\x20of\x20previous\x20node\x20names\x20to\x20delete.'),'node_name':NameSchema['describe']('Name\x20of\x20the\x20next\x20node.')})['strict']();export const NodeSchema=z['discriminatedUnion']('op',[z['object']({'op':z['literal']('add'),'nodes':z['array'](MachineNodeSchema)['describe']('List\x20of\x20nodes\x20to\x20add\x20or\x20set.'),'bReplace':z['boolean']()['optional']()['describe']('Whether\x20to\x20replace\x20existing\x20nodes.\x20If\x20true,\x20existing\x20nodes\x20will\x20be\x20replaced;\x20if\x20false,\x20nodes\x20will\x20be\x20added\x20by\x20merging.')})['strict']()['describe']('Add\x20nodes.'),z['object']({'op':z['literal']('set'),'nodes':z['array'](MachineNodeSchema)['describe']('List\x20of\x20nodes\x20to\x20add\x20or\x20set.'),'bReplace':z['boolean']()['optional']()['describe']('Whether\x20to\x20replace\x20existing\x20nodes.\x20If\x20true,\x20existing\x20nodes\x20will\x20be\x20replaced;\x20if\x20false,\x20nodes\x20will\x20be\x20added\x20by\x20merging.')})['strict']()['describe']('Set\x20nodes.'),z['object']({'op':z['literal']('remove'),'nodes':z['array'](NameSchema)['describe']('List\x20of\x20node\x20names\x20to\x20delete.')})['strict']()['describe']('Delete\x20nodes.'),z['object']({'op':z['literal']('clear')})['strict']()['describe']('Clear\x20all\x20nodes.'),z['object']({'op':z['literal']('exchange'),'node_one':NameSchema['describe']('Name\x20of\x20the\x20first\x20node.'),'node_other':NameSchema['describe']('Name\x20of\x20the\x20second\x20node.')})['strict']()['describe']('Exchange\x20the\x20positions\x20of\x20two\x20nodes.'),z['object']({'op':z['literal']('rename'),'node_name_old':NameSchema['describe']('Name\x20of\x20thenode.'),'node_name_new':NameSchema['describe']('New\x20name\x20of\x20the\x20node.')})['strict']()['describe']('Rename\x20node.'),z['object']({'op':z['literal']('remove\x20prior\x20node'),'pairs':z['array'](NodeRemovePriorNodeDataSchema)['describe']('List\x20of\x20previous-next\x20node\x20pairs\x20to\x20delete.')})['strict']()['describe']('Delete\x20previous-next\x20node\x20pairs.'),z['object']({'op':z['literal']('add\x20forward'),'data':z['array'](NodeAddForwardDataSchema)['describe']('List\x20of\x20operations\x20to\x20add.')})['strict']()['describe']('Add\x20operations.'),z['object']({'op':z['literal']('remove\x20forward'),'data':z['array'](NodeRemoveForwardDataSchema)['describe']('List\x20of\x20operations\x20to\x20delete.')})['strict']()['describe']('Delete\x20operations.')]);export const NodeJsonOrMarkdownFileSchema=z['object']({'json_or_markdown_file':z['string']()['describe']('Path\x20to\x20a\x20JSON\x20or\x20Markdown\x20file\x20containing\x20node\x20array\x20for\x20COMPLETE\x20REPLACEMENT\x20of\x20all\x20nodes.\x0a\x0a**File\x20Format\x20Requirements:**\x0a-\x20Must\x20contain\x20a\x20JSON\x20ARRAY\x20of\x20node\x20objects:\x20[{\x22name\x22:\x20\x22...\x22,\x20\x22pairs\x22:\x20[...]},\x20{...}]\x0a-\x20NOT\x20an\x20operation\x20object\x20with\x20\x22op\x22\x20field\x20(use\x20NodeSchema\x20for\x20operations)\x0a-\x20Supports\x20JSON\x20or\x20Markdown\x20(with\x20```json\x20code\x20blocks)\x0a\x0a**Node\x20Structure:**\x0aEach\x20node\x20is\x20a\x20directed\x20graph\x20element\x20representing\x20workflow\x20states\x20and\x20transitions:\x0a-\x20name:\x20Node\x20identifier\x0a-\x20pairs:\x20Array\x20of\x20{prior_node,\x20forwards,\x20threshold}\x20defining\x20connections\x0a-\x20forwards:\x20Operations\x20available\x20from\x20this\x20node\x0a-\x20threshold:\x20Required\x20weight\x20to\x20advance\x0a\x0a**Behavior:**\x0a-\x20COMPLETELY\x20REPLACES\x20all\x20existing\x20nodes\x20(equivalent\x20to\x20\x22set\x22\x20with\x20bReplace=true)\x0a-\x20Auto-detects\x20format\x20based\x20on\x20file\x20content\x0a-\x20If\x20parsing\x20fails,\x20error\x20includes\x20line\x20number\x20and\x20column\x20information')})['strict']();export const NodeFieldSchema=z['union']([NodeSchema,NodeJsonOrMarkdownFileSchema]);export const CallMachine_DataSchema=z['object']({'object':WithPermissionObjectSchema,'progress_new':ProgressNewSchema['optional']()['describe']('Generate\x20new\x20Progress\x20object.'),'description':z['string']()['optional']()['describe']('Description\x20of\x20the\x20object.'),'repository':ObjectsSchema['optional']()['describe']('Set\x20repository\x20list\x20for\x20the\x20object.\x20Used\x20for\x20consensus\x20data\x20management.'),'node':NodeFieldSchema['optional']()['describe']('CRITICAL:\x20Choose\x20ONE\x20of\x20two\x20mutually\x20exclusive\x20modes:\x0a\x0a**Mode\x201:\x20NodeSchema\x20(incremental\x20operations)**\x0aUse\x20for\x20partial\x20modifications:\x20add,\x20set,\x20remove,\x20clear,\x20exchange,\x20rename,\x20remove\x20prior\x20node,\x20add\x20forward,\x20remove\x20forward.\x0aFormat:\x20{\x20\x22op\x22:\x20\x22add\x22,\x20\x22nodes\x22:\x20[...],\x20\x22bReplace\x22:\x20false\x20}\x0aThis\x20mode\x20modifies\x20existing\x20nodes\x20incrementally.\x0a\x0a**Mode\x202:\x20NodeJsonOrMarkdownFileSchema\x20(complete\x20replacement)**\x0aUse\x20for\x20complete\x20node\x20redefinition\x20from\x20file.\x0aFormat:\x20{\x20\x22json_or_markdown_file\x22:\x20\x22/path/to/nodes.json\x22\x20}\x0aIMPORTANT:\x20This\x20COMPLETELY\x20REPLACES\x20all\x20existing\x20nodes.\x20File\x20must\x20contain\x20node\x20array\x20[{...},\x20{...}],\x20NOT\x20an\x20operation\x20object\x20with\x20\x22op\x22\x20field.\x0aSupported\x20formats:\x20JSON\x20array\x20or\x20Markdown\x20with\x20code\x20blocks.\x0aIf\x20parsing\x20fails,\x20error\x20includes\x20line\x20number\x20and\x20column\x20information.'),'pause':z['boolean']()['optional']()['describe']('Whether\x20to\x20pause\x20generating\x20new\x20Progress\x20objects.'),'publish':z['boolean']()['optional']()['describe']('Whether\x20to\x20publish\x20the\x20object.\x20After\x20the\x20object\x20is\x20published,\x20new\x20Progress\x20objects\x20can\x20be\x20generated;\x20and\x20node\x20settings\x20will\x20no\x20longer\x20be\x20changeable.'),'owner_receive':ReceivedObjectsOrRecentlySchema['optional']()['describe']('Unwrap\x20CoinWrapper\x20objects\x20and\x20other\x20objects\x20received\x20by\x20this\x20object\x20and\x20send\x20them\x20to\x20the\x20owner\x20of\x20its\x20Permission\x20object.'),'um':z['union']([z['string'](),z['null']()])['optional']()['describe']('Contact\x20object.')})['strict']()['describe']('On-chain\x20Machine\x20operations.\x20USAGE:\x20(1)\x20CREATE\x20NEW:\x20Set\x20\x27object\x27\x20field\x20with\x20OBJECT\x20format\x20{name,\x20permission,\x20...}\x20to\x20create\x20a\x20Machine.\x20NOTE:\x20\x27name\x27\x20goes\x20INSIDE\x20\x27object\x27,\x20NOT\x20at\x20the\x20data\x20root\x20level.\x20\x27permission\x27\x20can\x20be\x20a\x20new\x20Permission\x20object\x20or\x20reference\x20an\x20existing\x20one\x20-\x20check\x20\x27object\x27\x20field\x20description\x20for\x20details.\x20(2)\x20OPERATE\x20EXISTING:\x20Set\x20\x27object\x27\x20field\x20with\x20STRING\x20format\x20(object\x20ID\x20or\x20name).\x20The\x20\x27object\x27\x20field\x20is\x20CRITICAL\x20and\x20REQUIRED\x20in\x20both\x20cases.\x20STRING\x20for\x20existing,\x20OBJECT\x20for\x20new\x20creation.');export const CallMachine_InputSchema=z['object']({'data':CallMachine_DataSchema,'env':CallEnvSchema['optional'](),'submission':SubmissionCallSchema['optional']()})['strict']();export const MachineNode2File_InputSchema=z['object']({'machine':NameOrAddressSchema['describe']('Machine\x20object\x20ID\x20or\x20name\x20to\x20export'),'file_path':z['string']()['describe']('Output\x20file\x20path\x20(absolute\x20or\x20relative)'),'format':z['enum'](['json','markdown'])['optional']()['describe']('Output\x20format:\x20\x27json\x27\x20(default)\x20or\x20\x27markdown\x27'),'env':CallEnvSchema['optional']()})['strict']()['describe']('Query\x20a\x20Machine\x20object\x20from\x20the\x20blockchain\x20and\x20export\x20its\x20node\x20definition\x20to\x20a\x20JSON\x20or\x20Markdown\x20file.\x20The\x20exported\x20file\x20can\x20be\x20edited\x20and\x20used\x20to\x20create\x20new\x20Machine\x20objects.');export const MachineNode2File_OutputSchema=z['discriminatedUnion']('status',[z['object']({'status':z['literal']('success'),'data':z['object']({'file_path':z['string']()['describe']('Absolute\x20path\x20of\x20the\x20exported\x20file'),'format':z['enum'](['json','markdown'])['describe']('Export\x20format'),'machine_object':NameOrAddressSchema['describe']('Machine\x20object\x20ID'),'node_count':z['number']()['describe']('Number\x20of\x20nodes\x20exported')})['strict']()['describe']('Success\x20result\x20data')})['strict'](),z['object']({'status':z['literal']('error'),'error':z['string']()['describe']('Error\x20message')})['strict']()])['describe']('MachineNode2File\x20operation\x20output');export const MachineNode2File_OutputWrappedSchema=z['object']({'result':MachineNode2File_OutputSchema})['strict']()['describe']('MachineNode2File\x20operation\x20output\x20wrapped\x20schema');
|
|
@@ -1,39 +1 @@
|
|
|
1
|
-
import { z }
|
|
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();
|
|
1
|
+
import{z}from'zod';import{CallEnvSchema,SubmissionCallSchema}from'./base.js';import{OperateSchema}from'./progress.js';import{AccountOrMark_AddressSchema,DescriptionSchema,LongNameSchema,ManyAccountOrMark_AddressSchema,NameOrAddressSchema}from'../common/index.js';import{QueryReceivedResultSchema}from'../common/index.js';export const ArbConfirmSchema=z['object']({'arb':NameOrAddressSchema['describe']('Arb\x20object\x20ID\x20or\x20name.'),'confirm':z['boolean']()['describe']('Whether\x20to\x20confirm\x20that\x20the\x20submitted\x20arbitration\x20materials\x20are\x20valid\x20for\x20arbitration.'),'description':DescriptionSchema['optional']()['describe']('Message\x20description\x20for\x20compensation\x20application.'),'proposition':z['array'](LongNameSchema)['optional']()['describe']('Compensation\x20claims.')})['strict']();export const ArbObjectionSchema=z['object']({'arb':NameOrAddressSchema['describe']('Arb\x20object\x20ID\x20or\x20name.'),'objection':DescriptionSchema['describe']('Oppose\x20and\x20appeal\x20the\x20arbitration\x20result,\x20request\x20re-arbitration')})['strict']();export const ArbClaimCompensationSchema=z['object']({'arb':NameOrAddressSchema['describe']('Arb\x20object\x20ID\x20or\x20name.')})['strict']();export const CallOrder_DataSchema=z['object']({'object':NameOrAddressSchema['describe']('Order\x20object\x20ID\x20or\x20name.'),'agents':ManyAccountOrMark_AddressSchema['optional']()['describe']('Order\x20agents.\x20Agents\x20can\x20operate\x20the\x20order,\x20such\x20as\x20canceling\x20the\x20order,\x20modifying\x20the\x20order\x20status,\x20etc.;\x20but\x20cannot\x20receive\x20the\x20funds\x20received\x20by\x20the\x20order.'),'required_info':z['union']([NameOrAddressSchema,z['null']()])['optional']()['describe']('Contact\x20object\x20ID\x20(recipient)\x20or\x20WTS\x20Proof\x20object\x20(delivery\x20proof)\x20that\x20information\x20has\x20been\x20delivered\x20via\x20Wowok\x20Messenger.'),'progress':OperateSchema['optional']()['describe']('Advance\x20order\x20process'),'arb_confirm':ArbConfirmSchema['optional']()['describe']('Submit\x20compensation\x20request\x20and\x20apply\x20for\x20arbitration'),'arb_objection':ArbObjectionSchema['optional']()['describe']('Oppose\x20and\x20appeal\x20the\x20arbitration\x20result,\x20request\x20re-arbitration.'),'arb_claim_compensation':ArbClaimCompensationSchema['optional']()['describe']('Specify\x20the\x20adjudicated\x20Arb\x20object\x20to\x20obtain\x20order\x20compensation.'),'receive':QueryReceivedResultSchema['optional']()['describe']('Unwrap\x20CoinWrapper\x20objects\x20or\x20other\x20objects\x20received\x20by\x20the\x20order\x20and\x20transfer\x20them\x20to\x20the\x20order\x20owner'),'transfer_to':AccountOrMark_AddressSchema['optional']()['describe']('Set\x20new\x20owner\x20of\x20the\x20order.\x20Requires\x20order\x20owner\x20permission\x20to\x20set.')})['strict']()['describe']('On-chain,\x20operate\x20on\x20an\x20Order\x20object.');export const CallOrder_InputSchema=z['object']({'data':CallOrder_DataSchema,'env':CallEnvSchema['optional'](),'submission':SubmissionCallSchema['optional']()})['strict']();
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
import { z
|
|
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();
|
|
1
|
+
import{z}from'zod';import{PaymentInfoSchema}from'../query/index.js';import{CoinParamSchema,CallEnvSchema,TypeNamedObjectSchema}from'./base.js';import{AccountOrMark_AddressSchema}from'../common/index.js';export const RevenueSchema=z['object']({'recipient':AccountOrMark_AddressSchema,'amount':CoinParamSchema})['strict']()['describe']('Payment\x20recipient\x20and\x20amount');export const CallPayment_DataSchema=z['object']({'object':TypeNamedObjectSchema,'revenue':z['array'](RevenueSchema)['describe']('Array\x20of\x20payment\x20recipients\x20and\x20amounts'),'info':PaymentInfoSchema})['strict']()['describe']('On-chain\x20Payment\x20creation.\x20USAGE:\x20Set\x20\x27object\x27\x20field\x20with\x20{name,\x20type,\x20...}\x20to\x20create\x20a\x20named\x20Payment.\x20NOTE:\x20\x27name\x27\x20goes\x20INSIDE\x20\x27object\x27,\x20NOT\x20at\x20the\x20data\x20root\x20level.\x20Payment\x20is\x20an\x20immutable\x20object\x20-\x20it\x20can\x20only\x20be\x20created,\x20not\x20modified.\x20The\x20\x27object\x27\x20field\x20is\x20CRITICAL\x20and\x20REQUIRED.');export const CallPayment_InputSchema=z['object']({'data':CallPayment_DataSchema,'env':CallEnvSchema['optional']()})['strict']();
|