@wowok/agent-mcp 2.6.1 → 2.6.3
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/customer/info-puzzle.d.ts +1 -1
- package/dist/customer/info-puzzle.js +4 -2
- package/dist/customer/risk-assessment.js +26 -4
- package/dist/customer/types.d.ts +2 -0
- package/dist/examples/guard-template-balance-check.json +38 -0
- package/dist/examples/guard-template-time-lock.json +39 -0
- package/dist/examples/machine-template-7node-rental.json +114 -0
- package/dist/examples/rental-ziroom-machine-create.json +137 -0
- package/dist/examples/rental-ziroom-permission-create.json +35 -0
- package/dist/examples/rental-ziroom-service-create.json +80 -0
- package/dist/examples/retail-myshop-service-create.json +88 -0
- package/dist/extensions/capability-manifest.js +24 -24
- package/dist/extensions/constraint-registry.js +18 -18
- package/dist/extensions/metric-registry.js +14 -14
- package/dist/extensions/mode-evaluator.js +16 -16
- package/dist/extensions/modes.js +131 -45
- package/dist/extensions/registry.d.ts +2 -0
- package/dist/extensions/registry.js +63 -30
- package/dist/extensions/types.d.ts +1 -0
- package/dist/index.js +50 -0
- package/dist/knowledge/deployment-scanner.js +1 -1
- package/dist/knowledge/fund-layer.d.ts +72 -0
- package/dist/knowledge/fund-layer.js +420 -0
- package/dist/knowledge/guard-render.d.ts +57 -0
- package/dist/knowledge/guard-render.js +700 -0
- package/dist/knowledge/guard-submission-prompt.d.ts +31 -0
- package/dist/knowledge/guard-submission-prompt.js +171 -0
- package/dist/knowledge/machine-ledger.js +1 -1
- package/dist/knowledge/machine-render.d.ts +41 -0
- package/dist/knowledge/machine-render.js +565 -0
- package/dist/knowledge/machine-templates.js +4 -4
- package/dist/knowledge/reward-confirm.js +2 -2
- package/dist/knowledge/reward-puzzle.js +1 -1
- package/dist/knowledge/reward-risk.js +9 -9
- package/dist/knowledge/reward-templates.js +2 -2
- package/dist/knowledge/service-confirm.d.ts +1 -1
- package/dist/knowledge/service-confirm.js +3 -3
- package/dist/knowledge/service-context.js +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/service-risk.d.ts +1 -1
- package/dist/knowledge/service-risk.js +3 -3
- package/dist/knowledge/service-templates.js +2 -2
- package/dist/knowledge/service-translation.d.ts +1 -1
- package/dist/knowledge/service-translation.js +7 -7
- package/dist/project/deployment-bridge.js +6 -5
- package/dist/project/deployment-doc.js +5 -5
- package/dist/project/edit-planner.d.ts +123 -0
- package/dist/project/edit-planner.js +1371 -0
- package/dist/project/evaluation.js +314 -14
- package/dist/project/graph-builder.js +6 -1
- package/dist/project/handlers.d.ts +99 -2
- package/dist/project/handlers.js +358 -16
- package/dist/project/stage-gate.js +4 -4
- package/dist/schema/call/allocation.js +2 -2
- package/dist/schema/call/arbitration.js +19 -6
- package/dist/schema/call/contact.js +2 -2
- package/dist/schema/call/demand.js +2 -2
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/machine.d.ts +1975 -777
- package/dist/schema/call/machine.js +50 -4
- package/dist/schema/call/order.js +3 -6
- package/dist/schema/call/permission.js +2 -2
- package/dist/schema/call/repository.js +2 -2
- package/dist/schema/call/reward.js +3 -3
- package/dist/schema/call/semantic.js +7 -1
- package/dist/schema/call/service.d.ts +180 -8
- package/dist/schema/call/service.js +82 -27
- package/dist/schema/call/treasury.js +3 -3
- package/dist/schema/common/index.d.ts +2 -0
- package/dist/schema/common/index.js +46 -10
- package/dist/schema/local/index.js +5 -1
- package/dist/schema/operations.d.ts +755 -176
- package/dist/schema/operations.js +43 -7
- package/dist/schema/project/index.d.ts +969 -6
- package/dist/schema/project/index.js +268 -4
- package/dist/schema/query/index.d.ts +217 -0
- package/dist/schema/query/index.js +63 -33
- package/dist/schema/schema-query/index.d.ts +53 -3
- package/dist/schema/schema-query/index.js +17 -2
- package/dist/schema/utils/node-parser.js +13 -0
- package/dist/schema/utils/object-type-utils.d.ts +12 -0
- package/dist/schema/utils/object-type-utils.js +35 -0
- package/dist/schema/utils/permission-machine-check.d.ts +49 -0
- package/dist/schema/utils/permission-machine-check.js +121 -0
- package/dist/schema/utils/skills-recommendation.d.ts +2 -0
- package/dist/schema/utils/skills-recommendation.js +76 -0
- package/dist/schema-query/index.d.ts +14 -1
- package/dist/schema-query/index.js +104 -2
- package/dist/schemas/account_operation.schema.json +1 -1
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/onchain_events.output.json +1 -1
- package/dist/schemas/onchain_operations.output.json +2820 -0
- package/dist/schemas/onchain_operations.schema.json +115 -53
- package/dist/schemas/onchain_operations_allocation.schema.json +5 -5
- package/dist/schemas/onchain_operations_arbitration.schema.json +9 -7
- package/dist/schemas/onchain_operations_contact.schema.json +3 -3
- package/dist/schemas/onchain_operations_demand.schema.json +3 -3
- package/dist/schemas/onchain_operations_gen_passport.schema.json +2 -2
- package/dist/schemas/onchain_operations_guard.schema.json +1 -1
- package/dist/schemas/onchain_operations_machine.schema.json +4 -4
- package/dist/schemas/onchain_operations_order.schema.json +3 -3
- package/dist/schemas/onchain_operations_payment.schema.json +1 -1
- package/dist/schemas/onchain_operations_permission.schema.json +2 -2
- package/dist/schemas/onchain_operations_progress.schema.json +1 -1
- package/dist/schemas/onchain_operations_proof.schema.json +1 -1
- package/dist/schemas/onchain_operations_repository.schema.json +3 -3
- package/dist/schemas/onchain_operations_reward.schema.json +6 -6
- package/dist/schemas/onchain_operations_service.schema.json +77 -17
- package/dist/schemas/onchain_operations_treasury.schema.json +4 -4
- package/dist/schemas/onchain_table_data.output.json +1 -1
- package/dist/schemas/onchain_table_data.schema.json +10 -9
- package/dist/schemas/project_operation.output.json +1026 -7
- package/dist/schemas/project_operation.schema.json +46 -4
- package/dist/schemas/query_toolkit.output.json +15 -15
- package/dist/schemas/query_toolkit.schema.json +3 -3
- package/dist/schemas/schema_query.output.json +64 -1
- package/dist/schemas/schema_query.schema.json +3 -2
- package/dist/schemas/wowok_buildin_info.output.json +81 -8
- package/dist/schemas/wowok_buildin_info.schema.json +46 -2
- package/dist/tools/handlers/onchain.js +571 -6
- package/dist/tools/handlers/project.js +25 -2
- package/dist/tools/handlers/schema-query.js +24 -1
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.js +177 -6
- package/package.json +2 -2
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { WithPermissionObjectSchema, NamedObjectSchema, ObjectsSchema, CallEnvSchema, SubmissionCallSchema, } from './base.js';
|
|
3
3
|
import { MachineNodeSchema, MachineForwardSchema } from '../query/index.js';
|
|
4
|
-
import { ManyAccountOrMark_AddressSchema, NameOrAddressSchema, NameSchema, NotEmptyNameSchema, ReceivedObjectsOrRecentlySchema } from '../common/index.js';
|
|
4
|
+
import { ManyAccountOrMark_AddressSchema, NameOrAddressSchema, NameSchema, NotEmptyNameSchema, ReceivedObjectsOrRecentlySchema, RECEIVE_FORMAT_BLOCK_OBJECTS } from '../common/index.js';
|
|
5
|
+
function validateEntryForward(nodes) {
|
|
6
|
+
for (const node of nodes) {
|
|
7
|
+
if (!node.pairs)
|
|
8
|
+
continue;
|
|
9
|
+
for (const pair of node.pairs) {
|
|
10
|
+
if (pair.prev_node === "") {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const ENTRY_FORWARD_ERROR_MESSAGE = "Machine has no entry forward. At least one node must have a pair with prev_node=\"\" (empty string), " +
|
|
18
|
+
"which defines how Progress advances from the initial state (current=\"\") to the first node. " +
|
|
19
|
+
"Without an entry forward, the workflow will be permanently stuck. " +
|
|
20
|
+
"Example: {name: 'Subscribed', pairs: [{prev_node: '', forwards: [{name: 'Subscribe', weight: 1}]}]}";
|
|
5
21
|
export const ProgressNamedOperatorSchema = z.object({
|
|
6
22
|
op: z.union([z.literal('add'), z.literal('set'), z.literal('remove')]),
|
|
7
23
|
name: NotEmptyNameSchema,
|
|
@@ -68,7 +84,17 @@ export const NodeSchema = z.discriminatedUnion('op', [
|
|
|
68
84
|
op: z.literal('remove forward'),
|
|
69
85
|
data: z.array(NodeRemoveForwardDataSchema).describe('List of operations to delete.'),
|
|
70
86
|
}).strict().describe('Delete operations.'),
|
|
71
|
-
])
|
|
87
|
+
])
|
|
88
|
+
.superRefine((data, ctx) => {
|
|
89
|
+
if ((data.op === 'add' || data.op === 'set') && data.bReplace === true) {
|
|
90
|
+
if (!validateEntryForward(data.nodes)) {
|
|
91
|
+
ctx.addIssue({
|
|
92
|
+
code: z.ZodIssueCode.custom,
|
|
93
|
+
message: ENTRY_FORWARD_ERROR_MESSAGE,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
});
|
|
72
98
|
export const NodeJsonOrMarkdownFileSchema = z.object({
|
|
73
99
|
json_or_markdown_file: z.string().describe(`Path to a JSON or Markdown file containing node array for COMPLETE REPLACEMENT of all nodes.
|
|
74
100
|
|
|
@@ -113,9 +139,29 @@ Supported formats: JSON array or Markdown with code blocks.
|
|
|
113
139
|
If parsing fails, error includes line number and column information.`),
|
|
114
140
|
pause: z.boolean().optional().describe('Whether to pause generating new Progress objects.'),
|
|
115
141
|
publish: z.boolean().optional().describe('Whether to publish the object. After the object is published, new Progress objects can be generated; and node settings will no longer be changeable.'),
|
|
116
|
-
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.'),
|
|
142
|
+
owner_receive: ReceivedObjectsOrRecentlySchema.optional().describe('Unwrap CoinWrapper objects and other objects received by this Machine object and send them to the owner of its Permission object.' + RECEIVE_FORMAT_BLOCK_OBJECTS),
|
|
117
143
|
um: z.union([NameOrAddressSchema, z.null()]).optional().describe('Contact object ID or name.'),
|
|
118
|
-
}).strict()
|
|
144
|
+
}).strict()
|
|
145
|
+
.refine((data) => {
|
|
146
|
+
if (data.publish !== true)
|
|
147
|
+
return true;
|
|
148
|
+
if (!data.node)
|
|
149
|
+
return true;
|
|
150
|
+
if ('json_or_markdown_file' in data.node)
|
|
151
|
+
return true;
|
|
152
|
+
if ('nodes' in data.node && Array.isArray(data.node.nodes)) {
|
|
153
|
+
const isCreatingNew = typeof data.object === 'object' && data.object !== null;
|
|
154
|
+
const isReplace = data.node.bReplace === true;
|
|
155
|
+
if (isCreatingNew || isReplace) {
|
|
156
|
+
const nodes = data.node.nodes;
|
|
157
|
+
if (Array.isArray(nodes) && nodes.length > 0 && typeof nodes[0] === 'object') {
|
|
158
|
+
return validateEntryForward(nodes);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return true;
|
|
163
|
+
}, { message: ENTRY_FORWARD_ERROR_MESSAGE })
|
|
164
|
+
.describe("On-chain Machine operations. USAGE: (1) CREATE NEW: Set 'object' field with OBJECT format {name, permission, ...} to create a Machine. NOTE: 'name' goes INSIDE 'object', NOT at the data root level. 'permission' can be a new Permission object or reference an existing one - check 'object' field description for details. (2) OPERATE EXISTING: Set 'object' field with STRING format (object ID or name). The 'object' field is CRITICAL and REQUIRED in both cases. STRING for existing, OBJECT for new creation.");
|
|
119
165
|
export const CallMachine_InputSchema = z.object({
|
|
120
166
|
data: CallMachine_DataSchema,
|
|
121
167
|
env: CallEnvSchema.optional(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { CallEnvSchema, SubmissionCallSchema } from "./base.js";
|
|
3
3
|
import { OperateSchema } from "./progress.js";
|
|
4
|
-
import { AccountOrMark_AddressSchema, DescriptionSchema, LongNameSchema, ManyAccountOrMark_AddressSchema, NameOrAddressSchema, ReceivedObjectsOrRecentlySchema } from "../common/index.js";
|
|
4
|
+
import { AccountOrMark_AddressSchema, DescriptionSchema, LongNameSchema, ManyAccountOrMark_AddressSchema, NameOrAddressSchema, ReceivedObjectsOrRecentlySchema, RECEIVE_FORMAT_BLOCK_OBJECTS } from "../common/index.js";
|
|
5
5
|
export const ArbConfirmSchema = z.object({
|
|
6
6
|
arb: NameOrAddressSchema.describe("Arb object ID or name."),
|
|
7
7
|
confirm: z.boolean().describe("Whether to confirm that the submitted arbitration materials are valid for arbitration."),
|
|
@@ -24,11 +24,8 @@ export const CallOrder_DataSchema = z.object({
|
|
|
24
24
|
arb_objection: ArbObjectionSchema.optional().describe("Oppose and appeal the arbitration result, request re-arbitration."),
|
|
25
25
|
arb_claim_compensation: ArbClaimCompensationSchema.optional().describe("Specify the adjudicated Arb object to obtain order compensation."),
|
|
26
26
|
receive: ReceivedObjectsOrRecentlySchema.optional().describe("Unwrap CoinWrapper objects or other objects received by the order and transfer them to the order owner. " +
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
"• ReceivedNormal[] (array) — explicit list of received objects: [{id, type, content_raw?}]\n" +
|
|
30
|
-
"• ReceivedBalance ({token_type, balance, received: [{id, balance, payment}]}) — received balance record\n" +
|
|
31
|
-
"DO NOT wrap in {result: ...} — pass directly (NOT {result: [...]})"),
|
|
27
|
+
"Consistent with `owner_receive` on other objects (arbitration/contact/demand/machine/permission/repository/reward/service/treasury)." +
|
|
28
|
+
RECEIVE_FORMAT_BLOCK_OBJECTS),
|
|
32
29
|
transfer_to: AccountOrMark_AddressSchema.optional().describe("Set new owner of the order. Requires order owner permission to set."),
|
|
33
30
|
}).strict().describe("On-chain, operate on an Order object.");
|
|
34
31
|
export const CallOrder_InputSchema = z.object({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { PermissionIndexTypeSchema } from "../query/index.js";
|
|
3
3
|
import { CallEnvSchema, SubmissionCallSchema, NormalObjectSchema } from "./base.js";
|
|
4
|
-
import { AccountOrMark_AddressSchema, DescriptionSchema, LongNameSchema, ManyAccountOrMark_AddressSchema, NameOrAddressSchema, ReceivedObjectsOrRecentlySchema } from "../common/index.js";
|
|
4
|
+
import { AccountOrMark_AddressSchema, DescriptionSchema, LongNameSchema, ManyAccountOrMark_AddressSchema, NameOrAddressSchema, ReceivedObjectsOrRecentlySchema, RECEIVE_FORMAT_BLOCK_OBJECTS } from "../common/index.js";
|
|
5
5
|
export const RemarkSetSchema = z.object({
|
|
6
6
|
op: z.literal("set"),
|
|
7
7
|
index: PermissionIndexTypeSchema,
|
|
@@ -95,7 +95,7 @@ export const CallPermission_DataSchema = z.object({
|
|
|
95
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
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
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).'),
|
|
98
|
+
owner_receive: ReceivedObjectsOrRecentlySchema.optional().describe('Unwrap CoinWrapper objects and other objects received by this Permission object and send them to the builder(owner).' + RECEIVE_FORMAT_BLOCK_OBJECTS),
|
|
99
99
|
um: z.union([NameOrAddressSchema, z.null()]).optional().describe("Contact object ID or name."),
|
|
100
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
101
|
export const CallPermission_InputSchema = z.object({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { WithPermissionObjectSchema, ObjectsSchema, CallEnvSchema, SubmissionCallSchema, } from "./base.js";
|
|
3
|
-
import { AccountOrMark_AddressSchema, DescriptionSchema, NameOrAddressSchema, NameSchema, ReceivedObjectsOrRecentlySchema } from "../common/index.js";
|
|
3
|
+
import { AccountOrMark_AddressSchema, DescriptionSchema, NameOrAddressSchema, NameSchema, ReceivedObjectsOrRecentlySchema, RECEIVE_FORMAT_BLOCK_OBJECTS } from "../common/index.js";
|
|
4
4
|
import { PolicyRuleSchema } from "../query/index.js";
|
|
5
5
|
import { SupportedValueSchema } from "../common/index.js";
|
|
6
6
|
export const RepositoryIdSchema = z.union([
|
|
@@ -67,7 +67,7 @@ export const CallRepository_DataSchema = z.object({
|
|
|
67
67
|
data_add: DataAddSchema.optional().describe("Add data items"),
|
|
68
68
|
data_remove: DataRemoveSchema.optional().describe("Delete data items"),
|
|
69
69
|
rewards: ObjectsSchema.optional().describe("Reward object list. Used for data contribution incentives."),
|
|
70
|
-
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
|
+
owner_receive: ReceivedObjectsOrRecentlySchema.optional().describe("Unwrap CoinWrapper objects and other objects received by this Repository object and send them to the owner of its Permission object." + RECEIVE_FORMAT_BLOCK_OBJECTS),
|
|
71
71
|
um: z.union([NameOrAddressSchema, z.null()]).optional().describe("Contact object ID or name."),
|
|
72
72
|
}).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.");
|
|
73
73
|
export const CallRepository_InputSchema = z.object({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { TypedPermissionObjectSchema, CoinParamSchema, CallEnvSchema, SubmissionCallSchema, } from "./base.js";
|
|
3
3
|
import { RewardGuardSchema } from "../query/index.js";
|
|
4
|
-
import { BalanceTypeSchema, ReceivedObjectsOrRecentlySchema, ReceivedBalanceOrRecentlySchema, NameOrAddressSchema, DescriptionSchema } from "../common/index.js";
|
|
4
|
+
import { BalanceTypeSchema, ReceivedObjectsOrRecentlySchema, ReceivedBalanceOrRecentlySchema, NameOrAddressSchema, DescriptionSchema, RECEIVE_FORMAT_BLOCK_OBJECTS, RECEIVE_FORMAT_BLOCK_BALANCE } from "../common/index.js";
|
|
5
5
|
export const RewardRecordSchema = z.object({
|
|
6
6
|
amount: BalanceTypeSchema,
|
|
7
7
|
time: z.number().int(),
|
|
@@ -16,11 +16,11 @@ export const CallReward_DataSchema = z.object({
|
|
|
16
16
|
claim: NameOrAddressSchema.optional().describe("Guard object ID. Used to verify Guard and start the reward distribution process corresponding to this Guard."),
|
|
17
17
|
description: DescriptionSchema.optional(),
|
|
18
18
|
coin_add: CoinParamSchema.optional().describe("Add amount to Reward object."),
|
|
19
|
-
receive: ReceivedBalanceOrRecentlySchema.optional().describe("Unwrap CoinWrapper objects received by Reward object and store them in pending balance."),
|
|
19
|
+
receive: ReceivedBalanceOrRecentlySchema.optional().describe("Unwrap CoinWrapper objects received by Reward object and store them in pending balance." + RECEIVE_FORMAT_BLOCK_BALANCE),
|
|
20
20
|
guard_add: z.array(RewardGuardSchema).optional().describe("Add Guard to Reward object."),
|
|
21
21
|
guard_remove_expired: z.boolean().optional().describe("Whether to remove expired Guard."),
|
|
22
22
|
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."),
|
|
23
|
-
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."),
|
|
23
|
+
owner_receive: ReceivedObjectsOrRecentlySchema.optional().describe("Unwrap CoinWrapper objects and other objects received by this Reward object and send them to the owner of its Permission object." + RECEIVE_FORMAT_BLOCK_OBJECTS),
|
|
24
24
|
um: z.union([NameOrAddressSchema, z.null()]).optional().describe("Contact object ID or name."),
|
|
25
25
|
}).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.");
|
|
26
26
|
export const CallReward_InputSchema = z.object({
|
|
@@ -453,7 +453,8 @@ const INTENT_RULES = [
|
|
|
453
453
|
{ operation_type: "progress", intent: "update_progress", confidence: 0.9 },
|
|
454
454
|
{ operation_type: "order", signals: (d) => !!d?.arb, intent: "apply_arbitration", confidence: 0.9 },
|
|
455
455
|
{ operation_type: "order", intent: "manage_order", confidence: 0.85 },
|
|
456
|
-
{ operation_type: "payment", intent: "
|
|
456
|
+
{ operation_type: "payment", signals: (d) => d?.receive === true, intent: "claim_escrow_payment", confidence: 0.95 },
|
|
457
|
+
{ operation_type: "payment", intent: "send_payment", confidence: 0.9 },
|
|
457
458
|
{ operation_type: "reward", intent: "manage_reward", confidence: 0.9 },
|
|
458
459
|
{ operation_type: "demand", intent: "post_demand", confidence: 0.9 },
|
|
459
460
|
{ operation_type: "treasury", intent: "manage_treasury", confidence: 0.9 },
|
|
@@ -599,6 +600,11 @@ const FUND_ROLE_RULES = [
|
|
|
599
600
|
role: "release",
|
|
600
601
|
confidence: 0.9,
|
|
601
602
|
},
|
|
603
|
+
{
|
|
604
|
+
when: (ctx) => ctx.operation_type === "payment" && ctx.data?.receive === true,
|
|
605
|
+
role: "release",
|
|
606
|
+
confidence: 0.95,
|
|
607
|
+
},
|
|
602
608
|
{
|
|
603
609
|
when: (ctx) => ctx.operation_type === "payment" && isNegative(ctx.amount),
|
|
604
610
|
role: "payment",
|
|
@@ -1214,7 +1214,57 @@ export declare const CallService_DataSchema: z.ZodObject<{
|
|
|
1214
1214
|
}, {
|
|
1215
1215
|
coin: string;
|
|
1216
1216
|
}>]>>;
|
|
1217
|
-
|
|
1217
|
+
compensation_fund_withdraw: z.ZodOptional<z.ZodObject<{
|
|
1218
|
+
receipt: z.ZodObject<{
|
|
1219
|
+
name_or_address: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
1220
|
+
local_mark_first: z.ZodOptional<z.ZodBoolean>;
|
|
1221
|
+
}, "strict", z.ZodTypeAny, {
|
|
1222
|
+
name_or_address?: string | undefined;
|
|
1223
|
+
local_mark_first?: boolean | undefined;
|
|
1224
|
+
}, {
|
|
1225
|
+
name_or_address?: string | undefined;
|
|
1226
|
+
local_mark_first?: boolean | undefined;
|
|
1227
|
+
}>;
|
|
1228
|
+
payment_info: z.ZodObject<{
|
|
1229
|
+
for_object: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
1230
|
+
for_guard: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
1231
|
+
remark: z.ZodString;
|
|
1232
|
+
index: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
1233
|
+
}, "strip", z.ZodTypeAny, {
|
|
1234
|
+
index: string | number;
|
|
1235
|
+
remark: string;
|
|
1236
|
+
for_object?: string | null | undefined;
|
|
1237
|
+
for_guard?: string | null | undefined;
|
|
1238
|
+
}, {
|
|
1239
|
+
index: string | number;
|
|
1240
|
+
remark: string;
|
|
1241
|
+
for_object?: string | null | undefined;
|
|
1242
|
+
for_guard?: string | null | undefined;
|
|
1243
|
+
}>;
|
|
1244
|
+
}, "strict", z.ZodTypeAny, {
|
|
1245
|
+
payment_info: {
|
|
1246
|
+
index: string | number;
|
|
1247
|
+
remark: string;
|
|
1248
|
+
for_object?: string | null | undefined;
|
|
1249
|
+
for_guard?: string | null | undefined;
|
|
1250
|
+
};
|
|
1251
|
+
receipt: {
|
|
1252
|
+
name_or_address?: string | undefined;
|
|
1253
|
+
local_mark_first?: boolean | undefined;
|
|
1254
|
+
};
|
|
1255
|
+
}, {
|
|
1256
|
+
payment_info: {
|
|
1257
|
+
index: string | number;
|
|
1258
|
+
remark: string;
|
|
1259
|
+
for_object?: string | null | undefined;
|
|
1260
|
+
for_guard?: string | null | undefined;
|
|
1261
|
+
};
|
|
1262
|
+
receipt: {
|
|
1263
|
+
name_or_address?: string | undefined;
|
|
1264
|
+
local_mark_first?: boolean | undefined;
|
|
1265
|
+
};
|
|
1266
|
+
}>>;
|
|
1267
|
+
setting_lock_duration_add: z.ZodOptional<z.ZodNumber>;
|
|
1218
1268
|
compensation_fund_receive: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
1219
1269
|
balance: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
1220
1270
|
token_type: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -1430,6 +1480,18 @@ export declare const CallService_DataSchema: z.ZodObject<{
|
|
|
1430
1480
|
} | {
|
|
1431
1481
|
coin: string;
|
|
1432
1482
|
} | undefined;
|
|
1483
|
+
compensation_fund_withdraw?: {
|
|
1484
|
+
payment_info: {
|
|
1485
|
+
index: string | number;
|
|
1486
|
+
remark: string;
|
|
1487
|
+
for_object?: string | null | undefined;
|
|
1488
|
+
for_guard?: string | null | undefined;
|
|
1489
|
+
};
|
|
1490
|
+
receipt: {
|
|
1491
|
+
name_or_address?: string | undefined;
|
|
1492
|
+
local_mark_first?: boolean | undefined;
|
|
1493
|
+
};
|
|
1494
|
+
} | undefined;
|
|
1433
1495
|
compensation_fund_receive?: {
|
|
1434
1496
|
received: {
|
|
1435
1497
|
id: string;
|
|
@@ -1439,7 +1501,7 @@ export declare const CallService_DataSchema: z.ZodObject<{
|
|
|
1439
1501
|
balance: string | number;
|
|
1440
1502
|
token_type: string;
|
|
1441
1503
|
} | "recently" | undefined;
|
|
1442
|
-
|
|
1504
|
+
setting_lock_duration_add?: number | undefined;
|
|
1443
1505
|
order_new?: {
|
|
1444
1506
|
buy: {
|
|
1445
1507
|
items: {
|
|
@@ -1598,6 +1660,18 @@ export declare const CallService_DataSchema: z.ZodObject<{
|
|
|
1598
1660
|
} | {
|
|
1599
1661
|
coin: string;
|
|
1600
1662
|
} | undefined;
|
|
1663
|
+
compensation_fund_withdraw?: {
|
|
1664
|
+
payment_info: {
|
|
1665
|
+
index: string | number;
|
|
1666
|
+
remark: string;
|
|
1667
|
+
for_object?: string | null | undefined;
|
|
1668
|
+
for_guard?: string | null | undefined;
|
|
1669
|
+
};
|
|
1670
|
+
receipt: {
|
|
1671
|
+
name_or_address?: string | undefined;
|
|
1672
|
+
local_mark_first?: boolean | undefined;
|
|
1673
|
+
};
|
|
1674
|
+
} | undefined;
|
|
1601
1675
|
compensation_fund_receive?: {
|
|
1602
1676
|
received: {
|
|
1603
1677
|
id: string;
|
|
@@ -1607,7 +1681,7 @@ export declare const CallService_DataSchema: z.ZodObject<{
|
|
|
1607
1681
|
balance: string | number;
|
|
1608
1682
|
token_type: string;
|
|
1609
1683
|
} | "recently" | undefined;
|
|
1610
|
-
|
|
1684
|
+
setting_lock_duration_add?: number | undefined;
|
|
1611
1685
|
order_new?: {
|
|
1612
1686
|
buy: {
|
|
1613
1687
|
items: {
|
|
@@ -2393,7 +2467,57 @@ export declare const CallService_InputSchema: z.ZodObject<{
|
|
|
2393
2467
|
}, {
|
|
2394
2468
|
coin: string;
|
|
2395
2469
|
}>]>>;
|
|
2396
|
-
|
|
2470
|
+
compensation_fund_withdraw: z.ZodOptional<z.ZodObject<{
|
|
2471
|
+
receipt: z.ZodObject<{
|
|
2472
|
+
name_or_address: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
2473
|
+
local_mark_first: z.ZodOptional<z.ZodBoolean>;
|
|
2474
|
+
}, "strict", z.ZodTypeAny, {
|
|
2475
|
+
name_or_address?: string | undefined;
|
|
2476
|
+
local_mark_first?: boolean | undefined;
|
|
2477
|
+
}, {
|
|
2478
|
+
name_or_address?: string | undefined;
|
|
2479
|
+
local_mark_first?: boolean | undefined;
|
|
2480
|
+
}>;
|
|
2481
|
+
payment_info: z.ZodObject<{
|
|
2482
|
+
for_object: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
2483
|
+
for_guard: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
2484
|
+
remark: z.ZodString;
|
|
2485
|
+
index: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
2486
|
+
}, "strip", z.ZodTypeAny, {
|
|
2487
|
+
index: string | number;
|
|
2488
|
+
remark: string;
|
|
2489
|
+
for_object?: string | null | undefined;
|
|
2490
|
+
for_guard?: string | null | undefined;
|
|
2491
|
+
}, {
|
|
2492
|
+
index: string | number;
|
|
2493
|
+
remark: string;
|
|
2494
|
+
for_object?: string | null | undefined;
|
|
2495
|
+
for_guard?: string | null | undefined;
|
|
2496
|
+
}>;
|
|
2497
|
+
}, "strict", z.ZodTypeAny, {
|
|
2498
|
+
payment_info: {
|
|
2499
|
+
index: string | number;
|
|
2500
|
+
remark: string;
|
|
2501
|
+
for_object?: string | null | undefined;
|
|
2502
|
+
for_guard?: string | null | undefined;
|
|
2503
|
+
};
|
|
2504
|
+
receipt: {
|
|
2505
|
+
name_or_address?: string | undefined;
|
|
2506
|
+
local_mark_first?: boolean | undefined;
|
|
2507
|
+
};
|
|
2508
|
+
}, {
|
|
2509
|
+
payment_info: {
|
|
2510
|
+
index: string | number;
|
|
2511
|
+
remark: string;
|
|
2512
|
+
for_object?: string | null | undefined;
|
|
2513
|
+
for_guard?: string | null | undefined;
|
|
2514
|
+
};
|
|
2515
|
+
receipt: {
|
|
2516
|
+
name_or_address?: string | undefined;
|
|
2517
|
+
local_mark_first?: boolean | undefined;
|
|
2518
|
+
};
|
|
2519
|
+
}>>;
|
|
2520
|
+
setting_lock_duration_add: z.ZodOptional<z.ZodNumber>;
|
|
2397
2521
|
compensation_fund_receive: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
2398
2522
|
balance: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
2399
2523
|
token_type: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -2609,6 +2733,18 @@ export declare const CallService_InputSchema: z.ZodObject<{
|
|
|
2609
2733
|
} | {
|
|
2610
2734
|
coin: string;
|
|
2611
2735
|
} | undefined;
|
|
2736
|
+
compensation_fund_withdraw?: {
|
|
2737
|
+
payment_info: {
|
|
2738
|
+
index: string | number;
|
|
2739
|
+
remark: string;
|
|
2740
|
+
for_object?: string | null | undefined;
|
|
2741
|
+
for_guard?: string | null | undefined;
|
|
2742
|
+
};
|
|
2743
|
+
receipt: {
|
|
2744
|
+
name_or_address?: string | undefined;
|
|
2745
|
+
local_mark_first?: boolean | undefined;
|
|
2746
|
+
};
|
|
2747
|
+
} | undefined;
|
|
2612
2748
|
compensation_fund_receive?: {
|
|
2613
2749
|
received: {
|
|
2614
2750
|
id: string;
|
|
@@ -2618,7 +2754,7 @@ export declare const CallService_InputSchema: z.ZodObject<{
|
|
|
2618
2754
|
balance: string | number;
|
|
2619
2755
|
token_type: string;
|
|
2620
2756
|
} | "recently" | undefined;
|
|
2621
|
-
|
|
2757
|
+
setting_lock_duration_add?: number | undefined;
|
|
2622
2758
|
order_new?: {
|
|
2623
2759
|
buy: {
|
|
2624
2760
|
items: {
|
|
@@ -2777,6 +2913,18 @@ export declare const CallService_InputSchema: z.ZodObject<{
|
|
|
2777
2913
|
} | {
|
|
2778
2914
|
coin: string;
|
|
2779
2915
|
} | undefined;
|
|
2916
|
+
compensation_fund_withdraw?: {
|
|
2917
|
+
payment_info: {
|
|
2918
|
+
index: string | number;
|
|
2919
|
+
remark: string;
|
|
2920
|
+
for_object?: string | null | undefined;
|
|
2921
|
+
for_guard?: string | null | undefined;
|
|
2922
|
+
};
|
|
2923
|
+
receipt: {
|
|
2924
|
+
name_or_address?: string | undefined;
|
|
2925
|
+
local_mark_first?: boolean | undefined;
|
|
2926
|
+
};
|
|
2927
|
+
} | undefined;
|
|
2780
2928
|
compensation_fund_receive?: {
|
|
2781
2929
|
received: {
|
|
2782
2930
|
id: string;
|
|
@@ -2786,7 +2934,7 @@ export declare const CallService_InputSchema: z.ZodObject<{
|
|
|
2786
2934
|
balance: string | number;
|
|
2787
2935
|
token_type: string;
|
|
2788
2936
|
} | "recently" | undefined;
|
|
2789
|
-
|
|
2937
|
+
setting_lock_duration_add?: number | undefined;
|
|
2790
2938
|
order_new?: {
|
|
2791
2939
|
buy: {
|
|
2792
2940
|
items: {
|
|
@@ -3188,6 +3336,18 @@ export declare const CallService_InputSchema: z.ZodObject<{
|
|
|
3188
3336
|
} | {
|
|
3189
3337
|
coin: string;
|
|
3190
3338
|
} | undefined;
|
|
3339
|
+
compensation_fund_withdraw?: {
|
|
3340
|
+
payment_info: {
|
|
3341
|
+
index: string | number;
|
|
3342
|
+
remark: string;
|
|
3343
|
+
for_object?: string | null | undefined;
|
|
3344
|
+
for_guard?: string | null | undefined;
|
|
3345
|
+
};
|
|
3346
|
+
receipt: {
|
|
3347
|
+
name_or_address?: string | undefined;
|
|
3348
|
+
local_mark_first?: boolean | undefined;
|
|
3349
|
+
};
|
|
3350
|
+
} | undefined;
|
|
3191
3351
|
compensation_fund_receive?: {
|
|
3192
3352
|
received: {
|
|
3193
3353
|
id: string;
|
|
@@ -3197,7 +3357,7 @@ export declare const CallService_InputSchema: z.ZodObject<{
|
|
|
3197
3357
|
balance: string | number;
|
|
3198
3358
|
token_type: string;
|
|
3199
3359
|
} | "recently" | undefined;
|
|
3200
|
-
|
|
3360
|
+
setting_lock_duration_add?: number | undefined;
|
|
3201
3361
|
order_new?: {
|
|
3202
3362
|
buy: {
|
|
3203
3363
|
items: {
|
|
@@ -3398,6 +3558,18 @@ export declare const CallService_InputSchema: z.ZodObject<{
|
|
|
3398
3558
|
} | {
|
|
3399
3559
|
coin: string;
|
|
3400
3560
|
} | undefined;
|
|
3561
|
+
compensation_fund_withdraw?: {
|
|
3562
|
+
payment_info: {
|
|
3563
|
+
index: string | number;
|
|
3564
|
+
remark: string;
|
|
3565
|
+
for_object?: string | null | undefined;
|
|
3566
|
+
for_guard?: string | null | undefined;
|
|
3567
|
+
};
|
|
3568
|
+
receipt: {
|
|
3569
|
+
name_or_address?: string | undefined;
|
|
3570
|
+
local_mark_first?: boolean | undefined;
|
|
3571
|
+
};
|
|
3572
|
+
} | undefined;
|
|
3401
3573
|
compensation_fund_receive?: {
|
|
3402
3574
|
received: {
|
|
3403
3575
|
id: string;
|
|
@@ -3407,7 +3579,7 @@ export declare const CallService_InputSchema: z.ZodObject<{
|
|
|
3407
3579
|
balance: string | number;
|
|
3408
3580
|
token_type: string;
|
|
3409
3581
|
} | "recently" | undefined;
|
|
3410
|
-
|
|
3582
|
+
setting_lock_duration_add?: number | undefined;
|
|
3411
3583
|
order_new?: {
|
|
3412
3584
|
buy: {
|
|
3413
3585
|
items: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
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";
|
|
3
|
+
import { AllocatorsSchema, DiscountTypeSchema, ServiceSaleSchema, PaymentInfoSchema } from "../query/index.js";
|
|
4
|
+
import { AccountOrMark_AddressSchema, DescriptionSchema, LongNameSchema, ManyAccountOrMark_AddressSchema, NameOrAddressSchema, NotEmptyNameSchema, ReceivedBalanceOrRecentlySchema, ReceivedObjectsOrRecentlySchema, RECEIVE_FORMAT_BLOCK_OBJECTS, RECEIVE_FORMAT_BLOCK_BALANCE } from "../common/index.js";
|
|
5
5
|
import { BalanceTypeSchema } from "../common/index.js";
|
|
6
6
|
export const ServiceBuyItemSchema = z.object({
|
|
7
7
|
name: LongNameSchema.describe("Name of the product or service to purchase"),
|
|
@@ -10,7 +10,9 @@ export const ServiceBuyItemSchema = z.object({
|
|
|
10
10
|
}).strict();
|
|
11
11
|
export const BuySchema = z.object({
|
|
12
12
|
items: z.array(ServiceBuyItemSchema).describe("List of products or services to purchase"),
|
|
13
|
-
total_pay: CoinParamSchema.describe("Actual payment amount"
|
|
13
|
+
total_pay: CoinParamSchema.describe("Actual payment amount. FORMAT: {balance: <amount_in_smallest_unit>} or {coin: <coin_object_id>}. " +
|
|
14
|
+
"The token type and precision are determined by the Service object's type_parameter (the generic type set when the Service was created). " +
|
|
15
|
+
"For WOW (9 decimals): {balance: 1000000000} = 1 WOW. For SUI (9 decimals): {balance: 1000000000} = 1 SUI."),
|
|
14
16
|
discount: z.string().optional().describe("Discount object ID or name"),
|
|
15
17
|
payment_remark: z.string().optional().describe("Payment remark"),
|
|
16
18
|
payment_index: z.number().optional().describe("Payment index"),
|
|
@@ -31,9 +33,15 @@ export const OrderNewSchema = z.object({
|
|
|
31
33
|
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
34
|
order_required_info: z.string().optional().describe("Contact object ID or WTS Proof object"),
|
|
33
35
|
transfer: AccountOrMark_AddressSchema.optional().describe("Set the new owner of the order. Requires order owner permission to set."),
|
|
34
|
-
namedNewOrder: NamedObjectSchema.optional().describe("Set
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
namedNewOrder: NamedObjectSchema.optional().describe("RECOMMENDED: Set a local name for the newly created Order object. " +
|
|
37
|
+
"Without this, the Order is only referenceable by its on-chain address. " +
|
|
38
|
+
"Example: {name: 'my_order_v1'} allows subsequent operations to use 'my_order_v1' instead of the address."),
|
|
39
|
+
namedNewAllocation: NamedObjectSchema.optional().describe("RECOMMENDED: Set a local name for the order's Allocation object. " +
|
|
40
|
+
"Without this, the Allocation is only referenceable by its address. " +
|
|
41
|
+
"Example: {name: 'my_allocation_v1'} allows alloc_by_guard to reference 'my_allocation_v1'."),
|
|
42
|
+
namedNewProgress: NamedObjectSchema.optional().describe("RECOMMENDED: Set a local name for the order's Progress object. " +
|
|
43
|
+
"Without this, the Progress is only referenceable by its address. " +
|
|
44
|
+
"Example: {name: 'my_progress_v1'} allows progress operations to use 'my_progress_v1'."),
|
|
37
45
|
}).strict();
|
|
38
46
|
export const SalesSchema = z.discriminatedUnion("op", [
|
|
39
47
|
z.object({
|
|
@@ -60,41 +68,88 @@ export const CallService_DataSchema = z.object({
|
|
|
60
68
|
sales: SalesSchema.optional().describe("Service sales products or services list."),
|
|
61
69
|
repositories: ObjectsSchema.optional().describe("Service Repository object list."),
|
|
62
70
|
rewards: ObjectsSchema.optional().describe("Service Reward object list."),
|
|
63
|
-
arbitrations: ObjectsSchema.optional().describe("Service Arbitration object list."
|
|
71
|
+
arbitrations: ObjectsSchema.optional().describe("Service Arbitration object list. " +
|
|
72
|
+
"FORMAT: same as repositories — use the `objects` field name inside the operation data. " +
|
|
73
|
+
"Example: {arbitrations: [{name: 'my_arb_1'}, {name: 'my_arb_2'}]}. " +
|
|
74
|
+
"Each item is a NameOrAddress (object ID or local mark name)."),
|
|
64
75
|
machine: z.union([NameOrAddressSchema, z.null()]).optional().describe("Service Machine object ID or name. The Machine object must be in published state."),
|
|
65
76
|
discount: DiscountSchema.optional().describe("Issue discount."),
|
|
66
77
|
discount_destroy: z.array(NameOrAddressSchema).optional().describe("Destroy existing discount object ID list."),
|
|
67
78
|
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."
|
|
79
|
+
order_allocators: z.union([AllocatorsSchema, z.null()]).optional().describe("Order fund allocator. Max 100 allocators (MAX_ALLOCATOR_COUNT). " +
|
|
80
|
+
"Each allocator has a guard (first matching guard wins) and a sharing list. " +
|
|
81
|
+
"Set to null to clear. " +
|
|
82
|
+
"⚠️ PERMANENTLY IMMUTABLE after publish: order_allocators can ONLY be set BEFORE publish=true " +
|
|
83
|
+
"(Move service.move:503: assert!(!self.bPublished, E_ALREADY_PUBLISHED)). " +
|
|
84
|
+
"After publish, the ONLY way to change allocation rules is to create a NEW Service object. " +
|
|
85
|
+
"There is NO pause+lock exception for order_allocators (unlike arbitrations/rewards which have time-lock removal). " +
|
|
86
|
+
"PRE-PUBLISH CHECKLIST: verify all guard names resolve, all sharing amounts are correct, " +
|
|
87
|
+
"threshold is set, and recipient types (Entity/Signer/GuardIdentifier) are intended before calling publish=true. " +
|
|
88
|
+
"GuardIdentifier sharing mode: {who: {GuardIdentifier: <u8>}, sharing: <rate>, mode: 'Rate'} — " +
|
|
89
|
+
"resolves recipient from Guard table submission at allocation time (e.g., refund to customer). " +
|
|
90
|
+
"MULTI-CALL ALLOCATION: Allocation.alloc() can be called MULTIPLE times (no consumed flag in contract). " +
|
|
91
|
+
"Use Amount mode (not Surplus) for recurring allocations — Surplus calls balance::withdraw_all which drains the balance. " +
|
|
92
|
+
"For monthly payment scenarios, create multiple Allocators with time-based Guards + Amount mode sharing items."),
|
|
69
93
|
buy_guard: z.union([NameOrAddressSchema, z.null()]).optional().describe("Buy guard object ID or name."),
|
|
70
|
-
compensation_fund_add: CoinParamSchema.optional().describe("
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
94
|
+
compensation_fund_add: CoinParamSchema.optional().describe("Deposit funds into the Service compensation_fund. Used to pay indemnity when arbitration resolves in customer's favor. " +
|
|
95
|
+
"FORMAT: {balance: <amount_in_smallest_unit>} — the field name is 'balance' (NOT 'amount'). " +
|
|
96
|
+
"The token type and precision are determined by the Service object's type_parameter (the generic type set when the Service was created). " +
|
|
97
|
+
"For WOW (9 decimals): {balance: 1000000000} = 1 WOW. For SUI (9 decimals): {balance: 1000000000} = 1 SUI. " +
|
|
98
|
+
"For tokens with different decimals, adjust accordingly (e.g. USDC has 6 decimals, so {balance: 1000000} = 1 USDC). " +
|
|
99
|
+
"REQUIRES: Permission index 315 (SERVICE_COMPENSATION_FUND_DEPOSIT) must be granted to the calling account first. " +
|
|
100
|
+
"COMMON MISTAKE: using {amount: ...} or {amount: ..., type: 'WOW'} — these will fail. The correct field is 'balance'."),
|
|
101
|
+
compensation_fund_withdraw: z.object({
|
|
102
|
+
receipt: AccountOrMark_AddressSchema.describe("Receipt address that will receive the withdrawn funds (as a new Payment object)"),
|
|
103
|
+
payment_info: PaymentInfoSchema.describe("Payment info for the new Payment object created to hold the withdrawn funds"),
|
|
104
|
+
}).strict().optional().describe("Withdraw ALL funds from the compensation_fund to a new Payment object owned by `receipt`. " +
|
|
105
|
+
"Move layer: service::compensation_fund_withdraw (service.move L383-390). " +
|
|
106
|
+
"REQUIRES: Service must be paused AND setting_lock_duration must have elapsed since pause (assert_not_published at L384-385). " +
|
|
107
|
+
"Withdraws the ENTIRE compensation_fund balance via balance::withdraw_all. " +
|
|
108
|
+
"DIFFERENT from compensation_claim (order-side, for arbitration-winning users, no pause+lock required)."),
|
|
109
|
+
setting_lock_duration_add: z.number().optional().describe("Additional lock duration to ADD to 'setting_lock_duration' (Move field name). " +
|
|
110
|
+
"UNIT: milliseconds (ms). Example: 2592000000 = 30 days, 7776000000 = 90 days, 86400000 = 1 day. " +
|
|
111
|
+
"DEFAULT: 2592000000 (30 days, DEFAULT_LOCK_DURATION). This is the initial value when a Service is created. " +
|
|
112
|
+
"Behavior: additive (safe_add) — only increases, never decreases. " +
|
|
113
|
+
"Move entry: service::setting_lock_duration_add / setting_lock_duration_add_with_passport. " +
|
|
114
|
+
"Can be called BEFORE or AFTER publish (no publish check). " +
|
|
115
|
+
"Affects the waiting time required by: compensation_fund_withdraw, arbitrations remove/clear, rewards remove/clear " +
|
|
116
|
+
"(all require pause + setting_lock_duration elapsed since pause)."),
|
|
117
|
+
compensation_fund_receive: ReceivedBalanceOrRecentlySchema.optional().describe("Receive order compensation funds from this Service object." + RECEIVE_FORMAT_BLOCK_BALANCE),
|
|
118
|
+
owner_receive: ReceivedObjectsOrRecentlySchema.optional().describe("Unwrap CoinWrapper objects and other objects received by this Service object and send them to the owner of its Permission object." + RECEIVE_FORMAT_BLOCK_OBJECTS),
|
|
74
119
|
um: z.union([NameOrAddressSchema, z.null()]).optional().describe("Contact object ID or name."),
|
|
75
120
|
pause: z.boolean().optional().describe("Whether to pause accepting new orders."),
|
|
76
121
|
publish: z.boolean().optional().describe("Whether to publish the Service. After publishing, customers can place orders. " +
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
" • machine (
|
|
80
|
-
" • order_allocators (
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
" • rewards remove/clear
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
" •
|
|
87
|
-
" • sales, discount, description, location, pause, repositories,\n" +
|
|
88
|
-
" • compensation_fund_add, customer_required, um (Contact)
|
|
89
|
-
"These
|
|
122
|
+
"VERIFIED against Move source service.move + SDK service.ts (4-level immutability matrix):\n" +
|
|
123
|
+
" L1 — PERMANENTLY LOCKED after publish (assert!(!bPublished), no pause+lock exception):\n" +
|
|
124
|
+
" • machine (service.move L633/L653 — workflow template)\n" +
|
|
125
|
+
" • order_allocators (service.move L503 — fund distribution rules)\n" +
|
|
126
|
+
" L2 — TIME-LOCKED after publish (assert_not_published — requires pause + setting_lock_duration elapsed):\n" +
|
|
127
|
+
" • arbitrations remove/clear (service.move L433/L445 — dispute resolution objects)\n" +
|
|
128
|
+
" • rewards remove/clear (service.move L402/L414 — reward objects)\n" +
|
|
129
|
+
" • compensation_fund_withdraw (service.move L384-385 — withdraw ALL funds)\n" +
|
|
130
|
+
" L3 — REMAIN MUTABLE after publish (no SDK check, no Move check):\n" +
|
|
131
|
+
" • arbitrations add, rewards add (no assert — can add after publish)\n" +
|
|
132
|
+
" • buy_guard, sales, discount, description, location, pause, repositories,\n" +
|
|
133
|
+
" • compensation_fund_add, setting_lock_duration_add, customer_required, um (Contact)\n" +
|
|
134
|
+
"These 2 L1-LOCKED fields (machine/order_allocators) MUST be set BEFORE publish=true.\n" +
|
|
135
|
+
"arbitrations/rewards can be ADDED after publish but remove/clear requires pause+lock.\n" +
|
|
136
|
+
"\n" +
|
|
137
|
+
"⚠️ COMPENSATION_FUND + ARBITRATION LINKAGE (service.move:494-499):\n" +
|
|
138
|
+
" At publish time, if compensation_fund > 0, Arbitration MUST be bound:\n" +
|
|
139
|
+
" if (balance::value(&self.compensation_fund) > 0) {\n" +
|
|
140
|
+
" assert!(arbitration_count > 0, E_ARBITRATION_NOT_SET_WITH_COMPENSATION_FUND);\n" +
|
|
141
|
+
" }\n" +
|
|
142
|
+
" The MCP handler enforces this as a HARD PRE-CHECK: if publish=true AND compensation_fund_add " +
|
|
143
|
+
" is set in the same call AND arbitrations is empty, the call is REJECTED before submission. " +
|
|
144
|
+
" If compensation_fund was deposited in a prior call, a SOFT WARNING is issued.\n" +
|
|
90
145
|
"\n" +
|
|
91
146
|
"SCHEMA-03 / P0-01 fix — DEPLOYMENT WORKFLOW (two-phase, avoids circular dependency):\n" +
|
|
92
147
|
" Phase 1 — CREATE (no publish): object={name:'my-service', type_parameter, permission} + machine + order_allocators + arbitrations.\n" +
|
|
93
148
|
" NOTE: buy_guard can use a LocalMark NAME (not address) to break the Guard→Service circular dependency.\n" +
|
|
94
149
|
" The name is resolved to an address at transaction build time.\n" +
|
|
95
150
|
" Phase 2 — PUBLISH: object='my-service' (string ref) + publish=true.\n" +
|
|
96
|
-
" All
|
|
97
|
-
" Post-publish updates: buy_guard, sales, description, repositories (add), rewards (add), etc."),
|
|
151
|
+
" All L1-LOCKED fields must be set in Phase 1; Phase 2 only flips the publish flag.\n" +
|
|
152
|
+
" Post-publish updates: buy_guard, sales, description, repositories (add), rewards (add), arbitrations (add), etc."),
|
|
98
153
|
}).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.");
|
|
99
154
|
export const CallService_InputSchema = z.object({
|
|
100
155
|
data: CallService_DataSchema,
|