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.
Files changed (39) hide show
  1. package/dist/index.d.ts +45 -2
  2. package/dist/index.js +1 -1319
  3. package/dist/schema/call/allocation.js +1 -27
  4. package/dist/schema/call/arbitration.js +1 -106
  5. package/dist/schema/call/base.js +1 -152
  6. package/dist/schema/call/contact.js +1 -41
  7. package/dist/schema/call/demand.js +1 -51
  8. package/dist/schema/call/guard.d.ts +6 -6
  9. package/dist/schema/call/guard.js +1 -67
  10. package/dist/schema/call/handler.d.ts +0 -45
  11. package/dist/schema/call/handler.js +1 -214
  12. package/dist/schema/call/index.js +1 -19
  13. package/dist/schema/call/machine.js +1 -164
  14. package/dist/schema/call/order.js +1 -39
  15. package/dist/schema/call/payment.js +1 -20
  16. package/dist/schema/call/permission.js +1 -118
  17. package/dist/schema/call/personal.js +1 -81
  18. package/dist/schema/call/progress.js +1 -28
  19. package/dist/schema/call/proof.js +1 -27
  20. package/dist/schema/call/repository.js +1 -85
  21. package/dist/schema/call/reward.d.ts +12 -0
  22. package/dist/schema/call/reward.js +1 -46
  23. package/dist/schema/call/service.js +1 -88
  24. package/dist/schema/call/treasury.d.ts +84 -0
  25. package/dist/schema/call/treasury.js +1 -76
  26. package/dist/schema/common/index.js +1 -395
  27. package/dist/schema/index.js +1 -8
  28. package/dist/schema/local/index.js +1 -913
  29. package/dist/schema/local/wip.js +1 -230
  30. package/dist/schema/messenger/index.d.ts +0 -2
  31. package/dist/schema/messenger/index.js +1 -479
  32. package/dist/schema/query/index.d.ts +155 -0
  33. package/dist/schema/query/index.js +1 -1256
  34. package/dist/schema/utils/guard-parser.js +1 -410
  35. package/dist/schema/utils/guard-query-utils.js +1 -22
  36. package/dist/schema/utils/node-parser.d.ts +0 -14
  37. package/dist/schema/utils/node-parser.js +1 -382
  38. package/dist/schema/utils/permission-index-utils.js +1 -10
  39. package/package.json +5 -3
@@ -1,27 +1 @@
1
- import { z } from "zod";
2
- import { CoinParamSchema, CallEnvSchema, SubmissionCallSchema, TypeNamedObjectSchema } from "./base.js";
3
- import { AllocatorsSchema, PaymentInfoSchema } from "../query/index.js";
4
- import { NameOrAddressSchema, ReceivedBalanceOrRecentlySchema } from "../common/index.js";
5
- // 定义CallAllocation_Data的第一个类型:创建新的allocation对象
6
- export const CallAllocation_CreateSchema = z.object({
7
- object: TypeNamedObjectSchema.describe("REQUIRED for creating new object. Provide {name: 'yourName', type: 'Allocation'} to create and name the new Allocation object."),
8
- allocators: AllocatorsSchema,
9
- coin: CoinParamSchema,
10
- payment_info: PaymentInfoSchema
11
- }).strict().describe("Create a new Allocation object. Set 'object' field with {name: 'yourName', type: 'Allocation'} to name the new object. Notice:'name' goes INSIDE 'object', NOT at the data root level.");
12
- // 定义CallAllocation_Data的第二个类型:操作现有的allocation对象
13
- export const CallAllocation_OperateSchema = z.object({
14
- object: NameOrAddressSchema.describe("REQUIRED for operating existing object. Provide the Allocation object ID or existing name to reference the target object."),
15
- received_coins: ReceivedBalanceOrRecentlySchema.optional().describe("Unwrap the CoinWrapper objects received by the Allocation object and deposit them into the pending allocation balance"),
16
- alloc_by_guard: NameOrAddressSchema.optional().describe("Verify the specified Guard and execute the corresponding fund allocation")
17
- }).strict().describe("Operate on an existing Allocation object. Set 'object' field with the object ID or existing name to specify the target.");
18
- // 定义CallAllocation_Data schema(联合类型)
19
- export const CallAllocation_DataSchema = z.union([
20
- CallAllocation_CreateSchema,
21
- CallAllocation_OperateSchema
22
- ]).describe("On-chain Allocation operations. USAGE: (1) CREATE NEW: Use CallAllocation_CreateSchema by setting 'object' with {name, type, ...}. (2) OPERATE EXISTING: Use CallAllocation_OperateSchema by setting 'object' with object ID or name. The 'object' field is CRITICAL and REQUIRED in both cases.");
23
- export const CallAllocation_InputSchema = z.object({
24
- data: CallAllocation_DataSchema,
25
- env: CallEnvSchema.optional(),
26
- submission: SubmissionCallSchema.optional(),
27
- }).strict();
1
+ import{z}from'zod';import{CoinParamSchema,CallEnvSchema,SubmissionCallSchema,TypeNamedObjectSchema}from'./base.js';import{AllocatorsSchema,PaymentInfoSchema}from'../query/index.js';import{NameOrAddressSchema,ReceivedBalanceOrRecentlySchema}from'../common/index.js';export const CallAllocation_CreateSchema=z['object']({'object':TypeNamedObjectSchema['describe']('REQUIRED\x20for\x20creating\x20new\x20object.\x20Provide\x20{name:\x20\x27yourName\x27,\x20type:\x20\x27Allocation\x27}\x20to\x20create\x20and\x20name\x20the\x20new\x20Allocation\x20object.'),'allocators':AllocatorsSchema,'coin':CoinParamSchema,'payment_info':PaymentInfoSchema})['strict']()['describe']('Create\x20a\x20new\x20Allocation\x20object.\x20Set\x20\x27object\x27\x20field\x20with\x20{name:\x20\x27yourName\x27,\x20type:\x20\x27Allocation\x27}\x20to\x20name\x20the\x20new\x20object.\x20Notice:\x27name\x27\x20goes\x20INSIDE\x20\x27object\x27,\x20NOT\x20at\x20the\x20data\x20root\x20level.');export const CallAllocation_OperateSchema=z['object']({'object':NameOrAddressSchema['describe']('REQUIRED\x20for\x20operating\x20existing\x20object.\x20Provide\x20the\x20Allocation\x20object\x20ID\x20or\x20existing\x20name\x20to\x20reference\x20the\x20target\x20object.'),'received_coins':ReceivedBalanceOrRecentlySchema['optional']()['describe']('Unwrap\x20the\x20CoinWrapper\x20objects\x20received\x20by\x20the\x20Allocation\x20object\x20and\x20deposit\x20them\x20into\x20the\x20pending\x20allocation\x20balance'),'alloc_by_guard':NameOrAddressSchema['optional']()['describe']('Verify\x20the\x20specified\x20Guard\x20and\x20execute\x20the\x20corresponding\x20fund\x20allocation')})['strict']()['describe']('Operate\x20on\x20an\x20existing\x20Allocation\x20object.\x20Set\x20\x27object\x27\x20field\x20with\x20the\x20object\x20ID\x20or\x20existing\x20name\x20to\x20specify\x20the\x20target.');export const CallAllocation_DataSchema=z['union']([CallAllocation_CreateSchema,CallAllocation_OperateSchema])['describe']('On-chain\x20Allocation\x20operations.\x20USAGE:\x20(1)\x20CREATE\x20NEW:\x20Use\x20CallAllocation_CreateSchema\x20by\x20setting\x20\x27object\x27\x20with\x20OBJECT\x20format\x20{name,\x20type_parameter,\x20...}.\x20(2)\x20OPERATE\x20EXISTING:\x20Use\x20CallAllocation_OperateSchema\x20by\x20setting\x20\x27object\x27\x20with\x20STRING\x20format\x20(object\x20ID\x20or\x20name).\x20The\x20\x27object\x27\x20field\x20is\x20CRITICAL\x20and\x20REQUIRED\x20in\x20both\x20cases.\x20');export const CallAllocation_InputSchema=z['object']({'data':CallAllocation_DataSchema,'env':CallEnvSchema['optional'](),'submission':SubmissionCallSchema['optional']()})['strict']();
@@ -1,106 +1 @@
1
- import { z } from "zod";
2
- import { TypedPermissionObjectSchema, CoinParamSchema, NamedObjectSchema, CallEnvSchema, SubmissionCallSchema } from "./base.js";
3
- import { VotingGuardSchema } from "../query/index.js";
4
- import { BalanceTypeSchema, DescriptionSchema, LongNameSchema, NameOrAddressSchema, NameSchema, ReceivedObjectsOrRecentlySchema } from "../common/index.js";
5
- // VotingGuardSchema is imported from ../query
6
- // 定义dispute schema
7
- export const DisputeSchema = z.object({
8
- order: NameOrAddressSchema.describe("Order ID or name."),
9
- description: DescriptionSchema.optional().describe("Dispute description."),
10
- proposition: z.array(LongNameSchema).describe("List of dispute propositions."),
11
- fee: CoinParamSchema.describe("Dispute processing fee."),
12
- namedArb: NamedObjectSchema.optional().describe("Name for the newly created arbitration object.")
13
- }).strict();
14
- // 定义confirm schema
15
- export const ConfirmSchema = z.object({
16
- arb: NameOrAddressSchema,
17
- voting_deadline: z.union([z.number().int().min(0), z.null()])
18
- }).strict();
19
- // 定义voting_deadline_change schema
20
- export const VotingDeadlineChangeSchema = z.object({
21
- arb: NameOrAddressSchema,
22
- voting_deadline: z.union([z.number(), z.null()])
23
- }).strict();
24
- // 定义vote schema
25
- export const VoteSchema = z.object({
26
- arb: NameOrAddressSchema,
27
- votes: z.array(z.number().int().min(0).max(255)),
28
- voting_guard: NameOrAddressSchema.optional()
29
- }).strict();
30
- // 定义feedback schema
31
- export const FeedbackSchema = z.object({
32
- arb: NameOrAddressSchema,
33
- feedback: DescriptionSchema.describe("Arbitration feedback."),
34
- }).strict();
35
- // 定义arbitration schema
36
- export const ArbitrationActionSchema = z.object({
37
- arb: NameOrAddressSchema,
38
- feedback: DescriptionSchema.describe("Arbitration feedback."),
39
- indemnity: z.number().int().min(0)
40
- }).strict();
41
- // 定义reset schema
42
- export const ResetSchema = z.object({
43
- arb: NameOrAddressSchema,
44
- feedback: DescriptionSchema.describe("Arbitration feedback."),
45
- }).strict();
46
- // 定义arb_withdraw schema
47
- export const ArbWithdrawSchema = z.object({
48
- arb: NameOrAddressSchema,
49
- }).strict();
50
- // 定义fees_transfer的to schema
51
- export const FeesTransferToSchema = z.union([
52
- z.object({
53
- allocation: NameOrAddressSchema.describe("Allocation object ID or name.")
54
- }).strict(),
55
- z.object({
56
- treasury: NameOrAddressSchema.describe("Treasury object ID or name.")
57
- }).strict()
58
- ]);
59
- // 定义fees_transfer schema
60
- export const FeesTransferSchema = z.object({
61
- to: FeesTransferToSchema.describe("Transfer arbitration fees to the specified Allocation object or Treasury object."),
62
- payment_remark: NameSchema.describe("Payment remark."),
63
- payment_index: z.number().int().min(0).describe("Payment index."),
64
- newPayment: NamedObjectSchema.optional().describe("Name for the newly created payment object.")
65
- }).strict();
66
- // 定义voting_guard schema
67
- export const VotingGuardActionSchema = z.discriminatedUnion("op", [
68
- z.object({
69
- op: z.enum(["add", "set"]),
70
- guards: z.array(VotingGuardSchema)
71
- }).strict(),
72
- z.object({
73
- op: z.literal("remove"),
74
- guards: z.array(NameOrAddressSchema)
75
- }).strict(),
76
- z.object({
77
- op: z.literal("clear")
78
- }).strict()
79
- ]);
80
- // 定义CallArbitration_Data schema
81
- export const CallArbitration_DataSchema = z.object({
82
- object: TypedPermissionObjectSchema,
83
- dispute: DisputeSchema.optional().describe("Create a new Arb object for the order."),
84
- description: DescriptionSchema.optional().describe("Introduction of the Arbitration object."),
85
- location: LongNameSchema.optional().describe("Arbitration location."),
86
- fee: BalanceTypeSchema.optional().describe("Arbitration fee."),
87
- pause: z.boolean().optional().describe("Whether to pause arbitration."),
88
- confirm: ConfirmSchema.optional().describe("Confirm the materials submitted by the user for arbitration."),
89
- voting_deadline_change: VotingDeadlineChangeSchema.optional().describe("Change the voting deadline."),
90
- vote: VoteSchema.optional().describe("Vote on user propositions."),
91
- feedback: FeedbackSchema.optional().describe("Arbitration feedback for the Arb object."),
92
- arbitration: ArbitrationActionSchema.optional().describe("Provide a definitive arbitration result."),
93
- reset: ResetSchema.optional().describe("User applies to resubmit materials and restart arbitration."),
94
- arb_withdraw: ArbWithdrawSchema.optional().describe("Withdraw arbitration fees from the Arb object."),
95
- fees_transfer: FeesTransferSchema.optional().describe("Distribute the withdrawn arbitration fees."),
96
- usage_guard: z.union([NameOrAddressSchema, z.null()]).optional().describe("Set Guard for verification when users apply for arbitration; if Guard verification fails, users will not be able to apply for arbitration."),
97
- voting_guard: VotingGuardActionSchema.optional().describe("Set Guard for verification during arbitration voting; if Guard verification fails, arbitration voting will fail."),
98
- 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."),
99
- um: z.union([NameOrAddressSchema, z.null()]).optional().describe("Contact object.")
100
- }).strict().describe("On-chain Arbitration operations. USAGE: (1) CREATE NEW: Set 'object' field with {name, type, permission, ...} to create an Arbitration. 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.");
101
- // 定义输入schema
102
- export const CallArbitration_InputSchema = z.object({
103
- data: CallArbitration_DataSchema,
104
- env: CallEnvSchema.optional(),
105
- submission: SubmissionCallSchema.optional(),
106
- }).strict();
1
+ import{z}from'zod';import{TypedPermissionObjectSchema,CoinParamSchema,NamedObjectSchema,CallEnvSchema,SubmissionCallSchema}from'./base.js';import{VotingGuardSchema}from'../query/index.js';import{BalanceTypeSchema,DescriptionSchema,LongNameSchema,NameOrAddressSchema,NameSchema,ReceivedObjectsOrRecentlySchema}from'../common/index.js';export const DisputeSchema=z['object']({'order':NameOrAddressSchema['describe']('Order\x20ID\x20or\x20name.'),'description':DescriptionSchema['optional']()['describe']('Dispute\x20description.'),'proposition':z['array'](LongNameSchema)['describe']('List\x20of\x20dispute\x20propositions.'),'fee':CoinParamSchema['describe']('Dispute\x20processing\x20fee.'),'namedArb':NamedObjectSchema['optional']()['describe']('Name\x20for\x20the\x20newly\x20created\x20arbitration\x20object.')})['strict']();export const ConfirmSchema=z['object']({'arb':NameOrAddressSchema,'voting_deadline':z['union']([z['number']()['int']()['min'](0x0),z['null']()])})['strict']();export const VotingDeadlineChangeSchema=z['object']({'arb':NameOrAddressSchema,'voting_deadline':z['union']([z['number'](),z['null']()])})['strict']();export const VoteSchema=z['object']({'arb':NameOrAddressSchema,'votes':z['array'](z['number']()['int']()['min'](0x0)['max'](0xff)),'voting_guard':NameOrAddressSchema['optional']()})['strict']();export const FeedbackSchema=z['object']({'arb':NameOrAddressSchema,'feedback':DescriptionSchema['describe']('Arbitration\x20feedback.')})['strict']();export const ArbitrationActionSchema=z['object']({'arb':NameOrAddressSchema,'feedback':DescriptionSchema['describe']('Arbitration\x20feedback.'),'indemnity':z['number']()['int']()['min'](0x0)})['strict']();export const ResetSchema=z['object']({'arb':NameOrAddressSchema,'feedback':DescriptionSchema['describe']('Arbitration\x20feedback.')})['strict']();export const ArbWithdrawSchema=z['object']({'arb':NameOrAddressSchema})['strict']();export const FeesTransferToSchema=z['union']([z['object']({'allocation':NameOrAddressSchema['describe']('Allocation\x20object\x20ID\x20or\x20name.')})['strict'](),z['object']({'treasury':NameOrAddressSchema['describe']('Treasury\x20object\x20ID\x20or\x20name.')})['strict']()]);export const FeesTransferSchema=z['object']({'to':FeesTransferToSchema['describe']('Transfer\x20arbitration\x20fees\x20to\x20the\x20specified\x20Allocation\x20object\x20or\x20Treasury\x20object.'),'payment_remark':NameSchema['describe']('Payment\x20remark.'),'payment_index':z['number']()['int']()['min'](0x0)['describe']('Payment\x20index.'),'newPayment':NamedObjectSchema['optional']()['describe']('Name\x20for\x20the\x20newly\x20created\x20payment\x20object.')})['strict']();export const VotingGuardActionSchema=z['discriminatedUnion']('op',[z['object']({'op':z['enum'](['add','set']),'guards':z['array'](VotingGuardSchema)})['strict'](),z['object']({'op':z['literal']('remove'),'guards':z['array'](NameOrAddressSchema)})['strict'](),z['object']({'op':z['literal']('clear')})['strict']()]);export const CallArbitration_DataSchema=z['object']({'object':TypedPermissionObjectSchema,'dispute':DisputeSchema['optional']()['describe']('Create\x20a\x20new\x20Arb\x20object\x20for\x20the\x20order.'),'description':DescriptionSchema['optional']()['describe']('Introduction\x20of\x20the\x20Arbitration\x20object.'),'location':LongNameSchema['optional']()['describe']('Arbitration\x20location.'),'fee':BalanceTypeSchema['optional']()['describe']('Arbitration\x20fee.'),'pause':z['boolean']()['optional']()['describe']('Whether\x20to\x20pause\x20arbitration.'),'confirm':ConfirmSchema['optional']()['describe']('Confirm\x20the\x20materials\x20submitted\x20by\x20the\x20user\x20for\x20arbitration.'),'voting_deadline_change':VotingDeadlineChangeSchema['optional']()['describe']('Change\x20the\x20voting\x20deadline.'),'vote':VoteSchema['optional']()['describe']('Vote\x20on\x20user\x20propositions.'),'feedback':FeedbackSchema['optional']()['describe']('Arbitration\x20feedback\x20for\x20the\x20Arb\x20object.'),'arbitration':ArbitrationActionSchema['optional']()['describe']('Provide\x20a\x20definitive\x20arbitration\x20result.'),'reset':ResetSchema['optional']()['describe']('User\x20applies\x20to\x20resubmit\x20materials\x20and\x20restart\x20arbitration.'),'arb_withdraw':ArbWithdrawSchema['optional']()['describe']('Withdraw\x20arbitration\x20fees\x20from\x20the\x20Arb\x20object.'),'fees_transfer':FeesTransferSchema['optional']()['describe']('Distribute\x20the\x20withdrawn\x20arbitration\x20fees.'),'usage_guard':z['union']([NameOrAddressSchema,z['null']()])['optional']()['describe']('Set\x20Guard\x20for\x20verification\x20when\x20users\x20apply\x20for\x20arbitration;\x20if\x20Guard\x20verification\x20fails,\x20users\x20will\x20not\x20be\x20able\x20to\x20apply\x20for\x20arbitration.'),'voting_guard':VotingGuardActionSchema['optional']()['describe']('Set\x20Guard\x20for\x20verification\x20during\x20arbitration\x20voting;\x20if\x20Guard\x20verification\x20fails,\x20arbitration\x20voting\x20will\x20fail.'),'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']([NameOrAddressSchema,z['null']()])['optional']()['describe']('Contact\x20object.')})['strict']()['describe']('On-chain\x20Arbitration\x20operations.\x20USAGE:\x20(1)\x20CREATE\x20NEW:\x20Set\x20\x27object\x27\x20field\x20with\x20OBJECT\x20format\x20{name,\x20type_parameter,\x20permission,\x20...}\x20to\x20create\x20an\x20Arbitration.\x20NOTE:\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 CallArbitration_InputSchema=z['object']({'data':CallArbitration_DataSchema,'env':CallEnvSchema['optional'](),'submission':SubmissionCallSchema['optional']()})['strict']();
@@ -1,152 +1 @@
1
- import { z } from "zod";
2
- import { WowTransactionBlockResponseSchema } from "../local/index.js";
3
- import { BalanceTypeSchema, EntrypointSchema, ObjectBaseSchema, GuardTableItemSchema, NameSchema, NameOrAddressSchema, TokenTypeWithDefaultSchema } from "../common/index.js";
4
- import { ENTRYPOINT } from "wowok";
5
- export function strictParse(schema, input, fieldName = "input") {
6
- const shape = schema._def.shape?.();
7
- if (!shape) {
8
- return schema.parse(input);
9
- }
10
- const allowedFields = Object.keys(shape);
11
- const inputFields = Object.keys(input || {});
12
- const unknownFields = inputFields.filter(f => !allowedFields.includes(f));
13
- if (unknownFields.length > 0) {
14
- throw new Error(`Unknown ${fieldName} field(s): ${unknownFields.join(', ')}`);
15
- }
16
- return schema.parse(input);
17
- }
18
- // 定义 NamedObject schema
19
- export const NamedObjectSchema = z.object({
20
- name: NameSchema.optional().describe("The name of the object"),
21
- tags: z.array(z.string()).optional().describe("The tags of the object"),
22
- onChain: z.boolean().optional().describe("CRITICAL: Whether to sync the name to the blockchain. DEFAULT (undefined/false): The name is stored LOCALLY ONLY on your device (PRIVATE). If set to true: The name is published ON-CHAIN and becomes PUBLICLY VISIBLE to everyone. Only set to true for displaying the relationships you are willing to make public on the chain."),
23
- replaceExistName: z.boolean().optional().describe("FORCE CLAIM: Set to true ONLY when the user explicitly expresses a STRONG INTENTION to forcefully take over an existing name (e.g., 'I must use this name', 'force rename', 'replace the existing one'). " +
24
- "WARNING: This will UNBIND the name from its original object and rebind it to the new one, potentially breaking existing references. " +
25
- "If not specified or false: the operation will FAIL with an error when the name is already in use (safe default behavior)."),
26
- }).strict().describe("Assign a name and optional tags to a new object. By default, names are stored LOCALLY (private) on your device. " +
27
- "Set 'onChain: true' to create a PUBLIC on-chain identity visible to everyone. " +
28
- "IMPORTANT: If the requested name is already taken, the operation will FAIL by default. " +
29
- "Only set 'replaceExistName: true' when the user EXPLICITLY demands to forcefully claim the name.");
30
- // 定义 NormalObject schema
31
- export const NormalObjectSchema = z.union([
32
- NameOrAddressSchema.describe("Object name or ID. Used to operate on an existing object."),
33
- NamedObjectSchema,
34
- ]).describe("Reference an existing object by name or ID, or create a new object by providing its name.");
35
- // 定义 NamedObjectWithDescription schema
36
- export const NamedObjectWithDescriptionSchema = NamedObjectSchema.extend({
37
- description: z.string().optional().describe("The description of the object"),
38
- }).strict().describe("Create a new object with a name and optional description. The name helps identify the object, while the description provides additional details about its purpose or functionality.");
39
- // 定义 DescriptionObject schema
40
- export const DescriptionObjectSchema = z.union([
41
- NameOrAddressSchema.describe("Object name or ID. Used to operate on an existing object."),
42
- NamedObjectWithDescriptionSchema
43
- ]).describe("Reference an existing object by name or ID, or create a new object by specifying its name and description.");
44
- // 定义 TypeNamedObject schema
45
- export const TypeNamedObjectSchema = NamedObjectSchema.extend({
46
- type_parameter: TokenTypeWithDefaultSchema.describe("Token type of the on-chain object, e.g. '0x2::wow::WOW'. Defines what token this object can use for payments."),
47
- }).describe("Create a new named object (with optional tags) and specify a token type for payments (e.g., WOW).");
48
- // 定义 NamedObjectWithPermission schema
49
- export const NamedObjectWithPermissionSchema = NamedObjectSchema.extend({
50
- permission: DescriptionObjectSchema.optional(),
51
- }).strict().describe("Use a Permission object to manage access control: (1) Specify an existing Permission object's name or ID; (2) Create a new Permission object (which can be named and tagged); or (3) Leave empty to automatically create a new unnamed Permission object.");
52
- // 定义 TypeNamedObjectWithPermission schema
53
- export const TypeNamedObjectWithPermissionSchema = NamedObjectWithPermissionSchema.extend({
54
- type_parameter: TokenTypeWithDefaultSchema.describe("Type parameter (token type) of the on-chain object, e.g. '0x2::wow::WOW'. Defines what token this object can use for payments."),
55
- }).strict().describe("Create a new named on-chain object with both a specific token type AND permission control. Use this when you need to specify a token type (e.g., WOW) for payment operations AND require permission management (who can manage/operate this object). For objects without permission management, use TypeNamedObjectSchema instead.");
56
- // 定义 CoinParam schema
57
- export const CoinParamSchema = z.union([
58
- z.object({
59
- balance: BalanceTypeSchema,
60
- }).describe("Specify an amount value."),
61
- z.object({
62
- coin: z.string().describe("Coin object ID. Use a specified Coin object."),
63
- }),
64
- ]).describe("Specify the amount to pay from the transaction account, or the Coin ID owned by the transaction account. Used for payment.");
65
- // 定义 CallEnv schema
66
- export const CallEnvSchema = z.object({
67
- account: NameOrAddressSchema.optional().default(""),
68
- permission_guard: z.array(z.string()).optional().describe("List of permission guard IDs. Used to extend additional operation permissions (requires verification and configuration in the Permission object)."),
69
- no_cache: z.boolean().optional().describe("Whether to disable caching."),
70
- network: EntrypointSchema.optional(),
71
- referrer: NameOrAddressSchema.optional().describe("Referrer ID. If the user is using the network for the first time, the referrer ID will be recorded."),
72
- }).strict().describe(`IMPORTANT: Execution environment includes: account for signing operations, network selection (${ENTRYPOINT}), additional Guard permissions, and more. Used to specify context information during the call. If account is not specified, the default account ("") will be used.`);
73
- // 定义 ObjectsOp schema
74
- export const ObjectsOpSchema = z.union([
75
- z.object({
76
- op: z.literal("set").or(z.literal("add")).or(z.literal("remove")),
77
- objects: z.array(NameOrAddressSchema),
78
- }).describe("Set, add, or remove object ID list."),
79
- z.object({
80
- op: z.literal("clear"),
81
- }).describe("Remove all objects."),
82
- ]).describe("Operate object list. Used to set, add, or remove objects.");
83
- // 定义 ResponseData schema
84
- export const ResponseDataSchema = ObjectBaseSchema.extend({
85
- change: z.union([z.literal("created"), z.literal("mutated"), z.string()]),
86
- }).describe("Call result data. Contains basic object information and change type.");
87
- // 定义 CallResponseError schema
88
- export const CallResponseErrorSchema = z.object({
89
- type: z.literal("error").describe("Type of call response: error"),
90
- error: z.string(),
91
- }).describe("Call error data. Contains error information.");
92
- // 定义 GuardSubmissionToFill schema
93
- export const GuardSubmissionToFillSchema = z.object({
94
- guard: NameOrAddressSchema.describe("Guard object name or ID."),
95
- submission: z.array(GuardTableItemSchema).describe("User-submitted data required for Guard verification."),
96
- }).strict().describe("Permission guard submission data.");
97
- // 定义 GuardInfo_forCall schema
98
- export const SubmissionCallSchema = z.object({
99
- type: z.literal("submission").describe("Type of call response: submission"),
100
- guard: z.array(z.object({
101
- object: NameOrAddressSchema.describe("Guard object name or ID."),
102
- impack: z.boolean().describe("Whether the verification result of this Guard participates in the final verification logic. If true, the verification result of this Guard will be included in the final verification result; if false, the verification result of this Guard will not be included."),
103
- }).strict()),
104
- submission: z.array(GuardSubmissionToFillSchema),
105
- }).strict().describe("Guard verification submission data required to complete an operation. Contains: (1) 'guard' - array of Guard objects to verify, each with an object ID and an 'impack' flag indicating if its result affects the final outcome; (2) 'submission' - array of user data submissions matching the Guard's requirements. The operation proceeds only after all Guards with impack=true are successfully verified.");
106
- // 定义 TypedPermissionObject schema
107
- export const TypedPermissionObjectSchema = z.union([
108
- NameOrAddressSchema.describe("Object name or ID. Used to operate on an existing object."),
109
- TypeNamedObjectWithPermissionSchema,
110
- ]).describe("Reference an existing object by name or ID, or create a new object with full configuration: name (optional), tags (optional), description (optional), token type for payments, and Permission-based access control.");
111
- // 定义 WithPermissionObject schema
112
- export const WithPermissionObjectSchema = z.union([
113
- NameOrAddressSchema.describe("Object name or ID. Used to operate on an existing object."),
114
- NamedObjectWithPermissionSchema,
115
- ]).describe("Create a new object (which can be named and tagged) with a Permission object to manage its access control, or operate on an existing object by referencing its name or ID.");
116
- // 定义 TypedDescriptionObject schema
117
- export const TypedDescriptionObjectSchema = z.union([
118
- NameOrAddressSchema.describe("Object name or ID. Used to operate on an existing object."),
119
- TypeNamedObjectSchema,
120
- ]).describe("Reference an existing object by name or ID, or create a new object with full configuration options: name (optional), tags (optional array), description (optional), token type for payments (e.g., '0x2::wow::WOW'), and visibility settings (local by default, or public on-chain).");
121
- // 定义 CallResult schema
122
- export const CallResultSchema = z.discriminatedUnion("type", [
123
- SubmissionCallSchema,
124
- WowTransactionBlockResponseSchema.extend({
125
- type: z.literal("transaction"),
126
- }),
127
- CallResponseErrorSchema,
128
- z.object({
129
- type: z.literal("data"),
130
- data: z.array(ResponseDataSchema),
131
- }),
132
- z.object({
133
- type: z.literal("null"),
134
- }),
135
- ]).describe("Call result. Can be Guard verification information (type: 'submission') that needs to be submitted by the user, result response, error information (type: 'error'), or null.");
136
- export const ObjectsSchema = z.union([
137
- z.object({
138
- op: z.union([z.literal('add'), z.literal('set')]),
139
- objects: z.array(NameOrAddressSchema).describe('List of object IDs or names to add or set'),
140
- }).strict(),
141
- z.object({
142
- op: z.literal('remove'),
143
- objects: z.array(NameOrAddressSchema).describe('List of object IDs or names to remove'),
144
- }).strict(),
145
- z.object({
146
- op: z.literal('clear'),
147
- }).strict(),
148
- ]);
149
- export const CallOutputSchema = z.object({
150
- result: CallResultSchema,
151
- message: z.string().optional().describe("Message or hint information"),
152
- }).strict().describe("On-chain Operation Result");
1
+ import{z}from'zod';import{WowTransactionBlockResponseSchema}from'../local/index.js';import{BalanceTypeSchema,EntrypointSchema,ObjectBaseSchema,GuardTableItemSchema,NameSchema,NameOrAddressSchema,TokenTypeWithDefaultSchema}from'../common/index.js';import{ENTRYPOINT}from'wowok';export function strictParse(a,b,c='input'){const d=a['_def']['shape']?.();if(!d)return a['parse'](b);const e=Object['keys'](d),f=Object['keys'](b||{}),g=f['filter'](h=>!e['includes'](h));if(g['length']>0x0)throw new Error('Unknown\x20'+c+'\x20field(s):\x20'+g['join'](',\x20'));return a['parse'](b);}export const NamedObjectSchema=z['object']({'name':NameSchema['optional']()['describe']('The\x20name\x20of\x20the\x20object'),'tags':z['array'](z['string']())['optional']()['describe']('The\x20tags\x20of\x20the\x20object'),'onChain':z['boolean']()['optional']()['describe']('CRITICAL:\x20Whether\x20to\x20sync\x20the\x20name\x20to\x20the\x20blockchain.\x20DEFAULT\x20(undefined/false):\x20The\x20name\x20is\x20stored\x20LOCALLY\x20ONLY\x20on\x20your\x20device\x20(PRIVATE).\x20If\x20set\x20to\x20true:\x20The\x20name\x20is\x20published\x20ON-CHAIN\x20and\x20becomes\x20PUBLICLY\x20VISIBLE\x20to\x20everyone.\x20Only\x20set\x20to\x20true\x20for\x20displaying\x20the\x20relationships\x20you\x20are\x20willing\x20to\x20make\x20public\x20on\x20the\x20chain.'),'replaceExistName':z['boolean']()['optional']()['describe']('FORCE\x20CLAIM:\x20Set\x20to\x20true\x20ONLY\x20when\x20the\x20user\x20explicitly\x20expresses\x20a\x20STRONG\x20INTENTION\x20to\x20forcefully\x20take\x20over\x20an\x20existing\x20name\x20(e.g.,\x20\x27I\x20must\x20use\x20this\x20name\x27,\x20\x27force\x20rename\x27,\x20\x27replace\x20the\x20existing\x20one\x27).\x20'+'WARNING:\x20This\x20will\x20UNBIND\x20the\x20name\x20from\x20its\x20original\x20object\x20and\x20rebind\x20it\x20to\x20the\x20new\x20one,\x20potentially\x20breaking\x20existing\x20references.\x20'+'If\x20not\x20specified\x20or\x20false:\x20the\x20operation\x20will\x20FAIL\x20with\x20an\x20error\x20when\x20the\x20name\x20is\x20already\x20in\x20use\x20(safe\x20default\x20behavior).')})['strict']()['describe']('Assign\x20a\x20name\x20and\x20optional\x20tags\x20to\x20a\x20new\x20object.\x20By\x20default,\x20names\x20are\x20stored\x20LOCALLY\x20(private)\x20on\x20your\x20device.\x20'+'Set\x20\x27onChain:\x20true\x27\x20to\x20create\x20a\x20PUBLIC\x20on-chain\x20identity\x20visible\x20to\x20everyone.\x20'+'IMPORTANT:\x20If\x20the\x20requested\x20name\x20is\x20already\x20taken,\x20the\x20operation\x20will\x20FAIL\x20by\x20default.\x20'+'Only\x20set\x20\x27replaceExistName:\x20true\x27\x20when\x20the\x20user\x20EXPLICITLY\x20demands\x20to\x20forcefully\x20claim\x20the\x20name.');export const NormalObjectSchema=z['union']([NameOrAddressSchema['describe']('String\x20format:\x20Reference\x20an\x20EXISTING\x20object\x20by\x20its\x20name\x20(local\x20mark)\x20or\x20on-chain\x20object\x20ID.\x20Example:\x20\x27my-service\x27\x20or\x20\x270x1234...\x27'),NamedObjectSchema['describe']('Object\x20format:\x20CREATE\x20a\x20NEW\x20object\x20with\x20specified\x20properties.\x20See\x20NamedObjectSchema\x20for\x20details\x20including\x20\x27name\x27\x20(optional),\x20\x27tags\x27\x20(optional),\x20\x27onChain\x27\x20(whether\x20to\x20make\x20name\x20public),\x20and\x20\x27replaceExistName\x27\x20(force\x20claim\x20existing\x20name).')])['describe']('Two\x20ways\x20to\x20specify\x20an\x20object:\x20(1)\x20STRING\x20-\x20Reference\x20an\x20EXISTING\x20object\x20by\x20name\x20or\x20ID;\x20(2)\x20OBJECT\x20-\x20CREATE\x20a\x20NEW\x20object\x20using\x20NamedObjectSchema\x20structure\x20with\x20optional\x20name,\x20tags,\x20and\x20visibility\x20settings.');export const NamedObjectWithDescriptionSchema=NamedObjectSchema['extend']({'description':z['string']()['optional']()['describe']('The\x20description\x20of\x20the\x20object')})['strict']()['describe']('Create\x20a\x20new\x20object\x20with\x20a\x20name\x20and\x20optional\x20description.\x20The\x20name\x20helps\x20identify\x20the\x20object,\x20while\x20the\x20description\x20provides\x20additional\x20details\x20about\x20its\x20purpose\x20or\x20functionality.');export const DescriptionObjectSchema=z['union']([NameOrAddressSchema['describe']('String\x20format:\x20Reference\x20an\x20EXISTING\x20object\x20by\x20its\x20name\x20(local\x20mark)\x20or\x20on-chain\x20object\x20ID.\x20Example:\x20\x27my-object\x27\x20or\x20\x270x1234...\x27'),NamedObjectWithDescriptionSchema['describe']('Object\x20format:\x20CREATE\x20a\x20NEW\x20object\x20with\x20name,\x20optional\x20description,\x20and\x20visibility\x20settings.\x20Extends\x20NamedObjectSchema\x20with\x20an\x20additional\x20\x27description\x27\x20field\x20for\x20detailed\x20object\x20information.')])['describe']('Two\x20ways\x20to\x20specify\x20an\x20object:\x20(1)\x20STRING\x20-\x20Reference\x20an\x20EXISTING\x20object\x20by\x20name\x20or\x20ID;\x20(2)\x20OBJECT\x20-\x20CREATE\x20a\x20NEW\x20object\x20with\x20full\x20configuration\x20including\x20optional\x20name,\x20tags,\x20description,\x20and\x20visibility\x20settings\x20(local\x20private\x20by\x20default,\x20or\x20public\x20on-chain\x20with\x20onChain:true).');export const TypeNamedObjectSchema=NamedObjectSchema['extend']({'type_parameter':TokenTypeWithDefaultSchema['describe']('Token\x20type\x20of\x20the\x20on-chain\x20object,\x20e.g.\x20\x270x2::wow::WOW\x27.\x20Defines\x20what\x20token\x20this\x20object\x20can\x20use\x20for\x20payments.')})['describe']('Create\x20a\x20new\x20named\x20object\x20(with\x20optional\x20tags)\x20and\x20specify\x20a\x20token\x20type\x20for\x20payments\x20(e.g.,\x20WOW).');export const NamedObjectWithPermissionSchema=NamedObjectSchema['extend']({'permission':DescriptionObjectSchema['optional']()})['strict']()['describe']('Use\x20a\x20Permission\x20object\x20to\x20manage\x20access\x20control:\x20(1)\x20Specify\x20an\x20existing\x20Permission\x20object\x27s\x20name\x20or\x20ID;\x20(2)\x20Create\x20a\x20new\x20Permission\x20object\x20(which\x20can\x20be\x20named\x20and\x20tagged);\x20or\x20(3)\x20Leave\x20empty\x20to\x20automatically\x20create\x20a\x20new\x20unnamed\x20Permission\x20object.');export const TypeNamedObjectWithPermissionSchema=NamedObjectWithPermissionSchema['extend']({'type_parameter':TokenTypeWithDefaultSchema['describe']('Type\x20parameter\x20(token\x20type)\x20of\x20the\x20on-chain\x20object,\x20e.g.\x20\x270x2::wow::WOW\x27.\x20Defines\x20what\x20token\x20this\x20object\x20can\x20use\x20for\x20payments.')})['strict']()['describe']('Create\x20a\x20new\x20named\x20on-chain\x20object\x20with\x20both\x20a\x20specific\x20token\x20type\x20AND\x20permission\x20control.\x20Use\x20this\x20when\x20you\x20need\x20to\x20specify\x20a\x20token\x20type\x20(e.g.,\x20WOW)\x20for\x20payment\x20operations\x20AND\x20require\x20permission\x20management\x20(who\x20can\x20manage/operate\x20this\x20object).\x20For\x20objects\x20without\x20permission\x20management,\x20use\x20TypeNamedObjectSchema\x20instead.');export const CoinParamSchema=z['union']([z['object']({'balance':BalanceTypeSchema})['describe']('Specify\x20an\x20amount\x20value.'),z['object']({'coin':z['string']()['describe']('Coin\x20object\x20ID\x20or\x20name(local\x20mark).\x20Use\x20a\x20specified\x20Coin\x20object.')})])['describe']('Specify\x20the\x20amount\x20to\x20pay\x20from\x20the\x20transaction\x20account,\x20or\x20the\x20Coin\x20ID\x20owned\x20by\x20the\x20transaction\x20account.\x20Used\x20for\x20payment.');export const CallEnvSchema=z['object']({'account':NameOrAddressSchema['optional']()['default'](''),'permission_guard':z['array'](z['string']())['optional']()['describe']('List\x20of\x20permission\x20guard\x20IDs.\x20Used\x20to\x20extend\x20additional\x20operation\x20permissions\x20(requires\x20verification\x20and\x20configuration\x20in\x20the\x20Permission\x20object).'),'no_cache':z['boolean']()['optional']()['describe']('Whether\x20to\x20disable\x20caching.'),'network':EntrypointSchema['optional'](),'referrer':NameOrAddressSchema['optional']()['describe']('Referrer\x20ID.\x20If\x20the\x20user\x20is\x20using\x20the\x20network\x20for\x20the\x20first\x20time,\x20the\x20referrer\x20ID\x20will\x20be\x20recorded.')})['strict']()['describe']('IMPORTANT:\x20Execution\x20environment\x20includes:\x20account\x20for\x20signing\x20operations,\x20network\x20selection\x20('+ENTRYPOINT+'),\x20additional\x20Guard\x20permissions,\x20and\x20more.\x20Used\x20to\x20specify\x20context\x20information\x20during\x20the\x20call.\x20If\x20account\x20is\x20not\x20specified,\x20the\x20default\x20account\x20(\x22\x22)\x20will\x20be\x20used.');export const ObjectsOpSchema=z['union']([z['object']({'op':z['literal']('set')['or'](z['literal']('add'))['or'](z['literal']('remove')),'objects':z['array'](NameOrAddressSchema)})['describe']('Set,\x20add,\x20or\x20remove\x20object\x20ID\x20list.'),z['object']({'op':z['literal']('clear')})['describe']('Remove\x20all\x20objects.')])['describe']('Operate\x20object\x20list.\x20Used\x20to\x20set,\x20add,\x20or\x20remove\x20objects.');export const ResponseDataSchema=ObjectBaseSchema['extend']({'change':z['union']([z['literal']('created'),z['literal']('mutated'),z['string']()])})['describe']('Call\x20result\x20data.\x20Contains\x20basic\x20object\x20information\x20and\x20change\x20type.');export const CallResponseErrorSchema=z['object']({'type':z['literal']('error')['describe']('Type\x20of\x20call\x20response:\x20error'),'error':z['string']()})['describe']('Call\x20error\x20data.\x20Contains\x20error\x20information.');export const GuardSubmissionToFillSchema=z['object']({'guard':NameOrAddressSchema['describe']('Guard\x20object\x20name\x20or\x20ID.'),'submission':z['array'](GuardTableItemSchema)['describe']('User-submitted\x20data\x20required\x20for\x20Guard\x20verification.')})['strict']()['describe']('Permission\x20guard\x20submission\x20data.');export const SubmissionCallSchema=z['object']({'type':z['literal']('submission')['describe']('Type\x20of\x20call\x20response:\x20submission'),'guard':z['array'](z['object']({'object':NameOrAddressSchema['describe']('Guard\x20object\x20name\x20or\x20ID.'),'impack':z['boolean']()['describe']('Whether\x20the\x20verification\x20result\x20of\x20this\x20Guard\x20participates\x20in\x20the\x20final\x20verification\x20logic.\x20If\x20true,\x20the\x20verification\x20result\x20of\x20this\x20Guard\x20will\x20be\x20included\x20in\x20the\x20final\x20verification\x20result;\x20if\x20false,\x20the\x20verification\x20result\x20of\x20this\x20Guard\x20will\x20not\x20be\x20included.')})['strict']()),'submission':z['array'](GuardSubmissionToFillSchema)})['strict']()['describe']('Guard\x20verification\x20submission\x20data\x20required\x20to\x20complete\x20an\x20operation.\x20Contains:\x20(1)\x20\x27guard\x27\x20-\x20array\x20of\x20Guard\x20objects\x20to\x20verify,\x20each\x20with\x20an\x20object\x20ID\x20and\x20an\x20\x27impack\x27\x20flag\x20indicating\x20if\x20its\x20result\x20affects\x20the\x20final\x20outcome;\x20(2)\x20\x27submission\x27\x20-\x20array\x20of\x20user\x20data\x20submissions\x20matching\x20the\x20Guard\x27s\x20requirements.\x20The\x20operation\x20proceeds\x20only\x20after\x20all\x20Guards\x20with\x20impack=true\x20are\x20successfully\x20verified.');export const TypedPermissionObjectSchema=z['union']([NameOrAddressSchema['describe']('String\x20format:\x20Reference\x20an\x20EXISTING\x20object\x20by\x20its\x20name\x20(local\x20mark)\x20or\x20on-chain\x20object\x20ID.\x20Use\x20this\x20when\x20the\x20object\x20already\x20exists\x20and\x20you\x20want\x20to\x20reference\x20it.'),TypeNamedObjectWithPermissionSchema['describe']('Object\x20format:\x20CREATE\x20a\x20NEW\x20object\x20with\x20COMPLETE\x20configuration\x20including:\x20optional\x20name,\x20tags,\x20description,\x20token\x20type\x20for\x20payments\x20(e.g.,\x20\x270x2::wow::WOW\x27),\x20AND\x20Permission-based\x20access\x20control.\x20Use\x20this\x20for\x20creating\x20sophisticated\x20objects\x20with\x20both\x20payment\x20token\x20specification\x20and\x20permission\x20management.')])['describe']('Two\x20ways\x20to\x20specify\x20an\x20object:\x20(1)\x20STRING\x20-\x20Reference\x20an\x20EXISTING\x20object\x20by\x20name\x20or\x20ID;\x20(2)\x20OBJECT\x20-\x20CREATE\x20a\x20NEW\x20object\x20with\x20full\x20configuration\x20including\x20name,\x20tags,\x20description,\x20token\x20type\x20for\x20payments,\x20and\x20Permission-based\x20access\x20control.\x20The\x20object\x20format\x20is\x20used\x20when\x20you\x20need\x20both\x20token\x20specification\x20AND\x20permission\x20management.');export const WithPermissionObjectSchema=z['union']([NameOrAddressSchema['describe']('String\x20format:\x20Reference\x20an\x20EXISTING\x20object\x20by\x20its\x20name\x20(local\x20mark)\x20or\x20on-chain\x20object\x20ID.\x20Use\x20when\x20the\x20Permission\x20object\x20already\x20exists.'),NamedObjectWithPermissionSchema['describe']('Object\x20format:\x20CREATE\x20a\x20NEW\x20object\x20with\x20Permission-based\x20access\x20control.\x20Includes\x20optional\x20name,\x20tags,\x20visibility\x20settings,\x20AND\x20a\x20Permission\x20object\x20(which\x20itself\x20can\x20be\x20referenced\x20by\x20string\x20or\x20created\x20as\x20a\x20new\x20object).\x20Use\x20this\x20to\x20create\x20objects\x20with\x20managed\x20access\x20permissions.')])['describe']('Two\x20ways\x20to\x20specify\x20a\x20Permission-managed\x20object:\x20(1)\x20STRING\x20-\x20Reference\x20an\x20EXISTING\x20Permission\x20object\x20by\x20name\x20or\x20ID;\x20(2)\x20OBJECT\x20-\x20CREATE\x20a\x20NEW\x20object\x20with\x20Permission\x20access\x20control,\x20where\x20the\x20Permission\x20can\x20also\x20be\x20either\x20referenced\x20(string)\x20or\x20newly\x20created\x20(object).\x20This\x20is\x20used\x20when\x20you\x20need\x20permission\x20management\x20but\x20don\x27t\x20need\x20to\x20specify\x20a\x20token\x20type.');export const TypedDescriptionObjectSchema=z['union']([NameOrAddressSchema['describe']('String\x20format:\x20Reference\x20an\x20EXISTING\x20object\x20by\x20its\x20name\x20(local\x20mark)\x20or\x20on-chain\x20object\x20ID.\x20Use\x20when\x20the\x20object\x20already\x20exists.'),TypeNamedObjectSchema['describe']('Object\x20format:\x20CREATE\x20a\x20NEW\x20object\x20with\x20token\x20type\x20specification\x20for\x20payments.\x20Includes\x20optional\x20name,\x20tags,\x20visibility\x20settings,\x20AND\x20a\x20specific\x20token\x20type\x20(e.g.,\x20\x270x2::wow::WOW\x27\x20or\x20\x270x2::usdt::USDT\x27).\x20Use\x20this\x20when\x20you\x20need\x20to\x20specify\x20what\x20token\x20the\x20object\x20will\x20use\x20for\x20payments\x20but\x20don\x27t\x20need\x20permission\x20management.')])['describe']('Two\x20ways\x20to\x20specify\x20an\x20object:\x20(1)\x20STRING\x20-\x20Reference\x20an\x20EXISTING\x20object\x20by\x20name\x20or\x20ID;\x20(2)\x20OBJECT\x20-\x20CREATE\x20a\x20NEW\x20object\x20with\x20token\x20type\x20specification\x20for\x20payments.\x20The\x20object\x20format\x20includes\x20name,\x20tags,\x20visibility\x20settings,\x20and\x20a\x20required\x20token\x20type.\x20This\x20is\x20used\x20when\x20you\x20need\x20to\x20specify\x20the\x20payment\x20token\x20but\x20don\x27t\x20need\x20permission\x20management.');export const CallResultSchema=z['discriminatedUnion']('type',[SubmissionCallSchema,WowTransactionBlockResponseSchema['extend']({'type':z['literal']('transaction')}),CallResponseErrorSchema,z['object']({'type':z['literal']('data'),'data':z['array'](ResponseDataSchema)}),z['object']({'type':z['literal']('null')})])['describe']('Call\x20result.\x20Can\x20be\x20Guard\x20verification\x20information\x20(type:\x20\x27submission\x27)\x20that\x20needs\x20to\x20be\x20submitted\x20by\x20the\x20user,\x20result\x20response,\x20error\x20information\x20(type:\x20\x27error\x27),\x20or\x20null.');export const ObjectsSchema=z['union']([z['object']({'op':z['union']([z['literal']('add'),z['literal']('set')]),'objects':z['array'](NameOrAddressSchema)['describe']('List\x20of\x20object\x20IDs\x20or\x20names\x20to\x20add\x20or\x20set')})['strict'](),z['object']({'op':z['literal']('remove'),'objects':z['array'](NameOrAddressSchema)['describe']('List\x20of\x20object\x20IDs\x20or\x20names\x20to\x20remove')})['strict'](),z['object']({'op':z['literal']('clear')})['strict']()]);export const CallOutputSchema=z['object']({'result':CallResultSchema,'message':z['string']()['optional']()['describe']('Message\x20or\x20hint\x20information')})['strict']()['describe']('On-chain\x20Operation\x20Result');
@@ -1,41 +1 @@
1
- import { z } from "zod";
2
- import { WithPermissionObjectSchema, CallEnvSchema, SubmissionCallSchema } from "./base.js";
3
- import { NameOrAddressSchema, ReceivedObjectsOrRecentlySchema, DescriptionSchema, LongNameSchema, NameSchema } from "../common/index.js";
4
- // IM (Instant Messaging) contact entry schema
5
- export const ImEntrySchema = z.object({
6
- at: NameOrAddressSchema.describe("Contact's account address or name for instant messaging"),
7
- description: LongNameSchema.optional().describe("Optional description or note about this contact"),
8
- }).strict().describe("An instant messaging contact entry with address and optional description");
9
- // IM operations discriminated union schema
10
- export const ImsOperationSchema = z.discriminatedUnion("op", [
11
- z.object({
12
- op: z.literal("add").describe("Add new IM contacts to the list"),
13
- im: z.array(ImEntrySchema).describe("List of IM contacts to add"),
14
- }).strict().describe("Add operation: Append new contacts to the existing IM list"),
15
- z.object({
16
- op: z.literal("set").describe("Set/replace all IM contacts"),
17
- im: z.array(ImEntrySchema).describe("Complete list of IM contacts to set"),
18
- }).strict().describe("Set operation: Replace entire IM list with new contacts"),
19
- z.object({
20
- op: z.literal("remove").describe("Remove specific IM contacts"),
21
- im: z.array(NameOrAddressSchema).describe("List of contact addresses or names to remove"),
22
- }).strict().describe("Remove operation: Delete specified contacts from the IM list"),
23
- z.object({
24
- op: z.literal("clear").describe("Clear all IM contacts"),
25
- }).strict().describe("Clear operation: Remove all contacts from the IM list"),
26
- ]).describe("IM list operation: add, set, remove, or clear contacts");
27
- // CallContact_Data schema - Main data structure for Contact operations
28
- export const CallContact_DataSchema = z.object({
29
- object: WithPermissionObjectSchema,
30
- my_status: NameSchema.optional().describe("Set your status message in this contact list. Only valid if your account is already in the IM list"),
31
- description: DescriptionSchema.optional().describe("Contact object description or public information"),
32
- location: LongNameSchema.optional().describe("Physical or virtual location information for this contact"),
33
- ims: ImsOperationSchema.optional().describe("IM contact list operation: add, set, remove, or clear instant messaging contacts"),
34
- owner_receive: ReceivedObjectsOrRecentlySchema.optional().describe("Receive objects sent to this contact object and unwrap them to the permission owner"),
35
- }).strict().describe("On-chain Contact operations. USAGE: (1) CREATE NEW: Set 'object' field with {name, permission, ...} to create a Contact. 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.");
36
- // CallContact_InputSchema - Complete input schema for Contact tool
37
- export const CallContact_InputSchema = z.object({
38
- data: CallContact_DataSchema.describe("Contact operation data containing object reference and operations to perform"),
39
- env: CallEnvSchema.optional().describe("Call environment parameters including account, network, and cache settings"),
40
- submission: SubmissionCallSchema.optional().describe("Guard submission data for permission verification"),
41
- }).strict().describe("Contact object operation data. Manage on-chain contact information and instant messaging addresses for real-time encrypted communication");
1
+ import{z}from'zod';import{WithPermissionObjectSchema,CallEnvSchema,SubmissionCallSchema}from'./base.js';import{NameOrAddressSchema,ReceivedObjectsOrRecentlySchema,DescriptionSchema,LongNameSchema,NameSchema}from'../common/index.js';export const ImEntrySchema=z['object']({'at':NameOrAddressSchema['describe']('Contact\x27s\x20account\x20address\x20or\x20name\x20for\x20instant\x20messaging'),'description':LongNameSchema['optional']()['describe']('Optional\x20description\x20or\x20note\x20about\x20this\x20contact')})['strict']()['describe']('An\x20instant\x20messaging\x20contact\x20entry\x20with\x20address\x20and\x20optional\x20description');export const ImsOperationSchema=z['discriminatedUnion']('op',[z['object']({'op':z['literal']('add')['describe']('Add\x20new\x20IM\x20contacts\x20to\x20the\x20list'),'im':z['array'](ImEntrySchema)['describe']('List\x20of\x20IM\x20contacts\x20to\x20add')})['strict']()['describe']('Add\x20operation:\x20Append\x20new\x20contacts\x20to\x20the\x20existing\x20IM\x20list'),z['object']({'op':z['literal']('set')['describe']('Set/replace\x20all\x20IM\x20contacts'),'im':z['array'](ImEntrySchema)['describe']('Complete\x20list\x20of\x20IM\x20contacts\x20to\x20set')})['strict']()['describe']('Set\x20operation:\x20Replace\x20entire\x20IM\x20list\x20with\x20new\x20contacts'),z['object']({'op':z['literal']('remove')['describe']('Remove\x20specific\x20IM\x20contacts'),'im':z['array'](NameOrAddressSchema)['describe']('List\x20of\x20contact\x20addresses\x20or\x20names\x20to\x20remove')})['strict']()['describe']('Remove\x20operation:\x20Delete\x20specified\x20contacts\x20from\x20the\x20IM\x20list'),z['object']({'op':z['literal']('clear')['describe']('Clear\x20all\x20IM\x20contacts')})['strict']()['describe']('Clear\x20operation:\x20Remove\x20all\x20contacts\x20from\x20the\x20IM\x20list')])['describe']('IM\x20list\x20operation:\x20add,\x20set,\x20remove,\x20or\x20clear\x20contacts');export const CallContact_DataSchema=z['object']({'object':WithPermissionObjectSchema,'my_status':NameSchema['optional']()['describe']('Set\x20your\x20status\x20message\x20in\x20this\x20contact\x20list.\x20Only\x20valid\x20if\x20your\x20account\x20is\x20already\x20in\x20the\x20IM\x20list'),'description':DescriptionSchema['optional']()['describe']('Contact\x20object\x20description\x20or\x20public\x20information'),'location':LongNameSchema['optional']()['describe']('Physical\x20or\x20virtual\x20location\x20information\x20for\x20this\x20contact'),'ims':ImsOperationSchema['optional']()['describe']('IM\x20contact\x20list\x20operation:\x20add,\x20set,\x20remove,\x20or\x20clear\x20instant\x20messaging\x20contacts'),'owner_receive':ReceivedObjectsOrRecentlySchema['optional']()['describe']('Receive\x20objects\x20sent\x20to\x20this\x20contact\x20object\x20and\x20unwrap\x20them\x20to\x20the\x20permission\x20owner')})['strict']()['describe']('On-chain\x20Contact\x20operations.\x20USAGE:\x20(1)\x20CREATE\x20NEW:\x20Set\x20\x27object\x27\x20field\x20with\x20OBJECT\x20format\x20{name,\x20permission,\x20...}\x20to\x20create\x20a\x20Contact.\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 CallContact_InputSchema=z['object']({'data':CallContact_DataSchema['describe']('Contact\x20operation\x20data\x20containing\x20object\x20reference\x20and\x20operations\x20to\x20perform'),'env':CallEnvSchema['optional']()['describe']('Call\x20environment\x20parameters\x20including\x20account,\x20network,\x20and\x20cache\x20settings'),'submission':SubmissionCallSchema['optional']()['describe']('Guard\x20submission\x20data\x20for\x20permission\x20verification')})['strict']()['describe']('Contact\x20object\x20operation\x20data.\x20Manage\x20on-chain\x20contact\x20information\x20and\x20instant\x20messaging\x20addresses\x20for\x20real-time\x20encrypted\x20communication');
@@ -1,51 +1 @@
1
- import { z } from 'zod';
2
- import { WithPermissionObjectSchema, ObjectsSchema, CallEnvSchema, SubmissionCallSchema, } from './base.js';
3
- import { ServiceGuardSchema } from '../query/index.js';
4
- import { AccountOrMark_AddressSchema, DescriptionSchema, LongNameSchema, NameOrAddressSchema, ReceivedObjectsOrRecentlySchema } from '../common/index.js';
5
- // guards字段类型
6
- export const GuardsSchema = z.discriminatedUnion('op', [
7
- z.object({
8
- op: z.literal('add'),
9
- guard: z.array(ServiceGuardSchema).describe('List of guard IDs or names to add'),
10
- }).strict(),
11
- z.object({
12
- op: z.literal('set'),
13
- guard: z.array(ServiceGuardSchema).describe('List of guard IDs or names to set'),
14
- }).strict(),
15
- z.object({
16
- op: z.literal('remove'),
17
- guard: z.array(NameOrAddressSchema).describe('List of guard IDs or names to remove'),
18
- }).strict(),
19
- z.object({
20
- op: z.literal('clear'),
21
- }).strict(),
22
- ]);
23
- // DemandPresent字段类型
24
- export const DemandPresentSchema = z.object({
25
- recommend: DescriptionSchema.describe('Recommendation for the demand'),
26
- by_guard: NameOrAddressSchema.optional().describe('Guard ID or name, used to select which Guard\'s verification to pass through'),
27
- service: NameOrAddressSchema.optional().describe('Service ID or name to present'),
28
- }).strict();
29
- // FeedbackInfo字段类型
30
- export const FeedbackInfoSchema = z.object({
31
- who: AccountOrMark_AddressSchema.describe('Account address or mark name, used to identify providing feedback to this user'),
32
- acceptance_score: z.number().int().min(0).max(255).optional().describe('Acceptance score, used to evaluate the reception level of the service recommended by the user'),
33
- feedback: DescriptionSchema.optional().describe('Feedback content for the user'),
34
- }).strict();
35
- // CallDemand_Data类型
36
- export const CallDemand_DataSchema = z.object({
37
- object: WithPermissionObjectSchema,
38
- present: DemandPresentSchema.optional().describe('Recommend Service to Demand object'),
39
- description: DescriptionSchema.optional(),
40
- location: LongNameSchema.optional().describe('Service location of the Demand object'),
41
- rewards: ObjectsSchema.optional().describe('Reward information of the Demand object'),
42
- feedback: z.array(FeedbackInfoSchema).optional().describe('User feedback information for the Demand object'),
43
- guards: GuardsSchema.optional().describe('Validation Guard list for the Demand object. Used to verify whether the service recommended by the user meets the requirements'),
44
- 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.'),
45
- um: z.union([NameOrAddressSchema, z.null()]).optional().describe('Contact object.'),
46
- }).strict().describe("On-chain Demand operations. USAGE: (1) CREATE NEW: Set 'object' field with {name, permission, ...} to create a Demand. 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.");
47
- export const CallDemand_InputSchema = z.object({
48
- data: CallDemand_DataSchema,
49
- env: CallEnvSchema.optional(),
50
- submission: SubmissionCallSchema.optional(),
51
- }).strict();
1
+ import{z}from'zod';import{WithPermissionObjectSchema,ObjectsSchema,CallEnvSchema,SubmissionCallSchema}from'./base.js';import{ServiceGuardSchema}from'../query/index.js';import{AccountOrMark_AddressSchema,DescriptionSchema,LongNameSchema,NameOrAddressSchema,ReceivedObjectsOrRecentlySchema}from'../common/index.js';export const GuardsSchema=z['discriminatedUnion']('op',[z['object']({'op':z['literal']('add'),'guard':z['array'](ServiceGuardSchema)['describe']('List\x20of\x20guard\x20IDs\x20or\x20names\x20to\x20add')})['strict'](),z['object']({'op':z['literal']('set'),'guard':z['array'](ServiceGuardSchema)['describe']('List\x20of\x20guard\x20IDs\x20or\x20names\x20to\x20set')})['strict'](),z['object']({'op':z['literal']('remove'),'guard':z['array'](NameOrAddressSchema)['describe']('List\x20of\x20guard\x20IDs\x20or\x20names\x20to\x20remove')})['strict'](),z['object']({'op':z['literal']('clear')})['strict']()]);export const DemandPresentSchema=z['object']({'recommend':DescriptionSchema['describe']('Recommendation\x20for\x20the\x20demand'),'by_guard':NameOrAddressSchema['optional']()['describe']('Guard\x20ID\x20or\x20name,\x20used\x20to\x20select\x20which\x20Guard\x27s\x20verification\x20to\x20pass\x20through'),'service':NameOrAddressSchema['optional']()['describe']('Service\x20ID\x20or\x20name\x20to\x20present')})['strict']();export const FeedbackInfoSchema=z['object']({'who':AccountOrMark_AddressSchema['describe']('Account\x20address\x20or\x20mark\x20name,\x20used\x20to\x20identify\x20providing\x20feedback\x20to\x20this\x20user'),'acceptance_score':z['number']()['int']()['min'](0x0)['max'](0xff)['optional']()['describe']('Acceptance\x20score,\x20used\x20to\x20evaluate\x20the\x20reception\x20level\x20of\x20the\x20service\x20recommended\x20by\x20the\x20user'),'feedback':DescriptionSchema['optional']()['describe']('Feedback\x20content\x20for\x20the\x20user')})['strict']();export const CallDemand_DataSchema=z['object']({'object':WithPermissionObjectSchema,'present':DemandPresentSchema['optional']()['describe']('Recommend\x20Service\x20to\x20Demand\x20object'),'description':DescriptionSchema['optional'](),'location':LongNameSchema['optional']()['describe']('Service\x20location\x20of\x20the\x20Demand\x20object'),'rewards':ObjectsSchema['optional']()['describe']('Reward\x20information\x20of\x20the\x20Demand\x20object'),'feedback':z['array'](FeedbackInfoSchema)['optional']()['describe']('User\x20feedback\x20information\x20for\x20the\x20Demand\x20object'),'guards':GuardsSchema['optional']()['describe']('Validation\x20Guard\x20list\x20for\x20the\x20Demand\x20object.\x20Used\x20to\x20verify\x20whether\x20the\x20service\x20recommended\x20by\x20the\x20user\x20meets\x20the\x20requirements'),'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']([NameOrAddressSchema,z['null']()])['optional']()['describe']('Contact\x20object.')})['strict']()['describe']('On-chain\x20Demand\x20operations.\x20USAGE:\x20(1)\x20CREATE\x20NEW:\x20Set\x20\x27object\x27\x20field\x20with\x20OBJECT\x20format\x20{name,\x20permission,\x20...}\x20to\x20create\x20a\x20Demand.\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 CallDemand_InputSchema=z['object']({'data':CallDemand_DataSchema,'env':CallEnvSchema['optional'](),'submission':SubmissionCallSchema['optional']()})['strict']();
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  export declare const CallGuard_RootSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
3
3
  type: z.ZodLiteral<"node">;
4
4
  node: z.ZodType<any, z.ZodTypeDef, any>;
5
- }, "strip", z.ZodTypeAny, {
5
+ }, "strict", z.ZodTypeAny, {
6
6
  type: "node";
7
7
  node?: any;
8
8
  }, {
@@ -12,7 +12,7 @@ export declare const CallGuard_RootSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
12
12
  type: z.ZodLiteral<"file">;
13
13
  file_path: z.ZodString;
14
14
  format: z.ZodDefault<z.ZodOptional<z.ZodEnum<["json", "markdown"]>>>;
15
- }, "strip", z.ZodTypeAny, {
15
+ }, "strict", z.ZodTypeAny, {
16
16
  type: "file";
17
17
  format: "markdown" | "json";
18
18
  file_path: string;
@@ -112,7 +112,7 @@ export declare const CallGuard_DataSchema: z.ZodObject<{
112
112
  root: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
113
113
  type: z.ZodLiteral<"node">;
114
114
  node: z.ZodType<any, z.ZodTypeDef, any>;
115
- }, "strip", z.ZodTypeAny, {
115
+ }, "strict", z.ZodTypeAny, {
116
116
  type: "node";
117
117
  node?: any;
118
118
  }, {
@@ -122,7 +122,7 @@ export declare const CallGuard_DataSchema: z.ZodObject<{
122
122
  type: z.ZodLiteral<"file">;
123
123
  file_path: z.ZodString;
124
124
  format: z.ZodDefault<z.ZodOptional<z.ZodEnum<["json", "markdown"]>>>;
125
- }, "strip", z.ZodTypeAny, {
125
+ }, "strict", z.ZodTypeAny, {
126
126
  type: "file";
127
127
  format: "markdown" | "json";
128
128
  file_path: string;
@@ -306,7 +306,7 @@ export declare const CallGuard_InputSchema: z.ZodObject<{
306
306
  root: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
307
307
  type: z.ZodLiteral<"node">;
308
308
  node: z.ZodType<any, z.ZodTypeDef, any>;
309
- }, "strip", z.ZodTypeAny, {
309
+ }, "strict", z.ZodTypeAny, {
310
310
  type: "node";
311
311
  node?: any;
312
312
  }, {
@@ -316,7 +316,7 @@ export declare const CallGuard_InputSchema: z.ZodObject<{
316
316
  type: z.ZodLiteral<"file">;
317
317
  file_path: z.ZodString;
318
318
  format: z.ZodDefault<z.ZodOptional<z.ZodEnum<["json", "markdown"]>>>;
319
- }, "strip", z.ZodTypeAny, {
319
+ }, "strict", z.ZodTypeAny, {
320
320
  type: "file";
321
321
  format: "markdown" | "json";
322
322
  file_path: string;
@@ -1,67 +1 @@
1
- import { z } from 'zod';
2
- import { CallEnvSchema, NamedObjectSchema, SubmissionCallSchema } from './base.js';
3
- import { GuardNodeSchema } from '../query/index.js';
4
- import { DescriptionSchema, GuardTableItemBaseSchema, NameOrAddressSchema } from '../common/index.js';
5
- // CallGuard_RootSchema - Root 可以是直接节点或文件引用
6
- export const CallGuard_RootSchema = z.discriminatedUnion("type", [
7
- // type: node - 直接提供 GuardNode 计算树
8
- z.object({
9
- type: z.literal("node"),
10
- node: GuardNodeSchema.describe("Guard computational tree root node. MUST return a Bool value (pass/fail)."),
11
- }),
12
- // type: file - 从 JSON/Markdown 文件加载
13
- z.object({
14
- type: z.literal("file"),
15
- file_path: z.string().describe("Path to JSON or Markdown file containing Guard definition. File can define: namedNew, description, table, root, rely."),
16
- format: z.enum(["json", "markdown"]).optional().default("json")
17
- .describe("File format: 'json' or 'markdown'. Default is 'json'."),
18
- }),
19
- ]).describe("Guard root definition. Either provide a direct node tree or reference a file to load. When using file type, fields defined in the schema (namedNew, description, table, rely) will OVERRIDE the corresponding fields in the file.");
20
- // CallGuard_DataSchema - Guard 数据定义
21
- export const CallGuard_DataSchema = z.object({
22
- namedNew: NamedObjectSchema.optional().describe("Name and optional tags for the new Guard object. Set 'onChain: true' to create a public on-chain identity. When using root.type='file', this field OVERRIDES namedNew in the file."),
23
- description: DescriptionSchema.optional().describe("Guard description. When using root.type='file', this field OVERRIDES description in the file."),
24
- table: z.array(GuardTableItemBaseSchema).optional().describe("Data table of the Guard object. When using root.type='file', this field OVERRIDES table in the file."),
25
- root: CallGuard_RootSchema.describe("Root definition: either a direct node tree (type='node') or a file reference (type='file'). When type='file', the file can define all Guard fields (namedNew, description, table, root, rely), and schema fields override file content."),
26
- rely: z.object({
27
- guards: z.array(NameOrAddressSchema).describe("List of dependent Guard object IDs or names."),
28
- logic_or: z.boolean().optional().describe("Whether to use logical OR operator."),
29
- }).optional().describe("All Guard objects that the new Guard object depends on. If logic_or is true, the execution result of the new Guard object is the logical OR of the execution results of all dependent Guard objects; otherwise, it is logical AND. When using root.type='file', this field OVERRIDES rely in the file."),
30
- }).strict().describe("On-chain Guard creation. IMPORTANT: All defined data (include all submitted data) must be defined in the 'table' field. USAGE: Set 'namedNew' field with {name, tags?, onChain?} to name the new Guard. The Guard is immutable once created. Define the validation logic in 'root' field. When root.type='file', the file can contain all Guard fields, and any fields defined in the schema will OVERRIDE the file content.");
31
- // CallGuard_InputSchema - Guard 创建 Schema
32
- export const CallGuard_InputSchema = z.object({
33
- data: CallGuard_DataSchema.describe("Guard data definition."),
34
- env: CallEnvSchema.optional(),
35
- }).strict().describe("On-chain Guard creation input wrapper. Contains the Guard data definition and optional environment settings.");
36
- // CallGenPassport_InputSchema - 用于 gen_passport 函数
37
- export const CallGenPassport_InputSchema = z.object({
38
- guard: NameOrAddressSchema.describe("Guard object ID to verify and generate passport from"),
39
- info: SubmissionCallSchema.optional().describe("Optional submission data. If not provided, will attempt to get existing submissions from the guard."),
40
- env: CallEnvSchema.optional(),
41
- }).strict().describe("Generate a new Passport object after Guard verification succeeds. The Passport is an immutable on-chain object that can be used for offline friend verification, transaction condition verification, etc.");
42
- // Guard2File_InputSchema - 用于 guard2file 函数
43
- export const Guard2File_InputSchema = z.object({
44
- guard: NameOrAddressSchema.describe("Guard object ID or name to export"),
45
- file_path: z.string().describe("Output file path (absolute or relative)"),
46
- format: z.enum(["json", "markdown"]).optional().describe("Output format: 'json' (default) or 'markdown'"),
47
- env: CallEnvSchema.optional(),
48
- }).strict().describe("Query a Guard object from the blockchain and export its definition to a JSON or Markdown file. The exported file can be edited and used to create new Guard objects.");
49
- // Guard2File_OutputSchema - guard2file 输出 schema
50
- export const Guard2File_OutputSchema = z.discriminatedUnion("status", [
51
- z.object({
52
- status: z.literal("success"),
53
- data: z.object({
54
- file_path: z.string().describe("Absolute path of the exported file"),
55
- format: z.enum(["json", "markdown"]).describe("Export format"),
56
- guard_object: z.string().describe("Guard object ID"),
57
- }).strict().describe("Success result data"),
58
- }).strict(),
59
- z.object({
60
- status: z.literal("error"),
61
- error: z.string().describe("Error message"),
62
- }).strict(),
63
- ]).describe("Guard2File operation output schema with discriminator");
64
- // Guard2File_OutputWrappedSchema - 包装后的输出 schema
65
- export const Guard2File_OutputWrappedSchema = z.object({
66
- result: Guard2File_OutputSchema,
67
- }).strict().describe("Guard2File operation output wrapped schema");
1
+ import{z}from'zod';import{CallEnvSchema,NamedObjectSchema,SubmissionCallSchema}from'./base.js';import{GuardNodeSchema}from'../query/index.js';import{DescriptionSchema,GuardTableItemBaseSchema,NameOrAddressSchema}from'../common/index.js';export const CallGuard_RootSchema=z['discriminatedUnion']('type',[z['object']({'type':z['literal']('node'),'node':GuardNodeSchema['describe']('Guard\x20computational\x20tree\x20root\x20node.\x20MUST\x20return\x20a\x20Bool\x20value\x20(pass/fail).')})['strict'](),z['object']({'type':z['literal']('file'),'file_path':z['string']()['describe']('Path\x20to\x20JSON\x20or\x20Markdown\x20file\x20containing\x20Guard\x20definition.\x20File\x20can\x20define:\x20namedNew,\x20description,\x20table,\x20root,\x20rely.'),'format':z['enum'](['json','markdown'])['optional']()['default']('json')['describe']('File\x20format:\x20\x27json\x27\x20or\x20\x27markdown\x27.\x20Default\x20is\x20\x27json\x27.')})['strict']()])['describe']('Guard\x20root\x20definition.\x20Either\x20provide\x20a\x20direct\x20node\x20tree\x20or\x20reference\x20a\x20file\x20to\x20load.\x20When\x20using\x20file\x20type,\x20fields\x20defined\x20in\x20the\x20schema\x20(namedNew,\x20description,\x20table,\x20rely)\x20will\x20OVERRIDE\x20the\x20corresponding\x20fields\x20in\x20the\x20file.');export const CallGuard_DataSchema=z['object']({'namedNew':NamedObjectSchema['optional']()['describe']('Name\x20and\x20optional\x20tags\x20for\x20the\x20new\x20Guard\x20object.\x20Set\x20\x27onChain:\x20true\x27\x20to\x20create\x20a\x20public\x20on-chain\x20identity.\x20When\x20using\x20root.type=\x27file\x27,\x20this\x20field\x20OVERRIDES\x20namedNew\x20in\x20the\x20file.'),'description':DescriptionSchema['optional']()['describe']('Guard\x20description.\x20When\x20using\x20root.type=\x27file\x27,\x20this\x20field\x20OVERRIDES\x20description\x20in\x20the\x20file.'),'table':z['array'](GuardTableItemBaseSchema)['optional']()['describe']('Data\x20table\x20of\x20the\x20Guard\x20object.\x20When\x20using\x20root.type=\x27file\x27,\x20this\x20field\x20OVERRIDES\x20table\x20in\x20the\x20file.'),'root':CallGuard_RootSchema['describe']('Root\x20definition:\x20either\x20a\x20direct\x20node\x20tree\x20(type=\x27node\x27)\x20or\x20a\x20file\x20reference\x20(type=\x27file\x27).\x20When\x20type=\x27file\x27,\x20the\x20file\x20can\x20define\x20all\x20Guard\x20fields\x20(namedNew,\x20description,\x20table,\x20root,\x20rely),\x20and\x20schema\x20fields\x20override\x20file\x20content.'),'rely':z['object']({'guards':z['array'](NameOrAddressSchema)['describe']('List\x20of\x20dependent\x20Guard\x20object\x20IDs\x20or\x20names.'),'logic_or':z['boolean']()['optional']()['describe']('Whether\x20to\x20use\x20logical\x20OR\x20operator.')})['optional']()['describe']('All\x20Guard\x20objects\x20that\x20the\x20new\x20Guard\x20object\x20depends\x20on.\x20If\x20logic_or\x20is\x20true,\x20the\x20execution\x20result\x20of\x20the\x20new\x20Guard\x20object\x20is\x20the\x20logical\x20OR\x20of\x20the\x20execution\x20results\x20of\x20all\x20dependent\x20Guard\x20objects;\x20otherwise,\x20it\x20is\x20logical\x20AND.\x20When\x20using\x20root.type=\x27file\x27,\x20this\x20field\x20OVERRIDES\x20rely\x20in\x20the\x20file.')})['strict']()['describe']('On-chain\x20Guard\x20creation.\x20IMPORTANT:\x20All\x20defined\x20data\x20(include\x20all\x20submitted\x20data)\x20must\x20be\x20defined\x20in\x20the\x20\x27table\x27\x20field.\x20USAGE:\x20Set\x20\x27namedNew\x27\x20field\x20with\x20{name,\x20tags?,\x20onChain?}\x20to\x20name\x20the\x20new\x20Guard.\x20The\x20Guard\x20is\x20immutable\x20once\x20created.\x20Define\x20the\x20validation\x20logic\x20in\x20\x27root\x27\x20field.\x20When\x20root.type=\x27file\x27,\x20the\x20file\x20can\x20contain\x20all\x20Guard\x20fields,\x20and\x20any\x20fields\x20defined\x20in\x20the\x20schema\x20will\x20OVERRIDE\x20the\x20file\x20content.');export const CallGuard_InputSchema=z['object']({'data':CallGuard_DataSchema['describe']('Guard\x20data\x20definition.'),'env':CallEnvSchema['optional']()})['strict']()['describe']('On-chain\x20Guard\x20creation\x20input\x20wrapper.\x20Contains\x20the\x20Guard\x20data\x20definition\x20and\x20optional\x20environment\x20settings.');export const CallGenPassport_InputSchema=z['object']({'guard':NameOrAddressSchema['describe']('Guard\x20object\x20ID\x20to\x20verify\x20and\x20generate\x20passport\x20from'),'info':SubmissionCallSchema['optional']()['describe']('Optional\x20submission\x20data.\x20If\x20not\x20provided,\x20will\x20attempt\x20to\x20get\x20existing\x20submissions\x20from\x20the\x20guard.'),'env':CallEnvSchema['optional']()})['strict']()['describe']('Generate\x20a\x20new\x20Passport\x20object\x20after\x20Guard\x20verification\x20succeeds.\x20The\x20Passport\x20is\x20an\x20immutable\x20on-chain\x20object\x20that\x20can\x20be\x20used\x20for\x20offline\x20friend\x20verification,\x20transaction\x20condition\x20verification,\x20etc.');export const Guard2File_InputSchema=z['object']({'guard':NameOrAddressSchema['describe']('Guard\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\x20Guard\x20object\x20from\x20the\x20blockchain\x20and\x20export\x20its\x20definition\x20to\x20a\x20JSON\x20or\x20Markdown\x20file.\x20The\x20exported\x20file\x20can\x20be\x20edited\x20and\x20used\x20to\x20create\x20new\x20Guard\x20objects.');export const Guard2File_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'),'guard_object':z['string']()['describe']('Guard\x20object\x20ID')})['strict']()['describe']('Success\x20result\x20data')})['strict'](),z['object']({'status':z['literal']('error'),'error':z['string']()['describe']('Error\x20message')})['strict']()])['describe']('Guard2File\x20operation\x20output\x20schema\x20with\x20discriminator');export const Guard2File_OutputWrappedSchema=z['object']({'result':Guard2File_OutputSchema})['strict']()['describe']('Guard2File\x20operation\x20output\x20wrapped\x20schema');