@neuroverseos/governance 0.2.1 → 0.2.2
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/adapters/express.d.cts +1 -1
- package/dist/adapters/express.d.ts +1 -1
- package/dist/adapters/express.js +3 -3
- package/dist/adapters/index.cjs +44 -8
- package/dist/adapters/index.d.cts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.js +6 -6
- package/dist/adapters/langchain.cjs +34 -4
- package/dist/adapters/langchain.d.cts +1 -1
- package/dist/adapters/langchain.d.ts +1 -1
- package/dist/adapters/langchain.js +3 -3
- package/dist/adapters/openai.cjs +34 -4
- package/dist/adapters/openai.d.cts +1 -1
- package/dist/adapters/openai.d.ts +1 -1
- package/dist/adapters/openai.js +3 -3
- package/dist/adapters/openclaw.cjs +34 -4
- package/dist/adapters/openclaw.d.cts +1 -1
- package/dist/adapters/openclaw.d.ts +1 -1
- package/dist/adapters/openclaw.js +3 -3
- package/dist/{chunk-ZL4AHY4X.js → chunk-2NICNKOM.js} +1 -1
- package/dist/{chunk-PQBJBVSW.js → chunk-4JRYGIO7.js} +1 -1
- package/dist/{chunk-P74Y66ZV.js → chunk-4QXB6PEO.js} +29 -2
- package/dist/{chunk-37JG24WH.js → chunk-6CZSKEY5.js} +3 -0
- package/dist/{chunk-PAX2P6ZP.js → chunk-DPVS43ZT.js} +12 -5
- package/dist/{chunk-5EDDNJU6.js → chunk-KEST3MWO.js} +7 -4
- package/dist/{chunk-TINSRYXQ.js → chunk-OHAC6HJE.js} +7 -4
- package/dist/{chunk-ADV7Q2LJ.js → chunk-PDOZHZWL.js} +1 -1
- package/dist/{chunk-2JQJ5U5X.js → chunk-QPASI2BR.js} +1 -1
- package/dist/{chunk-IVPKFJX3.js → chunk-RWXVAH6P.js} +7 -4
- package/dist/{chunk-UPJNTSVM.js → chunk-SKU3GAPD.js} +7 -4
- package/dist/cli/neuroverse.cjs +89 -25
- package/dist/cli/neuroverse.js +8 -8
- package/dist/cli/plan.cjs +59 -14
- package/dist/cli/plan.js +30 -15
- package/dist/cli/run.cjs +34 -4
- package/dist/cli/run.js +2 -2
- package/dist/{doctor-V72UM2TC.js → doctor-QV6HELS5.js} +1 -1
- package/dist/{guard-WA3FCCIO.js → guard-GFLQZY6U.js} +2 -2
- package/dist/{guard-contract-D-2LQInm.d.cts → guard-contract-Cm91Kp4j.d.cts} +39 -1
- package/dist/{guard-contract-D-2LQInm.d.ts → guard-contract-Cm91Kp4j.d.ts} +39 -1
- package/dist/{guard-engine-D7X4CVAE.js → guard-engine-JLTUARGU.js} +2 -2
- package/dist/{impact-BWULZ5RP.js → impact-XPECYRLH.js} +4 -4
- package/dist/index.cjs +47 -7
- package/dist/index.d.cts +20 -5
- package/dist/index.d.ts +20 -5
- package/dist/index.js +7 -7
- package/dist/{mcp-server-YUOQP4M5.js → mcp-server-LZVJHBT5.js} +3 -3
- package/dist/{playground-CBXMAW2B.js → playground-FGOMASHN.js} +2 -2
- package/dist/{redteam-SSNABQ7W.js → redteam-SK7AMIG3.js} +2 -2
- package/dist/{session-MWRBTCYX.js → session-VISISNWJ.js} +3 -3
- package/dist/{test-3GZSG5FR.js → test-75AVHC3R.js} +2 -2
- package/dist/{trace-TM4Z7G73.js → trace-JVF67VR3.js} +3 -3
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
evaluateGuard
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4JRYGIO7.js";
|
|
4
4
|
import {
|
|
5
5
|
loadWorld
|
|
6
6
|
} from "./chunk-JZPQGIKR.js";
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
advancePlan,
|
|
9
9
|
evaluatePlan,
|
|
10
10
|
getPlanProgress
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4QXB6PEO.js";
|
|
12
12
|
|
|
13
13
|
// src/adapters/langchain.ts
|
|
14
14
|
var GovernanceBlockedError = class extends Error {
|
|
@@ -79,8 +79,11 @@ var NeuroVerseCallbackHandler = class {
|
|
|
79
79
|
if (verdict.status === "ALLOW" && this.activePlan) {
|
|
80
80
|
const planVerdict = evaluatePlan(event, this.activePlan);
|
|
81
81
|
if (planVerdict.matchedStep) {
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
const advResult = advancePlan(this.activePlan, planVerdict.matchedStep);
|
|
83
|
+
if (advResult.success && advResult.plan) {
|
|
84
|
+
this.activePlan = advResult.plan;
|
|
85
|
+
this.engineOptions.plan = this.activePlan;
|
|
86
|
+
}
|
|
84
87
|
const progress = getPlanProgress(this.activePlan);
|
|
85
88
|
this.options.onPlanProgress?.(progress);
|
|
86
89
|
if (progress.completed === progress.total) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
evaluateGuard
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4JRYGIO7.js";
|
|
4
4
|
import {
|
|
5
5
|
loadWorld
|
|
6
6
|
} from "./chunk-JZPQGIKR.js";
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
advancePlan,
|
|
9
9
|
evaluatePlan,
|
|
10
10
|
getPlanProgress
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4QXB6PEO.js";
|
|
12
12
|
|
|
13
13
|
// src/adapters/openclaw.ts
|
|
14
14
|
var GovernanceBlockedError = class extends Error {
|
|
@@ -70,8 +70,11 @@ var NeuroVersePlugin = class {
|
|
|
70
70
|
if (verdict.status === "ALLOW" && this.activePlan) {
|
|
71
71
|
const planVerdict = evaluatePlan(event, this.activePlan);
|
|
72
72
|
if (planVerdict.matchedStep) {
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
const advResult = advancePlan(this.activePlan, planVerdict.matchedStep);
|
|
74
|
+
if (advResult.success && advResult.plan) {
|
|
75
|
+
this.activePlan = advResult.plan;
|
|
76
|
+
this.engineOptions.plan = this.activePlan;
|
|
77
|
+
}
|
|
75
78
|
const progress = getPlanProgress(this.activePlan);
|
|
76
79
|
this.options.onPlanProgress?.(progress);
|
|
77
80
|
if (progress.completed === progress.total) {
|
package/dist/cli/neuroverse.cjs
CHANGED
|
@@ -4528,13 +4528,40 @@ function getPlanProgress(plan) {
|
|
|
4528
4528
|
percentage: total > 0 ? Math.round(completed / total * 100) : 0
|
|
4529
4529
|
};
|
|
4530
4530
|
}
|
|
4531
|
-
function advancePlan(plan, stepId) {
|
|
4532
|
-
|
|
4531
|
+
function advancePlan(plan, stepId, evidence) {
|
|
4532
|
+
const step = plan.steps.find((s) => s.id === stepId);
|
|
4533
|
+
if (!step) {
|
|
4534
|
+
return { success: false, reason: `Step "${stepId}" not found in plan.` };
|
|
4535
|
+
}
|
|
4536
|
+
if (step.status === "completed") {
|
|
4537
|
+
return { success: false, reason: `Step "${stepId}" is already completed.` };
|
|
4538
|
+
}
|
|
4539
|
+
const mode = plan.completion ?? "trust";
|
|
4540
|
+
if (mode === "verified" && step.verify) {
|
|
4541
|
+
if (!evidence) {
|
|
4542
|
+
return {
|
|
4543
|
+
success: false,
|
|
4544
|
+
reason: `Step "${step.label}" requires evidence (verify: ${step.verify}). Provide evidence to advance.`
|
|
4545
|
+
};
|
|
4546
|
+
}
|
|
4547
|
+
if (evidence.type !== step.verify) {
|
|
4548
|
+
return {
|
|
4549
|
+
success: false,
|
|
4550
|
+
reason: `Evidence type "${evidence.type}" does not match required verification "${step.verify}".`
|
|
4551
|
+
};
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4554
|
+
const updatedPlan = {
|
|
4533
4555
|
...plan,
|
|
4534
4556
|
steps: plan.steps.map(
|
|
4535
4557
|
(s) => s.id === stepId ? { ...s, status: "completed" } : s
|
|
4536
4558
|
)
|
|
4537
4559
|
};
|
|
4560
|
+
return {
|
|
4561
|
+
success: true,
|
|
4562
|
+
plan: updatedPlan,
|
|
4563
|
+
evidence: evidence ?? void 0
|
|
4564
|
+
};
|
|
4538
4565
|
}
|
|
4539
4566
|
function evaluatePlan(event, plan) {
|
|
4540
4567
|
const progress = getPlanProgress(plan);
|
|
@@ -6322,8 +6349,11 @@ var init_langchain = __esm({
|
|
|
6322
6349
|
if (verdict.status === "ALLOW" && this.activePlan) {
|
|
6323
6350
|
const planVerdict = evaluatePlan(event, this.activePlan);
|
|
6324
6351
|
if (planVerdict.matchedStep) {
|
|
6325
|
-
|
|
6326
|
-
|
|
6352
|
+
const advResult = advancePlan(this.activePlan, planVerdict.matchedStep);
|
|
6353
|
+
if (advResult.success && advResult.plan) {
|
|
6354
|
+
this.activePlan = advResult.plan;
|
|
6355
|
+
this.engineOptions.plan = this.activePlan;
|
|
6356
|
+
}
|
|
6327
6357
|
const progress = getPlanProgress(this.activePlan);
|
|
6328
6358
|
this.options.onPlanProgress?.(progress);
|
|
6329
6359
|
if (progress.completed === progress.total) {
|
|
@@ -6417,8 +6447,11 @@ var init_openai = __esm({
|
|
|
6417
6447
|
if (verdict.status === "ALLOW" && this.activePlan) {
|
|
6418
6448
|
const planVerdict = evaluatePlan(event, this.activePlan);
|
|
6419
6449
|
if (planVerdict.matchedStep) {
|
|
6420
|
-
|
|
6421
|
-
|
|
6450
|
+
const advResult = advancePlan(this.activePlan, planVerdict.matchedStep);
|
|
6451
|
+
if (advResult.success && advResult.plan) {
|
|
6452
|
+
this.activePlan = advResult.plan;
|
|
6453
|
+
this.engineOptions.plan = this.activePlan;
|
|
6454
|
+
}
|
|
6422
6455
|
const progress = getPlanProgress(this.activePlan);
|
|
6423
6456
|
this.options.onPlanProgress?.(progress);
|
|
6424
6457
|
if (progress.completed === progress.total) {
|
|
@@ -6551,8 +6584,11 @@ var init_openclaw = __esm({
|
|
|
6551
6584
|
if (verdict.status === "ALLOW" && this.activePlan) {
|
|
6552
6585
|
const planVerdict = evaluatePlan(event, this.activePlan);
|
|
6553
6586
|
if (planVerdict.matchedStep) {
|
|
6554
|
-
|
|
6555
|
-
|
|
6587
|
+
const advResult = advancePlan(this.activePlan, planVerdict.matchedStep);
|
|
6588
|
+
if (advResult.success && advResult.plan) {
|
|
6589
|
+
this.activePlan = advResult.plan;
|
|
6590
|
+
this.engineOptions.plan = this.activePlan;
|
|
6591
|
+
}
|
|
6556
6592
|
const progress = getPlanProgress(this.activePlan);
|
|
6557
6593
|
this.options.onPlanProgress?.(progress);
|
|
6558
6594
|
if (progress.completed === progress.total) {
|
|
@@ -7486,10 +7522,13 @@ function parsePlanMarkdown(markdown) {
|
|
|
7486
7522
|
if (frontmatter.expires) {
|
|
7487
7523
|
expires_at = new Date(frontmatter.expires).toISOString();
|
|
7488
7524
|
}
|
|
7525
|
+
const completionRaw = frontmatter.completion?.toLowerCase();
|
|
7526
|
+
const completion = completionRaw === "verified" ? "verified" : "trust";
|
|
7489
7527
|
const plan = {
|
|
7490
7528
|
plan_id: frontmatter.plan_id,
|
|
7491
7529
|
objective: frontmatter.objective ?? "",
|
|
7492
7530
|
sequential: frontmatter.sequential === "true",
|
|
7531
|
+
completion,
|
|
7493
7532
|
steps,
|
|
7494
7533
|
constraints,
|
|
7495
7534
|
world_id: frontmatter.world ?? void 0,
|
|
@@ -7578,6 +7617,8 @@ async function compileCommand(args) {
|
|
|
7578
7617
|
process.stdout.write(` Constraints: ${plan.constraints.length}
|
|
7579
7618
|
`);
|
|
7580
7619
|
process.stdout.write(` Sequential: ${plan.sequential}
|
|
7620
|
+
`);
|
|
7621
|
+
process.stdout.write(` Completion: ${plan.completion}
|
|
7581
7622
|
`);
|
|
7582
7623
|
if (plan.world_id) process.stdout.write(` World: ${plan.world_id}
|
|
7583
7624
|
`);
|
|
@@ -7653,6 +7694,8 @@ async function statusCommand(args) {
|
|
|
7653
7694
|
process.stdout.write(`Plan: ${plan.plan_id}
|
|
7654
7695
|
`);
|
|
7655
7696
|
process.stdout.write(`Objective: ${plan.objective}
|
|
7697
|
+
`);
|
|
7698
|
+
process.stdout.write(`Completion: ${plan.completion ?? "trust"}
|
|
7656
7699
|
`);
|
|
7657
7700
|
process.stdout.write(`Progress: ${progress.completed}/${progress.total} (${progress.percentage}%)
|
|
7658
7701
|
`);
|
|
@@ -7681,7 +7724,7 @@ async function advanceCommand(args) {
|
|
|
7681
7724
|
const stepId = args.find((a) => !a.startsWith("--"));
|
|
7682
7725
|
const planPath = parseArg(args, "--plan");
|
|
7683
7726
|
if (!stepId || !planPath) {
|
|
7684
|
-
process.stderr.write("Usage: neuroverse plan advance <step_id> --plan plan.json\n");
|
|
7727
|
+
process.stderr.write("Usage: neuroverse plan advance <step_id> --plan plan.json [--evidence <type> --proof <proof>]\n");
|
|
7685
7728
|
process.exit(PLAN_EXIT_CODES.ERROR);
|
|
7686
7729
|
return;
|
|
7687
7730
|
}
|
|
@@ -7694,25 +7737,36 @@ async function advanceCommand(args) {
|
|
|
7694
7737
|
process.exit(PLAN_EXIT_CODES.ERROR);
|
|
7695
7738
|
return;
|
|
7696
7739
|
}
|
|
7697
|
-
const
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7740
|
+
const evidenceType = parseArg(args, "--evidence");
|
|
7741
|
+
const evidenceProof = parseArg(args, "--proof");
|
|
7742
|
+
let evidence;
|
|
7743
|
+
if (evidenceType && evidenceProof) {
|
|
7744
|
+
evidence = {
|
|
7745
|
+
type: evidenceType,
|
|
7746
|
+
proof: evidenceProof,
|
|
7747
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
7748
|
+
};
|
|
7749
|
+
} else if (evidenceType || evidenceProof) {
|
|
7750
|
+
process.stderr.write("Error: --evidence and --proof must both be provided.\n");
|
|
7703
7751
|
process.exit(PLAN_EXIT_CODES.ERROR);
|
|
7704
7752
|
return;
|
|
7705
7753
|
}
|
|
7706
|
-
|
|
7707
|
-
|
|
7754
|
+
const result = advancePlan(plan, stepId, evidence);
|
|
7755
|
+
if (!result.success) {
|
|
7756
|
+
process.stderr.write(`Error: ${result.reason}
|
|
7708
7757
|
`);
|
|
7758
|
+
process.exit(PLAN_EXIT_CODES.ERROR);
|
|
7709
7759
|
return;
|
|
7710
7760
|
}
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
const
|
|
7761
|
+
(0, import_fs2.writeFileSync)(planPath, JSON.stringify(result.plan, null, 2) + "\n");
|
|
7762
|
+
const progress = getPlanProgress(result.plan);
|
|
7763
|
+
const step = plan.steps.find((s) => s.id === stepId);
|
|
7714
7764
|
process.stdout.write(`Step completed: ${step.label}
|
|
7715
7765
|
`);
|
|
7766
|
+
if (result.evidence) {
|
|
7767
|
+
process.stdout.write(`Evidence: ${result.evidence.type} = ${result.evidence.proof}
|
|
7768
|
+
`);
|
|
7769
|
+
}
|
|
7716
7770
|
process.stdout.write(`Progress: ${progress.completed}/${progress.total} (${progress.percentage}%)
|
|
7717
7771
|
`);
|
|
7718
7772
|
if (progress.completed === progress.total) {
|
|
@@ -8270,8 +8324,11 @@ var init_session = __esm({
|
|
|
8270
8324
|
if (this.state.plan) {
|
|
8271
8325
|
const planVerdict = evaluatePlan(event, this.state.plan);
|
|
8272
8326
|
if (planVerdict.matchedStep) {
|
|
8273
|
-
|
|
8274
|
-
|
|
8327
|
+
const advResult = advancePlan(this.state.plan, planVerdict.matchedStep);
|
|
8328
|
+
if (advResult.success && advResult.plan) {
|
|
8329
|
+
this.state.plan = advResult.plan;
|
|
8330
|
+
this.engineOptions.plan = this.state.plan;
|
|
8331
|
+
}
|
|
8275
8332
|
this.state.progress = getPlanProgress(this.state.plan);
|
|
8276
8333
|
this.config.onPlanProgress?.(this.state.progress);
|
|
8277
8334
|
if (this.state.progress.completed === this.state.progress.total) {
|
|
@@ -8885,8 +8942,11 @@ Closest plan step: "${pc.closestStepLabel}"`;
|
|
|
8885
8942
|
if (this.plan) {
|
|
8886
8943
|
const planVerdict = evaluatePlan(event, this.plan);
|
|
8887
8944
|
if (planVerdict.matchedStep) {
|
|
8888
|
-
|
|
8889
|
-
|
|
8945
|
+
const advResult = advancePlan(this.plan, planVerdict.matchedStep);
|
|
8946
|
+
if (advResult.success && advResult.plan) {
|
|
8947
|
+
this.plan = advResult.plan;
|
|
8948
|
+
this.engineOptions.plan = this.plan;
|
|
8949
|
+
}
|
|
8890
8950
|
const progress = getPlanProgress(this.plan);
|
|
8891
8951
|
process.stderr.write(
|
|
8892
8952
|
`[neuroverse-mcp] Plan: ${progress.completed}/${progress.total} (${progress.percentage}%)
|
|
@@ -9046,7 +9106,11 @@ Closest plan step: "${pc.closestStepLabel}"`;
|
|
|
9046
9106
|
if (step.status === "completed") {
|
|
9047
9107
|
return { content: [{ type: "text", text: `Step "${stepId}" is already completed.` }] };
|
|
9048
9108
|
}
|
|
9049
|
-
|
|
9109
|
+
const advResult = advancePlan(this.plan, stepId);
|
|
9110
|
+
if (!advResult.success) {
|
|
9111
|
+
return { content: [{ type: "text", text: `Cannot advance: ${advResult.reason}` }] };
|
|
9112
|
+
}
|
|
9113
|
+
this.plan = advResult.plan;
|
|
9050
9114
|
this.engineOptions.plan = this.plan;
|
|
9051
9115
|
const progress = getPlanProgress(this.plan);
|
|
9052
9116
|
let text = `Step completed: ${step.label}
|
package/dist/cli/neuroverse.js
CHANGED
|
@@ -105,23 +105,23 @@ async function main() {
|
|
|
105
105
|
return validateMain(subArgs);
|
|
106
106
|
}
|
|
107
107
|
case "guard": {
|
|
108
|
-
const { main: guardMain } = await import("../guard-
|
|
108
|
+
const { main: guardMain } = await import("../guard-GFLQZY6U.js");
|
|
109
109
|
return guardMain(subArgs);
|
|
110
110
|
}
|
|
111
111
|
case "test": {
|
|
112
|
-
const { main: testMain } = await import("../test-
|
|
112
|
+
const { main: testMain } = await import("../test-75AVHC3R.js");
|
|
113
113
|
return testMain(subArgs);
|
|
114
114
|
}
|
|
115
115
|
case "redteam": {
|
|
116
|
-
const { main: redteamMain } = await import("../redteam-
|
|
116
|
+
const { main: redteamMain } = await import("../redteam-SK7AMIG3.js");
|
|
117
117
|
return redteamMain(subArgs);
|
|
118
118
|
}
|
|
119
119
|
case "doctor": {
|
|
120
|
-
const { main: doctorMain } = await import("../doctor-
|
|
120
|
+
const { main: doctorMain } = await import("../doctor-QV6HELS5.js");
|
|
121
121
|
return doctorMain(subArgs);
|
|
122
122
|
}
|
|
123
123
|
case "playground": {
|
|
124
|
-
const { main: playgroundMain } = await import("../playground-
|
|
124
|
+
const { main: playgroundMain } = await import("../playground-FGOMASHN.js");
|
|
125
125
|
return playgroundMain(subArgs);
|
|
126
126
|
}
|
|
127
127
|
case "plan": {
|
|
@@ -133,7 +133,7 @@ async function main() {
|
|
|
133
133
|
return runMain(subArgs);
|
|
134
134
|
}
|
|
135
135
|
case "mcp": {
|
|
136
|
-
const { startMcpServer } = await import("../mcp-server-
|
|
136
|
+
const { startMcpServer } = await import("../mcp-server-LZVJHBT5.js");
|
|
137
137
|
return startMcpServer(subArgs);
|
|
138
138
|
}
|
|
139
139
|
case "worlds": {
|
|
@@ -141,11 +141,11 @@ async function main() {
|
|
|
141
141
|
return worldMain(["list", ...subArgs]);
|
|
142
142
|
}
|
|
143
143
|
case "trace": {
|
|
144
|
-
const { main: traceMain } = await import("../trace-
|
|
144
|
+
const { main: traceMain } = await import("../trace-JVF67VR3.js");
|
|
145
145
|
return traceMain(subArgs);
|
|
146
146
|
}
|
|
147
147
|
case "impact": {
|
|
148
|
-
const { main: impactMain } = await import("../impact-
|
|
148
|
+
const { main: impactMain } = await import("../impact-XPECYRLH.js");
|
|
149
149
|
return impactMain(subArgs);
|
|
150
150
|
}
|
|
151
151
|
case "world": {
|
package/dist/cli/plan.cjs
CHANGED
|
@@ -137,13 +137,40 @@ function getPlanProgress(plan) {
|
|
|
137
137
|
percentage: total > 0 ? Math.round(completed / total * 100) : 0
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
|
-
function advancePlan(plan, stepId) {
|
|
141
|
-
|
|
140
|
+
function advancePlan(plan, stepId, evidence) {
|
|
141
|
+
const step = plan.steps.find((s) => s.id === stepId);
|
|
142
|
+
if (!step) {
|
|
143
|
+
return { success: false, reason: `Step "${stepId}" not found in plan.` };
|
|
144
|
+
}
|
|
145
|
+
if (step.status === "completed") {
|
|
146
|
+
return { success: false, reason: `Step "${stepId}" is already completed.` };
|
|
147
|
+
}
|
|
148
|
+
const mode = plan.completion ?? "trust";
|
|
149
|
+
if (mode === "verified" && step.verify) {
|
|
150
|
+
if (!evidence) {
|
|
151
|
+
return {
|
|
152
|
+
success: false,
|
|
153
|
+
reason: `Step "${step.label}" requires evidence (verify: ${step.verify}). Provide evidence to advance.`
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
if (evidence.type !== step.verify) {
|
|
157
|
+
return {
|
|
158
|
+
success: false,
|
|
159
|
+
reason: `Evidence type "${evidence.type}" does not match required verification "${step.verify}".`
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const updatedPlan = {
|
|
142
164
|
...plan,
|
|
143
165
|
steps: plan.steps.map(
|
|
144
166
|
(s) => s.id === stepId ? { ...s, status: "completed" } : s
|
|
145
167
|
)
|
|
146
168
|
};
|
|
169
|
+
return {
|
|
170
|
+
success: true,
|
|
171
|
+
plan: updatedPlan,
|
|
172
|
+
evidence: evidence ?? void 0
|
|
173
|
+
};
|
|
147
174
|
}
|
|
148
175
|
function evaluatePlan(event, plan) {
|
|
149
176
|
const progress = getPlanProgress(plan);
|
|
@@ -1192,10 +1219,13 @@ function parsePlanMarkdown(markdown) {
|
|
|
1192
1219
|
if (frontmatter.expires) {
|
|
1193
1220
|
expires_at = new Date(frontmatter.expires).toISOString();
|
|
1194
1221
|
}
|
|
1222
|
+
const completionRaw = frontmatter.completion?.toLowerCase();
|
|
1223
|
+
const completion = completionRaw === "verified" ? "verified" : "trust";
|
|
1195
1224
|
const plan = {
|
|
1196
1225
|
plan_id: frontmatter.plan_id,
|
|
1197
1226
|
objective: frontmatter.objective ?? "",
|
|
1198
1227
|
sequential: frontmatter.sequential === "true",
|
|
1228
|
+
completion,
|
|
1199
1229
|
steps,
|
|
1200
1230
|
constraints,
|
|
1201
1231
|
world_id: frontmatter.world ?? void 0,
|
|
@@ -1272,6 +1302,8 @@ async function compileCommand(args) {
|
|
|
1272
1302
|
process.stdout.write(` Constraints: ${plan.constraints.length}
|
|
1273
1303
|
`);
|
|
1274
1304
|
process.stdout.write(` Sequential: ${plan.sequential}
|
|
1305
|
+
`);
|
|
1306
|
+
process.stdout.write(` Completion: ${plan.completion}
|
|
1275
1307
|
`);
|
|
1276
1308
|
if (plan.world_id) process.stdout.write(` World: ${plan.world_id}
|
|
1277
1309
|
`);
|
|
@@ -1347,6 +1379,8 @@ async function statusCommand(args) {
|
|
|
1347
1379
|
process.stdout.write(`Plan: ${plan.plan_id}
|
|
1348
1380
|
`);
|
|
1349
1381
|
process.stdout.write(`Objective: ${plan.objective}
|
|
1382
|
+
`);
|
|
1383
|
+
process.stdout.write(`Completion: ${plan.completion ?? "trust"}
|
|
1350
1384
|
`);
|
|
1351
1385
|
process.stdout.write(`Progress: ${progress.completed}/${progress.total} (${progress.percentage}%)
|
|
1352
1386
|
`);
|
|
@@ -1375,7 +1409,7 @@ async function advanceCommand(args) {
|
|
|
1375
1409
|
const stepId = args.find((a) => !a.startsWith("--"));
|
|
1376
1410
|
const planPath = parseArg(args, "--plan");
|
|
1377
1411
|
if (!stepId || !planPath) {
|
|
1378
|
-
process.stderr.write("Usage: neuroverse plan advance <step_id> --plan plan.json\n");
|
|
1412
|
+
process.stderr.write("Usage: neuroverse plan advance <step_id> --plan plan.json [--evidence <type> --proof <proof>]\n");
|
|
1379
1413
|
process.exit(PLAN_EXIT_CODES.ERROR);
|
|
1380
1414
|
return;
|
|
1381
1415
|
}
|
|
@@ -1388,25 +1422,36 @@ async function advanceCommand(args) {
|
|
|
1388
1422
|
process.exit(PLAN_EXIT_CODES.ERROR);
|
|
1389
1423
|
return;
|
|
1390
1424
|
}
|
|
1391
|
-
const
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1425
|
+
const evidenceType = parseArg(args, "--evidence");
|
|
1426
|
+
const evidenceProof = parseArg(args, "--proof");
|
|
1427
|
+
let evidence;
|
|
1428
|
+
if (evidenceType && evidenceProof) {
|
|
1429
|
+
evidence = {
|
|
1430
|
+
type: evidenceType,
|
|
1431
|
+
proof: evidenceProof,
|
|
1432
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1433
|
+
};
|
|
1434
|
+
} else if (evidenceType || evidenceProof) {
|
|
1435
|
+
process.stderr.write("Error: --evidence and --proof must both be provided.\n");
|
|
1397
1436
|
process.exit(PLAN_EXIT_CODES.ERROR);
|
|
1398
1437
|
return;
|
|
1399
1438
|
}
|
|
1400
|
-
|
|
1401
|
-
|
|
1439
|
+
const result = advancePlan(plan, stepId, evidence);
|
|
1440
|
+
if (!result.success) {
|
|
1441
|
+
process.stderr.write(`Error: ${result.reason}
|
|
1402
1442
|
`);
|
|
1443
|
+
process.exit(PLAN_EXIT_CODES.ERROR);
|
|
1403
1444
|
return;
|
|
1404
1445
|
}
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
const
|
|
1446
|
+
(0, import_fs.writeFileSync)(planPath, JSON.stringify(result.plan, null, 2) + "\n");
|
|
1447
|
+
const progress = getPlanProgress(result.plan);
|
|
1448
|
+
const step = plan.steps.find((s) => s.id === stepId);
|
|
1408
1449
|
process.stdout.write(`Step completed: ${step.label}
|
|
1409
1450
|
`);
|
|
1451
|
+
if (result.evidence) {
|
|
1452
|
+
process.stdout.write(`Evidence: ${result.evidence.type} = ${result.evidence.proof}
|
|
1453
|
+
`);
|
|
1454
|
+
}
|
|
1410
1455
|
process.stdout.write(`Progress: ${progress.completed}/${progress.total} (${progress.percentage}%)
|
|
1411
1456
|
`);
|
|
1412
1457
|
if (progress.completed === progress.total) {
|
package/dist/cli/plan.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PLAN_EXIT_CODES,
|
|
3
3
|
parsePlanMarkdown
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-6CZSKEY5.js";
|
|
5
5
|
import {
|
|
6
6
|
advancePlan,
|
|
7
7
|
evaluatePlan,
|
|
8
8
|
getPlanProgress
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-4QXB6PEO.js";
|
|
10
10
|
import "../chunk-YZFATT7X.js";
|
|
11
11
|
|
|
12
12
|
// src/cli/plan.ts
|
|
@@ -65,6 +65,8 @@ async function compileCommand(args) {
|
|
|
65
65
|
process.stdout.write(` Constraints: ${plan.constraints.length}
|
|
66
66
|
`);
|
|
67
67
|
process.stdout.write(` Sequential: ${plan.sequential}
|
|
68
|
+
`);
|
|
69
|
+
process.stdout.write(` Completion: ${plan.completion}
|
|
68
70
|
`);
|
|
69
71
|
if (plan.world_id) process.stdout.write(` World: ${plan.world_id}
|
|
70
72
|
`);
|
|
@@ -107,7 +109,7 @@ async function checkCommand(args) {
|
|
|
107
109
|
const worldPath = parseArg(args, "--world");
|
|
108
110
|
if (worldPath) {
|
|
109
111
|
const { loadWorld } = await import("../world-loader-HMPTOEA2.js");
|
|
110
|
-
const { evaluateGuard } = await import("../guard-engine-
|
|
112
|
+
const { evaluateGuard } = await import("../guard-engine-JLTUARGU.js");
|
|
111
113
|
const world = await loadWorld(worldPath);
|
|
112
114
|
const verdict2 = evaluateGuard(event, world, { plan });
|
|
113
115
|
process.stdout.write(JSON.stringify(verdict2, null, 2) + "\n");
|
|
@@ -140,6 +142,8 @@ async function statusCommand(args) {
|
|
|
140
142
|
process.stdout.write(`Plan: ${plan.plan_id}
|
|
141
143
|
`);
|
|
142
144
|
process.stdout.write(`Objective: ${plan.objective}
|
|
145
|
+
`);
|
|
146
|
+
process.stdout.write(`Completion: ${plan.completion ?? "trust"}
|
|
143
147
|
`);
|
|
144
148
|
process.stdout.write(`Progress: ${progress.completed}/${progress.total} (${progress.percentage}%)
|
|
145
149
|
`);
|
|
@@ -168,7 +172,7 @@ async function advanceCommand(args) {
|
|
|
168
172
|
const stepId = args.find((a) => !a.startsWith("--"));
|
|
169
173
|
const planPath = parseArg(args, "--plan");
|
|
170
174
|
if (!stepId || !planPath) {
|
|
171
|
-
process.stderr.write("Usage: neuroverse plan advance <step_id> --plan plan.json\n");
|
|
175
|
+
process.stderr.write("Usage: neuroverse plan advance <step_id> --plan plan.json [--evidence <type> --proof <proof>]\n");
|
|
172
176
|
process.exit(PLAN_EXIT_CODES.ERROR);
|
|
173
177
|
return;
|
|
174
178
|
}
|
|
@@ -181,25 +185,36 @@ async function advanceCommand(args) {
|
|
|
181
185
|
process.exit(PLAN_EXIT_CODES.ERROR);
|
|
182
186
|
return;
|
|
183
187
|
}
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
const evidenceType = parseArg(args, "--evidence");
|
|
189
|
+
const evidenceProof = parseArg(args, "--proof");
|
|
190
|
+
let evidence;
|
|
191
|
+
if (evidenceType && evidenceProof) {
|
|
192
|
+
evidence = {
|
|
193
|
+
type: evidenceType,
|
|
194
|
+
proof: evidenceProof,
|
|
195
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
196
|
+
};
|
|
197
|
+
} else if (evidenceType || evidenceProof) {
|
|
198
|
+
process.stderr.write("Error: --evidence and --proof must both be provided.\n");
|
|
190
199
|
process.exit(PLAN_EXIT_CODES.ERROR);
|
|
191
200
|
return;
|
|
192
201
|
}
|
|
193
|
-
|
|
194
|
-
|
|
202
|
+
const result = advancePlan(plan, stepId, evidence);
|
|
203
|
+
if (!result.success) {
|
|
204
|
+
process.stderr.write(`Error: ${result.reason}
|
|
195
205
|
`);
|
|
206
|
+
process.exit(PLAN_EXIT_CODES.ERROR);
|
|
196
207
|
return;
|
|
197
208
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const
|
|
209
|
+
writeFileSync(planPath, JSON.stringify(result.plan, null, 2) + "\n");
|
|
210
|
+
const progress = getPlanProgress(result.plan);
|
|
211
|
+
const step = plan.steps.find((s) => s.id === stepId);
|
|
201
212
|
process.stdout.write(`Step completed: ${step.label}
|
|
202
213
|
`);
|
|
214
|
+
if (result.evidence) {
|
|
215
|
+
process.stdout.write(`Evidence: ${result.evidence.type} = ${result.evidence.proof}
|
|
216
|
+
`);
|
|
217
|
+
}
|
|
203
218
|
process.stdout.write(`Progress: ${progress.completed}/${progress.total} (${progress.percentage}%)
|
|
204
219
|
`);
|
|
205
220
|
if (progress.completed === progress.total) {
|
package/dist/cli/run.cjs
CHANGED
|
@@ -274,13 +274,40 @@ function getPlanProgress(plan) {
|
|
|
274
274
|
percentage: total > 0 ? Math.round(completed / total * 100) : 0
|
|
275
275
|
};
|
|
276
276
|
}
|
|
277
|
-
function advancePlan(plan, stepId) {
|
|
278
|
-
|
|
277
|
+
function advancePlan(plan, stepId, evidence) {
|
|
278
|
+
const step = plan.steps.find((s) => s.id === stepId);
|
|
279
|
+
if (!step) {
|
|
280
|
+
return { success: false, reason: `Step "${stepId}" not found in plan.` };
|
|
281
|
+
}
|
|
282
|
+
if (step.status === "completed") {
|
|
283
|
+
return { success: false, reason: `Step "${stepId}" is already completed.` };
|
|
284
|
+
}
|
|
285
|
+
const mode = plan.completion ?? "trust";
|
|
286
|
+
if (mode === "verified" && step.verify) {
|
|
287
|
+
if (!evidence) {
|
|
288
|
+
return {
|
|
289
|
+
success: false,
|
|
290
|
+
reason: `Step "${step.label}" requires evidence (verify: ${step.verify}). Provide evidence to advance.`
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
if (evidence.type !== step.verify) {
|
|
294
|
+
return {
|
|
295
|
+
success: false,
|
|
296
|
+
reason: `Evidence type "${evidence.type}" does not match required verification "${step.verify}".`
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
const updatedPlan = {
|
|
279
301
|
...plan,
|
|
280
302
|
steps: plan.steps.map(
|
|
281
303
|
(s) => s.id === stepId ? { ...s, status: "completed" } : s
|
|
282
304
|
)
|
|
283
305
|
};
|
|
306
|
+
return {
|
|
307
|
+
success: true,
|
|
308
|
+
plan: updatedPlan,
|
|
309
|
+
evidence: evidence ?? void 0
|
|
310
|
+
};
|
|
284
311
|
}
|
|
285
312
|
function evaluatePlan(event, plan) {
|
|
286
313
|
const progress = getPlanProgress(plan);
|
|
@@ -1444,8 +1471,11 @@ var init_session = __esm({
|
|
|
1444
1471
|
if (this.state.plan) {
|
|
1445
1472
|
const planVerdict = evaluatePlan(event, this.state.plan);
|
|
1446
1473
|
if (planVerdict.matchedStep) {
|
|
1447
|
-
|
|
1448
|
-
|
|
1474
|
+
const advResult = advancePlan(this.state.plan, planVerdict.matchedStep);
|
|
1475
|
+
if (advResult.success && advResult.plan) {
|
|
1476
|
+
this.state.plan = advResult.plan;
|
|
1477
|
+
this.engineOptions.plan = this.state.plan;
|
|
1478
|
+
}
|
|
1449
1479
|
this.state.progress = getPlanProgress(this.state.plan);
|
|
1450
1480
|
this.config.onPlanProgress?.(this.state.progress);
|
|
1451
1481
|
if (this.state.progress.completed === this.state.progress.total) {
|
package/dist/cli/run.js
CHANGED
|
@@ -92,7 +92,7 @@ async function main(args) {
|
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
const { resolveProvider, ModelAdapter } = await import("../model-adapter-BB7G4MFI.js");
|
|
95
|
-
const { runInteractiveMode } = await import("../session-
|
|
95
|
+
const { runInteractiveMode } = await import("../session-VISISNWJ.js");
|
|
96
96
|
const modelConfig = resolveProvider(providerName, {
|
|
97
97
|
model: parseArg(args, "--model"),
|
|
98
98
|
apiKey: parseArg(args, "--api-key")
|
|
@@ -126,7 +126,7 @@ async function main(args) {
|
|
|
126
126
|
model
|
|
127
127
|
);
|
|
128
128
|
} else if (isPipeMode) {
|
|
129
|
-
const { runPipeMode } = await import("../session-
|
|
129
|
+
const { runPipeMode } = await import("../session-VISISNWJ.js");
|
|
130
130
|
await runPipeMode({
|
|
131
131
|
worldPath,
|
|
132
132
|
plan,
|
|
@@ -100,7 +100,7 @@ async function main(argv) {
|
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
try {
|
|
103
|
-
const { evaluateGuard } = await import("./guard-engine-
|
|
103
|
+
const { evaluateGuard } = await import("./guard-engine-JLTUARGU.js");
|
|
104
104
|
checks.push({
|
|
105
105
|
label: "Guard engine",
|
|
106
106
|
status: typeof evaluateGuard === "function" ? "pass" : "fail",
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
} from "./chunk-AKW5YVCE.js";
|
|
8
8
|
import {
|
|
9
9
|
evaluateGuard
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4JRYGIO7.js";
|
|
11
11
|
import {
|
|
12
12
|
loadWorld
|
|
13
13
|
} from "./chunk-JZPQGIKR.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-4QXB6PEO.js";
|
|
15
15
|
import "./chunk-YZFATT7X.js";
|
|
16
16
|
|
|
17
17
|
// src/cli/guard.ts
|