@wowok/agent-mcp 2.6.3 → 2.6.6
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 +13 -9
- package/dist/customer/customer-advice.d.ts +31 -0
- package/dist/customer/customer-advice.js +129 -0
- package/dist/customer/index.d.ts +2 -0
- package/dist/customer/index.js +2 -0
- package/dist/customer/info-puzzle.d.ts +8 -1
- package/dist/customer/info-puzzle.js +30 -5
- package/dist/customer/order-monitor.d.ts +2 -0
- package/dist/customer/order-monitor.js +3 -2
- package/dist/customer/post-purchase.d.ts +2 -0
- package/dist/customer/post-purchase.js +6 -5
- package/dist/customer/preorder-compare.d.ts +24 -0
- package/dist/customer/preorder-compare.js +34 -0
- package/dist/customer/reminder-system.d.ts +2 -0
- package/dist/customer/reminder-system.js +2 -1
- package/dist/customer/risk-assessment.js +4 -3
- package/dist/customer/types.d.ts +5 -0
- package/dist/examples/arbitration-dispute-create.json +41 -0
- package/dist/examples/arbitration-vote-weighted.json +35 -0
- package/dist/examples/arbitration-voting-guard-add.json +38 -0
- package/dist/examples/demand-present-service.json +33 -0
- package/dist/examples/gen-passport-verify-guard.json +48 -0
- package/dist/examples/guard-template-balance-check.json +36 -15
- package/dist/examples/guard-template-time-lock.json +33 -12
- package/dist/examples/insurance-guard-claim-timelock.json +75 -0
- package/dist/examples/insurance-guard-withdraw-allocation.json +96 -0
- package/dist/examples/insurance-machine-create-publish.json +75 -0
- package/dist/examples/insurance-service-allocators-publish.json +56 -0
- package/dist/examples/machine-multisig-threshold.json +86 -0
- package/dist/examples/machine-template-7node-rental.json +99 -94
- package/dist/examples/payment-scenario-bound.json +45 -0
- package/dist/examples/rental-ziroom-machine-create.json +126 -114
- package/dist/examples/rental-ziroom-permission-create.json +10 -3
- package/dist/examples/rental-ziroom-service-create.json +27 -18
- package/dist/examples/retail-adv-guard-customer-win-create.json +80 -0
- package/dist/examples/retail-adv-guard-messenger-proof-create.json +65 -0
- package/dist/examples/retail-adv-guard-reward-timeout-create.json +92 -0
- package/dist/examples/retail-adv-reward-guard-add.json +51 -0
- package/dist/examples/retail-myshop-allocation-activate.json +55 -0
- package/dist/examples/retail-myshop-arbitration-create.json +40 -0
- package/dist/examples/retail-myshop-contact-create.json +43 -0
- package/dist/examples/retail-myshop-order-create.json +56 -0
- package/dist/examples/retail-myshop-progress-operate.json +38 -0
- package/dist/examples/retail-myshop-reward-create.json +35 -0
- package/dist/examples/service-discount-issue.json +46 -0
- package/dist/examples/threebody-guard-create.json +56 -0
- package/dist/examples/threebody-machine-create.json +72 -0
- package/dist/examples/threebody-permission-create.json +38 -0
- package/dist/examples/threebody-service-allocators.json +49 -0
- package/dist/examples/travel-guard-time-lock.json +69 -0
- package/dist/examples/travel-guard-weather-oracle.json +70 -0
- package/dist/examples/travel-machine-create.json +136 -0
- package/dist/examples/travel-repository-create.json +47 -0
- package/dist/examples/travel-service-create.json +102 -0
- package/dist/examples/travel-treasury-create.json +34 -0
- package/dist/examples/treasury-deposit.json +37 -0
- package/dist/examples/treasury-withdraw.json +38 -0
- package/dist/extensions/business-modules.d.ts +49 -0
- package/dist/extensions/business-modules.js +287 -0
- package/dist/extensions/capability-manifest.js +192 -5
- package/dist/extensions/constraint-registry.js +3 -1
- package/dist/extensions/modes.js +10 -4
- package/dist/extensions/registry.d.ts +14 -9
- package/dist/extensions/registry.js +69 -14
- package/dist/extensions/types.d.ts +1 -0
- package/dist/knowledge/fund-layer.d.ts +67 -1
- package/dist/knowledge/fund-layer.js +561 -12
- package/dist/knowledge/guard-templates.d.ts +10 -0
- package/dist/knowledge/guard-templates.js +50 -0
- package/dist/knowledge/index.d.ts +2 -2
- package/dist/knowledge/index.js +2 -2
- package/dist/knowledge/machine-risk.js +4 -1
- package/dist/knowledge/progress-context.js +1 -1
- package/dist/knowledge/progress-ledger.js +3 -3
- package/dist/knowledge/progress-templates.js +1 -1
- package/dist/knowledge/progress-translation.js +1 -1
- package/dist/knowledge/safety-rules.d.ts +83 -1
- package/dist/knowledge/safety-rules.js +166 -2
- package/dist/knowledge/scenario-modes.d.ts +1 -1
- package/dist/knowledge/scenario-modes.js +13 -11
- package/dist/knowledge/template-registry.d.ts +48 -0
- package/dist/knowledge/template-registry.js +341 -0
- package/dist/knowledge/tool-constraints.js +6 -6
- package/dist/knowledge/tools-reference.js +11 -8
- package/dist/participation/merchant-interest.d.ts +32 -0
- package/dist/participation/merchant-interest.js +100 -0
- package/dist/participation/radar-core.d.ts +104 -0
- package/dist/participation/radar-core.js +269 -0
- package/dist/project/context-assembly.js +8 -0
- package/dist/project/edit-planner.js +27 -56
- package/dist/project/evaluation.d.ts +36 -0
- package/dist/project/evaluation.js +422 -56
- package/dist/project/game-theory.d.ts +43 -0
- package/dist/project/game-theory.js +177 -0
- package/dist/project/graph-builder.js +1 -0
- package/dist/project/handlers.d.ts +38 -0
- package/dist/project/handlers.js +65 -35
- package/dist/project/intent-analyzer.d.ts +71 -0
- package/dist/project/intent-analyzer.js +149 -0
- package/dist/project/machine-nodes.d.ts +2 -0
- package/dist/project/machine-nodes.js +36 -0
- package/dist/project/merchant-guide.d.ts +165 -0
- package/dist/project/merchant-guide.js +264 -0
- package/dist/project/mode-actions.d.ts +199 -0
- package/dist/project/mode-actions.js +309 -0
- package/dist/project/participation-radar.d.ts +18 -0
- package/dist/project/participation-radar.js +428 -0
- package/dist/project/pipeline-actions.d.ts +101 -0
- package/dist/project/pipeline-actions.js +109 -0
- package/dist/project/semantic-graph.d.ts +95 -0
- package/dist/project/semantic-graph.js +245 -0
- package/dist/schema/call/allocation.d.ts +11 -11
- package/dist/schema/call/allocation.js +11 -1
- package/dist/schema/call/arbitration.d.ts +21 -21
- package/dist/schema/call/arbitration.js +17 -9
- package/dist/schema/call/base.d.ts +2 -2
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +127 -127
- package/dist/schema/call/bridge.js +12 -12
- package/dist/schema/call/contact.d.ts +3 -3
- package/dist/schema/call/demand.d.ts +3 -3
- package/dist/schema/call/guard.d.ts +11 -11
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/machine.d.ts +216 -21
- package/dist/schema/call/machine.js +1 -1
- package/dist/schema/call/order.d.ts +7 -7
- package/dist/schema/call/payment.d.ts +3 -3
- package/dist/schema/call/permission.d.ts +3 -3
- package/dist/schema/call/personal.d.ts +337 -3
- package/dist/schema/call/personal.js +10 -0
- package/dist/schema/call/progress.d.ts +177 -9
- package/dist/schema/call/progress.js +7 -3
- package/dist/schema/call/proof.d.ts +6 -6
- package/dist/schema/call/repository.d.ts +3 -3
- package/dist/schema/call/reward.d.ts +57 -57
- package/dist/schema/call/semantic.js +41 -1
- package/dist/schema/call/service.d.ts +114 -114
- package/dist/schema/call/service.js +11 -2
- package/dist/schema/call/treasury.d.ts +57 -57
- package/dist/schema/messenger/index.js +4 -1
- package/dist/schema/operations.d.ts +713 -291
- package/dist/schema/operations.js +33 -0
- package/dist/schema/project/index.d.ts +4635 -100
- package/dist/schema/project/index.js +868 -1
- package/dist/schema/query/index.d.ts +363 -19
- package/dist/schema/query/index.js +25 -3
- package/dist/schema/schema-query/index.d.ts +13 -7
- package/dist/schema/schema-query/index.js +29 -5
- package/dist/schema/trust/index.d.ts +1012 -6
- package/dist/schema/trust/index.js +212 -11
- package/dist/schema/utils/skills-recommendation.js +1 -0
- package/dist/schema-query/index.d.ts +4 -1
- package/dist/schema-query/index.js +255 -1
- package/dist/schemas/bridge_operation.schema.json +14 -7
- package/dist/schemas/guard2file.schema.json +2 -0
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/machineNode2file.schema.json +2 -0
- package/dist/schemas/messenger_operation.schema.json +1 -1
- package/dist/schemas/onchain_operations.schema.json +143 -15
- package/dist/schemas/onchain_operations_allocation.schema.json +2 -1
- package/dist/schemas/onchain_operations_arbitration.schema.json +7 -5
- package/dist/schemas/onchain_operations_contact.schema.json +1 -0
- package/dist/schemas/onchain_operations_demand.schema.json +1 -0
- package/dist/schemas/onchain_operations_gen_passport.schema.json +2 -0
- package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -0
- package/dist/schemas/onchain_operations_guard.schema.json +578 -0
- package/dist/schemas/onchain_operations_machine.schema.json +1 -0
- package/dist/schemas/onchain_operations_order.schema.json +4 -3
- package/dist/schemas/onchain_operations_payment.schema.json +1 -0
- package/dist/schemas/onchain_operations_permission.schema.json +1 -0
- package/dist/schemas/onchain_operations_personal.schema.json +37 -0
- package/dist/schemas/onchain_operations_progress.schema.json +90 -3
- package/dist/schemas/onchain_operations_proof.schema.json +1 -0
- package/dist/schemas/onchain_operations_repository.schema.json +1 -0
- package/dist/schemas/onchain_operations_reward.schema.json +1 -0
- package/dist/schemas/onchain_operations_service.schema.json +4 -3
- package/dist/schemas/onchain_operations_treasury.schema.json +1 -0
- package/dist/schemas/project_operation.output.json +2243 -1
- package/dist/schemas/project_operation.schema.json +683 -1
- package/dist/schemas/query_toolkit.output.json +1 -1
- package/dist/schemas/query_toolkit.schema.json +37 -0
- package/dist/schemas/schema_query.output.json +1 -1
- package/dist/schemas/schema_query.schema.json +30 -5
- package/dist/schemas/trust_score.output.json +392 -1
- package/dist/schemas/trust_score.schema.json +275 -1
- package/dist/tools/handlers/onchain.js +73 -8
- package/dist/tools/handlers/project.js +46 -0
- package/dist/tools/handlers/query.js +117 -2
- package/dist/tools/handlers/schema-query.js +41 -0
- package/dist/tools/handlers/trust.js +192 -6
- package/dist/tools/index.js +52 -9
- package/dist/tools/wrap.js +194 -15
- package/package.json +2 -2
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { ProjectObjectType } from "./namespace.js";
|
|
2
|
+
import type { BusinessIntent } from "./intent-analyzer.js";
|
|
3
|
+
import type { BusinessModule, BusinessModuleId } from "../extensions/business-modules.js";
|
|
4
|
+
export type ConfigValueType = "string" | "number" | "boolean" | "address_ref" | "guard_logic" | "enum";
|
|
5
|
+
export interface ConfigValueBase {
|
|
6
|
+
type: ConfigValueType;
|
|
7
|
+
mapsTo: string;
|
|
8
|
+
}
|
|
9
|
+
export interface StringConfigValue extends ConfigValueBase {
|
|
10
|
+
type: "string";
|
|
11
|
+
value: string;
|
|
12
|
+
}
|
|
13
|
+
export interface NumberConfigValue extends ConfigValueBase {
|
|
14
|
+
type: "number";
|
|
15
|
+
value: number;
|
|
16
|
+
unit?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface BooleanConfigValue extends ConfigValueBase {
|
|
19
|
+
type: "boolean";
|
|
20
|
+
value: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface AddressRefConfigValue extends ConfigValueBase {
|
|
23
|
+
type: "address_ref";
|
|
24
|
+
targetId: string;
|
|
25
|
+
}
|
|
26
|
+
export interface GuardLogicConfigValue extends ConfigValueBase {
|
|
27
|
+
type: "guard_logic";
|
|
28
|
+
description: string;
|
|
29
|
+
}
|
|
30
|
+
export interface EnumConfigValue extends ConfigValueBase {
|
|
31
|
+
type: "enum";
|
|
32
|
+
value: string;
|
|
33
|
+
allowed: string[];
|
|
34
|
+
}
|
|
35
|
+
export type ConfigValue = StringConfigValue | NumberConfigValue | BooleanConfigValue | AddressRefConfigValue | GuardLogicConfigValue | EnumConfigValue;
|
|
36
|
+
export interface ExpectedState {
|
|
37
|
+
published: boolean;
|
|
38
|
+
paused: boolean;
|
|
39
|
+
additional?: Record<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
export interface SemanticNode {
|
|
42
|
+
id: string;
|
|
43
|
+
type: ProjectObjectType;
|
|
44
|
+
purpose: string;
|
|
45
|
+
derivedFrom: {
|
|
46
|
+
intentField: string;
|
|
47
|
+
rationale: string;
|
|
48
|
+
};
|
|
49
|
+
config: Record<string, ConfigValue>;
|
|
50
|
+
expectedState: ExpectedState;
|
|
51
|
+
}
|
|
52
|
+
export interface SemanticEdge {
|
|
53
|
+
from: string;
|
|
54
|
+
to: string;
|
|
55
|
+
relation: string;
|
|
56
|
+
required: boolean;
|
|
57
|
+
derivedFrom: {
|
|
58
|
+
intentField: string;
|
|
59
|
+
rationale: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export interface SemanticConstraint {
|
|
63
|
+
id: string;
|
|
64
|
+
level: "hard" | "soft" | "info";
|
|
65
|
+
description: string;
|
|
66
|
+
source: {
|
|
67
|
+
layer: "contract" | "harness" | "industry_mode" | "business_rule";
|
|
68
|
+
reference: string;
|
|
69
|
+
};
|
|
70
|
+
fixSuggestion: string;
|
|
71
|
+
}
|
|
72
|
+
export interface EvaluationPreview {
|
|
73
|
+
estimatedRiskScore: number;
|
|
74
|
+
estimatedTrustScore: number;
|
|
75
|
+
estimatedCompletenessScore: number;
|
|
76
|
+
keyRisks: string[];
|
|
77
|
+
strengths: string[];
|
|
78
|
+
moduleBoosts: Record<string, number>;
|
|
79
|
+
}
|
|
80
|
+
export interface SemanticObjectGraph {
|
|
81
|
+
nodes: SemanticNode[];
|
|
82
|
+
edges: SemanticEdge[];
|
|
83
|
+
constraints: SemanticConstraint[];
|
|
84
|
+
evaluationPreview?: EvaluationPreview;
|
|
85
|
+
adoptedModules: BusinessModuleId[];
|
|
86
|
+
businessIntent: BusinessIntent;
|
|
87
|
+
}
|
|
88
|
+
export interface GraphValidationResult {
|
|
89
|
+
valid: boolean;
|
|
90
|
+
hardViolations: SemanticConstraint[];
|
|
91
|
+
softViolations: SemanticConstraint[];
|
|
92
|
+
infoNotes: SemanticConstraint[];
|
|
93
|
+
}
|
|
94
|
+
export declare function buildSemanticGraph(intent: BusinessIntent, adoptedModules: BusinessModule[]): SemanticObjectGraph;
|
|
95
|
+
export declare function validateGraph(graph: SemanticObjectGraph): GraphValidationResult;
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
export function buildSemanticGraph(intent, adoptedModules) {
|
|
2
|
+
const nodes = [];
|
|
3
|
+
const edges = [];
|
|
4
|
+
const constraints = [];
|
|
5
|
+
nodes.push({
|
|
6
|
+
id: "main_permission",
|
|
7
|
+
type: "permission",
|
|
8
|
+
purpose: "Role-based access control for merchant, customer, and optional arbitrator",
|
|
9
|
+
derivedFrom: { intentField: "roles", rationale: "All WOW services require a Permission object for role management" },
|
|
10
|
+
config: {
|
|
11
|
+
name: { type: "string", value: `${intent.description.slice(0, 20)}_permission`, mapsTo: "object.name" },
|
|
12
|
+
},
|
|
13
|
+
expectedState: { published: true, paused: false },
|
|
14
|
+
});
|
|
15
|
+
if (intent.intent.startsWith("sell_") || intent.intent === "rent_asset") {
|
|
16
|
+
nodes.push({
|
|
17
|
+
id: "main_service",
|
|
18
|
+
type: "service",
|
|
19
|
+
purpose: `Main service offering: ${intent.description}`,
|
|
20
|
+
derivedFrom: { intentField: "description", rationale: "Service is the primary object representing the merchant offering" },
|
|
21
|
+
config: {
|
|
22
|
+
name: { type: "string", value: `${intent.description.slice(0, 20)}_service`, mapsTo: "object.name" },
|
|
23
|
+
type_parameter: { type: "string", value: intent.payment.currency, mapsTo: "object.type_parameter" },
|
|
24
|
+
permission: { type: "address_ref", targetId: "main_permission", mapsTo: "object.permission" },
|
|
25
|
+
},
|
|
26
|
+
expectedState: { published: true, paused: false },
|
|
27
|
+
});
|
|
28
|
+
edges.push({
|
|
29
|
+
from: "main_service",
|
|
30
|
+
to: "main_permission",
|
|
31
|
+
relation: "has_permission",
|
|
32
|
+
required: true,
|
|
33
|
+
derivedFrom: { intentField: "roles", rationale: "Service must reference its Permission object" },
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (intent.payment.model === "milestone" || intent.deliverables.length > 1) {
|
|
37
|
+
nodes.push({
|
|
38
|
+
id: "main_machine",
|
|
39
|
+
type: "machine",
|
|
40
|
+
purpose: "Workflow controlling deliverable milestones and acceptance",
|
|
41
|
+
derivedFrom: { intentField: "deliverables", rationale: "Multiple deliverables or milestone payment requires Machine workflow" },
|
|
42
|
+
config: {
|
|
43
|
+
name: { type: "string", value: `${intent.description.slice(0, 20)}_machine`, mapsTo: "object.name" },
|
|
44
|
+
permission: { type: "address_ref", targetId: "main_permission", mapsTo: "object.permission" },
|
|
45
|
+
},
|
|
46
|
+
expectedState: { published: true, paused: false },
|
|
47
|
+
});
|
|
48
|
+
if (nodes.find((n) => n.id === "main_service")) {
|
|
49
|
+
edges.push({
|
|
50
|
+
from: "main_service",
|
|
51
|
+
to: "main_machine",
|
|
52
|
+
relation: "uses_machine",
|
|
53
|
+
required: true,
|
|
54
|
+
derivedFrom: { intentField: "deliverables", rationale: "Service binds to Machine for workflow execution" },
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (intent.payment.model === "milestone" || intent.payment.model === "escrow" || intent.trust.escrow) {
|
|
59
|
+
nodes.push({
|
|
60
|
+
id: "main_allocation",
|
|
61
|
+
type: "allocation",
|
|
62
|
+
purpose: "Fund distribution among merchant and optional suppliers",
|
|
63
|
+
derivedFrom: { intentField: "payment.allocation", rationale: "Escrow/milestone requires Allocation for fund routing" },
|
|
64
|
+
config: {
|
|
65
|
+
name: { type: "string", value: `${intent.description.slice(0, 20)}_allocation`, mapsTo: "object.name" },
|
|
66
|
+
type_parameter: { type: "string", value: intent.payment.currency, mapsTo: "object.type_parameter" },
|
|
67
|
+
permission: { type: "address_ref", targetId: "main_permission", mapsTo: "object.permission" },
|
|
68
|
+
},
|
|
69
|
+
expectedState: { published: true, paused: false },
|
|
70
|
+
});
|
|
71
|
+
if (nodes.find((n) => n.id === "main_service")) {
|
|
72
|
+
edges.push({
|
|
73
|
+
from: "main_service",
|
|
74
|
+
to: "main_allocation",
|
|
75
|
+
relation: "has_order_allocators",
|
|
76
|
+
required: true,
|
|
77
|
+
derivedFrom: { intentField: "payment", rationale: "Service must bind Allocation for order fund routing" },
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (intent.trust.arbitration !== "none") {
|
|
82
|
+
nodes.push({
|
|
83
|
+
id: "main_arbitration",
|
|
84
|
+
type: "arb",
|
|
85
|
+
purpose: "Independent dispute resolution",
|
|
86
|
+
derivedFrom: { intentField: "trust.arbitration", rationale: "Arbitration object provides binding dispute resolution" },
|
|
87
|
+
config: {
|
|
88
|
+
name: { type: "string", value: `${intent.description.slice(0, 20)}_arbitration`, mapsTo: "object.name" },
|
|
89
|
+
type_parameter: { type: "string", value: intent.payment.currency, mapsTo: "object.type_parameter" },
|
|
90
|
+
},
|
|
91
|
+
expectedState: { published: true, paused: false },
|
|
92
|
+
});
|
|
93
|
+
nodes.push({
|
|
94
|
+
id: "arb_permission",
|
|
95
|
+
type: "permission",
|
|
96
|
+
purpose: "Independent permission for arbitration (MUST differ from Service.permission)",
|
|
97
|
+
derivedFrom: { intentField: "trust.arbitration", rationale: "Contract-enforced: arbitration.permission != service.permission (E_ARBITRATION_PERMISSION_CONFLICT=33)" },
|
|
98
|
+
config: {
|
|
99
|
+
name: { type: "string", value: `${intent.description.slice(0, 20)}_arb_permission`, mapsTo: "object.name" },
|
|
100
|
+
},
|
|
101
|
+
expectedState: { published: true, paused: false },
|
|
102
|
+
});
|
|
103
|
+
edges.push({
|
|
104
|
+
from: "main_arbitration",
|
|
105
|
+
to: "arb_permission",
|
|
106
|
+
relation: "has_permission",
|
|
107
|
+
required: true,
|
|
108
|
+
derivedFrom: { intentField: "trust.arbitration", rationale: "Arbitration requires its own Permission" },
|
|
109
|
+
});
|
|
110
|
+
if (nodes.find((n) => n.id === "main_service")) {
|
|
111
|
+
edges.push({
|
|
112
|
+
from: "main_service",
|
|
113
|
+
to: "main_arbitration",
|
|
114
|
+
relation: "has_arbitration",
|
|
115
|
+
required: false,
|
|
116
|
+
derivedFrom: { intentField: "trust.arbitration", rationale: "Service references Arbitration in arbitrations list" },
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const needsRepository = adoptedModules.some((m) => m.id === "wip_provenance" || m.id === "subscription_with_proof" || m.id === "damage_attestation");
|
|
121
|
+
if (needsRepository) {
|
|
122
|
+
nodes.push({
|
|
123
|
+
id: "main_repository",
|
|
124
|
+
type: "repository",
|
|
125
|
+
purpose: "Store WIP hashes and delivery evidence",
|
|
126
|
+
derivedFrom: { intentField: "deliverables", rationale: "WIP provenance requires Repository for hash commitments" },
|
|
127
|
+
config: {
|
|
128
|
+
name: { type: "string", value: `${intent.description.slice(0, 20)}_repository`, mapsTo: "object.name" },
|
|
129
|
+
permission: { type: "address_ref", targetId: "main_permission", mapsTo: "object.permission" },
|
|
130
|
+
},
|
|
131
|
+
expectedState: { published: true, paused: false },
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
for (const mod of adoptedModules) {
|
|
135
|
+
for (const ref of mod.templateRefs) {
|
|
136
|
+
if (ref.object_type === "guard") {
|
|
137
|
+
nodes.push({
|
|
138
|
+
id: `guard_${mod.id}`,
|
|
139
|
+
type: "guard",
|
|
140
|
+
purpose: ref.purpose,
|
|
141
|
+
derivedFrom: { intentField: "trust", rationale: `Guard for ${mod.name} module` },
|
|
142
|
+
config: {
|
|
143
|
+
name: { type: "string", value: `${intent.description.slice(0, 20)}_${mod.id}_guard`, mapsTo: "object.name" },
|
|
144
|
+
},
|
|
145
|
+
expectedState: { published: true, paused: false },
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
constraints.push({
|
|
151
|
+
id: "service_permission_bound",
|
|
152
|
+
level: "hard",
|
|
153
|
+
description: "Service must be bound to a Permission object",
|
|
154
|
+
source: { layer: "contract", reference: "service.move: permission field is required" },
|
|
155
|
+
fixSuggestion: "Create Permission object first, then reference it in Service.object.permission",
|
|
156
|
+
});
|
|
157
|
+
if (intent.trust.arbitration !== "none") {
|
|
158
|
+
constraints.push({
|
|
159
|
+
id: "arbitration_permission_independent",
|
|
160
|
+
level: "hard",
|
|
161
|
+
description: "Arbitration.permission MUST be different from Service.permission",
|
|
162
|
+
source: { layer: "contract", reference: "service.move:433-436 E_ARBITRATION_PERMISSION_CONFLICT=33" },
|
|
163
|
+
fixSuggestion: "Create a dedicated Permission object for Arbitration, do NOT reuse Service.permission",
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
if (intent.payment.model === "milestone") {
|
|
167
|
+
constraints.push({
|
|
168
|
+
id: "machine_bound_before_publish",
|
|
169
|
+
level: "hard",
|
|
170
|
+
description: "Machine must be published and bound to Service before Service.publish",
|
|
171
|
+
source: { layer: "contract", reference: "service.move: machine is IMMUTABLE after publish" },
|
|
172
|
+
fixSuggestion: "Create and publish Machine before calling Service.publish. Machine cannot be changed after Service is published.",
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
const moduleBoosts = calculateModuleScoreBoost(adoptedModules);
|
|
176
|
+
const estimatedRiskScore = Math.min(100, 40 + Object.values(moduleBoosts).reduce((a, b) => a + b, 0) / 2);
|
|
177
|
+
const estimatedTrustScore = Math.min(100, 50 + (moduleBoosts["trust"] ?? 0) + (moduleBoosts["fund_safety"] ?? 0));
|
|
178
|
+
const estimatedCompletenessScore = Math.min(100, 30 + adoptedModules.length * 8);
|
|
179
|
+
const evaluationPreview = {
|
|
180
|
+
estimatedRiskScore,
|
|
181
|
+
estimatedTrustScore,
|
|
182
|
+
estimatedCompletenessScore,
|
|
183
|
+
keyRisks: [
|
|
184
|
+
...(intent.trust.arbitration === "none" ? ["No arbitration configured — disputes have no resolution path"] : []),
|
|
185
|
+
...(intent.payment.model === "upfront" && intent.trust.refundPolicy === "no_refund" ? ["Full upfront + no refund = high user risk"] : []),
|
|
186
|
+
],
|
|
187
|
+
strengths: adoptedModules.map((m) => `${m.name}: ${m.description.slice(0, 60)}...`),
|
|
188
|
+
moduleBoosts,
|
|
189
|
+
};
|
|
190
|
+
return {
|
|
191
|
+
nodes,
|
|
192
|
+
edges,
|
|
193
|
+
constraints,
|
|
194
|
+
evaluationPreview,
|
|
195
|
+
adoptedModules: adoptedModules.map((m) => m.id),
|
|
196
|
+
businessIntent: intent,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function calculateModuleScoreBoost(modules) {
|
|
200
|
+
const boosts = {};
|
|
201
|
+
for (const m of modules) {
|
|
202
|
+
for (const impact of m.evaluationImpact) {
|
|
203
|
+
const increment = impact.effect === "required" ? 15 : impact.effect === "boost" ? 8 : 3;
|
|
204
|
+
boosts[impact.dimension] = (boosts[impact.dimension] ?? 0) + increment;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return boosts;
|
|
208
|
+
}
|
|
209
|
+
export function validateGraph(graph) {
|
|
210
|
+
const hardViolations = [];
|
|
211
|
+
const softViolations = [];
|
|
212
|
+
const infoNotes = [];
|
|
213
|
+
for (const constraint of graph.constraints) {
|
|
214
|
+
if (constraint.id === "service_permission_bound") {
|
|
215
|
+
const hasService = graph.nodes.some((n) => n.type === "service");
|
|
216
|
+
const hasPermissionEdge = graph.edges.some((e) => e.relation === "has_permission" && e.from.startsWith("main_service"));
|
|
217
|
+
if (hasService && !hasPermissionEdge) {
|
|
218
|
+
hardViolations.push(constraint);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (constraint.id === "arbitration_permission_independent") {
|
|
222
|
+
const serviceNode = graph.nodes.find((n) => n.id === "main_service");
|
|
223
|
+
const arbNode = graph.nodes.find((n) => n.id === "main_arbitration");
|
|
224
|
+
if (serviceNode && arbNode) {
|
|
225
|
+
const servicePerm = graph.edges.find((e) => e.from === "main_service" && e.relation === "has_permission")?.to;
|
|
226
|
+
const arbPerm = graph.edges.find((e) => e.from === "main_arbitration" && e.relation === "has_permission")?.to;
|
|
227
|
+
if (servicePerm && arbPerm && servicePerm === arbPerm) {
|
|
228
|
+
hardViolations.push(constraint);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (constraint.level === "soft") {
|
|
233
|
+
softViolations.push(constraint);
|
|
234
|
+
}
|
|
235
|
+
else if (constraint.level === "info") {
|
|
236
|
+
infoNotes.push(constraint);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
valid: hardViolations.length === 0,
|
|
241
|
+
hardViolations,
|
|
242
|
+
softViolations,
|
|
243
|
+
infoNotes,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
@@ -325,7 +325,6 @@ export declare const CallAllocation_OperateSchema: z.ZodObject<{
|
|
|
325
325
|
alloc_by_guard: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
326
326
|
}, "strict", z.ZodTypeAny, {
|
|
327
327
|
object: string;
|
|
328
|
-
alloc_by_guard?: string | undefined;
|
|
329
328
|
received_coins?: {
|
|
330
329
|
received: {
|
|
331
330
|
id: string;
|
|
@@ -335,9 +334,9 @@ export declare const CallAllocation_OperateSchema: z.ZodObject<{
|
|
|
335
334
|
balance: string | number;
|
|
336
335
|
token_type: string;
|
|
337
336
|
} | "recently" | undefined;
|
|
337
|
+
alloc_by_guard?: string | undefined;
|
|
338
338
|
}, {
|
|
339
339
|
object: string;
|
|
340
|
-
alloc_by_guard?: string | undefined;
|
|
341
340
|
received_coins?: {
|
|
342
341
|
received: {
|
|
343
342
|
id: string;
|
|
@@ -347,6 +346,7 @@ export declare const CallAllocation_OperateSchema: z.ZodObject<{
|
|
|
347
346
|
balance: string | number;
|
|
348
347
|
token_type: string;
|
|
349
348
|
} | "recently" | undefined;
|
|
349
|
+
alloc_by_guard?: string | undefined;
|
|
350
350
|
}>;
|
|
351
351
|
export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
|
|
352
352
|
object: z.ZodObject<{
|
|
@@ -673,7 +673,6 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
673
673
|
alloc_by_guard: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
674
674
|
}, "strict", z.ZodTypeAny, {
|
|
675
675
|
object: string;
|
|
676
|
-
alloc_by_guard?: string | undefined;
|
|
677
676
|
received_coins?: {
|
|
678
677
|
received: {
|
|
679
678
|
id: string;
|
|
@@ -683,9 +682,9 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
683
682
|
balance: string | number;
|
|
684
683
|
token_type: string;
|
|
685
684
|
} | "recently" | undefined;
|
|
685
|
+
alloc_by_guard?: string | undefined;
|
|
686
686
|
}, {
|
|
687
687
|
object: string;
|
|
688
|
-
alloc_by_guard?: string | undefined;
|
|
689
688
|
received_coins?: {
|
|
690
689
|
received: {
|
|
691
690
|
id: string;
|
|
@@ -695,6 +694,7 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
695
694
|
balance: string | number;
|
|
696
695
|
token_type: string;
|
|
697
696
|
} | "recently" | undefined;
|
|
697
|
+
alloc_by_guard?: string | undefined;
|
|
698
698
|
}>]>;
|
|
699
699
|
export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
700
700
|
data: z.ZodUnion<[z.ZodObject<{
|
|
@@ -1022,7 +1022,6 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
1022
1022
|
alloc_by_guard: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
1023
1023
|
}, "strict", z.ZodTypeAny, {
|
|
1024
1024
|
object: string;
|
|
1025
|
-
alloc_by_guard?: string | undefined;
|
|
1026
1025
|
received_coins?: {
|
|
1027
1026
|
received: {
|
|
1028
1027
|
id: string;
|
|
@@ -1032,9 +1031,9 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
1032
1031
|
balance: string | number;
|
|
1033
1032
|
token_type: string;
|
|
1034
1033
|
} | "recently" | undefined;
|
|
1034
|
+
alloc_by_guard?: string | undefined;
|
|
1035
1035
|
}, {
|
|
1036
1036
|
object: string;
|
|
1037
|
-
alloc_by_guard?: string | undefined;
|
|
1038
1037
|
received_coins?: {
|
|
1039
1038
|
received: {
|
|
1040
1039
|
id: string;
|
|
@@ -1044,6 +1043,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
1044
1043
|
balance: string | number;
|
|
1045
1044
|
token_type: string;
|
|
1046
1045
|
} | "recently" | undefined;
|
|
1046
|
+
alloc_by_guard?: string | undefined;
|
|
1047
1047
|
}>]>;
|
|
1048
1048
|
env: z.ZodOptional<z.ZodObject<{
|
|
1049
1049
|
account: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>>;
|
|
@@ -1055,10 +1055,11 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
1055
1055
|
user_intent_phrases: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1056
1056
|
project: z.ZodOptional<z.ZodString>;
|
|
1057
1057
|
client_schema_version: z.ZodOptional<z.ZodString>;
|
|
1058
|
-
schema_strict_mode: z.ZodOptional<z.ZodBoolean
|
|
1058
|
+
schema_strict_mode: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
1059
1059
|
dry_run: z.ZodOptional<z.ZodBoolean>;
|
|
1060
1060
|
}, "strict", z.ZodTypeAny, {
|
|
1061
1061
|
account: string;
|
|
1062
|
+
schema_strict_mode: boolean;
|
|
1062
1063
|
no_cache?: boolean | undefined;
|
|
1063
1064
|
network?: import("@wowok/wowok").ENTRYPOINT | undefined;
|
|
1064
1065
|
permission_guard?: string[] | undefined;
|
|
@@ -1067,7 +1068,6 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
1067
1068
|
user_intent_phrases?: string[] | undefined;
|
|
1068
1069
|
project?: string | undefined;
|
|
1069
1070
|
client_schema_version?: string | undefined;
|
|
1070
|
-
schema_strict_mode?: boolean | undefined;
|
|
1071
1071
|
dry_run?: boolean | undefined;
|
|
1072
1072
|
}, {
|
|
1073
1073
|
no_cache?: boolean | undefined;
|
|
@@ -1307,7 +1307,6 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
1307
1307
|
};
|
|
1308
1308
|
} | {
|
|
1309
1309
|
object: string;
|
|
1310
|
-
alloc_by_guard?: string | undefined;
|
|
1311
1310
|
received_coins?: {
|
|
1312
1311
|
received: {
|
|
1313
1312
|
id: string;
|
|
@@ -1317,6 +1316,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
1317
1316
|
balance: string | number;
|
|
1318
1317
|
token_type: string;
|
|
1319
1318
|
} | "recently" | undefined;
|
|
1319
|
+
alloc_by_guard?: string | undefined;
|
|
1320
1320
|
};
|
|
1321
1321
|
submission?: {
|
|
1322
1322
|
type: "submission";
|
|
@@ -1347,6 +1347,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
1347
1347
|
} | undefined;
|
|
1348
1348
|
env?: {
|
|
1349
1349
|
account: string;
|
|
1350
|
+
schema_strict_mode: boolean;
|
|
1350
1351
|
no_cache?: boolean | undefined;
|
|
1351
1352
|
network?: import("@wowok/wowok").ENTRYPOINT | undefined;
|
|
1352
1353
|
permission_guard?: string[] | undefined;
|
|
@@ -1355,7 +1356,6 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
1355
1356
|
user_intent_phrases?: string[] | undefined;
|
|
1356
1357
|
project?: string | undefined;
|
|
1357
1358
|
client_schema_version?: string | undefined;
|
|
1358
|
-
schema_strict_mode?: boolean | undefined;
|
|
1359
1359
|
dry_run?: boolean | undefined;
|
|
1360
1360
|
} | undefined;
|
|
1361
1361
|
}, {
|
|
@@ -1403,7 +1403,6 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
1403
1403
|
};
|
|
1404
1404
|
} | {
|
|
1405
1405
|
object: string;
|
|
1406
|
-
alloc_by_guard?: string | undefined;
|
|
1407
1406
|
received_coins?: {
|
|
1408
1407
|
received: {
|
|
1409
1408
|
id: string;
|
|
@@ -1413,6 +1412,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
|
|
|
1413
1412
|
balance: string | number;
|
|
1414
1413
|
token_type: string;
|
|
1415
1414
|
} | "recently" | undefined;
|
|
1415
|
+
alloc_by_guard?: string | undefined;
|
|
1416
1416
|
};
|
|
1417
1417
|
submission?: {
|
|
1418
1418
|
type: "submission";
|
|
@@ -11,7 +11,17 @@ export const CallAllocation_CreateSchema = z.object({
|
|
|
11
11
|
export const CallAllocation_OperateSchema = z.object({
|
|
12
12
|
object: NameOrAddressSchema.describe("REQUIRED for operating existing object. Provide the Allocation object ID or existing name to reference the target object."),
|
|
13
13
|
received_coins: ReceivedBalanceOrRecentlySchema.optional().describe("Unwrap the CoinWrapper objects received by the Allocation object and deposit them into the pending allocation balance." + RECEIVE_FORMAT_BLOCK_BALANCE),
|
|
14
|
-
alloc_by_guard: NameOrAddressSchema.optional().describe("Verify the specified Guard and execute the corresponding fund allocation"
|
|
14
|
+
alloc_by_guard: NameOrAddressSchema.optional().describe("Verify the specified Guard and execute the corresponding fund allocation. " +
|
|
15
|
+
"POST-ALLOCATION CLAIM (required step): each recipient receives a CoinWrapper object (NOT spendable coins). " +
|
|
16
|
+
"Recipient address resolution (allocation.move): Entity recipients receive it at the Entity's address; " +
|
|
17
|
+
"Signer recipients receive it at the transaction sender's address; " +
|
|
18
|
+
"GuardIdentifier n recipients receive it at the ADDRESS SUBMITTED for identifier n in this call's submission " +
|
|
19
|
+
"(resolved via passport::submission_get) — conventionally the Order OBJECT address (escrow pattern), " +
|
|
20
|
+
"in which case the order owner claims it via operation_type='order' {object:'<order_id>', receive:'recently'}. " +
|
|
21
|
+
"Claim paths by holder: EOA wallet → operation_type='payment' RECEIVE mode {object:'<coinwrapper_id>', receive:true, type_parameter:'0x2::wow::WOW'}; " +
|
|
22
|
+
"Order object → order receive; Treasury object → treasury receive. " +
|
|
23
|
+
"Find pending CoinWrappers via query_toolkit query_type='onchain_received'. " +
|
|
24
|
+
"Verify the distribution via the immutable Payment object created by this call (allocation.payment array).")
|
|
15
25
|
}).strict().describe("Operate on an existing Allocation object. Set 'object' field with the object ID or existing name to specify the target.");
|
|
16
26
|
export const CallAllocation_DataSchema = z.union([
|
|
17
27
|
CallAllocation_CreateSchema,
|