@wowok/agent-mcp 2.3.18 → 2.4.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/industry-risks.js +31 -31
- package/dist/customer/order-monitor.js +57 -57
- package/dist/customer/order-strategy.js +89 -89
- package/dist/customer/post-purchase.js +97 -97
- package/dist/customer/reminder-system.js +26 -26
- package/dist/customer/risk-assessment.js +46 -46
- package/dist/customer/types.d.ts +4 -4
- package/dist/customer/types.js +4 -4
- package/dist/customer/user-preferences.js +50 -50
- package/dist/experience/intent-distill.js +6 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -1624
- package/dist/knowledge/acquisition-flywheel.js +64 -64
- package/dist/knowledge/arbitration-trust.js +10 -10
- package/dist/knowledge/demand-matching.js +8 -8
- package/dist/knowledge/dynamic-pricing.js +18 -18
- package/dist/knowledge/flywheel-loop.js +11 -11
- package/dist/knowledge/glossary.js +22 -22
- package/dist/knowledge/guard-ledger.d.ts +1 -1
- package/dist/knowledge/guard-ledger.js +145 -104
- package/dist/knowledge/guard-lint.d.ts +77 -0
- package/dist/knowledge/guard-lint.js +670 -0
- package/dist/knowledge/guard-migration.d.ts +48 -0
- package/dist/knowledge/guard-migration.js +228 -0
- package/dist/knowledge/guard-puzzle.d.ts +109 -14
- package/dist/knowledge/guard-puzzle.js +627 -101
- package/dist/knowledge/guard-risk.d.ts +10 -1
- package/dist/knowledge/guard-risk.js +1634 -292
- package/dist/knowledge/guard-templates.d.ts +38 -0
- package/dist/knowledge/guard-templates.js +605 -0
- package/dist/knowledge/guard-translation.d.ts +14 -2
- package/dist/knowledge/guard-translation.js +825 -194
- package/dist/knowledge/index.d.ts +8 -4
- package/dist/knowledge/index.js +9 -5
- package/dist/knowledge/industry-evolution.js +29 -29
- package/dist/knowledge/industry-generalizer.js +52 -52
- package/dist/knowledge/industry-registry.js +20 -33
- package/dist/knowledge/intent-metrics.js +67 -67
- package/dist/knowledge/process-model.js +80 -80
- package/dist/knowledge/reputation-rules.js +9 -9
- package/dist/knowledge/reward-templates.js +51 -51
- package/dist/knowledge/safety-rules.js +3 -3
- package/dist/knowledge/tool-constraints.js +20 -4
- package/dist/knowledge/trust-metrics.js +26 -26
- package/dist/project/graph.d.ts +1 -0
- package/dist/project/graph.js +27 -1
- package/dist/project/index.d.ts +1 -0
- package/dist/project/index.js +39 -2
- package/dist/project/namespace.d.ts +11 -1
- package/dist/project/namespace.js +27 -2
- package/dist/project/query.d.ts +2 -0
- package/dist/project/query.js +56 -15
- package/dist/rules.d.ts +12 -0
- package/dist/rules.js +9 -0
- package/dist/schema/call/allocation.d.ts +10 -10
- package/dist/schema/call/base.js +19 -19
- package/dist/schema/call/bridge.d.ts +32 -32
- package/dist/schema/call/demand.d.ts +84 -84
- package/dist/schema/call/guard.d.ts +153 -0
- package/dist/schema/call/guard.js +50 -0
- package/dist/schema/call/machine.d.ts +38 -38
- package/dist/schema/call/permission.d.ts +78 -78
- package/dist/schema/call/repository.d.ts +22 -22
- package/dist/schema/call/semantic.js +229 -25
- package/dist/schema/call/service.d.ts +7 -7
- package/dist/schema/local/wip.d.ts +39 -19
- package/dist/schema/local/wip.js +5 -5
- package/dist/schema/messenger/index.d.ts +26 -26
- package/dist/schema/messenger/index.js +2 -2
- package/dist/schema/operations.d.ts +270 -192
- package/dist/schema/query/index.d.ts +184 -184
- package/dist/schema/query/index.js +15 -9
- package/dist/schema/trust/index.d.ts +4 -4
- package/dist/schema/utils/guard-parser.js +4 -4
- package/dist/schema/utils/guard-query-utils.d.ts +7 -0
- package/dist/schema/utils/guard-query-utils.js +14 -1
- package/dist/schema/utils/node-parser.js +14 -14
- package/dist/schemas/bridge_operation.output.json +15 -15
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/messenger_operation.output.json +18 -16
- package/dist/schemas/onchain_events.output.json +15 -15
- package/dist/schemas/onchain_operations.output.json +16 -16
- package/dist/schemas/onchain_operations.schema.json +11 -20
- package/dist/schemas/onchain_operations_allocation.schema.json +7 -10
- package/dist/schemas/onchain_operations_machine.schema.json +2 -5
- package/dist/schemas/onchain_operations_service.schema.json +2 -5
- package/dist/schemas/onchain_table_data.output.json +20 -26
- package/dist/schemas/wip_file.output.json +24 -1
- package/dist/tools/handlers/bridge.d.ts +1 -0
- package/dist/tools/handlers/bridge.js +1 -0
- package/dist/tools/handlers/config.d.ts +2 -0
- package/dist/tools/handlers/config.js +71 -0
- package/dist/tools/handlers/file-export.d.ts +3 -0
- package/dist/tools/handlers/file-export.js +90 -0
- package/dist/tools/handlers/local.d.ts +30 -0
- package/dist/tools/handlers/local.js +27 -0
- package/dist/tools/handlers/messenger.d.ts +16 -0
- package/dist/tools/handlers/messenger.js +187 -0
- package/dist/tools/handlers/onchain.d.ts +2 -0
- package/dist/tools/handlers/onchain.js +246 -0
- package/dist/tools/handlers/project.d.ts +2 -0
- package/dist/tools/handlers/project.js +53 -0
- package/dist/tools/handlers/query.d.ts +5 -0
- package/dist/tools/handlers/query.js +256 -0
- package/dist/tools/handlers/schema-query.d.ts +2 -0
- package/dist/tools/handlers/schema-query.js +92 -0
- package/dist/tools/handlers/trust.d.ts +2 -0
- package/dist/tools/handlers/trust.js +194 -0
- package/dist/tools/handlers/wip.d.ts +2 -0
- package/dist/tools/handlers/wip.js +44 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.js +479 -0
- package/dist/tools/rules-hook.d.ts +2 -0
- package/dist/tools/rules-hook.js +22 -0
- package/dist/tools/shared.d.ts +29 -0
- package/dist/tools/shared.js +130 -0
- package/dist/tools/types.d.ts +35 -0
- package/dist/tools/types.js +1 -0
- package/dist/tools/wrap.d.ts +6 -0
- package/dist/tools/wrap.js +55 -0
- package/package.json +19 -5
package/dist/project/query.js
CHANGED
|
@@ -1,35 +1,76 @@
|
|
|
1
1
|
import { LocalMark } from "@wowok/wowok";
|
|
2
|
-
import {
|
|
2
|
+
import { extractAllProjectVersions, TAG_PREFIX } from "./namespace.js";
|
|
3
3
|
export async function listProjects() {
|
|
4
4
|
const marks = await LocalMark.Instance().list(undefined);
|
|
5
5
|
const byProject = new Map();
|
|
6
6
|
for (const m of marks) {
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
7
|
+
const entries = extractAllProjectVersions(m.tags);
|
|
8
|
+
if (entries.length === 0)
|
|
9
9
|
continue;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const byPrefix = new Map();
|
|
11
|
+
for (const entry of entries) {
|
|
12
|
+
if (!byPrefix.has(entry.prefix))
|
|
13
|
+
byPrefix.set(entry.prefix, []);
|
|
14
|
+
byPrefix.get(entry.prefix).push(entry.version);
|
|
12
15
|
}
|
|
13
|
-
const proj = byProject.get(prefix);
|
|
14
|
-
proj.objectCount++;
|
|
15
16
|
const typeTag = m.tags?.find((t) => t.startsWith(TAG_PREFIX.type));
|
|
16
17
|
const type = typeTag?.slice(TAG_PREFIX.type.length);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
for (const [prefix, versions] of byPrefix) {
|
|
19
|
+
const hasVersioned = versions.some((v) => v !== undefined);
|
|
20
|
+
const effectiveVersions = hasVersioned
|
|
21
|
+
? versions.filter((v) => v !== undefined)
|
|
22
|
+
: versions;
|
|
23
|
+
if (!byProject.has(prefix)) {
|
|
24
|
+
byProject.set(prefix, {
|
|
25
|
+
prefix,
|
|
26
|
+
objectCount: 0,
|
|
27
|
+
types: [],
|
|
28
|
+
versions: [],
|
|
29
|
+
objects: [],
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const proj = byProject.get(prefix);
|
|
33
|
+
if (type && !proj.types.includes(type))
|
|
34
|
+
proj.types.push(type);
|
|
35
|
+
for (const v of effectiveVersions) {
|
|
36
|
+
proj.objectCount++;
|
|
37
|
+
if (v && !proj.versions.includes(v)) {
|
|
38
|
+
proj.versions.push(v);
|
|
39
|
+
}
|
|
40
|
+
proj.objects.push({
|
|
41
|
+
name: m.name,
|
|
42
|
+
address: m.address,
|
|
43
|
+
type,
|
|
44
|
+
version: v,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
20
48
|
}
|
|
21
49
|
return Array.from(byProject.values()).sort((a, b) => b.objectCount - a.objectCount);
|
|
22
50
|
}
|
|
23
51
|
export async function listProjectObjects(prefix) {
|
|
24
|
-
const marks = await LocalMark.Instance().list(
|
|
25
|
-
|
|
52
|
+
const marks = await LocalMark.Instance().list(undefined);
|
|
53
|
+
const results = [];
|
|
54
|
+
const isVersionedFilter = prefix.includes("_v");
|
|
55
|
+
for (const m of marks) {
|
|
56
|
+
const entries = extractAllProjectVersions(m.tags);
|
|
57
|
+
const matched = entries.find((e) => {
|
|
58
|
+
if (isVersionedFilter) {
|
|
59
|
+
return e.version ? `${e.prefix}_${e.version}` === prefix : false;
|
|
60
|
+
}
|
|
61
|
+
return e.prefix === prefix;
|
|
62
|
+
});
|
|
63
|
+
if (!matched)
|
|
64
|
+
continue;
|
|
26
65
|
const typeTag = m.tags?.find((t) => t.startsWith(TAG_PREFIX.type));
|
|
27
|
-
|
|
66
|
+
results.push({
|
|
28
67
|
name: m.name,
|
|
29
68
|
address: m.address,
|
|
30
69
|
type: typeTag?.slice(TAG_PREFIX.type.length),
|
|
31
|
-
|
|
32
|
-
|
|
70
|
+
version: matched.version,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return results;
|
|
33
74
|
}
|
|
34
75
|
export async function listShareableObjects() {
|
|
35
76
|
const marks = await LocalMark.Instance().list({ tags: [`${TAG_PREFIX.shareable}true`] });
|
package/dist/rules.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { validateOperation, hasBlockingViolations, getWarningViolations, type ConstraintViolation, } from "./knowledge/tool-constraints.js";
|
|
2
|
+
export { computeServiceTrustScore, type ServiceTrustMetrics, } from "./knowledge/trust-metrics.js";
|
|
3
|
+
export { AUDIT_RULES, auditService, hasBlockingErrors, getErrors, getWarnings, summarizeFindings, type AuditFinding, } from "./knowledge/audit-rules.js";
|
|
4
|
+
export { confirmGate, isConfirmGateEnabled, isExplicitlyConfirmed, getFailMode, type ConfirmResult, type FailMode, } from "./safety/confirm-gate.js";
|
|
5
|
+
export { renderPreview } from "./safety/preview.js";
|
|
6
|
+
export { CONFIRMATION_RULES, SAFETY_RULES_VERSION, DEFAULT_AMOUNT_THRESHOLD, getAmountThreshold, formatAmount, collectDefaultWarnings, type OperationPreview, type ConfirmLevel, type ConfirmationRule, } from "./knowledge/safety-rules.js";
|
|
7
|
+
export { distillIntent, extractSignals } from "./experience/intent-distill.js";
|
|
8
|
+
export type { DistilledIntent } from "./experience/types.js";
|
|
9
|
+
export { Harness, getHarness, setHarness } from "./harness/index.js";
|
|
10
|
+
export type { ODG, ExpectedResult, VerifyReport, RecoveryAction, Checkpoint, } from "./harness/types.js";
|
|
11
|
+
export { getDefaultPreferences, inferPreferences, matchServiceToPreferences, mergePreferences, validatePreferences, SUPPORTED_INDUSTRIES, type IndustryTemplate, type Industry, type PreferenceInference, type ServiceForMatching, type PreferenceMatchResult, } from "./customer/user-preferences.js";
|
|
12
|
+
export type { UserPreferences } from "./customer/types.js";
|
package/dist/rules.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { validateOperation, hasBlockingViolations, getWarningViolations, } from "./knowledge/tool-constraints.js";
|
|
2
|
+
export { computeServiceTrustScore, } from "./knowledge/trust-metrics.js";
|
|
3
|
+
export { AUDIT_RULES, auditService, hasBlockingErrors, getErrors, getWarnings, summarizeFindings, } from "./knowledge/audit-rules.js";
|
|
4
|
+
export { confirmGate, isConfirmGateEnabled, isExplicitlyConfirmed, getFailMode, } from "./safety/confirm-gate.js";
|
|
5
|
+
export { renderPreview } from "./safety/preview.js";
|
|
6
|
+
export { CONFIRMATION_RULES, SAFETY_RULES_VERSION, DEFAULT_AMOUNT_THRESHOLD, getAmountThreshold, formatAmount, collectDefaultWarnings, } from "./knowledge/safety-rules.js";
|
|
7
|
+
export { distillIntent, extractSignals } from "./experience/intent-distill.js";
|
|
8
|
+
export { Harness, getHarness, setHarness } from "./harness/index.js";
|
|
9
|
+
export { getDefaultPreferences, inferPreferences, matchServiceToPreferences, mergePreferences, validatePreferences, SUPPORTED_INDUSTRIES, } from "./customer/user-preferences.js";
|
|
@@ -22,7 +22,7 @@ export declare const CallAllocation_CreateSchema: z.ZodObject<{
|
|
|
22
22
|
}>;
|
|
23
23
|
allocators: z.ZodObject<{
|
|
24
24
|
description: z.ZodEffects<z.ZodString, string, string>;
|
|
25
|
-
threshold: z.ZodUnion<[z.ZodNumber, z.ZodString]
|
|
25
|
+
threshold: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
26
26
|
allocators: z.ZodArray<z.ZodObject<{
|
|
27
27
|
guard: z.ZodEffects<z.ZodString, string, string>;
|
|
28
28
|
sharing: z.ZodArray<z.ZodObject<{
|
|
@@ -152,7 +152,6 @@ export declare const CallAllocation_CreateSchema: z.ZodObject<{
|
|
|
152
152
|
}[];
|
|
153
153
|
}, {
|
|
154
154
|
description: string;
|
|
155
|
-
threshold: string | number;
|
|
156
155
|
allocators: {
|
|
157
156
|
guard: string;
|
|
158
157
|
sharing: {
|
|
@@ -172,6 +171,7 @@ export declare const CallAllocation_CreateSchema: z.ZodObject<{
|
|
|
172
171
|
max?: string | number | null | undefined;
|
|
173
172
|
fix?: string | number | undefined;
|
|
174
173
|
}[];
|
|
174
|
+
threshold?: string | number | undefined;
|
|
175
175
|
}>;
|
|
176
176
|
coin: z.ZodUnion<[z.ZodObject<{
|
|
177
177
|
balance: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
@@ -259,7 +259,6 @@ export declare const CallAllocation_CreateSchema: z.ZodObject<{
|
|
|
259
259
|
};
|
|
260
260
|
allocators: {
|
|
261
261
|
description: string;
|
|
262
|
-
threshold: string | number;
|
|
263
262
|
allocators: {
|
|
264
263
|
guard: string;
|
|
265
264
|
sharing: {
|
|
@@ -279,6 +278,7 @@ export declare const CallAllocation_CreateSchema: z.ZodObject<{
|
|
|
279
278
|
max?: string | number | null | undefined;
|
|
280
279
|
fix?: string | number | undefined;
|
|
281
280
|
}[];
|
|
281
|
+
threshold?: string | number | undefined;
|
|
282
282
|
};
|
|
283
283
|
payment_info: {
|
|
284
284
|
index: string | number;
|
|
@@ -371,7 +371,7 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
371
371
|
}>;
|
|
372
372
|
allocators: z.ZodObject<{
|
|
373
373
|
description: z.ZodEffects<z.ZodString, string, string>;
|
|
374
|
-
threshold: z.ZodUnion<[z.ZodNumber, z.ZodString]
|
|
374
|
+
threshold: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
375
375
|
allocators: z.ZodArray<z.ZodObject<{
|
|
376
376
|
guard: z.ZodEffects<z.ZodString, string, string>;
|
|
377
377
|
sharing: z.ZodArray<z.ZodObject<{
|
|
@@ -501,7 +501,6 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
501
501
|
}[];
|
|
502
502
|
}, {
|
|
503
503
|
description: string;
|
|
504
|
-
threshold: string | number;
|
|
505
504
|
allocators: {
|
|
506
505
|
guard: string;
|
|
507
506
|
sharing: {
|
|
@@ -521,6 +520,7 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
521
520
|
max?: string | number | null | undefined;
|
|
522
521
|
fix?: string | number | undefined;
|
|
523
522
|
}[];
|
|
523
|
+
threshold?: string | number | undefined;
|
|
524
524
|
}>;
|
|
525
525
|
coin: z.ZodUnion<[z.ZodObject<{
|
|
526
526
|
balance: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
@@ -608,7 +608,6 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
608
608
|
};
|
|
609
609
|
allocators: {
|
|
610
610
|
description: string;
|
|
611
|
-
threshold: string | number;
|
|
612
611
|
allocators: {
|
|
613
612
|
guard: string;
|
|
614
613
|
sharing: {
|
|
@@ -628,6 +627,7 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
628
627
|
max?: string | number | null | undefined;
|
|
629
628
|
fix?: string | number | undefined;
|
|
630
629
|
}[];
|
|
630
|
+
threshold?: string | number | undefined;
|
|
631
631
|
};
|
|
632
632
|
payment_info: {
|
|
633
633
|
index: string | number;
|
|
@@ -720,7 +720,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
720
720
|
}>;
|
|
721
721
|
allocators: z.ZodObject<{
|
|
722
722
|
description: z.ZodEffects<z.ZodString, string, string>;
|
|
723
|
-
threshold: z.ZodUnion<[z.ZodNumber, z.ZodString]
|
|
723
|
+
threshold: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
724
724
|
allocators: z.ZodArray<z.ZodObject<{
|
|
725
725
|
guard: z.ZodEffects<z.ZodString, string, string>;
|
|
726
726
|
sharing: z.ZodArray<z.ZodObject<{
|
|
@@ -850,7 +850,6 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
850
850
|
}[];
|
|
851
851
|
}, {
|
|
852
852
|
description: string;
|
|
853
|
-
threshold: string | number;
|
|
854
853
|
allocators: {
|
|
855
854
|
guard: string;
|
|
856
855
|
sharing: {
|
|
@@ -870,6 +869,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
870
869
|
max?: string | number | null | undefined;
|
|
871
870
|
fix?: string | number | undefined;
|
|
872
871
|
}[];
|
|
872
|
+
threshold?: string | number | undefined;
|
|
873
873
|
}>;
|
|
874
874
|
coin: z.ZodUnion<[z.ZodObject<{
|
|
875
875
|
balance: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
@@ -957,7 +957,6 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
957
957
|
};
|
|
958
958
|
allocators: {
|
|
959
959
|
description: string;
|
|
960
|
-
threshold: string | number;
|
|
961
960
|
allocators: {
|
|
962
961
|
guard: string;
|
|
963
962
|
sharing: {
|
|
@@ -977,6 +976,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
977
976
|
max?: string | number | null | undefined;
|
|
978
977
|
fix?: string | number | undefined;
|
|
979
978
|
}[];
|
|
979
|
+
threshold?: string | number | undefined;
|
|
980
980
|
};
|
|
981
981
|
payment_info: {
|
|
982
982
|
index: string | number;
|
|
@@ -1370,7 +1370,6 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
1370
1370
|
};
|
|
1371
1371
|
allocators: {
|
|
1372
1372
|
description: string;
|
|
1373
|
-
threshold: string | number;
|
|
1374
1373
|
allocators: {
|
|
1375
1374
|
guard: string;
|
|
1376
1375
|
sharing: {
|
|
@@ -1390,6 +1389,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
1390
1389
|
max?: string | number | null | undefined;
|
|
1391
1390
|
fix?: string | number | undefined;
|
|
1392
1391
|
}[];
|
|
1392
|
+
threshold?: string | number | undefined;
|
|
1393
1393
|
};
|
|
1394
1394
|
payment_info: {
|
|
1395
1395
|
index: string | number;
|
package/dist/schema/call/base.js
CHANGED
|
@@ -122,7 +122,7 @@ export const ExperienceSchema = z.object({
|
|
|
122
122
|
avoid: z.array(z.string()).optional().describe("Pitfalls to avoid based on history. Example: ['Guard rejection on delivery_proof']"),
|
|
123
123
|
relevance: z.number().min(0).max(1).optional().describe("Relevance score 0-1 of the matched experience. Example: 0.85"),
|
|
124
124
|
matched_scenario: z.string().optional().describe("Matched historical scenario. Example: 'publish_service_freelance'"),
|
|
125
|
-
}).strict().describe("Experience layer feedback from past operations (Phase 2
|
|
125
|
+
}).strict().describe("Experience layer feedback from past operations (Phase 2 Topic 2). Provides advice and pitfalls based on historical patterns.");
|
|
126
126
|
export const ServiceStatusSchema = z.object({
|
|
127
127
|
active: z.array(z.string()).describe("Phase 2 services currently active (enabled). Example: ['confirm_gate','project_service','experience_layer']"),
|
|
128
128
|
inactive: z.array(z.string()).optional().describe("Phase 2 services currently inactive (can be toggled via config_operation). Example: ['harness','graph_persist']"),
|
|
@@ -131,29 +131,29 @@ export const CustomerReminderSchema = z.object({
|
|
|
131
131
|
id: z.string().describe("Reminder rule id. Example: 'high_risk_score'"),
|
|
132
132
|
stage: z.enum(["browse", "evaluate", "preorder", "in_progress", "complete", "after_sale"]).describe("Order lifecycle stage when this reminder fires. Example: 'evaluate'"),
|
|
133
133
|
priority: z.enum(["required", "recommended", "info", "reminder"]).describe("Priority. 'required' = blocks purchase; 'recommended' = strong caution. Example: 'required'"),
|
|
134
|
-
message: z.string().describe("Human-readable reminder message. Example: '
|
|
134
|
+
message: z.string().describe("Human-readable reminder message. Example: 'Composite risk score 25/100, strongly discourage purchase'"),
|
|
135
135
|
action: z.string().optional().describe("Suggested next action. Example: 'require merchant to bind Arbitration before ordering'"),
|
|
136
136
|
}).strict().describe("A buyer-side reminder triggered at a specific order lifecycle stage (Phase 3 C-3).");
|
|
137
137
|
export const PreferenceMatchSchema = z.object({
|
|
138
138
|
score: z.number().min(0).max(100).describe("Match score 0-100 (higher = better fit). Example: 75"),
|
|
139
|
-
matches: z.array(z.string()).describe("Aspects that match user preferences. Example: ['
|
|
140
|
-
mismatches: z.array(z.string()).describe("Aspects that mismatch user preferences. Example: ['
|
|
139
|
+
matches: z.array(z.string()).describe("Aspects that match user preferences. Example: ['Price 10% below average','Has arbitration']"),
|
|
140
|
+
mismatches: z.array(z.string()).describe("Aspects that mismatch user preferences. Example: ['Delivery cycle exceeds expectation']"),
|
|
141
141
|
}).strict().describe("Service-to-preference match result (Phase 3 C-2). 7-dimension scoring: price/time/region/brand/bargain/emotion/risk.");
|
|
142
142
|
export const CustomerAdviceSchema = z.object({
|
|
143
143
|
risk_score: z.number().min(0).max(100).optional().describe("Composite risk score 0-100 (higher = safer). Relation: from risk-assessment.ts 4-dimension scoring. Example: 75"),
|
|
144
144
|
risk_level: z.enum(["low", "medium_low", "medium_high", "high"]).optional().describe("Risk level bucket. 'high' = strongly discourage purchase. Example: 'medium_high'"),
|
|
145
|
-
recommendations: z.array(z.string()).describe("Actionable recommendations for the buyer. Example: ['
|
|
146
|
-
reminders: z.array(CustomerReminderSchema).describe("Stage-specific reminders (deduped, sorted by priority, capped to 3 high-risk). Example: [{priority:'required', message:'
|
|
145
|
+
recommendations: z.array(z.string()).describe("Actionable recommendations for the buyer. Example: ['Require merchant to configure arbitration','Negotiate refund terms via Messenger']"),
|
|
146
|
+
reminders: z.array(CustomerReminderSchema).describe("Stage-specific reminders (deduped, sorted by priority, capped to 3 high-risk). Example: [{priority:'required', message:'Ambiguous Guard must be human-reviewed'}]"),
|
|
147
147
|
preference_match: PreferenceMatchSchema.optional().describe("Service-to-preference match (populated when user preferences exist). Example: {score:75, matches:[...], mismatches:[...]}"),
|
|
148
148
|
}).strict().describe("Buyer-side advice (Phase 3 C-3.3). Populated in semantic.customer_advice for order/query operations when customer_intelligence service is enabled.");
|
|
149
149
|
export const EvolutionContextSchema = z.object({
|
|
150
|
-
industry_signal: z.string().optional().describe("Industry evolution signal summary. Example: '
|
|
151
|
-
evolution_advice: z.string().optional().describe("Evolution advice for the current operation. Example: '
|
|
150
|
+
industry_signal: z.string().optional().describe("Industry evolution signal summary. Example: 'Industry health 82/100 (healthy); 25 cumulative industry signals'"),
|
|
151
|
+
evolution_advice: z.string().optional().describe("Evolution advice for the current operation. Example: 'Recommend mandatory arbitration + compensation fund + delivery Guard'"),
|
|
152
152
|
confidence: z.number().min(0).max(1).describe("Confidence of the evolution context 0-1. <0.5 means no data yet. Example: 0.75"),
|
|
153
153
|
health_score: z.number().min(0).max(100).optional().describe("Industry health score 0-100 if available. Example: 82"),
|
|
154
154
|
pending_suggestions: z.number().int().min(0).optional().describe("Count of pending industry update suggestions (filtered by role if role is set). Example: 3"),
|
|
155
155
|
intent: z.enum(["default", "growth", "retention", "compliance", "efficiency", "trust_building", "custom"]).optional().describe("Phase 4 P4-6.C: Current business intent driving the scoring model. Absent = 'default'. Example: 'growth'"),
|
|
156
|
-
role_advice: z.array(z.string()).optional().describe("Phase 4 P4-6.C: Role-targeted advice strings (user/merchant/arbitrator). Example: ['
|
|
156
|
+
role_advice: z.array(z.string()).optional().describe("Phase 4 P4-6.C: Role-targeted advice strings (user/merchant/arbitrator). Example: ['Strengthen loyalty flywheel','Optimize first-order conversion']"),
|
|
157
157
|
role: z.enum(["user", "merchant", "arbitrator"]).optional().describe("Phase 4 P4-6.C: Role used for advice routing. Example: 'merchant'"),
|
|
158
158
|
}).strict().describe("Phase 4 industry evolution context (populated when industry_evolution service is enabled). Provides AI with industry-level health signals, evolution advice, and role-targeted recommendations.");
|
|
159
159
|
export const GuardPuzzleStatusSchema = z.object({
|
|
@@ -166,7 +166,7 @@ export const GuardPuzzleStatusSchema = z.object({
|
|
|
166
166
|
}).strict().describe("Guard information puzzle completeness status. 6 dimensions (A-F). false = missing, needs user input.");
|
|
167
167
|
export const GuardAvailableQuerySchema = z.object({
|
|
168
168
|
id: z.number().int().describe("Query instruction ID. Example: 1253"),
|
|
169
|
-
name: z.string().describe("Query instruction name. Example: 'progress.
|
|
169
|
+
name: z.string().describe("Query instruction name. Example: 'progress.current'"),
|
|
170
170
|
objectType: z.string().describe("Target object type. Example: 'Progress'"),
|
|
171
171
|
returnType: z.string().describe("Return value type. Example: 'String'"),
|
|
172
172
|
description: z.string().optional().describe("Query description"),
|
|
@@ -179,17 +179,17 @@ export const GuardAdviceSchema = z.object({
|
|
|
179
179
|
matched_scene: z.string().optional()
|
|
180
180
|
.describe("Matched Guard scene id from the 8 binding scenarios ledger. Example: 'machine_forward_guard'"),
|
|
181
181
|
scene_description: z.string().optional()
|
|
182
|
-
.describe("Human-readable scene description. Example: '
|
|
182
|
+
.describe("Human-readable scene description. Example: 'Workflow node forward validation (Forward.guard)'"),
|
|
183
183
|
scene_constraints: z.array(z.string()).optional()
|
|
184
|
-
.describe("Special constraints for the matched scene. Example: ['
|
|
184
|
+
.describe("Special constraints for the matched scene. Example: ['Forward.guard cannot be modified after Machine is published']"),
|
|
185
185
|
suggested_patterns: z.array(z.string()).optional()
|
|
186
|
-
.describe("Suggested Guard patterns based on user intent. Example: ['
|
|
186
|
+
.describe("Suggested Guard patterns based on user intent. Example: ['time lock','progress status check']"),
|
|
187
187
|
available_queries: z.array(GuardAvailableQuerySchema).optional()
|
|
188
188
|
.describe("Available query instructions for the current context (subset of 375 GUARDQUERY entries)"),
|
|
189
189
|
risk_warnings: z.array(z.string()).optional()
|
|
190
|
-
.describe("Risk warnings for the current Guard design. Example: ['Guard
|
|
190
|
+
.describe("Risk warnings for the current Guard design. Example: ['Guard cannot be modified after creation','Time lock test uses 1000ms']"),
|
|
191
191
|
pending_questions: z.array(z.string()).optional()
|
|
192
|
-
.describe("Questions for the user to complete the puzzle. Example: ['
|
|
192
|
+
.describe("Questions for the user to complete the puzzle. Example: ['Which Host Object will the Guard bind to?']"),
|
|
193
193
|
confirmation_text: z.string().optional()
|
|
194
194
|
.describe("Structured semantic confirmation text for user review (generated when puzzle is complete). User must explicitly confirm before CREATE."),
|
|
195
195
|
test_result: z.object({
|
|
@@ -217,7 +217,7 @@ export const SemanticSummarySchema = z.object({
|
|
|
217
217
|
events: z.array(EventSemanticSchema).optional().describe("On-chain events annotated with business semantics (S-8)"),
|
|
218
218
|
next_actions: z.array(NextActionSchema).optional().describe("Recommended next actions to drive the workflow forward"),
|
|
219
219
|
warnings: z.array(z.string()).optional().describe("Business-level warnings. Example: 'order_allocators not configured; order funds cannot be distributed'"),
|
|
220
|
-
experience: ExperienceSchema.optional().describe("Experience layer feedback from past operations (Phase 2
|
|
220
|
+
experience: ExperienceSchema.optional().describe("Experience layer feedback from past operations (Phase 2 Topic 2)"),
|
|
221
221
|
service_status: ServiceStatusSchema.optional().describe("Phase 2 runtime service status (populated when semantic_rich is enabled). Lets AI see active services in each response."),
|
|
222
222
|
customer_advice: CustomerAdviceSchema.optional().describe("Buyer-side advice (Phase 3 C-3.3). Populated when customer_intelligence service is enabled AND operation is order/query on a Service. Contains risk_score, recommendations, reminders, and preference_match."),
|
|
223
223
|
evolution_context: EvolutionContextSchema.optional().describe("Phase 4 industry evolution context (populated when industry_evolution service is enabled). Provides AI with industry health signals and evolution advice."),
|
|
@@ -246,7 +246,7 @@ export const OperationPreviewSchema = z.object({
|
|
|
246
246
|
immutable_after: z.array(z.string()).optional().describe("Fields that become immutable after this op (for publish). Example: ['machine','order_allocators']"),
|
|
247
247
|
warnings: z.array(z.string()).optional().describe("Default-value warnings. Example: ['Using default account (env.account=\"\")']"),
|
|
248
248
|
irreversible: z.boolean().optional().describe("True when the operation cannot be reverted. Example: true"),
|
|
249
|
-
}).strict().describe("Preview of an operation awaiting user confirmation (Phase 2
|
|
249
|
+
}).strict().describe("Preview of an operation awaiting user confirmation (Phase 2 Topic 4 ConfirmGate).");
|
|
250
250
|
export const CallPendingConfirmationSchema = z.object({
|
|
251
251
|
type: z.literal("pending_confirmation").describe("Discriminator. The operation was NOT executed; it is blocked pending user confirmation. Re-call with env.confirmed=true to proceed, or modify/cancel."),
|
|
252
252
|
preview: OperationPreviewSchema.describe("Preview of the operation awaiting confirmation."),
|
|
@@ -290,7 +290,7 @@ export const CallResultSchema = z.discriminatedUnion("type", [
|
|
|
290
290
|
type: z.literal("null").describe("Discriminator for this result variant. Constraint: always 'null'. Example: 'null'"),
|
|
291
291
|
}),
|
|
292
292
|
CallPendingConfirmationSchema,
|
|
293
|
-
]).describe("Discriminated union of 6 result types: 'transaction' (raw
|
|
293
|
+
]).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.");
|
|
294
294
|
export const ObjectsSchema = z.union([
|
|
295
295
|
z.object({
|
|
296
296
|
op: z.union([z.literal('add'), z.literal('set')]),
|
|
@@ -345,4 +345,4 @@ export const CallOutputSchema = z.object({
|
|
|
345
345
|
semantic: SemanticSummarySchema.optional().describe("Business semantic summary. AI should read semantic first; fall back to parsing result only when semantic is absent. Relation: populated by MCP server from operation context; undefined when intent cannot be confidently inferred or for non-transaction tools. Example: {intent:'publish_service', status:'success', summary:'...'}"),
|
|
346
346
|
harness_report: HarnessReportSchema.optional().describe("L4 Harness report (Verify + Recover). Present only when the Harness is injected and an Expected Result was declared for this operation. Relation: produced by handler.ts calling harness.verify() and harness.recover(). Example: {verify:{status:'fail', mismatches:[...]}, recovery:{strategy:'recreate'}}"),
|
|
347
347
|
schema_warning: SchemaWarningSchema.optional().describe("Schema compatibility warning. Present only when client_schema_version is provided in env and a mismatch is detected."),
|
|
348
|
-
}).strict().describe("Unified MCP tool output. result.type discriminates 5 outcomes: 'transaction' (raw
|
|
348
|
+
}).strict().describe("Unified MCP tool output. result.type discriminates 5 outcomes: 'transaction' (raw Wow response), 'submission' (needs Guard data), 'error' (failed with error_code), 'data' (query result), 'null' (no-op). When semantic is present, prefer it over raw result parsing. When harness_report is present, check verify.status first and follow recovery.strategy if status is 'fail'.");
|