wowok_agent 2.1.40 → 2.2.1
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 +2064 -177
- package/dist/index.js +1284 -1
- package/dist/schema/call/allocation.js +24 -1
- package/dist/schema/call/arbitration.js +92 -1
- package/dist/schema/call/base.d.ts +1 -1
- package/dist/schema/call/base.js +138 -1
- package/dist/schema/call/contact.js +37 -1
- package/dist/schema/call/demand.js +47 -1
- package/dist/schema/call/guard.js +58 -1
- package/dist/schema/call/handler.js +171 -1
- package/dist/schema/call/index.js +18 -1
- package/dist/schema/call/machine.d.ts +32 -32
- package/dist/schema/call/machine.js +152 -1
- package/dist/schema/call/order.js +34 -1
- package/dist/schema/call/payment.js +17 -1
- package/dist/schema/call/permission.js +105 -1
- package/dist/schema/call/personal.js +68 -1
- package/dist/schema/call/progress.js +26 -1
- package/dist/schema/call/proof.js +27 -1
- package/dist/schema/call/repository.js +76 -1
- package/dist/schema/call/reward.js +42 -1
- package/dist/schema/call/service.js +82 -1
- package/dist/schema/call/treasury.js +71 -1
- package/dist/schema/common/index.js +345 -1
- package/dist/schema/index.js +7 -1
- package/dist/schema/local/index.js +855 -1
- package/dist/schema/local/wip.js +187 -1
- package/dist/schema/messenger/index.js +446 -1
- package/dist/schema/query/index.d.ts +43 -43
- package/dist/schema/query/index.js +1265 -1
- package/dist/schema/utils/guard-parser.js +401 -1
- package/dist/schema/utils/guard-query-utils.js +22 -1
- package/dist/schema/utils/node-parser.js +353 -1
- package/dist/schema/utils/permission-index-utils.js +7 -1
- package/package.json +3 -6
|
@@ -1 +1,171 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ResponseData, LocalMark, enrichMoveError } from "wowok";
|
|
2
|
+
export function handleCallResult(result) {
|
|
3
|
+
if (result && "error" in result) {
|
|
4
|
+
const enrichedError = enrichMoveError(result.error);
|
|
5
|
+
const output = {
|
|
6
|
+
message: `Error: ${enrichedError}`,
|
|
7
|
+
result: { type: "error", error: enrichedError },
|
|
8
|
+
};
|
|
9
|
+
return {
|
|
10
|
+
content: [{ type: "text", text: output.message }],
|
|
11
|
+
structuredContent: output,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
if (result && "digest" in result) {
|
|
15
|
+
const r = ResponseData(result);
|
|
16
|
+
const txStatus = result?.effects?.status?.status;
|
|
17
|
+
const txError = result?.effects?.status?.error;
|
|
18
|
+
const isSuccess = txStatus === "success";
|
|
19
|
+
if (!isSuccess) {
|
|
20
|
+
const enrichedError = enrichMoveError(txError || txStatus || "unknown error");
|
|
21
|
+
const output = {
|
|
22
|
+
message: `Transaction failed: ${enrichedError}`,
|
|
23
|
+
result: { type: "error", error: enrichedError },
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
content: [
|
|
27
|
+
{ type: "text", text: output.message },
|
|
28
|
+
{ type: "text", text: JSON.stringify(r) },
|
|
29
|
+
],
|
|
30
|
+
structuredContent: output,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const output = {
|
|
34
|
+
message: "Transaction completed successfully",
|
|
35
|
+
result: { type: "transaction", ...result },
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
content: [
|
|
39
|
+
{ type: "text", text: output.message },
|
|
40
|
+
{ type: "text", text: JSON.stringify(r) },
|
|
41
|
+
],
|
|
42
|
+
structuredContent: output,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (result && "guard" in result && "submission" in result) {
|
|
46
|
+
const output = {
|
|
47
|
+
message: "Submission required for Guard verification",
|
|
48
|
+
result: { type: "submission", ...result },
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
content: [
|
|
52
|
+
{ type: "text", text: output.message },
|
|
53
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
54
|
+
],
|
|
55
|
+
structuredContent: output,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (Array.isArray(result)) {
|
|
59
|
+
const output = {
|
|
60
|
+
message: "Operation completed",
|
|
61
|
+
result: { type: "data", data: result },
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
content: [
|
|
65
|
+
{ type: "text", text: output.message },
|
|
66
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
67
|
+
],
|
|
68
|
+
structuredContent: output,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (result === undefined || result === null) {
|
|
72
|
+
const output = {
|
|
73
|
+
message: "Operation completed",
|
|
74
|
+
result: { type: "null" },
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
content: [{ type: "text", text: output.message }],
|
|
78
|
+
structuredContent: output,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const output = {
|
|
82
|
+
message: "Operation completed",
|
|
83
|
+
result: { type: "transaction", ...result },
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
content: [{ type: "text", text: output.message }],
|
|
87
|
+
structuredContent: output,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export function createServerConfig(packageJson, description) {
|
|
91
|
+
return {
|
|
92
|
+
name: packageJson.name,
|
|
93
|
+
version: packageJson.version,
|
|
94
|
+
description: description || packageJson.description,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export function createCapabilitiesConfig() {
|
|
98
|
+
return {
|
|
99
|
+
capabilities: {
|
|
100
|
+
prompts: {},
|
|
101
|
+
resources: {},
|
|
102
|
+
tools: { listChanged: true },
|
|
103
|
+
logging: {},
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export function createToolMeta(category, tags) {
|
|
108
|
+
return {
|
|
109
|
+
author: "WOWOK Team",
|
|
110
|
+
createdAt: "2026-02-01",
|
|
111
|
+
lastUpdated: "2026-02-01",
|
|
112
|
+
category,
|
|
113
|
+
tags,
|
|
114
|
+
requiresAuth: false,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export function createToolAnnotations(readOnlyHint = false, destructiveHint = false) {
|
|
118
|
+
return {
|
|
119
|
+
readOnlyHint,
|
|
120
|
+
destructiveHint,
|
|
121
|
+
idempotentHint: true,
|
|
122
|
+
openWorldHint: false,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
export async function transformSubmission(submission) {
|
|
126
|
+
if (!submission)
|
|
127
|
+
return undefined;
|
|
128
|
+
const guardNames = (submission.guard || []).map((g) => g.object).filter(Boolean);
|
|
129
|
+
const submissionGuardNames = (submission.submission || []).map((s) => s.guard).filter(Boolean);
|
|
130
|
+
const allNames = [...new Set([...guardNames, ...submissionGuardNames])];
|
|
131
|
+
const resolvedAddresses = allNames.length > 0
|
|
132
|
+
? await LocalMark.Instance().get_many_address(allNames)
|
|
133
|
+
: [];
|
|
134
|
+
const nameToAddress = new Map();
|
|
135
|
+
allNames.forEach((name, index) => {
|
|
136
|
+
const addr = resolvedAddresses[index];
|
|
137
|
+
if (addr) {
|
|
138
|
+
nameToAddress.set(name, addr);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
const getAddress = (name) => {
|
|
142
|
+
if (nameToAddress.has(name)) {
|
|
143
|
+
return nameToAddress.get(name);
|
|
144
|
+
}
|
|
145
|
+
for (const [n, addr] of nameToAddress.entries()) {
|
|
146
|
+
if (n === name)
|
|
147
|
+
return addr;
|
|
148
|
+
}
|
|
149
|
+
if (name.startsWith("0x") && name.length === 66) {
|
|
150
|
+
return name;
|
|
151
|
+
}
|
|
152
|
+
throw new Error(`Guard name or address not found: ${name}`);
|
|
153
|
+
};
|
|
154
|
+
return {
|
|
155
|
+
type: "submission",
|
|
156
|
+
guard: (submission.guard || []).map((g) => ({
|
|
157
|
+
object: getAddress(g.object),
|
|
158
|
+
impack: g.impack || false,
|
|
159
|
+
})),
|
|
160
|
+
submission: (submission.submission || []).map((s) => ({
|
|
161
|
+
guard: getAddress(s.guard),
|
|
162
|
+
submission: s.submission || [],
|
|
163
|
+
})),
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
export function validateInput(data, schema) {
|
|
167
|
+
return schema.parse(data);
|
|
168
|
+
}
|
|
169
|
+
export function getEnvConfig(env) {
|
|
170
|
+
return env || {};
|
|
171
|
+
}
|
|
@@ -1 +1,18 @@
|
|
|
1
|
-
export*from'./base.js';
|
|
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';
|
|
@@ -276,14 +276,14 @@ export declare const NodeSchema: z.ZodDiscriminatedUnion<"op", [z.ZodObject<{
|
|
|
276
276
|
guard: z.ZodOptional<z.ZodObject<{
|
|
277
277
|
guard: z.ZodString;
|
|
278
278
|
retained_submission: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
279
|
-
}, "
|
|
279
|
+
}, "strict", z.ZodTypeAny, {
|
|
280
280
|
guard: string;
|
|
281
281
|
retained_submission?: number[] | undefined;
|
|
282
282
|
}, {
|
|
283
283
|
guard: string;
|
|
284
284
|
retained_submission?: number[] | undefined;
|
|
285
285
|
}>>;
|
|
286
|
-
}, "
|
|
286
|
+
}, "strict", z.ZodTypeAny, {
|
|
287
287
|
name: string;
|
|
288
288
|
weight: number;
|
|
289
289
|
guard?: {
|
|
@@ -302,7 +302,7 @@ export declare const NodeSchema: z.ZodDiscriminatedUnion<"op", [z.ZodObject<{
|
|
|
302
302
|
namedOperator?: string | undefined;
|
|
303
303
|
permissionIndex?: number | undefined;
|
|
304
304
|
}>, "many">;
|
|
305
|
-
}, "
|
|
305
|
+
}, "strict", z.ZodTypeAny, {
|
|
306
306
|
forwards: {
|
|
307
307
|
name: string;
|
|
308
308
|
weight: number;
|
|
@@ -329,7 +329,7 @@ export declare const NodeSchema: z.ZodDiscriminatedUnion<"op", [z.ZodObject<{
|
|
|
329
329
|
threshold: number;
|
|
330
330
|
prev_node: string;
|
|
331
331
|
}>, "many">;
|
|
332
|
-
}, "
|
|
332
|
+
}, "strict", z.ZodTypeAny, {
|
|
333
333
|
name: string;
|
|
334
334
|
pairs: {
|
|
335
335
|
forwards: {
|
|
@@ -418,14 +418,14 @@ export declare const NodeSchema: z.ZodDiscriminatedUnion<"op", [z.ZodObject<{
|
|
|
418
418
|
guard: z.ZodOptional<z.ZodObject<{
|
|
419
419
|
guard: z.ZodString;
|
|
420
420
|
retained_submission: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
421
|
-
}, "
|
|
421
|
+
}, "strict", z.ZodTypeAny, {
|
|
422
422
|
guard: string;
|
|
423
423
|
retained_submission?: number[] | undefined;
|
|
424
424
|
}, {
|
|
425
425
|
guard: string;
|
|
426
426
|
retained_submission?: number[] | undefined;
|
|
427
427
|
}>>;
|
|
428
|
-
}, "
|
|
428
|
+
}, "strict", z.ZodTypeAny, {
|
|
429
429
|
name: string;
|
|
430
430
|
weight: number;
|
|
431
431
|
guard?: {
|
|
@@ -444,7 +444,7 @@ export declare const NodeSchema: z.ZodDiscriminatedUnion<"op", [z.ZodObject<{
|
|
|
444
444
|
namedOperator?: string | undefined;
|
|
445
445
|
permissionIndex?: number | undefined;
|
|
446
446
|
}>, "many">;
|
|
447
|
-
}, "
|
|
447
|
+
}, "strict", z.ZodTypeAny, {
|
|
448
448
|
forwards: {
|
|
449
449
|
name: string;
|
|
450
450
|
weight: number;
|
|
@@ -471,7 +471,7 @@ export declare const NodeSchema: z.ZodDiscriminatedUnion<"op", [z.ZodObject<{
|
|
|
471
471
|
threshold: number;
|
|
472
472
|
prev_node: string;
|
|
473
473
|
}>, "many">;
|
|
474
|
-
}, "
|
|
474
|
+
}, "strict", z.ZodTypeAny, {
|
|
475
475
|
name: string;
|
|
476
476
|
pairs: {
|
|
477
477
|
forwards: {
|
|
@@ -729,14 +729,14 @@ export declare const NodeFieldSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"op",
|
|
|
729
729
|
guard: z.ZodOptional<z.ZodObject<{
|
|
730
730
|
guard: z.ZodString;
|
|
731
731
|
retained_submission: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
732
|
-
}, "
|
|
732
|
+
}, "strict", z.ZodTypeAny, {
|
|
733
733
|
guard: string;
|
|
734
734
|
retained_submission?: number[] | undefined;
|
|
735
735
|
}, {
|
|
736
736
|
guard: string;
|
|
737
737
|
retained_submission?: number[] | undefined;
|
|
738
738
|
}>>;
|
|
739
|
-
}, "
|
|
739
|
+
}, "strict", z.ZodTypeAny, {
|
|
740
740
|
name: string;
|
|
741
741
|
weight: number;
|
|
742
742
|
guard?: {
|
|
@@ -755,7 +755,7 @@ export declare const NodeFieldSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"op",
|
|
|
755
755
|
namedOperator?: string | undefined;
|
|
756
756
|
permissionIndex?: number | undefined;
|
|
757
757
|
}>, "many">;
|
|
758
|
-
}, "
|
|
758
|
+
}, "strict", z.ZodTypeAny, {
|
|
759
759
|
forwards: {
|
|
760
760
|
name: string;
|
|
761
761
|
weight: number;
|
|
@@ -782,7 +782,7 @@ export declare const NodeFieldSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"op",
|
|
|
782
782
|
threshold: number;
|
|
783
783
|
prev_node: string;
|
|
784
784
|
}>, "many">;
|
|
785
|
-
}, "
|
|
785
|
+
}, "strict", z.ZodTypeAny, {
|
|
786
786
|
name: string;
|
|
787
787
|
pairs: {
|
|
788
788
|
forwards: {
|
|
@@ -871,14 +871,14 @@ export declare const NodeFieldSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"op",
|
|
|
871
871
|
guard: z.ZodOptional<z.ZodObject<{
|
|
872
872
|
guard: z.ZodString;
|
|
873
873
|
retained_submission: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
874
|
-
}, "
|
|
874
|
+
}, "strict", z.ZodTypeAny, {
|
|
875
875
|
guard: string;
|
|
876
876
|
retained_submission?: number[] | undefined;
|
|
877
877
|
}, {
|
|
878
878
|
guard: string;
|
|
879
879
|
retained_submission?: number[] | undefined;
|
|
880
880
|
}>>;
|
|
881
|
-
}, "
|
|
881
|
+
}, "strict", z.ZodTypeAny, {
|
|
882
882
|
name: string;
|
|
883
883
|
weight: number;
|
|
884
884
|
guard?: {
|
|
@@ -897,7 +897,7 @@ export declare const NodeFieldSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"op",
|
|
|
897
897
|
namedOperator?: string | undefined;
|
|
898
898
|
permissionIndex?: number | undefined;
|
|
899
899
|
}>, "many">;
|
|
900
|
-
}, "
|
|
900
|
+
}, "strict", z.ZodTypeAny, {
|
|
901
901
|
forwards: {
|
|
902
902
|
name: string;
|
|
903
903
|
weight: number;
|
|
@@ -924,7 +924,7 @@ export declare const NodeFieldSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"op",
|
|
|
924
924
|
threshold: number;
|
|
925
925
|
prev_node: string;
|
|
926
926
|
}>, "many">;
|
|
927
|
-
}, "
|
|
927
|
+
}, "strict", z.ZodTypeAny, {
|
|
928
928
|
name: string;
|
|
929
929
|
pairs: {
|
|
930
930
|
forwards: {
|
|
@@ -1408,14 +1408,14 @@ export declare const CallMachine_DataSchema: z.ZodObject<{
|
|
|
1408
1408
|
guard: z.ZodOptional<z.ZodObject<{
|
|
1409
1409
|
guard: z.ZodString;
|
|
1410
1410
|
retained_submission: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
1411
|
-
}, "
|
|
1411
|
+
}, "strict", z.ZodTypeAny, {
|
|
1412
1412
|
guard: string;
|
|
1413
1413
|
retained_submission?: number[] | undefined;
|
|
1414
1414
|
}, {
|
|
1415
1415
|
guard: string;
|
|
1416
1416
|
retained_submission?: number[] | undefined;
|
|
1417
1417
|
}>>;
|
|
1418
|
-
}, "
|
|
1418
|
+
}, "strict", z.ZodTypeAny, {
|
|
1419
1419
|
name: string;
|
|
1420
1420
|
weight: number;
|
|
1421
1421
|
guard?: {
|
|
@@ -1434,7 +1434,7 @@ export declare const CallMachine_DataSchema: z.ZodObject<{
|
|
|
1434
1434
|
namedOperator?: string | undefined;
|
|
1435
1435
|
permissionIndex?: number | undefined;
|
|
1436
1436
|
}>, "many">;
|
|
1437
|
-
}, "
|
|
1437
|
+
}, "strict", z.ZodTypeAny, {
|
|
1438
1438
|
forwards: {
|
|
1439
1439
|
name: string;
|
|
1440
1440
|
weight: number;
|
|
@@ -1461,7 +1461,7 @@ export declare const CallMachine_DataSchema: z.ZodObject<{
|
|
|
1461
1461
|
threshold: number;
|
|
1462
1462
|
prev_node: string;
|
|
1463
1463
|
}>, "many">;
|
|
1464
|
-
}, "
|
|
1464
|
+
}, "strict", z.ZodTypeAny, {
|
|
1465
1465
|
name: string;
|
|
1466
1466
|
pairs: {
|
|
1467
1467
|
forwards: {
|
|
@@ -1550,14 +1550,14 @@ export declare const CallMachine_DataSchema: z.ZodObject<{
|
|
|
1550
1550
|
guard: z.ZodOptional<z.ZodObject<{
|
|
1551
1551
|
guard: z.ZodString;
|
|
1552
1552
|
retained_submission: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
1553
|
-
}, "
|
|
1553
|
+
}, "strict", z.ZodTypeAny, {
|
|
1554
1554
|
guard: string;
|
|
1555
1555
|
retained_submission?: number[] | undefined;
|
|
1556
1556
|
}, {
|
|
1557
1557
|
guard: string;
|
|
1558
1558
|
retained_submission?: number[] | undefined;
|
|
1559
1559
|
}>>;
|
|
1560
|
-
}, "
|
|
1560
|
+
}, "strict", z.ZodTypeAny, {
|
|
1561
1561
|
name: string;
|
|
1562
1562
|
weight: number;
|
|
1563
1563
|
guard?: {
|
|
@@ -1576,7 +1576,7 @@ export declare const CallMachine_DataSchema: z.ZodObject<{
|
|
|
1576
1576
|
namedOperator?: string | undefined;
|
|
1577
1577
|
permissionIndex?: number | undefined;
|
|
1578
1578
|
}>, "many">;
|
|
1579
|
-
}, "
|
|
1579
|
+
}, "strict", z.ZodTypeAny, {
|
|
1580
1580
|
forwards: {
|
|
1581
1581
|
name: string;
|
|
1582
1582
|
weight: number;
|
|
@@ -1603,7 +1603,7 @@ export declare const CallMachine_DataSchema: z.ZodObject<{
|
|
|
1603
1603
|
threshold: number;
|
|
1604
1604
|
prev_node: string;
|
|
1605
1605
|
}>, "many">;
|
|
1606
|
-
}, "
|
|
1606
|
+
}, "strict", z.ZodTypeAny, {
|
|
1607
1607
|
name: string;
|
|
1608
1608
|
pairs: {
|
|
1609
1609
|
forwards: {
|
|
@@ -2434,14 +2434,14 @@ export declare const CallMachine_InputSchema: z.ZodObject<{
|
|
|
2434
2434
|
guard: z.ZodOptional<z.ZodObject<{
|
|
2435
2435
|
guard: z.ZodString;
|
|
2436
2436
|
retained_submission: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
2437
|
-
}, "
|
|
2437
|
+
}, "strict", z.ZodTypeAny, {
|
|
2438
2438
|
guard: string;
|
|
2439
2439
|
retained_submission?: number[] | undefined;
|
|
2440
2440
|
}, {
|
|
2441
2441
|
guard: string;
|
|
2442
2442
|
retained_submission?: number[] | undefined;
|
|
2443
2443
|
}>>;
|
|
2444
|
-
}, "
|
|
2444
|
+
}, "strict", z.ZodTypeAny, {
|
|
2445
2445
|
name: string;
|
|
2446
2446
|
weight: number;
|
|
2447
2447
|
guard?: {
|
|
@@ -2460,7 +2460,7 @@ export declare const CallMachine_InputSchema: z.ZodObject<{
|
|
|
2460
2460
|
namedOperator?: string | undefined;
|
|
2461
2461
|
permissionIndex?: number | undefined;
|
|
2462
2462
|
}>, "many">;
|
|
2463
|
-
}, "
|
|
2463
|
+
}, "strict", z.ZodTypeAny, {
|
|
2464
2464
|
forwards: {
|
|
2465
2465
|
name: string;
|
|
2466
2466
|
weight: number;
|
|
@@ -2487,7 +2487,7 @@ export declare const CallMachine_InputSchema: z.ZodObject<{
|
|
|
2487
2487
|
threshold: number;
|
|
2488
2488
|
prev_node: string;
|
|
2489
2489
|
}>, "many">;
|
|
2490
|
-
}, "
|
|
2490
|
+
}, "strict", z.ZodTypeAny, {
|
|
2491
2491
|
name: string;
|
|
2492
2492
|
pairs: {
|
|
2493
2493
|
forwards: {
|
|
@@ -2576,14 +2576,14 @@ export declare const CallMachine_InputSchema: z.ZodObject<{
|
|
|
2576
2576
|
guard: z.ZodOptional<z.ZodObject<{
|
|
2577
2577
|
guard: z.ZodString;
|
|
2578
2578
|
retained_submission: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
2579
|
-
}, "
|
|
2579
|
+
}, "strict", z.ZodTypeAny, {
|
|
2580
2580
|
guard: string;
|
|
2581
2581
|
retained_submission?: number[] | undefined;
|
|
2582
2582
|
}, {
|
|
2583
2583
|
guard: string;
|
|
2584
2584
|
retained_submission?: number[] | undefined;
|
|
2585
2585
|
}>>;
|
|
2586
|
-
}, "
|
|
2586
|
+
}, "strict", z.ZodTypeAny, {
|
|
2587
2587
|
name: string;
|
|
2588
2588
|
weight: number;
|
|
2589
2589
|
guard?: {
|
|
@@ -2602,7 +2602,7 @@ export declare const CallMachine_InputSchema: z.ZodObject<{
|
|
|
2602
2602
|
namedOperator?: string | undefined;
|
|
2603
2603
|
permissionIndex?: number | undefined;
|
|
2604
2604
|
}>, "many">;
|
|
2605
|
-
}, "
|
|
2605
|
+
}, "strict", z.ZodTypeAny, {
|
|
2606
2606
|
forwards: {
|
|
2607
2607
|
name: string;
|
|
2608
2608
|
weight: number;
|
|
@@ -2629,7 +2629,7 @@ export declare const CallMachine_InputSchema: z.ZodObject<{
|
|
|
2629
2629
|
threshold: number;
|
|
2630
2630
|
prev_node: string;
|
|
2631
2631
|
}>, "many">;
|
|
2632
|
-
}, "
|
|
2632
|
+
}, "strict", z.ZodTypeAny, {
|
|
2633
2633
|
name: string;
|
|
2634
2634
|
pairs: {
|
|
2635
2635
|
forwards: {
|
|
@@ -1 +1,152 @@
|
|
|
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
|
+
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
|
+
export const ProgressNamedOperatorSchema = z.object({
|
|
6
|
+
op: z.union([z.literal('add'), z.literal('set'), z.literal('remove')]),
|
|
7
|
+
name: NotEmptyNameSchema,
|
|
8
|
+
operators: ManyAccountOrMark_AddressSchema,
|
|
9
|
+
}).strict();
|
|
10
|
+
export const ProgressNewSchema = z.object({
|
|
11
|
+
task: z.union([NameOrAddressSchema, z.null()]).optional().describe('Task bound to the Progress object. It is an object ID or name'),
|
|
12
|
+
repository: ObjectsSchema.optional().describe('Set repository list for the Progress object. Used for consensus data management.'),
|
|
13
|
+
progress_namedOperator: ProgressNamedOperatorSchema.optional().describe('Add, set, and remove operators for the permission namespace of the Progress object.'),
|
|
14
|
+
namedNew: NamedObjectSchema.optional(),
|
|
15
|
+
}).strict();
|
|
16
|
+
export const NodeAddForwardDataSchema = z.object({
|
|
17
|
+
prior_node_name: NameSchema.describe('Name of the previous node.'),
|
|
18
|
+
node_name: NameSchema.describe('Name of the next node.'),
|
|
19
|
+
forward: z.array(z.object({
|
|
20
|
+
name: NameSchema.describe('Name of the operation'),
|
|
21
|
+
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.'),
|
|
22
|
+
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.'),
|
|
23
|
+
weight: z.number().min(0).max(65535).int().describe('Weight of the operation'),
|
|
24
|
+
}).strict()).describe('List of operations between the previous and next nodes.'),
|
|
25
|
+
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.'),
|
|
26
|
+
}).strict();
|
|
27
|
+
export const NodeRemoveForwardDataSchema = z.object({
|
|
28
|
+
prior_node_name: NameSchema.describe('Name of the previous node.'),
|
|
29
|
+
node_name: NameSchema.describe('Name of the next node.'),
|
|
30
|
+
forward_name: z.array(NameSchema).describe('List of operation names to delete.'),
|
|
31
|
+
}).strict();
|
|
32
|
+
export const NodeRemovePriorNodeDataSchema = z.object({
|
|
33
|
+
prior_node_name: z.array(NameSchema).describe('List of previous node names to delete.'),
|
|
34
|
+
node_name: NameSchema.describe('Name of the next node.'),
|
|
35
|
+
}).strict();
|
|
36
|
+
export const NodeSchema = z.discriminatedUnion('op', [
|
|
37
|
+
z.object({
|
|
38
|
+
op: z.literal('add'),
|
|
39
|
+
nodes: z.array(MachineNodeSchema).describe('List of nodes to add or set.'),
|
|
40
|
+
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.'),
|
|
41
|
+
}).strict().describe('Add nodes.'),
|
|
42
|
+
z.object({
|
|
43
|
+
op: z.literal('set'),
|
|
44
|
+
nodes: z.array(MachineNodeSchema).describe('List of nodes to add or set.'),
|
|
45
|
+
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.'),
|
|
46
|
+
}).strict().describe('Set nodes.'),
|
|
47
|
+
z.object({
|
|
48
|
+
op: z.literal('remove'),
|
|
49
|
+
nodes: z.array(NameSchema).describe('List of node names to delete.'),
|
|
50
|
+
}).strict().describe('Delete nodes.'),
|
|
51
|
+
z.object({
|
|
52
|
+
op: z.literal('clear'),
|
|
53
|
+
}).strict().describe('Clear all nodes.'),
|
|
54
|
+
z.object({
|
|
55
|
+
op: z.literal('exchange'),
|
|
56
|
+
node_one: NameSchema.describe('Name of the first node.'),
|
|
57
|
+
node_other: NameSchema.describe('Name of the second node.'),
|
|
58
|
+
}).strict().describe('Exchange the positions of two nodes.'),
|
|
59
|
+
z.object({
|
|
60
|
+
op: z.literal('rename'),
|
|
61
|
+
node_name_old: NameSchema.describe('Name of thenode.'),
|
|
62
|
+
node_name_new: NameSchema.describe('New name of the node.'),
|
|
63
|
+
}).strict().describe('Rename node.'),
|
|
64
|
+
z.object({
|
|
65
|
+
op: z.literal('remove prior node'),
|
|
66
|
+
pairs: z.array(NodeRemovePriorNodeDataSchema).describe('List of previous-next node pairs to delete.'),
|
|
67
|
+
}).strict().describe('Delete previous-next node pairs.'),
|
|
68
|
+
z.object({
|
|
69
|
+
op: z.literal('add forward'),
|
|
70
|
+
data: z.array(NodeAddForwardDataSchema).describe('List of operations to add.'),
|
|
71
|
+
}).strict().describe('Add operations.'),
|
|
72
|
+
z.object({
|
|
73
|
+
op: z.literal('remove forward'),
|
|
74
|
+
data: z.array(NodeRemoveForwardDataSchema).describe('List of operations to delete.'),
|
|
75
|
+
}).strict().describe('Delete operations.'),
|
|
76
|
+
]);
|
|
77
|
+
export const NodeJsonOrMarkdownFileSchema = z.object({
|
|
78
|
+
json_or_markdown_file: z.string().describe(`Path to a JSON or Markdown file containing node array for COMPLETE REPLACEMENT of all nodes.
|
|
79
|
+
|
|
80
|
+
**File Format Requirements:**
|
|
81
|
+
- Must contain a JSON ARRAY of node objects: [{"name": "...", "pairs": [...]}, {...}]
|
|
82
|
+
- NOT an operation object with "op" field (use NodeSchema for operations)
|
|
83
|
+
- Supports JSON or Markdown (with \`\`\`json code blocks)
|
|
84
|
+
|
|
85
|
+
**Node Structure:**
|
|
86
|
+
Each node is a directed graph element representing workflow states and transitions:
|
|
87
|
+
- name: Node identifier
|
|
88
|
+
- pairs: Array of {prior_node, forwards, threshold} defining connections
|
|
89
|
+
- forwards: Operations available from this node
|
|
90
|
+
- threshold: Required weight to advance
|
|
91
|
+
|
|
92
|
+
**Behavior:**
|
|
93
|
+
- COMPLETELY REPLACES all existing nodes (equivalent to "set" with bReplace=true)
|
|
94
|
+
- Auto-detects format based on file content
|
|
95
|
+
- If parsing fails, error includes line number and column information`),
|
|
96
|
+
}).strict();
|
|
97
|
+
export const NodeFieldSchema = z.union([
|
|
98
|
+
NodeSchema,
|
|
99
|
+
NodeJsonOrMarkdownFileSchema,
|
|
100
|
+
]);
|
|
101
|
+
export const CallMachine_DataSchema = z.object({
|
|
102
|
+
object: WithPermissionObjectSchema,
|
|
103
|
+
progress_new: ProgressNewSchema.optional().describe('Generate new Progress object.'),
|
|
104
|
+
description: z.string().optional().describe('Description of the object.'),
|
|
105
|
+
repository: ObjectsSchema.optional().describe('Set repository list for the object. Used for consensus data management.'),
|
|
106
|
+
node: NodeFieldSchema.optional().describe(`CRITICAL: Choose ONE of two mutually exclusive modes:
|
|
107
|
+
|
|
108
|
+
**Mode 1: NodeSchema (incremental operations)**
|
|
109
|
+
Use for partial modifications: add, set, remove, clear, exchange, rename, remove prior node, add forward, remove forward.
|
|
110
|
+
Format: { "op": "add", "nodes": [...], "bReplace": false }
|
|
111
|
+
This mode modifies existing nodes incrementally.
|
|
112
|
+
|
|
113
|
+
**Mode 2: NodeJsonOrMarkdownFileSchema (complete replacement)**
|
|
114
|
+
Use for complete node redefinition from file.
|
|
115
|
+
Format: { "json_or_markdown_file": "/path/to/nodes.json" }
|
|
116
|
+
IMPORTANT: This COMPLETELY REPLACES all existing nodes. File must contain node array [{...}, {...}], NOT an operation object with "op" field.
|
|
117
|
+
Supported formats: JSON array or Markdown with code blocks.
|
|
118
|
+
If parsing fails, error includes line number and column information.`),
|
|
119
|
+
pause: z.boolean().optional().describe('Whether to pause generating new Progress objects.'),
|
|
120
|
+
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.'),
|
|
121
|
+
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.'),
|
|
122
|
+
um: z.union([z.string(), z.null()]).optional().describe('Contact object.'),
|
|
123
|
+
}).strict().describe("On-chain Machine operations. USAGE: (1) CREATE NEW: Set 'object' field with OBJECT format {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 STRING format (object ID or name). The 'object' field is CRITICAL and REQUIRED in both cases. STRING for existing, OBJECT for new creation.");
|
|
124
|
+
export const CallMachine_InputSchema = z.object({
|
|
125
|
+
data: CallMachine_DataSchema,
|
|
126
|
+
env: CallEnvSchema.optional(),
|
|
127
|
+
submission: SubmissionCallSchema.optional(),
|
|
128
|
+
}).strict();
|
|
129
|
+
export const MachineNode2File_InputSchema = z.object({
|
|
130
|
+
machine: NameOrAddressSchema.describe("Machine object ID or name to export"),
|
|
131
|
+
file_path: z.string().describe("Output file path (absolute or relative)"),
|
|
132
|
+
format: z.enum(["json", "markdown"]).optional().describe("Output format: 'json' (default) or 'markdown'"),
|
|
133
|
+
env: CallEnvSchema.optional(),
|
|
134
|
+
}).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.");
|
|
135
|
+
export const MachineNode2File_OutputSchema = z.discriminatedUnion("status", [
|
|
136
|
+
z.object({
|
|
137
|
+
status: z.literal("success"),
|
|
138
|
+
data: z.object({
|
|
139
|
+
file_path: z.string().describe("Absolute path of the exported file"),
|
|
140
|
+
format: z.enum(["json", "markdown"]).describe("Export format"),
|
|
141
|
+
machine_object: NameOrAddressSchema.describe("Machine object ID"),
|
|
142
|
+
node_count: z.number().describe("Number of nodes exported"),
|
|
143
|
+
}).strict().describe("Success result data"),
|
|
144
|
+
}).strict(),
|
|
145
|
+
z.object({
|
|
146
|
+
status: z.literal("error"),
|
|
147
|
+
error: z.string().describe("Error message"),
|
|
148
|
+
}).strict(),
|
|
149
|
+
]).describe("MachineNode2File operation output");
|
|
150
|
+
export const MachineNode2File_OutputWrappedSchema = z.object({
|
|
151
|
+
result: MachineNode2File_OutputSchema,
|
|
152
|
+
}).strict().describe("MachineNode2File operation output wrapped schema");
|