@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
package/dist/adapters/express.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createGovernanceMiddleware,
|
|
3
3
|
createGovernanceMiddlewareFromWorld
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-2NICNKOM.js";
|
|
5
|
+
import "../chunk-4JRYGIO7.js";
|
|
6
6
|
import "../chunk-JZPQGIKR.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-4QXB6PEO.js";
|
|
8
8
|
import "../chunk-YZFATT7X.js";
|
|
9
9
|
export {
|
|
10
10
|
createGovernanceMiddleware,
|
package/dist/adapters/index.cjs
CHANGED
|
@@ -154,13 +154,40 @@ function getPlanProgress(plan) {
|
|
|
154
154
|
percentage: total > 0 ? Math.round(completed / total * 100) : 0
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
-
function advancePlan(plan, stepId) {
|
|
158
|
-
|
|
157
|
+
function advancePlan(plan, stepId, evidence) {
|
|
158
|
+
const step = plan.steps.find((s) => s.id === stepId);
|
|
159
|
+
if (!step) {
|
|
160
|
+
return { success: false, reason: `Step "${stepId}" not found in plan.` };
|
|
161
|
+
}
|
|
162
|
+
if (step.status === "completed") {
|
|
163
|
+
return { success: false, reason: `Step "${stepId}" is already completed.` };
|
|
164
|
+
}
|
|
165
|
+
const mode = plan.completion ?? "trust";
|
|
166
|
+
if (mode === "verified" && step.verify) {
|
|
167
|
+
if (!evidence) {
|
|
168
|
+
return {
|
|
169
|
+
success: false,
|
|
170
|
+
reason: `Step "${step.label}" requires evidence (verify: ${step.verify}). Provide evidence to advance.`
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
if (evidence.type !== step.verify) {
|
|
174
|
+
return {
|
|
175
|
+
success: false,
|
|
176
|
+
reason: `Evidence type "${evidence.type}" does not match required verification "${step.verify}".`
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const updatedPlan = {
|
|
159
181
|
...plan,
|
|
160
182
|
steps: plan.steps.map(
|
|
161
183
|
(s) => s.id === stepId ? { ...s, status: "completed" } : s
|
|
162
184
|
)
|
|
163
185
|
};
|
|
186
|
+
return {
|
|
187
|
+
success: true,
|
|
188
|
+
plan: updatedPlan,
|
|
189
|
+
evidence: evidence ?? void 0
|
|
190
|
+
};
|
|
164
191
|
}
|
|
165
192
|
function evaluatePlan(event, plan) {
|
|
166
193
|
const progress = getPlanProgress(plan);
|
|
@@ -1108,8 +1135,11 @@ var NeuroVerseCallbackHandler = class {
|
|
|
1108
1135
|
if (verdict.status === "ALLOW" && this.activePlan) {
|
|
1109
1136
|
const planVerdict = evaluatePlan(event, this.activePlan);
|
|
1110
1137
|
if (planVerdict.matchedStep) {
|
|
1111
|
-
|
|
1112
|
-
|
|
1138
|
+
const advResult = advancePlan(this.activePlan, planVerdict.matchedStep);
|
|
1139
|
+
if (advResult.success && advResult.plan) {
|
|
1140
|
+
this.activePlan = advResult.plan;
|
|
1141
|
+
this.engineOptions.plan = this.activePlan;
|
|
1142
|
+
}
|
|
1113
1143
|
const progress = getPlanProgress(this.activePlan);
|
|
1114
1144
|
this.options.onPlanProgress?.(progress);
|
|
1115
1145
|
if (progress.completed === progress.total) {
|
|
@@ -1187,8 +1217,11 @@ var GovernedToolExecutor = class {
|
|
|
1187
1217
|
if (verdict.status === "ALLOW" && this.activePlan) {
|
|
1188
1218
|
const planVerdict = evaluatePlan(event, this.activePlan);
|
|
1189
1219
|
if (planVerdict.matchedStep) {
|
|
1190
|
-
|
|
1191
|
-
|
|
1220
|
+
const advResult = advancePlan(this.activePlan, planVerdict.matchedStep);
|
|
1221
|
+
if (advResult.success && advResult.plan) {
|
|
1222
|
+
this.activePlan = advResult.plan;
|
|
1223
|
+
this.engineOptions.plan = this.activePlan;
|
|
1224
|
+
}
|
|
1192
1225
|
const progress = getPlanProgress(this.activePlan);
|
|
1193
1226
|
this.options.onPlanProgress?.(progress);
|
|
1194
1227
|
if (progress.completed === progress.total) {
|
|
@@ -1305,8 +1338,11 @@ var NeuroVersePlugin = class {
|
|
|
1305
1338
|
if (verdict.status === "ALLOW" && this.activePlan) {
|
|
1306
1339
|
const planVerdict = evaluatePlan(event, this.activePlan);
|
|
1307
1340
|
if (planVerdict.matchedStep) {
|
|
1308
|
-
|
|
1309
|
-
|
|
1341
|
+
const advResult = advancePlan(this.activePlan, planVerdict.matchedStep);
|
|
1342
|
+
if (advResult.success && advResult.plan) {
|
|
1343
|
+
this.activePlan = advResult.plan;
|
|
1344
|
+
this.engineOptions.plan = this.activePlan;
|
|
1345
|
+
}
|
|
1310
1346
|
const progress = getPlanProgress(this.activePlan);
|
|
1311
1347
|
this.options.onPlanProgress?.(progress);
|
|
1312
1348
|
if (progress.completed === progress.total) {
|
|
@@ -2,4 +2,4 @@ export { GovernanceBlockedError as LangChainGovernanceBlockedError, NeuroVerseCa
|
|
|
2
2
|
export { GovernedExecutorOptions, GovernedToolExecutor, GovernedToolResult, GovernanceBlockedError as OpenAIGovernanceBlockedError, OpenAIToolCall, createGovernedToolExecutor, createGovernedToolExecutorFromWorld } from './openai.cjs';
|
|
3
3
|
export { AgentAction, HookResult, NeuroVersePlugin, NeuroVersePluginOptions, GovernanceBlockedError as OpenClawGovernanceBlockedError, createNeuroVersePlugin, createNeuroVersePluginFromWorld } from './openclaw.cjs';
|
|
4
4
|
export { GovernanceMiddlewareOptions, GovernanceRequest, GovernanceResponse, createGovernanceMiddleware, createGovernanceMiddlewareFromWorld } from './express.cjs';
|
|
5
|
-
import '../guard-contract-
|
|
5
|
+
import '../guard-contract-Cm91Kp4j.cjs';
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { GovernanceBlockedError as LangChainGovernanceBlockedError, NeuroVerseCa
|
|
|
2
2
|
export { GovernedExecutorOptions, GovernedToolExecutor, GovernedToolResult, GovernanceBlockedError as OpenAIGovernanceBlockedError, OpenAIToolCall, createGovernedToolExecutor, createGovernedToolExecutorFromWorld } from './openai.js';
|
|
3
3
|
export { AgentAction, HookResult, NeuroVersePlugin, NeuroVersePluginOptions, GovernanceBlockedError as OpenClawGovernanceBlockedError, createNeuroVersePlugin, createNeuroVersePluginFromWorld } from './openclaw.js';
|
|
4
4
|
export { GovernanceMiddlewareOptions, GovernanceRequest, GovernanceResponse, createGovernanceMiddleware, createGovernanceMiddlewareFromWorld } from './express.js';
|
|
5
|
-
import '../guard-contract-
|
|
5
|
+
import '../guard-contract-Cm91Kp4j.js';
|
package/dist/adapters/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createGovernanceMiddleware,
|
|
3
3
|
createGovernanceMiddlewareFromWorld
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-2NICNKOM.js";
|
|
5
5
|
import {
|
|
6
6
|
GovernanceBlockedError,
|
|
7
7
|
NeuroVerseCallbackHandler,
|
|
8
8
|
createNeuroVerseCallbackHandler,
|
|
9
9
|
createNeuroVerseCallbackHandlerFromWorld
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-RWXVAH6P.js";
|
|
11
11
|
import {
|
|
12
12
|
GovernanceBlockedError as GovernanceBlockedError2,
|
|
13
13
|
GovernedToolExecutor,
|
|
14
14
|
createGovernedToolExecutor,
|
|
15
15
|
createGovernedToolExecutorFromWorld
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-OHAC6HJE.js";
|
|
17
17
|
import {
|
|
18
18
|
GovernanceBlockedError as GovernanceBlockedError3,
|
|
19
19
|
NeuroVersePlugin,
|
|
20
20
|
createNeuroVersePlugin,
|
|
21
21
|
createNeuroVersePluginFromWorld
|
|
22
|
-
} from "../chunk-
|
|
23
|
-
import "../chunk-
|
|
22
|
+
} from "../chunk-SKU3GAPD.js";
|
|
23
|
+
import "../chunk-4JRYGIO7.js";
|
|
24
24
|
import "../chunk-JZPQGIKR.js";
|
|
25
|
-
import "../chunk-
|
|
25
|
+
import "../chunk-4QXB6PEO.js";
|
|
26
26
|
import "../chunk-YZFATT7X.js";
|
|
27
27
|
export {
|
|
28
28
|
GovernedToolExecutor,
|
|
@@ -144,13 +144,40 @@ function getPlanProgress(plan) {
|
|
|
144
144
|
percentage: total > 0 ? Math.round(completed / total * 100) : 0
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
|
-
function advancePlan(plan, stepId) {
|
|
148
|
-
|
|
147
|
+
function advancePlan(plan, stepId, evidence) {
|
|
148
|
+
const step = plan.steps.find((s) => s.id === stepId);
|
|
149
|
+
if (!step) {
|
|
150
|
+
return { success: false, reason: `Step "${stepId}" not found in plan.` };
|
|
151
|
+
}
|
|
152
|
+
if (step.status === "completed") {
|
|
153
|
+
return { success: false, reason: `Step "${stepId}" is already completed.` };
|
|
154
|
+
}
|
|
155
|
+
const mode = plan.completion ?? "trust";
|
|
156
|
+
if (mode === "verified" && step.verify) {
|
|
157
|
+
if (!evidence) {
|
|
158
|
+
return {
|
|
159
|
+
success: false,
|
|
160
|
+
reason: `Step "${step.label}" requires evidence (verify: ${step.verify}). Provide evidence to advance.`
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
if (evidence.type !== step.verify) {
|
|
164
|
+
return {
|
|
165
|
+
success: false,
|
|
166
|
+
reason: `Evidence type "${evidence.type}" does not match required verification "${step.verify}".`
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const updatedPlan = {
|
|
149
171
|
...plan,
|
|
150
172
|
steps: plan.steps.map(
|
|
151
173
|
(s) => s.id === stepId ? { ...s, status: "completed" } : s
|
|
152
174
|
)
|
|
153
175
|
};
|
|
176
|
+
return {
|
|
177
|
+
success: true,
|
|
178
|
+
plan: updatedPlan,
|
|
179
|
+
evidence: evidence ?? void 0
|
|
180
|
+
};
|
|
154
181
|
}
|
|
155
182
|
function evaluatePlan(event, plan) {
|
|
156
183
|
const progress = getPlanProgress(plan);
|
|
@@ -1098,8 +1125,11 @@ var NeuroVerseCallbackHandler = class {
|
|
|
1098
1125
|
if (verdict.status === "ALLOW" && this.activePlan) {
|
|
1099
1126
|
const planVerdict = evaluatePlan(event, this.activePlan);
|
|
1100
1127
|
if (planVerdict.matchedStep) {
|
|
1101
|
-
|
|
1102
|
-
|
|
1128
|
+
const advResult = advancePlan(this.activePlan, planVerdict.matchedStep);
|
|
1129
|
+
if (advResult.success && advResult.plan) {
|
|
1130
|
+
this.activePlan = advResult.plan;
|
|
1131
|
+
this.engineOptions.plan = this.activePlan;
|
|
1132
|
+
}
|
|
1103
1133
|
const progress = getPlanProgress(this.activePlan);
|
|
1104
1134
|
this.options.onPlanProgress?.(progress);
|
|
1105
1135
|
if (progress.completed === progress.total) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GuardVerdict, a as GuardEvent, W as WorldDefinition, P as PlanDefinition, b as PlanProgress } from '../guard-contract-
|
|
1
|
+
import { G as GuardVerdict, a as GuardEvent, W as WorldDefinition, P as PlanDefinition, b as PlanProgress } from '../guard-contract-Cm91Kp4j.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* NeuroVerse Adapter — LangChain
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GuardVerdict, a as GuardEvent, W as WorldDefinition, P as PlanDefinition, b as PlanProgress } from '../guard-contract-
|
|
1
|
+
import { G as GuardVerdict, a as GuardEvent, W as WorldDefinition, P as PlanDefinition, b as PlanProgress } from '../guard-contract-Cm91Kp4j.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* NeuroVerse Adapter — LangChain
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
NeuroVerseCallbackHandler,
|
|
4
4
|
createNeuroVerseCallbackHandler,
|
|
5
5
|
createNeuroVerseCallbackHandlerFromWorld
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-RWXVAH6P.js";
|
|
7
|
+
import "../chunk-4JRYGIO7.js";
|
|
8
8
|
import "../chunk-JZPQGIKR.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-4QXB6PEO.js";
|
|
10
10
|
import "../chunk-YZFATT7X.js";
|
|
11
11
|
export {
|
|
12
12
|
GovernanceBlockedError,
|
package/dist/adapters/openai.cjs
CHANGED
|
@@ -144,13 +144,40 @@ function getPlanProgress(plan) {
|
|
|
144
144
|
percentage: total > 0 ? Math.round(completed / total * 100) : 0
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
|
-
function advancePlan(plan, stepId) {
|
|
148
|
-
|
|
147
|
+
function advancePlan(plan, stepId, evidence) {
|
|
148
|
+
const step = plan.steps.find((s) => s.id === stepId);
|
|
149
|
+
if (!step) {
|
|
150
|
+
return { success: false, reason: `Step "${stepId}" not found in plan.` };
|
|
151
|
+
}
|
|
152
|
+
if (step.status === "completed") {
|
|
153
|
+
return { success: false, reason: `Step "${stepId}" is already completed.` };
|
|
154
|
+
}
|
|
155
|
+
const mode = plan.completion ?? "trust";
|
|
156
|
+
if (mode === "verified" && step.verify) {
|
|
157
|
+
if (!evidence) {
|
|
158
|
+
return {
|
|
159
|
+
success: false,
|
|
160
|
+
reason: `Step "${step.label}" requires evidence (verify: ${step.verify}). Provide evidence to advance.`
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
if (evidence.type !== step.verify) {
|
|
164
|
+
return {
|
|
165
|
+
success: false,
|
|
166
|
+
reason: `Evidence type "${evidence.type}" does not match required verification "${step.verify}".`
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const updatedPlan = {
|
|
149
171
|
...plan,
|
|
150
172
|
steps: plan.steps.map(
|
|
151
173
|
(s) => s.id === stepId ? { ...s, status: "completed" } : s
|
|
152
174
|
)
|
|
153
175
|
};
|
|
176
|
+
return {
|
|
177
|
+
success: true,
|
|
178
|
+
plan: updatedPlan,
|
|
179
|
+
evidence: evidence ?? void 0
|
|
180
|
+
};
|
|
154
181
|
}
|
|
155
182
|
function evaluatePlan(event, plan) {
|
|
156
183
|
const progress = getPlanProgress(plan);
|
|
@@ -1089,8 +1116,11 @@ var GovernedToolExecutor = class {
|
|
|
1089
1116
|
if (verdict.status === "ALLOW" && this.activePlan) {
|
|
1090
1117
|
const planVerdict = evaluatePlan(event, this.activePlan);
|
|
1091
1118
|
if (planVerdict.matchedStep) {
|
|
1092
|
-
|
|
1093
|
-
|
|
1119
|
+
const advResult = advancePlan(this.activePlan, planVerdict.matchedStep);
|
|
1120
|
+
if (advResult.success && advResult.plan) {
|
|
1121
|
+
this.activePlan = advResult.plan;
|
|
1122
|
+
this.engineOptions.plan = this.activePlan;
|
|
1123
|
+
}
|
|
1094
1124
|
const progress = getPlanProgress(this.activePlan);
|
|
1095
1125
|
this.options.onPlanProgress?.(progress);
|
|
1096
1126
|
if (progress.completed === progress.total) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GuardVerdict, a as GuardEvent, P as PlanDefinition, b as PlanProgress, W as WorldDefinition } from '../guard-contract-
|
|
1
|
+
import { G as GuardVerdict, a as GuardEvent, P as PlanDefinition, b as PlanProgress, W as WorldDefinition } from '../guard-contract-Cm91Kp4j.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* NeuroVerse Adapter — OpenAI
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GuardVerdict, a as GuardEvent, P as PlanDefinition, b as PlanProgress, W as WorldDefinition } from '../guard-contract-
|
|
1
|
+
import { G as GuardVerdict, a as GuardEvent, P as PlanDefinition, b as PlanProgress, W as WorldDefinition } from '../guard-contract-Cm91Kp4j.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* NeuroVerse Adapter — OpenAI
|
package/dist/adapters/openai.js
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
GovernedToolExecutor,
|
|
4
4
|
createGovernedToolExecutor,
|
|
5
5
|
createGovernedToolExecutorFromWorld
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-OHAC6HJE.js";
|
|
7
|
+
import "../chunk-4JRYGIO7.js";
|
|
8
8
|
import "../chunk-JZPQGIKR.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-4QXB6PEO.js";
|
|
10
10
|
import "../chunk-YZFATT7X.js";
|
|
11
11
|
export {
|
|
12
12
|
GovernanceBlockedError,
|
|
@@ -144,13 +144,40 @@ function getPlanProgress(plan) {
|
|
|
144
144
|
percentage: total > 0 ? Math.round(completed / total * 100) : 0
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
|
-
function advancePlan(plan, stepId) {
|
|
148
|
-
|
|
147
|
+
function advancePlan(plan, stepId, evidence) {
|
|
148
|
+
const step = plan.steps.find((s) => s.id === stepId);
|
|
149
|
+
if (!step) {
|
|
150
|
+
return { success: false, reason: `Step "${stepId}" not found in plan.` };
|
|
151
|
+
}
|
|
152
|
+
if (step.status === "completed") {
|
|
153
|
+
return { success: false, reason: `Step "${stepId}" is already completed.` };
|
|
154
|
+
}
|
|
155
|
+
const mode = plan.completion ?? "trust";
|
|
156
|
+
if (mode === "verified" && step.verify) {
|
|
157
|
+
if (!evidence) {
|
|
158
|
+
return {
|
|
159
|
+
success: false,
|
|
160
|
+
reason: `Step "${step.label}" requires evidence (verify: ${step.verify}). Provide evidence to advance.`
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
if (evidence.type !== step.verify) {
|
|
164
|
+
return {
|
|
165
|
+
success: false,
|
|
166
|
+
reason: `Evidence type "${evidence.type}" does not match required verification "${step.verify}".`
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const updatedPlan = {
|
|
149
171
|
...plan,
|
|
150
172
|
steps: plan.steps.map(
|
|
151
173
|
(s) => s.id === stepId ? { ...s, status: "completed" } : s
|
|
152
174
|
)
|
|
153
175
|
};
|
|
176
|
+
return {
|
|
177
|
+
success: true,
|
|
178
|
+
plan: updatedPlan,
|
|
179
|
+
evidence: evidence ?? void 0
|
|
180
|
+
};
|
|
154
181
|
}
|
|
155
182
|
function evaluatePlan(event, plan) {
|
|
156
183
|
const progress = getPlanProgress(plan);
|
|
@@ -1089,8 +1116,11 @@ var NeuroVersePlugin = class {
|
|
|
1089
1116
|
if (verdict.status === "ALLOW" && this.activePlan) {
|
|
1090
1117
|
const planVerdict = evaluatePlan(event, this.activePlan);
|
|
1091
1118
|
if (planVerdict.matchedStep) {
|
|
1092
|
-
|
|
1093
|
-
|
|
1119
|
+
const advResult = advancePlan(this.activePlan, planVerdict.matchedStep);
|
|
1120
|
+
if (advResult.success && advResult.plan) {
|
|
1121
|
+
this.activePlan = advResult.plan;
|
|
1122
|
+
this.engineOptions.plan = this.activePlan;
|
|
1123
|
+
}
|
|
1094
1124
|
const progress = getPlanProgress(this.activePlan);
|
|
1095
1125
|
this.options.onPlanProgress?.(progress);
|
|
1096
1126
|
if (progress.completed === progress.total) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GuardVerdict, W as WorldDefinition, a as GuardEvent, P as PlanDefinition, b as PlanProgress } from '../guard-contract-
|
|
1
|
+
import { G as GuardVerdict, W as WorldDefinition, a as GuardEvent, P as PlanDefinition, b as PlanProgress } from '../guard-contract-Cm91Kp4j.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* NeuroVerse Adapter — OpenClaw
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GuardVerdict, W as WorldDefinition, a as GuardEvent, P as PlanDefinition, b as PlanProgress } from '../guard-contract-
|
|
1
|
+
import { G as GuardVerdict, W as WorldDefinition, a as GuardEvent, P as PlanDefinition, b as PlanProgress } from '../guard-contract-Cm91Kp4j.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* NeuroVerse Adapter — OpenClaw
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
NeuroVersePlugin,
|
|
4
4
|
createNeuroVersePlugin,
|
|
5
5
|
createNeuroVersePluginFromWorld
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-SKU3GAPD.js";
|
|
7
|
+
import "../chunk-4JRYGIO7.js";
|
|
8
8
|
import "../chunk-JZPQGIKR.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-4QXB6PEO.js";
|
|
10
10
|
import "../chunk-YZFATT7X.js";
|
|
11
11
|
export {
|
|
12
12
|
GovernanceBlockedError,
|
|
@@ -105,13 +105,40 @@ function getPlanProgress(plan) {
|
|
|
105
105
|
percentage: total > 0 ? Math.round(completed / total * 100) : 0
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
function advancePlan(plan, stepId) {
|
|
109
|
-
|
|
108
|
+
function advancePlan(plan, stepId, evidence) {
|
|
109
|
+
const step = plan.steps.find((s) => s.id === stepId);
|
|
110
|
+
if (!step) {
|
|
111
|
+
return { success: false, reason: `Step "${stepId}" not found in plan.` };
|
|
112
|
+
}
|
|
113
|
+
if (step.status === "completed") {
|
|
114
|
+
return { success: false, reason: `Step "${stepId}" is already completed.` };
|
|
115
|
+
}
|
|
116
|
+
const mode = plan.completion ?? "trust";
|
|
117
|
+
if (mode === "verified" && step.verify) {
|
|
118
|
+
if (!evidence) {
|
|
119
|
+
return {
|
|
120
|
+
success: false,
|
|
121
|
+
reason: `Step "${step.label}" requires evidence (verify: ${step.verify}). Provide evidence to advance.`
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if (evidence.type !== step.verify) {
|
|
125
|
+
return {
|
|
126
|
+
success: false,
|
|
127
|
+
reason: `Evidence type "${evidence.type}" does not match required verification "${step.verify}".`
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const updatedPlan = {
|
|
110
132
|
...plan,
|
|
111
133
|
steps: plan.steps.map(
|
|
112
134
|
(s) => s.id === stepId ? { ...s, status: "completed" } : s
|
|
113
135
|
)
|
|
114
136
|
};
|
|
137
|
+
return {
|
|
138
|
+
success: true,
|
|
139
|
+
plan: updatedPlan,
|
|
140
|
+
evidence: evidence ?? void 0
|
|
141
|
+
};
|
|
115
142
|
}
|
|
116
143
|
function evaluatePlan(event, plan) {
|
|
117
144
|
const progress = getPlanProgress(plan);
|
|
@@ -133,10 +133,13 @@ function parsePlanMarkdown(markdown) {
|
|
|
133
133
|
if (frontmatter.expires) {
|
|
134
134
|
expires_at = new Date(frontmatter.expires).toISOString();
|
|
135
135
|
}
|
|
136
|
+
const completionRaw = frontmatter.completion?.toLowerCase();
|
|
137
|
+
const completion = completionRaw === "verified" ? "verified" : "trust";
|
|
136
138
|
const plan = {
|
|
137
139
|
plan_id: frontmatter.plan_id,
|
|
138
140
|
objective: frontmatter.objective ?? "",
|
|
139
141
|
sequential: frontmatter.sequential === "true",
|
|
142
|
+
completion,
|
|
140
143
|
steps,
|
|
141
144
|
constraints,
|
|
142
145
|
world_id: frontmatter.world ?? void 0,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-AKW5YVCE.js";
|
|
5
5
|
import {
|
|
6
6
|
evaluateGuard
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4JRYGIO7.js";
|
|
8
8
|
import {
|
|
9
9
|
loadWorld
|
|
10
10
|
} from "./chunk-JZPQGIKR.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
advancePlan,
|
|
13
13
|
evaluatePlan,
|
|
14
14
|
getPlanProgress
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-4QXB6PEO.js";
|
|
16
16
|
|
|
17
17
|
// src/runtime/mcp-server.ts
|
|
18
18
|
import { execSync } from "child_process";
|
|
@@ -385,8 +385,11 @@ Closest plan step: "${pc.closestStepLabel}"`;
|
|
|
385
385
|
if (this.plan) {
|
|
386
386
|
const planVerdict = evaluatePlan(event, this.plan);
|
|
387
387
|
if (planVerdict.matchedStep) {
|
|
388
|
-
|
|
389
|
-
|
|
388
|
+
const advResult = advancePlan(this.plan, planVerdict.matchedStep);
|
|
389
|
+
if (advResult.success && advResult.plan) {
|
|
390
|
+
this.plan = advResult.plan;
|
|
391
|
+
this.engineOptions.plan = this.plan;
|
|
392
|
+
}
|
|
390
393
|
const progress = getPlanProgress(this.plan);
|
|
391
394
|
process.stderr.write(
|
|
392
395
|
`[neuroverse-mcp] Plan: ${progress.completed}/${progress.total} (${progress.percentage}%)
|
|
@@ -546,7 +549,11 @@ Closest plan step: "${pc.closestStepLabel}"`;
|
|
|
546
549
|
if (step.status === "completed") {
|
|
547
550
|
return { content: [{ type: "text", text: `Step "${stepId}" is already completed.` }] };
|
|
548
551
|
}
|
|
549
|
-
|
|
552
|
+
const advResult = advancePlan(this.plan, stepId);
|
|
553
|
+
if (!advResult.success) {
|
|
554
|
+
return { content: [{ type: "text", text: `Cannot advance: ${advResult.reason}` }] };
|
|
555
|
+
}
|
|
556
|
+
this.plan = advResult.plan;
|
|
550
557
|
this.engineOptions.plan = this.plan;
|
|
551
558
|
const progress = getPlanProgress(this.plan);
|
|
552
559
|
let text = `Step completed: ${step.label}
|
|
@@ -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/runtime/session.ts
|
|
14
14
|
async function defaultToolExecutor(name, args) {
|
|
@@ -94,8 +94,11 @@ var SessionManager = class {
|
|
|
94
94
|
if (this.state.plan) {
|
|
95
95
|
const planVerdict = evaluatePlan(event, this.state.plan);
|
|
96
96
|
if (planVerdict.matchedStep) {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
const advResult = advancePlan(this.state.plan, planVerdict.matchedStep);
|
|
98
|
+
if (advResult.success && advResult.plan) {
|
|
99
|
+
this.state.plan = advResult.plan;
|
|
100
|
+
this.engineOptions.plan = this.state.plan;
|
|
101
|
+
}
|
|
99
102
|
this.state.progress = getPlanProgress(this.state.plan);
|
|
100
103
|
this.config.onPlanProgress?.(this.state.progress);
|
|
101
104
|
if (this.state.progress.completed === this.state.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/openai.ts
|
|
14
14
|
var GovernanceBlockedError = class extends Error {
|
|
@@ -70,8 +70,11 @@ var GovernedToolExecutor = 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) {
|