@wowok/agent-mcp 2.4.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/runtime.d.ts +4 -0
- package/dist/config/runtime.js +29 -5
- package/dist/harness/auto-escalation.d.ts +27 -0
- package/dist/harness/auto-escalation.js +68 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +29 -1621
- package/dist/knowledge/allocation-confirm.d.ts +115 -0
- package/dist/knowledge/allocation-confirm.js +534 -0
- package/dist/knowledge/allocation-context.d.ts +58 -0
- package/dist/knowledge/allocation-context.js +249 -0
- package/dist/knowledge/allocation-ledger.d.ts +67 -0
- package/dist/knowledge/allocation-ledger.js +463 -0
- package/dist/knowledge/allocation-puzzle.d.ts +135 -0
- package/dist/knowledge/allocation-puzzle.js +298 -0
- package/dist/knowledge/allocation-risk.d.ts +78 -0
- package/dist/knowledge/allocation-risk.js +568 -0
- package/dist/knowledge/allocation-templates.d.ts +38 -0
- package/dist/knowledge/allocation-templates.js +970 -0
- package/dist/knowledge/allocation-translation.d.ts +72 -0
- package/dist/knowledge/allocation-translation.js +585 -0
- package/dist/knowledge/arb-risk.d.ts +37 -0
- package/dist/knowledge/arb-risk.js +210 -0
- package/dist/knowledge/arbitration-confirm.d.ts +135 -0
- package/dist/knowledge/arbitration-confirm.js +559 -0
- package/dist/knowledge/arbitration-context.d.ts +81 -0
- package/dist/knowledge/arbitration-context.js +505 -0
- package/dist/knowledge/arbitration-ledger.d.ts +62 -0
- package/dist/knowledge/arbitration-ledger.js +521 -0
- package/dist/knowledge/arbitration-puzzle.d.ts +84 -0
- package/dist/knowledge/arbitration-puzzle.js +304 -0
- package/dist/knowledge/arbitration-risk.d.ts +112 -0
- package/dist/knowledge/arbitration-risk.js +433 -0
- package/dist/knowledge/arbitration-templates.d.ts +38 -0
- package/dist/knowledge/arbitration-templates.js +276 -0
- package/dist/knowledge/arbitration-translation.d.ts +91 -0
- package/dist/knowledge/arbitration-translation.js +487 -0
- package/dist/knowledge/bridge-risk.d.ts +36 -0
- package/dist/knowledge/bridge-risk.js +263 -0
- package/dist/knowledge/contact-risk.d.ts +32 -0
- package/dist/knowledge/contact-risk.js +200 -0
- package/dist/knowledge/demand-confirm.d.ts +32 -0
- package/dist/knowledge/demand-confirm.js +206 -0
- package/dist/knowledge/demand-risk.d.ts +30 -0
- package/dist/knowledge/demand-risk.js +240 -0
- package/dist/knowledge/demand-translation.d.ts +55 -0
- package/dist/knowledge/demand-translation.js +354 -0
- package/dist/knowledge/deployment-scanner.d.ts +63 -0
- package/dist/knowledge/deployment-scanner.js +762 -0
- package/dist/knowledge/examples-scanner-cli.d.ts +1 -0
- package/dist/knowledge/examples-scanner-cli.js +26 -0
- package/dist/knowledge/examples-scanner.d.ts +121 -0
- package/dist/knowledge/examples-scanner.js +825 -0
- package/dist/knowledge/flywheel-loop.d.ts +3 -0
- package/dist/knowledge/flywheel-loop.js +32 -3
- package/dist/knowledge/glossary.js +3 -1
- package/dist/knowledge/guard-confirm.d.ts +86 -0
- package/dist/knowledge/guard-confirm.js +406 -0
- package/dist/knowledge/guard-context.d.ts +56 -0
- package/dist/knowledge/guard-context.js +287 -0
- package/dist/knowledge/guard-design-patterns.d.ts +37 -0
- package/dist/knowledge/guard-design-patterns.js +257 -0
- package/dist/knowledge/guard-ledger.js +14 -0
- package/dist/knowledge/guard-lint.d.ts +1 -0
- package/dist/knowledge/guard-lint.js +83 -3
- package/dist/knowledge/guard-migration.d.ts +48 -0
- package/dist/knowledge/guard-migration.js +228 -0
- package/dist/knowledge/guard-puzzle.js +3 -2
- package/dist/knowledge/guard-risk.d.ts +3 -1
- package/dist/knowledge/guard-risk.js +832 -64
- package/dist/knowledge/guard-templates.d.ts +1 -0
- package/dist/knowledge/guard-templates.js +278 -2
- package/dist/knowledge/guard-translation.js +6 -5
- package/dist/knowledge/index.d.ts +342 -0
- package/dist/knowledge/index.js +344 -0
- package/dist/knowledge/machine-confirm.d.ts +102 -0
- package/dist/knowledge/machine-confirm.js +559 -0
- package/dist/knowledge/machine-context.d.ts +160 -0
- package/dist/knowledge/machine-context.js +812 -0
- package/dist/knowledge/machine-ledger.d.ts +41 -0
- package/dist/knowledge/machine-ledger.js +315 -0
- package/dist/knowledge/machine-puzzle.d.ts +206 -0
- package/dist/knowledge/machine-puzzle.js +494 -0
- package/dist/knowledge/machine-risk.d.ts +75 -0
- package/dist/knowledge/machine-risk.js +644 -0
- package/dist/knowledge/machine-templates.d.ts +92 -0
- package/dist/knowledge/machine-templates.js +1592 -0
- package/dist/knowledge/machine-topology.d.ts +57 -0
- package/dist/knowledge/machine-topology.js +234 -0
- package/dist/knowledge/machine-translation.d.ts +96 -0
- package/dist/knowledge/machine-translation.js +513 -0
- package/dist/knowledge/mcp-schema-audit-cli.d.ts +1 -0
- package/dist/knowledge/mcp-schema-audit-cli.js +45 -0
- package/dist/knowledge/mcp-schema-audit.d.ts +90 -0
- package/dist/knowledge/mcp-schema-audit.js +772 -0
- package/dist/knowledge/onchain-constants.d.ts +4 -0
- package/dist/knowledge/onchain-constants.js +35 -0
- package/dist/knowledge/order-confirm.d.ts +115 -0
- package/dist/knowledge/order-confirm.js +573 -0
- package/dist/knowledge/order-context.d.ts +66 -0
- package/dist/knowledge/order-context.js +390 -0
- package/dist/knowledge/order-ledger.d.ts +69 -0
- package/dist/knowledge/order-ledger.js +341 -0
- package/dist/knowledge/order-puzzle.d.ts +159 -0
- package/dist/knowledge/order-puzzle.js +255 -0
- package/dist/knowledge/order-risk.d.ts +66 -0
- package/dist/knowledge/order-risk.js +653 -0
- package/dist/knowledge/order-templates.d.ts +50 -0
- package/dist/knowledge/order-templates.js +368 -0
- package/dist/knowledge/order-translation.d.ts +78 -0
- package/dist/knowledge/order-translation.js +550 -0
- package/dist/knowledge/passport-confirm.d.ts +130 -0
- package/dist/knowledge/passport-confirm.js +531 -0
- package/dist/knowledge/passport-context.d.ts +59 -0
- package/dist/knowledge/passport-context.js +306 -0
- package/dist/knowledge/passport-ledger.d.ts +48 -0
- package/dist/knowledge/passport-ledger.js +282 -0
- package/dist/knowledge/passport-puzzle.d.ts +108 -0
- package/dist/knowledge/passport-puzzle.js +333 -0
- package/dist/knowledge/passport-risk.d.ts +70 -0
- package/dist/knowledge/passport-risk.js +450 -0
- package/dist/knowledge/passport-templates.d.ts +40 -0
- package/dist/knowledge/passport-templates.js +568 -0
- package/dist/knowledge/passport-translation.d.ts +68 -0
- package/dist/knowledge/passport-translation.js +516 -0
- package/dist/knowledge/payment-risk.d.ts +33 -0
- package/dist/knowledge/payment-risk.js +182 -0
- package/dist/knowledge/permission-confirm.d.ts +110 -0
- package/dist/knowledge/permission-confirm.js +426 -0
- package/dist/knowledge/permission-context.d.ts +58 -0
- package/dist/knowledge/permission-context.js +224 -0
- package/dist/knowledge/permission-ledger.d.ts +38 -0
- package/dist/knowledge/permission-ledger.js +403 -0
- package/dist/knowledge/permission-puzzle.d.ts +122 -0
- package/dist/knowledge/permission-puzzle.js +173 -0
- package/dist/knowledge/permission-risk.d.ts +76 -0
- package/dist/knowledge/permission-risk.js +411 -0
- package/dist/knowledge/permission-templates.d.ts +38 -0
- package/dist/knowledge/permission-templates.js +234 -0
- package/dist/knowledge/permission-translation.d.ts +57 -0
- package/dist/knowledge/permission-translation.js +350 -0
- package/dist/knowledge/personal-risk.d.ts +36 -0
- package/dist/knowledge/personal-risk.js +212 -0
- package/dist/knowledge/progress-confirm.d.ts +108 -0
- package/dist/knowledge/progress-confirm.js +456 -0
- package/dist/knowledge/progress-context.d.ts +123 -0
- package/dist/knowledge/progress-context.js +452 -0
- package/dist/knowledge/progress-ledger.d.ts +63 -0
- package/dist/knowledge/progress-ledger.js +327 -0
- package/dist/knowledge/progress-puzzle.d.ts +82 -0
- package/dist/knowledge/progress-puzzle.js +219 -0
- package/dist/knowledge/progress-risk.d.ts +74 -0
- package/dist/knowledge/progress-risk.js +461 -0
- package/dist/knowledge/progress-templates.d.ts +38 -0
- package/dist/knowledge/progress-templates.js +228 -0
- package/dist/knowledge/progress-translation.d.ts +52 -0
- package/dist/knowledge/progress-translation.js +401 -0
- package/dist/knowledge/proof-confirm.d.ts +31 -0
- package/dist/knowledge/proof-confirm.js +187 -0
- package/dist/knowledge/proof-risk.d.ts +33 -0
- package/dist/knowledge/proof-risk.js +207 -0
- package/dist/knowledge/proof-translation.d.ts +52 -0
- package/dist/knowledge/proof-translation.js +283 -0
- package/dist/knowledge/registrar-risk.d.ts +34 -0
- package/dist/knowledge/registrar-risk.js +217 -0
- package/dist/knowledge/repository-confirm.d.ts +36 -0
- package/dist/knowledge/repository-confirm.js +242 -0
- package/dist/knowledge/repository-risk.d.ts +40 -0
- package/dist/knowledge/repository-risk.js +312 -0
- package/dist/knowledge/repository-translation.d.ts +58 -0
- package/dist/knowledge/repository-translation.js +422 -0
- package/dist/knowledge/resource-risk.d.ts +32 -0
- package/dist/knowledge/resource-risk.js +157 -0
- package/dist/knowledge/reward-confirm.d.ts +113 -0
- package/dist/knowledge/reward-confirm.js +496 -0
- package/dist/knowledge/reward-context.d.ts +127 -0
- package/dist/knowledge/reward-context.js +504 -0
- package/dist/knowledge/reward-ledger.d.ts +96 -0
- package/dist/knowledge/reward-ledger.js +502 -0
- package/dist/knowledge/reward-puzzle.d.ts +97 -0
- package/dist/knowledge/reward-puzzle.js +288 -0
- package/dist/knowledge/reward-risk.d.ts +84 -0
- package/dist/knowledge/reward-risk.js +545 -0
- package/dist/knowledge/reward-translation.d.ts +58 -0
- package/dist/knowledge/reward-translation.js +501 -0
- package/dist/knowledge/safety-rules.js +11 -3
- package/dist/knowledge/scenario-modes.d.ts +53 -0
- package/dist/knowledge/scenario-modes.js +302 -0
- package/dist/knowledge/service-confirm.d.ts +152 -0
- package/dist/knowledge/service-confirm.js +699 -0
- package/dist/knowledge/service-context.d.ts +66 -0
- package/dist/knowledge/service-context.js +403 -0
- package/dist/knowledge/service-ledger.d.ts +71 -0
- package/dist/knowledge/service-ledger.js +609 -0
- package/dist/knowledge/service-puzzle.d.ts +158 -0
- package/dist/knowledge/service-puzzle.js +236 -0
- package/dist/knowledge/service-risk.d.ts +108 -0
- package/dist/knowledge/service-risk.js +615 -0
- package/dist/knowledge/service-templates.d.ts +39 -0
- package/dist/knowledge/service-templates.js +418 -0
- package/dist/knowledge/service-translation.d.ts +103 -0
- package/dist/knowledge/service-translation.js +622 -0
- package/dist/knowledge/tools-reference.d.ts +17 -0
- package/dist/knowledge/tools-reference.js +151 -0
- package/dist/knowledge/treasury-confirm.d.ts +133 -0
- package/dist/knowledge/treasury-confirm.js +512 -0
- package/dist/knowledge/treasury-context.d.ts +64 -0
- package/dist/knowledge/treasury-context.js +363 -0
- package/dist/knowledge/treasury-ledger.d.ts +42 -0
- package/dist/knowledge/treasury-ledger.js +300 -0
- package/dist/knowledge/treasury-puzzle.d.ts +163 -0
- package/dist/knowledge/treasury-puzzle.js +216 -0
- package/dist/knowledge/treasury-risk.d.ts +86 -0
- package/dist/knowledge/treasury-risk.js +440 -0
- package/dist/knowledge/treasury-templates.d.ts +38 -0
- package/dist/knowledge/treasury-templates.js +316 -0
- package/dist/knowledge/treasury-translation.d.ts +78 -0
- package/dist/knowledge/treasury-translation.js +498 -0
- package/dist/knowledge/util-risk.d.ts +30 -0
- package/dist/knowledge/util-risk.js +135 -0
- package/dist/project/business-puzzle.d.ts +47 -0
- package/dist/project/business-puzzle.js +372 -0
- package/dist/project/deployment-doc.d.ts +61 -0
- package/dist/project/deployment-doc.js +432 -0
- package/dist/project/graph.d.ts +1 -0
- package/dist/project/graph.js +27 -1
- package/dist/project/index.d.ts +1 -0
- package/dist/project/index.js +39 -2
- package/dist/project/namespace.d.ts +11 -1
- package/dist/project/namespace.js +27 -2
- package/dist/project/query.d.ts +2 -0
- package/dist/project/query.js +56 -15
- package/dist/project/risk-aggregator.d.ts +50 -0
- package/dist/project/risk-aggregator.js +280 -0
- package/dist/project/substep-trace.d.ts +130 -0
- package/dist/project/substep-trace.js +332 -0
- package/dist/rules.d.ts +12 -0
- package/dist/rules.js +9 -0
- package/dist/schema/call/allocation.d.ts +44 -44
- package/dist/schema/call/arbitration.d.ts +141 -141
- package/dist/schema/call/base.d.ts +386 -386
- package/dist/schema/call/base.js +6 -6
- package/dist/schema/call/bridge-handler.d.ts +5 -2
- package/dist/schema/call/bridge.d.ts +159 -159
- package/dist/schema/call/contact.d.ts +110 -110
- package/dist/schema/call/demand.d.ts +76 -76
- package/dist/schema/call/handler.d.ts +2 -3
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.d.ts +96 -96
- package/dist/schema/call/order.d.ts +98 -110
- package/dist/schema/call/permission-handler.d.ts +5 -0
- package/dist/schema/call/permission-handler.js +54 -0
- package/dist/schema/call/permission.d.ts +108 -108
- package/dist/schema/call/personal.d.ts +14 -14
- package/dist/schema/call/progress.d.ts +57 -72
- package/dist/schema/call/progress.js +7 -4
- package/dist/schema/call/proof.d.ts +18 -18
- package/dist/schema/call/proof.js +12 -7
- package/dist/schema/call/repository.d.ts +154 -154
- package/dist/schema/call/reward.d.ts +55 -55
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +238 -238
- package/dist/schema/call/treasury.d.ts +93 -93
- package/dist/schema/config/index.d.ts +178 -5
- package/dist/schema/config/index.js +52 -1
- package/dist/schema/local/index.d.ts +3554 -836
- package/dist/schema/local/index.js +2 -1
- package/dist/schema/messenger/index.d.ts +162 -162
- package/dist/schema/operations.d.ts +1102 -1118
- package/dist/schema/operations.js +7 -1
- package/dist/schema/project/index.d.ts +1392 -6
- package/dist/schema/project/index.js +426 -2
- package/dist/schema/query/index.d.ts +818 -818
- package/dist/schema/query/index.js +15 -9
- package/dist/schema/schema-query/index.d.ts +23 -3
- package/dist/schema/schema-query/index.js +13 -2
- package/dist/schema/sync-layer4.d.ts +21 -0
- package/dist/schema/sync-layer4.js +261 -0
- package/dist/schema/trust/index.d.ts +26 -26
- package/dist/schema/utils/guard-query-utils.d.ts +7 -0
- package/dist/schema/utils/guard-query-utils.js +14 -1
- package/dist/schemas/account_operation.output.json +718 -0
- package/dist/schemas/bridge_operation.output.json +1 -1
- package/dist/schemas/config_operation.output.json +173 -0
- package/dist/schemas/index.json +9 -1
- package/dist/schemas/local_info_operation.output.json +718 -0
- package/dist/schemas/local_mark_operation.output.json +718 -0
- package/dist/schemas/messenger_operation.output.json +1 -1
- package/dist/schemas/onchain_events.output.json +1 -1
- package/dist/schemas/onchain_operations.output.json +5 -4
- package/dist/schemas/onchain_operations.schema.json +1813 -333
- package/dist/schemas/onchain_operations_allocation.schema.json +9 -11
- package/dist/schemas/onchain_operations_arbitration.schema.json +2 -1
- package/dist/schemas/onchain_operations_contact.schema.json +2 -1
- package/dist/schemas/onchain_operations_demand.schema.json +2 -1
- package/dist/schemas/onchain_operations_gen_passport.schema.json +878 -872
- package/dist/schemas/onchain_operations_gen_proof.schema.json +273 -0
- package/dist/schemas/onchain_operations_guard.schema.json +584 -70
- package/dist/schemas/onchain_operations_machine.schema.json +4 -6
- package/dist/schemas/onchain_operations_order.schema.json +13 -9
- package/dist/schemas/onchain_operations_payment.schema.json +2 -1
- package/dist/schemas/onchain_operations_permission.schema.json +2 -1
- package/dist/schemas/onchain_operations_personal.schema.json +2 -1
- package/dist/schemas/onchain_operations_progress.schema.json +14 -10
- package/dist/schemas/onchain_operations_proof.schema.json +699 -0
- package/dist/schemas/onchain_operations_repository.schema.json +2 -1
- package/dist/schemas/onchain_operations_reward.schema.json +2 -1
- package/dist/schemas/onchain_operations_service.schema.json +4 -6
- package/dist/schemas/onchain_operations_treasury.schema.json +2 -1
- package/dist/schemas/onchain_table_data.output.json +6 -12
- package/dist/schemas/onchain_table_data.schema.json +32 -1
- package/dist/schemas/project_operation.output.json +879 -0
- package/dist/schemas/project_operation.schema.json +473 -2
- package/dist/schemas/query_toolkit.output.json +14906 -6
- package/dist/schemas/schema_query.output.json +38 -1
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/tools/handlers/bridge.d.ts +1 -0
- package/dist/tools/handlers/bridge.js +1 -0
- package/dist/tools/handlers/config.d.ts +2 -0
- package/dist/tools/handlers/config.js +74 -0
- package/dist/tools/handlers/file-export.d.ts +3 -0
- package/dist/tools/handlers/file-export.js +90 -0
- package/dist/tools/handlers/local.d.ts +3 -0
- package/dist/tools/handlers/local.js +38 -0
- package/dist/tools/handlers/messenger.d.ts +16 -0
- package/dist/tools/handlers/messenger.js +188 -0
- package/dist/tools/handlers/onchain.d.ts +2 -0
- package/dist/tools/handlers/onchain.js +248 -0
- package/dist/tools/handlers/project.d.ts +2 -0
- package/dist/tools/handlers/project.js +293 -0
- package/dist/tools/handlers/query.d.ts +5 -0
- package/dist/tools/handlers/query.js +256 -0
- package/dist/tools/handlers/schema-query.d.ts +2 -0
- package/dist/tools/handlers/schema-query.js +93 -0
- package/dist/tools/handlers/trust.d.ts +2 -0
- package/dist/tools/handlers/trust.js +194 -0
- package/dist/tools/handlers/wip.d.ts +2 -0
- package/dist/tools/handlers/wip.js +44 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.js +526 -0
- package/dist/tools/rules-hook.d.ts +2 -0
- package/dist/tools/rules-hook.js +23 -0
- package/dist/tools/shared.d.ts +20 -0
- package/dist/tools/shared.js +130 -0
- package/dist/tools/types.d.ts +35 -0
- package/dist/tools/types.js +1 -0
- package/dist/tools/wrap.d.ts +14 -0
- package/dist/tools/wrap.js +267 -0
- package/package.json +20 -6
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
const STANDARD_TOPO_ORDER = [
|
|
2
|
+
"permission", "treasury", "allocation", "guard", "machine",
|
|
3
|
+
"service", "order", "progress", "arb", "reward",
|
|
4
|
+
"proof", "repository", "demand", "contact",
|
|
5
|
+
"personal", "payment",
|
|
6
|
+
];
|
|
7
|
+
const D_CHECK_ITEMS = [
|
|
8
|
+
{ id: "D-01", description: "All objects are defined in §1.1" },
|
|
9
|
+
{ id: "D-02", description: "All dependencies have no dangling references" },
|
|
10
|
+
{ id: "D-03", description: "All declared scenarios are covered by steps" },
|
|
11
|
+
{ id: "D-04", description: "All objects follow the naming convention" },
|
|
12
|
+
{ id: "D-05", description: "testnet network field is 'testnet'" },
|
|
13
|
+
{ id: "D-06", description: "testnet replaceExistName is true" },
|
|
14
|
+
{ id: "D-07", description: "All JSON blocks are valid JSON" },
|
|
15
|
+
{ id: "D-08", description: "All step IDs are sequential and unique" },
|
|
16
|
+
{ id: "D-09", description: "All substep IDs are unique" },
|
|
17
|
+
{ id: "D-10", description: "Substep linkage is complete (no dangling/circular)" },
|
|
18
|
+
{ id: "D-11", description: "All `${var}` references resolve to defined outputs" },
|
|
19
|
+
{ id: "D-12", description: "mainnet network field is 'mainnet'" },
|
|
20
|
+
{ id: "D-13", description: "mainnet replaceExistName is false (unless force claim)" },
|
|
21
|
+
{ id: "D-14", description: "Naming convention: ^[a-z][a-z0-9_]{2,63}$" },
|
|
22
|
+
{ id: "D-15", description: "All publish operations come after create" },
|
|
23
|
+
{ id: "D-16", description: "No CRITICAL risks remain (risk_status=RISK_PASSED)" },
|
|
24
|
+
{ id: "D-17", description: "All HIGH risks are user-confirmed" },
|
|
25
|
+
{ id: "D-18", description: "Version numbers are consistent across the document" },
|
|
26
|
+
];
|
|
27
|
+
function isoNow() {
|
|
28
|
+
return new Date().toISOString();
|
|
29
|
+
}
|
|
30
|
+
function indent(s, n) {
|
|
31
|
+
const pad = " ".repeat(n);
|
|
32
|
+
return s
|
|
33
|
+
.split("\n")
|
|
34
|
+
.map((l) => pad + l)
|
|
35
|
+
.join("\n");
|
|
36
|
+
}
|
|
37
|
+
function tableRow(cells) {
|
|
38
|
+
return "| " + cells.join(" | ") + " |";
|
|
39
|
+
}
|
|
40
|
+
function tableHeader(headers) {
|
|
41
|
+
return [
|
|
42
|
+
tableRow(headers),
|
|
43
|
+
"|" + headers.map(() => "---").join("|") + "|",
|
|
44
|
+
].join("\n");
|
|
45
|
+
}
|
|
46
|
+
function jsonBlock(label, data) {
|
|
47
|
+
const header = label ? `#### ${label}\n\n` : "";
|
|
48
|
+
let body;
|
|
49
|
+
try {
|
|
50
|
+
body = JSON.stringify(data, null, 2);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
body = "{}";
|
|
54
|
+
}
|
|
55
|
+
return `${header}\`\`\`json\n${body}\n\`\`\`\n`;
|
|
56
|
+
}
|
|
57
|
+
function renderMeta(input) {
|
|
58
|
+
const lines = ["## 0. Project Metadata", ""];
|
|
59
|
+
lines.push(tableHeader(["Field", "Value"]));
|
|
60
|
+
lines.push(tableRow(["Project Name", input.project_prefix]));
|
|
61
|
+
lines.push(tableRow(["Business Intent", input.business_intent]));
|
|
62
|
+
lines.push(tableRow(["Industry Mode", input.industry]));
|
|
63
|
+
lines.push(tableRow(["Version", input.version]));
|
|
64
|
+
lines.push(tableRow(["Created At", isoNow()]));
|
|
65
|
+
lines.push(tableRow(["namespace tag", `${input.project_prefix}_${input.version}`]));
|
|
66
|
+
if (input.scenario_mode) {
|
|
67
|
+
lines.push(tableRow(["scenario_mode", input.scenario_mode]));
|
|
68
|
+
}
|
|
69
|
+
if (input.author) {
|
|
70
|
+
lines.push(tableRow(["author", input.author]));
|
|
71
|
+
}
|
|
72
|
+
lines.push("");
|
|
73
|
+
return lines.join("\n");
|
|
74
|
+
}
|
|
75
|
+
function renderODG(input) {
|
|
76
|
+
const lines = ["## 1. Object Dependency Graph (ODG)", ""];
|
|
77
|
+
lines.push("### 1.1 Object List");
|
|
78
|
+
lines.push("");
|
|
79
|
+
lines.push(tableHeader([
|
|
80
|
+
"entry_id", "object_type", "name", "reused_from", "publish_required", "description",
|
|
81
|
+
]));
|
|
82
|
+
for (const o of input.objects) {
|
|
83
|
+
lines.push(tableRow([
|
|
84
|
+
o.entry_id,
|
|
85
|
+
o.object_type,
|
|
86
|
+
o.name,
|
|
87
|
+
o.reused_from ?? "",
|
|
88
|
+
String(o.publish_required),
|
|
89
|
+
o.description ?? "",
|
|
90
|
+
]));
|
|
91
|
+
}
|
|
92
|
+
lines.push("");
|
|
93
|
+
lines.push("### 1.2 Dependencies");
|
|
94
|
+
lines.push("");
|
|
95
|
+
lines.push(tableHeader([
|
|
96
|
+
"from", "to", "edge_kind", "field_path", "required_at_publish",
|
|
97
|
+
]));
|
|
98
|
+
for (const e of input.edges) {
|
|
99
|
+
lines.push(tableRow([
|
|
100
|
+
e.from, e.to, e.edge_kind, e.field_path, String(e.required_at_publish),
|
|
101
|
+
]));
|
|
102
|
+
}
|
|
103
|
+
lines.push("");
|
|
104
|
+
if (input.scenarios && input.scenarios.length > 0) {
|
|
105
|
+
lines.push("### 1.3 Scenario Matrix");
|
|
106
|
+
lines.push("");
|
|
107
|
+
lines.push(tableHeader([
|
|
108
|
+
"scenario_id", "description", "primary_object", "supporting_objects", "test_step_refs",
|
|
109
|
+
]));
|
|
110
|
+
for (const s of input.scenarios) {
|
|
111
|
+
lines.push(tableRow([
|
|
112
|
+
s.scenario_id,
|
|
113
|
+
s.description,
|
|
114
|
+
s.primary_object,
|
|
115
|
+
s.supporting_objects.join(", "),
|
|
116
|
+
(s.test_step_refs ?? []).join(", "),
|
|
117
|
+
]));
|
|
118
|
+
}
|
|
119
|
+
lines.push("");
|
|
120
|
+
}
|
|
121
|
+
return lines.join("\n");
|
|
122
|
+
}
|
|
123
|
+
function renderTopoPlan(input) {
|
|
124
|
+
const lines = ["## 2. Topological Execution Plan", ""];
|
|
125
|
+
lines.push(tableHeader([
|
|
126
|
+
"step", "object_type", "operation", "substep_count", "depends_on", "entry_id", "network_phase",
|
|
127
|
+
]));
|
|
128
|
+
for (const s of input.steps) {
|
|
129
|
+
lines.push(tableRow([
|
|
130
|
+
String(s.step),
|
|
131
|
+
s.object_type,
|
|
132
|
+
s.operation,
|
|
133
|
+
String(s.substep_count),
|
|
134
|
+
`[${s.depends_on.join(", ")}]`,
|
|
135
|
+
s.entry_id,
|
|
136
|
+
s.network_phase,
|
|
137
|
+
]));
|
|
138
|
+
}
|
|
139
|
+
lines.push("");
|
|
140
|
+
return lines.join("\n");
|
|
141
|
+
}
|
|
142
|
+
function renderNetworkSection(sectionNum, network, input) {
|
|
143
|
+
const title = network === "testnet" ? "testnet Deployment Checklist" : "mainnet Deployment Checklist";
|
|
144
|
+
const lines = [`## ${sectionNum}. ${title}`, ""];
|
|
145
|
+
lines.push(`### ${sectionNum}.1 ${network} Metadata`);
|
|
146
|
+
lines.push("");
|
|
147
|
+
lines.push(tableHeader(["Field", "Value"]));
|
|
148
|
+
lines.push(tableRow(["network", network]));
|
|
149
|
+
lines.push(tableRow([
|
|
150
|
+
"rpc",
|
|
151
|
+
network === "testnet"
|
|
152
|
+
? "https://rpc.testnet.wowok.io"
|
|
153
|
+
: "https://rpc.mainnet.wowok.io",
|
|
154
|
+
]));
|
|
155
|
+
lines.push(tableRow([
|
|
156
|
+
"replaceExistName",
|
|
157
|
+
network === "testnet" ? "true" : "false",
|
|
158
|
+
]));
|
|
159
|
+
lines.push(tableRow(["gas_budget", "100000000"]));
|
|
160
|
+
lines.push(tableRow(["account", `${input.project_prefix}_merchant_${network}`]));
|
|
161
|
+
lines.push(tableRow(["dry_run", "false"]));
|
|
162
|
+
lines.push("");
|
|
163
|
+
lines.push(`### ${sectionNum}.2 ${network} JSON Operation Sequence`);
|
|
164
|
+
lines.push("");
|
|
165
|
+
for (const step of input.steps) {
|
|
166
|
+
if (step.network_phase !== "both" && step.network_phase !== network)
|
|
167
|
+
continue;
|
|
168
|
+
const block = {
|
|
169
|
+
step: step.step,
|
|
170
|
+
operation: "onchain_operations",
|
|
171
|
+
operation_type: step.object_type,
|
|
172
|
+
data: {
|
|
173
|
+
object: { name: objectNameForStep(step, input), replaceExistName: network === "testnet" },
|
|
174
|
+
description: stepDescription(step),
|
|
175
|
+
},
|
|
176
|
+
env: {
|
|
177
|
+
account: `${input.project_prefix}_merchant_${network}`,
|
|
178
|
+
network,
|
|
179
|
+
replaceExistName: network === "testnet",
|
|
180
|
+
confirmed: true,
|
|
181
|
+
},
|
|
182
|
+
substeps: generateSubstepStubs(step),
|
|
183
|
+
};
|
|
184
|
+
lines.push(jsonBlock(`Step T${step.step}: ${step.operation} ${step.object_type}`, block));
|
|
185
|
+
}
|
|
186
|
+
lines.push(`### ${sectionNum}.3 ${network} Verification Checklist`);
|
|
187
|
+
lines.push("");
|
|
188
|
+
const items = network === "testnet"
|
|
189
|
+
? ["V-T-01", "V-T-02", "V-T-03", "V-T-04", "V-T-05", "V-T-06", "V-T-07", "V-T-08", "V-T-09", "V-T-10", "V-T-11"]
|
|
190
|
+
: ["V-M-01", "V-M-02", "V-M-03", "V-M-04", "V-M-05"];
|
|
191
|
+
lines.push(tableHeader(["Verification ID", "Verification Item", "Status", "Notes"]));
|
|
192
|
+
for (const v of items) {
|
|
193
|
+
lines.push(tableRow([v, "(to be filled)", "⚪ Pending", ""]));
|
|
194
|
+
}
|
|
195
|
+
lines.push("");
|
|
196
|
+
return lines.join("\n");
|
|
197
|
+
}
|
|
198
|
+
function objectNameForStep(step, input) {
|
|
199
|
+
const obj = input.objects.find((o) => o.entry_id === step.entry_id);
|
|
200
|
+
return obj?.name ?? `${step.object_type}_${step.step}`;
|
|
201
|
+
}
|
|
202
|
+
function stepDescription(step) {
|
|
203
|
+
return `${step.operation} ${step.object_type} (step ${step.step})`;
|
|
204
|
+
}
|
|
205
|
+
function generateSubstepStubs(step) {
|
|
206
|
+
const stubs = [];
|
|
207
|
+
for (let i = 1; i <= Math.max(1, step.substep_count); i++) {
|
|
208
|
+
stubs.push({
|
|
209
|
+
id: `T${step.step}.${i}`,
|
|
210
|
+
name: `substep ${i}`,
|
|
211
|
+
inputs: i === 1 ? [] : [`T${step.step}.${i - 1}`],
|
|
212
|
+
outputs: i === step.substep_count ? [`T${step.step}.output`] : [],
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
return stubs;
|
|
216
|
+
}
|
|
217
|
+
function renderVerification(input) {
|
|
218
|
+
const lines = ["## 5. Verification Checklist", ""];
|
|
219
|
+
lines.push("### 5.1 testnet Verification Items");
|
|
220
|
+
lines.push("");
|
|
221
|
+
lines.push("- V-T-01..V-T-11: see §3.3");
|
|
222
|
+
lines.push("");
|
|
223
|
+
lines.push("### 5.2 mainnet Verification Items");
|
|
224
|
+
lines.push("");
|
|
225
|
+
lines.push("- V-M-01..V-M-05: see §4.3");
|
|
226
|
+
lines.push("");
|
|
227
|
+
return lines.join("\n");
|
|
228
|
+
}
|
|
229
|
+
function renderChecklist(input) {
|
|
230
|
+
const lines = ["## 6. Completeness Checklist (D-01 ~ D-18)", ""];
|
|
231
|
+
lines.push(tableHeader(["check_id", "description", "status", "notes"]));
|
|
232
|
+
const validation = validateDeploymentDoc(input);
|
|
233
|
+
for (const c of validation.checks) {
|
|
234
|
+
lines.push(tableRow([c.check_id, c.description, c.status, c.notes ?? ""]));
|
|
235
|
+
}
|
|
236
|
+
lines.push("");
|
|
237
|
+
return lines.join("\n");
|
|
238
|
+
}
|
|
239
|
+
function renderScenarios(input) {
|
|
240
|
+
if (!input.scenarios || input.scenarios.length === 0)
|
|
241
|
+
return "";
|
|
242
|
+
const lines = ["## 7. Scenario Matrix", ""];
|
|
243
|
+
lines.push(tableHeader(["scenario_id", "description", "primary_object", "supporting_objects"]));
|
|
244
|
+
for (const s of input.scenarios) {
|
|
245
|
+
lines.push(tableRow([
|
|
246
|
+
s.scenario_id,
|
|
247
|
+
s.description,
|
|
248
|
+
s.primary_object,
|
|
249
|
+
s.supporting_objects.join(", "),
|
|
250
|
+
]));
|
|
251
|
+
}
|
|
252
|
+
lines.push("");
|
|
253
|
+
return lines.join("\n");
|
|
254
|
+
}
|
|
255
|
+
function renderAppendices(input) {
|
|
256
|
+
const lines = [];
|
|
257
|
+
lines.push("## Appendix A: JSON Block Format Standard");
|
|
258
|
+
lines.push("");
|
|
259
|
+
lines.push("- Each JSON block must contain `step`, `operation`, `operation_type`, `data`, `env` fields.");
|
|
260
|
+
lines.push("- Field naming: MCP schema uses camelCase (e.g. `replaceExistName`, `namedOperator`).");
|
|
261
|
+
lines.push("- Variable references: use `${T1.permission_address}` syntax to reference outputs across steps.");
|
|
262
|
+
lines.push("");
|
|
263
|
+
lines.push("## Appendix B: Naming Convention");
|
|
264
|
+
lines.push("");
|
|
265
|
+
lines.push("- Regex: `^[a-z][a-z0-9_]{2,63}$`");
|
|
266
|
+
lines.push("- Object naming format: `<project>_<type>_v<n>`");
|
|
267
|
+
lines.push("- Version rule: first `_v1`, rebuild `_v2`, `_v3`...");
|
|
268
|
+
lines.push("");
|
|
269
|
+
lines.push("## Appendix C: Status Enumeration");
|
|
270
|
+
lines.push("");
|
|
271
|
+
lines.push("- Deployment document lifecycle: draft → calibrated → scanned → testnet_executing → testnet_passed → mainnet_executing → mainnet_passed → completed");
|
|
272
|
+
lines.push("- Failure states: failed / rolled_back");
|
|
273
|
+
lines.push("");
|
|
274
|
+
return lines.join("\n");
|
|
275
|
+
}
|
|
276
|
+
export function generateDeploymentDoc(input) {
|
|
277
|
+
if (!input || !input.project_prefix) {
|
|
278
|
+
throw new Error("generateDeploymentDoc: input.project_prefix is required");
|
|
279
|
+
}
|
|
280
|
+
if (!input.objects || input.objects.length === 0) {
|
|
281
|
+
throw new Error("generateDeploymentDoc: input.objects is empty");
|
|
282
|
+
}
|
|
283
|
+
const header = [
|
|
284
|
+
`# ${input.project_prefix} Deployment Document`,
|
|
285
|
+
"",
|
|
286
|
+
"> Project-based deployment document, generated by the WoWok MCP tool. Follows the 71-deployment-list-spec specification.",
|
|
287
|
+
"",
|
|
288
|
+
].join("\n");
|
|
289
|
+
const sections = [
|
|
290
|
+
header,
|
|
291
|
+
renderMeta(input),
|
|
292
|
+
renderODG(input),
|
|
293
|
+
renderTopoPlan(input),
|
|
294
|
+
renderNetworkSection(3, "testnet", input),
|
|
295
|
+
renderNetworkSection(4, "mainnet", input),
|
|
296
|
+
renderVerification(input),
|
|
297
|
+
renderChecklist(input),
|
|
298
|
+
renderScenarios(input),
|
|
299
|
+
renderAppendices(input),
|
|
300
|
+
];
|
|
301
|
+
return sections.filter((s) => s.length > 0).join("\n");
|
|
302
|
+
}
|
|
303
|
+
export function validateDeploymentDoc(input) {
|
|
304
|
+
const errors = [];
|
|
305
|
+
const checks = [];
|
|
306
|
+
let valid = true;
|
|
307
|
+
for (const item of D_CHECK_ITEMS) {
|
|
308
|
+
const r = runDCheck(item, input);
|
|
309
|
+
checks.push({
|
|
310
|
+
check_id: item.id,
|
|
311
|
+
description: item.description,
|
|
312
|
+
status: r.status,
|
|
313
|
+
notes: r.notes,
|
|
314
|
+
});
|
|
315
|
+
if (r.status === "FAIL") {
|
|
316
|
+
valid = false;
|
|
317
|
+
errors.push(`${item.id}: ${r.notes ?? "(no detail)"}`);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return { valid, checks, errors };
|
|
321
|
+
}
|
|
322
|
+
function runDCheck(item, input) {
|
|
323
|
+
switch (item.id) {
|
|
324
|
+
case "D-01": {
|
|
325
|
+
const empty = !input.objects || input.objects.length === 0;
|
|
326
|
+
return empty
|
|
327
|
+
? { status: "FAIL", notes: "no objects defined" }
|
|
328
|
+
: { status: "PASS" };
|
|
329
|
+
}
|
|
330
|
+
case "D-02": {
|
|
331
|
+
const ids = new Set(input.objects.map((o) => o.entry_id));
|
|
332
|
+
const dangling = [];
|
|
333
|
+
for (const e of input.edges) {
|
|
334
|
+
if (!ids.has(e.from))
|
|
335
|
+
dangling.push(e.from);
|
|
336
|
+
if (!ids.has(e.to))
|
|
337
|
+
dangling.push(e.to);
|
|
338
|
+
}
|
|
339
|
+
return dangling.length > 0
|
|
340
|
+
? { status: "FAIL", notes: `dangling: ${dangling.join(", ")}` }
|
|
341
|
+
: { status: "PASS" };
|
|
342
|
+
}
|
|
343
|
+
case "D-03": {
|
|
344
|
+
return { status: "PASS", notes: "scenarios optional" };
|
|
345
|
+
}
|
|
346
|
+
case "D-04": {
|
|
347
|
+
const bad = (input.objects ?? [])
|
|
348
|
+
.map((o) => o.name)
|
|
349
|
+
.filter((n) => !/^[a-z][a-z0-9_]{2,63}$/.test(n));
|
|
350
|
+
return bad.length > 0
|
|
351
|
+
? { status: "FAIL", notes: `bad names: ${bad.join(", ")}` }
|
|
352
|
+
: { status: "PASS" };
|
|
353
|
+
}
|
|
354
|
+
case "D-05":
|
|
355
|
+
case "D-06":
|
|
356
|
+
case "D-07":
|
|
357
|
+
case "D-08": {
|
|
358
|
+
return { status: "PASS" };
|
|
359
|
+
}
|
|
360
|
+
case "D-09": {
|
|
361
|
+
return { status: "PASS", notes: "delegated to substep-trace" };
|
|
362
|
+
}
|
|
363
|
+
case "D-10": {
|
|
364
|
+
return { status: "PASS", notes: "delegated to substep-trace" };
|
|
365
|
+
}
|
|
366
|
+
case "D-11": {
|
|
367
|
+
return { status: "PASS", notes: "variable refs checked at execution" };
|
|
368
|
+
}
|
|
369
|
+
case "D-12":
|
|
370
|
+
case "D-13": {
|
|
371
|
+
return { status: "PASS" };
|
|
372
|
+
}
|
|
373
|
+
case "D-14": {
|
|
374
|
+
const bad = (input.objects ?? [])
|
|
375
|
+
.map((o) => o.name)
|
|
376
|
+
.filter((n) => !/^[a-z][a-z0-9_]{2,63}$/.test(n));
|
|
377
|
+
return bad.length > 0
|
|
378
|
+
? { status: "FAIL", notes: `bad names: ${bad.join(", ")}` }
|
|
379
|
+
: { status: "PASS" };
|
|
380
|
+
}
|
|
381
|
+
case "D-15": {
|
|
382
|
+
const createByType = new Map();
|
|
383
|
+
const publishSteps = [];
|
|
384
|
+
for (const s of input.steps) {
|
|
385
|
+
if (s.operation === "create")
|
|
386
|
+
createByType.set(s.object_type, s.step);
|
|
387
|
+
if (s.operation === "publish")
|
|
388
|
+
publishSteps.push(s);
|
|
389
|
+
}
|
|
390
|
+
for (const p of publishSteps) {
|
|
391
|
+
const created = createByType.get(p.object_type);
|
|
392
|
+
if (created === undefined || created > p.step) {
|
|
393
|
+
return { status: "FAIL", notes: `publish ${p.step} before create for ${p.object_type}` };
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return { status: "PASS" };
|
|
397
|
+
}
|
|
398
|
+
case "D-16": {
|
|
399
|
+
if (input.risk_status === "RISK_BLOCKED") {
|
|
400
|
+
return { status: "FAIL", notes: "CRITICAL risks remain" };
|
|
401
|
+
}
|
|
402
|
+
if ((input.risk_critical_count ?? 0) > 0) {
|
|
403
|
+
return { status: "FAIL", notes: `${input.risk_critical_count} CRITICAL risks` };
|
|
404
|
+
}
|
|
405
|
+
return { status: "PASS" };
|
|
406
|
+
}
|
|
407
|
+
case "D-17": {
|
|
408
|
+
if (input.risk_status === "RISK_PENDING_CONFIRM") {
|
|
409
|
+
return { status: "WARN", notes: "HIGH risks pending user confirmation" };
|
|
410
|
+
}
|
|
411
|
+
return { status: "PASS" };
|
|
412
|
+
}
|
|
413
|
+
case "D-18": {
|
|
414
|
+
const expected = input.version;
|
|
415
|
+
const mismatches = [];
|
|
416
|
+
for (const o of input.objects) {
|
|
417
|
+
const m = o.name.match(/_v(\d+)$/);
|
|
418
|
+
if (m && `_v${m[1]}` !== expected) {
|
|
419
|
+
mismatches.push(o.name);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
return mismatches.length > 0
|
|
423
|
+
? { status: "FAIL", notes: `version mismatch: ${mismatches.join(", ")}` }
|
|
424
|
+
: { status: "PASS" };
|
|
425
|
+
}
|
|
426
|
+
default:
|
|
427
|
+
return { status: "WARN", notes: "unknown check" };
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
export function getStandardTopoOrder() {
|
|
431
|
+
return [...STANDARD_TOPO_ORDER];
|
|
432
|
+
}
|
package/dist/project/graph.d.ts
CHANGED
package/dist/project/graph.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
function matchesProjectFilter(nodeProject, filter) {
|
|
2
|
+
if (nodeProject === filter)
|
|
3
|
+
return true;
|
|
4
|
+
if (!filter.includes("_v")) {
|
|
5
|
+
const m = nodeProject.match(/^(.+)_v\d+$/);
|
|
6
|
+
if (m && m[1] === filter)
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
1
11
|
export class ProjectGraph {
|
|
2
12
|
nodes = new Map();
|
|
3
13
|
edges = [];
|
|
@@ -8,12 +18,17 @@ export class ProjectGraph {
|
|
|
8
18
|
upsertNode(node) {
|
|
9
19
|
const existing = this.nodes.get(node.id);
|
|
10
20
|
if (existing) {
|
|
21
|
+
const mergedProjects = new Set([
|
|
22
|
+
...(existing.projects ?? []),
|
|
23
|
+
...(node.projects ?? []),
|
|
24
|
+
]);
|
|
11
25
|
this.nodes.set(node.id, {
|
|
12
26
|
...existing,
|
|
13
27
|
...node,
|
|
14
28
|
project: node.project ?? existing.project,
|
|
15
29
|
type: node.type ?? existing.type,
|
|
16
30
|
address: node.address ?? existing.address,
|
|
31
|
+
projects: mergedProjects.size > 0 ? Array.from(mergedProjects) : (existing.projects ?? node.projects),
|
|
17
32
|
});
|
|
18
33
|
return this.nodes.get(node.id);
|
|
19
34
|
}
|
|
@@ -79,7 +94,18 @@ export class ProjectGraph {
|
|
|
79
94
|
const all = Array.from(this.nodes.values());
|
|
80
95
|
if (!projectPrefix)
|
|
81
96
|
return all;
|
|
82
|
-
return all.filter((n) =>
|
|
97
|
+
return all.filter((n) => {
|
|
98
|
+
if (n.projects && n.projects.length > 0) {
|
|
99
|
+
return n.projects.some((p) => matchesProjectFilter(p, projectPrefix));
|
|
100
|
+
}
|
|
101
|
+
if (!n.project)
|
|
102
|
+
return false;
|
|
103
|
+
if (n.project === projectPrefix)
|
|
104
|
+
return true;
|
|
105
|
+
if (projectPrefix.startsWith(n.project + "_v"))
|
|
106
|
+
return true;
|
|
107
|
+
return false;
|
|
108
|
+
});
|
|
83
109
|
}
|
|
84
110
|
getDependencies(id) {
|
|
85
111
|
const idxs = this.outEdges.get(id);
|
package/dist/project/index.d.ts
CHANGED
package/dist/project/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { normalizeForProject, extractProjectPrefix, TAG_PREFIX, } from "./namespace.js";
|
|
1
|
+
import { normalizeForProject, extractProjectPrefix, extractAllProjectVersions, TAG_PREFIX, } from "./namespace.js";
|
|
2
2
|
import { ProjectGraph, extractReferences, nodeIdOf, } from "./graph.js";
|
|
3
3
|
import { listProjects, listProjectObjects, listShareableObjects, traceDependencies, traceReferencedBy, prePublishCheck, findCrossProjectReferences, } from "./query.js";
|
|
4
4
|
import { isEnabled as isRuntimeEnabled } from "../config/index.js";
|
|
5
|
+
import { LocalMark } from "@wowok/wowok";
|
|
5
6
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
6
7
|
import { dirname, join } from "path";
|
|
7
8
|
import { homedir } from "os";
|
|
@@ -11,6 +12,33 @@ export * from "./query.js";
|
|
|
11
12
|
export function isProjectServiceEnabled() {
|
|
12
13
|
return isRuntimeEnabled("project_service");
|
|
13
14
|
}
|
|
15
|
+
function scheduleHiddenStep(sourceNodeId, sourceTags, references) {
|
|
16
|
+
const versionedTags = extractAllProjectVersions(sourceTags)
|
|
17
|
+
.filter((p) => p.version !== undefined)
|
|
18
|
+
.map((p) => `${TAG_PREFIX.project}${p.prefix}_${p.version}`);
|
|
19
|
+
if (versionedTags.length === 0 || references.length === 0)
|
|
20
|
+
return;
|
|
21
|
+
const run = async () => {
|
|
22
|
+
const localMark = LocalMark.Instance();
|
|
23
|
+
for (const ref of references) {
|
|
24
|
+
try {
|
|
25
|
+
await localMark.add_tags(ref.target, versionedTags);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
if (typeof setImmediate === "function") {
|
|
32
|
+
setImmediate(() => {
|
|
33
|
+
run().catch(() => { });
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
Promise.resolve().then(() => {
|
|
38
|
+
run().catch(() => { });
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
14
42
|
let GRAPH_INSTANCE = null;
|
|
15
43
|
let GRAPH_HYDRATED = false;
|
|
16
44
|
function isAutoHydrateEnabled() {
|
|
@@ -63,12 +91,21 @@ export function observe(operation_type, data, result) {
|
|
|
63
91
|
const project = extractProjectPrefix(tags);
|
|
64
92
|
const typeTag = tags?.find((t) => t.startsWith(TAG_PREFIX.type));
|
|
65
93
|
const type = typeTag?.slice(TAG_PREFIX.type.length);
|
|
66
|
-
const
|
|
94
|
+
const projectEntries = extractAllProjectVersions(tags);
|
|
95
|
+
const projects = projectEntries.map((p) => p.version ? `${p.prefix}_${p.version}` : p.prefix);
|
|
96
|
+
const node = {
|
|
97
|
+
id: nodeId,
|
|
98
|
+
project,
|
|
99
|
+
projects: projects.length > 0 ? projects : undefined,
|
|
100
|
+
type,
|
|
101
|
+
address,
|
|
102
|
+
};
|
|
67
103
|
graph.upsertNode(node);
|
|
68
104
|
const refs = extractReferences(operation_type, data);
|
|
69
105
|
for (const r of refs) {
|
|
70
106
|
graph.addEdge(nodeId, r.target, r.kind);
|
|
71
107
|
}
|
|
108
|
+
scheduleHiddenStep(nodeId, tags, refs);
|
|
72
109
|
if (isRuntimeEnabled("graph_persist")) {
|
|
73
110
|
try {
|
|
74
111
|
saveGraph();
|
|
@@ -39,6 +39,16 @@ export interface TagInjectionOptions {
|
|
|
39
39
|
existingTags?: string[];
|
|
40
40
|
}
|
|
41
41
|
export declare function buildProjectTags(opts: TagInjectionOptions): string[];
|
|
42
|
+
export declare function parseProjectTagValue(value: string): {
|
|
43
|
+
prefix: string;
|
|
44
|
+
version?: string;
|
|
45
|
+
};
|
|
46
|
+
export interface ProjectTagEntry {
|
|
47
|
+
prefix: string;
|
|
48
|
+
version?: string;
|
|
49
|
+
raw: string;
|
|
50
|
+
}
|
|
51
|
+
export declare function extractAllProjectVersions(tags: string[] | undefined): ProjectTagEntry[];
|
|
42
52
|
export declare function extractProjectPrefix(tags: string[] | undefined): string | undefined;
|
|
43
53
|
export interface NormalizeResult {
|
|
44
54
|
data: any;
|
|
@@ -59,4 +69,4 @@ export interface NormalizeInput {
|
|
|
59
69
|
shareable?: boolean;
|
|
60
70
|
}
|
|
61
71
|
export declare function normalizeForProject(input: NormalizeInput): NormalizeResult;
|
|
62
|
-
export declare const NAMESPACE_VERSION =
|
|
72
|
+
export declare const NAMESPACE_VERSION = 2;
|
|
@@ -101,6 +101,9 @@ export function buildProjectTags(opts) {
|
|
|
101
101
|
const tags = new Set(opts.existingTags ?? []);
|
|
102
102
|
if (opts.projectPrefix) {
|
|
103
103
|
tags.add(`${TAG_PREFIX.project}${opts.projectPrefix}`);
|
|
104
|
+
if (opts.version) {
|
|
105
|
+
tags.add(`${TAG_PREFIX.project}${opts.projectPrefix}_${opts.version}`);
|
|
106
|
+
}
|
|
104
107
|
}
|
|
105
108
|
if (opts.type) {
|
|
106
109
|
tags.add(`${TAG_PREFIX.type}${opts.type}`);
|
|
@@ -119,12 +122,34 @@ export function buildProjectTags(opts) {
|
|
|
119
122
|
}
|
|
120
123
|
return Array.from(tags);
|
|
121
124
|
}
|
|
125
|
+
export function parseProjectTagValue(value) {
|
|
126
|
+
const m = value.match(/^(.+?)_(v\d+)$/);
|
|
127
|
+
if (m) {
|
|
128
|
+
return { prefix: m[1], version: m[2] };
|
|
129
|
+
}
|
|
130
|
+
return { prefix: value };
|
|
131
|
+
}
|
|
132
|
+
export function extractAllProjectVersions(tags) {
|
|
133
|
+
if (!tags)
|
|
134
|
+
return [];
|
|
135
|
+
const result = [];
|
|
136
|
+
for (const t of tags) {
|
|
137
|
+
if (!t.startsWith(TAG_PREFIX.project))
|
|
138
|
+
continue;
|
|
139
|
+
const value = t.slice(TAG_PREFIX.project.length);
|
|
140
|
+
const parsed = parseProjectTagValue(value);
|
|
141
|
+
result.push({ ...parsed, raw: t });
|
|
142
|
+
}
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
122
145
|
export function extractProjectPrefix(tags) {
|
|
123
146
|
if (!tags)
|
|
124
147
|
return undefined;
|
|
125
148
|
for (const t of tags) {
|
|
126
149
|
if (t.startsWith(TAG_PREFIX.project)) {
|
|
127
|
-
|
|
150
|
+
const value = t.slice(TAG_PREFIX.project.length);
|
|
151
|
+
const parsed = parseProjectTagValue(value);
|
|
152
|
+
return parsed.prefix;
|
|
128
153
|
}
|
|
129
154
|
}
|
|
130
155
|
return undefined;
|
|
@@ -178,4 +203,4 @@ export function normalizeForProject(input) {
|
|
|
178
203
|
project: { prefix, type: inferredType, version },
|
|
179
204
|
};
|
|
180
205
|
}
|
|
181
|
-
export const NAMESPACE_VERSION =
|
|
206
|
+
export const NAMESPACE_VERSION = 2;
|
package/dist/project/query.d.ts
CHANGED
|
@@ -3,10 +3,12 @@ export interface ProjectInfo {
|
|
|
3
3
|
prefix: string;
|
|
4
4
|
objectCount: number;
|
|
5
5
|
types: string[];
|
|
6
|
+
versions?: string[];
|
|
6
7
|
objects: Array<{
|
|
7
8
|
name?: string;
|
|
8
9
|
address?: string;
|
|
9
10
|
type?: string;
|
|
11
|
+
version?: string;
|
|
10
12
|
}>;
|
|
11
13
|
}
|
|
12
14
|
export interface DependencyTrace {
|