@wowok/agent-mcp 2.4.3 → 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.js +21 -0
- 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-puzzle.js +3 -2
- package/dist/knowledge/guard-risk.d.ts +1 -1
- package/dist/knowledge/guard-risk.js +12 -14
- package/dist/knowledge/guard-templates.js +1 -1
- 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/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/schema/call/allocation.d.ts +34 -34
- package/dist/schema/call/arbitration.d.ts +141 -141
- package/dist/schema/call/base.d.ts +386 -386
- package/dist/schema/call/base.js +3 -3
- 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 +58 -58
- 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/service.d.ts +231 -231
- 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 +1058 -1074
- 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 +672 -672
- 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/schemas/account_operation.output.json +718 -0
- 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/onchain_operations.output.json +3 -2
- package/dist/schemas/onchain_operations.schema.json +1802 -313
- package/dist/schemas/onchain_operations_allocation.schema.json +2 -1
- 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 +2 -1
- 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 +2 -1
- package/dist/schemas/onchain_operations_treasury.schema.json +2 -1
- 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/config.d.ts +1 -1
- package/dist/tools/handlers/config.js +21 -18
- package/dist/tools/handlers/file-export.d.ts +2 -2
- package/dist/tools/handlers/local.d.ts +3 -30
- package/dist/tools/handlers/local.js +14 -3
- package/dist/tools/handlers/messenger.d.ts +1 -1
- package/dist/tools/handlers/messenger.js +2 -1
- package/dist/tools/handlers/onchain.d.ts +1 -1
- package/dist/tools/handlers/onchain.js +24 -22
- package/dist/tools/handlers/project.d.ts +1 -1
- package/dist/tools/handlers/project.js +258 -18
- package/dist/tools/handlers/query.d.ts +4 -4
- package/dist/tools/handlers/schema-query.d.ts +1 -1
- package/dist/tools/handlers/schema-query.js +21 -20
- package/dist/tools/handlers/trust.d.ts +1 -1
- package/dist/tools/handlers/trust.js +2 -2
- package/dist/tools/handlers/wip.d.ts +1 -1
- package/dist/tools/handlers/wip.js +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +55 -8
- package/dist/tools/rules-hook.d.ts +1 -1
- package/dist/tools/rules-hook.js +3 -2
- package/dist/tools/shared.d.ts +13 -22
- package/dist/tools/types.d.ts +5 -5
- package/dist/tools/wrap.d.ts +10 -2
- package/dist/tools/wrap.js +212 -0
- package/package.json +3 -3
package/dist/config/runtime.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type ServiceName = "confirm_gate" | "project_service" | "harness" | "graph_persist" | "semantic_rich" | "experience_layer" | "customer_intelligence" | "order_monitor" | "industry_evolution";
|
|
2
|
+
export type HarnessTier = "off" | "lightweight" | "full";
|
|
2
3
|
interface ServiceMeta {
|
|
3
4
|
name: ServiceName;
|
|
4
5
|
description: string;
|
|
@@ -7,6 +8,9 @@ interface ServiceMeta {
|
|
|
7
8
|
remindOnToggle: boolean;
|
|
8
9
|
}
|
|
9
10
|
export declare const SERVICE_REGISTRY: ServiceMeta[];
|
|
11
|
+
export declare function getHarnessTier(): HarnessTier;
|
|
12
|
+
export declare function setHarnessTier(tier: HarnessTier): void;
|
|
13
|
+
export declare function resetHarnessTier(): void;
|
|
10
14
|
export declare function isEnabled(service: ServiceName): boolean;
|
|
11
15
|
export declare function setEnabled(service: ServiceName, enabled: boolean): void;
|
|
12
16
|
export declare function toggle(service: ServiceName): boolean;
|
package/dist/config/runtime.js
CHANGED
|
@@ -18,8 +18,8 @@ export const SERVICE_REGISTRY = [
|
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
name: "harness",
|
|
21
|
-
description: "L4 Harness verify/recover loop — automatically validates expected results before and after operations",
|
|
22
|
-
defaultEnabled:
|
|
21
|
+
description: "L4 Harness verify/recover loop — automatically validates expected results before and after operations. GLM5: default ON with tiered enforcement (off/lightweight/full).",
|
|
22
|
+
defaultEnabled: true,
|
|
23
23
|
envVar: "WOWOK_HARNESS_ENABLED",
|
|
24
24
|
remindOnToggle: true,
|
|
25
25
|
},
|
|
@@ -68,6 +68,7 @@ export const SERVICE_REGISTRY = [
|
|
|
68
68
|
];
|
|
69
69
|
const SERVICE_MAP = new Map(SERVICE_REGISTRY.map((s) => [s.name, s]));
|
|
70
70
|
const runtimeOverrides = new Map();
|
|
71
|
+
let harnessTierOverride;
|
|
71
72
|
function configFilePath() {
|
|
72
73
|
const dir = process.env.WOWOK_CONFIG_DIR
|
|
73
74
|
? process.env.WOWOK_CONFIG_DIR
|
|
@@ -103,8 +104,9 @@ function savePersisted() {
|
|
|
103
104
|
if (!existsSync(dir))
|
|
104
105
|
mkdirSync(dir, { recursive: true });
|
|
105
106
|
const data = {
|
|
106
|
-
version:
|
|
107
|
+
version: 2,
|
|
107
108
|
services: Object.fromEntries(runtimeOverrides),
|
|
109
|
+
harness_tier: harnessTierOverride,
|
|
108
110
|
updatedAt: Date.now(),
|
|
109
111
|
};
|
|
110
112
|
writeFileSync(path, JSON.stringify(data, null, 2), "utf-8");
|
|
@@ -119,7 +121,29 @@ function savePersisted() {
|
|
|
119
121
|
runtimeOverrides.set(name, enabled);
|
|
120
122
|
}
|
|
121
123
|
}
|
|
124
|
+
if (persisted.harness_tier) {
|
|
125
|
+
harnessTierOverride = persisted.harness_tier;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
export function getHarnessTier() {
|
|
130
|
+
if (!isEnabled("harness"))
|
|
131
|
+
return "off";
|
|
132
|
+
if (harnessTierOverride)
|
|
133
|
+
return harnessTierOverride;
|
|
134
|
+
const envVal = process.env.WOWOK_HARNESS_TIER;
|
|
135
|
+
if (envVal === "off" || envVal === "lightweight" || envVal === "full") {
|
|
136
|
+
return envVal;
|
|
122
137
|
}
|
|
138
|
+
return "lightweight";
|
|
139
|
+
}
|
|
140
|
+
export function setHarnessTier(tier) {
|
|
141
|
+
harnessTierOverride = tier;
|
|
142
|
+
savePersisted();
|
|
143
|
+
}
|
|
144
|
+
export function resetHarnessTier() {
|
|
145
|
+
harnessTierOverride = undefined;
|
|
146
|
+
savePersisted();
|
|
123
147
|
}
|
|
124
148
|
export function isEnabled(service) {
|
|
125
149
|
if (runtimeOverrides.has(service)) {
|
|
@@ -192,8 +216,8 @@ function buildReminder(service, enabled) {
|
|
|
192
216
|
: "ProjectService is OFF: objects will not be automatically tagged with project membership. To enable, call config_operation toggle project_service.";
|
|
193
217
|
case "harness":
|
|
194
218
|
return enabled
|
|
195
|
-
?
|
|
196
|
-
: "Harness is OFF. To enable
|
|
219
|
+
? `Harness is ON (tier: ${getHarnessTier()}): automatically validates expected results around operations. lightweight=Plan+Verify; full=Plan+Expect+Verify+Recover+Checkpoint. To change tier, set WOWOK_HARNESS_TIER or call harness API. To disable, call config_operation toggle harness.`
|
|
220
|
+
: "Harness is OFF. GLM5 recommends keeping it ON (lightweight tier) for safety. To enable, call config_operation toggle harness.";
|
|
197
221
|
case "graph_persist":
|
|
198
222
|
return enabled
|
|
199
223
|
? "Graph persistence is ON: the object dependency graph will be saved to ~/.wowok/project-graph.json."
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type HarnessTier } from "../config/runtime.js";
|
|
2
|
+
export type EscalationTrigger = "E1_CRITICAL_RISK" | "E2_OPERATION_CRITICAL" | "E3_SUBSTEP_FAILURE" | "E4_REPEATED_FAILURE";
|
|
3
|
+
export interface EscalationEvent {
|
|
4
|
+
trigger: EscalationTrigger;
|
|
5
|
+
timestamp: string;
|
|
6
|
+
reason: string;
|
|
7
|
+
from_tier: HarnessTier;
|
|
8
|
+
to_tier: HarnessTier;
|
|
9
|
+
}
|
|
10
|
+
export interface EscalationState {
|
|
11
|
+
current_tier: HarnessTier;
|
|
12
|
+
history: EscalationEvent[];
|
|
13
|
+
recent_failures: Array<{
|
|
14
|
+
timestamp: number;
|
|
15
|
+
operation: string;
|
|
16
|
+
error_code: string;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
19
|
+
export declare function isFullTier(tier: HarnessTier): boolean;
|
|
20
|
+
export declare function shouldRunHeavyHooks(): boolean;
|
|
21
|
+
export declare function shouldRunLightHooks(): boolean;
|
|
22
|
+
export declare function recordCriticalRisk(description: string): EscalationEvent | null;
|
|
23
|
+
export declare function recordCriticalOperation(operation: string, errorCode: string): EscalationEvent | null;
|
|
24
|
+
export declare function recordSubstepFailure(detail: string): EscalationEvent | null;
|
|
25
|
+
export declare function recordOperationFailure(operation: string, errorCode: string): EscalationEvent | null;
|
|
26
|
+
export declare function getEscalationState(): Readonly<EscalationState>;
|
|
27
|
+
export declare function resetEscalation(): void;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { getHarnessTier, setHarnessTier } from "../config/runtime.js";
|
|
2
|
+
const state = {
|
|
3
|
+
current_tier: "lightweight",
|
|
4
|
+
history: [],
|
|
5
|
+
recent_failures: [],
|
|
6
|
+
};
|
|
7
|
+
const REPEATED_FAILURE_WINDOW_MS = 60_000;
|
|
8
|
+
const REPEATED_FAILURE_THRESHOLD = 3;
|
|
9
|
+
export function isFullTier(tier) {
|
|
10
|
+
return tier === "full";
|
|
11
|
+
}
|
|
12
|
+
export function shouldRunHeavyHooks() {
|
|
13
|
+
return isFullTier(getHarnessTier());
|
|
14
|
+
}
|
|
15
|
+
export function shouldRunLightHooks() {
|
|
16
|
+
const tier = getHarnessTier();
|
|
17
|
+
return tier === "lightweight" || tier === "full";
|
|
18
|
+
}
|
|
19
|
+
export function recordCriticalRisk(description) {
|
|
20
|
+
return escalate("E1_CRITICAL_RISK", `CRITICAL risk detected: ${description}`);
|
|
21
|
+
}
|
|
22
|
+
export function recordCriticalOperation(operation, errorCode) {
|
|
23
|
+
return escalate("E2_OPERATION_CRITICAL", `Operation '${operation}' returned CRITICAL error: ${errorCode}`);
|
|
24
|
+
}
|
|
25
|
+
export function recordSubstepFailure(detail) {
|
|
26
|
+
return escalate("E3_SUBSTEP_FAILURE", `Substep trace reported failure: ${detail}`);
|
|
27
|
+
}
|
|
28
|
+
export function recordOperationFailure(operation, errorCode) {
|
|
29
|
+
const now = Date.now();
|
|
30
|
+
state.recent_failures.push({ timestamp: now, operation, error_code: errorCode });
|
|
31
|
+
state.recent_failures = state.recent_failures.filter((f) => now - f.timestamp <= REPEATED_FAILURE_WINDOW_MS);
|
|
32
|
+
if (state.recent_failures.length >= REPEATED_FAILURE_THRESHOLD) {
|
|
33
|
+
const summary = state.recent_failures
|
|
34
|
+
.map((f) => `${f.operation}:${f.error_code}`)
|
|
35
|
+
.join(", ");
|
|
36
|
+
return escalate("E4_REPEATED_FAILURE", `Repeated failures (${state.recent_failures.length} in ${REPEATED_FAILURE_WINDOW_MS / 1000}s): ${summary}`);
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
export function getEscalationState() {
|
|
41
|
+
return {
|
|
42
|
+
current_tier: getHarnessTier(),
|
|
43
|
+
history: [...state.history],
|
|
44
|
+
recent_failures: [...state.recent_failures],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function resetEscalation() {
|
|
48
|
+
state.history = [];
|
|
49
|
+
state.recent_failures = [];
|
|
50
|
+
setHarnessTier("lightweight");
|
|
51
|
+
state.current_tier = "lightweight";
|
|
52
|
+
}
|
|
53
|
+
function escalate(trigger, reason) {
|
|
54
|
+
const fromTier = getHarnessTier();
|
|
55
|
+
if (fromTier !== "lightweight")
|
|
56
|
+
return null;
|
|
57
|
+
const event = {
|
|
58
|
+
trigger,
|
|
59
|
+
timestamp: new Date().toISOString(),
|
|
60
|
+
reason,
|
|
61
|
+
from_tier: fromTier,
|
|
62
|
+
to_tier: "full",
|
|
63
|
+
};
|
|
64
|
+
setHarnessTier("full");
|
|
65
|
+
state.current_tier = "full";
|
|
66
|
+
state.history.push(event);
|
|
67
|
+
return event;
|
|
68
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { readFileSync } from "fs";
|
|
|
5
5
|
const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8"));
|
|
6
6
|
import { OnchainOperationsSchema, WipOperationsSchema, WatchQueryOperationsSchema, AccountOperationSchema, LocalMarkOperationSchema, LocalInfoOperationSchema, ProtocolInfoQuerySchema, CallOutputSchema, MessengerOperationInputSchema, MessengerOperationOutputSchema, createServerConfig, createCapabilitiesConfig, } from "./schema/index.js";
|
|
7
7
|
import { areSchemasAvailable, getSchemaIndex, } from "./schema-query/index.js";
|
|
8
|
+
import { syncDeployedToolDescriptors, shouldAutoSyncAtStartup, } from "./schema/sync-layer4.js";
|
|
8
9
|
import { isProjectServiceEnabled, observe as projectObserve, } from "./project/index.js";
|
|
9
10
|
import { registerSuccessHook } from "./schema/call/handler.js";
|
|
10
11
|
import { listServices } from "./config/index.js";
|
|
@@ -132,6 +133,26 @@ async function main() {
|
|
|
132
133
|
else {
|
|
133
134
|
console.error("Schema files not available. Run 'npm run generate:schemas' to generate them.");
|
|
134
135
|
}
|
|
136
|
+
if (shouldAutoSyncAtStartup()) {
|
|
137
|
+
try {
|
|
138
|
+
const r = syncDeployedToolDescriptors({ silent: true });
|
|
139
|
+
if (r.failed > 0) {
|
|
140
|
+
console.error(`Layer 4 auto-sync: ${r.ok}/${r.total} ok, ${r.failed} failed`);
|
|
141
|
+
for (const e of r.errors) {
|
|
142
|
+
console.error(` - ${e.tool}: ${e.error}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
console.error(`Layer 4 auto-sync: ${r.ok}/${r.total} tools restored`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
catch (e) {
|
|
150
|
+
console.error(`Layer 4 auto-sync skipped: ${e.message}`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
console.error("Layer 4 auto-sync disabled (WOWOK_SYNC_LAYER4=never)");
|
|
155
|
+
}
|
|
135
156
|
if (isProjectServiceEnabled()) {
|
|
136
157
|
registerSuccessHook((result, context) => {
|
|
137
158
|
if (context?.operation_type && context?.data) {
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { type AllocationRiskAssessment } from "./allocation-risk.js";
|
|
2
|
+
export type ConfirmGateStatus = "approved" | "blocked_checklist" | "blocked_risk" | "blocked_user" | "blocked_environment";
|
|
3
|
+
export interface ConfirmGateResult {
|
|
4
|
+
status: ConfirmGateStatus;
|
|
5
|
+
checklist_result: ChecklistResult;
|
|
6
|
+
risk_result?: AllocationRiskAssessment;
|
|
7
|
+
user_confirmation?: UserConfirmation;
|
|
8
|
+
environment_result?: EnvironmentResult;
|
|
9
|
+
confirmation_text?: string;
|
|
10
|
+
block_reason?: string;
|
|
11
|
+
decision_record: DecisionRecord;
|
|
12
|
+
}
|
|
13
|
+
export interface ChecklistResult {
|
|
14
|
+
all_passed: boolean;
|
|
15
|
+
items: ChecklistItem[];
|
|
16
|
+
}
|
|
17
|
+
export interface ChecklistItem {
|
|
18
|
+
id: string;
|
|
19
|
+
description: string;
|
|
20
|
+
passed: boolean;
|
|
21
|
+
message: string;
|
|
22
|
+
}
|
|
23
|
+
export interface UserConfirmation {
|
|
24
|
+
questions_asked: ConfirmationQuestion[];
|
|
25
|
+
responses: ConfirmationResponse[];
|
|
26
|
+
all_confirmed: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface ConfirmationQuestion {
|
|
29
|
+
id: string;
|
|
30
|
+
question: string;
|
|
31
|
+
requires_explicit_yes: boolean;
|
|
32
|
+
related_risk_ids?: string[];
|
|
33
|
+
}
|
|
34
|
+
export interface ConfirmationResponse {
|
|
35
|
+
question_id: string;
|
|
36
|
+
response: "yes" | "no" | "skip";
|
|
37
|
+
}
|
|
38
|
+
export interface EnvironmentResult {
|
|
39
|
+
passed: boolean;
|
|
40
|
+
checks: {
|
|
41
|
+
name: string;
|
|
42
|
+
passed: boolean;
|
|
43
|
+
message: string;
|
|
44
|
+
}[];
|
|
45
|
+
}
|
|
46
|
+
export interface DecisionRecord {
|
|
47
|
+
timestamp: string;
|
|
48
|
+
gate_version: string;
|
|
49
|
+
final_status: ConfirmGateStatus;
|
|
50
|
+
layers_passed: string[];
|
|
51
|
+
layers_failed: string[];
|
|
52
|
+
}
|
|
53
|
+
export interface AllocationJsonForConfirm {
|
|
54
|
+
object?: {
|
|
55
|
+
name: string;
|
|
56
|
+
type_parameter?: string;
|
|
57
|
+
} | string | null;
|
|
58
|
+
allocators?: {
|
|
59
|
+
description: string;
|
|
60
|
+
threshold: string | number;
|
|
61
|
+
allocators: {
|
|
62
|
+
guard: string;
|
|
63
|
+
sharing: {
|
|
64
|
+
who: {
|
|
65
|
+
GuardIdentifier: number;
|
|
66
|
+
} | {
|
|
67
|
+
Entity: string;
|
|
68
|
+
} | {
|
|
69
|
+
Signer: "signer";
|
|
70
|
+
};
|
|
71
|
+
sharing: string | number;
|
|
72
|
+
mode: "Amount" | "Rate" | "Surplus";
|
|
73
|
+
}[];
|
|
74
|
+
fix?: string | number;
|
|
75
|
+
max?: string | number | null;
|
|
76
|
+
}[];
|
|
77
|
+
};
|
|
78
|
+
coin?: {
|
|
79
|
+
name?: string;
|
|
80
|
+
address?: string;
|
|
81
|
+
} | string;
|
|
82
|
+
payment_info?: object;
|
|
83
|
+
received_coins?: {
|
|
84
|
+
token_type: string;
|
|
85
|
+
received: {
|
|
86
|
+
id: string;
|
|
87
|
+
payment: string;
|
|
88
|
+
}[];
|
|
89
|
+
};
|
|
90
|
+
alloc_by_guard?: string;
|
|
91
|
+
}
|
|
92
|
+
export interface ConfirmGateInput {
|
|
93
|
+
allocation_json: AllocationJsonForConfirm;
|
|
94
|
+
intent?: string;
|
|
95
|
+
operation_type?: "create" | "receive" | "alloc_by_guard" | "query";
|
|
96
|
+
guard_signer_bindings?: Record<string, boolean>;
|
|
97
|
+
order_already_has_allocation?: boolean;
|
|
98
|
+
bound_order?: string;
|
|
99
|
+
guard_conditions_mutually_exclusive?: boolean;
|
|
100
|
+
referenced_treasuries_permissions?: Record<string, string>;
|
|
101
|
+
passport_identifier_types?: Record<number, string>;
|
|
102
|
+
skip_user_confirmation?: boolean;
|
|
103
|
+
skip_environment_check?: boolean;
|
|
104
|
+
}
|
|
105
|
+
export declare const ALLOCATION_PUBLISH_CHECKLIST: ChecklistItem[];
|
|
106
|
+
export declare const ALLOCATION_CONFIRMATION_QUESTIONS: ConfirmationQuestion[];
|
|
107
|
+
export declare const ALLOCATION_CONFIRM_VERSION = "1.0.0";
|
|
108
|
+
export declare function runAllocationConfirmGate(input: ConfirmGateInput): ConfirmGateResult;
|
|
109
|
+
export interface ProgressiveCheckResult {
|
|
110
|
+
stage: "checklist" | "risk" | "confirmation" | "environment" | "complete";
|
|
111
|
+
status: "pass" | "fail" | "pending";
|
|
112
|
+
message: string;
|
|
113
|
+
next_action?: string;
|
|
114
|
+
}
|
|
115
|
+
export declare function progressiveAllocationCheck(input: ConfirmGateInput): ProgressiveCheckResult;
|