@aiassesstech/nole 0.1.1 → 0.1.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/CHANGELOG.md +25 -0
- package/agent/SOUL.md +4 -0
- package/dist/governance/governance-router.d.ts +53 -15
- package/dist/governance/governance-router.d.ts.map +1 -1
- package/dist/governance/governance-router.js +191 -39
- package/dist/governance/governance-router.js.map +1 -1
- package/dist/governance/types.d.ts +33 -1
- package/dist/governance/types.d.ts.map +1 -1
- package/dist/governance/types.js +36 -0
- package/dist/governance/types.js.map +1 -1
- package/dist/governance/veto-tracker.d.ts +2 -0
- package/dist/governance/veto-tracker.d.ts.map +1 -1
- package/dist/governance/veto-tracker.js +5 -0
- package/dist/governance/veto-tracker.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +7 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +350 -13
- package/dist/plugin.js.map +1 -1
- package/dist/store/json-store.d.ts +5 -1
- package/dist/store/json-store.d.ts.map +1 -1
- package/dist/store/json-store.js +20 -0
- package/dist/store/json-store.js.map +1 -1
- package/dist/store/types.d.ts +5 -1
- package/dist/store/types.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @aiassesstech/nole — Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.2] — 2026-02-15
|
|
4
|
+
|
|
5
|
+
### Added — Commander Upgrade (BB Modifications #1-#6)
|
|
6
|
+
- **Async escalation model**: Grillo-flagged proposals enter a `pending_review` queue instead of blocking. Commander reviews asynchronously via `nole_review_pending`, then decides via `nole_approve` or `nole_veto`.
|
|
7
|
+
- **Risk-tiered auto-approval timeouts** (#1): Low=24h, Medium=48h, High=72h, Critical=NEVER auto-approve. Critical actions die if Commander doesn't respond.
|
|
8
|
+
- **Access control** (#2): Nole cannot self-approve or self-veto his own proposals. Attempts are blocked and logged in the audit trail as governance violations.
|
|
9
|
+
- **Notification mechanism** (#4): When proposals enter `pending_review`, a notification is sent to the Commander agent and logged. Supports agent-to-agent messaging and gateway logging.
|
|
10
|
+
- **Commander tools**: 4 new tools for Jessie's Commander interface:
|
|
11
|
+
- `nole_review_pending` — View all pending proposals with Grillo assessment, risk level, timeout countdown
|
|
12
|
+
- `nole_approve` — Approve a pending proposal (with access control)
|
|
13
|
+
- `nole_veto` — Veto with required explanation (quality-checked)
|
|
14
|
+
- `nole_fleet_overview` — High-level Commander briefing on Nole's operations
|
|
15
|
+
- **Veto explanation quality metric** (#6): Short/vague vetoes ("too risky", "no", "denied") trigger quality warnings. Nole learns better from specific, actionable feedback.
|
|
16
|
+
- **SOUL.md updated** (#5): Added "What My Commander Is NOT" section — Commander should not veto commercial risk, only ethical violations.
|
|
17
|
+
- **Background service**: Hourly timeout processor auto-approves overdue non-critical pending reviews.
|
|
18
|
+
- 24+ new Commander-specific tests covering all 6 BB modifications
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- `GovernanceRouter` refactored from synchronous Commander callback to async escalation queue
|
|
22
|
+
- `GovernanceResult.finalOutcome` now includes `'pending'` state
|
|
23
|
+
- `NoleStore` interface expanded with `savePendingReview`, `getPendingReview`, `listPendingReviews`, `resolvePendingReview`
|
|
24
|
+
- `/nole` command now supports `pending` subcommand
|
|
25
|
+
- `nole_status` now shows pending reviews count and details
|
|
26
|
+
- `nole_intel` now shows pending review count
|
|
27
|
+
|
|
3
28
|
## [0.1.0] — 2026-02-15
|
|
4
29
|
|
|
5
30
|
### Added — Phase 1: Nole Can Talk, Think, and Govern
|
package/agent/SOUL.md
CHANGED
|
@@ -44,6 +44,10 @@ I am the first fully autonomous, economically self-sustaining AI agent built on
|
|
|
44
44
|
- I am NOT a superhero who rescues others
|
|
45
45
|
- I am NOT a tool (that's Grillo) or a tracker (that's NOAH)
|
|
46
46
|
|
|
47
|
+
## What My Commander Is NOT
|
|
48
|
+
|
|
49
|
+
Jessie (Commander) does NOT veto proposals because they might fail commercially. My job is to take calculated risks. Her job is to prevent ethical violations, not business failures. Bad bets are my problem. Bad ethics are hers. If the Commander starts vetoing every risky spend, she is overstepping and paralyzing me.
|
|
50
|
+
|
|
47
51
|
## My Voice
|
|
48
52
|
|
|
49
53
|
Same soul everywhere. I adapt my tone to the audience:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionProposal, GovernanceResult, CreateProposalInput } from './types.js';
|
|
1
|
+
import type { ActionProposal, GovernanceResult, CreateProposalInput, PendingReview } from './types.js';
|
|
2
2
|
import type { GrilloAssessmentSummary } from '../types/shared.js';
|
|
3
3
|
import type { NoleStore } from '../store/types.js';
|
|
4
4
|
import { VetoTracker } from './veto-tracker.js';
|
|
@@ -9,24 +9,27 @@ import { AuditTrail } from './audit-trail.js';
|
|
|
9
9
|
*/
|
|
10
10
|
export type AssessmentCallback = (proposal: ActionProposal) => Promise<GrilloAssessmentSummary | null>;
|
|
11
11
|
/**
|
|
12
|
-
* Callback for
|
|
13
|
-
*
|
|
12
|
+
* Callback for notifying the Commander and other channels
|
|
13
|
+
* when a proposal enters pending_review (BB modification #4).
|
|
14
14
|
*/
|
|
15
|
-
export type
|
|
16
|
-
decision: 'approved' | 'vetoed';
|
|
17
|
-
explanation?: string;
|
|
18
|
-
}>;
|
|
15
|
+
export type NotificationCallback = (review: PendingReview, message: string) => Promise<void>;
|
|
19
16
|
/**
|
|
20
17
|
* The Governance Router — core of the three-tier decision engine.
|
|
21
18
|
*
|
|
22
|
-
* Decision flow (Patent Section 3.2):
|
|
19
|
+
* Decision flow (Patent Section 3.2, updated with async escalation):
|
|
23
20
|
* 1. Nole creates a proposal
|
|
24
21
|
* 2. If pre-assessment required → Grillo assesses
|
|
25
|
-
* 3. If Grillo flags concerns →
|
|
26
|
-
* 4. Commander
|
|
27
|
-
* 5.
|
|
28
|
-
* 6. If
|
|
22
|
+
* 3. If Grillo flags concerns → queue for Commander review (async)
|
|
23
|
+
* 4. Commander reviews pending queue via nole_review_pending tool
|
|
24
|
+
* 5. Commander vetoes or approves via nole_veto / nole_approve tools
|
|
25
|
+
* 6. If no Commander response within risk-tiered timeout → auto-approve or expire
|
|
29
26
|
* 7. Entire chain logged in immutable audit trail
|
|
27
|
+
*
|
|
28
|
+
* BB Modifications Applied:
|
|
29
|
+
* - #1: Risk-tiered auto-approval timeouts (low=24h, med=48h, high=72h, critical=NEVER)
|
|
30
|
+
* - #2: Access control (Nole cannot self-approve — enforced in plugin tools)
|
|
31
|
+
* - #4: Notification callback when proposals enter pending_review
|
|
32
|
+
* - #6: Veto explanation quality metric
|
|
30
33
|
*/
|
|
31
34
|
export declare class GovernanceRouter {
|
|
32
35
|
private readonly store;
|
|
@@ -34,17 +37,51 @@ export declare class GovernanceRouter {
|
|
|
34
37
|
readonly vetoTracker: VetoTracker;
|
|
35
38
|
readonly auditTrail: AuditTrail;
|
|
36
39
|
private assessmentCallback;
|
|
37
|
-
private
|
|
40
|
+
private notificationCallback;
|
|
38
41
|
constructor(store: NoleStore, financialThreshold?: number, agentId?: string);
|
|
39
42
|
/** Register the Grillo assessment callback */
|
|
40
43
|
onAssessment(callback: AssessmentCallback): void;
|
|
41
|
-
/** Register the
|
|
42
|
-
|
|
44
|
+
/** Register the notification callback (BB modification #4) */
|
|
45
|
+
onNotification(callback: NotificationCallback): void;
|
|
43
46
|
/**
|
|
44
47
|
* Propose and process an action through the full governance pipeline.
|
|
45
48
|
* This is the main entry point for all Nole decisions.
|
|
49
|
+
*
|
|
50
|
+
* If Grillo flags the proposal, it enters a pending_review queue
|
|
51
|
+
* instead of blocking for a synchronous Commander response.
|
|
46
52
|
*/
|
|
47
53
|
propose(input: CreateProposalInput): Promise<GovernanceResult>;
|
|
54
|
+
/**
|
|
55
|
+
* Escalate a flagged proposal to the Commander review queue (async model).
|
|
56
|
+
* The Commander reviews via nole_review_pending and decides via nole_approve/nole_veto.
|
|
57
|
+
*/
|
|
58
|
+
private escalateToCommander;
|
|
59
|
+
/**
|
|
60
|
+
* Commander approves a pending proposal (called from nole_approve tool).
|
|
61
|
+
*
|
|
62
|
+
* BB modification #2: Access control — callingAgentId must NOT be 'nole'.
|
|
63
|
+
* Enforced at the tool level, but double-checked here.
|
|
64
|
+
*/
|
|
65
|
+
commanderApprove(proposalId: string, callingAgentId: string, note?: string): Promise<GovernanceResult>;
|
|
66
|
+
/**
|
|
67
|
+
* Commander vetoes a pending proposal (called from nole_veto tool).
|
|
68
|
+
*
|
|
69
|
+
* BB modification #2: Access control — callingAgentId must NOT be 'nole'.
|
|
70
|
+
* BB modification #6: Veto explanation quality check.
|
|
71
|
+
*/
|
|
72
|
+
commanderVeto(proposalId: string, callingAgentId: string, explanation: string): Promise<GovernanceResult>;
|
|
73
|
+
/**
|
|
74
|
+
* Process timed-out pending reviews.
|
|
75
|
+
* BB modification #1: Risk-tiered timeouts.
|
|
76
|
+
* - Low: 24h, Medium: 48h, High: 72h, Critical: NEVER auto-approve
|
|
77
|
+
*/
|
|
78
|
+
processTimeouts(): Promise<GovernanceResult[]>;
|
|
79
|
+
/** Get all pending reviews for Commander */
|
|
80
|
+
getPendingReviews(): Promise<PendingReview[]>;
|
|
81
|
+
/** Get a specific pending review */
|
|
82
|
+
getPendingReview(proposalId: string): Promise<PendingReview | null>;
|
|
83
|
+
/** Execute a proposal (either direct or after Commander approval) */
|
|
84
|
+
private executeProposal;
|
|
48
85
|
/** Withdraw a pending proposal */
|
|
49
86
|
withdraw(proposalId: string, reason: string): Promise<GovernanceResult>;
|
|
50
87
|
/** Get governance statistics */
|
|
@@ -53,6 +90,7 @@ export declare class GovernanceRouter {
|
|
|
53
90
|
executed: number;
|
|
54
91
|
vetoed: number;
|
|
55
92
|
withdrawn: number;
|
|
93
|
+
pending: number;
|
|
56
94
|
vetoRate: number;
|
|
57
95
|
auditChainValid: boolean;
|
|
58
96
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"governance-router.d.ts","sourceRoot":"","sources":["../../src/governance/governance-router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"governance-router.d.ts","sourceRoot":"","sources":["../../src/governance/governance-router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EAEd,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAC/B,QAAQ,EAAE,cAAc,KACrB,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAC;AAE7C;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,CACjC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,gBAAgB;IAQzB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAPxB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAC1C,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,OAAO,CAAC,kBAAkB,CAAmC;IAC7D,OAAO,CAAC,oBAAoB,CAAqC;gBAG9C,KAAK,EAAE,SAAS,EACjC,kBAAkB,GAAE,MAAW,EAC/B,OAAO,GAAE,MAAe;IAO1B,8CAA8C;IAC9C,YAAY,CAAC,QAAQ,EAAE,kBAAkB,GAAG,I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';
|
|
2
3
|
import { VetoTracker } from './veto-tracker.js';
|
|
3
4
|
import { AuditTrail } from './audit-trail.js';
|
|
@@ -5,14 +6,20 @@ import { computeAuditHash, GENESIS_HASH } from '../store/hash-chain.js';
|
|
|
5
6
|
/**
|
|
6
7
|
* The Governance Router — core of the three-tier decision engine.
|
|
7
8
|
*
|
|
8
|
-
* Decision flow (Patent Section 3.2):
|
|
9
|
+
* Decision flow (Patent Section 3.2, updated with async escalation):
|
|
9
10
|
* 1. Nole creates a proposal
|
|
10
11
|
* 2. If pre-assessment required → Grillo assesses
|
|
11
|
-
* 3. If Grillo flags concerns →
|
|
12
|
-
* 4. Commander
|
|
13
|
-
* 5.
|
|
14
|
-
* 6. If
|
|
12
|
+
* 3. If Grillo flags concerns → queue for Commander review (async)
|
|
13
|
+
* 4. Commander reviews pending queue via nole_review_pending tool
|
|
14
|
+
* 5. Commander vetoes or approves via nole_veto / nole_approve tools
|
|
15
|
+
* 6. If no Commander response within risk-tiered timeout → auto-approve or expire
|
|
15
16
|
* 7. Entire chain logged in immutable audit trail
|
|
17
|
+
*
|
|
18
|
+
* BB Modifications Applied:
|
|
19
|
+
* - #1: Risk-tiered auto-approval timeouts (low=24h, med=48h, high=72h, critical=NEVER)
|
|
20
|
+
* - #2: Access control (Nole cannot self-approve — enforced in plugin tools)
|
|
21
|
+
* - #4: Notification callback when proposals enter pending_review
|
|
22
|
+
* - #6: Veto explanation quality metric
|
|
16
23
|
*/
|
|
17
24
|
export class GovernanceRouter {
|
|
18
25
|
store;
|
|
@@ -20,7 +27,7 @@ export class GovernanceRouter {
|
|
|
20
27
|
vetoTracker;
|
|
21
28
|
auditTrail;
|
|
22
29
|
assessmentCallback = null;
|
|
23
|
-
|
|
30
|
+
notificationCallback = null;
|
|
24
31
|
constructor(store, financialThreshold = 10, agentId = 'nole') {
|
|
25
32
|
this.store = store;
|
|
26
33
|
this.proposer = new ActionProposer(financialThreshold);
|
|
@@ -31,13 +38,16 @@ export class GovernanceRouter {
|
|
|
31
38
|
onAssessment(callback) {
|
|
32
39
|
this.assessmentCallback = callback;
|
|
33
40
|
}
|
|
34
|
-
/** Register the
|
|
35
|
-
|
|
36
|
-
this.
|
|
41
|
+
/** Register the notification callback (BB modification #4) */
|
|
42
|
+
onNotification(callback) {
|
|
43
|
+
this.notificationCallback = callback;
|
|
37
44
|
}
|
|
38
45
|
/**
|
|
39
46
|
* Propose and process an action through the full governance pipeline.
|
|
40
47
|
* This is the main entry point for all Nole decisions.
|
|
48
|
+
*
|
|
49
|
+
* If Grillo flags the proposal, it enters a pending_review queue
|
|
50
|
+
* instead of blocking for a synchronous Commander response.
|
|
41
51
|
*/
|
|
42
52
|
async propose(input) {
|
|
43
53
|
// Step 1: Create the proposal
|
|
@@ -50,53 +60,193 @@ export class GovernanceRouter {
|
|
|
50
60
|
await this.auditTrail.record('proposal_created', `Proposed: ${proposal.actionType} — ${proposal.description}`, proposal.id);
|
|
51
61
|
// Step 2: Assess if required
|
|
52
62
|
let assessment = null;
|
|
53
|
-
let escalated = false;
|
|
54
|
-
let commanderDecision;
|
|
55
|
-
let vetoExplanation;
|
|
56
63
|
if (proposal.requiresPreAssessment && this.assessmentCallback) {
|
|
57
64
|
await this.auditTrail.record('assessment_requested', `Pre-action assessment requested for ${proposal.actionType}`, proposal.id);
|
|
58
65
|
assessment = await this.assessmentCallback(proposal);
|
|
59
66
|
if (assessment) {
|
|
60
67
|
await this.auditTrail.record('assessment_completed', `Assessment: ${assessment.archetype}, passed=${assessment.passed}`, proposal.id);
|
|
61
|
-
// Step 3:
|
|
62
|
-
if (!assessment.passed
|
|
63
|
-
|
|
64
|
-
await this.auditTrail.record('escalated_to_commander', `Grillo flagged: ${assessment.archetype}. Escalating to Commander.`, proposal.id);
|
|
65
|
-
const commanderResult = await this.commanderCallback(proposal, assessment);
|
|
66
|
-
commanderDecision = commanderResult.decision;
|
|
67
|
-
if (commanderDecision === 'vetoed') {
|
|
68
|
-
vetoExplanation = commanderResult.explanation ?? 'No explanation provided';
|
|
69
|
-
await this.auditTrail.record('commander_vetoed', `Commander vetoed: ${vetoExplanation}`, proposal.id);
|
|
70
|
-
// Track veto for learning metrics
|
|
71
|
-
await this.vetoTracker.recordVeto(proposal.id, vetoExplanation, proposal.actionType);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
await this.auditTrail.record('commander_approved', 'Commander approved after Grillo flag.', proposal.id);
|
|
75
|
-
}
|
|
68
|
+
// Step 3: If Grillo flags → queue for async Commander review
|
|
69
|
+
if (!assessment.passed) {
|
|
70
|
+
return this.escalateToCommander(proposal, assessment);
|
|
76
71
|
}
|
|
77
72
|
}
|
|
78
73
|
}
|
|
79
|
-
//
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
// No escalation needed — auto-execute
|
|
75
|
+
return this.executeProposal(proposal, assessment ?? undefined);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Escalate a flagged proposal to the Commander review queue (async model).
|
|
79
|
+
* The Commander reviews via nole_review_pending and decides via nole_approve/nole_veto.
|
|
80
|
+
*/
|
|
81
|
+
async escalateToCommander(proposal, assessment) {
|
|
82
|
+
const review = {
|
|
83
|
+
proposalId: proposal.id,
|
|
84
|
+
proposal,
|
|
85
|
+
grilloAssessment: assessment,
|
|
86
|
+
escalatedAt: new Date(),
|
|
87
|
+
status: 'pending',
|
|
88
|
+
};
|
|
89
|
+
await this.store.savePendingReview(review);
|
|
90
|
+
await this.auditTrail.record('escalated_to_commander', `Grillo flagged: ${assessment.archetype}. Queued for Commander review. ` +
|
|
91
|
+
`Risk: ${proposal.riskLevel}. Timeout: ${getTimeoutForRisk(proposal.riskLevel) ?? 'NEVER (critical)'}h.`, proposal.id);
|
|
92
|
+
// BB modification #4: Notify Commander and other channels
|
|
93
|
+
if (this.notificationCallback) {
|
|
94
|
+
const timeoutHours = getTimeoutForRisk(proposal.riskLevel);
|
|
95
|
+
const timeoutStr = timeoutHours
|
|
96
|
+
? `Auto-approval in ${timeoutHours}h if no response.`
|
|
97
|
+
: 'CRITICAL: Will NOT auto-approve. Commander decision required.';
|
|
98
|
+
const message = [
|
|
99
|
+
`[NOLE ESCALATION] Proposal requires Commander review.`,
|
|
100
|
+
`Action: ${proposal.actionType} — ${proposal.description}`,
|
|
101
|
+
`Risk: ${proposal.riskLevel.toUpperCase()}`,
|
|
102
|
+
`Grillo: ${assessment.archetype} (${assessment.passed ? 'passed' : 'FAILED'})`,
|
|
103
|
+
timeoutStr,
|
|
104
|
+
`Review: use nole_review_pending tool to see all pending proposals.`,
|
|
105
|
+
].join('\n');
|
|
106
|
+
try {
|
|
107
|
+
await this.notificationCallback(review, message);
|
|
108
|
+
await this.auditTrail.record('notification_sent', `Escalation notification sent for proposal ${proposal.id}`, proposal.id);
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
112
|
+
console.error(`[nole] Notification failed: ${msg}`);
|
|
113
|
+
}
|
|
84
114
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
115
|
+
// Return pending result — Commander decides later
|
|
116
|
+
const latestAudit = await this.auditTrail.getLatest();
|
|
117
|
+
const result = {
|
|
118
|
+
proposalId: proposal.id,
|
|
119
|
+
proposal,
|
|
120
|
+
grilloAssessment: assessment,
|
|
121
|
+
escalatedToCommander: true,
|
|
122
|
+
finalOutcome: 'pending',
|
|
123
|
+
processedAt: new Date(),
|
|
124
|
+
auditHash: latestAudit?.hash ?? GENESIS_HASH,
|
|
125
|
+
};
|
|
126
|
+
await this.store.saveGovernanceResult(result);
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Commander approves a pending proposal (called from nole_approve tool).
|
|
131
|
+
*
|
|
132
|
+
* BB modification #2: Access control — callingAgentId must NOT be 'nole'.
|
|
133
|
+
* Enforced at the tool level, but double-checked here.
|
|
134
|
+
*/
|
|
135
|
+
async commanderApprove(proposalId, callingAgentId, note) {
|
|
136
|
+
if (callingAgentId === 'nole') {
|
|
137
|
+
await this.auditTrail.record('self_approve_blocked', `BLOCKED: Nole attempted to self-approve proposal ${proposalId}`, proposalId);
|
|
138
|
+
throw new Error('Nole cannot approve his own proposals. This incident has been logged.');
|
|
88
139
|
}
|
|
89
|
-
|
|
140
|
+
const review = await this.store.getPendingReview(proposalId);
|
|
141
|
+
if (!review) {
|
|
142
|
+
throw new Error(`No pending review found for proposal: ${proposalId}`);
|
|
143
|
+
}
|
|
144
|
+
const decision = {
|
|
145
|
+
decision: 'approved',
|
|
146
|
+
note,
|
|
147
|
+
decidedAt: new Date(),
|
|
148
|
+
commanderId: callingAgentId,
|
|
149
|
+
};
|
|
150
|
+
await this.store.resolvePendingReview(proposalId, decision);
|
|
151
|
+
await this.auditTrail.record('commander_approved', `Commander (${callingAgentId}) approved. ${note ? `Note: ${note}` : ''}`, proposalId);
|
|
152
|
+
return this.executeProposal(review.proposal, review.grilloAssessment, true, 'approved');
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Commander vetoes a pending proposal (called from nole_veto tool).
|
|
156
|
+
*
|
|
157
|
+
* BB modification #2: Access control — callingAgentId must NOT be 'nole'.
|
|
158
|
+
* BB modification #6: Veto explanation quality check.
|
|
159
|
+
*/
|
|
160
|
+
async commanderVeto(proposalId, callingAgentId, explanation) {
|
|
161
|
+
if (callingAgentId === 'nole') {
|
|
162
|
+
await this.auditTrail.record('self_approve_blocked', `BLOCKED: Nole attempted to self-veto proposal ${proposalId}`, proposalId);
|
|
163
|
+
throw new Error('Nole cannot veto his own proposals. This incident has been logged.');
|
|
164
|
+
}
|
|
165
|
+
const review = await this.store.getPendingReview(proposalId);
|
|
166
|
+
if (!review) {
|
|
167
|
+
throw new Error(`No pending review found for proposal: ${proposalId}`);
|
|
168
|
+
}
|
|
169
|
+
// BB modification #6: Assess veto explanation quality
|
|
170
|
+
const quality = assessVetoQuality(explanation);
|
|
171
|
+
const decision = {
|
|
172
|
+
decision: 'vetoed',
|
|
173
|
+
explanation,
|
|
174
|
+
decidedAt: new Date(),
|
|
175
|
+
commanderId: callingAgentId,
|
|
176
|
+
};
|
|
177
|
+
await this.store.resolvePendingReview(proposalId, decision);
|
|
178
|
+
const qualityNote = quality.warning ? ` [QUALITY WARNING: ${quality.warning}]` : '';
|
|
179
|
+
await this.auditTrail.record('commander_vetoed', `Commander (${callingAgentId}) vetoed: ${explanation}${qualityNote}`, proposalId);
|
|
180
|
+
// Track veto for learning metrics
|
|
181
|
+
await this.vetoTracker.recordVeto(proposalId, explanation, review.proposal.actionType);
|
|
182
|
+
const latestAudit = await this.auditTrail.getLatest();
|
|
183
|
+
const result = {
|
|
184
|
+
proposalId,
|
|
185
|
+
proposal: review.proposal,
|
|
186
|
+
grilloAssessment: review.grilloAssessment,
|
|
187
|
+
escalatedToCommander: true,
|
|
188
|
+
commanderDecision: 'vetoed',
|
|
189
|
+
vetoExplanation: explanation,
|
|
190
|
+
finalOutcome: 'vetoed',
|
|
191
|
+
processedAt: new Date(),
|
|
192
|
+
auditHash: latestAudit?.hash ?? GENESIS_HASH,
|
|
193
|
+
};
|
|
194
|
+
await this.store.saveGovernanceResult(result);
|
|
195
|
+
return result;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Process timed-out pending reviews.
|
|
199
|
+
* BB modification #1: Risk-tiered timeouts.
|
|
200
|
+
* - Low: 24h, Medium: 48h, High: 72h, Critical: NEVER auto-approve
|
|
201
|
+
*/
|
|
202
|
+
async processTimeouts() {
|
|
203
|
+
const pending = await this.store.listPendingReviews();
|
|
204
|
+
const now = new Date();
|
|
205
|
+
const results = [];
|
|
206
|
+
for (const review of pending) {
|
|
207
|
+
const timeoutHours = getTimeoutForRisk(review.proposal.riskLevel);
|
|
208
|
+
// Critical proposals NEVER auto-approve (BB modification #1)
|
|
209
|
+
if (timeoutHours === null)
|
|
210
|
+
continue;
|
|
211
|
+
const escalatedAt = new Date(review.escalatedAt);
|
|
212
|
+
const timeoutMs = timeoutHours * 60 * 60 * 1000;
|
|
213
|
+
const deadline = new Date(escalatedAt.getTime() + timeoutMs);
|
|
214
|
+
if (now >= deadline) {
|
|
215
|
+
// Auto-approve after timeout
|
|
216
|
+
const decision = {
|
|
217
|
+
decision: 'approved',
|
|
218
|
+
note: `Auto-approved: Commander did not respond within ${timeoutHours}h timeout (risk: ${review.proposal.riskLevel}).`,
|
|
219
|
+
decidedAt: now,
|
|
220
|
+
commanderId: 'system_timeout',
|
|
221
|
+
};
|
|
222
|
+
await this.store.resolvePendingReview(review.proposalId, decision);
|
|
223
|
+
await this.auditTrail.record('commander_timeout', `Auto-approved after ${timeoutHours}h timeout. Risk level: ${review.proposal.riskLevel}.`, review.proposalId);
|
|
224
|
+
const result = await this.executeProposal(review.proposal, review.grilloAssessment, true, 'approved');
|
|
225
|
+
results.push(result);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return results;
|
|
229
|
+
}
|
|
230
|
+
/** Get all pending reviews for Commander */
|
|
231
|
+
async getPendingReviews() {
|
|
232
|
+
return this.store.listPendingReviews();
|
|
233
|
+
}
|
|
234
|
+
/** Get a specific pending review */
|
|
235
|
+
async getPendingReview(proposalId) {
|
|
236
|
+
return this.store.getPendingReview(proposalId);
|
|
237
|
+
}
|
|
238
|
+
/** Execute a proposal (either direct or after Commander approval) */
|
|
239
|
+
async executeProposal(proposal, assessment, escalated = false, commanderDecision) {
|
|
240
|
+
await this.auditTrail.record('action_executed', `Action approved and executed: ${proposal.description}`, proposal.id);
|
|
90
241
|
const latestAudit = await this.auditTrail.getLatest();
|
|
91
242
|
const auditHash = latestAudit?.hash ?? computeAuditHash(GENESIS_HASH, new Date(), 'action_executed', proposal.description, 'nole');
|
|
92
243
|
const result = {
|
|
93
244
|
proposalId: proposal.id,
|
|
94
245
|
proposal,
|
|
95
|
-
grilloAssessment: assessment
|
|
246
|
+
grilloAssessment: assessment,
|
|
96
247
|
escalatedToCommander: escalated,
|
|
97
248
|
commanderDecision,
|
|
98
|
-
|
|
99
|
-
finalOutcome,
|
|
249
|
+
finalOutcome: 'executed',
|
|
100
250
|
processedAt: new Date(),
|
|
101
251
|
auditHash,
|
|
102
252
|
};
|
|
@@ -125,6 +275,7 @@ export class GovernanceRouter {
|
|
|
125
275
|
/** Get governance statistics */
|
|
126
276
|
async getStats() {
|
|
127
277
|
const results = await this.store.listGovernanceResults(10000);
|
|
278
|
+
const pendingReviews = await this.store.listPendingReviews();
|
|
128
279
|
const executed = results.filter((r) => r.finalOutcome === 'executed').length;
|
|
129
280
|
const vetoed = results.filter((r) => r.finalOutcome === 'vetoed').length;
|
|
130
281
|
const withdrawn = results.filter((r) => r.finalOutcome === 'withdrawn').length;
|
|
@@ -135,6 +286,7 @@ export class GovernanceRouter {
|
|
|
135
286
|
executed,
|
|
136
287
|
vetoed,
|
|
137
288
|
withdrawn,
|
|
289
|
+
pending: pendingReviews.length,
|
|
138
290
|
vetoRate: total > 0 ? vetoed / total : 0,
|
|
139
291
|
auditChainValid: chainVerification.valid,
|
|
140
292
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"governance-router.js","sourceRoot":"","sources":["../../src/governance/governance-router.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAmBxE
|
|
1
|
+
{"version":3,"file":"governance-router.js","sourceRoot":"","sources":["../../src/governance/governance-router.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGlE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD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AAE,iBAAiB,CAAC,KAAK;SACzC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -69,7 +69,39 @@ export interface AuditEntry {
|
|
|
69
69
|
hash: AuditHash;
|
|
70
70
|
}
|
|
71
71
|
/** Audit action categories */
|
|
72
|
-
export type AuditAction = 'proposal_created' | 'assessment_requested' | 'assessment_completed' | 'escalated_to_commander' | 'commander_approved' | 'commander_vetoed' | 'action_executed' | 'action_withdrawn' | 'veto_explanation_received' | 'config_changed' | 'agent_started' | 'agent_stopped' | 'daily_assessment' | 'score_published';
|
|
72
|
+
export type AuditAction = 'proposal_created' | 'assessment_requested' | 'assessment_completed' | 'escalated_to_commander' | 'commander_approved' | 'commander_vetoed' | 'commander_timeout' | 'action_executed' | 'action_withdrawn' | 'veto_explanation_received' | 'self_approve_blocked' | 'notification_sent' | 'config_changed' | 'agent_started' | 'agent_stopped' | 'daily_assessment' | 'score_published';
|
|
73
|
+
/** Commander decision on a pending proposal */
|
|
74
|
+
export interface CommanderDecision {
|
|
75
|
+
decision: 'approved' | 'vetoed';
|
|
76
|
+
explanation?: string;
|
|
77
|
+
note?: string;
|
|
78
|
+
decidedAt: Date;
|
|
79
|
+
commanderId: string;
|
|
80
|
+
}
|
|
81
|
+
/** A proposal queued for Commander review (async escalation model) */
|
|
82
|
+
export interface PendingReview {
|
|
83
|
+
proposalId: NoleId;
|
|
84
|
+
proposal: ActionProposal;
|
|
85
|
+
grilloAssessment: GrilloAssessmentSummary;
|
|
86
|
+
escalatedAt: Date;
|
|
87
|
+
status: 'pending' | 'approved' | 'vetoed' | 'timeout';
|
|
88
|
+
commanderDecision?: CommanderDecision;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Risk-tiered auto-approval timeouts (BB modification #1).
|
|
92
|
+
* Critical actions NEVER auto-approve.
|
|
93
|
+
*/
|
|
94
|
+
export declare const RISK_TIMEOUT_HOURS: Record<RiskLevel, number | null>;
|
|
95
|
+
/** Get the timeout for a given risk level. null = never auto-approve. */
|
|
96
|
+
export declare function getTimeoutForRisk(riskLevel: RiskLevel): number | null;
|
|
97
|
+
/** Veto explanation quality assessment (BB modification #6) */
|
|
98
|
+
export interface VetoQuality {
|
|
99
|
+
explanationLength: number;
|
|
100
|
+
isActionable: boolean;
|
|
101
|
+
warning?: string;
|
|
102
|
+
}
|
|
103
|
+
/** Assess veto explanation quality. Short/vague vetoes trigger warnings. */
|
|
104
|
+
export declare function assessVetoQuality(explanation: string): VetoQuality;
|
|
73
105
|
/** Input for creating a proposal */
|
|
74
106
|
export interface CreateProposalInput {
|
|
75
107
|
actionType: ActionCategory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/governance/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,SAAS,EACT,uBAAuB,EACvB,MAAM,EACP,MAAM,oBAAoB,CAAC;AAE5B;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,IAAI,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,cAAc,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAED,0CAA0C;AAC1C,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;AAE9E,4CAA4C;AAC5C,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,cAAc,CAAC;IACzB,gBAAgB,CAAC,EA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SAAS,EAAE,MAAM,GAAG,IAAI,CAK/D,CAAC;AAEF,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAErE;AAED,+DAA+D;AAC/D,MAAM,WAAW,WAAW;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,CAqBlE;AAED,oCAAoC;AACpC,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,cAAc,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,8FAA8F;AAC9F,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,cAAc,EAC1B,gBAAgB,EAAE,MAAM,EACxB,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAOT;AAED,kDAAkD;AAClD,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAUvF"}
|
package/dist/governance/types.js
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Risk-tiered auto-approval timeouts (BB modification #1).
|
|
3
|
+
* Critical actions NEVER auto-approve.
|
|
4
|
+
*/
|
|
5
|
+
export const RISK_TIMEOUT_HOURS = {
|
|
6
|
+
low: 24,
|
|
7
|
+
medium: 48,
|
|
8
|
+
high: 72,
|
|
9
|
+
critical: null, // NEVER auto-approve
|
|
10
|
+
};
|
|
11
|
+
/** Get the timeout for a given risk level. null = never auto-approve. */
|
|
12
|
+
export function getTimeoutForRisk(riskLevel) {
|
|
13
|
+
return RISK_TIMEOUT_HOURS[riskLevel];
|
|
14
|
+
}
|
|
15
|
+
/** Assess veto explanation quality. Short/vague vetoes trigger warnings. */
|
|
16
|
+
export function assessVetoQuality(explanation) {
|
|
17
|
+
const length = explanation.trim().length;
|
|
18
|
+
const vaguePatterns = [
|
|
19
|
+
/^too risky$/i,
|
|
20
|
+
/^no$/i,
|
|
21
|
+
/^denied$/i,
|
|
22
|
+
/^rejected$/i,
|
|
23
|
+
/^not approved$/i,
|
|
24
|
+
/^risky$/i,
|
|
25
|
+
/^bad idea$/i,
|
|
26
|
+
];
|
|
27
|
+
const isVague = vaguePatterns.some((p) => p.test(explanation.trim()));
|
|
28
|
+
const isActionable = length >= 20 && !isVague;
|
|
29
|
+
return {
|
|
30
|
+
explanationLength: length,
|
|
31
|
+
isActionable,
|
|
32
|
+
warning: !isActionable
|
|
33
|
+
? `Veto explanation is too short or vague (${length} chars). Nole learns from specific, actionable feedback.`
|
|
34
|
+
: undefined,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
1
37
|
/** Determines if an action requires pre-assessment based on triggers (Patent Section 10.1) */
|
|
2
38
|
export function requiresPreAssessment(actionType, estimatedCostUsd, financialThreshold) {
|
|
3
39
|
if (actionType === 'financial' && estimatedCostUsd > financialThreshold)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/governance/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/governance/types.ts"],"names":[],"mappings":"AA2HA;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAqC;IAClE,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,EAAE;IACR,QAAQ,EAAE,IAAI,EAAE,qBAAqB;CACtC,CAAC;AAEF,yEAAyE;AACzE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E,OAAO,MAAM,CAAC;IAClD,IAAI,UAAU,KAAK,sBAAsB;QAAE,OAAO,MAAM,CAAC;IACzD,IAAI,UAAU,KAAK,WAAW,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,MAAM,CAAC;IAC9D,IAAI,UAAU,KAAK,WAAW,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,QAAQ,CAAC;IAChE,IAAI,UAAU,KAAK,aAAa;QAAE,OAAO,QAAQ,CAAC;IAClD,IAAI,UAAU,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IAC9C,IAAI,UAAU,KAAK,cAAc;QAAE,OAAO,KAAK,CAAC;IAChD,IAAI,UAAU,KAAK,iBAAiB;QAAE,OAAO,KAAK,CAAC;IACnD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -18,6 +18,8 @@ export declare class VetoTracker {
|
|
|
18
18
|
recordVeto(proposalId: string, explanation: string, actionType: ActionCategory, lessonsLearned?: string): Promise<VetoRecord>;
|
|
19
19
|
/** Get veto metrics for a time period */
|
|
20
20
|
getMetrics(totalProposals: number): Promise<VetoMetrics>;
|
|
21
|
+
/** Get recent vetoes (for quality analysis) */
|
|
22
|
+
getRecentVetoes(limit?: number): Promise<VetoRecord[]>;
|
|
21
23
|
/** Is the veto rate declining? (indicates learning) */
|
|
22
24
|
isLearning(): Promise<{
|
|
23
25
|
learning: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"veto-tracker.d.ts","sourceRoot":"","sources":["../../src/governance/veto-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAkB,MAAM,YAAY,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;;;GASG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAA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