wowok_agent 1.6.6 → 2.1.8

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.

Potentially problematic release.


This version of wowok_agent might be problematic. Click here for more details.

Files changed (181) hide show
  1. package/README.md +20 -40
  2. package/dist/index.d.ts +13528 -27
  3. package/dist/index.js +1026 -27
  4. package/dist/schema/call/allocation.d.ts +1370 -0
  5. package/dist/schema/call/allocation.js +27 -0
  6. package/dist/schema/call/arbitration.d.ts +1902 -0
  7. package/dist/schema/call/arbitration.js +106 -0
  8. package/dist/schema/call/base.d.ts +6381 -0
  9. package/dist/schema/call/base.js +152 -0
  10. package/dist/schema/call/contact.d.ts +898 -0
  11. package/dist/schema/call/contact.js +41 -0
  12. package/dist/schema/call/demand.d.ts +1193 -0
  13. package/dist/schema/call/demand.js +51 -0
  14. package/dist/schema/call/guard.d.ts +819 -0
  15. package/dist/schema/call/guard.js +67 -0
  16. package/dist/schema/call/handler.d.ts +80 -0
  17. package/dist/schema/call/handler.js +177 -0
  18. package/dist/schema/call/index.d.ts +18 -0
  19. package/dist/schema/call/index.js +19 -0
  20. package/dist/schema/call/machine.d.ts +3906 -0
  21. package/dist/schema/call/machine.js +164 -0
  22. package/dist/schema/call/order.d.ts +994 -0
  23. package/dist/schema/call/order.js +39 -0
  24. package/dist/schema/call/payment.d.ts +408 -0
  25. package/dist/schema/call/payment.js +20 -0
  26. package/dist/schema/call/permission.d.ts +2945 -0
  27. package/dist/schema/call/permission.js +118 -0
  28. package/dist/schema/call/personal.d.ts +1498 -0
  29. package/dist/schema/call/personal.js +81 -0
  30. package/dist/schema/call/progress.d.ts +847 -0
  31. package/dist/schema/call/progress.js +37 -0
  32. package/dist/schema/call/proof.d.ts +328 -0
  33. package/dist/schema/call/proof.js +27 -0
  34. package/dist/schema/call/repository.d.ts +2220 -0
  35. package/dist/schema/call/repository.js +85 -0
  36. package/dist/schema/call/reward.d.ts +1178 -0
  37. package/dist/schema/call/reward.js +46 -0
  38. package/dist/schema/call/service.d.ts +3534 -0
  39. package/dist/schema/call/service.js +87 -0
  40. package/dist/schema/call/treasury.d.ts +2399 -0
  41. package/dist/schema/call/treasury.js +76 -0
  42. package/dist/schema/common/index.d.ts +623 -0
  43. package/dist/schema/common/index.js +331 -0
  44. package/dist/schema/index.d.ts +7 -0
  45. package/dist/schema/index.js +8 -0
  46. package/dist/schema/local/index.d.ts +7824 -0
  47. package/dist/schema/local/index.js +913 -0
  48. package/dist/schema/local/wip.d.ts +781 -0
  49. package/dist/schema/local/wip.js +229 -0
  50. package/dist/schema/messenger/index.d.ts +3624 -0
  51. package/dist/schema/messenger/index.js +407 -0
  52. package/dist/schema/query/index.d.ts +27176 -0
  53. package/dist/schema/query/index.js +1313 -0
  54. package/dist/schema/utils/guard-parser.d.ts +20 -0
  55. package/dist/schema/utils/guard-parser.js +410 -0
  56. package/dist/schema/utils/guard-query-utils.d.ts +5 -0
  57. package/dist/schema/utils/guard-query-utils.js +22 -0
  58. package/dist/schema/utils/node-parser.d.ts +59 -0
  59. package/dist/schema/utils/node-parser.js +382 -0
  60. package/dist/schema/utils/permission-index-utils.d.ts +2 -0
  61. package/dist/schema/utils/permission-index-utils.js +10 -0
  62. package/package.json +31 -49
  63. package/LICENSE +0 -201
  64. package/dist/call/arbitration.d.ts +0 -57
  65. package/dist/call/arbitration.d.ts.map +0 -1
  66. package/dist/call/arbitration.js +0 -245
  67. package/dist/call/arbitration.js.map +0 -1
  68. package/dist/call/base.d.ts +0 -85
  69. package/dist/call/base.d.ts.map +0 -1
  70. package/dist/call/base.js +0 -231
  71. package/dist/call/base.js.map +0 -1
  72. package/dist/call/call.d.ts +0 -95
  73. package/dist/call/call.d.ts.map +0 -1
  74. package/dist/call/call.js +0 -149
  75. package/dist/call/call.js.map +0 -1
  76. package/dist/call/demand.d.ts +0 -46
  77. package/dist/call/demand.d.ts.map +0 -1
  78. package/dist/call/demand.js +0 -201
  79. package/dist/call/demand.js.map +0 -1
  80. package/dist/call/guard.d.ts +0 -53
  81. package/dist/call/guard.d.ts.map +0 -1
  82. package/dist/call/guard.js +0 -386
  83. package/dist/call/guard.js.map +0 -1
  84. package/dist/call/machine.d.ts +0 -97
  85. package/dist/call/machine.d.ts.map +0 -1
  86. package/dist/call/machine.js +0 -342
  87. package/dist/call/machine.js.map +0 -1
  88. package/dist/call/object_permission.d.ts +0 -14
  89. package/dist/call/object_permission.d.ts.map +0 -1
  90. package/dist/call/object_permission.js +0 -59
  91. package/dist/call/object_permission.js.map +0 -1
  92. package/dist/call/permission.d.ts +0 -63
  93. package/dist/call/permission.d.ts.map +0 -1
  94. package/dist/call/permission.js +0 -137
  95. package/dist/call/permission.js.map +0 -1
  96. package/dist/call/personal.d.ts +0 -47
  97. package/dist/call/personal.d.ts.map +0 -1
  98. package/dist/call/personal.js +0 -119
  99. package/dist/call/personal.js.map +0 -1
  100. package/dist/call/repository.d.ts +0 -117
  101. package/dist/call/repository.d.ts.map +0 -1
  102. package/dist/call/repository.js +0 -408
  103. package/dist/call/repository.js.map +0 -1
  104. package/dist/call/service.d.ts +0 -115
  105. package/dist/call/service.d.ts.map +0 -1
  106. package/dist/call/service.js +0 -550
  107. package/dist/call/service.js.map +0 -1
  108. package/dist/call/treasury.d.ts +0 -46
  109. package/dist/call/treasury.d.ts.map +0 -1
  110. package/dist/call/treasury.js +0 -222
  111. package/dist/call/treasury.js.map +0 -1
  112. package/dist/common.d.ts +0 -12
  113. package/dist/common.d.ts.map +0 -1
  114. package/dist/common.js +0 -71
  115. package/dist/common.js.map +0 -1
  116. package/dist/index.d.ts.map +0 -1
  117. package/dist/index.js.map +0 -1
  118. package/dist/local/.d.ts +0 -20
  119. package/dist/local/.d.ts.map +0 -1
  120. package/dist/local/.js +0 -76
  121. package/dist/local/.js.map +0 -1
  122. package/dist/local/account.d.ts +0 -42
  123. package/dist/local/account.d.ts.map +0 -1
  124. package/dist/local/account.js +0 -335
  125. package/dist/local/account.js.map +0 -1
  126. package/dist/local/cache.d.ts +0 -32
  127. package/dist/local/cache.d.ts.map +0 -1
  128. package/dist/local/cache.js +0 -77
  129. package/dist/local/cache.js.map +0 -1
  130. package/dist/local/coin.d.ts +0 -22
  131. package/dist/local/coin.d.ts.map +0 -1
  132. package/dist/local/coin.js +0 -123
  133. package/dist/local/coin.js.map +0 -1
  134. package/dist/local/config.d.ts +0 -20
  135. package/dist/local/config.d.ts.map +0 -1
  136. package/dist/local/config.js +0 -75
  137. package/dist/local/config.js.map +0 -1
  138. package/dist/local/index.d.ts +0 -110
  139. package/dist/local/index.d.ts.map +0 -1
  140. package/dist/local/index.js +0 -122
  141. package/dist/local/index.js.map +0 -1
  142. package/dist/local/local.d.ts +0 -55
  143. package/dist/local/local.d.ts.map +0 -1
  144. package/dist/local/local.js +0 -248
  145. package/dist/local/local.js.map +0 -1
  146. package/dist/query/events.d.ts +0 -65
  147. package/dist/query/events.d.ts.map +0 -1
  148. package/dist/query/events.js +0 -75
  149. package/dist/query/events.js.map +0 -1
  150. package/dist/query/objects.d.ts +0 -346
  151. package/dist/query/objects.d.ts.map +0 -1
  152. package/dist/query/objects.js +0 -472
  153. package/dist/query/objects.js.map +0 -1
  154. package/dist/query/permission.d.ts +0 -15
  155. package/dist/query/permission.d.ts.map +0 -1
  156. package/dist/query/permission.js +0 -45
  157. package/dist/query/permission.js.map +0 -1
  158. package/dist/query/received.d.ts +0 -16
  159. package/dist/query/received.d.ts.map +0 -1
  160. package/dist/query/received.js +0 -16
  161. package/dist/query/received.js.map +0 -1
  162. package/dist/schema/call.d.ts +0 -13005
  163. package/dist/schema/call.d.ts.map +0 -1
  164. package/dist/schema/call.js +0 -997
  165. package/dist/schema/call.js.map +0 -1
  166. package/dist/schema/const.d.ts +0 -254
  167. package/dist/schema/const.d.ts.map +0 -1
  168. package/dist/schema/const.js +0 -305
  169. package/dist/schema/const.js.map +0 -1
  170. package/dist/schema/local.d.ts +0 -702
  171. package/dist/schema/local.d.ts.map +0 -1
  172. package/dist/schema/local.js +0 -150
  173. package/dist/schema/local.js.map +0 -1
  174. package/dist/schema/query.d.ts +0 -1465
  175. package/dist/schema/query.d.ts.map +0 -1
  176. package/dist/schema/query.js +0 -224
  177. package/dist/schema/query.js.map +0 -1
  178. package/dist/schema/util.d.ts +0 -71
  179. package/dist/schema/util.d.ts.map +0 -1
  180. package/dist/schema/util.js +0 -139
  181. package/dist/schema/util.js.map +0 -1
@@ -0,0 +1,152 @@
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 public identities you want to share."),
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");