@wowok/agent-mcp 2.6.0 → 2.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/customer/info-puzzle.d.ts +1 -1
- package/dist/customer/info-puzzle.js +4 -2
- package/dist/customer/risk-assessment.js +26 -4
- package/dist/customer/types.d.ts +2 -0
- package/dist/examples/guard-template-balance-check.json +38 -0
- package/dist/examples/guard-template-time-lock.json +39 -0
- package/dist/examples/machine-template-7node-rental.json +114 -0
- package/dist/examples/rental-ziroom-machine-create.json +137 -0
- package/dist/examples/rental-ziroom-permission-create.json +35 -0
- package/dist/examples/rental-ziroom-service-create.json +80 -0
- package/dist/examples/retail-myshop-service-create.json +88 -0
- package/dist/extensions/capability-manifest.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 +493 -0
- package/dist/extensions/registry.d.ts +50 -0
- package/dist/extensions/registry.js +662 -0
- package/dist/extensions/types.d.ts +219 -0
- package/dist/extensions/types.js +1 -0
- package/dist/index.js +50 -0
- package/dist/knowledge/deployment-scanner.d.ts +3 -0
- package/dist/knowledge/deployment-scanner.js +64 -3
- package/dist/knowledge/fund-layer.d.ts +72 -0
- package/dist/knowledge/fund-layer.js +420 -0
- package/dist/knowledge/guard-render.d.ts +57 -0
- package/dist/knowledge/guard-render.js +700 -0
- package/dist/knowledge/guard-risk.d.ts +13 -0
- package/dist/knowledge/guard-risk.js +57 -0
- package/dist/knowledge/guard-submission-prompt.d.ts +31 -0
- package/dist/knowledge/guard-submission-prompt.js +171 -0
- package/dist/knowledge/guard-templates.js +278 -0
- package/dist/knowledge/machine-ledger.js +1 -1
- package/dist/knowledge/machine-render.d.ts +41 -0
- package/dist/knowledge/machine-render.js +565 -0
- package/dist/knowledge/machine-templates.js +24 -5
- package/dist/knowledge/reward-confirm.js +2 -2
- package/dist/knowledge/reward-puzzle.js +1 -1
- package/dist/knowledge/reward-risk.js +9 -9
- package/dist/knowledge/reward-templates.js +2 -2
- package/dist/knowledge/service-confirm.d.ts +15 -6
- package/dist/knowledge/service-confirm.js +119 -11
- package/dist/knowledge/service-context.js +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/service-risk.d.ts +1 -1
- package/dist/knowledge/service-risk.js +3 -3
- package/dist/knowledge/service-templates.js +2 -2
- package/dist/knowledge/service-translation.d.ts +1 -1
- package/dist/knowledge/service-translation.js +7 -7
- package/dist/knowledge/tool-constraints.js +6 -2
- package/dist/project/deployment-bridge.d.ts +1 -1
- package/dist/project/deployment-bridge.js +31 -7
- package/dist/project/deployment-doc.d.ts +3 -0
- package/dist/project/deployment-doc.js +76 -14
- package/dist/project/edit-planner.d.ts +123 -0
- package/dist/project/edit-planner.js +1371 -0
- package/dist/project/evaluation.d.ts +2 -0
- package/dist/project/evaluation.js +873 -88
- package/dist/project/graph-builder.d.ts +4 -1
- package/dist/project/graph-builder.js +132 -62
- package/dist/project/graph.d.ts +1 -0
- package/dist/project/handlers.d.ts +317 -6
- package/dist/project/handlers.js +1171 -19
- 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/allocation.js +2 -2
- package/dist/schema/call/arbitration.js +19 -6
- 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/contact.js +2 -2
- package/dist/schema/call/demand.d.ts +23 -31
- package/dist/schema/call/demand.js +2 -2
- package/dist/schema/call/guard.js +2 -2
- package/dist/schema/call/machine.d.ts +1976 -752
- package/dist/schema/call/machine.js +50 -4
- package/dist/schema/call/order.d.ts +149 -228
- package/dist/schema/call/order.js +4 -3
- package/dist/schema/call/payment.d.ts +183 -3
- package/dist/schema/call/payment.js +21 -3
- package/dist/schema/call/permission.js +2 -2
- 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/repository.js +2 -2
- package/dist/schema/call/reward.js +3 -3
- package/dist/schema/call/semantic.d.ts +1 -1
- package/dist/schema/call/semantic.js +37 -2
- package/dist/schema/call/service.d.ts +275 -127
- package/dist/schema/call/service.js +89 -13
- package/dist/schema/call/treasury.js +3 -3
- package/dist/schema/common/index.d.ts +13 -2
- package/dist/schema/common/index.js +80 -15
- package/dist/schema/local/index.d.ts +32 -35
- package/dist/schema/local/index.js +28 -6
- package/dist/schema/messenger/index.d.ts +274 -46
- package/dist/schema/operations.d.ts +1264 -544
- package/dist/schema/operations.js +65 -7
- package/dist/schema/project/index.d.ts +2846 -167
- package/dist/schema/project/index.js +570 -16
- package/dist/schema/query/index.d.ts +922 -349
- package/dist/schema/query/index.js +205 -42
- package/dist/schema/schema-query/index.d.ts +65 -3
- package/dist/schema/schema-query/index.js +38 -5
- package/dist/schema/utils/node-parser.js +20 -4
- package/dist/schema/utils/object-type-utils.d.ts +12 -0
- package/dist/schema/utils/object-type-utils.js +35 -0
- package/dist/schema/utils/permission-machine-check.d.ts +49 -0
- package/dist/schema/utils/permission-machine-check.js +121 -0
- package/dist/schema/utils/skills-recommendation.d.ts +2 -0
- package/dist/schema/utils/skills-recommendation.js +76 -0
- package/dist/schema-query/index.d.ts +20 -1
- package/dist/schema-query/index.js +306 -4
- package/dist/schemas/account_operation.output.json +7 -1
- package/dist/schemas/account_operation.schema.json +3 -3
- 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.output.json +2820 -0
- package/dist/schemas/onchain_operations.schema.json +444 -330
- package/dist/schemas/onchain_operations_allocation.schema.json +37 -28
- package/dist/schemas/onchain_operations_arbitration.schema.json +16 -14
- package/dist/schemas/onchain_operations_contact.schema.json +10 -10
- package/dist/schemas/onchain_operations_demand.schema.json +10 -10
- package/dist/schemas/onchain_operations_gen_passport.schema.json +16 -16
- package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -2
- package/dist/schemas/onchain_operations_guard.schema.json +2 -2
- package/dist/schemas/onchain_operations_machine.schema.json +43 -35
- package/dist/schemas/onchain_operations_order.schema.json +72 -78
- package/dist/schemas/onchain_operations_payment.schema.json +141 -111
- package/dist/schemas/onchain_operations_permission.schema.json +3 -3
- package/dist/schemas/onchain_operations_personal.schema.json +7 -7
- package/dist/schemas/onchain_operations_progress.schema.json +9 -9
- package/dist/schemas/onchain_operations_proof.schema.json +8 -8
- package/dist/schemas/onchain_operations_repository.schema.json +10 -10
- package/dist/schemas/onchain_operations_reward.schema.json +14 -14
- package/dist/schemas/onchain_operations_service.schema.json +119 -48
- package/dist/schemas/onchain_operations_treasury.schema.json +11 -11
- package/dist/schemas/onchain_table_data.output.json +33 -25
- package/dist/schemas/onchain_table_data.schema.json +22 -21
- package/dist/schemas/project_operation.output.json +2194 -23
- package/dist/schemas/project_operation.schema.json +84 -6
- package/dist/schemas/query_toolkit.output.json +108 -80
- package/dist/schemas/query_toolkit.schema.json +12 -12
- package/dist/schemas/schema_query.output.json +70 -3
- package/dist/schemas/schema_query.schema.json +18 -3
- package/dist/schemas/wowok_buildin_info.output.json +81 -8
- package/dist/schemas/wowok_buildin_info.schema.json +46 -2
- package/dist/tools/handlers/local.js +20 -5
- package/dist/tools/handlers/onchain.js +594 -6
- package/dist/tools/handlers/project.js +76 -4
- package/dist/tools/handlers/query.js +27 -0
- package/dist/tools/handlers/schema-query.js +43 -1
- 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.d.ts +8 -0
- package/dist/tools/index.js +387 -12
- 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
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { type GraphData } from "@wowok/wowok";
|
|
1
|
+
import { type GraphData, type GraphNode } from "@wowok/wowok";
|
|
2
|
+
export type GraphNodeWithTemplate = GraphNode & {
|
|
3
|
+
isTemplate?: boolean;
|
|
4
|
+
};
|
|
2
5
|
export interface GraphBuildOptions {
|
|
3
6
|
maxDepth?: number;
|
|
4
7
|
maxConcurrency?: number;
|
|
@@ -9,7 +9,12 @@ function shortTypeName(objectType) {
|
|
|
9
9
|
}
|
|
10
10
|
function extractAddressFields(obj) {
|
|
11
11
|
const refs = [];
|
|
12
|
-
const
|
|
12
|
+
const rawType = obj.type;
|
|
13
|
+
let objType = rawType;
|
|
14
|
+
if (rawType && rawType.includes("::")) {
|
|
15
|
+
const parts = rawType.split("::");
|
|
16
|
+
objType = parts[parts.length - 1];
|
|
17
|
+
}
|
|
13
18
|
const isAddress = (v) => typeof v === "string" && v.startsWith("0x") && v.length >= 10;
|
|
14
19
|
const addRef = (addr, field, refType) => {
|
|
15
20
|
if (isAddress(addr) && addr !== "0x0" && addr !== obj.object) {
|
|
@@ -45,46 +50,86 @@ function extractAddressFields(obj) {
|
|
|
45
50
|
const firstGuard = data.order_allocators.allocators[0]?.guard;
|
|
46
51
|
addRef(firstGuard, "order_allocators", "create");
|
|
47
52
|
}
|
|
48
|
-
addRefOption(data.compensation_fund, "compensation_fund", "bind");
|
|
49
53
|
break;
|
|
50
54
|
}
|
|
51
55
|
case "Machine": {
|
|
52
56
|
addRef(data.permission, "permission", "validate");
|
|
53
|
-
addRefArray(data.
|
|
54
|
-
if (data.nodes) {
|
|
55
|
-
for (const node of data.nodes) {
|
|
56
|
-
if (node.forward?.guard) {
|
|
57
|
-
addRef(node.forward.guard, "node_guard", "validate");
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
57
|
+
addRefArray(data.consensus_repositories, "consensus_repositories", "consume");
|
|
61
58
|
break;
|
|
62
59
|
}
|
|
63
60
|
case "Order": {
|
|
64
61
|
addRef(data.service, "service", "consume");
|
|
65
62
|
addRefOption(data.machine, "machine", "consume");
|
|
66
63
|
addRefOption(data.progress, "progress", "trigger");
|
|
67
|
-
|
|
64
|
+
addRefArray(data.dispute, "dispute", "trigger");
|
|
65
|
+
addRefOption(data.allocation, "allocation", "bind");
|
|
68
66
|
break;
|
|
69
67
|
}
|
|
70
68
|
case "Progress": {
|
|
71
69
|
addRef(data.machine, "machine", "bind");
|
|
72
|
-
|
|
73
|
-
addRefOption(data.order, "order", "bind");
|
|
70
|
+
addRefArray(data.context_repositories, "context_repositories", "consume");
|
|
74
71
|
break;
|
|
75
72
|
}
|
|
76
73
|
case "Treasury": {
|
|
77
74
|
addRef(data.permission, "permission", "validate");
|
|
78
|
-
|
|
75
|
+
if (Array.isArray(data.external_deposit_guard)) {
|
|
76
|
+
for (const g of data.external_deposit_guard)
|
|
77
|
+
addRef(g?.guard, "external_deposit_guard", "validate");
|
|
78
|
+
}
|
|
79
|
+
if (Array.isArray(data.external_withdraw_guard)) {
|
|
80
|
+
for (const g of data.external_withdraw_guard)
|
|
81
|
+
addRef(g?.guard, "external_withdraw_guard", "validate");
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
case "Allocation": {
|
|
86
|
+
if (Array.isArray(data.allocators)) {
|
|
87
|
+
for (const alloc of data.allocators)
|
|
88
|
+
addRef(alloc?.guard, "allocator_guard", "validate");
|
|
89
|
+
}
|
|
90
|
+
addRefOption(data.payment_info?.for_object, "for_object", "bind");
|
|
91
|
+
addRefOption(data.payment_info?.for_guard, "for_guard", "validate");
|
|
92
|
+
addRefArray(data.payment, "payment", "trigger");
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
case "Arbitration": {
|
|
96
|
+
addRef(data.permission, "permission", "validate");
|
|
97
|
+
if (Array.isArray(data.voting_guard)) {
|
|
98
|
+
for (const vg of data.voting_guard)
|
|
99
|
+
addRef(vg?.guard, "voting_guard", "validate");
|
|
100
|
+
}
|
|
101
|
+
addRefOption(data.usage_guard, "usage_guard", "validate");
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
case "Reward": {
|
|
105
|
+
addRef(data.permission, "permission", "validate");
|
|
106
|
+
if (Array.isArray(data.guards)) {
|
|
107
|
+
for (const rg of data.guards)
|
|
108
|
+
addRef(rg?.guard, "guard", "validate");
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
case "Repository": {
|
|
113
|
+
addRef(data.permission, "permission", "validate");
|
|
114
|
+
addRefArray(data.rewards, "rewards", "trigger");
|
|
115
|
+
if (Array.isArray(data.policies)) {
|
|
116
|
+
for (const policy of data.policies) {
|
|
117
|
+
if (Array.isArray(policy?.write_guard)) {
|
|
118
|
+
for (const wg of policy.write_guard)
|
|
119
|
+
addRef(wg?.guard, "write_guard", "validate");
|
|
120
|
+
}
|
|
121
|
+
addRefOption(policy?.quote_guard, "quote_guard", "validate");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
79
124
|
break;
|
|
80
125
|
}
|
|
81
|
-
case "Allocation":
|
|
82
|
-
case "Arbitration":
|
|
83
|
-
case "Reward":
|
|
84
|
-
case "Repository":
|
|
85
126
|
case "Demand": {
|
|
86
127
|
addRef(data.permission, "permission", "validate");
|
|
87
|
-
|
|
128
|
+
if (Array.isArray(data.guards)) {
|
|
129
|
+
for (const dg of data.guards)
|
|
130
|
+
addRef(dg?.guard, "guard", "validate");
|
|
131
|
+
}
|
|
132
|
+
addRefArray(data.rewards, "rewards", "trigger");
|
|
88
133
|
break;
|
|
89
134
|
}
|
|
90
135
|
case "Contact": {
|
|
@@ -95,9 +140,16 @@ function extractAddressFields(obj) {
|
|
|
95
140
|
break;
|
|
96
141
|
}
|
|
97
142
|
case "Payment": {
|
|
98
|
-
addRefOption(data.for_object, "for_object", "bind");
|
|
99
|
-
addRefOption(data.for_guard, "for_guard", "validate");
|
|
100
|
-
|
|
143
|
+
addRefOption(data.info?.for_object, "for_object", "bind");
|
|
144
|
+
addRefOption(data.info?.for_guard, "for_guard", "validate");
|
|
145
|
+
if (Array.isArray(data.record)) {
|
|
146
|
+
for (const r of data.record) {
|
|
147
|
+
const rec = r?.recipient;
|
|
148
|
+
if (rec && typeof rec === "object" && typeof rec.Entity === "string") {
|
|
149
|
+
addRef(rec.Entity, "recipient_entity", "consume");
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
101
153
|
break;
|
|
102
154
|
}
|
|
103
155
|
case "Guard": {
|
|
@@ -165,53 +217,71 @@ const EXPECTED_RELATIONSHIPS = new Map([
|
|
|
165
217
|
{ targetType: "Machine", fieldName: "machine", relationshipType: "bind", single: true },
|
|
166
218
|
{ targetType: "Guard", fieldName: "buy_guard", relationshipType: "validate", single: true },
|
|
167
219
|
{ targetType: "Permission", fieldName: "permission", relationshipType: "validate", single: true },
|
|
168
|
-
{ targetType: "
|
|
169
|
-
{ targetType: "
|
|
220
|
+
{ targetType: "Guard", fieldName: "allocator_guard", relationshipType: "validate" },
|
|
221
|
+
{ targetType: "Contact", fieldName: "um", relationshipType: "bind", single: true },
|
|
170
222
|
{ targetType: "Arbitration", fieldName: "arbitrations", relationshipType: "trigger" },
|
|
171
223
|
{ targetType: "Reward", fieldName: "rewards", relationshipType: "trigger" },
|
|
172
224
|
{ targetType: "Repository", fieldName: "repositories", relationshipType: "consume" },
|
|
173
225
|
]],
|
|
174
226
|
["Machine", [
|
|
175
|
-
{ targetType: "Guard", fieldName: "nodes.guard", relationshipType: "validate" },
|
|
176
227
|
{ targetType: "Permission", fieldName: "permission", relationshipType: "validate", single: true },
|
|
177
|
-
{ targetType: "Repository", fieldName: "
|
|
228
|
+
{ targetType: "Repository", fieldName: "consensus_repositories", relationshipType: "consume" },
|
|
229
|
+
{ targetType: "Contact", fieldName: "um", relationshipType: "bind", single: true },
|
|
178
230
|
]],
|
|
179
231
|
["Order", [
|
|
180
232
|
{ targetType: "Service", fieldName: "service", relationshipType: "consume", single: true },
|
|
233
|
+
{ targetType: "Machine", fieldName: "machine", relationshipType: "consume", single: true },
|
|
181
234
|
{ targetType: "Progress", fieldName: "progress", relationshipType: "trigger", single: true },
|
|
235
|
+
{ targetType: "Arb", fieldName: "dispute", relationshipType: "trigger" },
|
|
236
|
+
{ targetType: "Allocation", fieldName: "allocation", relationshipType: "bind", single: true },
|
|
182
237
|
]],
|
|
183
238
|
["Progress", [
|
|
184
|
-
{ targetType: "Machine", fieldName: "parent", relationshipType: "bind", single: true },
|
|
185
239
|
{ targetType: "Machine", fieldName: "machine", relationshipType: "bind", single: true },
|
|
240
|
+
{ targetType: "Repository", fieldName: "context_repositories", relationshipType: "consume" },
|
|
186
241
|
]],
|
|
187
242
|
["Allocation", [
|
|
188
|
-
{ targetType: "
|
|
189
|
-
{ targetType: "Guard", fieldName: "
|
|
243
|
+
{ targetType: "Guard", fieldName: "allocator_guard", relationshipType: "validate" },
|
|
244
|
+
{ targetType: "Guard", fieldName: "for_guard", relationshipType: "validate", single: true },
|
|
245
|
+
{ targetType: "Payment", fieldName: "payment", relationshipType: "trigger" },
|
|
190
246
|
]],
|
|
191
247
|
["Reward", [
|
|
192
|
-
{ targetType: "Guard", fieldName: "guard", relationshipType: "validate"
|
|
248
|
+
{ targetType: "Guard", fieldName: "guard", relationshipType: "validate" },
|
|
193
249
|
{ targetType: "Permission", fieldName: "permission", relationshipType: "validate", single: true },
|
|
250
|
+
{ targetType: "Contact", fieldName: "um", relationshipType: "bind", single: true },
|
|
194
251
|
]],
|
|
195
252
|
["Repository", [
|
|
196
|
-
{ targetType: "Guard", fieldName: "
|
|
253
|
+
{ targetType: "Guard", fieldName: "write_guard", relationshipType: "validate" },
|
|
254
|
+
{ targetType: "Guard", fieldName: "quote_guard", relationshipType: "validate", single: true },
|
|
197
255
|
{ targetType: "Permission", fieldName: "permission", relationshipType: "validate", single: true },
|
|
256
|
+
{ targetType: "Reward", fieldName: "rewards", relationshipType: "trigger" },
|
|
257
|
+
{ targetType: "Contact", fieldName: "um", relationshipType: "bind", single: true },
|
|
198
258
|
]],
|
|
199
259
|
["Demand", [
|
|
200
|
-
{ targetType: "
|
|
201
|
-
{ targetType: "Guard", fieldName: "guards", relationshipType: "validate" },
|
|
260
|
+
{ targetType: "Guard", fieldName: "guard", relationshipType: "validate" },
|
|
202
261
|
{ targetType: "Reward", fieldName: "rewards", relationshipType: "trigger" },
|
|
262
|
+
{ targetType: "Contact", fieldName: "um", relationshipType: "bind", single: true },
|
|
203
263
|
]],
|
|
204
264
|
["Treasury", [
|
|
205
265
|
{ targetType: "Permission", fieldName: "permission", relationshipType: "validate", single: true },
|
|
206
|
-
{ targetType: "Guard", fieldName: "
|
|
266
|
+
{ targetType: "Guard", fieldName: "external_deposit_guard", relationshipType: "validate" },
|
|
267
|
+
{ targetType: "Guard", fieldName: "external_withdraw_guard", relationshipType: "validate" },
|
|
268
|
+
{ targetType: "Contact", fieldName: "um", relationshipType: "bind", single: true },
|
|
207
269
|
]],
|
|
208
270
|
["Arbitration", [
|
|
209
271
|
{ targetType: "Permission", fieldName: "permission", relationshipType: "validate", single: true },
|
|
210
|
-
{ targetType: "Guard", fieldName: "
|
|
272
|
+
{ targetType: "Guard", fieldName: "voting_guard", relationshipType: "validate" },
|
|
273
|
+
{ targetType: "Guard", fieldName: "usage_guard", relationshipType: "validate", single: true },
|
|
274
|
+
{ targetType: "Contact", fieldName: "um", relationshipType: "bind", single: true },
|
|
211
275
|
]],
|
|
212
276
|
["Payment", [
|
|
213
277
|
{ targetType: "Guard", fieldName: "for_guard", relationshipType: "validate", single: true },
|
|
214
278
|
]],
|
|
279
|
+
["Contact", [
|
|
280
|
+
{ targetType: "Permission", fieldName: "permission", relationshipType: "validate", single: true },
|
|
281
|
+
]],
|
|
282
|
+
["Permission", [
|
|
283
|
+
{ targetType: "Contact", fieldName: "um", relationshipType: "bind", single: true },
|
|
284
|
+
]],
|
|
215
285
|
]);
|
|
216
286
|
export class GraphBuilder {
|
|
217
287
|
localProject;
|
|
@@ -478,33 +548,31 @@ export class GraphBuilder {
|
|
|
478
548
|
const fieldKey = `${source.address}#${expected.fieldName}`;
|
|
479
549
|
const existingBindings = sourceFieldBindings.get(fieldKey);
|
|
480
550
|
const hasOtherBinding = existingBindings !== undefined && existingBindings.size > 0;
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
});
|
|
507
|
-
}
|
|
551
|
+
if (hasOtherBinding)
|
|
552
|
+
continue;
|
|
553
|
+
const representativeTarget = targets.find((t) => t.address !== source.address &&
|
|
554
|
+
!existingPairs.has(`${source.address}→${t.address}`) &&
|
|
555
|
+
!existingBindings?.has(t.address));
|
|
556
|
+
if (!representativeTarget)
|
|
557
|
+
continue;
|
|
558
|
+
potentialEdges.push({
|
|
559
|
+
sourceObject: source.address,
|
|
560
|
+
targetObject: representativeTarget.address,
|
|
561
|
+
edgeSource: "potential",
|
|
562
|
+
relationshipType: expected.relationshipType,
|
|
563
|
+
fieldName: expected.fieldName,
|
|
564
|
+
depth: 0,
|
|
565
|
+
verified: false,
|
|
566
|
+
weight: 0.6,
|
|
567
|
+
direction: "outbound",
|
|
568
|
+
metadata: {
|
|
569
|
+
reason: "expected_relationship_missing",
|
|
570
|
+
expected_target_type: expected.targetType,
|
|
571
|
+
source_object_name: source.name,
|
|
572
|
+
representative: true,
|
|
573
|
+
alternative_target_count: targets.length - 1,
|
|
574
|
+
},
|
|
575
|
+
});
|
|
508
576
|
}
|
|
509
577
|
}
|
|
510
578
|
}
|
|
@@ -554,12 +622,14 @@ export class GraphBuilder {
|
|
|
554
622
|
const obj = objectCache.get(addr);
|
|
555
623
|
const queryName = obj?.query_name;
|
|
556
624
|
const objectName = queryName && queryName !== addr ? queryName : null;
|
|
625
|
+
const isTemplate = addr.startsWith("draft:");
|
|
557
626
|
nodeMap.set(addr, {
|
|
558
627
|
address: addr,
|
|
559
628
|
objectType: obj?.type ?? null,
|
|
560
629
|
objectName,
|
|
561
630
|
role: null,
|
|
562
631
|
isCore: addr === rootAddress,
|
|
632
|
+
isTemplate,
|
|
563
633
|
});
|
|
564
634
|
}
|
|
565
635
|
return nodeMap.get(addr);
|