@wowok/agent-mcp 2.6.0 → 2.6.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/README.md +5 -3
- package/dist/extensions/capability-manifest.d.ts +125 -0
- package/dist/extensions/capability-manifest.js +594 -0
- package/dist/extensions/constraint-registry.d.ts +24 -0
- package/dist/extensions/constraint-registry.js +196 -0
- package/dist/extensions/index.d.ts +12 -0
- package/dist/extensions/index.js +6 -0
- package/dist/extensions/metric-registry.d.ts +26 -0
- package/dist/extensions/metric-registry.js +257 -0
- package/dist/extensions/mode-evaluator.d.ts +15 -0
- package/dist/extensions/mode-evaluator.js +170 -0
- package/dist/extensions/modes.d.ts +2 -0
- package/dist/extensions/modes.js +407 -0
- package/dist/extensions/registry.d.ts +48 -0
- package/dist/extensions/registry.js +629 -0
- package/dist/extensions/types.d.ts +218 -0
- package/dist/extensions/types.js +1 -0
- package/dist/knowledge/deployment-scanner.d.ts +3 -0
- package/dist/knowledge/deployment-scanner.js +64 -3
- package/dist/knowledge/guard-risk.d.ts +13 -0
- package/dist/knowledge/guard-risk.js +57 -0
- package/dist/knowledge/guard-templates.js +278 -0
- package/dist/knowledge/machine-templates.js +20 -1
- package/dist/knowledge/service-confirm.d.ts +14 -5
- package/dist/knowledge/service-confirm.js +116 -8
- package/dist/knowledge/tool-constraints.js +6 -2
- package/dist/project/deployment-bridge.d.ts +1 -1
- package/dist/project/deployment-bridge.js +27 -4
- package/dist/project/deployment-doc.d.ts +3 -0
- package/dist/project/deployment-doc.js +72 -10
- package/dist/project/evaluation.d.ts +2 -0
- package/dist/project/evaluation.js +569 -84
- package/dist/project/graph-builder.d.ts +4 -1
- package/dist/project/graph-builder.js +126 -61
- package/dist/project/graph.d.ts +1 -0
- package/dist/project/handlers.d.ts +219 -5
- package/dist/project/handlers.js +819 -9
- package/dist/project/stage-gate.d.ts +4 -0
- package/dist/project/stage-gate.js +64 -5
- package/dist/project/task-tracker.d.ts +26 -0
- package/dist/project/task-tracker.js +78 -0
- package/dist/safety/preview.js +16 -0
- package/dist/schema/call/allocation.d.ts +16 -16
- package/dist/schema/call/base.d.ts +21 -13
- package/dist/schema/call/base.js +27 -6
- package/dist/schema/call/bridge.d.ts +5 -5
- package/dist/schema/call/bridge.js +3 -1
- package/dist/schema/call/demand.d.ts +23 -31
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/machine.d.ts +402 -376
- package/dist/schema/call/order.d.ts +149 -228
- package/dist/schema/call/order.js +7 -3
- package/dist/schema/call/payment.d.ts +183 -3
- package/dist/schema/call/payment.js +21 -3
- package/dist/schema/call/personal.d.ts +241 -52
- package/dist/schema/call/progress.d.ts +53 -61
- package/dist/schema/call/progress.js +18 -4
- package/dist/schema/call/repository.d.ts +23 -31
- package/dist/schema/call/semantic.d.ts +1 -1
- package/dist/schema/call/semantic.js +30 -1
- package/dist/schema/call/service.d.ts +95 -119
- package/dist/schema/call/service.js +22 -1
- package/dist/schema/common/index.d.ts +11 -2
- package/dist/schema/common/index.js +43 -14
- package/dist/schema/local/index.d.ts +32 -35
- package/dist/schema/local/index.js +23 -5
- package/dist/schema/messenger/index.d.ts +274 -46
- package/dist/schema/operations.d.ts +680 -539
- package/dist/schema/operations.js +22 -0
- package/dist/schema/project/index.d.ts +1796 -80
- package/dist/schema/project/index.js +304 -14
- package/dist/schema/query/index.d.ts +705 -349
- package/dist/schema/query/index.js +164 -31
- package/dist/schema/schema-query/index.d.ts +15 -3
- package/dist/schema/schema-query/index.js +23 -5
- package/dist/schema/utils/node-parser.js +7 -4
- package/dist/schema-query/index.d.ts +7 -1
- package/dist/schema-query/index.js +204 -4
- package/dist/schemas/account_operation.output.json +7 -1
- package/dist/schemas/account_operation.schema.json +2 -2
- package/dist/schemas/bridge_operation.output.json +6 -0
- package/dist/schemas/bridge_operation.schema.json +1 -1
- package/dist/schemas/guard-templates.json +379 -0
- package/dist/schemas/guard2file.schema.json +1 -1
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/local_info_operation.output.json +6 -0
- package/dist/schemas/local_mark_operation.output.json +7 -1
- package/dist/schemas/local_mark_operation.schema.json +1 -1
- package/dist/schemas/machineNode2file.schema.json +1 -1
- package/dist/schemas/messenger_operation.schema.json +4 -4
- package/dist/schemas/onchain_events.output.json +1 -1
- package/dist/schemas/onchain_operations.schema.json +348 -296
- package/dist/schemas/onchain_operations_allocation.schema.json +34 -25
- package/dist/schemas/onchain_operations_arbitration.schema.json +8 -8
- package/dist/schemas/onchain_operations_contact.schema.json +8 -8
- package/dist/schemas/onchain_operations_demand.schema.json +8 -8
- package/dist/schemas/onchain_operations_gen_passport.schema.json +14 -14
- package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -2
- package/dist/schemas/onchain_operations_guard.schema.json +1 -1
- package/dist/schemas/onchain_operations_machine.schema.json +41 -33
- package/dist/schemas/onchain_operations_order.schema.json +71 -77
- package/dist/schemas/onchain_operations_payment.schema.json +141 -111
- package/dist/schemas/onchain_operations_permission.schema.json +2 -2
- package/dist/schemas/onchain_operations_personal.schema.json +7 -7
- package/dist/schemas/onchain_operations_progress.schema.json +8 -8
- package/dist/schemas/onchain_operations_proof.schema.json +7 -7
- package/dist/schemas/onchain_operations_repository.schema.json +8 -8
- package/dist/schemas/onchain_operations_reward.schema.json +10 -10
- package/dist/schemas/onchain_operations_service.schema.json +46 -35
- package/dist/schemas/onchain_operations_treasury.schema.json +8 -8
- package/dist/schemas/onchain_table_data.output.json +33 -25
- package/dist/schemas/onchain_table_data.schema.json +12 -12
- package/dist/schemas/project_operation.output.json +1175 -23
- package/dist/schemas/project_operation.schema.json +40 -4
- package/dist/schemas/query_toolkit.output.json +104 -76
- package/dist/schemas/query_toolkit.schema.json +9 -9
- package/dist/schemas/schema_query.output.json +7 -3
- package/dist/schemas/schema_query.schema.json +17 -3
- package/dist/tools/handlers/local.js +20 -5
- package/dist/tools/handlers/onchain.js +23 -0
- package/dist/tools/handlers/project.js +52 -3
- package/dist/tools/handlers/query.js +27 -0
- package/dist/tools/handlers/schema-query.js +19 -0
- package/dist/tools/handlers/task-status.d.ts +170 -0
- package/dist/tools/handlers/task-status.js +55 -0
- package/dist/tools/handlers/wip.js +47 -1
- package/dist/tools/index.js +211 -7
- package/dist/tools/retry.d.ts +8 -0
- package/dist/tools/retry.js +85 -0
- package/dist/tools/wip-deploy-assist.d.ts +28 -0
- package/dist/tools/wip-deploy-assist.js +278 -0
- package/package.json +2 -2
- package/dist/schemas/guard-node-examples.md +0 -199
|
@@ -35,6 +35,8 @@ export interface StageGateInput {
|
|
|
35
35
|
}>;
|
|
36
36
|
trace_coherent?: boolean;
|
|
37
37
|
has_published_object?: boolean;
|
|
38
|
+
evaluation_score?: number;
|
|
39
|
+
deployment_doc_generated?: boolean;
|
|
38
40
|
gas_budget?: GasBudgetCheck;
|
|
39
41
|
}
|
|
40
42
|
export interface StageGateResult {
|
|
@@ -45,5 +47,7 @@ export interface StageGateResult {
|
|
|
45
47
|
warnings: string[];
|
|
46
48
|
can_proceed: boolean;
|
|
47
49
|
}
|
|
50
|
+
export declare const STAGE5_RISK_SCORE_BLOCK = 50;
|
|
51
|
+
export declare const STAGE5_RISK_SCORE_WARN = 80;
|
|
48
52
|
export declare function validateStageGate(input: StageGateInput): StageGateResult;
|
|
49
53
|
export declare function validateStageGateFromDisk(prefix: string, version: string, stage?: ProjectStage, extra?: Partial<StageGateInput>): StageGateResult;
|
|
@@ -1,4 +1,66 @@
|
|
|
1
1
|
import { loadStageState, projectExists } from "./project-store.js";
|
|
2
|
+
export const STAGE5_RISK_SCORE_BLOCK = 50;
|
|
3
|
+
export const STAGE5_RISK_SCORE_WARN = 80;
|
|
4
|
+
function buildStage5ScoreCheck(input) {
|
|
5
|
+
if (input.evaluation_score !== undefined && input.evaluation_score !== null) {
|
|
6
|
+
const score = input.evaluation_score;
|
|
7
|
+
if (score < STAGE5_RISK_SCORE_BLOCK) {
|
|
8
|
+
return {
|
|
9
|
+
dimension: "risk",
|
|
10
|
+
status: "FAIL",
|
|
11
|
+
message: `Stage 3 evaluation score ${score} < ${STAGE5_RISK_SCORE_BLOCK} (block threshold). ` +
|
|
12
|
+
`GLM6 衔接验证: deployment blocked — too many CRITICAL risks unresolved. ` +
|
|
13
|
+
`Fix risks in Stage 3 (aggregate_risks) before deploying.`,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
if (score < STAGE5_RISK_SCORE_WARN) {
|
|
17
|
+
return {
|
|
18
|
+
dimension: "risk",
|
|
19
|
+
status: "WARN",
|
|
20
|
+
message: `Stage 3 evaluation score ${score} < ${STAGE5_RISK_SCORE_WARN} (warn threshold). ` +
|
|
21
|
+
`GLM6 衔接验证: non-blocking — proceed at your own risk. ` +
|
|
22
|
+
`Recommend improving risk posture before deploying to mainnet.`,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
dimension: "risk",
|
|
27
|
+
status: "PASS",
|
|
28
|
+
message: `Stage 3 evaluation score ${score} >= ${STAGE5_RISK_SCORE_WARN} — safe to deploy`,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const riskPassed = input.risk_status === "RISK_PASSED";
|
|
32
|
+
return {
|
|
33
|
+
dimension: "risk",
|
|
34
|
+
status: riskPassed ? "PASS" : "WARN",
|
|
35
|
+
message: riskPassed
|
|
36
|
+
? "Risk status is RISK_PASSED"
|
|
37
|
+
: `Risk status is ${input.risk_status ?? "unknown"} — recommend resolving before deployment`,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function buildStage5DocCheck(input) {
|
|
41
|
+
if (input.deployment_doc_generated !== true) {
|
|
42
|
+
return {
|
|
43
|
+
dimension: "semantic",
|
|
44
|
+
status: "FAIL",
|
|
45
|
+
message: "GLM6 衔接验证: Stage 4 deployment doc not generated. " +
|
|
46
|
+
"Call generate_deployment_doc (Stage 4) before executing deployment (Stage 5).",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const errorCount = input.doc_error_count ?? 0;
|
|
50
|
+
if (errorCount > 0) {
|
|
51
|
+
return {
|
|
52
|
+
dimension: "semantic",
|
|
53
|
+
status: "FAIL",
|
|
54
|
+
message: `GLM6 衔接验证: Stage 4 deployment doc has ${errorCount} D-error(s). ` +
|
|
55
|
+
`Fix all D-errors before executing deployment.`,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
dimension: "semantic",
|
|
60
|
+
status: "PASS",
|
|
61
|
+
message: "Stage 4 deployment doc generated with 0 D-errors",
|
|
62
|
+
};
|
|
63
|
+
}
|
|
2
64
|
function buildGasBudgetCheck(input) {
|
|
3
65
|
const gb = input.gas_budget;
|
|
4
66
|
if (!gb) {
|
|
@@ -220,6 +282,7 @@ function validateStage4Gate(input) {
|
|
|
220
282
|
}
|
|
221
283
|
function validateStage5Gate(input) {
|
|
222
284
|
const checks = [];
|
|
285
|
+
checks.push(buildStage5DocCheck(input));
|
|
223
286
|
const coherent = input.trace_coherent === true;
|
|
224
287
|
checks.push({
|
|
225
288
|
dimension: "semantic",
|
|
@@ -244,11 +307,7 @@ function validateStage5Gate(input) {
|
|
|
244
307
|
"Ensure all substeps are correct before executing on mainnet."
|
|
245
308
|
: "No objects published yet — stage 5 is still reversible",
|
|
246
309
|
});
|
|
247
|
-
checks.push(
|
|
248
|
-
dimension: "risk",
|
|
249
|
-
status: "PASS",
|
|
250
|
-
message: "Risks verified in stage 3",
|
|
251
|
-
});
|
|
310
|
+
checks.push(buildStage5ScoreCheck(input));
|
|
252
311
|
checks.push({
|
|
253
312
|
dimension: "isolation",
|
|
254
313
|
status: "PASS",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type TaskStatus = "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
2
|
+
export interface TaskState {
|
|
3
|
+
task_id: string;
|
|
4
|
+
operation: string;
|
|
5
|
+
status: TaskStatus;
|
|
6
|
+
progress: number;
|
|
7
|
+
message: string;
|
|
8
|
+
result: unknown;
|
|
9
|
+
error: string | null;
|
|
10
|
+
started_at: number;
|
|
11
|
+
completed_at: number | null;
|
|
12
|
+
project_id: string | null;
|
|
13
|
+
}
|
|
14
|
+
declare class TaskTrackerImpl {
|
|
15
|
+
private tasks;
|
|
16
|
+
private counter;
|
|
17
|
+
create(operation: string, projectId?: string): string;
|
|
18
|
+
update(task_id: string, progress: number, message?: string): void;
|
|
19
|
+
complete(task_id: string, result: unknown): void;
|
|
20
|
+
fail(task_id: string, error: string): void;
|
|
21
|
+
get(task_id: string): TaskState | undefined;
|
|
22
|
+
list(projectId?: string): TaskState[];
|
|
23
|
+
private evictExpired;
|
|
24
|
+
}
|
|
25
|
+
export declare const TaskTracker: TaskTrackerImpl;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const RETENTION_MS = 5 * 60 * 1000;
|
|
2
|
+
const MAX_TASKS = 200;
|
|
3
|
+
class TaskTrackerImpl {
|
|
4
|
+
tasks = new Map();
|
|
5
|
+
counter = 0;
|
|
6
|
+
create(operation, projectId) {
|
|
7
|
+
this.evictExpired();
|
|
8
|
+
this.counter++;
|
|
9
|
+
const task_id = `task_${Date.now()}_${this.counter}`;
|
|
10
|
+
const state = {
|
|
11
|
+
task_id,
|
|
12
|
+
operation,
|
|
13
|
+
status: "pending",
|
|
14
|
+
progress: 0,
|
|
15
|
+
message: "Task created",
|
|
16
|
+
result: null,
|
|
17
|
+
error: null,
|
|
18
|
+
started_at: Date.now(),
|
|
19
|
+
completed_at: null,
|
|
20
|
+
project_id: projectId ?? null,
|
|
21
|
+
};
|
|
22
|
+
this.tasks.set(task_id, state);
|
|
23
|
+
return task_id;
|
|
24
|
+
}
|
|
25
|
+
update(task_id, progress, message) {
|
|
26
|
+
const t = this.tasks.get(task_id);
|
|
27
|
+
if (!t)
|
|
28
|
+
return;
|
|
29
|
+
t.progress = Math.max(0, Math.min(100, progress));
|
|
30
|
+
if (message)
|
|
31
|
+
t.message = message;
|
|
32
|
+
if (t.status === "pending")
|
|
33
|
+
t.status = "running";
|
|
34
|
+
}
|
|
35
|
+
complete(task_id, result) {
|
|
36
|
+
const t = this.tasks.get(task_id);
|
|
37
|
+
if (!t)
|
|
38
|
+
return;
|
|
39
|
+
t.status = "completed";
|
|
40
|
+
t.progress = 100;
|
|
41
|
+
t.result = result;
|
|
42
|
+
t.completed_at = Date.now();
|
|
43
|
+
}
|
|
44
|
+
fail(task_id, error) {
|
|
45
|
+
const t = this.tasks.get(task_id);
|
|
46
|
+
if (!t)
|
|
47
|
+
return;
|
|
48
|
+
t.status = "failed";
|
|
49
|
+
t.error = error;
|
|
50
|
+
t.completed_at = Date.now();
|
|
51
|
+
}
|
|
52
|
+
get(task_id) {
|
|
53
|
+
return this.tasks.get(task_id);
|
|
54
|
+
}
|
|
55
|
+
list(projectId) {
|
|
56
|
+
const all = Array.from(this.tasks.values());
|
|
57
|
+
if (projectId)
|
|
58
|
+
return all.filter(t => t.project_id === projectId);
|
|
59
|
+
return all;
|
|
60
|
+
}
|
|
61
|
+
evictExpired() {
|
|
62
|
+
const now = Date.now();
|
|
63
|
+
for (const [id, t] of this.tasks) {
|
|
64
|
+
if (t.completed_at && now - t.completed_at > RETENTION_MS) {
|
|
65
|
+
this.tasks.delete(id);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (this.tasks.size > MAX_TASKS) {
|
|
69
|
+
const completed = Array.from(this.tasks.values())
|
|
70
|
+
.filter(t => t.status === "completed" || t.status === "failed")
|
|
71
|
+
.sort((a, b) => (a.completed_at ?? 0) - (b.completed_at ?? 0));
|
|
72
|
+
const toEvict = completed.slice(0, this.tasks.size - MAX_TASKS);
|
|
73
|
+
for (const t of toEvict)
|
|
74
|
+
this.tasks.delete(t.task_id);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export const TaskTracker = new TaskTrackerImpl();
|
package/dist/safety/preview.js
CHANGED
|
@@ -5,6 +5,16 @@ const LEVEL_LABEL = {
|
|
|
5
5
|
publish: "Publish confirmation (irreversible lock)",
|
|
6
6
|
irreversible: "Irreversible operation confirmation",
|
|
7
7
|
};
|
|
8
|
+
const CONFIRMATION_REQUIRED_OPERATIONS = [
|
|
9
|
+
"guard (CREATE — immutable, cannot be edited or deleted)",
|
|
10
|
+
"service (publish=true — locks machine/order_allocators)",
|
|
11
|
+
"machine (publish=true — locks nodes/pairs/forwards)",
|
|
12
|
+
"arbitration (verdict — irreversible)",
|
|
13
|
+
"payment (send — irreversible)",
|
|
14
|
+
"treasury (withdraw/external_withdraw/external_deposit — irreversible)",
|
|
15
|
+
"reward / treasury / service.compensation_fund_add (amount-sensitive)",
|
|
16
|
+
"gen_passport (gas-consuming test)",
|
|
17
|
+
];
|
|
8
18
|
export function renderPreview(p) {
|
|
9
19
|
const lines = [];
|
|
10
20
|
lines.push(`⚠️ Confirmation required — ${LEVEL_LABEL[p.level]}`);
|
|
@@ -32,5 +42,11 @@ export function renderPreview(p) {
|
|
|
32
42
|
}
|
|
33
43
|
lines.push("");
|
|
34
44
|
lines.push("Confirm by re-calling with env.confirmed=true, or modify/cancel.");
|
|
45
|
+
lines.push("");
|
|
46
|
+
lines.push("Operations that require env.confirmed=true:");
|
|
47
|
+
for (const op of CONFIRMATION_REQUIRED_OPERATIONS) {
|
|
48
|
+
lines.push(` - ${op}`);
|
|
49
|
+
}
|
|
50
|
+
lines.push('Example: {"env": {"account": "...", "network": "testnet", "confirmed": true}}');
|
|
35
51
|
return lines.join("\n");
|
|
36
52
|
}
|
|
@@ -61,7 +61,7 @@ export declare const CallAllocation_CreateSchema: z.ZodObject<{
|
|
|
61
61
|
Signer: "signer";
|
|
62
62
|
}>]>;
|
|
63
63
|
sharing: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
64
|
-
mode: z.ZodEnum<["Amount", "Rate", "Surplus"]>;
|
|
64
|
+
mode: z.ZodUnion<[z.ZodEnum<["Amount", "Rate", "Surplus"]>, z.ZodEffects<z.ZodNumber, "Amount" | "Rate" | "Surplus", number>]>;
|
|
65
65
|
}, "strip", z.ZodTypeAny, {
|
|
66
66
|
mode: "Amount" | "Rate" | "Surplus";
|
|
67
67
|
sharing: string | number;
|
|
@@ -76,7 +76,7 @@ export declare const CallAllocation_CreateSchema: z.ZodObject<{
|
|
|
76
76
|
Signer: "signer";
|
|
77
77
|
};
|
|
78
78
|
}, {
|
|
79
|
-
mode: "Amount" | "Rate" | "Surplus";
|
|
79
|
+
mode: number | "Amount" | "Rate" | "Surplus";
|
|
80
80
|
sharing: string | number;
|
|
81
81
|
who: {
|
|
82
82
|
GuardIdentifier: number;
|
|
@@ -112,7 +112,7 @@ export declare const CallAllocation_CreateSchema: z.ZodObject<{
|
|
|
112
112
|
}, {
|
|
113
113
|
guard: string;
|
|
114
114
|
sharing: {
|
|
115
|
-
mode: "Amount" | "Rate" | "Surplus";
|
|
115
|
+
mode: number | "Amount" | "Rate" | "Surplus";
|
|
116
116
|
sharing: string | number;
|
|
117
117
|
who: {
|
|
118
118
|
GuardIdentifier: number;
|
|
@@ -155,7 +155,7 @@ export declare const CallAllocation_CreateSchema: z.ZodObject<{
|
|
|
155
155
|
allocators: {
|
|
156
156
|
guard: string;
|
|
157
157
|
sharing: {
|
|
158
|
-
mode: "Amount" | "Rate" | "Surplus";
|
|
158
|
+
mode: number | "Amount" | "Rate" | "Surplus";
|
|
159
159
|
sharing: string | number;
|
|
160
160
|
who: {
|
|
161
161
|
GuardIdentifier: number;
|
|
@@ -262,7 +262,7 @@ export declare const CallAllocation_CreateSchema: z.ZodObject<{
|
|
|
262
262
|
allocators: {
|
|
263
263
|
guard: string;
|
|
264
264
|
sharing: {
|
|
265
|
-
mode: "Amount" | "Rate" | "Surplus";
|
|
265
|
+
mode: number | "Amount" | "Rate" | "Surplus";
|
|
266
266
|
sharing: string | number;
|
|
267
267
|
who: {
|
|
268
268
|
GuardIdentifier: number;
|
|
@@ -410,7 +410,7 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
410
410
|
Signer: "signer";
|
|
411
411
|
}>]>;
|
|
412
412
|
sharing: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
413
|
-
mode: z.ZodEnum<["Amount", "Rate", "Surplus"]>;
|
|
413
|
+
mode: z.ZodUnion<[z.ZodEnum<["Amount", "Rate", "Surplus"]>, z.ZodEffects<z.ZodNumber, "Amount" | "Rate" | "Surplus", number>]>;
|
|
414
414
|
}, "strip", z.ZodTypeAny, {
|
|
415
415
|
mode: "Amount" | "Rate" | "Surplus";
|
|
416
416
|
sharing: string | number;
|
|
@@ -425,7 +425,7 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
425
425
|
Signer: "signer";
|
|
426
426
|
};
|
|
427
427
|
}, {
|
|
428
|
-
mode: "Amount" | "Rate" | "Surplus";
|
|
428
|
+
mode: number | "Amount" | "Rate" | "Surplus";
|
|
429
429
|
sharing: string | number;
|
|
430
430
|
who: {
|
|
431
431
|
GuardIdentifier: number;
|
|
@@ -461,7 +461,7 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
461
461
|
}, {
|
|
462
462
|
guard: string;
|
|
463
463
|
sharing: {
|
|
464
|
-
mode: "Amount" | "Rate" | "Surplus";
|
|
464
|
+
mode: number | "Amount" | "Rate" | "Surplus";
|
|
465
465
|
sharing: string | number;
|
|
466
466
|
who: {
|
|
467
467
|
GuardIdentifier: number;
|
|
@@ -504,7 +504,7 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
504
504
|
allocators: {
|
|
505
505
|
guard: string;
|
|
506
506
|
sharing: {
|
|
507
|
-
mode: "Amount" | "Rate" | "Surplus";
|
|
507
|
+
mode: number | "Amount" | "Rate" | "Surplus";
|
|
508
508
|
sharing: string | number;
|
|
509
509
|
who: {
|
|
510
510
|
GuardIdentifier: number;
|
|
@@ -611,7 +611,7 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
611
611
|
allocators: {
|
|
612
612
|
guard: string;
|
|
613
613
|
sharing: {
|
|
614
|
-
mode: "Amount" | "Rate" | "Surplus";
|
|
614
|
+
mode: number | "Amount" | "Rate" | "Surplus";
|
|
615
615
|
sharing: string | number;
|
|
616
616
|
who: {
|
|
617
617
|
GuardIdentifier: number;
|
|
@@ -759,7 +759,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
759
759
|
Signer: "signer";
|
|
760
760
|
}>]>;
|
|
761
761
|
sharing: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
762
|
-
mode: z.ZodEnum<["Amount", "Rate", "Surplus"]>;
|
|
762
|
+
mode: z.ZodUnion<[z.ZodEnum<["Amount", "Rate", "Surplus"]>, z.ZodEffects<z.ZodNumber, "Amount" | "Rate" | "Surplus", number>]>;
|
|
763
763
|
}, "strip", z.ZodTypeAny, {
|
|
764
764
|
mode: "Amount" | "Rate" | "Surplus";
|
|
765
765
|
sharing: string | number;
|
|
@@ -774,7 +774,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
774
774
|
Signer: "signer";
|
|
775
775
|
};
|
|
776
776
|
}, {
|
|
777
|
-
mode: "Amount" | "Rate" | "Surplus";
|
|
777
|
+
mode: number | "Amount" | "Rate" | "Surplus";
|
|
778
778
|
sharing: string | number;
|
|
779
779
|
who: {
|
|
780
780
|
GuardIdentifier: number;
|
|
@@ -810,7 +810,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
810
810
|
}, {
|
|
811
811
|
guard: string;
|
|
812
812
|
sharing: {
|
|
813
|
-
mode: "Amount" | "Rate" | "Surplus";
|
|
813
|
+
mode: number | "Amount" | "Rate" | "Surplus";
|
|
814
814
|
sharing: string | number;
|
|
815
815
|
who: {
|
|
816
816
|
GuardIdentifier: number;
|
|
@@ -853,7 +853,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
853
853
|
allocators: {
|
|
854
854
|
guard: string;
|
|
855
855
|
sharing: {
|
|
856
|
-
mode: "Amount" | "Rate" | "Surplus";
|
|
856
|
+
mode: number | "Amount" | "Rate" | "Surplus";
|
|
857
857
|
sharing: string | number;
|
|
858
858
|
who: {
|
|
859
859
|
GuardIdentifier: number;
|
|
@@ -960,7 +960,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
960
960
|
allocators: {
|
|
961
961
|
guard: string;
|
|
962
962
|
sharing: {
|
|
963
|
-
mode: "Amount" | "Rate" | "Surplus";
|
|
963
|
+
mode: number | "Amount" | "Rate" | "Surplus";
|
|
964
964
|
sharing: string | number;
|
|
965
965
|
who: {
|
|
966
966
|
GuardIdentifier: number;
|
|
@@ -1377,7 +1377,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
1377
1377
|
allocators: {
|
|
1378
1378
|
guard: string;
|
|
1379
1379
|
sharing: {
|
|
1380
|
-
mode: "Amount" | "Rate" | "Surplus";
|
|
1380
|
+
mode: number | "Amount" | "Rate" | "Surplus";
|
|
1381
1381
|
sharing: string | number;
|
|
1382
1382
|
who: {
|
|
1383
1383
|
GuardIdentifier: number;
|
|
@@ -1597,7 +1597,7 @@ export declare const SemanticSummarySchema: z.ZodObject<{
|
|
|
1597
1597
|
export declare const CallResponseErrorSchema: z.ZodObject<{
|
|
1598
1598
|
type: z.ZodLiteral<"error">;
|
|
1599
1599
|
error: z.ZodString;
|
|
1600
|
-
error_code: z.ZodOptional<z.ZodEnum<["invalid_parameter", "guard_rejected", "state_conflict", "insufficient_balance", "object_not_found", "permission_denied", "immutable_violation", "network_error", "rate_limit", "gas_exceeded", "bcs_error", "signature_error", "config_error", "unknown"]>>;
|
|
1600
|
+
error_code: z.ZodOptional<z.ZodEnum<["invalid_parameter", "guard_rejected", "state_conflict", "insufficient_balance", "object_not_found", "permission_denied", "immutable_violation", "network_error", "rate_limit", "gas_exceeded", "bcs_error", "signature_error", "config_error", "wip_verification_failed", "unknown"]>>;
|
|
1601
1601
|
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
1602
1602
|
recovery_hint: z.ZodOptional<z.ZodString>;
|
|
1603
1603
|
related_object: z.ZodOptional<z.ZodString>;
|
|
@@ -1605,14 +1605,14 @@ export declare const CallResponseErrorSchema: z.ZodObject<{
|
|
|
1605
1605
|
type: "error";
|
|
1606
1606
|
error: string;
|
|
1607
1607
|
related_object?: string | undefined;
|
|
1608
|
-
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | undefined;
|
|
1608
|
+
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | "wip_verification_failed" | undefined;
|
|
1609
1609
|
retryable?: boolean | undefined;
|
|
1610
1610
|
recovery_hint?: string | undefined;
|
|
1611
1611
|
}, {
|
|
1612
1612
|
type: "error";
|
|
1613
1613
|
error: string;
|
|
1614
1614
|
related_object?: string | undefined;
|
|
1615
|
-
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | undefined;
|
|
1615
|
+
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | "wip_verification_failed" | undefined;
|
|
1616
1616
|
retryable?: boolean | undefined;
|
|
1617
1617
|
recovery_hint?: string | undefined;
|
|
1618
1618
|
}>;
|
|
@@ -4416,7 +4416,7 @@ export declare const CallResultSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
4416
4416
|
}>, z.ZodObject<{
|
|
4417
4417
|
type: z.ZodLiteral<"error">;
|
|
4418
4418
|
error: z.ZodString;
|
|
4419
|
-
error_code: z.ZodOptional<z.ZodEnum<["invalid_parameter", "guard_rejected", "state_conflict", "insufficient_balance", "object_not_found", "permission_denied", "immutable_violation", "network_error", "rate_limit", "gas_exceeded", "bcs_error", "signature_error", "config_error", "unknown"]>>;
|
|
4419
|
+
error_code: z.ZodOptional<z.ZodEnum<["invalid_parameter", "guard_rejected", "state_conflict", "insufficient_balance", "object_not_found", "permission_denied", "immutable_violation", "network_error", "rate_limit", "gas_exceeded", "bcs_error", "signature_error", "config_error", "wip_verification_failed", "unknown"]>>;
|
|
4420
4420
|
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
4421
4421
|
recovery_hint: z.ZodOptional<z.ZodString>;
|
|
4422
4422
|
related_object: z.ZodOptional<z.ZodString>;
|
|
@@ -4424,14 +4424,14 @@ export declare const CallResultSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
4424
4424
|
type: "error";
|
|
4425
4425
|
error: string;
|
|
4426
4426
|
related_object?: string | undefined;
|
|
4427
|
-
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | undefined;
|
|
4427
|
+
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | "wip_verification_failed" | undefined;
|
|
4428
4428
|
retryable?: boolean | undefined;
|
|
4429
4429
|
recovery_hint?: string | undefined;
|
|
4430
4430
|
}, {
|
|
4431
4431
|
type: "error";
|
|
4432
4432
|
error: string;
|
|
4433
4433
|
related_object?: string | undefined;
|
|
4434
|
-
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | undefined;
|
|
4434
|
+
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | "wip_verification_failed" | undefined;
|
|
4435
4435
|
retryable?: boolean | undefined;
|
|
4436
4436
|
recovery_hint?: string | undefined;
|
|
4437
4437
|
}>, z.ZodObject<{
|
|
@@ -4902,7 +4902,7 @@ export declare const CallResultSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
4902
4902
|
};
|
|
4903
4903
|
rule_id?: string | undefined;
|
|
4904
4904
|
}>]>;
|
|
4905
|
-
export declare const ObjectsSchema: z.ZodUnion<[z.ZodObject<{
|
|
4905
|
+
export declare const ObjectsSchema: z.ZodEffects<z.ZodUnion<[z.ZodObject<{
|
|
4906
4906
|
op: z.ZodUnion<[z.ZodLiteral<"add">, z.ZodLiteral<"set">]>;
|
|
4907
4907
|
objects: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
|
|
4908
4908
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -4926,7 +4926,15 @@ export declare const ObjectsSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
4926
4926
|
op: "clear";
|
|
4927
4927
|
}, {
|
|
4928
4928
|
op: "clear";
|
|
4929
|
-
}>]
|
|
4929
|
+
}>]>, {
|
|
4930
|
+
op: "set" | "add";
|
|
4931
|
+
objects: string[];
|
|
4932
|
+
} | {
|
|
4933
|
+
op: "remove";
|
|
4934
|
+
objects: string[];
|
|
4935
|
+
} | {
|
|
4936
|
+
op: "clear";
|
|
4937
|
+
}, unknown>;
|
|
4930
4938
|
export declare const VerifyMismatchSchema: z.ZodObject<{
|
|
4931
4939
|
dimension: z.ZodEnum<["created", "modified", "released", "state", "event"]>;
|
|
4932
4940
|
expected: z.ZodString;
|
|
@@ -7391,7 +7399,7 @@ export declare const CallOutputSchema: z.ZodObject<{
|
|
|
7391
7399
|
}>, z.ZodObject<{
|
|
7392
7400
|
type: z.ZodLiteral<"error">;
|
|
7393
7401
|
error: z.ZodString;
|
|
7394
|
-
error_code: z.ZodOptional<z.ZodEnum<["invalid_parameter", "guard_rejected", "state_conflict", "insufficient_balance", "object_not_found", "permission_denied", "immutable_violation", "network_error", "rate_limit", "gas_exceeded", "bcs_error", "signature_error", "config_error", "unknown"]>>;
|
|
7402
|
+
error_code: z.ZodOptional<z.ZodEnum<["invalid_parameter", "guard_rejected", "state_conflict", "insufficient_balance", "object_not_found", "permission_denied", "immutable_violation", "network_error", "rate_limit", "gas_exceeded", "bcs_error", "signature_error", "config_error", "wip_verification_failed", "unknown"]>>;
|
|
7395
7403
|
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
7396
7404
|
recovery_hint: z.ZodOptional<z.ZodString>;
|
|
7397
7405
|
related_object: z.ZodOptional<z.ZodString>;
|
|
@@ -7399,14 +7407,14 @@ export declare const CallOutputSchema: z.ZodObject<{
|
|
|
7399
7407
|
type: "error";
|
|
7400
7408
|
error: string;
|
|
7401
7409
|
related_object?: string | undefined;
|
|
7402
|
-
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | undefined;
|
|
7410
|
+
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | "wip_verification_failed" | undefined;
|
|
7403
7411
|
retryable?: boolean | undefined;
|
|
7404
7412
|
recovery_hint?: string | undefined;
|
|
7405
7413
|
}, {
|
|
7406
7414
|
type: "error";
|
|
7407
7415
|
error: string;
|
|
7408
7416
|
related_object?: string | undefined;
|
|
7409
|
-
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | undefined;
|
|
7417
|
+
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | "wip_verification_failed" | undefined;
|
|
7410
7418
|
retryable?: boolean | undefined;
|
|
7411
7419
|
recovery_hint?: string | undefined;
|
|
7412
7420
|
}>, z.ZodObject<{
|
|
@@ -8694,7 +8702,7 @@ export declare const CallOutputSchema: z.ZodObject<{
|
|
|
8694
8702
|
type: "error";
|
|
8695
8703
|
error: string;
|
|
8696
8704
|
related_object?: string | undefined;
|
|
8697
|
-
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | undefined;
|
|
8705
|
+
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | "wip_verification_failed" | undefined;
|
|
8698
8706
|
retryable?: boolean | undefined;
|
|
8699
8707
|
recovery_hint?: string | undefined;
|
|
8700
8708
|
} | {
|
|
@@ -9270,7 +9278,7 @@ export declare const CallOutputSchema: z.ZodObject<{
|
|
|
9270
9278
|
type: "error";
|
|
9271
9279
|
error: string;
|
|
9272
9280
|
related_object?: string | undefined;
|
|
9273
|
-
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | undefined;
|
|
9281
|
+
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | "wip_verification_failed" | undefined;
|
|
9274
9282
|
retryable?: boolean | undefined;
|
|
9275
9283
|
recovery_hint?: string | undefined;
|
|
9276
9284
|
} | {
|
package/dist/schema/call/base.js
CHANGED
|
@@ -15,9 +15,30 @@ export function strictParse(schema, input, fieldName = "input") {
|
|
|
15
15
|
const inputFields = Object.keys(input || {});
|
|
16
16
|
const unknownFields = inputFields.filter(f => !allowedFields.includes(f));
|
|
17
17
|
if (unknownFields.length > 0) {
|
|
18
|
-
throw new Error(`Unknown ${fieldName} field(s): ${unknownFields.join(', ')}`
|
|
18
|
+
throw new Error(`Unknown ${fieldName} field(s): ${unknownFields.join(', ')}. ` +
|
|
19
|
+
`Allowed fields: ${allowedFields.join(', ')}. ` +
|
|
20
|
+
`Remove the unknown field(s) or check the schema for the correct field name.`);
|
|
19
21
|
}
|
|
20
|
-
|
|
22
|
+
const result = schema.safeParse(input);
|
|
23
|
+
if (!result.success) {
|
|
24
|
+
const errorLines = result.error.issues.map(issue => {
|
|
25
|
+
const path = issue.path.length > 0
|
|
26
|
+
? issue.path.map(p => typeof p === "number" ? `[${p}]` : p).join(".").replace(".[", "[")
|
|
27
|
+
: "(root)";
|
|
28
|
+
let extras = "";
|
|
29
|
+
const issueAny = issue;
|
|
30
|
+
if (issue.code === "invalid_type") {
|
|
31
|
+
const expected = issueAny.expected;
|
|
32
|
+
const received = issueAny.received;
|
|
33
|
+
if (typeof expected === "string" && typeof received === "string") {
|
|
34
|
+
extras = ` (expected: ${expected}; received: ${received})`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return ` - ${fieldName}.${path} [${issue.code}]: ${issue.message}${extras}`;
|
|
38
|
+
});
|
|
39
|
+
throw new Error(`${fieldName} validation failed with ${result.error.issues.length} error(s):\n${errorLines.join("\n")}`);
|
|
40
|
+
}
|
|
41
|
+
return result.data;
|
|
21
42
|
}
|
|
22
43
|
export const NamedObjectSchema = z.object({
|
|
23
44
|
name: NameSchema.optional().describe("The name of the object"),
|
|
@@ -227,7 +248,7 @@ export const SemanticSummarySchema = z.object({
|
|
|
227
248
|
export const CallResponseErrorSchema = z.object({
|
|
228
249
|
type: z.literal("error").describe("Discriminator for this result variant. Constraint: always 'error'. Example: 'error'"),
|
|
229
250
|
error: z.string().describe("Human-readable error message from the chain or SDK. Relation: enriched via enrichMoveError before classification. Example: 'Insufficient balance for gas'"),
|
|
230
|
-
error_code: z.enum(["invalid_parameter", "guard_rejected", "state_conflict", "insufficient_balance", "object_not_found", "permission_denied", "immutable_violation", "network_error", "rate_limit", "gas_exceeded", "bcs_error", "signature_error", "config_error", "unknown"]).optional().describe("Error classification for programmatic recovery. Constraint: enum of
|
|
251
|
+
error_code: z.enum(["invalid_parameter", "guard_rejected", "state_conflict", "insufficient_balance", "object_not_found", "permission_denied", "immutable_violation", "network_error", "rate_limit", "gas_exceeded", "bcs_error", "signature_error", "config_error", "wip_verification_failed", "unknown"]).optional().describe("Error classification for programmatic recovery. Constraint: enum of 15 values (must match ErrorCode in semantic.ts). Relation: drives Recover Loop strategy selection. Example: 'insufficient_balance'"),
|
|
231
252
|
retryable: z.boolean().optional().describe("Whether the same call can be retried as-is. Constraint: true for network_error, rate_limit, gas_exceeded, and insufficient_balance. Example: true"),
|
|
232
253
|
recovery_hint: z.string().optional().describe("Recovery suggestion for AI or user. Relation: paired with error_code to guide Recover Loop. Example: 'Claim faucet tokens then retry'"),
|
|
233
254
|
related_object: z.string().optional().describe("Object ID related to the error, if any. Example: '0x123...'"),
|
|
@@ -263,7 +284,7 @@ export const SubmissionCallSchema = z.object({
|
|
|
263
284
|
object: NameOrAddressSchema.describe("Guard object name or ID to verify against. Example: 'my-delivery-guard' or '0x123...'"),
|
|
264
285
|
impack: z.boolean().describe("Whether this Guard's verification result participates in the final logic. Constraint: if false, the Guard is checked but does not block the operation. Example: true"),
|
|
265
286
|
}).strict()).max(MAX_GUARD_COUNT_PASSPORT).describe(`Array of Guard objects to verify. Constraint: at most ${MAX_GUARD_COUNT_PASSPORT} entries (MAX_GUARD_COUNT_PASSPORT). Relation: each entry corresponds to a Guard bound to the operation.`),
|
|
266
|
-
submission: z.array(GuardSubmissionToFillSchema).describe("User-submitted data for each Guard. Relation: one entry per Guard in the guard array; fill submission fields and resubmit via call_with_submission."),
|
|
287
|
+
submission: z.array(GuardSubmissionToFillSchema).describe("User-submitted data for each Guard. Relation: one entry per Guard in the guard array; fill submission fields and resubmit via call_with_submission. PLACEMENT: this `submission` field is at the SAME level as `data` and `env` in the operation input — NOT inside `data.data`. Example structure: {tool:'onchain_operations', data:{operation_type:'order', data:{object:'my_order', progress:{...}}}, submission:{type:'submission', guard:[...], submission:[...]}}"),
|
|
267
288
|
}).strict().describe("Guard verification required. The operation was blocked because one or more Guards require user-submitted data. Fill the submission array and resubmit. Semantic status is 'pending_input'.");
|
|
268
289
|
export const TypedPermissionObjectSchema = z.union([
|
|
269
290
|
NameOrAddressSchema.describe("String format: Reference an EXISTING object by its name (local mark) or on-chain object ID. Use this when the object already exists and you want to reference it."),
|
|
@@ -292,7 +313,7 @@ export const CallResultSchema = z.discriminatedUnion("type", [
|
|
|
292
313
|
}),
|
|
293
314
|
CallPendingConfirmationSchema,
|
|
294
315
|
]).describe("Discriminated union of 6 result types: 'transaction' (raw Wow response), 'submission' (Guard verification needed), 'error' (failed with error_code), 'data' (query result array), 'null' (no-op completed), 'pending_confirmation' (ConfirmGate blocked — re-call with env.confirmed=true). AI should check result.type first to determine how to process the response.");
|
|
295
|
-
export const ObjectsSchema = z.union([
|
|
316
|
+
export const ObjectsSchema = z.preprocess((val) => (Array.isArray(val) ? { op: 'add', objects: val } : val), z.union([
|
|
296
317
|
z.object({
|
|
297
318
|
op: z.union([z.literal('add'), z.literal('set')]),
|
|
298
319
|
objects: z.array(NameOrAddressSchema).describe('List of object IDs or names to add or set'),
|
|
@@ -304,7 +325,7 @@ export const ObjectsSchema = z.union([
|
|
|
304
325
|
z.object({
|
|
305
326
|
op: z.literal('clear'),
|
|
306
327
|
}).strict(),
|
|
307
|
-
]);
|
|
328
|
+
]));
|
|
308
329
|
export const VerifyMismatchSchema = z.object({
|
|
309
330
|
dimension: z.enum(["created", "modified", "released", "state", "event"]).describe("Verify dimension that mismatched. Example: 'created'"),
|
|
310
331
|
expected: z.string().describe("What the Expect Loop declared. Example: 'Service object created'"),
|
|
@@ -2707,19 +2707,19 @@ export declare const BridgeCallOutputSchema: z.ZodObject<{
|
|
|
2707
2707
|
}>, z.ZodObject<{
|
|
2708
2708
|
type: z.ZodLiteral<"error">;
|
|
2709
2709
|
error: z.ZodString;
|
|
2710
|
-
error_code: z.ZodOptional<z.ZodEnum<["invalid_parameter", "guard_rejected", "state_conflict", "insufficient_balance", "object_not_found", "permission_denied", "immutable_violation", "network_error", "unknown"]>>;
|
|
2710
|
+
error_code: z.ZodOptional<z.ZodEnum<["invalid_parameter", "guard_rejected", "state_conflict", "insufficient_balance", "object_not_found", "permission_denied", "immutable_violation", "network_error", "rate_limit", "gas_exceeded", "bcs_error", "signature_error", "config_error", "wip_verification_failed", "unknown"]>>;
|
|
2711
2711
|
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
2712
2712
|
recovery_hint: z.ZodOptional<z.ZodString>;
|
|
2713
2713
|
}, "strip", z.ZodTypeAny, {
|
|
2714
2714
|
type: "error";
|
|
2715
2715
|
error: string;
|
|
2716
|
-
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | undefined;
|
|
2716
|
+
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | "wip_verification_failed" | undefined;
|
|
2717
2717
|
retryable?: boolean | undefined;
|
|
2718
2718
|
recovery_hint?: string | undefined;
|
|
2719
2719
|
}, {
|
|
2720
2720
|
type: "error";
|
|
2721
2721
|
error: string;
|
|
2722
|
-
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | undefined;
|
|
2722
|
+
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | "wip_verification_failed" | undefined;
|
|
2723
2723
|
retryable?: boolean | undefined;
|
|
2724
2724
|
recovery_hint?: string | undefined;
|
|
2725
2725
|
}>]>;
|
|
@@ -3393,7 +3393,7 @@ export declare const BridgeCallOutputSchema: z.ZodObject<{
|
|
|
3393
3393
|
} | {
|
|
3394
3394
|
type: "error";
|
|
3395
3395
|
error: string;
|
|
3396
|
-
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | undefined;
|
|
3396
|
+
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | "wip_verification_failed" | undefined;
|
|
3397
3397
|
retryable?: boolean | undefined;
|
|
3398
3398
|
recovery_hint?: string | undefined;
|
|
3399
3399
|
};
|
|
@@ -3528,7 +3528,7 @@ export declare const BridgeCallOutputSchema: z.ZodObject<{
|
|
|
3528
3528
|
} | {
|
|
3529
3529
|
type: "error";
|
|
3530
3530
|
error: string;
|
|
3531
|
-
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | undefined;
|
|
3531
|
+
error_code?: "unknown" | "invalid_parameter" | "guard_rejected" | "state_conflict" | "insufficient_balance" | "object_not_found" | "permission_denied" | "immutable_violation" | "network_error" | "rate_limit" | "gas_exceeded" | "bcs_error" | "signature_error" | "config_error" | "wip_verification_failed" | undefined;
|
|
3532
3532
|
retryable?: boolean | undefined;
|
|
3533
3533
|
recovery_hint?: string | undefined;
|
|
3534
3534
|
};
|
|
@@ -444,7 +444,9 @@ export const BridgeCallOutputSchema = z.object({
|
|
|
444
444
|
.enum([
|
|
445
445
|
"invalid_parameter", "guard_rejected", "state_conflict",
|
|
446
446
|
"insufficient_balance", "object_not_found", "permission_denied",
|
|
447
|
-
"immutable_violation", "network_error", "
|
|
447
|
+
"immutable_violation", "network_error", "rate_limit",
|
|
448
|
+
"gas_exceeded", "bcs_error", "signature_error",
|
|
449
|
+
"config_error", "wip_verification_failed", "unknown",
|
|
448
450
|
])
|
|
449
451
|
.optional()
|
|
450
452
|
.describe("Error classification for programmatic recovery"),
|