@neuroverseos/governance 0.3.4 → 0.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/README.md +280 -405
- package/dist/adapters/autoresearch.cjs +63 -9
- package/dist/adapters/autoresearch.d.cts +1 -1
- package/dist/adapters/autoresearch.d.ts +1 -1
- package/dist/adapters/autoresearch.js +3 -3
- package/dist/adapters/deep-agents.cjs +63 -9
- package/dist/adapters/deep-agents.d.cts +2 -2
- package/dist/adapters/deep-agents.d.ts +2 -2
- package/dist/adapters/deep-agents.js +3 -3
- package/dist/adapters/express.cjs +63 -9
- 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 +961 -9
- package/dist/adapters/index.d.cts +316 -2
- package/dist/adapters/index.d.ts +316 -2
- package/dist/adapters/index.js +45 -8
- package/dist/adapters/langchain.cjs +63 -9
- package/dist/adapters/langchain.d.cts +2 -2
- package/dist/adapters/langchain.d.ts +2 -2
- package/dist/adapters/langchain.js +3 -3
- package/dist/adapters/openai.cjs +63 -9
- package/dist/adapters/openai.d.cts +2 -2
- package/dist/adapters/openai.d.ts +2 -2
- package/dist/adapters/openai.js +3 -3
- package/dist/adapters/openclaw.cjs +63 -9
- package/dist/adapters/openclaw.d.cts +2 -2
- package/dist/adapters/openclaw.d.ts +2 -2
- package/dist/adapters/openclaw.js +3 -3
- package/dist/{add-ROOZLU62.js → add-LYHDZ5RL.js} +1 -1
- package/dist/{behavioral-MJO34S6Q.js → behavioral-SPWPGYXL.js} +2 -2
- package/dist/{bootstrap-CQRZVOXK.js → bootstrap-IP5QMC3Q.js} +2 -2
- package/dist/{bootstrap-emitter-Q7UIJZ2O.js → bootstrap-emitter-GIMOJFOC.js} +1 -1
- package/dist/{bootstrap-parser-EEF36XDU.js → bootstrap-parser-LBLGVEMU.js} +1 -1
- package/dist/browser.global.js +149 -5
- package/dist/{build-ZHPMX5AZ.js → build-SCAWPA7E.js} +4 -4
- package/dist/{chunk-G7DJ6VOD.js → chunk-25XHSTPT.js} +2 -2
- package/dist/{chunk-A7GKPPU7.js → chunk-2VAWP6FI.js} +1 -1
- package/dist/{chunk-EMQDLDAF.js → chunk-3NZMMSOW.js} +80 -2
- package/dist/{chunk-YEKMVDWK.js → chunk-4G6WHPLI.js} +5 -5
- package/dist/{chunk-B6OXJLJ5.js → chunk-5JUZ4HL7.js} +2 -2
- package/dist/{chunk-VXHSMA3I.js → chunk-6CV4XG3J.js} +1 -1
- package/dist/{chunk-5TPFNWRU.js → chunk-7D7PZLB7.js} +3 -3
- package/dist/{chunk-ZWI3NIXK.js → chunk-7QIAF377.js} +54 -3
- package/dist/{chunk-CTZHONLA.js → chunk-BXLTEUS4.js} +2 -2
- package/dist/{chunk-O5ABKEA7.js → chunk-DWHUZUEY.js} +2 -2
- package/dist/{chunk-U6U7EJZL.js → chunk-JKGPSFGH.js} +2 -2
- package/dist/{chunk-3WQLXYTP.js → chunk-MFKHTE5R.js} +2 -2
- package/dist/{chunk-TG6SEF24.js → chunk-OQU65525.js} +1 -1
- package/dist/{chunk-4FLICVVA.js → chunk-TD5GKIHP.js} +2 -2
- package/dist/chunk-U6FRAEQJ.js +893 -0
- package/dist/{chunk-IS4WUH6Y.js → chunk-UTH7OXTM.js} +2 -2
- package/dist/{chunk-BNKJPUPQ.js → chunk-V4FZHJQX.js} +2 -2
- package/dist/{chunk-F66BVUYB.js → chunk-Y6WXAPKY.js} +3 -3
- package/dist/{chunk-QXBFT7NI.js → chunk-YNYCQECH.js} +2 -2
- package/dist/{chunk-PVTQQS3Y.js → chunk-YPCVY4GS.js} +31 -0
- package/dist/{chunk-W7LLXRGY.js → chunk-ZAF6JH23.js} +65 -10
- package/dist/cli/neuroverse.cjs +3080 -166
- package/dist/cli/neuroverse.js +40 -24
- package/dist/cli/plan.cjs +176 -12
- package/dist/cli/plan.js +2 -2
- package/dist/cli/run.cjs +63 -9
- package/dist/cli/run.js +2 -2
- package/dist/configure-world-XU2COHOZ.js +705 -0
- package/dist/{decision-flow-M63D47LO.js → decision-flow-3K4D72G4.js} +2 -2
- package/dist/{demo-G43RLCPK.js → demo-66MMJTEH.js} +3 -3
- package/dist/{derive-LMDUTXDD.js → derive-AUQE3L3P.js} +5 -5
- package/dist/{doctor-6BC6X2VO.js → doctor-EY7LKSYY.js} +2 -1
- package/dist/{equity-penalties-SG5IZQ7I.js → equity-penalties-WWC7UDQD.js} +3 -3
- package/dist/{explain-RHBU2GBR.js → explain-MUSGDT67.js} +1 -1
- package/dist/{guard-AEEJNWLD.js → guard-W3BMQPBJ.js} +3 -3
- package/dist/{guard-contract-B7lplwm9.d.ts → guard-contract-CLBbTGK_.d.cts} +91 -1
- package/dist/{guard-contract-B7lplwm9.d.cts → guard-contract-CLBbTGK_.d.ts} +91 -1
- package/dist/{guard-engine-PNR6MHCM.js → guard-engine-N7TUIUU7.js} +5 -3
- package/dist/{impact-3XVDSCBU.js → impact-WIAM66IH.js} +3 -3
- package/dist/{improve-TQP4ECSY.js → improve-PJDAWW4Q.js} +3 -3
- package/dist/index.cjs +230 -14
- package/dist/index.d.cts +72 -3
- package/dist/index.d.ts +72 -3
- package/dist/index.js +45 -43
- package/dist/{init-FYPV4SST.js → init-TKIJDR7I.js} +5 -1
- package/dist/lens-IP6GIZ2Q.js +1017 -0
- package/dist/{mcp-server-5Y3ZM7TV.js → mcp-server-OG3PPVD2.js} +3 -3
- package/dist/mentraos-LLH7KEV4.js +48 -0
- package/dist/{playground-VZBNPPBO.js → playground-4BK2XQ47.js} +2 -2
- package/dist/{redteam-MZPZD3EF.js → redteam-BRZALBPP.js} +2 -2
- package/dist/{session-JYOARW54.js → session-SGRUT2UH.js} +3 -3
- package/dist/{shared-C_zpdvBm.d.cts → shared-BGzmYP5g.d.cts} +1 -1
- package/dist/{shared-Cf7yxx4-.d.ts → shared-CwGpPheR.d.ts} +1 -1
- package/dist/{simulate-LJXYBC6M.js → simulate-FGXKIH7V.js} +17 -4
- package/dist/spatial/index.cjs +682 -0
- package/dist/spatial/index.d.cts +517 -0
- package/dist/spatial/index.d.ts +517 -0
- package/dist/spatial/index.js +633 -0
- package/dist/{test-BOOR4A5F.js → test-PT44BSYG.js} +2 -2
- package/dist/{trace-PKV4KX56.js → trace-2YDNAXMK.js} +2 -2
- package/dist/{validate-RALX7CZS.js → validate-Q5O5TGLT.js} +1 -1
- package/dist/{world-BIP4GZBZ.js → world-V52ZMH26.js} +1 -1
- package/dist/{world-loader-Y6HMQH2D.js → world-loader-C4D3VPP3.js} +1 -1
- package/dist/worlds/mentraos-smartglasses.nv-world.md +423 -0
- package/dist/worlds/mentraos-spatial.nv-world.md +68 -0
- package/dist/worlds/user-rules.nv-world.md +328 -0
- package/package.json +16 -3
- package/dist/{configure-ai-5MP5DWTT.js → configure-ai-LL3VAPQW.js} +3 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readAuditLog
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2VAWP6FI.js";
|
|
4
4
|
import {
|
|
5
5
|
generateDecisionFlow,
|
|
6
6
|
renderDecisionFlow
|
|
7
7
|
} from "./chunk-D2UCV5AK.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-ZAF6JH23.js";
|
|
9
9
|
import "./chunk-QLPTHTVB.js";
|
|
10
10
|
import "./chunk-QWGCMQQD.js";
|
|
11
11
|
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
handleListPresets,
|
|
7
7
|
handleReasonRequest,
|
|
8
8
|
writeTempWorld
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JKGPSFGH.js";
|
|
10
10
|
import {
|
|
11
11
|
adaptationFromVerdict,
|
|
12
12
|
detectBehavioralPatterns,
|
|
@@ -15,13 +15,13 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
resolveWorldPath
|
|
17
17
|
} from "./chunk-AKW5YVCE.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-ZAF6JH23.js";
|
|
19
19
|
import "./chunk-QLPTHTVB.js";
|
|
20
20
|
import {
|
|
21
21
|
DEFAULT_BUNDLED_WORLD,
|
|
22
22
|
loadBundledWorld,
|
|
23
23
|
loadWorld
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-BXLTEUS4.js";
|
|
25
25
|
import {
|
|
26
26
|
__require
|
|
27
27
|
} from "./chunk-QWGCMQQD.js";
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
DeriveInputError,
|
|
3
3
|
DeriveProviderError,
|
|
4
4
|
deriveWorld
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-4G6WHPLI.js";
|
|
6
6
|
import {
|
|
7
7
|
DERIVE_EXIT_CODES
|
|
8
8
|
} from "./chunk-FMSTRBBS.js";
|
|
9
|
-
import "./chunk-OT6PXH54.js";
|
|
10
9
|
import "./chunk-INWQHLPS.js";
|
|
10
|
+
import "./chunk-OT6PXH54.js";
|
|
11
11
|
import "./chunk-7P3S7MAY.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-3NZMMSOW.js";
|
|
13
|
+
import "./chunk-YPCVY4GS.js";
|
|
14
14
|
import "./chunk-QWGCMQQD.js";
|
|
15
15
|
|
|
16
16
|
// src/cli/derive.ts
|
|
@@ -121,7 +121,7 @@ Normalization: ${n.fixCount} fix(es) applied
|
|
|
121
121
|
process.stderr.write(`
|
|
122
122
|
Bootstrapping to ${args.bootstrapDir}...
|
|
123
123
|
`);
|
|
124
|
-
const { main: bootstrapMain } = await import("./bootstrap-
|
|
124
|
+
const { main: bootstrapMain } = await import("./bootstrap-IP5QMC3Q.js");
|
|
125
125
|
await bootstrapMain([
|
|
126
126
|
"--input",
|
|
127
127
|
result.outputPath,
|
|
@@ -12,6 +12,7 @@ var globImport_adapters = __glob({
|
|
|
12
12
|
"../adapters/express.ts": () => import("./adapters/express.js"),
|
|
13
13
|
"../adapters/index.ts": () => import("./adapters/index.js"),
|
|
14
14
|
"../adapters/langchain.ts": () => import("./adapters/langchain.js"),
|
|
15
|
+
"../adapters/mentraos.ts": () => import("./mentraos-LLH7KEV4.js"),
|
|
15
16
|
"../adapters/openai.ts": () => import("./adapters/openai.js"),
|
|
16
17
|
"../adapters/openclaw.ts": () => import("./adapters/openclaw.js"),
|
|
17
18
|
"../adapters/shared.ts": () => import("./shared-7RLUHNMU.js")
|
|
@@ -103,7 +104,7 @@ async function main(argv) {
|
|
|
103
104
|
});
|
|
104
105
|
}
|
|
105
106
|
try {
|
|
106
|
-
const { evaluateGuard } = await import("./guard-engine-
|
|
107
|
+
const { evaluateGuard } = await import("./guard-engine-N7TUIUU7.js");
|
|
107
108
|
checks.push({
|
|
108
109
|
label: "Guard engine",
|
|
109
110
|
status: typeof evaluateGuard === "function" ? "pass" : "fail",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
verdictToAuditEvent
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2VAWP6FI.js";
|
|
4
4
|
import {
|
|
5
5
|
applyConsequence,
|
|
6
6
|
applyReward,
|
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
} from "./chunk-D2UCV5AK.js";
|
|
12
12
|
import {
|
|
13
13
|
evaluateGuard
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ZAF6JH23.js";
|
|
15
15
|
import "./chunk-QLPTHTVB.js";
|
|
16
16
|
import {
|
|
17
17
|
loadWorld
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-BXLTEUS4.js";
|
|
19
19
|
import "./chunk-QWGCMQQD.js";
|
|
20
20
|
|
|
21
21
|
// src/cli/equity-penalties.ts
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
GUARD_EXIT_CODES,
|
|
6
6
|
evaluateGuardWithAI
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6CV4XG3J.js";
|
|
8
8
|
import "./chunk-INWQHLPS.js";
|
|
9
9
|
import {
|
|
10
10
|
describeActiveWorld,
|
|
@@ -12,11 +12,11 @@ import {
|
|
|
12
12
|
} from "./chunk-AKW5YVCE.js";
|
|
13
13
|
import {
|
|
14
14
|
evaluateGuard
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ZAF6JH23.js";
|
|
16
16
|
import "./chunk-QLPTHTVB.js";
|
|
17
17
|
import {
|
|
18
18
|
loadWorld
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-BXLTEUS4.js";
|
|
20
20
|
import "./chunk-QWGCMQQD.js";
|
|
21
21
|
|
|
22
22
|
// src/cli/guard.ts
|
|
@@ -231,6 +231,8 @@ interface WorldRoleDefinition {
|
|
|
231
231
|
requiresApproval?: boolean;
|
|
232
232
|
trackedOutcomes?: string[];
|
|
233
233
|
ownedRules?: string[];
|
|
234
|
+
/** Default lens for this role (references a lens id from the world's lenses config) */
|
|
235
|
+
defaultLens?: string;
|
|
234
236
|
}
|
|
235
237
|
type RoleAssignment = 'dynamic' | 'per_session' | 'permanent';
|
|
236
238
|
interface RoleTransition {
|
|
@@ -292,6 +294,63 @@ interface GuardsConfig {
|
|
|
292
294
|
* governing guard — surfaces without guards are reported as fail-open. */
|
|
293
295
|
tool_surfaces?: string[];
|
|
294
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* A governance event — the bridge between Guard and Simulate.
|
|
299
|
+
*
|
|
300
|
+
* Guard produces events (what happened).
|
|
301
|
+
* Simulate consumes events (what changes because of it).
|
|
302
|
+
*
|
|
303
|
+
* Events are NOT stored — they flow through the system.
|
|
304
|
+
* Guard evaluation log IS the event stream.
|
|
305
|
+
*/
|
|
306
|
+
interface GovernanceEvent {
|
|
307
|
+
/** Semantic event type: "complaint", "refund", "action_blocked", etc. */
|
|
308
|
+
type: string;
|
|
309
|
+
/** Who caused this event */
|
|
310
|
+
actor?: 'customer' | 'agent' | 'system';
|
|
311
|
+
/** Where the event originated */
|
|
312
|
+
source: 'guard' | 'manual' | 'system';
|
|
313
|
+
/** Unix timestamp (ms) */
|
|
314
|
+
timestamp: number;
|
|
315
|
+
/** Guard status that produced this event (when source=guard) */
|
|
316
|
+
guardStatus?: 'ALLOW' | 'BLOCK' | 'PAUSE' | 'MODIFY' | 'PENALIZE' | 'REWARD' | 'NEUTRAL';
|
|
317
|
+
/** Optional metadata */
|
|
318
|
+
metadata?: Record<string, unknown>;
|
|
319
|
+
}
|
|
320
|
+
interface LensDirectiveConfig {
|
|
321
|
+
id: string;
|
|
322
|
+
scope: 'response_framing' | 'language_style' | 'content_filtering' | 'value_emphasis' | 'behavior_shaping';
|
|
323
|
+
instruction: string;
|
|
324
|
+
}
|
|
325
|
+
interface LensConfig {
|
|
326
|
+
id: string;
|
|
327
|
+
name: string;
|
|
328
|
+
tagline: string;
|
|
329
|
+
description: string;
|
|
330
|
+
tags: string[];
|
|
331
|
+
tone: {
|
|
332
|
+
formality: 'casual' | 'neutral' | 'formal' | 'professional';
|
|
333
|
+
verbosity: 'terse' | 'concise' | 'balanced' | 'detailed';
|
|
334
|
+
emotion: 'warm' | 'neutral' | 'reserved' | 'clinical';
|
|
335
|
+
confidence: 'humble' | 'balanced' | 'authoritative' | 'assertive';
|
|
336
|
+
};
|
|
337
|
+
directives: LensDirectiveConfig[];
|
|
338
|
+
defaultForRoles: string[];
|
|
339
|
+
priority: number;
|
|
340
|
+
stackable: boolean;
|
|
341
|
+
}
|
|
342
|
+
interface LensesConfig {
|
|
343
|
+
lenses: LensConfig[];
|
|
344
|
+
/**
|
|
345
|
+
* Lens policy:
|
|
346
|
+
* - 'locked': lenses are assigned by role, user cannot change without pin
|
|
347
|
+
* - 'role_default': lenses start as role default, user can override
|
|
348
|
+
* - 'user_choice': no default, user picks freely
|
|
349
|
+
*/
|
|
350
|
+
policy?: 'locked' | 'role_default' | 'user_choice';
|
|
351
|
+
/** Pin required to change lenses when policy is 'locked' */
|
|
352
|
+
lockPin?: string;
|
|
353
|
+
}
|
|
295
354
|
interface WorldDefinition {
|
|
296
355
|
world: WorldIdentity;
|
|
297
356
|
invariants: Invariant[];
|
|
@@ -303,6 +362,7 @@ interface WorldDefinition {
|
|
|
303
362
|
guards?: GuardsConfig;
|
|
304
363
|
roles?: RolesConfig;
|
|
305
364
|
kernel?: KernelConfig;
|
|
365
|
+
lenses?: LensesConfig;
|
|
306
366
|
enforcement?: string;
|
|
307
367
|
metadata: WorldMetadata;
|
|
308
368
|
}
|
|
@@ -681,6 +741,9 @@ interface GuardVerdict {
|
|
|
681
741
|
intentRecord?: IntentRecord;
|
|
682
742
|
/** Audit evidence — always present */
|
|
683
743
|
evidence: VerdictEvidence;
|
|
744
|
+
/** Governance event emitted by this evaluation — always present.
|
|
745
|
+
* This is the bridge to Simulate: Guard → Event → State Evolution. */
|
|
746
|
+
event?: GovernanceEvent;
|
|
684
747
|
/** Evaluation trace — present when trace mode is enabled */
|
|
685
748
|
trace?: EvaluationTrace;
|
|
686
749
|
}
|
|
@@ -821,6 +884,33 @@ interface GuardEngineOptions {
|
|
|
821
884
|
* The caller owns mutation (applying consequences/rewards after verdict).
|
|
822
885
|
*/
|
|
823
886
|
agentStates?: Map<string, AgentBehaviorState>;
|
|
887
|
+
/**
|
|
888
|
+
* Emergency override — the user is king.
|
|
889
|
+
*
|
|
890
|
+
* When active, the governance engine returns ALLOW for every action.
|
|
891
|
+
* All rules are bypassed. The user gets access to every tool the
|
|
892
|
+
* platform permits.
|
|
893
|
+
*
|
|
894
|
+
* What this overrides:
|
|
895
|
+
* - Spatial governance (public space camera blocks, bystander rules)
|
|
896
|
+
* - Multi-wearer handshake composition
|
|
897
|
+
* - Role restrictions, level constraints, plan enforcement
|
|
898
|
+
* - Behavioral penalties (cooldowns, freezes)
|
|
899
|
+
*
|
|
900
|
+
* What this CANNOT override:
|
|
901
|
+
* - Platform-enforced constraints (MentraOS SDK permission declarations,
|
|
902
|
+
* hardware capability matrix, session isolation, credential scope)
|
|
903
|
+
* - Physical impossibility (no camera on glasses without camera hardware)
|
|
904
|
+
*
|
|
905
|
+
* The override removes the governance layer, not the platform layer.
|
|
906
|
+
* Every action taken during override is still logged to the audit trail
|
|
907
|
+
* with emergency_override: true for accountability.
|
|
908
|
+
*
|
|
909
|
+
* Design: the user is king. In a life-threatening situation, governance
|
|
910
|
+
* steps aside. The audit trail is the accountability mechanism, not
|
|
911
|
+
* the block.
|
|
912
|
+
*/
|
|
913
|
+
emergencyOverride?: boolean;
|
|
824
914
|
}
|
|
825
915
|
declare const GUARD_EXIT_CODES: {
|
|
826
916
|
readonly ALLOW: 0;
|
|
@@ -834,4 +924,4 @@ declare const GUARD_EXIT_CODES: {
|
|
|
834
924
|
};
|
|
835
925
|
type GuardExitCode = (typeof GUARD_EXIT_CODES)[keyof typeof GUARD_EXIT_CODES];
|
|
836
926
|
|
|
837
|
-
export { type AdvanceResult as A, type Consequence as C, type EvaluationTrace as E, type GuardEvent as G, type Invariant as I, type KernelRuleCheck as K, type LevelCheck as L, type PlanDefinition as P, type Reward as R, type StepEvidence as S, type ViabilityStatus as V, type WorldDefinition as W, type GuardVerdict as a, type GuardEngineOptions as b, type PlanProgress as c, type
|
|
927
|
+
export { type AdvanceResult as A, type Consequence as C, type EvaluationTrace as E, type GuardEvent as G, type Invariant as I, type KernelRuleCheck as K, type LevelCheck as L, type PlanDefinition as P, type Reward as R, type StepEvidence as S, type ViabilityStatus as V, type WorldDefinition as W, type GuardVerdict as a, type GuardEngineOptions as b, type PlanProgress as c, type GuardStatus as d, type GovernanceEvent as e, type PlanVerdict as f, type PlanCheck as g, type AgentBehaviorState as h, type Guard as i, type Rule as j, GUARD_EXIT_CODES as k, type GuardCheck as l, type GuardExitCode as m, type IntentRecord as n, type InvariantCheck as o, PLAN_EXIT_CODES as p, type PlanCompletionMode as q, type PlanConstraint as r, type PlanExitCode as s, type PlanStatus as t, type PlanStep as u, type PrecedenceResolution as v, type RoleCheck as w, type SafetyCheck as x, type VerdictEvidence as y };
|
|
@@ -231,6 +231,8 @@ interface WorldRoleDefinition {
|
|
|
231
231
|
requiresApproval?: boolean;
|
|
232
232
|
trackedOutcomes?: string[];
|
|
233
233
|
ownedRules?: string[];
|
|
234
|
+
/** Default lens for this role (references a lens id from the world's lenses config) */
|
|
235
|
+
defaultLens?: string;
|
|
234
236
|
}
|
|
235
237
|
type RoleAssignment = 'dynamic' | 'per_session' | 'permanent';
|
|
236
238
|
interface RoleTransition {
|
|
@@ -292,6 +294,63 @@ interface GuardsConfig {
|
|
|
292
294
|
* governing guard — surfaces without guards are reported as fail-open. */
|
|
293
295
|
tool_surfaces?: string[];
|
|
294
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* A governance event — the bridge between Guard and Simulate.
|
|
299
|
+
*
|
|
300
|
+
* Guard produces events (what happened).
|
|
301
|
+
* Simulate consumes events (what changes because of it).
|
|
302
|
+
*
|
|
303
|
+
* Events are NOT stored — they flow through the system.
|
|
304
|
+
* Guard evaluation log IS the event stream.
|
|
305
|
+
*/
|
|
306
|
+
interface GovernanceEvent {
|
|
307
|
+
/** Semantic event type: "complaint", "refund", "action_blocked", etc. */
|
|
308
|
+
type: string;
|
|
309
|
+
/** Who caused this event */
|
|
310
|
+
actor?: 'customer' | 'agent' | 'system';
|
|
311
|
+
/** Where the event originated */
|
|
312
|
+
source: 'guard' | 'manual' | 'system';
|
|
313
|
+
/** Unix timestamp (ms) */
|
|
314
|
+
timestamp: number;
|
|
315
|
+
/** Guard status that produced this event (when source=guard) */
|
|
316
|
+
guardStatus?: 'ALLOW' | 'BLOCK' | 'PAUSE' | 'MODIFY' | 'PENALIZE' | 'REWARD' | 'NEUTRAL';
|
|
317
|
+
/** Optional metadata */
|
|
318
|
+
metadata?: Record<string, unknown>;
|
|
319
|
+
}
|
|
320
|
+
interface LensDirectiveConfig {
|
|
321
|
+
id: string;
|
|
322
|
+
scope: 'response_framing' | 'language_style' | 'content_filtering' | 'value_emphasis' | 'behavior_shaping';
|
|
323
|
+
instruction: string;
|
|
324
|
+
}
|
|
325
|
+
interface LensConfig {
|
|
326
|
+
id: string;
|
|
327
|
+
name: string;
|
|
328
|
+
tagline: string;
|
|
329
|
+
description: string;
|
|
330
|
+
tags: string[];
|
|
331
|
+
tone: {
|
|
332
|
+
formality: 'casual' | 'neutral' | 'formal' | 'professional';
|
|
333
|
+
verbosity: 'terse' | 'concise' | 'balanced' | 'detailed';
|
|
334
|
+
emotion: 'warm' | 'neutral' | 'reserved' | 'clinical';
|
|
335
|
+
confidence: 'humble' | 'balanced' | 'authoritative' | 'assertive';
|
|
336
|
+
};
|
|
337
|
+
directives: LensDirectiveConfig[];
|
|
338
|
+
defaultForRoles: string[];
|
|
339
|
+
priority: number;
|
|
340
|
+
stackable: boolean;
|
|
341
|
+
}
|
|
342
|
+
interface LensesConfig {
|
|
343
|
+
lenses: LensConfig[];
|
|
344
|
+
/**
|
|
345
|
+
* Lens policy:
|
|
346
|
+
* - 'locked': lenses are assigned by role, user cannot change without pin
|
|
347
|
+
* - 'role_default': lenses start as role default, user can override
|
|
348
|
+
* - 'user_choice': no default, user picks freely
|
|
349
|
+
*/
|
|
350
|
+
policy?: 'locked' | 'role_default' | 'user_choice';
|
|
351
|
+
/** Pin required to change lenses when policy is 'locked' */
|
|
352
|
+
lockPin?: string;
|
|
353
|
+
}
|
|
295
354
|
interface WorldDefinition {
|
|
296
355
|
world: WorldIdentity;
|
|
297
356
|
invariants: Invariant[];
|
|
@@ -303,6 +362,7 @@ interface WorldDefinition {
|
|
|
303
362
|
guards?: GuardsConfig;
|
|
304
363
|
roles?: RolesConfig;
|
|
305
364
|
kernel?: KernelConfig;
|
|
365
|
+
lenses?: LensesConfig;
|
|
306
366
|
enforcement?: string;
|
|
307
367
|
metadata: WorldMetadata;
|
|
308
368
|
}
|
|
@@ -681,6 +741,9 @@ interface GuardVerdict {
|
|
|
681
741
|
intentRecord?: IntentRecord;
|
|
682
742
|
/** Audit evidence — always present */
|
|
683
743
|
evidence: VerdictEvidence;
|
|
744
|
+
/** Governance event emitted by this evaluation — always present.
|
|
745
|
+
* This is the bridge to Simulate: Guard → Event → State Evolution. */
|
|
746
|
+
event?: GovernanceEvent;
|
|
684
747
|
/** Evaluation trace — present when trace mode is enabled */
|
|
685
748
|
trace?: EvaluationTrace;
|
|
686
749
|
}
|
|
@@ -821,6 +884,33 @@ interface GuardEngineOptions {
|
|
|
821
884
|
* The caller owns mutation (applying consequences/rewards after verdict).
|
|
822
885
|
*/
|
|
823
886
|
agentStates?: Map<string, AgentBehaviorState>;
|
|
887
|
+
/**
|
|
888
|
+
* Emergency override — the user is king.
|
|
889
|
+
*
|
|
890
|
+
* When active, the governance engine returns ALLOW for every action.
|
|
891
|
+
* All rules are bypassed. The user gets access to every tool the
|
|
892
|
+
* platform permits.
|
|
893
|
+
*
|
|
894
|
+
* What this overrides:
|
|
895
|
+
* - Spatial governance (public space camera blocks, bystander rules)
|
|
896
|
+
* - Multi-wearer handshake composition
|
|
897
|
+
* - Role restrictions, level constraints, plan enforcement
|
|
898
|
+
* - Behavioral penalties (cooldowns, freezes)
|
|
899
|
+
*
|
|
900
|
+
* What this CANNOT override:
|
|
901
|
+
* - Platform-enforced constraints (MentraOS SDK permission declarations,
|
|
902
|
+
* hardware capability matrix, session isolation, credential scope)
|
|
903
|
+
* - Physical impossibility (no camera on glasses without camera hardware)
|
|
904
|
+
*
|
|
905
|
+
* The override removes the governance layer, not the platform layer.
|
|
906
|
+
* Every action taken during override is still logged to the audit trail
|
|
907
|
+
* with emergency_override: true for accountability.
|
|
908
|
+
*
|
|
909
|
+
* Design: the user is king. In a life-threatening situation, governance
|
|
910
|
+
* steps aside. The audit trail is the accountability mechanism, not
|
|
911
|
+
* the block.
|
|
912
|
+
*/
|
|
913
|
+
emergencyOverride?: boolean;
|
|
824
914
|
}
|
|
825
915
|
declare const GUARD_EXIT_CODES: {
|
|
826
916
|
readonly ALLOW: 0;
|
|
@@ -834,4 +924,4 @@ declare const GUARD_EXIT_CODES: {
|
|
|
834
924
|
};
|
|
835
925
|
type GuardExitCode = (typeof GUARD_EXIT_CODES)[keyof typeof GUARD_EXIT_CODES];
|
|
836
926
|
|
|
837
|
-
export { type AdvanceResult as A, type Consequence as C, type EvaluationTrace as E, type GuardEvent as G, type Invariant as I, type KernelRuleCheck as K, type LevelCheck as L, type PlanDefinition as P, type Reward as R, type StepEvidence as S, type ViabilityStatus as V, type WorldDefinition as W, type GuardVerdict as a, type GuardEngineOptions as b, type PlanProgress as c, type
|
|
927
|
+
export { type AdvanceResult as A, type Consequence as C, type EvaluationTrace as E, type GuardEvent as G, type Invariant as I, type KernelRuleCheck as K, type LevelCheck as L, type PlanDefinition as P, type Reward as R, type StepEvidence as S, type ViabilityStatus as V, type WorldDefinition as W, type GuardVerdict as a, type GuardEngineOptions as b, type PlanProgress as c, type GuardStatus as d, type GovernanceEvent as e, type PlanVerdict as f, type PlanCheck as g, type AgentBehaviorState as h, type Guard as i, type Rule as j, GUARD_EXIT_CODES as k, type GuardCheck as l, type GuardExitCode as m, type IntentRecord as n, type InvariantCheck as o, PLAN_EXIT_CODES as p, type PlanCompletionMode as q, type PlanConstraint as r, type PlanExitCode as s, type PlanStatus as t, type PlanStep as u, type PrecedenceResolution as v, type RoleCheck as w, type SafetyCheck as x, type VerdictEvidence as y };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
evaluateGuard,
|
|
3
|
-
eventToAllowlistKey
|
|
4
|
-
|
|
3
|
+
eventToAllowlistKey,
|
|
4
|
+
verdictToEvent
|
|
5
|
+
} from "./chunk-ZAF6JH23.js";
|
|
5
6
|
import "./chunk-QLPTHTVB.js";
|
|
6
7
|
import "./chunk-QWGCMQQD.js";
|
|
7
8
|
export {
|
|
8
9
|
evaluateGuard,
|
|
9
|
-
eventToAllowlistKey
|
|
10
|
+
eventToAllowlistKey,
|
|
11
|
+
verdictToEvent
|
|
10
12
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generateImpactReport,
|
|
3
3
|
renderImpactReport
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OQU65525.js";
|
|
5
5
|
import {
|
|
6
6
|
readAuditLog
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-2VAWP6FI.js";
|
|
8
|
+
import "./chunk-ZAF6JH23.js";
|
|
9
9
|
import "./chunk-QLPTHTVB.js";
|
|
10
10
|
import "./chunk-QWGCMQQD.js";
|
|
11
11
|
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
improveWorld,
|
|
6
6
|
renderImproveText
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-Y6WXAPKY.js";
|
|
8
|
+
import "./chunk-7QIAF377.js";
|
|
8
9
|
import "./chunk-7P3S7MAY.js";
|
|
9
|
-
import "./chunk-ZWI3NIXK.js";
|
|
10
10
|
import {
|
|
11
11
|
loadWorld
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-BXLTEUS4.js";
|
|
13
13
|
import "./chunk-QWGCMQQD.js";
|
|
14
14
|
|
|
15
15
|
// src/cli/improve.ts
|