@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
|
@@ -229,6 +229,14 @@ export class CapabilityRegistry {
|
|
|
229
229
|
},
|
|
230
230
|
observed_in_industries: {}, success_count: 0, failure_count: 0, known_failure_modes: [],
|
|
231
231
|
depends_on_capabilities: [], version: "v1",
|
|
232
|
+
risk_profile: {
|
|
233
|
+
funds_risk: "low", trust_risk: "low", delivery_risk: "low", compliance_risk: "low",
|
|
234
|
+
known_risks: ["Index proliferation without naming convention makes permission audits harder"],
|
|
235
|
+
},
|
|
236
|
+
benefit_profile: {
|
|
237
|
+
automation_level: "medium", trust_boost: "high", efficiency_gain: "medium",
|
|
238
|
+
benefits: ["Role-based governance foundation for all other objects"],
|
|
239
|
+
},
|
|
232
240
|
});
|
|
233
241
|
this.registerCard({
|
|
234
242
|
capability_id: "permission.role_assign",
|
|
@@ -239,6 +247,14 @@ export class CapabilityRegistry {
|
|
|
239
247
|
config_template: { target_object: "<obj>", role: "<role_name>" },
|
|
240
248
|
observed_in_industries: {}, success_count: 0, failure_count: 0, known_failure_modes: [],
|
|
241
249
|
depends_on_capabilities: ["permission.index_create"], version: "v1",
|
|
250
|
+
risk_profile: {
|
|
251
|
+
funds_risk: "low", trust_risk: "medium", delivery_risk: "low", compliance_risk: "low",
|
|
252
|
+
known_risks: ["Mis-assigned role grants unintended operational authority"],
|
|
253
|
+
},
|
|
254
|
+
benefit_profile: {
|
|
255
|
+
automation_level: "high", trust_boost: "high", efficiency_gain: "medium",
|
|
256
|
+
benefits: ["Binds governance roles to concrete objects"],
|
|
257
|
+
},
|
|
242
258
|
});
|
|
243
259
|
this.registerCard({
|
|
244
260
|
capability_id: "guard.validate_buy",
|
|
@@ -254,6 +270,14 @@ export class CapabilityRegistry {
|
|
|
254
270
|
},
|
|
255
271
|
observed_in_industries: {}, success_count: 0, failure_count: 0, known_failure_modes: [],
|
|
256
272
|
depends_on_capabilities: ["permission.index_create"], version: "v1",
|
|
273
|
+
risk_profile: {
|
|
274
|
+
funds_risk: "low", trust_risk: "medium", delivery_risk: "medium", compliance_risk: "low",
|
|
275
|
+
known_risks: ["Over-strict buy validation blocks legitimate orders; over-loose validation admits fraud"],
|
|
276
|
+
},
|
|
277
|
+
benefit_profile: {
|
|
278
|
+
automation_level: "high", trust_boost: "high", efficiency_gain: "high",
|
|
279
|
+
benefits: ["Automated purchase gating without manual review"],
|
|
280
|
+
},
|
|
257
281
|
});
|
|
258
282
|
this.registerCard({
|
|
259
283
|
capability_id: "guard.validate_wip_hash",
|
|
@@ -268,6 +292,14 @@ export class CapabilityRegistry {
|
|
|
268
292
|
observed_in_industries: {}, success_count: 0, failure_count: 0,
|
|
269
293
|
known_failure_modes: ["milestone mode requires WIP hash evidence — without WIP, allocation cannot advance"],
|
|
270
294
|
depends_on_capabilities: ["guard.validate_buy"], version: "v1",
|
|
295
|
+
risk_profile: {
|
|
296
|
+
funds_risk: "low", trust_risk: "medium", delivery_risk: "high", compliance_risk: "low",
|
|
297
|
+
known_risks: ["Wrong hash algorithm or field mapping stalls milestone release"],
|
|
298
|
+
},
|
|
299
|
+
benefit_profile: {
|
|
300
|
+
automation_level: "high", trust_boost: "medium", efficiency_gain: "medium",
|
|
301
|
+
benefits: ["Tamper-proof delivery evidence for digital deliverables"],
|
|
302
|
+
},
|
|
271
303
|
});
|
|
272
304
|
this.registerCard({
|
|
273
305
|
capability_id: "machine.node_topology",
|
|
@@ -279,9 +311,9 @@ export class CapabilityRegistry {
|
|
|
279
311
|
nodes: [
|
|
280
312
|
{ name: "paid", role: "Entry: order created and paid" },
|
|
281
313
|
{ name: "delivering", role: "Service delivery in progress" },
|
|
314
|
+
{ name: "delivered", role: "Deliverable available for review" },
|
|
282
315
|
{ name: "completed", role: "Service completed, funds released" },
|
|
283
|
-
{ name: "
|
|
284
|
-
{ name: "cancelled", role: "Pre-delivery cancellation" },
|
|
316
|
+
{ name: "cancelled", role: "Pre-delivery cancellation — triggers refund Allocator" },
|
|
285
317
|
],
|
|
286
318
|
},
|
|
287
319
|
industry_overrides: {
|
|
@@ -291,7 +323,7 @@ export class CapabilityRegistry {
|
|
|
291
323
|
{ name: "delivered", role: "Goods delivered" },
|
|
292
324
|
{ name: "confirmed", role: "Buyer confirms receipt" },
|
|
293
325
|
{ name: "completed", role: "Funds released" },
|
|
294
|
-
{ name: "
|
|
326
|
+
{ name: "returned", role: "Buyer ships goods back — triggers refund Allocator (R-M1-11)" },
|
|
295
327
|
{ name: "cancelled", role: "Pre-ship cancellation" },
|
|
296
328
|
] },
|
|
297
329
|
freelance: { nodes: [
|
|
@@ -301,12 +333,19 @@ export class CapabilityRegistry {
|
|
|
301
333
|
{ name: "accepted", role: "Buyer accepts deliverable" },
|
|
302
334
|
{ name: "completed", role: "Funds released" },
|
|
303
335
|
{ name: "revision", role: "Revision requested" },
|
|
304
|
-
{ name: "
|
|
305
|
-
{ name: "cancelled", role: "Pre-start cancellation" },
|
|
336
|
+
{ name: "cancelled", role: "Pre-start cancellation — triggers refund Allocator (R-M1-11)" },
|
|
306
337
|
] },
|
|
307
338
|
},
|
|
308
339
|
observed_in_industries: {}, success_count: 0, failure_count: 0, known_failure_modes: [],
|
|
309
340
|
depends_on_capabilities: ["permission.index_create"], version: "v1",
|
|
341
|
+
risk_profile: {
|
|
342
|
+
funds_risk: "low", trust_risk: "medium", delivery_risk: "high", compliance_risk: "low",
|
|
343
|
+
known_risks: ["Dead-end nodes or missing refund paths trap order funds"],
|
|
344
|
+
},
|
|
345
|
+
benefit_profile: {
|
|
346
|
+
automation_level: "medium", trust_boost: "medium", efficiency_gain: "high",
|
|
347
|
+
benefits: ["Declarative workflow from order creation to completion"],
|
|
348
|
+
},
|
|
310
349
|
});
|
|
311
350
|
this.registerCard({
|
|
312
351
|
capability_id: "treasury.owner_receive",
|
|
@@ -317,6 +356,14 @@ export class CapabilityRegistry {
|
|
|
317
356
|
config_template: { owner_receive: true },
|
|
318
357
|
observed_in_industries: {}, success_count: 0, failure_count: 0, known_failure_modes: [],
|
|
319
358
|
depends_on_capabilities: [], version: "v1",
|
|
359
|
+
risk_profile: {
|
|
360
|
+
funds_risk: "high", trust_risk: "medium", delivery_risk: "low", compliance_risk: "low",
|
|
361
|
+
known_risks: ["Direct fund custody — misconfigured owner diverts all proceeds"],
|
|
362
|
+
},
|
|
363
|
+
benefit_profile: {
|
|
364
|
+
automation_level: "high", trust_boost: "medium", efficiency_gain: "medium",
|
|
365
|
+
benefits: ["Automated escrow and owner settlement"],
|
|
366
|
+
},
|
|
320
367
|
});
|
|
321
368
|
this.registerCard({
|
|
322
369
|
capability_id: "allocation.distribute",
|
|
@@ -335,6 +382,14 @@ export class CapabilityRegistry {
|
|
|
335
382
|
observed_in_industries: {}, success_count: 0, failure_count: 0,
|
|
336
383
|
known_failure_modes: ["milestone mode requires WIP hash evidence — without WIP, allocation cannot advance"],
|
|
337
384
|
depends_on_capabilities: ["treasury.owner_receive", "guard.validate_buy"], version: "v1",
|
|
385
|
+
risk_profile: {
|
|
386
|
+
funds_risk: "high", trust_risk: "low", delivery_risk: "medium", compliance_risk: "low",
|
|
387
|
+
known_risks: ["Wrong split ratios or recipient addresses misdirect settlement funds"],
|
|
388
|
+
},
|
|
389
|
+
benefit_profile: {
|
|
390
|
+
automation_level: "high", trust_boost: "medium", efficiency_gain: "high",
|
|
391
|
+
benefits: ["Multi-recipient settlement without manual transfers"],
|
|
392
|
+
},
|
|
338
393
|
});
|
|
339
394
|
this.registerCard({
|
|
340
395
|
capability_id: "allocation.distribute_milestone",
|
|
@@ -351,6 +406,14 @@ export class CapabilityRegistry {
|
|
|
351
406
|
},
|
|
352
407
|
observed_in_industries: {}, success_count: 0, failure_count: 0, known_failure_modes: [],
|
|
353
408
|
depends_on_capabilities: ["allocation.distribute", "guard.validate_wip_hash"], version: "v1",
|
|
409
|
+
risk_profile: {
|
|
410
|
+
funds_risk: "high", trust_risk: "medium", delivery_risk: "medium", compliance_risk: "low",
|
|
411
|
+
known_risks: ["Stuck milestone gates lock buyer funds until evidence is supplied"],
|
|
412
|
+
},
|
|
413
|
+
benefit_profile: {
|
|
414
|
+
automation_level: "medium", trust_boost: "high", efficiency_gain: "medium",
|
|
415
|
+
benefits: ["Evidence-gated release protects both buyer and provider"],
|
|
416
|
+
},
|
|
354
417
|
});
|
|
355
418
|
this.registerCard({
|
|
356
419
|
capability_id: "service.publish",
|
|
@@ -372,6 +435,14 @@ export class CapabilityRegistry {
|
|
|
372
435
|
"allocation.distribute", "treasury.owner_receive",
|
|
373
436
|
],
|
|
374
437
|
version: "v1",
|
|
438
|
+
risk_profile: {
|
|
439
|
+
funds_risk: "medium", trust_risk: "medium", delivery_risk: "medium", compliance_risk: "medium",
|
|
440
|
+
known_risks: ["Publish freezes machine binding and order_allocators permanently (E_ALREADY_PUBLISHED)"],
|
|
441
|
+
},
|
|
442
|
+
benefit_profile: {
|
|
443
|
+
automation_level: "medium", trust_boost: "medium", efficiency_gain: "medium",
|
|
444
|
+
benefits: ["On-chain discoverability and order intake"],
|
|
445
|
+
},
|
|
375
446
|
});
|
|
376
447
|
this.registerCard({
|
|
377
448
|
capability_id: "progress.advance",
|
|
@@ -382,6 +453,14 @@ export class CapabilityRegistry {
|
|
|
382
453
|
config_template: { parent: "<machine_name>" },
|
|
383
454
|
observed_in_industries: {}, success_count: 0, failure_count: 0, known_failure_modes: [],
|
|
384
455
|
depends_on_capabilities: ["machine.node_topology"], version: "v1",
|
|
456
|
+
risk_profile: {
|
|
457
|
+
funds_risk: "medium", trust_risk: "low", delivery_risk: "high", compliance_risk: "low",
|
|
458
|
+
known_risks: ["Forward without authorized executor permanently stalls the order"],
|
|
459
|
+
},
|
|
460
|
+
benefit_profile: {
|
|
461
|
+
automation_level: "high", trust_boost: "medium", efficiency_gain: "high",
|
|
462
|
+
benefits: ["Deterministic order state progression"],
|
|
463
|
+
},
|
|
385
464
|
});
|
|
386
465
|
this.registerCard({
|
|
387
466
|
capability_id: "arb.vote_weighted",
|
|
@@ -392,6 +471,14 @@ export class CapabilityRegistry {
|
|
|
392
471
|
config_template: { guard: "<guard_name>", voting_rule: "guard_weighted" },
|
|
393
472
|
observed_in_industries: {}, success_count: 0, failure_count: 0, known_failure_modes: [],
|
|
394
473
|
depends_on_capabilities: ["guard.validate_buy"], version: "v1",
|
|
474
|
+
risk_profile: {
|
|
475
|
+
funds_risk: "low", trust_risk: "high", delivery_risk: "medium", compliance_risk: "medium",
|
|
476
|
+
known_risks: ["Shared permission with Service destroys dispute independence (E_ARBITRATION_PERMISSION_CONFLICT)"],
|
|
477
|
+
},
|
|
478
|
+
benefit_profile: {
|
|
479
|
+
automation_level: "medium", trust_boost: "high", efficiency_gain: "low",
|
|
480
|
+
benefits: ["Neutral third-party dispute resolution"],
|
|
481
|
+
},
|
|
395
482
|
});
|
|
396
483
|
this.registerCard({
|
|
397
484
|
capability_id: "reward.claim_guard",
|
|
@@ -402,6 +489,14 @@ export class CapabilityRegistry {
|
|
|
402
489
|
config_template: { claim_guard: "<guard_name>", max_guard_count: 1 },
|
|
403
490
|
observed_in_industries: {}, success_count: 0, failure_count: 0, known_failure_modes: [],
|
|
404
491
|
depends_on_capabilities: ["guard.validate_buy"], version: "v1",
|
|
492
|
+
risk_profile: {
|
|
493
|
+
funds_risk: "medium", trust_risk: "low", delivery_risk: "low", compliance_risk: "low",
|
|
494
|
+
known_risks: ["Loose claim conditions drain the reward pool"],
|
|
495
|
+
},
|
|
496
|
+
benefit_profile: {
|
|
497
|
+
automation_level: "high", trust_boost: "medium", efficiency_gain: "medium",
|
|
498
|
+
benefits: ["Incentivizes reviews and repurchase"],
|
|
499
|
+
},
|
|
405
500
|
});
|
|
406
501
|
this.registerCard({
|
|
407
502
|
capability_id: "contact.im_create",
|
|
@@ -412,6 +507,14 @@ export class CapabilityRegistry {
|
|
|
412
507
|
config_template: {},
|
|
413
508
|
observed_in_industries: {}, success_count: 0, failure_count: 0, known_failure_modes: [],
|
|
414
509
|
depends_on_capabilities: [], version: "v1",
|
|
510
|
+
risk_profile: {
|
|
511
|
+
funds_risk: "low", trust_risk: "low", delivery_risk: "low", compliance_risk: "low",
|
|
512
|
+
known_risks: ["Unattended IM channel degrades dispute response time"],
|
|
513
|
+
},
|
|
514
|
+
benefit_profile: {
|
|
515
|
+
automation_level: "medium", trust_boost: "medium", efficiency_gain: "medium",
|
|
516
|
+
benefits: ["Direct buyer-seller encrypted communication"],
|
|
517
|
+
},
|
|
415
518
|
});
|
|
416
519
|
this.registerCard({
|
|
417
520
|
capability_id: "demand.matching",
|
|
@@ -422,6 +525,14 @@ export class CapabilityRegistry {
|
|
|
422
525
|
config_template: {},
|
|
423
526
|
observed_in_industries: {}, success_count: 0, failure_count: 0, known_failure_modes: [],
|
|
424
527
|
depends_on_capabilities: ["service.publish"], version: "v1",
|
|
528
|
+
risk_profile: {
|
|
529
|
+
funds_risk: "low", trust_risk: "low", delivery_risk: "low", compliance_risk: "low",
|
|
530
|
+
known_risks: ["Poor matching signals bury quality services"],
|
|
531
|
+
},
|
|
532
|
+
benefit_profile: {
|
|
533
|
+
automation_level: "medium", trust_boost: "low", efficiency_gain: "medium",
|
|
534
|
+
benefits: ["Demand-side discovery channel"],
|
|
535
|
+
},
|
|
425
536
|
});
|
|
426
537
|
this.registerCard({
|
|
427
538
|
capability_id: "repository.write_validate",
|
|
@@ -432,6 +543,14 @@ export class CapabilityRegistry {
|
|
|
432
543
|
config_template: {},
|
|
433
544
|
observed_in_industries: {}, success_count: 0, failure_count: 0, known_failure_modes: [],
|
|
434
545
|
depends_on_capabilities: ["guard.validate_buy"], version: "v1",
|
|
546
|
+
risk_profile: {
|
|
547
|
+
funds_risk: "low", trust_risk: "medium", delivery_risk: "low", compliance_risk: "medium",
|
|
548
|
+
known_risks: ["Unvalidated writes pollute the knowledge base with unverifiable claims"],
|
|
549
|
+
},
|
|
550
|
+
benefit_profile: {
|
|
551
|
+
automation_level: "medium", trust_boost: "high", efficiency_gain: "medium",
|
|
552
|
+
benefits: ["Guard-gated attestation for off-chain data"],
|
|
553
|
+
},
|
|
435
554
|
});
|
|
436
555
|
this.registerCard({
|
|
437
556
|
capability_id: "proof.evidence_anchor",
|
|
@@ -442,6 +561,14 @@ export class CapabilityRegistry {
|
|
|
442
561
|
config_template: {},
|
|
443
562
|
observed_in_industries: {}, success_count: 0, failure_count: 0, known_failure_modes: [],
|
|
444
563
|
depends_on_capabilities: ["progress.advance"], version: "v1",
|
|
564
|
+
risk_profile: {
|
|
565
|
+
funds_risk: "low", trust_risk: "medium", delivery_risk: "low", compliance_risk: "low",
|
|
566
|
+
known_risks: ["Anchored evidence is immutable — wrong hash cannot be corrected"],
|
|
567
|
+
},
|
|
568
|
+
benefit_profile: {
|
|
569
|
+
automation_level: "high", trust_boost: "high", efficiency_gain: "medium",
|
|
570
|
+
benefits: ["Immutable WTS evidence for Messenger confirmations"],
|
|
571
|
+
},
|
|
445
572
|
});
|
|
446
573
|
this.registerCard({
|
|
447
574
|
capability_id: "personal.profile_manage",
|
|
@@ -452,6 +579,14 @@ export class CapabilityRegistry {
|
|
|
452
579
|
config_template: {},
|
|
453
580
|
observed_in_industries: {}, success_count: 0, failure_count: 0, known_failure_modes: [],
|
|
454
581
|
depends_on_capabilities: [], version: "v1",
|
|
582
|
+
risk_profile: {
|
|
583
|
+
funds_risk: "low", trust_risk: "low", delivery_risk: "low", compliance_risk: "medium",
|
|
584
|
+
known_risks: ["Profile data may fall under privacy regulation (PII)"],
|
|
585
|
+
},
|
|
586
|
+
benefit_profile: {
|
|
587
|
+
automation_level: "medium", trust_boost: "low", efficiency_gain: "low",
|
|
588
|
+
benefits: ["Portable user identity across services"],
|
|
589
|
+
},
|
|
455
590
|
});
|
|
456
591
|
this.registerCard({
|
|
457
592
|
capability_id: "payment.settle",
|
|
@@ -462,6 +597,58 @@ export class CapabilityRegistry {
|
|
|
462
597
|
config_template: {},
|
|
463
598
|
observed_in_industries: {}, success_count: 0, failure_count: 0, known_failure_modes: [],
|
|
464
599
|
depends_on_capabilities: ["allocation.distribute", "treasury.owner_receive"], version: "v1",
|
|
600
|
+
risk_profile: {
|
|
601
|
+
funds_risk: "high", trust_risk: "low", delivery_risk: "low", compliance_risk: "medium",
|
|
602
|
+
known_risks: ["Settlement errors are irreversible once funds transfer"],
|
|
603
|
+
},
|
|
604
|
+
benefit_profile: {
|
|
605
|
+
automation_level: "high", trust_boost: "low", efficiency_gain: "high",
|
|
606
|
+
benefits: ["Atomic settlement in collaboration with Allocation"],
|
|
607
|
+
},
|
|
608
|
+
});
|
|
609
|
+
this.registerCard({
|
|
610
|
+
capability_id: "guard.validate_withdraw",
|
|
611
|
+
display_name: "Guard Validate Withdraw",
|
|
612
|
+
description: "Withdrawal validation: gate fund release from Allocation escrow on delivery confirmation",
|
|
613
|
+
object_type: "guard", module: "handler", category: "validation",
|
|
614
|
+
industry_agnostic: "medium",
|
|
615
|
+
config_template: { host: "service", templates: ["tpl_withdraw_on_completed"] },
|
|
616
|
+
industry_overrides: {
|
|
617
|
+
retail_d2c: { templates: ["tpl_withdraw_on_completed"] },
|
|
618
|
+
},
|
|
619
|
+
observed_in_industries: {}, success_count: 0, failure_count: 0,
|
|
620
|
+
known_failure_modes: ["Withdraw gate on wrong node lets merchant pull funds before delivery"],
|
|
621
|
+
depends_on_capabilities: ["allocation.distribute"], version: "v1",
|
|
622
|
+
risk_profile: {
|
|
623
|
+
funds_risk: "high", trust_risk: "medium", delivery_risk: "medium", compliance_risk: "low",
|
|
624
|
+
known_risks: ["Mis-gated withdrawal releases escrowed funds prematurely"],
|
|
625
|
+
},
|
|
626
|
+
benefit_profile: {
|
|
627
|
+
automation_level: "high", trust_boost: "high", efficiency_gain: "high",
|
|
628
|
+
benefits: ["Contract-enforced delivery gate replaces platform custody"],
|
|
629
|
+
},
|
|
630
|
+
});
|
|
631
|
+
this.registerCard({
|
|
632
|
+
capability_id: "guard.validate_refund",
|
|
633
|
+
display_name: "Guard Validate Refund",
|
|
634
|
+
description: "Refund validation: gate buyer refund on cancellation or return conditions",
|
|
635
|
+
object_type: "guard", module: "handler", category: "validation",
|
|
636
|
+
industry_agnostic: "medium",
|
|
637
|
+
config_template: { host: "service", templates: ["tpl_refund_on_cancelled"] },
|
|
638
|
+
industry_overrides: {
|
|
639
|
+
retail_d2c: { templates: ["tpl_refund_on_cancelled"] },
|
|
640
|
+
},
|
|
641
|
+
observed_in_industries: {}, success_count: 0, failure_count: 0,
|
|
642
|
+
known_failure_modes: ["Missing refund path on pre-delivery cancellation traps buyer funds"],
|
|
643
|
+
depends_on_capabilities: ["guard.validate_buy"], version: "v1",
|
|
644
|
+
risk_profile: {
|
|
645
|
+
funds_risk: "medium", trust_risk: "medium", delivery_risk: "medium", compliance_risk: "low",
|
|
646
|
+
known_risks: ["Over-broad refund conditions enable buyer abuse"],
|
|
647
|
+
},
|
|
648
|
+
benefit_profile: {
|
|
649
|
+
automation_level: "high", trust_boost: "high", efficiency_gain: "high",
|
|
650
|
+
benefits: ["Trustless buyer refund without merchant approval"],
|
|
651
|
+
},
|
|
465
652
|
});
|
|
466
653
|
}
|
|
467
654
|
registerBuiltinEdges() {
|
|
@@ -92,7 +92,9 @@ export class ConstraintRegistry {
|
|
|
92
92
|
return this.constraints.delete(constraint_id);
|
|
93
93
|
}
|
|
94
94
|
checkConstraints(mode, _capabilityRegistry, extraConstraints) {
|
|
95
|
-
const
|
|
95
|
+
const disabled = new Set(mode.disabled_builtin_constraints ?? []);
|
|
96
|
+
const allConstraints = [...this.constraints.values()]
|
|
97
|
+
.filter(c => !(c.scope === "builtin" && disabled.has(c.constraint_id)));
|
|
96
98
|
if (extraConstraints) {
|
|
97
99
|
for (const c of extraConstraints) {
|
|
98
100
|
if (!allConstraints.some(existing => existing.constraint_id === c.constraint_id)) {
|
package/dist/extensions/modes.js
CHANGED
|
@@ -25,9 +25,9 @@ const GENERAL_FLYWHEEL = {
|
|
|
25
25
|
const GENERAL_MACHINE_SHAPE = [
|
|
26
26
|
{ name: "paid", role: "Entry: order created and paid" },
|
|
27
27
|
{ name: "delivering", role: "Service delivery in progress" },
|
|
28
|
+
{ name: "delivered", role: "Deliverable available for review" },
|
|
28
29
|
{ name: "completed", role: "Service completed, funds released" },
|
|
29
|
-
{ name: "
|
|
30
|
-
{ name: "cancelled", role: "Pre-delivery cancellation" },
|
|
30
|
+
{ name: "cancelled", role: "Pre-delivery cancellation — triggers refund Allocator" },
|
|
31
31
|
];
|
|
32
32
|
const GENERAL_ALLOCATOR = {
|
|
33
33
|
recipient: "signer",
|
|
@@ -41,8 +41,8 @@ const RETAIL_MACHINE_SHAPE = [
|
|
|
41
41
|
{ name: "delivered", role: "Goods delivered to buyer" },
|
|
42
42
|
{ name: "confirmed", role: "Buyer confirms receipt" },
|
|
43
43
|
{ name: "completed", role: "Funds released to merchant" },
|
|
44
|
-
{ name: "
|
|
45
|
-
{ name: "cancelled", role: "Pre-ship cancellation" },
|
|
44
|
+
{ name: "returned", role: "Buyer ships goods back — triggers refund Allocator (R-M1-11 compliant)" },
|
|
45
|
+
{ name: "cancelled", role: "Pre-ship cancellation — triggers refund Allocator" },
|
|
46
46
|
];
|
|
47
47
|
const RETAIL_GUARDS = [
|
|
48
48
|
{ template_id: "buy_guard_inventory", host: "service", purpose: "Verify inventory and buyer address on purchase" },
|
|
@@ -187,6 +187,7 @@ export const BUILTIN_MODES = [
|
|
|
187
187
|
},
|
|
188
188
|
similar_industries: ["rental", "education"],
|
|
189
189
|
novel_capabilities: ["allocation.distribute_milestone"],
|
|
190
|
+
disabled_builtin_constraints: ["require_compensation_fund"],
|
|
190
191
|
},
|
|
191
192
|
{
|
|
192
193
|
name: "rental",
|
|
@@ -275,6 +276,7 @@ export const BUILTIN_MODES = [
|
|
|
275
276
|
},
|
|
276
277
|
similar_industries: ["freelance", "subscription"],
|
|
277
278
|
novel_capabilities: ["allocation.distribute_milestone"],
|
|
279
|
+
disabled_builtin_constraints: ["require_wip_evidence"],
|
|
278
280
|
},
|
|
279
281
|
{
|
|
280
282
|
name: "travel",
|
|
@@ -368,6 +370,7 @@ export const BUILTIN_MODES = [
|
|
|
368
370
|
},
|
|
369
371
|
similar_industries: ["freelance", "education"],
|
|
370
372
|
novel_capabilities: [],
|
|
373
|
+
disabled_builtin_constraints: ["require_arbitration", "require_compensation_fund", "require_wip_evidence"],
|
|
371
374
|
},
|
|
372
375
|
{
|
|
373
376
|
name: "retail",
|
|
@@ -413,6 +416,7 @@ export const BUILTIN_MODES = [
|
|
|
413
416
|
},
|
|
414
417
|
similar_industries: ["rental", "subscription"],
|
|
415
418
|
novel_capabilities: [],
|
|
419
|
+
disabled_builtin_constraints: ["require_wip_evidence"],
|
|
416
420
|
},
|
|
417
421
|
{
|
|
418
422
|
name: "retail_d2c",
|
|
@@ -458,6 +462,7 @@ export const BUILTIN_MODES = [
|
|
|
458
462
|
},
|
|
459
463
|
similar_industries: ["retail", "subscription"],
|
|
460
464
|
novel_capabilities: ["Allocation escrow as platform-custody alternative", "Multi-recipient allocation (merchant + processor)"],
|
|
465
|
+
disabled_builtin_constraints: ["require_arbitration", "require_compensation_fund", "require_wip_evidence"],
|
|
461
466
|
},
|
|
462
467
|
{
|
|
463
468
|
name: "general",
|
|
@@ -489,5 +494,6 @@ export const BUILTIN_MODES = [
|
|
|
489
494
|
},
|
|
490
495
|
similar_industries: [],
|
|
491
496
|
novel_capabilities: [],
|
|
497
|
+
disabled_builtin_constraints: ["require_arbitration", "require_compensation_fund", "require_wip_evidence"],
|
|
492
498
|
},
|
|
493
499
|
];
|
|
@@ -6,6 +6,8 @@ export declare class IndustryModeRegistry {
|
|
|
6
6
|
private aliases;
|
|
7
7
|
private evaluator;
|
|
8
8
|
private initialized;
|
|
9
|
+
private persistence;
|
|
10
|
+
private userModesLoaded;
|
|
9
11
|
static Instance(): IndustryModeRegistry;
|
|
10
12
|
private constructor();
|
|
11
13
|
registerMode(mode: IndustryMode, aliases?: string[]): boolean;
|
|
@@ -15,16 +17,19 @@ export declare class IndustryModeRegistry {
|
|
|
15
17
|
hasMode(name: string): boolean;
|
|
16
18
|
evaluateMode(name: string, intent: string, context: ProjectContext): ModeEvaluation;
|
|
17
19
|
evaluateMigration(sourceName: string, targetName: string): ModeMigrationEvaluation;
|
|
18
|
-
registerUserMode(mode: UserDefinedMode, userId: string): boolean
|
|
19
|
-
deriveMode(sourceMode: string, modifications: Partial<UserDefinedMode>, userId: string, newName: string, newDisplayName?: string): UserDefinedMode | undefined
|
|
20
|
-
evolveMode(modeName: string, updates: Partial<UserDefinedMode>, userId: string, changeDescription: string, bumpVersion?: boolean): UserDefinedMode | undefined
|
|
21
|
-
listUserModes(userId: string): UserDefinedMode[]
|
|
22
|
-
getUserMode(modeName: string, userId: string): UserDefinedMode | undefined
|
|
23
|
-
unregisterUserMode(modeName: string, userId: string): boolean
|
|
20
|
+
registerUserMode(mode: UserDefinedMode, userId: string): Promise<boolean>;
|
|
21
|
+
deriveMode(sourceMode: string, modifications: Partial<UserDefinedMode>, userId: string, newName: string, newDisplayName?: string): Promise<UserDefinedMode | undefined>;
|
|
22
|
+
evolveMode(modeName: string, updates: Partial<UserDefinedMode>, userId: string, changeDescription: string, bumpVersion?: boolean): Promise<UserDefinedMode | undefined>;
|
|
23
|
+
listUserModes(userId: string): Promise<UserDefinedMode[]>;
|
|
24
|
+
getUserMode(modeName: string, userId: string): Promise<UserDefinedMode | undefined>;
|
|
25
|
+
unregisterUserMode(modeName: string, userId: string): Promise<boolean>;
|
|
24
26
|
private userModeKey;
|
|
27
|
+
private ensureUserModesLoaded;
|
|
28
|
+
private persistUserMode;
|
|
29
|
+
private unpersistUserMode;
|
|
25
30
|
private bumpPatchVersion;
|
|
26
|
-
applyTemplate(name: string, intent: string, context: ProjectContext): Blueprint
|
|
27
|
-
applyUserMode(modeName: string, userId: string, intent: string, context: ProjectContext): Blueprint
|
|
31
|
+
applyTemplate(name: string, intent: string, context: ProjectContext): Promise<Blueprint>;
|
|
32
|
+
applyUserMode(modeName: string, userId: string, intent: string, context: ProjectContext): Promise<Blueprint>;
|
|
28
33
|
private doApplyTemplate;
|
|
29
34
|
validateBlueprint(objects: BlueprintObject[], edges: BlueprintEdge[], mode: IndustryMode): {
|
|
30
35
|
errors: string[];
|
|
@@ -47,4 +52,4 @@ export declare class IndustryModeRegistry {
|
|
|
47
52
|
private registerBuiltinModes;
|
|
48
53
|
}
|
|
49
54
|
export declare function getIndustryModeRegistry(): IndustryModeRegistry;
|
|
50
|
-
export declare const INDUSTRY_MODE_REGISTRY_VERSION = 2.
|
|
55
|
+
export declare const INDUSTRY_MODE_REGISTRY_VERSION = 2.2;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UserModeStorage } from "@wowok/wowok";
|
|
1
2
|
import { CapabilityRegistry } from "./capability-manifest.js";
|
|
2
3
|
import { ModeEvaluator } from "./mode-evaluator.js";
|
|
3
4
|
import { MetricRegistry } from "./metric-registry.js";
|
|
@@ -10,6 +11,8 @@ export class IndustryModeRegistry {
|
|
|
10
11
|
aliases = new Map();
|
|
11
12
|
evaluator;
|
|
12
13
|
initialized = false;
|
|
14
|
+
persistence = new UserModeStorage();
|
|
15
|
+
userModesLoaded = false;
|
|
13
16
|
static Instance() {
|
|
14
17
|
if (!IndustryModeRegistry.instance) {
|
|
15
18
|
IndustryModeRegistry.instance = new IndustryModeRegistry();
|
|
@@ -100,7 +103,8 @@ export class IndustryModeRegistry {
|
|
|
100
103
|
}
|
|
101
104
|
return this.evaluator.evaluateMigration(source, target);
|
|
102
105
|
}
|
|
103
|
-
registerUserMode(mode, userId) {
|
|
106
|
+
async registerUserMode(mode, userId) {
|
|
107
|
+
await this.ensureUserModesLoaded();
|
|
104
108
|
if (!mode.name || !mode.owner || !mode.machine_shape)
|
|
105
109
|
return false;
|
|
106
110
|
if (mode.source !== "custom")
|
|
@@ -120,9 +124,11 @@ export class IndustryModeRegistry {
|
|
|
120
124
|
}];
|
|
121
125
|
}
|
|
122
126
|
this.userModes.set(userKey, mode);
|
|
127
|
+
await this.persistUserMode(mode);
|
|
123
128
|
return true;
|
|
124
129
|
}
|
|
125
|
-
deriveMode(sourceMode, modifications, userId, newName, newDisplayName) {
|
|
130
|
+
async deriveMode(sourceMode, modifications, userId, newName, newDisplayName) {
|
|
131
|
+
await this.ensureUserModesLoaded();
|
|
126
132
|
const source = this.getMode(sourceMode);
|
|
127
133
|
if (!source)
|
|
128
134
|
return undefined;
|
|
@@ -165,9 +171,11 @@ export class IndustryModeRegistry {
|
|
|
165
171
|
}],
|
|
166
172
|
};
|
|
167
173
|
this.userModes.set(userKey, derived);
|
|
174
|
+
await this.persistUserMode(derived);
|
|
168
175
|
return derived;
|
|
169
176
|
}
|
|
170
|
-
evolveMode(modeName, updates, userId, changeDescription, bumpVersion = true) {
|
|
177
|
+
async evolveMode(modeName, updates, userId, changeDescription, bumpVersion = true) {
|
|
178
|
+
await this.ensureUserModesLoaded();
|
|
171
179
|
const userKey = this.userModeKey(userId, modeName);
|
|
172
180
|
const existing = this.userModes.get(userKey);
|
|
173
181
|
if (!existing)
|
|
@@ -193,9 +201,11 @@ export class IndustryModeRegistry {
|
|
|
193
201
|
version: newVersion,
|
|
194
202
|
};
|
|
195
203
|
this.userModes.set(userKey, evolved);
|
|
204
|
+
await this.persistUserMode(evolved);
|
|
196
205
|
return evolved;
|
|
197
206
|
}
|
|
198
|
-
listUserModes(userId) {
|
|
207
|
+
async listUserModes(userId) {
|
|
208
|
+
await this.ensureUserModesLoaded();
|
|
199
209
|
const result = [];
|
|
200
210
|
for (const mode of this.userModes.values()) {
|
|
201
211
|
if (mode.owner === userId) {
|
|
@@ -204,26 +214,71 @@ export class IndustryModeRegistry {
|
|
|
204
214
|
}
|
|
205
215
|
return result;
|
|
206
216
|
}
|
|
207
|
-
getUserMode(modeName, userId) {
|
|
217
|
+
async getUserMode(modeName, userId) {
|
|
218
|
+
await this.ensureUserModesLoaded();
|
|
208
219
|
const userKey = this.userModeKey(userId, modeName);
|
|
209
220
|
return this.userModes.get(userKey);
|
|
210
221
|
}
|
|
211
|
-
unregisterUserMode(modeName, userId) {
|
|
222
|
+
async unregisterUserMode(modeName, userId) {
|
|
223
|
+
await this.ensureUserModesLoaded();
|
|
212
224
|
const userKey = this.userModeKey(userId, modeName);
|
|
213
|
-
|
|
225
|
+
const removed = this.userModes.delete(userKey);
|
|
226
|
+
if (removed) {
|
|
227
|
+
await this.unpersistUserMode(userId, modeName);
|
|
228
|
+
}
|
|
229
|
+
return removed;
|
|
214
230
|
}
|
|
215
231
|
userModeKey(owner, name) {
|
|
216
232
|
return `${owner}:${name}`;
|
|
217
233
|
}
|
|
234
|
+
async ensureUserModesLoaded() {
|
|
235
|
+
if (this.userModesLoaded)
|
|
236
|
+
return;
|
|
237
|
+
this.userModesLoaded = true;
|
|
238
|
+
try {
|
|
239
|
+
const rows = await this.persistence.list();
|
|
240
|
+
for (const row of rows) {
|
|
241
|
+
try {
|
|
242
|
+
const mode = JSON.parse(row.data);
|
|
243
|
+
if (mode?.name && mode?.owner && mode?.machine_shape) {
|
|
244
|
+
this.userModes.set(this.userModeKey(row.owner, row.name), mode);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
console.warn(`[IndustryModeRegistry] Skipping corrupt user_modes row '${row.owner}:${row.name}'.`);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
catch (err) {
|
|
253
|
+
console.warn("[IndustryModeRegistry] Failed to load persisted user modes:", err.message);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
async persistUserMode(mode) {
|
|
257
|
+
try {
|
|
258
|
+
await this.persistence.save(mode.owner, mode.name, JSON.stringify(mode));
|
|
259
|
+
}
|
|
260
|
+
catch (err) {
|
|
261
|
+
console.warn(`[IndustryModeRegistry] Failed to persist user mode '${mode.owner}:${mode.name}':`, err.message);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
async unpersistUserMode(owner, name) {
|
|
265
|
+
try {
|
|
266
|
+
await this.persistence.delete(owner, name);
|
|
267
|
+
}
|
|
268
|
+
catch (err) {
|
|
269
|
+
console.warn(`[IndustryModeRegistry] Failed to delete persisted user mode '${owner}:${name}':`, err.message);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
218
272
|
bumpPatchVersion(version) {
|
|
219
|
-
const
|
|
273
|
+
const stripped = version.replace(/^v/, "");
|
|
274
|
+
const parts = stripped.split(".");
|
|
220
275
|
if (parts.length < 2)
|
|
221
|
-
return `v${
|
|
276
|
+
return `v${stripped}.1`;
|
|
222
277
|
const patch = parseInt(parts[1] ?? "0", 10);
|
|
223
278
|
parts[1] = String(patch + 1);
|
|
224
279
|
return `v${parts.join(".")}`;
|
|
225
280
|
}
|
|
226
|
-
applyTemplate(name, intent, context) {
|
|
281
|
+
async applyTemplate(name, intent, context) {
|
|
227
282
|
const builtinMode = this.getMode(name);
|
|
228
283
|
if (builtinMode) {
|
|
229
284
|
const blueprint = this.doApplyTemplate(builtinMode, intent, context);
|
|
@@ -232,7 +287,7 @@ export class IndustryModeRegistry {
|
|
|
232
287
|
}
|
|
233
288
|
if (name.includes(":")) {
|
|
234
289
|
const [owner, modeName] = name.split(":", 2);
|
|
235
|
-
const userMode = this.getUserMode(modeName, owner);
|
|
290
|
+
const userMode = await this.getUserMode(modeName, owner);
|
|
236
291
|
if (userMode) {
|
|
237
292
|
const blueprint = this.doApplyTemplate(userMode, intent, context);
|
|
238
293
|
this.recordCapabilitiesUsed(userMode);
|
|
@@ -247,8 +302,8 @@ export class IndustryModeRegistry {
|
|
|
247
302
|
this.recordCapabilitiesUsed(general);
|
|
248
303
|
return blueprint;
|
|
249
304
|
}
|
|
250
|
-
applyUserMode(modeName, userId, intent, context) {
|
|
251
|
-
const userMode = this.getUserMode(modeName, userId);
|
|
305
|
+
async applyUserMode(modeName, userId, intent, context) {
|
|
306
|
+
const userMode = await this.getUserMode(modeName, userId);
|
|
252
307
|
if (!userMode) {
|
|
253
308
|
throw new Error(`User mode '${modeName}' not found for user '${userId}'`);
|
|
254
309
|
}
|
|
@@ -659,4 +714,4 @@ export class IndustryModeRegistry {
|
|
|
659
714
|
export function getIndustryModeRegistry() {
|
|
660
715
|
return IndustryModeRegistry.Instance();
|
|
661
716
|
}
|
|
662
|
-
export const INDUSTRY_MODE_REGISTRY_VERSION = 2.
|
|
717
|
+
export const INDUSTRY_MODE_REGISTRY_VERSION = 2.2;
|
|
@@ -111,6 +111,7 @@ export interface IndustryMode {
|
|
|
111
111
|
applicable_conditions: ModeApplicableConditions;
|
|
112
112
|
similar_industries?: string[];
|
|
113
113
|
novel_capabilities?: string[];
|
|
114
|
+
disabled_builtin_constraints?: string[];
|
|
114
115
|
}
|
|
115
116
|
export interface UserDefinedMode extends IndustryMode {
|
|
116
117
|
owner: string;
|