wowok_agent 2.2.0 → 2.2.2
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 +62 -9
- package/dist/schema/call/base.d.ts +1 -1
- package/dist/schema/call/base.js +5 -1
- package/dist/schema/call/machine.d.ts +32 -32
- package/dist/schema/query/index.d.ts +43 -43
- package/dist/schema/query/index.js +8 -8
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -143,7 +143,37 @@ function transformRewardData(data) {
|
|
|
143
143
|
}
|
|
144
144
|
return transformed;
|
|
145
145
|
}
|
|
146
|
-
const OnchainOperationsSchema = z.
|
|
146
|
+
const OnchainOperationsSchema = z.preprocess((input) => {
|
|
147
|
+
if (typeof input === 'object' && input !== null) {
|
|
148
|
+
const obj = { ...input };
|
|
149
|
+
if (typeof obj.data === 'string') {
|
|
150
|
+
try {
|
|
151
|
+
obj.data = JSON.parse(obj.data);
|
|
152
|
+
}
|
|
153
|
+
catch { }
|
|
154
|
+
}
|
|
155
|
+
if (typeof obj.env === 'string') {
|
|
156
|
+
try {
|
|
157
|
+
obj.env = JSON.parse(obj.env);
|
|
158
|
+
}
|
|
159
|
+
catch { }
|
|
160
|
+
}
|
|
161
|
+
if (typeof obj.submission === 'string') {
|
|
162
|
+
try {
|
|
163
|
+
obj.submission = JSON.parse(obj.submission);
|
|
164
|
+
}
|
|
165
|
+
catch { }
|
|
166
|
+
}
|
|
167
|
+
if (typeof obj.info === 'string') {
|
|
168
|
+
try {
|
|
169
|
+
obj.info = JSON.parse(obj.info);
|
|
170
|
+
}
|
|
171
|
+
catch { }
|
|
172
|
+
}
|
|
173
|
+
return obj;
|
|
174
|
+
}
|
|
175
|
+
return input;
|
|
176
|
+
}, z.discriminatedUnion("operation_type", [
|
|
147
177
|
z.object({
|
|
148
178
|
operation_type: z.literal("service"),
|
|
149
179
|
data: CallService_DataSchema,
|
|
@@ -236,8 +266,20 @@ const OnchainOperationsSchema = z.discriminatedUnion("operation_type", [
|
|
|
236
266
|
info: SubmissionCallSchema.optional().describe("Optional submission data. If not provided, will attempt to get existing submissions from the guard."),
|
|
237
267
|
env: CallEnvSchema.optional(),
|
|
238
268
|
}).describe("🛂 Generate Verified Passport Object: Create immutable verified credentials after Guard validation passes."),
|
|
239
|
-
]);
|
|
240
|
-
const WipOperationsSchema = z.
|
|
269
|
+
]));
|
|
270
|
+
const WipOperationsSchema = z.preprocess((input) => {
|
|
271
|
+
if (typeof input === 'object' && input !== null) {
|
|
272
|
+
const obj = { ...input };
|
|
273
|
+
if (typeof obj.options === 'string') {
|
|
274
|
+
try {
|
|
275
|
+
obj.options = JSON.parse(obj.options);
|
|
276
|
+
}
|
|
277
|
+
catch { }
|
|
278
|
+
}
|
|
279
|
+
return obj;
|
|
280
|
+
}
|
|
281
|
+
return input;
|
|
282
|
+
}, z.discriminatedUnion("type", [
|
|
241
283
|
z.object({
|
|
242
284
|
type: z.literal("generate"),
|
|
243
285
|
options: WipGenerationOptionsSchema.describe("WIP generation options"),
|
|
@@ -260,8 +302,22 @@ const WipOperationsSchema = z.discriminatedUnion("type", [
|
|
|
260
302
|
wipPath: z.string().describe("WIP file path or directory path. Supports: 1) Single WIP file (e.g., '/path/to/file.wip'), 2) Directory containing .wip files (e.g., '/path/to/wips/'), 3) Network URL (e.g., 'https://example.com/doc.wip'). When directory is provided, all .wip files in the directory will be converted to HTML"),
|
|
261
303
|
options: WipToHtmlOptionsSchema.optional().describe("Conversion options"),
|
|
262
304
|
}).describe("Convert WIP file to HTML format"),
|
|
263
|
-
]);
|
|
264
|
-
const WatchQueryOperationsSchema = z.
|
|
305
|
+
]));
|
|
306
|
+
const WatchQueryOperationsSchema = z.preprocess((input) => {
|
|
307
|
+
if (typeof input === 'object' && input !== null) {
|
|
308
|
+
const obj = { ...input };
|
|
309
|
+
for (const key of ['filter', 'objects', 'env', 'token_type']) {
|
|
310
|
+
if (typeof obj[key] === 'string') {
|
|
311
|
+
try {
|
|
312
|
+
obj[key] = JSON.parse(obj[key]);
|
|
313
|
+
}
|
|
314
|
+
catch { }
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return obj;
|
|
318
|
+
}
|
|
319
|
+
return input;
|
|
320
|
+
}, z.discriminatedUnion("query_type", [
|
|
265
321
|
z.object({
|
|
266
322
|
query_type: z.literal("local_mark_list"),
|
|
267
323
|
filter: LocalMarkFilterSchema.optional().describe("Local mark filter"),
|
|
@@ -350,13 +406,10 @@ const WatchQueryOperationsSchema = z.discriminatedUnion("query_type", [
|
|
|
350
406
|
object: z.string().describe("Object ID to query"),
|
|
351
407
|
all_type: z.boolean().optional().describe("Whether to query all types of received objects"),
|
|
352
408
|
}).describe("Query on-chain received balance, payments, and NFTs"),
|
|
353
|
-
]);
|
|
409
|
+
]));
|
|
354
410
|
async function handleOnchainOperations(args) {
|
|
355
|
-
console.log("=== handleOnchainOperations ===");
|
|
356
|
-
console.log("args:", JSON.stringify(args, null, 2));
|
|
357
411
|
try {
|
|
358
412
|
const validated = strictParse(OnchainOperationsSchema, args, "onchain_operations input");
|
|
359
|
-
console.log("validated:", JSON.stringify(validated, null, 2));
|
|
360
413
|
const env = getEnvConfig(validated.env);
|
|
361
414
|
switch (validated.operation_type) {
|
|
362
415
|
case "service": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ENTRYPOINT } from "wowok";
|
|
3
|
-
export declare function strictParse<T>(schema:
|
|
3
|
+
export declare function strictParse<T extends z.ZodTypeAny>(schema: T, input: unknown, fieldName?: string): z.infer<T>;
|
|
4
4
|
export declare const NamedObjectSchema: z.ZodObject<{
|
|
5
5
|
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
6
6
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
package/dist/schema/call/base.js
CHANGED
|
@@ -3,7 +3,11 @@ import { WowTransactionBlockResponseSchema } from "../local/index.js";
|
|
|
3
3
|
import { BalanceTypeSchema, EntrypointSchema, ObjectBaseSchema, GuardTableItemSchema, NameSchema, NameOrAddressSchema, TokenTypeWithDefaultSchema } from "../common/index.js";
|
|
4
4
|
import { ENTRYPOINT } from "wowok";
|
|
5
5
|
export function strictParse(schema, input, fieldName = "input") {
|
|
6
|
-
|
|
6
|
+
let innerSchema = schema;
|
|
7
|
+
while (innerSchema._def?.typeName === 'ZodEffects') {
|
|
8
|
+
innerSchema = innerSchema._def.schema;
|
|
9
|
+
}
|
|
10
|
+
const shape = innerSchema._def.shape?.();
|
|
7
11
|
if (!shape) {
|
|
8
12
|
return schema.parse(input);
|
|
9
13
|
}
|
|
@@ -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: {
|