@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
|
@@ -0,0 +1,662 @@
|
|
|
1
|
+
import { CapabilityRegistry } from "./capability-manifest.js";
|
|
2
|
+
import { ModeEvaluator } from "./mode-evaluator.js";
|
|
3
|
+
import { MetricRegistry } from "./metric-registry.js";
|
|
4
|
+
import { ConstraintRegistry } from "./constraint-registry.js";
|
|
5
|
+
import { BUILTIN_MODES } from "./modes.js";
|
|
6
|
+
export class IndustryModeRegistry {
|
|
7
|
+
static instance;
|
|
8
|
+
registrations = new Map();
|
|
9
|
+
userModes = new Map();
|
|
10
|
+
aliases = new Map();
|
|
11
|
+
evaluator;
|
|
12
|
+
initialized = false;
|
|
13
|
+
static Instance() {
|
|
14
|
+
if (!IndustryModeRegistry.instance) {
|
|
15
|
+
IndustryModeRegistry.instance = new IndustryModeRegistry();
|
|
16
|
+
}
|
|
17
|
+
return IndustryModeRegistry.instance;
|
|
18
|
+
}
|
|
19
|
+
constructor() {
|
|
20
|
+
this.evaluator = new ModeEvaluator(CapabilityRegistry.Instance(), MetricRegistry.Instance(), ConstraintRegistry.Instance());
|
|
21
|
+
this.registerBuiltinModes();
|
|
22
|
+
this.initialized = true;
|
|
23
|
+
}
|
|
24
|
+
registerMode(mode, aliases) {
|
|
25
|
+
if (!mode.name || !mode.traits || !mode.machine_shape) {
|
|
26
|
+
console.warn(`[IndustryModeRegistry] registerMode rejected: invalid mode ` +
|
|
27
|
+
`(name=${mode.name || "<missing>"}, traits=${mode.traits ? "ok" : "<missing>"}, ` +
|
|
28
|
+
`machine_shape=${mode.machine_shape ? "ok" : "<missing>"}).`);
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
if (this.registrations.has(mode.name)) {
|
|
32
|
+
const existing = this.registrations.get(mode.name);
|
|
33
|
+
console.warn(`[IndustryModeRegistry] registerMode rejected: mode '${mode.name}' already registered ` +
|
|
34
|
+
`(registered_at=${new Date(existing?.registered_at ?? 0).toISOString()}). ` +
|
|
35
|
+
`Use evolveMode/deriveMode for user modifications, or unregister first.`);
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
this.registrations.set(mode.name, {
|
|
39
|
+
mode,
|
|
40
|
+
aliases,
|
|
41
|
+
enabled: true,
|
|
42
|
+
registered_at: Date.now(),
|
|
43
|
+
});
|
|
44
|
+
if (aliases) {
|
|
45
|
+
for (const alias of aliases) {
|
|
46
|
+
this.aliases.set(alias, mode.name);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
getMode(name) {
|
|
52
|
+
const canonical = this.resolveAlias(name);
|
|
53
|
+
return this.registrations.get(canonical)?.mode;
|
|
54
|
+
}
|
|
55
|
+
listModes() {
|
|
56
|
+
return Array.from(this.registrations.values())
|
|
57
|
+
.filter(r => r.enabled)
|
|
58
|
+
.map(r => r.mode);
|
|
59
|
+
}
|
|
60
|
+
resolveAlias(name) {
|
|
61
|
+
return this.aliases.get(name) ?? name;
|
|
62
|
+
}
|
|
63
|
+
hasMode(name) {
|
|
64
|
+
const canonical = this.resolveAlias(name);
|
|
65
|
+
return this.registrations.has(canonical);
|
|
66
|
+
}
|
|
67
|
+
evaluateMode(name, intent, context) {
|
|
68
|
+
const mode = this.getMode(name);
|
|
69
|
+
if (!mode) {
|
|
70
|
+
return {
|
|
71
|
+
applicable: false,
|
|
72
|
+
risk_score: 100,
|
|
73
|
+
benefit_score: 0,
|
|
74
|
+
risk_benefit_ratio: 0,
|
|
75
|
+
capability_conflicts: [],
|
|
76
|
+
violated_constraints: [],
|
|
77
|
+
unmet_conditions: [`Mode '${name}' not found`],
|
|
78
|
+
recommendations: [`Mode '${name}' not registered, falling back to 'general'`],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return this.evaluator.evaluateMode(mode, intent, context);
|
|
82
|
+
}
|
|
83
|
+
evaluateMigration(sourceName, targetName) {
|
|
84
|
+
const source = this.getMode(sourceName);
|
|
85
|
+
const target = this.getMode(targetName);
|
|
86
|
+
if (!source || !target) {
|
|
87
|
+
return {
|
|
88
|
+
feasibility_score: 0,
|
|
89
|
+
source_risk_score: 0,
|
|
90
|
+
target_risk_score: 0,
|
|
91
|
+
source_benefit_score: 0,
|
|
92
|
+
target_benefit_score: 0,
|
|
93
|
+
risk_delta: 0,
|
|
94
|
+
benefit_delta: 0,
|
|
95
|
+
added_capabilities: [],
|
|
96
|
+
removed_capabilities: [],
|
|
97
|
+
conflicting_capabilities: [],
|
|
98
|
+
recommendations: [`Mode '${sourceName}' or '${targetName}' not found`],
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return this.evaluator.evaluateMigration(source, target);
|
|
102
|
+
}
|
|
103
|
+
registerUserMode(mode, userId) {
|
|
104
|
+
if (!mode.name || !mode.owner || !mode.machine_shape)
|
|
105
|
+
return false;
|
|
106
|
+
if (mode.source !== "custom")
|
|
107
|
+
return false;
|
|
108
|
+
if (mode.owner !== userId)
|
|
109
|
+
return false;
|
|
110
|
+
const userKey = this.userModeKey(mode.owner, mode.name);
|
|
111
|
+
if (this.registrations.has(mode.name))
|
|
112
|
+
return false;
|
|
113
|
+
if (this.userModes.has(userKey))
|
|
114
|
+
return false;
|
|
115
|
+
if (!mode.evolution_history || mode.evolution_history.length === 0) {
|
|
116
|
+
mode.evolution_history = [{
|
|
117
|
+
version: mode.version || "v1",
|
|
118
|
+
changed_at: Date.now(),
|
|
119
|
+
changes: ["Initial registration (registerUserMode)"],
|
|
120
|
+
}];
|
|
121
|
+
}
|
|
122
|
+
this.userModes.set(userKey, mode);
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
deriveMode(sourceMode, modifications, userId, newName, newDisplayName) {
|
|
126
|
+
const source = this.getMode(sourceMode);
|
|
127
|
+
if (!source)
|
|
128
|
+
return undefined;
|
|
129
|
+
if (!newName || this.registrations.has(newName))
|
|
130
|
+
return undefined;
|
|
131
|
+
const userKey = this.userModeKey(userId, newName);
|
|
132
|
+
if (this.userModes.has(userKey))
|
|
133
|
+
return undefined;
|
|
134
|
+
const derived = {
|
|
135
|
+
name: newName,
|
|
136
|
+
display_name: newDisplayName ?? newName,
|
|
137
|
+
version: "v1",
|
|
138
|
+
source: "custom",
|
|
139
|
+
traits: modifications.traits ?? source.traits,
|
|
140
|
+
machine_shape: modifications.machine_shape ?? source.machine_shape,
|
|
141
|
+
guards: modifications.guards ?? source.guards,
|
|
142
|
+
allocator: modifications.allocator ?? source.allocator,
|
|
143
|
+
risk_checks: modifications.risk_checks ?? source.risk_checks,
|
|
144
|
+
needs: modifications.needs ?? source.needs,
|
|
145
|
+
flywheel: modifications.flywheel ?? source.flywheel,
|
|
146
|
+
key_risk: modifications.key_risk ?? source.key_risk,
|
|
147
|
+
build_notes: modifications.build_notes ?? source.build_notes,
|
|
148
|
+
capabilities_used: modifications.capabilities_used ?? source.capabilities_used,
|
|
149
|
+
config_overrides: modifications.config_overrides ?? source.config_overrides,
|
|
150
|
+
config_override_rules: modifications.config_override_rules ?? source.config_override_rules,
|
|
151
|
+
expected_benefits: modifications.expected_benefits ?? source.expected_benefits,
|
|
152
|
+
risk_appetite: modifications.risk_appetite ?? source.risk_appetite,
|
|
153
|
+
risk_constraints: modifications.risk_constraints ?? source.risk_constraints,
|
|
154
|
+
applicable_conditions: modifications.applicable_conditions ?? source.applicable_conditions,
|
|
155
|
+
similar_industries: modifications.similar_industries ?? source.similar_industries,
|
|
156
|
+
novel_capabilities: modifications.novel_capabilities ?? source.novel_capabilities,
|
|
157
|
+
owner: userId,
|
|
158
|
+
derived_from: sourceMode,
|
|
159
|
+
custom_metrics: modifications.custom_metrics ?? source.custom_metrics,
|
|
160
|
+
custom_constraints: modifications.custom_constraints ?? source.custom_constraints,
|
|
161
|
+
evolution_history: [{
|
|
162
|
+
version: "v1",
|
|
163
|
+
changed_at: Date.now(),
|
|
164
|
+
changes: [`Derived from builtin '${sourceMode}'`],
|
|
165
|
+
}],
|
|
166
|
+
};
|
|
167
|
+
this.userModes.set(userKey, derived);
|
|
168
|
+
return derived;
|
|
169
|
+
}
|
|
170
|
+
evolveMode(modeName, updates, userId, changeDescription, bumpVersion = true) {
|
|
171
|
+
const userKey = this.userModeKey(userId, modeName);
|
|
172
|
+
const existing = this.userModes.get(userKey);
|
|
173
|
+
if (!existing)
|
|
174
|
+
return undefined;
|
|
175
|
+
const newVersion = bumpVersion
|
|
176
|
+
? this.bumpPatchVersion(existing.version)
|
|
177
|
+
: existing.version;
|
|
178
|
+
const evolved = {
|
|
179
|
+
...existing,
|
|
180
|
+
...updates,
|
|
181
|
+
name: existing.name,
|
|
182
|
+
owner: existing.owner,
|
|
183
|
+
source: "custom",
|
|
184
|
+
derived_from: existing.derived_from,
|
|
185
|
+
evolution_history: [
|
|
186
|
+
...(existing.evolution_history ?? []),
|
|
187
|
+
{
|
|
188
|
+
version: newVersion,
|
|
189
|
+
changed_at: Date.now(),
|
|
190
|
+
changes: [changeDescription],
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
version: newVersion,
|
|
194
|
+
};
|
|
195
|
+
this.userModes.set(userKey, evolved);
|
|
196
|
+
return evolved;
|
|
197
|
+
}
|
|
198
|
+
listUserModes(userId) {
|
|
199
|
+
const result = [];
|
|
200
|
+
for (const mode of this.userModes.values()) {
|
|
201
|
+
if (mode.owner === userId) {
|
|
202
|
+
result.push(mode);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return result;
|
|
206
|
+
}
|
|
207
|
+
getUserMode(modeName, userId) {
|
|
208
|
+
const userKey = this.userModeKey(userId, modeName);
|
|
209
|
+
return this.userModes.get(userKey);
|
|
210
|
+
}
|
|
211
|
+
unregisterUserMode(modeName, userId) {
|
|
212
|
+
const userKey = this.userModeKey(userId, modeName);
|
|
213
|
+
return this.userModes.delete(userKey);
|
|
214
|
+
}
|
|
215
|
+
userModeKey(owner, name) {
|
|
216
|
+
return `${owner}:${name}`;
|
|
217
|
+
}
|
|
218
|
+
bumpPatchVersion(version) {
|
|
219
|
+
const parts = version.replace(/^v/, "").split(".");
|
|
220
|
+
if (parts.length < 2)
|
|
221
|
+
return `v${version}.1`;
|
|
222
|
+
const patch = parseInt(parts[1] ?? "0", 10);
|
|
223
|
+
parts[1] = String(patch + 1);
|
|
224
|
+
return `v${parts.join(".")}`;
|
|
225
|
+
}
|
|
226
|
+
applyTemplate(name, intent, context) {
|
|
227
|
+
const builtinMode = this.getMode(name);
|
|
228
|
+
if (builtinMode) {
|
|
229
|
+
const blueprint = this.doApplyTemplate(builtinMode, intent, context);
|
|
230
|
+
this.recordCapabilitiesUsed(builtinMode);
|
|
231
|
+
return blueprint;
|
|
232
|
+
}
|
|
233
|
+
if (name.includes(":")) {
|
|
234
|
+
const [owner, modeName] = name.split(":", 2);
|
|
235
|
+
const userMode = this.getUserMode(modeName, owner);
|
|
236
|
+
if (userMode) {
|
|
237
|
+
const blueprint = this.doApplyTemplate(userMode, intent, context);
|
|
238
|
+
this.recordCapabilitiesUsed(userMode);
|
|
239
|
+
return blueprint;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const general = this.getMode("general");
|
|
243
|
+
if (!general) {
|
|
244
|
+
throw new Error("IndustryMode 'general' not registered — cannot fallback");
|
|
245
|
+
}
|
|
246
|
+
const blueprint = this.doApplyTemplate(general, intent, context);
|
|
247
|
+
this.recordCapabilitiesUsed(general);
|
|
248
|
+
return blueprint;
|
|
249
|
+
}
|
|
250
|
+
applyUserMode(modeName, userId, intent, context) {
|
|
251
|
+
const userMode = this.getUserMode(modeName, userId);
|
|
252
|
+
if (!userMode) {
|
|
253
|
+
throw new Error(`User mode '${modeName}' not found for user '${userId}'`);
|
|
254
|
+
}
|
|
255
|
+
const blueprint = this.doApplyTemplate(userMode, intent, context);
|
|
256
|
+
this.recordCapabilitiesUsed(userMode);
|
|
257
|
+
return blueprint;
|
|
258
|
+
}
|
|
259
|
+
doApplyTemplate(mode, intent, context) {
|
|
260
|
+
let objects = this.buildObjects(mode, intent, context);
|
|
261
|
+
objects = this.applyConfigOverrides(mode, objects);
|
|
262
|
+
objects = this.applyConfigOverrideRules(mode, objects, intent, context);
|
|
263
|
+
const edges = this.buildEdges(objects, context);
|
|
264
|
+
const steps = this.buildSteps(objects, edges, context.network);
|
|
265
|
+
const scenarios = this.defaultScenarios(mode, intent, objects);
|
|
266
|
+
const validation = this.validateBlueprint(objects, edges, mode);
|
|
267
|
+
if (validation.errors.length > 0) {
|
|
268
|
+
throw new Error(`Blueprint validation for mode '${mode.name}' failed with ${validation.errors.length} CRITICAL error(s):\n` +
|
|
269
|
+
validation.errors.map((e, i) => ` ${i + 1}. ${e}`).join("\n"));
|
|
270
|
+
}
|
|
271
|
+
if (validation.warnings.length > 0) {
|
|
272
|
+
console.warn(`[IndustryModeRegistry] Blueprint validation for '${mode.name}' produced ${validation.warnings.length} warning(s):`, validation.warnings);
|
|
273
|
+
}
|
|
274
|
+
return {
|
|
275
|
+
context,
|
|
276
|
+
objects,
|
|
277
|
+
edges,
|
|
278
|
+
steps,
|
|
279
|
+
scenarios,
|
|
280
|
+
industry_source: mode.name,
|
|
281
|
+
applied_template: `${mode.name}@${mode.version}`,
|
|
282
|
+
validation,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
validateBlueprint(objects, edges, mode) {
|
|
286
|
+
const errors = [];
|
|
287
|
+
const warnings = [];
|
|
288
|
+
const machine = objects.find(o => o.object_type === "machine");
|
|
289
|
+
const service = objects.find(o => o.object_type === "service");
|
|
290
|
+
if (machine) {
|
|
291
|
+
const hint = machine.config.entry_node_forward_hint;
|
|
292
|
+
if (!hint) {
|
|
293
|
+
warnings.push("Machine blueprint missing entry_node_forward_hint. " +
|
|
294
|
+
"The AI must ensure the entry node (prev_node='') has ≥1 forward when constructing the Machine creation call (P0-2).");
|
|
295
|
+
}
|
|
296
|
+
else if (hint.required === true && !hint.example_forward) {
|
|
297
|
+
warnings.push("Machine entry_node_forward_hint marked required but example_forward is missing.");
|
|
298
|
+
}
|
|
299
|
+
const nodes = machine.config.nodes;
|
|
300
|
+
if (!nodes || nodes.length === 0) {
|
|
301
|
+
errors.push(`Machine blueprint has no nodes — mode '${mode.name}' machine_shape is empty. ` +
|
|
302
|
+
`Add nodes to the mode's machine_shape before applying template.`);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if (service) {
|
|
306
|
+
const compensationFundRef = service.config.compensation_fund;
|
|
307
|
+
if (compensationFundRef) {
|
|
308
|
+
errors.push(`Service blueprint has compensation_fund='${compensationFundRef}' (string reference). ` +
|
|
309
|
+
`BUG: compensation_fund is Balance<T> (numeric), NOT a Treasury object reference. ` +
|
|
310
|
+
`Remove compensation_fund field and use compensation_fund_balance + compensation_fund_add_hint instead. ` +
|
|
311
|
+
`Smart contract (service.move:179): compensation_fund: Balance<T>.`);
|
|
312
|
+
}
|
|
313
|
+
const balanceField = service.config.compensation_fund_balance;
|
|
314
|
+
if (balanceField === undefined) {
|
|
315
|
+
warnings.push("Service blueprint missing compensation_fund_balance. " +
|
|
316
|
+
"Should be 0 (initial Balance<T> state) — filled via service.compensation_fund_add(coin).");
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
const objectIds = new Set(objects.map(o => o.entry_id));
|
|
320
|
+
const objectNames = new Set(objects.map(o => o.name));
|
|
321
|
+
for (const edge of edges) {
|
|
322
|
+
const fromOk = objectIds.has(edge.from) || objectNames.has(edge.from);
|
|
323
|
+
const toOk = objectIds.has(edge.to) || objectNames.has(edge.to);
|
|
324
|
+
if (!fromOk || !toOk) {
|
|
325
|
+
errors.push(`Edge '${edge.from}' → '${edge.to}' (kind='${edge.edge_kind}') references undefined object. ` +
|
|
326
|
+
`from_exists=${fromOk}, to_exists=${toOk}.`);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return { errors, warnings };
|
|
330
|
+
}
|
|
331
|
+
buildObjects(mode, intent, context) {
|
|
332
|
+
const prefix = context.prefix;
|
|
333
|
+
const objects = [];
|
|
334
|
+
objects.push(this.makeObject("permission", `${prefix}_permission`, {
|
|
335
|
+
name: `${prefix}_permission`,
|
|
336
|
+
description: `Permission: role permission index (${mode.display_name})`,
|
|
337
|
+
permission_indexes: this.buildPermissionIndexes(mode),
|
|
338
|
+
tags: [`industry:${mode.name}`],
|
|
339
|
+
}));
|
|
340
|
+
const serviceGuardName = this.getFirstServiceGuardName(mode, prefix);
|
|
341
|
+
for (const guard of mode.guards) {
|
|
342
|
+
const shortName = this.deriveGuardShortName(guard.template_id);
|
|
343
|
+
const guardName = `${prefix}_guard_${shortName}`;
|
|
344
|
+
objects.push(this.makeObject("guard", guardName, {
|
|
345
|
+
name: guardName,
|
|
346
|
+
description: `Guard: ${guard.purpose} (${mode.display_name})`,
|
|
347
|
+
host: guard.host,
|
|
348
|
+
template_id: guard.template_id,
|
|
349
|
+
tags: [`industry:${mode.name}`, `host:${guard.host}`],
|
|
350
|
+
}));
|
|
351
|
+
}
|
|
352
|
+
objects.push(this.makeObject("machine", `${prefix}_machine`, {
|
|
353
|
+
name: `${prefix}_machine`,
|
|
354
|
+
description: `Machine: workflow topology (${mode.display_name}) — ${mode.machine_shape.length} nodes`,
|
|
355
|
+
nodes: mode.machine_shape.map(n => ({ name: n.name, role: n.role })),
|
|
356
|
+
guard_objects: mode.guards
|
|
357
|
+
.filter(g => g.host === "machine")
|
|
358
|
+
.map(g => ({
|
|
359
|
+
template_id: g.template_id,
|
|
360
|
+
object_name: `${prefix}_guard_${this.deriveGuardShortName(g.template_id)}`,
|
|
361
|
+
purpose: g.purpose,
|
|
362
|
+
})),
|
|
363
|
+
permission: `${prefix}_permission`,
|
|
364
|
+
entry_node_forward_hint: {
|
|
365
|
+
entry_node_name: mode.machine_shape[0]?.name ?? "paid",
|
|
366
|
+
required: true,
|
|
367
|
+
example_forward: {
|
|
368
|
+
next_node: mode.machine_shape[0]?.name ?? "paid",
|
|
369
|
+
namedOperator: "",
|
|
370
|
+
weight: 1,
|
|
371
|
+
},
|
|
372
|
+
reason: "Progress starts at current='' and follows the entry node's forwards. " +
|
|
373
|
+
"Without a forward, Progress is permanently stuck (P0-2). " +
|
|
374
|
+
"Schema refinement in MachineNodePairSchema enforces this at publish time.",
|
|
375
|
+
},
|
|
376
|
+
tags: [`industry:${mode.name}`],
|
|
377
|
+
}, true));
|
|
378
|
+
objects.push(this.makeObject("treasury", `${prefix}_treasury`, {
|
|
379
|
+
name: `${prefix}_treasury`,
|
|
380
|
+
description: `Treasury: fund escrow (${mode.display_name})`,
|
|
381
|
+
owner_receive: true,
|
|
382
|
+
tags: [`industry:${mode.name}`],
|
|
383
|
+
}));
|
|
384
|
+
objects.push(this.makeObject("allocation", `${prefix}_allocation`, {
|
|
385
|
+
name: `${prefix}_allocation`,
|
|
386
|
+
description: `Allocation: allocation strategy (${mode.display_name}) — ${mode.allocator.description}`,
|
|
387
|
+
strategy: mode.allocator,
|
|
388
|
+
treasury: `${prefix}_treasury`,
|
|
389
|
+
guard: serviceGuardName,
|
|
390
|
+
tags: [`industry:${mode.name}`],
|
|
391
|
+
}));
|
|
392
|
+
objects.push(this.makeObject("service", `${prefix}_service`, {
|
|
393
|
+
name: `${prefix}_service`,
|
|
394
|
+
description: `Service: business service (${mode.display_name}) — ${intent.slice(0, 100)}`,
|
|
395
|
+
machine: `${prefix}_machine`,
|
|
396
|
+
buy_guard: serviceGuardName,
|
|
397
|
+
permission: `${prefix}_permission`,
|
|
398
|
+
order_allocators: [`${prefix}_allocation`],
|
|
399
|
+
compensation_fund_balance: 0,
|
|
400
|
+
compensation_fund_required: mode.risk_constraints?.require_compensation_fund ?? false,
|
|
401
|
+
compensation_fund_coverage_ratio: mode.risk_constraints?.compensation_fund_coverage_ratio ?? 5,
|
|
402
|
+
compensation_fund_add_hint: "Call service.compensation_fund_add with a Coin<T> to deposit. " +
|
|
403
|
+
"The compensation_fund is a Balance<T> (numeric), not a Treasury object reference. " +
|
|
404
|
+
"Without deposit, arbitration rulings that award refunds to buyers cannot be paid out. " +
|
|
405
|
+
`Recommend ${mode.risk_constraints?.compensation_fund_coverage_ratio ?? 5}× the max single-order amount (P1-1 evaluation rule, industry: ${mode.name}).`,
|
|
406
|
+
arbitrations: [`${prefix}_arb`],
|
|
407
|
+
rewards: [`${prefix}_reward`],
|
|
408
|
+
business_intent: intent,
|
|
409
|
+
industry: mode.name,
|
|
410
|
+
tags: [`industry:${mode.name}`],
|
|
411
|
+
}, true));
|
|
412
|
+
objects.push(this.makeObject("progress", `${prefix}_progress`, {
|
|
413
|
+
name: `${prefix}_progress`,
|
|
414
|
+
description: `Progress: order fulfillment progress (${mode.display_name})`,
|
|
415
|
+
parent: `${prefix}_machine`,
|
|
416
|
+
tags: [`industry:${mode.name}`],
|
|
417
|
+
}));
|
|
418
|
+
objects.push(this.makeObject("arb", `${prefix}_arb`, {
|
|
419
|
+
name: `${prefix}_arb`,
|
|
420
|
+
description: `Arbitration: arbitration rules (${mode.display_name}) — ${mode.key_risk}`,
|
|
421
|
+
guard: `${prefix}_guard_buy`,
|
|
422
|
+
tags: [`industry:${mode.name}`],
|
|
423
|
+
}));
|
|
424
|
+
objects.push(this.makeObject("reward", `${prefix}_reward`, {
|
|
425
|
+
name: `${prefix}_reward`,
|
|
426
|
+
description: `Reward: incentive rules (${mode.display_name})`,
|
|
427
|
+
claim_guard: `${prefix}_guard_buy`,
|
|
428
|
+
tags: [`industry:${mode.name}`],
|
|
429
|
+
}));
|
|
430
|
+
objects.push(this.makeObject("contact", `${prefix}_contact`, {
|
|
431
|
+
name: `${prefix}_contact`,
|
|
432
|
+
description: `Contact: customer service contact (${mode.display_name})`,
|
|
433
|
+
tags: [`industry:${mode.name}`],
|
|
434
|
+
}));
|
|
435
|
+
return objects;
|
|
436
|
+
}
|
|
437
|
+
buildPermissionIndexes(mode) {
|
|
438
|
+
const permOverrides = mode.config_overrides?.["permission"];
|
|
439
|
+
if (permOverrides?.permission_indexes) {
|
|
440
|
+
return permOverrides.permission_indexes;
|
|
441
|
+
}
|
|
442
|
+
return [
|
|
443
|
+
{ name: "merchant", description: "Service owner / provider" },
|
|
444
|
+
{ name: "customer", description: "Service buyer / customer" },
|
|
445
|
+
{ name: "arbiter", description: "Arbitration arbiter" },
|
|
446
|
+
];
|
|
447
|
+
}
|
|
448
|
+
applyConfigOverrides(mode, objects) {
|
|
449
|
+
if (!mode.config_overrides)
|
|
450
|
+
return objects;
|
|
451
|
+
for (const obj of objects) {
|
|
452
|
+
const overrides = mode.config_overrides[obj.object_type];
|
|
453
|
+
if (overrides) {
|
|
454
|
+
for (const [key, value] of Object.entries(overrides)) {
|
|
455
|
+
obj.config[key] = value;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return objects;
|
|
460
|
+
}
|
|
461
|
+
applyConfigOverrideRules(mode, objects, intent, context) {
|
|
462
|
+
if (!mode.config_override_rules)
|
|
463
|
+
return objects;
|
|
464
|
+
for (const rule of mode.config_override_rules) {
|
|
465
|
+
const obj = objects.find(o => o.object_type === rule.object_type);
|
|
466
|
+
if (!obj)
|
|
467
|
+
continue;
|
|
468
|
+
let valueToApply;
|
|
469
|
+
if (rule.condition) {
|
|
470
|
+
const matched = this.evaluateCondition(rule, intent, context);
|
|
471
|
+
valueToApply = matched ? rule.condition.then_value : (rule.condition.else_value ?? rule.value);
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
valueToApply = rule.value;
|
|
475
|
+
}
|
|
476
|
+
if (valueToApply !== undefined) {
|
|
477
|
+
this.setNestedField(obj.config, rule.field_path, valueToApply);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return objects;
|
|
481
|
+
}
|
|
482
|
+
evaluateCondition(rule, intent, context) {
|
|
483
|
+
if (!rule.condition)
|
|
484
|
+
return false;
|
|
485
|
+
if (rule.condition.intent_contains) {
|
|
486
|
+
return intent.toLowerCase().includes(rule.condition.intent_contains.toLowerCase());
|
|
487
|
+
}
|
|
488
|
+
if (rule.condition.context_field && rule.condition.matches !== undefined) {
|
|
489
|
+
const fieldValue = context[rule.condition.context_field];
|
|
490
|
+
return fieldValue === rule.condition.matches;
|
|
491
|
+
}
|
|
492
|
+
return false;
|
|
493
|
+
}
|
|
494
|
+
setNestedField(obj, path, value) {
|
|
495
|
+
const parts = path.split(".");
|
|
496
|
+
let current = obj;
|
|
497
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
498
|
+
const part = parts[i];
|
|
499
|
+
if (current[part] === undefined || current[part] === null) {
|
|
500
|
+
current[part] = {};
|
|
501
|
+
}
|
|
502
|
+
current = current[part];
|
|
503
|
+
}
|
|
504
|
+
current[parts[parts.length - 1]] = value;
|
|
505
|
+
}
|
|
506
|
+
buildEdges(objects, context) {
|
|
507
|
+
const edges = [];
|
|
508
|
+
const find = (name) => objects.find(o => o.name === name);
|
|
509
|
+
const configPrefix = objects[0]?.config?.prefix;
|
|
510
|
+
const prefix = context?.prefix
|
|
511
|
+
?? (typeof configPrefix === "string" ? configPrefix : undefined)
|
|
512
|
+
?? objects[0]?.name.split("_")[0]
|
|
513
|
+
?? "";
|
|
514
|
+
const service = find(`${prefix}_service`);
|
|
515
|
+
const machine = find(`${prefix}_machine`);
|
|
516
|
+
const permission = find(`${prefix}_permission`);
|
|
517
|
+
const allocation = find(`${prefix}_allocation`);
|
|
518
|
+
const treasury = find(`${prefix}_treasury`);
|
|
519
|
+
const arb = find(`${prefix}_arb`);
|
|
520
|
+
const reward = find(`${prefix}_reward`);
|
|
521
|
+
const progress = find(`${prefix}_progress`);
|
|
522
|
+
const allGuards = objects.filter(o => o.object_type === "guard");
|
|
523
|
+
const serviceGuard = allGuards.find(g => g.config?.host === "service");
|
|
524
|
+
const machineGuards = allGuards.filter(g => g.config?.host === "machine");
|
|
525
|
+
if (!service || !machine || !permission) {
|
|
526
|
+
const missing = [];
|
|
527
|
+
if (!service)
|
|
528
|
+
missing.push("service");
|
|
529
|
+
if (!machine)
|
|
530
|
+
missing.push("machine");
|
|
531
|
+
if (!permission)
|
|
532
|
+
missing.push("permission");
|
|
533
|
+
console.warn(`[buildEdges] Missing core objects: ${missing.join(", ")}. ` +
|
|
534
|
+
`Edges will be empty (prefix='${prefix}'). ` +
|
|
535
|
+
`Check buildObjects output or context.prefix.`);
|
|
536
|
+
return edges;
|
|
537
|
+
}
|
|
538
|
+
edges.push(this.makeEdge(service, machine, "machine", "service.machine", true));
|
|
539
|
+
if (serviceGuard) {
|
|
540
|
+
edges.push(this.makeEdge(service, serviceGuard, "buy_guard", "service.buy_guard", true));
|
|
541
|
+
}
|
|
542
|
+
edges.push(this.makeEdge(service, permission, "permission", "service.permission", true));
|
|
543
|
+
if (allocation)
|
|
544
|
+
edges.push(this.makeEdge(service, allocation, "order_allocators", "service.order_allocators", true));
|
|
545
|
+
if (arb)
|
|
546
|
+
edges.push(this.makeEdge(service, arb, "arbitrations", "service.arbitrations", false));
|
|
547
|
+
if (reward)
|
|
548
|
+
edges.push(this.makeEdge(service, reward, "rewards", "service.rewards", false));
|
|
549
|
+
edges.push(this.makeEdge(machine, permission, "permission", "machine.permission", false));
|
|
550
|
+
for (const mg of machineGuards) {
|
|
551
|
+
edges.push(this.makeEdge(machine, mg, "guard", "machine.forwards.guard", false));
|
|
552
|
+
}
|
|
553
|
+
if (progress)
|
|
554
|
+
edges.push(this.makeEdge(progress, machine, "parent", "progress.parent", false));
|
|
555
|
+
if (allocation && treasury)
|
|
556
|
+
edges.push(this.makeEdge(allocation, treasury, "treasury", "allocation.treasury", false));
|
|
557
|
+
if (allocation && serviceGuard)
|
|
558
|
+
edges.push(this.makeEdge(allocation, serviceGuard, "buy_guard", "allocation.guard", false));
|
|
559
|
+
return edges;
|
|
560
|
+
}
|
|
561
|
+
makeEdge(from, to, edge_kind, field_path, required_at_publish) {
|
|
562
|
+
return {
|
|
563
|
+
from: from.entry_id,
|
|
564
|
+
to: to.entry_id,
|
|
565
|
+
edge_kind,
|
|
566
|
+
field_path,
|
|
567
|
+
required_at_publish,
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
buildSteps(objects, edges, network) {
|
|
571
|
+
const order = [
|
|
572
|
+
"permission", "guard", "machine", "treasury", "allocation",
|
|
573
|
+
"arb", "reward", "contact", "service", "progress",
|
|
574
|
+
];
|
|
575
|
+
const steps = [];
|
|
576
|
+
const entryToStep = new Map();
|
|
577
|
+
let stepNum = 1;
|
|
578
|
+
for (const type of order) {
|
|
579
|
+
const obj = objects.find(o => o.object_type === type);
|
|
580
|
+
if (!obj)
|
|
581
|
+
continue;
|
|
582
|
+
const depends = [];
|
|
583
|
+
for (const edge of edges) {
|
|
584
|
+
if (edge.to === obj.entry_id) {
|
|
585
|
+
const depStep = entryToStep.get(edge.from);
|
|
586
|
+
if (depStep !== undefined) {
|
|
587
|
+
depends.push(depStep);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
const operation = obj.publish_required ? "publish" : "create";
|
|
592
|
+
steps.push({
|
|
593
|
+
step: stepNum,
|
|
594
|
+
object_type: obj.object_type,
|
|
595
|
+
operation,
|
|
596
|
+
substep_count: 1,
|
|
597
|
+
depends_on: depends,
|
|
598
|
+
entry_id: obj.entry_id,
|
|
599
|
+
network_phase: network,
|
|
600
|
+
});
|
|
601
|
+
entryToStep.set(obj.entry_id, stepNum);
|
|
602
|
+
stepNum++;
|
|
603
|
+
}
|
|
604
|
+
return steps;
|
|
605
|
+
}
|
|
606
|
+
defaultScenarios(mode, intent, objects) {
|
|
607
|
+
const service = objects.find(o => o.object_type === "service");
|
|
608
|
+
return [{
|
|
609
|
+
scenario_id: `${mode.name}_primary`,
|
|
610
|
+
description: `${mode.display_name} main flow: ${intent.slice(0, 80)}`,
|
|
611
|
+
primary_object: service?.entry_id ?? "",
|
|
612
|
+
supporting_objects: objects.filter(o => o.object_type !== "service").map(o => o.entry_id),
|
|
613
|
+
}];
|
|
614
|
+
}
|
|
615
|
+
recordCapabilitiesUsed(mode) {
|
|
616
|
+
if (!mode.capabilities_used)
|
|
617
|
+
return;
|
|
618
|
+
try {
|
|
619
|
+
const registry = CapabilityRegistry.Instance();
|
|
620
|
+
for (const capId of mode.capabilities_used) {
|
|
621
|
+
registry.recordUsage(capId, mode.name);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
catch {
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
deriveGuardShortName(templateId) {
|
|
628
|
+
if (templateId.startsWith("tpl_")) {
|
|
629
|
+
const parts = templateId.split("_");
|
|
630
|
+
return parts[parts.length - 1] || templateId;
|
|
631
|
+
}
|
|
632
|
+
const match = templateId.match(/^([a-z]+)_guard_/);
|
|
633
|
+
if (match)
|
|
634
|
+
return match[1];
|
|
635
|
+
return templateId.split("_")[0] || templateId;
|
|
636
|
+
}
|
|
637
|
+
getFirstServiceGuardName(mode, prefix) {
|
|
638
|
+
const serviceGuard = mode.guards.find(g => g.host === "service");
|
|
639
|
+
if (!serviceGuard)
|
|
640
|
+
return "";
|
|
641
|
+
return `${prefix}_guard_${this.deriveGuardShortName(serviceGuard.template_id)}`;
|
|
642
|
+
}
|
|
643
|
+
makeObject(type, name, config, publish_required = false) {
|
|
644
|
+
return {
|
|
645
|
+
entry_id: `${type}:${name}`,
|
|
646
|
+
object_type: type,
|
|
647
|
+
name,
|
|
648
|
+
config,
|
|
649
|
+
publish_required,
|
|
650
|
+
status: "draft",
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
registerBuiltinModes() {
|
|
654
|
+
for (const mode of BUILTIN_MODES) {
|
|
655
|
+
this.registerMode(mode);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
export function getIndustryModeRegistry() {
|
|
660
|
+
return IndustryModeRegistry.Instance();
|
|
661
|
+
}
|
|
662
|
+
export const INDUSTRY_MODE_REGISTRY_VERSION = 2.1;
|