wowok_agent 2.1.40 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2064 -177
- package/dist/index.js +1284 -1
- package/dist/schema/call/allocation.js +24 -1
- package/dist/schema/call/arbitration.js +92 -1
- package/dist/schema/call/base.d.ts +1 -1
- package/dist/schema/call/base.js +138 -1
- package/dist/schema/call/contact.js +37 -1
- package/dist/schema/call/demand.js +47 -1
- package/dist/schema/call/guard.js +58 -1
- package/dist/schema/call/handler.js +171 -1
- package/dist/schema/call/index.js +18 -1
- package/dist/schema/call/machine.d.ts +32 -32
- package/dist/schema/call/machine.js +152 -1
- package/dist/schema/call/order.js +34 -1
- package/dist/schema/call/payment.js +17 -1
- package/dist/schema/call/permission.js +105 -1
- package/dist/schema/call/personal.js +68 -1
- package/dist/schema/call/progress.js +26 -1
- package/dist/schema/call/proof.js +27 -1
- package/dist/schema/call/repository.js +76 -1
- package/dist/schema/call/reward.js +42 -1
- package/dist/schema/call/service.js +82 -1
- package/dist/schema/call/treasury.js +71 -1
- package/dist/schema/common/index.js +345 -1
- package/dist/schema/index.js +7 -1
- package/dist/schema/local/index.js +855 -1
- package/dist/schema/local/wip.js +187 -1
- package/dist/schema/messenger/index.js +446 -1
- package/dist/schema/query/index.d.ts +43 -43
- package/dist/schema/query/index.js +1265 -1
- package/dist/schema/utils/guard-parser.js +401 -1
- package/dist/schema/utils/guard-query-utils.js +22 -1
- package/dist/schema/utils/node-parser.js +353 -1
- package/dist/schema/utils/permission-index-utils.js +7 -1
- package/package.json +3 -6
|
@@ -1 +1,34 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CallEnvSchema, SubmissionCallSchema } from "./base.js";
|
|
3
|
+
import { OperateSchema } from "./progress.js";
|
|
4
|
+
import { AccountOrMark_AddressSchema, DescriptionSchema, LongNameSchema, ManyAccountOrMark_AddressSchema, NameOrAddressSchema } from "../common/index.js";
|
|
5
|
+
import { QueryReceivedResultSchema } from "../common/index.js";
|
|
6
|
+
export const ArbConfirmSchema = z.object({
|
|
7
|
+
arb: NameOrAddressSchema.describe("Arb object ID or name."),
|
|
8
|
+
confirm: z.boolean().describe("Whether to confirm that the submitted arbitration materials are valid for arbitration."),
|
|
9
|
+
description: DescriptionSchema.optional().describe("Message description for compensation application."),
|
|
10
|
+
proposition: z.array(LongNameSchema).optional().describe("Compensation claims.")
|
|
11
|
+
}).strict();
|
|
12
|
+
export const ArbObjectionSchema = z.object({
|
|
13
|
+
arb: NameOrAddressSchema.describe("Arb object ID or name."),
|
|
14
|
+
objection: DescriptionSchema.describe("Oppose and appeal the arbitration result, request re-arbitration"),
|
|
15
|
+
}).strict();
|
|
16
|
+
export const ArbClaimCompensationSchema = z.object({
|
|
17
|
+
arb: NameOrAddressSchema.describe("Arb object ID or name."),
|
|
18
|
+
}).strict();
|
|
19
|
+
export const CallOrder_DataSchema = z.object({
|
|
20
|
+
object: NameOrAddressSchema.describe("Order object ID or name."),
|
|
21
|
+
agents: ManyAccountOrMark_AddressSchema.optional().describe("Order agents. Agents can operate the order, such as canceling the order, modifying the order status, etc.; but cannot receive the funds received by the order."),
|
|
22
|
+
required_info: z.union([NameOrAddressSchema, z.null()]).optional().describe("Contact object ID (recipient) or WTS Proof object (delivery proof) that information has been delivered via Wowok Messenger."),
|
|
23
|
+
progress: OperateSchema.optional().describe("Advance order process"),
|
|
24
|
+
arb_confirm: ArbConfirmSchema.optional().describe("Submit compensation request and apply for arbitration"),
|
|
25
|
+
arb_objection: ArbObjectionSchema.optional().describe("Oppose and appeal the arbitration result, request re-arbitration."),
|
|
26
|
+
arb_claim_compensation: ArbClaimCompensationSchema.optional().describe("Specify the adjudicated Arb object to obtain order compensation."),
|
|
27
|
+
receive: QueryReceivedResultSchema.optional().describe("Unwrap CoinWrapper objects or other objects received by the order and transfer them to the order owner"),
|
|
28
|
+
transfer_to: AccountOrMark_AddressSchema.optional().describe("Set new owner of the order. Requires order owner permission to set."),
|
|
29
|
+
}).strict().describe("On-chain, operate on an Order object.");
|
|
30
|
+
export const CallOrder_InputSchema = z.object({
|
|
31
|
+
data: CallOrder_DataSchema,
|
|
32
|
+
env: CallEnvSchema.optional(),
|
|
33
|
+
submission: SubmissionCallSchema.optional(),
|
|
34
|
+
}).strict();
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PaymentInfoSchema } from "../query/index.js";
|
|
3
|
+
import { CoinParamSchema, CallEnvSchema, TypeNamedObjectSchema } from "./base.js";
|
|
4
|
+
import { AccountOrMark_AddressSchema } from "../common/index.js";
|
|
5
|
+
export const RevenueSchema = z.object({
|
|
6
|
+
recipient: AccountOrMark_AddressSchema,
|
|
7
|
+
amount: CoinParamSchema
|
|
8
|
+
}).strict().describe("Payment recipient and amount");
|
|
9
|
+
export const CallPayment_DataSchema = z.object({
|
|
10
|
+
object: TypeNamedObjectSchema,
|
|
11
|
+
revenue: z.array(RevenueSchema).describe("Array of payment recipients and amounts"),
|
|
12
|
+
info: PaymentInfoSchema
|
|
13
|
+
}).strict().describe("On-chain Payment creation. USAGE: Set 'object' field with {name, type, ...} to create a named Payment. NOTE: 'name' goes INSIDE 'object', NOT at the data root level. Payment is an immutable object - it can only be created, not modified. The 'object' field is CRITICAL and REQUIRED.");
|
|
14
|
+
export const CallPayment_InputSchema = z.object({
|
|
15
|
+
data: CallPayment_DataSchema,
|
|
16
|
+
env: CallEnvSchema.optional(),
|
|
17
|
+
}).strict();
|
|
@@ -1 +1,105 @@
|
|
|
1
|
-
import{z}from'zod';import{PermissionIndexTypeSchema}from'../query/index.js';import{CallEnvSchema,SubmissionCallSchema,NormalObjectSchema}from'./base.js';import{AccountOrMark_AddressSchema,DescriptionSchema,LongNameSchema,ManyAccountOrMark_AddressSchema,NameOrAddressSchema,ReceivedObjectsOrRecentlySchema}from'../common/index.js';export const RemarkSetSchema=z['object']({'op':z['literal']('set'),'index':PermissionIndexTypeSchema,'remark':LongNameSchema['describe']('Permission\x20remark.')})['strict']()['describe']('Set\x20remark\x20for\x20a\x20permission.');export const RemarkRemoveSchema=z['object']({'op':z['literal']('remove'),'index':PermissionIndexTypeSchema})['strict']()['describe']('Remove\x20remark\x20for\x20a\x20permission.');export const RemarkClearSchema=z['object']({'op':z['literal']('clear')})['strict']()['describe']('Clear\x20remarks\x20for\x20all\x20permissions.');export const RemarkSchema=z['discriminatedUnion']('op',[RemarkSetSchema,RemarkRemoveSchema,RemarkClearSchema])['describe']('Set\x20remarks\x20for\x20permissions.');export const TablePermByIndexSchema=z['discriminatedUnion']('op',[z['object']({'op':z['literal']('add\x20perm\x20by\x20index'),'index':PermissionIndexTypeSchema,'entity':ManyAccountOrMark_AddressSchema})['strict']()['describe']('Grant\x20a\x20specific\x20permission\x20to\x20multiple\x20entities\x20at\x20once.\x20USE\x20WHEN:\x20You\x20need\x20to\x20assign\x20the\x20SAME\x20permission\x20to\x20MULTIPLE\x20users/Guards.\x20Example:\x20Give\x20\x27create\x20service\x27\x20permission\x20to\x20Alice,\x20Bob,\x20and\x20Carol\x20simultaneously.'),z['object']({'op':z['literal']('set\x20perm\x20by\x20index'),'index':PermissionIndexTypeSchema,'entity':ManyAccountOrMark_AddressSchema})['strict']()['describe']('Replace\x20the\x20entity\x20list\x20for\x20a\x20specific\x20permission\x20with\x20a\x20new\x20set\x20of\x20entities.\x20USE\x20WHEN:\x20You\x20want\x20to\x20completely\x20redefine\x20WHO\x20has\x20this\x20permission.\x20WARNING:\x20This\x20overwrites\x20the\x20existing\x20entity\x20list\x20for\x20this\x20permission.'),z['object']({'op':z['literal']('remove\x20perm\x20by\x20index'),'index':PermissionIndexTypeSchema,'entity':ManyAccountOrMark_AddressSchema})['strict']()['describe']('Revoke\x20a\x20specific\x20permission\x20from\x20multiple\x20entities\x20at\x20once.\x20USE\x20WHEN:\x20You\x20need\x20to\x20remove\x20the\x20SAME\x20permission\x20from\x20MULTIPLE\x20users/Guards.\x20Example:\x20Remove\x20\x27create\x20service\x27\x20permission\x20from\x20Alice,\x20Bob,\x20and\x20Carol\x20simultaneously.')])['describe']('Permission-centric\x20operations:\x20Manage\x20WHO\x20has\x20a\x20specific\x20permission.\x20Best\x20for\x20batch-assigning\x20one\x20permission\x20to\x20many\x20users.\x20Structure:\x20{op:\x20\x27add|set|remove\x20perm\x20by\x20index\x27,\x20index:\x20permission_id,\x20entity:\x20[user1,\x20user2,\x20...]}');export const TablePermByEntitySchema=z['discriminatedUnion']('op',[z['object']({'op':z['literal']('add\x20perm\x20by\x20entity'),'entity':AccountOrMark_AddressSchema,'index':z['array'](PermissionIndexTypeSchema)})['strict']()['describe']('Grant\x20multiple\x20permissions\x20to\x20a\x20single\x20entity.\x20USE\x20WHEN:\x20You\x20need\x20to\x20give\x20ONE\x20user/Guard\x20MANY\x20permissions\x20at\x20once.\x20Example:\x20Give\x20Alice\x20all\x20Machine-related\x20permissions\x20(create,\x20edit,\x20publish,\x20pause,\x20etc.)\x20in\x20one\x20call.'),z['object']({'op':z['literal']('set\x20perm\x20by\x20entity'),'entity':AccountOrMark_AddressSchema,'index':z['array'](PermissionIndexTypeSchema)})['strict']()['describe']('Replace\x20all\x20permissions\x20of\x20a\x20single\x20entity\x20with\x20a\x20new\x20permission\x20set.\x20USE\x20WHEN:\x20You\x20want\x20to\x20completely\x20redefine\x20WHAT\x20permissions\x20a\x20user/Guard\x20has.\x20WARNING:\x20This\x20overwrites\x20all\x20existing\x20permissions\x20for\x20this\x20entity.'),z['object']({'op':z['literal']('remove\x20perm\x20by\x20entity'),'entity':AccountOrMark_AddressSchema,'index':z['array'](PermissionIndexTypeSchema)})['strict']()['describe']('Revoke\x20multiple\x20permissions\x20from\x20a\x20single\x20entity.\x20USE\x20WHEN:\x20You\x20need\x20to\x20remove\x20MANY\x20permissions\x20from\x20ONE\x20user/Guard\x20at\x20once.\x20Example:\x20Remove\x20all\x20Machine-related\x20permissions\x20from\x20Alice.')])['describe']('Entity-centric\x20operations:\x20Manage\x20WHAT\x20permissions\x20a\x20specific\x20user/Guard\x20has.\x20Best\x20for\x20assigning\x20many\x20permissions\x20to\x20one\x20user.\x20Structure:\x20{op:\x20\x27add|set|remove\x20perm\x20by\x20entity\x27,\x20entity:\x20user_id,\x20index:\x20[perm1,\x20perm2,\x20...]}');export const TableSchema=z['discriminatedUnion']('op',[...TablePermByIndexSchema['options'],...TablePermByEntitySchema['options']])['describe']('Manage\x20permission\x20assignments\x20using\x20two\x20complementary\x20approaches.\x20CHOOSE\x20THE\x20RIGHT\x20APPROACH:\x20(1)\x20\x27perm\x20by\x20index\x27\x20-\x20Use\x20when\x20granting\x20ONE\x20permission\x20to\x20MANY\x20users\x20(permission-centric).\x20Example:\x20Give\x20\x27create\x20service\x27\x20permission\x20to\x20Alice,\x20Bob,\x20and\x20Carol.\x20(2)\x20\x27perm\x20by\x20entity\x27\x20-\x20Use\x20when\x20granting\x20MANY\x20permissions\x20to\x20ONE\x20user\x20(entity-centric).\x20Example:\x20Give\x20Alice\x20all\x20Machine-related\x20permissions.\x20Both\x20approaches\x20support\x20add/set/remove\x20operations.\x20Requires\x20admin\x20permission.');export const EntitySwapReplaceCopySchema=z['discriminatedUnion']('op',[z['object']({'op':z['literal']('swap'),'entity1':AccountOrMark_AddressSchema,'entity2':AccountOrMark_AddressSchema})['strict']()['describe']('Swap\x20all\x20permission\x20indexes\x20between\x20two\x20entities.'),z['object']({'op':z['literal']('replace'),'entity1':AccountOrMark_AddressSchema,'entity2':AccountOrMark_AddressSchema})['strict']()['describe']('Remove\x20all\x20permission\x20indexes\x20from\x20entity1\x20and\x20add\x20them\x20to\x20entity2\x27s\x20permission\x20indexes.'),z['object']({'op':z['literal']('copy'),'entity1':AccountOrMark_AddressSchema,'entity2':AccountOrMark_AddressSchema})['strict']()['describe']('Add\x20all\x20permission\x20indexes\x20from\x20entity1\x20to\x20entity2\x27s\x20permission\x20indexes.')]);export const EntityDelSchema=z['object']({'op':z['literal']('del'),'entity':AccountOrMark_AddressSchema})['strict']()['describe']('Delete\x20all\x20permission\x20indexes\x20from\x20an\x20entity.');export const EntitySchema=z['discriminatedUnion']('op',[...EntitySwapReplaceCopySchema['options'],EntityDelSchema]);export const AdminSchema=z['object']({'op':z['enum'](['add','remove','set'])['describe']('Admin\x20operations:\x20add,\x20remove,\x20set.'),'addresses':ManyAccountOrMark_AddressSchema['describe']('List\x20of\x20admin\x20addresses.')})['strict']();export const CallPermission_DataSchema=z['object']({'object':NormalObjectSchema['optional'](),'description':DescriptionSchema['optional'](),'remark':RemarkSchema['optional'](),'table':TableSchema['optional']()['describe']('Manage\x20permission\x20assignments\x20using\x20two\x20approaches:\x20(1)\x20By\x20Permission\x20Index\x20-\x20add/set/remove\x20entity\x20IDs\x20for\x20a\x20specific\x20permission;\x20(2)\x20By\x20Entity\x20-\x20add/set/remove\x20permission\x20indexes\x20for\x20a\x20specific\x20entity.\x20Requires\x20admin\x20permission.'),'entity':EntitySchema['optional']()['describe']('Advanced\x20entity\x20permission\x20operations:\x20swap\x20permissions\x20between\x20two\x20entities,\x20replace\x20one\x20entity\x27s\x20permissions\x20with\x20another\x27s,\x20copy\x20permissions\x20from\x20one\x20entity\x20to\x20another,\x20or\x20delete\x20all\x20permissions\x20of\x20an\x20entity.\x20Entity\x20can\x20be\x20a\x20user\x20ID\x20or\x20Guard\x20object\x20ID.\x20Requires\x20admin\x20permission.'),'admin':AdminSchema['optional']()['describe']('Manage\x20Permission\x20object\x20admins:\x20add\x20new\x20admins,\x20remove\x20existing\x20admins,\x20or\x20set\x20the\x20complete\x20admin\x20list.\x20Only\x20the\x20Permission\x20object\x20owner\x20(builder)\x20can\x20perform\x20this\x20operation.\x20The\x20creator\x20automatically\x20becomes\x20an\x20admin\x20with\x20full\x20permissions.'),'apply':z['array'](NameOrAddressSchema)['optional']()['describe']('Array\x20of\x20object\x20IDs\x20or\x20names\x20to\x20operate\x20on,\x20apply\x20the\x20Permission\x20object\x20to\x20these\x20objects\x27\x20permission\x20control.\x20Note:\x20The\x20signer\x20must\x20be\x20the\x20owner\x20of\x20the\x20existing\x20Permission\x20objects\x20for\x20these\x20objects'),'builder':AccountOrMark_AddressSchema['optional']()['describe']('Set\x20or\x20transfer\x20ownership\x20of\x20the\x20Permission\x20object\x20to\x20the\x20specified\x20user\x20ID.\x20The\x20creator\x20automatically\x20becomes\x20the\x20builder;\x20only\x20the\x20builder\x20can\x20transfer\x20ownership\x20to\x20other\x20users.'),'owner_receive':ReceivedObjectsOrRecentlySchema['optional']()['describe']('Unwrap\x20CoinWrapper\x20objects\x20and\x20other\x20objects\x20received\x20by\x20this\x20object\x20and\x20send\x20them\x20to\x20the\x20builder(owner).'),'um':z['union']([NameOrAddressSchema,z['null']()])['optional']()['describe']('Contact\x20object.')})['strict']()['describe']('On-chain\x20Permission\x20operations.\x20USAGE:\x20(1)\x20CREATE\x20NEW:\x20Set\x20\x27object\x27\x20field\x20with\x20OBJECT\x20format\x20{name,\x20tags?,\x20...}\x20to\x20create\x20a\x20Permission.\x20NOTE:\x20\x27name\x27\x20goes\x20INSIDE\x20\x27object\x27,\x20NOT\x20at\x20the\x20data\x20root\x20level.\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 CallPermission_InputSchema=z['object']({'data':CallPermission_DataSchema,'env':CallEnvSchema['optional'](),'submission':SubmissionCallSchema['optional']()})['strict']();
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PermissionIndexTypeSchema } from "../query/index.js";
|
|
3
|
+
import { CallEnvSchema, SubmissionCallSchema, NormalObjectSchema } from "./base.js";
|
|
4
|
+
import { AccountOrMark_AddressSchema, DescriptionSchema, LongNameSchema, ManyAccountOrMark_AddressSchema, NameOrAddressSchema, ReceivedObjectsOrRecentlySchema } from "../common/index.js";
|
|
5
|
+
export const RemarkSetSchema = z.object({
|
|
6
|
+
op: z.literal("set"),
|
|
7
|
+
index: PermissionIndexTypeSchema,
|
|
8
|
+
remark: LongNameSchema.describe("Permission remark.")
|
|
9
|
+
}).strict().describe("Set remark for a permission.");
|
|
10
|
+
export const RemarkRemoveSchema = z.object({
|
|
11
|
+
op: z.literal("remove"),
|
|
12
|
+
index: PermissionIndexTypeSchema
|
|
13
|
+
}).strict().describe("Remove remark for a permission.");
|
|
14
|
+
export const RemarkClearSchema = z.object({
|
|
15
|
+
op: z.literal("clear")
|
|
16
|
+
}).strict().describe("Clear remarks for all permissions.");
|
|
17
|
+
export const RemarkSchema = z.discriminatedUnion("op", [
|
|
18
|
+
RemarkSetSchema,
|
|
19
|
+
RemarkRemoveSchema,
|
|
20
|
+
RemarkClearSchema
|
|
21
|
+
]).describe("Set remarks for permissions.");
|
|
22
|
+
export const TablePermByIndexSchema = z.discriminatedUnion("op", [
|
|
23
|
+
z.object({
|
|
24
|
+
op: z.literal("add perm by index"),
|
|
25
|
+
index: PermissionIndexTypeSchema,
|
|
26
|
+
entity: ManyAccountOrMark_AddressSchema
|
|
27
|
+
}).strict().describe("Grant a specific permission to multiple entities at once. USE WHEN: You need to assign the SAME permission to MULTIPLE users/Guards. Example: Give 'create service' permission to Alice, Bob, and Carol simultaneously."),
|
|
28
|
+
z.object({
|
|
29
|
+
op: z.literal("set perm by index"),
|
|
30
|
+
index: PermissionIndexTypeSchema,
|
|
31
|
+
entity: ManyAccountOrMark_AddressSchema
|
|
32
|
+
}).strict().describe("Replace the entity list for a specific permission with a new set of entities. USE WHEN: You want to completely redefine WHO has this permission. WARNING: This overwrites the existing entity list for this permission."),
|
|
33
|
+
z.object({
|
|
34
|
+
op: z.literal("remove perm by index"),
|
|
35
|
+
index: PermissionIndexTypeSchema,
|
|
36
|
+
entity: ManyAccountOrMark_AddressSchema
|
|
37
|
+
}).strict().describe("Revoke a specific permission from multiple entities at once. USE WHEN: You need to remove the SAME permission from MULTIPLE users/Guards. Example: Remove 'create service' permission from Alice, Bob, and Carol simultaneously."),
|
|
38
|
+
]).describe("Permission-centric operations: Manage WHO has a specific permission. Best for batch-assigning one permission to many users. Structure: {op: 'add|set|remove perm by index', index: permission_id, entity: [user1, user2, ...]}");
|
|
39
|
+
export const TablePermByEntitySchema = z.discriminatedUnion("op", [
|
|
40
|
+
z.object({
|
|
41
|
+
op: z.literal("add perm by entity"),
|
|
42
|
+
entity: AccountOrMark_AddressSchema,
|
|
43
|
+
index: z.array(PermissionIndexTypeSchema)
|
|
44
|
+
}).strict().describe("Grant multiple permissions to a single entity. USE WHEN: You need to give ONE user/Guard MANY permissions at once. Example: Give Alice all Machine-related permissions (create, edit, publish, pause, etc.) in one call."),
|
|
45
|
+
z.object({
|
|
46
|
+
op: z.literal("set perm by entity"),
|
|
47
|
+
entity: AccountOrMark_AddressSchema,
|
|
48
|
+
index: z.array(PermissionIndexTypeSchema)
|
|
49
|
+
}).strict().describe("Replace all permissions of a single entity with a new permission set. USE WHEN: You want to completely redefine WHAT permissions a user/Guard has. WARNING: This overwrites all existing permissions for this entity."),
|
|
50
|
+
z.object({
|
|
51
|
+
op: z.literal("remove perm by entity"),
|
|
52
|
+
entity: AccountOrMark_AddressSchema,
|
|
53
|
+
index: z.array(PermissionIndexTypeSchema)
|
|
54
|
+
}).strict().describe("Revoke multiple permissions from a single entity. USE WHEN: You need to remove MANY permissions from ONE user/Guard at once. Example: Remove all Machine-related permissions from Alice."),
|
|
55
|
+
]).describe("Entity-centric operations: Manage WHAT permissions a specific user/Guard has. Best for assigning many permissions to one user. Structure: {op: 'add|set|remove perm by entity', entity: user_id, index: [perm1, perm2, ...]}");
|
|
56
|
+
export const TableSchema = z.discriminatedUnion("op", [
|
|
57
|
+
...TablePermByIndexSchema.options,
|
|
58
|
+
...TablePermByEntitySchema.options
|
|
59
|
+
]).describe("Manage permission assignments using two complementary approaches. CHOOSE THE RIGHT APPROACH: (1) 'perm by index' - Use when granting ONE permission to MANY users (permission-centric). Example: Give 'create service' permission to Alice, Bob, and Carol. (2) 'perm by entity' - Use when granting MANY permissions to ONE user (entity-centric). Example: Give Alice all Machine-related permissions. Both approaches support add/set/remove operations. Requires admin permission.");
|
|
60
|
+
export const EntitySwapReplaceCopySchema = z.discriminatedUnion("op", [
|
|
61
|
+
z.object({
|
|
62
|
+
op: z.literal("swap"),
|
|
63
|
+
entity1: AccountOrMark_AddressSchema,
|
|
64
|
+
entity2: AccountOrMark_AddressSchema
|
|
65
|
+
}).strict().describe("Swap all permission indexes between two entities."),
|
|
66
|
+
z.object({
|
|
67
|
+
op: z.literal("replace"),
|
|
68
|
+
entity1: AccountOrMark_AddressSchema,
|
|
69
|
+
entity2: AccountOrMark_AddressSchema
|
|
70
|
+
}).strict().describe("Remove all permission indexes from entity1 and add them to entity2's permission indexes."),
|
|
71
|
+
z.object({
|
|
72
|
+
op: z.literal("copy"),
|
|
73
|
+
entity1: AccountOrMark_AddressSchema,
|
|
74
|
+
entity2: AccountOrMark_AddressSchema
|
|
75
|
+
}).strict().describe("Add all permission indexes from entity1 to entity2's permission indexes."),
|
|
76
|
+
]);
|
|
77
|
+
export const EntityDelSchema = z.object({
|
|
78
|
+
op: z.literal("del"),
|
|
79
|
+
entity: AccountOrMark_AddressSchema
|
|
80
|
+
}).strict().describe("Delete all permission indexes from an entity.");
|
|
81
|
+
export const EntitySchema = z.discriminatedUnion("op", [
|
|
82
|
+
...EntitySwapReplaceCopySchema.options,
|
|
83
|
+
EntityDelSchema
|
|
84
|
+
]);
|
|
85
|
+
export const AdminSchema = z.object({
|
|
86
|
+
op: z.enum(["add", "remove", "set"]).describe("Admin operations: add, remove, set."),
|
|
87
|
+
addresses: ManyAccountOrMark_AddressSchema.describe("List of admin addresses.")
|
|
88
|
+
}).strict();
|
|
89
|
+
export const CallPermission_DataSchema = z.object({
|
|
90
|
+
object: NormalObjectSchema.optional(),
|
|
91
|
+
description: DescriptionSchema.optional(),
|
|
92
|
+
remark: RemarkSchema.optional(),
|
|
93
|
+
table: TableSchema.optional().describe("Manage permission assignments using two approaches: (1) By Permission Index - add/set/remove entity IDs for a specific permission; (2) By Entity - add/set/remove permission indexes for a specific entity. Requires admin permission."),
|
|
94
|
+
entity: EntitySchema.optional().describe("Advanced entity permission operations: swap permissions between two entities, replace one entity's permissions with another's, copy permissions from one entity to another, or delete all permissions of an entity. Entity can be a user ID or Guard object ID. Requires admin permission."),
|
|
95
|
+
admin: AdminSchema.optional().describe("Manage Permission object admins: add new admins, remove existing admins, or set the complete admin list. Only the Permission object owner (builder) can perform this operation. The creator automatically becomes an admin with full permissions."),
|
|
96
|
+
apply: z.array(NameOrAddressSchema).optional().describe("Array of object IDs or names to operate on, apply the Permission object to these objects' permission control. Note: The signer must be the owner of the existing Permission objects for these objects"),
|
|
97
|
+
builder: AccountOrMark_AddressSchema.optional().describe("Set or transfer ownership of the Permission object to the specified user ID. The creator automatically becomes the builder; only the builder can transfer ownership to other users."),
|
|
98
|
+
owner_receive: ReceivedObjectsOrRecentlySchema.optional().describe('Unwrap CoinWrapper objects and other objects received by this object and send them to the builder(owner).'),
|
|
99
|
+
um: z.union([NameOrAddressSchema, z.null()]).optional().describe("Contact object."),
|
|
100
|
+
}).strict().describe("On-chain Permission operations. USAGE: (1) CREATE NEW: Set 'object' field with OBJECT format {name, tags?, ...} to create a Permission. NOTE: 'name' goes INSIDE 'object', NOT at the data root level. (2) OPERATE EXISTING: Set 'object' field with STRING format (object ID or name). The 'object' field is CRITICAL and REQUIRED in both cases. STRING for existing, OBJECT for new creation.");
|
|
101
|
+
export const CallPermission_InputSchema = z.object({
|
|
102
|
+
data: CallPermission_DataSchema,
|
|
103
|
+
env: CallEnvSchema.optional(),
|
|
104
|
+
submission: SubmissionCallSchema.optional(),
|
|
105
|
+
}).strict();
|
|
@@ -1 +1,68 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AccountOrMark_AddressAISchema, AccountOrMark_AddressSchema, DescriptionSchema, ManyAccountOrMark_AddressAISchema, NameSchema } from "../common/index.js";
|
|
3
|
+
import { RecordsInEntitySchema } from "../query/index.js";
|
|
4
|
+
import { CallEnvSchema } from "./base.js";
|
|
5
|
+
export const InformationAddSchema = z.object({
|
|
6
|
+
op: z.literal("add"),
|
|
7
|
+
data: z.array(RecordsInEntitySchema)
|
|
8
|
+
}).strict().describe("PUBLIC: Add personal info on-chain. Safe: social handles, URLs, public email. NEVER: phone, address, private keys.");
|
|
9
|
+
export const InformationRemoveSchema = z.object({
|
|
10
|
+
op: z.literal("remove"),
|
|
11
|
+
name: z.array(NameSchema)
|
|
12
|
+
}).strict().describe("PUBLIC: Remove specified personal info records from your public profile.");
|
|
13
|
+
export const InformationClearSchema = z.object({
|
|
14
|
+
op: z.literal("clear")
|
|
15
|
+
}).strict().describe("PUBLIC: Clear ALL personal info from your public profile.");
|
|
16
|
+
export const InformationSchema = z.discriminatedUnion("op", [
|
|
17
|
+
InformationAddSchema,
|
|
18
|
+
InformationRemoveSchema,
|
|
19
|
+
InformationClearSchema
|
|
20
|
+
]);
|
|
21
|
+
export const MarkAddSchema = z.object({
|
|
22
|
+
op: z.literal("add"),
|
|
23
|
+
data: z.array(z.object({
|
|
24
|
+
address: AccountOrMark_AddressAISchema,
|
|
25
|
+
name: NameSchema.optional(),
|
|
26
|
+
tags: z.array(NameSchema).optional()
|
|
27
|
+
}).strict()),
|
|
28
|
+
}).strict().describe("PUBLIC: Add ID name and tags on-chain for public identity. For private marks, use 'local' tool.");
|
|
29
|
+
export const MarkRemoveSchema = z.object({
|
|
30
|
+
op: z.literal("remove"),
|
|
31
|
+
data: z.array(z.object({
|
|
32
|
+
address: AccountOrMark_AddressAISchema,
|
|
33
|
+
tags: z.array(NameSchema).optional()
|
|
34
|
+
}).strict())
|
|
35
|
+
}).strict().describe("PUBLIC: Remove specified tags from your on-chain identity mark.");
|
|
36
|
+
export const MarkClearSchema = z.object({
|
|
37
|
+
op: z.literal("clear"),
|
|
38
|
+
address: ManyAccountOrMark_AddressAISchema
|
|
39
|
+
}).strict().describe("PUBLIC: Clear ALL tags from specified on-chain identity marks.");
|
|
40
|
+
export const MarkTransferSchema = z.object({
|
|
41
|
+
op: z.literal("transfer"),
|
|
42
|
+
to: AccountOrMark_AddressAISchema
|
|
43
|
+
}).strict().describe("PUBLIC: Transfer your on-chain identity mark to another address.");
|
|
44
|
+
export const MarkReplaceSchema = z.object({
|
|
45
|
+
op: z.literal("replace"),
|
|
46
|
+
new_mark_object: z.string().describe("New personal ID tag object ID.")
|
|
47
|
+
}).strict().describe("PUBLIC: Replace your on-chain identity mark with a new object.");
|
|
48
|
+
export const MarkDestroySchema = z.object({
|
|
49
|
+
op: z.literal("destroy")
|
|
50
|
+
}).strict().describe("PUBLIC: Destroy your on-chain identity mark permanently.");
|
|
51
|
+
export const MarkSchema = z.discriminatedUnion("op", [
|
|
52
|
+
MarkAddSchema,
|
|
53
|
+
MarkRemoveSchema,
|
|
54
|
+
MarkClearSchema,
|
|
55
|
+
MarkTransferSchema,
|
|
56
|
+
MarkReplaceSchema,
|
|
57
|
+
MarkDestroySchema
|
|
58
|
+
]);
|
|
59
|
+
export const CallPersonal_DataSchema = z.object({
|
|
60
|
+
description: DescriptionSchema.optional(),
|
|
61
|
+
referrer: z.union([z.string(), AccountOrMark_AddressSchema, z.null()]).optional().describe("Referrer ID (name or address) for joining the on-chain network."),
|
|
62
|
+
information: InformationSchema.optional().describe("PUBLIC: Personal info on-chain. Safe: social handles, URLs. NEVER: phone, address, private keys."),
|
|
63
|
+
mark: MarkSchema.optional().describe("PUBLIC: On-chain identity mark. For PRIVATE marks, use 'local' tool.")
|
|
64
|
+
}).strict();
|
|
65
|
+
export const CallPersonal_InputSchema = z.object({
|
|
66
|
+
data: CallPersonal_DataSchema,
|
|
67
|
+
env: CallEnvSchema.optional(),
|
|
68
|
+
}).strict();
|
|
@@ -1 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CallEnvSchema, SubmissionCallSchema, ObjectsSchema } from "./base.js";
|
|
3
|
+
import { ProgressNamedOperatorSchema } from "./machine.js";
|
|
4
|
+
import { NameOrAddressSchema, NameSchema } from "../common/index.js";
|
|
5
|
+
export const ProgressNextSchema = z.object({
|
|
6
|
+
next_node_name: NameSchema.describe("Next node name."),
|
|
7
|
+
forward: NameSchema.describe("Next forward name."),
|
|
8
|
+
}).strict().describe("Specify a specific operation between current node and next node.");
|
|
9
|
+
export const OperateSchema = z.object({
|
|
10
|
+
operation: ProgressNextSchema,
|
|
11
|
+
hold: z.boolean().optional().describe("Whether to lock operation permission. When true, locks the permission; when false or omitted, submits operation result directly."),
|
|
12
|
+
adminUnhold: z.boolean().optional().describe("Whether to allow admin to force unlock. Only applicable when hold is true."),
|
|
13
|
+
message: z.string().optional().describe("Operation result message."),
|
|
14
|
+
}).strict().describe("Advance Progress object: lock operation permission (hold=true) or submit operation result (hold=false or omitted).");
|
|
15
|
+
export const CallProgress_DataSchema = z.object({
|
|
16
|
+
object: NameOrAddressSchema.describe("Progress object ID or name."),
|
|
17
|
+
task: NameOrAddressSchema.optional().describe("Task ID. Cannot be changed after setting."),
|
|
18
|
+
repository: ObjectsSchema.optional().describe("Consensus data Repository object list."),
|
|
19
|
+
progress_namedOperator: ProgressNamedOperatorSchema.optional().describe("Manage operators for Progress permission namespace."),
|
|
20
|
+
operate: OperateSchema.optional().describe("Advance Progress object. Can be locking operation permission (to avoid competition for the same permission) or submitting operation result."),
|
|
21
|
+
}).strict().describe("On-chain, operate an existing Progress object.");
|
|
22
|
+
export const CallProgress_InputSchema = z.object({
|
|
23
|
+
data: CallProgress_DataSchema,
|
|
24
|
+
env: CallEnvSchema.optional(),
|
|
25
|
+
submission: SubmissionCallSchema.optional(),
|
|
26
|
+
}).strict();
|
|
@@ -1 +1,27 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CallEnvSchema, NamedObjectSchema } from './base.js';
|
|
3
|
+
import { DescriptionSchema } from '../common/index.js';
|
|
4
|
+
export const CallProof_DataSchema = z.object({
|
|
5
|
+
namedNew: NamedObjectSchema.optional(),
|
|
6
|
+
description: DescriptionSchema.optional(),
|
|
7
|
+
proof: z.string().max(10240).describe("Proof content. e.g. merkle tree root"),
|
|
8
|
+
server_pubkey: z.string().max(1024).describe("Server public key"),
|
|
9
|
+
server_signature: z.string().max(40480).describe("Server signature"),
|
|
10
|
+
proof_type: z.union([z.number().int().min(0), z.string()]).describe("Proof type. 1: WTS proof; 1-100 reserved."),
|
|
11
|
+
item_count: z.union([z.number().int().min(0), z.string(), z.null()]).optional().describe("Item count. e.g. number of items in the merkle tree"),
|
|
12
|
+
about_address: z.union([NamedObjectSchema, z.null()]).optional().describe("About address. e.g. address of the entity being proved"),
|
|
13
|
+
}).strict().describe("On-chain Proof creation. USAGE: Set 'namedNew' field with {name, tag?} to create a named Proof. Proof is an immutable object - it can only be created, not modified. The 'namedNew' field is CRITICAL and REQUIRED.");
|
|
14
|
+
export const CallProof_InputSchema = z.object({
|
|
15
|
+
data: CallProof_DataSchema,
|
|
16
|
+
env: CallEnvSchema.optional(),
|
|
17
|
+
}).strict().describe("On-chain, create a new Proof object");
|
|
18
|
+
export const CallGenProof_InputSchema = z.object({
|
|
19
|
+
proof: z.string().max(10240).describe("Proof content. e.g. merkle tree root"),
|
|
20
|
+
server_pubkey: z.string().max(1024).describe("Server public key"),
|
|
21
|
+
server_signature: z.string().max(40480).describe("Server signature"),
|
|
22
|
+
proof_type: z.union([z.number().int().min(0), z.string()]).describe("Proof type. 1: WTS proof; 1-100 reserved."),
|
|
23
|
+
description: DescriptionSchema.optional(),
|
|
24
|
+
item_count: z.union([z.number().int().min(0), z.string(), z.null()]).optional().describe("Item count. e.g. number of items in the merkle tree"),
|
|
25
|
+
about_address: z.union([NamedObjectSchema, z.null()]).optional().describe("About address. e.g. address of the entity being proved"),
|
|
26
|
+
env: CallEnvSchema.optional(),
|
|
27
|
+
}).strict().describe("Generate a new Proof object on-chain");
|
|
@@ -1 +1,76 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { WithPermissionObjectSchema, ObjectsSchema, CallEnvSchema, SubmissionCallSchema, } from "./base.js";
|
|
3
|
+
import { AccountOrMark_AddressSchema, DescriptionSchema, NameOrAddressSchema, NameSchema, ReceivedObjectsOrRecentlySchema } from "../common/index.js";
|
|
4
|
+
import { PolicyRuleSchema } from "../query/index.js";
|
|
5
|
+
import { SupportedValueSchema } from "../common/index.js";
|
|
6
|
+
export const RepositoryIdSchema = z.union([
|
|
7
|
+
AccountOrMark_AddressSchema,
|
|
8
|
+
z.number().int(),
|
|
9
|
+
]).describe("Data item ID. If a number (such as time) is specified, it will be automatically converted to an address or ID type.");
|
|
10
|
+
export const KeyDataSchema = z.object({
|
|
11
|
+
id: RepositoryIdSchema,
|
|
12
|
+
data: SupportedValueSchema,
|
|
13
|
+
}).strict().describe("Data ID and value.");
|
|
14
|
+
export const RepDataItemSchema = z.object({
|
|
15
|
+
data: z.array(KeyDataSchema).describe("Data item list."),
|
|
16
|
+
write_guard: NameOrAddressSchema.optional().describe("Guard ID or name. Used to specify the policy write permissions and rules corresponding to this Guard."),
|
|
17
|
+
}).strict().describe("List of data items to write.");
|
|
18
|
+
export const SignerOrClockBaseSchema = z.object({
|
|
19
|
+
name: NameSchema.describe("Data item name."),
|
|
20
|
+
write_guard: NameOrAddressSchema.optional().describe("Guard ID or name. Used to specify the policy write permissions and rules corresponding to this Guard."),
|
|
21
|
+
}).strict().describe("Specify data items by name and ID. ID is the on-chain timestamp or signer ID (depending on how write_guard specifies the ID source).");
|
|
22
|
+
export const SignerOrClockSchema = z.object({
|
|
23
|
+
name: NameSchema.describe("Data item name."),
|
|
24
|
+
write_guard: NameOrAddressSchema.optional().describe("Guard ID or name. Used to specify the policy write permissions and rules corresponding to this Guard."),
|
|
25
|
+
data: SupportedValueSchema,
|
|
26
|
+
}).strict().describe("Specify data items by name and data. ID is the on-chain timestamp or signer ID (depending on how write_guard specifies the ID source).");
|
|
27
|
+
export const DataRemoveItemSchema = z.object({
|
|
28
|
+
id: z.array(RepositoryIdSchema).describe("Data item ID list."),
|
|
29
|
+
write_guard: NameOrAddressSchema.optional().describe("Guard ID or name. Used to verify permission to delete data."),
|
|
30
|
+
}).strict().describe("Delete data items by name and ID list.");
|
|
31
|
+
export const PoliciesAddSetSchema = z.object({
|
|
32
|
+
op: z.enum(["add", "set"]),
|
|
33
|
+
policy: z.array(PolicyRuleSchema).describe("Policy rule list."),
|
|
34
|
+
}).strict().describe("Add or set policy rules.");
|
|
35
|
+
export const PoliciesRemoveSchema = z.object({
|
|
36
|
+
op: z.literal("remove"),
|
|
37
|
+
policy: z.array(NameSchema).describe("Policy rule name list."),
|
|
38
|
+
}).strict().describe("Remove policy rules.");
|
|
39
|
+
export const PoliciesClearSchema = z.object({
|
|
40
|
+
op: z.literal("clear"),
|
|
41
|
+
}).strict().describe("Clear policy rules.");
|
|
42
|
+
export const PoliciesSchema = z.discriminatedUnion("op", [
|
|
43
|
+
PoliciesAddSetSchema,
|
|
44
|
+
PoliciesRemoveSchema,
|
|
45
|
+
PoliciesClearSchema,
|
|
46
|
+
]);
|
|
47
|
+
export const DataAddWithItemsSchema = z.object({
|
|
48
|
+
name: NameSchema.describe("Data item name. Must match the name in PolicyRule."),
|
|
49
|
+
items: z.array(RepDataItemSchema).describe("List of data items to add. Each data item contains name, ID, and data parts, where name and ID together form the unique key for the data."),
|
|
50
|
+
}).strict().describe("Add data by name and data item list. Each data item contains name, ID, and data parts, where name and ID together form the unique key for the data.");
|
|
51
|
+
export const DataAddSchema = z.union([
|
|
52
|
+
SignerOrClockSchema,
|
|
53
|
+
DataAddWithItemsSchema,
|
|
54
|
+
]);
|
|
55
|
+
export const DataRemoveSchema = z.union([
|
|
56
|
+
SignerOrClockBaseSchema,
|
|
57
|
+
z.object({
|
|
58
|
+
name: NameSchema.describe("Data item name. Must match the name in PolicyRule."),
|
|
59
|
+
items: z.array(DataRemoveItemSchema).describe("List of data items to delete."),
|
|
60
|
+
}).strict(),
|
|
61
|
+
]);
|
|
62
|
+
export const CallRepository_DataSchema = z.object({
|
|
63
|
+
object: WithPermissionObjectSchema,
|
|
64
|
+
description: DescriptionSchema.optional(),
|
|
65
|
+
policies: PoliciesSchema.optional().describe("Policy list. Used to define data item write permissions and rules, as well as data item read permissions."),
|
|
66
|
+
data_add: DataAddSchema.optional().describe("Add data items"),
|
|
67
|
+
data_remove: DataRemoveSchema.optional().describe("Delete data items"),
|
|
68
|
+
rewards: ObjectsSchema.optional().describe("Reward object list. Used for data contribution incentives."),
|
|
69
|
+
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."),
|
|
70
|
+
um: z.union([NameOrAddressSchema, z.null()]).optional().describe("Contact object."),
|
|
71
|
+
}).strict().describe("On-chain Repository operations. USAGE: (1) CREATE NEW: Set 'object' field with OBJECT format {name, permission, ...} to create a Repository. NOTE: 'name' goes INSIDE 'object', NOT at the data root level. 'permission' can be a new Permission object or reference an existing one - check 'object' field description for details. (2) OPERATE EXISTING: Set 'object' field with STRING format (object ID or name). The 'object' field is CRITICAL and REQUIRED in both cases. STRING for existing, OBJECT for new creation.");
|
|
72
|
+
export const CallRepository_InputSchema = z.object({
|
|
73
|
+
data: CallRepository_DataSchema,
|
|
74
|
+
env: CallEnvSchema.optional(),
|
|
75
|
+
submission: SubmissionCallSchema.optional(),
|
|
76
|
+
}).strict();
|
|
@@ -1 +1,42 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TypedPermissionObjectSchema, CoinParamSchema, CallEnvSchema, SubmissionCallSchema, } from "./base.js";
|
|
3
|
+
import { RewardGuardSchema } from "../query/index.js";
|
|
4
|
+
import { BalanceTypeSchema, ReceivedObjectsOrRecentlySchema, ReceivedBalanceOrRecentlySchema, NameOrAddressSchema, GuardIdentifierSchema, DescriptionSchema } from "../common/index.js";
|
|
5
|
+
export const RecipientGuardIdentifierSchema = z.object({
|
|
6
|
+
type: z.literal("GuardIdentifier"),
|
|
7
|
+
GuardIdentifier: GuardIdentifierSchema,
|
|
8
|
+
}).strict().describe("Get recipient ID from specified data index in Guard table. The ID must be of address type.");
|
|
9
|
+
export const RecipientEntitySchema = z.object({
|
|
10
|
+
type: z.literal("Entity"),
|
|
11
|
+
Entity: NameOrAddressSchema,
|
|
12
|
+
}).strict().describe("Fixed entity ID");
|
|
13
|
+
export const RecipientSignerSchema = z.object({
|
|
14
|
+
type: z.literal("Signer"),
|
|
15
|
+
Signer: z.boolean(),
|
|
16
|
+
}).strict().describe("Signer ID");
|
|
17
|
+
export const RewardRecordSchema = z.object({
|
|
18
|
+
amount: BalanceTypeSchema,
|
|
19
|
+
time: z.number().int(),
|
|
20
|
+
}).strict().describe("Reward amount and time");
|
|
21
|
+
export const RecipientRecordSchema = z.object({
|
|
22
|
+
guard: NameOrAddressSchema,
|
|
23
|
+
total: BalanceTypeSchema,
|
|
24
|
+
amount: z.array(RewardRecordSchema),
|
|
25
|
+
}).strict().describe("Reward recipient record");
|
|
26
|
+
export const CallReward_DataSchema = z.object({
|
|
27
|
+
object: TypedPermissionObjectSchema,
|
|
28
|
+
claim: NameOrAddressSchema.optional().describe("Guard object ID. Used to verify Guard and start the reward distribution process corresponding to this Guard."),
|
|
29
|
+
description: DescriptionSchema.optional(),
|
|
30
|
+
coin_add: CoinParamSchema.optional().describe("Add amount to Reward object."),
|
|
31
|
+
receive: ReceivedBalanceOrRecentlySchema.optional().describe("Unwrap CoinWrapper objects received by Reward object and store them in pending balance."),
|
|
32
|
+
guard_add: z.array(RewardGuardSchema).optional().describe("Add Guard to Reward object."),
|
|
33
|
+
guard_remove_expired: z.boolean().optional().describe("Whether to remove expired Guard."),
|
|
34
|
+
guard_expiration_time: z.union([z.number().int().min(1), z.null()]).optional().describe("Add expiration time(ms). Before this time expires, new Guard and fund allocation rules cannot be added."),
|
|
35
|
+
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."),
|
|
36
|
+
um: z.union([NameOrAddressSchema, z.null()]).optional().describe("Contact object."),
|
|
37
|
+
}).strict().describe("On-chain Reward operations. USAGE: (1) CREATE NEW: Set 'object' field with OBJECT format {name, type_parameter, permission, ...} to create a Reward. NOTE: 'name' goes INSIDE 'object', NOT at the data root level.'permission' can be a new Permission object or reference an existing one - check 'object' field description for details. (2) OPERATE EXISTING: Set 'object' field with STRING format (object ID or name). The 'object' field is CRITICAL and REQUIRED in both cases. STRING for existing, OBJECT for new creation.");
|
|
38
|
+
export const CallReward_InputSchema = z.object({
|
|
39
|
+
data: CallReward_DataSchema,
|
|
40
|
+
env: CallEnvSchema.optional(),
|
|
41
|
+
submission: SubmissionCallSchema.optional(),
|
|
42
|
+
}).strict();
|
|
@@ -1 +1,82 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TypedPermissionObjectSchema, CoinParamSchema, NamedObjectSchema, ObjectsSchema, CallEnvSchema, SubmissionCallSchema } from "./base.js";
|
|
3
|
+
import { AllocatorsSchema, DiscountTypeSchema, ServiceSaleSchema } from "../query/index.js";
|
|
4
|
+
import { AccountOrMark_AddressSchema, DescriptionSchema, LongNameSchema, ManyAccountOrMark_AddressSchema, NameOrAddressSchema, NotEmptyNameSchema, ReceivedBalanceOrRecentlySchema, ReceivedObjectsOrRecentlySchema } from "../common/index.js";
|
|
5
|
+
import { BalanceTypeSchema } from "../common/index.js";
|
|
6
|
+
export const ServiceBuyItemSchema = z.object({
|
|
7
|
+
name: LongNameSchema.describe("Name of the product or service to purchase"),
|
|
8
|
+
stock: BalanceTypeSchema.describe("Quantity of the product or service to purchase"),
|
|
9
|
+
wip_hash: z.string().describe("WIP file hash of the item"),
|
|
10
|
+
}).strict();
|
|
11
|
+
export const BuySchema = z.object({
|
|
12
|
+
items: z.array(ServiceBuyItemSchema).describe("List of products or services to purchase"),
|
|
13
|
+
total_pay: CoinParamSchema.describe("Actual payment amount"),
|
|
14
|
+
discount: z.string().optional().describe("Discount object ID or name"),
|
|
15
|
+
payment_remark: z.string().optional().describe("Payment remark"),
|
|
16
|
+
payment_index: z.number().optional().describe("Payment index"),
|
|
17
|
+
}).strict();
|
|
18
|
+
export const DiscountSchema = z.object({
|
|
19
|
+
name: z.string().describe("Discount name"),
|
|
20
|
+
discount_type: DiscountTypeSchema.describe("Discount type"),
|
|
21
|
+
discount_value: BalanceTypeSchema.describe("Discount value"),
|
|
22
|
+
benchmark: z.union([z.number(), z.string()]).optional().describe("Discount benchmark value. Discount is only applied if the amount exceeds this value"),
|
|
23
|
+
time_ms_start: z.number().optional().describe("Discount start time (milliseconds)"),
|
|
24
|
+
time_ms_end: z.number().optional().describe("Discount end time (milliseconds)"),
|
|
25
|
+
count: z.number().optional().describe("Discount usage count"),
|
|
26
|
+
recipient: ManyAccountOrMark_AddressSchema.describe("Discount recipient"),
|
|
27
|
+
transferable: z.boolean().optional().describe("Whether the discount object recipient can transfer the discount object"),
|
|
28
|
+
}).strict();
|
|
29
|
+
export const OrderNewSchema = z.object({
|
|
30
|
+
buy: BuySchema,
|
|
31
|
+
agents: ManyAccountOrMark_AddressSchema.optional().describe("Order agents. Agents can operate the order, such as canceling the order, modifying the order status, etc.; but cannot receive the funds received by the order."),
|
|
32
|
+
order_required_info: z.string().optional().describe("Contact object ID or WTS Proof object"),
|
|
33
|
+
transfer: AccountOrMark_AddressSchema.optional().describe("Set the new owner of the order. Requires order owner permission to set."),
|
|
34
|
+
namedNewOrder: NamedObjectSchema.optional().describe("Set the local name of the order object."),
|
|
35
|
+
namedNewAllocation: NamedObjectSchema.optional().describe("Set the local name of the order's Allocation object."),
|
|
36
|
+
namedNewProgress: NamedObjectSchema.optional().describe("Set the local name of the order's Progress object."),
|
|
37
|
+
}).strict();
|
|
38
|
+
export const SalesSchema = z.discriminatedUnion("op", [
|
|
39
|
+
z.object({
|
|
40
|
+
op: z.literal("add"),
|
|
41
|
+
sales: z.array(ServiceSaleSchema),
|
|
42
|
+
}).strict().describe("Add new sales products or services."),
|
|
43
|
+
z.object({
|
|
44
|
+
op: z.literal("set"),
|
|
45
|
+
sales: z.array(ServiceSaleSchema),
|
|
46
|
+
}).strict().describe("Set sales products or services."),
|
|
47
|
+
z.object({
|
|
48
|
+
op: z.literal("remove"),
|
|
49
|
+
sales_name: z.array(LongNameSchema.describe("Sales name")),
|
|
50
|
+
}).strict().describe("Remove existing sales products or services."),
|
|
51
|
+
z.object({
|
|
52
|
+
op: z.literal("clear"),
|
|
53
|
+
}).strict().describe("Clear all sales products or services."),
|
|
54
|
+
]);
|
|
55
|
+
export const CallService_DataSchema = z.object({
|
|
56
|
+
object: TypedPermissionObjectSchema,
|
|
57
|
+
order_new: OrderNewSchema.optional().describe("Create new order."),
|
|
58
|
+
description: DescriptionSchema.optional(),
|
|
59
|
+
location: LongNameSchema.optional().describe("Location of the Service"),
|
|
60
|
+
sales: SalesSchema.optional().describe("Service sales products or services list."),
|
|
61
|
+
repositories: ObjectsSchema.optional().describe("Service Repository object list."),
|
|
62
|
+
rewards: ObjectsSchema.optional().describe("Service Reward object list."),
|
|
63
|
+
arbitrations: ObjectsSchema.optional().describe("Service Arbitration object list."),
|
|
64
|
+
machine: z.union([NameOrAddressSchema, z.null()]).optional().describe("Service Machine object ID or name. The Machine object must be in published state."),
|
|
65
|
+
discount: DiscountSchema.optional().describe("Issue discount."),
|
|
66
|
+
discount_destroy: z.array(NameOrAddressSchema).optional().describe("Destroy existing discount object ID list."),
|
|
67
|
+
customer_required: z.array(NotEmptyNameSchema).optional().describe("Customer required information. Such as phone, email, etc."),
|
|
68
|
+
order_allocators: z.union([AllocatorsSchema, z.null()]).optional().describe("Order fund allocator."),
|
|
69
|
+
buy_guard: z.union([NameOrAddressSchema, z.null()]).optional().describe("Buy guard object ID or name."),
|
|
70
|
+
compensation_fund_add: CoinParamSchema.optional().describe("Compensation fund. Used to claim compensation based on the arbitration result of the Arb object when resolving order disputes."),
|
|
71
|
+
compensation_locked_time_add: z.number().optional().describe("Lock time for compensation funds added to orders (milliseconds)."),
|
|
72
|
+
compensation_fund_receive: ReceivedBalanceOrRecentlySchema.optional().describe("Receive order compensation funds."),
|
|
73
|
+
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."),
|
|
74
|
+
um: z.union([NameOrAddressSchema, z.null()]).optional().describe("Contact object ID or name."),
|
|
75
|
+
pause: z.boolean().optional().describe("Whether to pause accepting new orders."),
|
|
76
|
+
publish: z.boolean().optional().describe("Whether to publish the Service. After publishing, customers can place orders; at the same time, service commitments such as machine, order_allocators, arbitrations, etc. will be immutable."),
|
|
77
|
+
}).strict().describe("On-chain Service operations. USAGE: (1) CREATE NEW: Set 'object' field with OBJECT format {name, type_parameter, permission, ...} to create a Service. NOTE: 'name' goes INSIDE 'object', NOT at the data root level. 'permission' can be a new Permission object or reference an existing one - check 'object' field description for details. (2) OPERATE EXISTING: Set 'object' field with STRING format (object ID or name). The 'object' field is CRITICAL and REQUIRED in both cases. STRING for existing, OBJECT for new creation.");
|
|
78
|
+
export const CallService_InputSchema = z.object({
|
|
79
|
+
data: CallService_DataSchema,
|
|
80
|
+
env: CallEnvSchema.optional(),
|
|
81
|
+
submission: SubmissionCallSchema.optional(),
|
|
82
|
+
}).strict();
|