@aragon-agent/cli 0.6.44 → 0.6.45
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 +44 -0
- package/README.md +69 -2
- package/dist/agent/controller.d.ts +69 -0
- package/dist/agent/controller.js +224 -11
- package/dist/agent/governance-view.d.ts +40 -0
- package/dist/agent/governance-view.js +40 -0
- package/dist/agent/governance-wiring.d.ts +162 -0
- package/dist/agent/governance-wiring.js +470 -0
- package/dist/agent/plan-prompt.d.ts +7 -0
- package/dist/agent/plan-prompt.js +2 -1
- package/dist/agent/reducer.d.ts +33 -1
- package/dist/agent/reducer.js +45 -9
- package/dist/agent/system-prompt.d.ts +19 -0
- package/dist/agent/system-prompt.js +9 -1
- package/dist/cli.js +45 -1
- package/dist/commands/builtins.js +10 -4
- package/dist/commands/governance-command.d.ts +35 -0
- package/dist/commands/governance-command.js +292 -0
- package/dist/commands/governance-runs-table.d.ts +40 -0
- package/dist/commands/governance-runs-table.js +130 -0
- package/dist/commands/registry.d.ts +12 -0
- package/dist/config/app-paths.d.ts +10 -0
- package/dist/config/app-paths.js +12 -0
- package/dist/config/cli-commands.d.ts +18 -0
- package/dist/config/cli-commands.js +47 -1
- package/dist/config/env.d.ts +2 -1
- package/dist/config/env.js +10 -1
- package/dist/config/governance-config.d.ts +125 -0
- package/dist/config/governance-config.js +164 -0
- package/dist/config/governance-launch.d.ts +71 -0
- package/dist/config/governance-launch.js +58 -0
- package/dist/config/load.d.ts +15 -0
- package/dist/config/load.js +26 -1
- package/dist/config/model-profile-store.d.ts +4 -2
- package/dist/config/schema.d.ts +22 -0
- package/dist/config/schema.js +6 -0
- package/dist/config/store.js +14 -1
- package/dist/config/ui-state.d.ts +11 -0
- package/dist/config/ui-state.js +11 -0
- package/dist/diagnostics/doctor.js +20 -0
- package/dist/governance/card-normalize.d.ts +24 -0
- package/dist/governance/card-normalize.js +76 -0
- package/dist/governance/copy.d.ts +109 -0
- package/dist/governance/copy.js +223 -0
- package/dist/governance/engine/aftermath.d.ts +49 -0
- package/dist/governance/engine/aftermath.js +134 -0
- package/dist/governance/engine/artifact-persist.d.ts +35 -0
- package/dist/governance/engine/artifact-persist.js +86 -0
- package/dist/governance/engine/budget.d.ts +52 -0
- package/dist/governance/engine/budget.js +112 -0
- package/dist/governance/engine/cards.d.ts +18 -0
- package/dist/governance/engine/cards.js +186 -0
- package/dist/governance/engine/digest.d.ts +32 -0
- package/dist/governance/engine/digest.js +63 -0
- package/dist/governance/engine/engine-core.d.ts +219 -0
- package/dist/governance/engine/engine-core.js +562 -0
- package/dist/governance/engine/engine.d.ts +68 -0
- package/dist/governance/engine/engine.js +314 -0
- package/dist/governance/engine/estimate.d.ts +38 -0
- package/dist/governance/engine/estimate.js +46 -0
- package/dist/governance/engine/inspector.d.ts +16 -0
- package/dist/governance/engine/inspector.js +396 -0
- package/dist/governance/engine/integration.d.ts +35 -0
- package/dist/governance/engine/integration.js +220 -0
- package/dist/governance/engine/lifecycle.d.ts +29 -0
- package/dist/governance/engine/lifecycle.js +656 -0
- package/dist/governance/engine/pause.d.ts +56 -0
- package/dist/governance/engine/pause.js +107 -0
- package/dist/governance/engine/phase-members.d.ts +15 -0
- package/dist/governance/engine/phase-members.js +34 -0
- package/dist/governance/engine/phase-planner.d.ts +53 -0
- package/dist/governance/engine/phase-planner.js +282 -0
- package/dist/governance/engine/rebuild.d.ts +27 -0
- package/dist/governance/engine/rebuild.js +57 -0
- package/dist/governance/engine/report.d.ts +66 -0
- package/dist/governance/engine/report.js +220 -0
- package/dist/governance/engine/run-digest.d.ts +20 -0
- package/dist/governance/engine/run-digest.js +42 -0
- package/dist/governance/engine/spec-builder.d.ts +117 -0
- package/dist/governance/engine/spec-builder.js +321 -0
- package/dist/governance/engine/stage-runner.d.ts +22 -0
- package/dist/governance/engine/stage-runner.js +664 -0
- package/dist/governance/engine/start-input.d.ts +19 -0
- package/dist/governance/engine/start-input.js +111 -0
- package/dist/governance/engine/state-machine.d.ts +101 -0
- package/dist/governance/engine/state-machine.js +586 -0
- package/dist/governance/engine/submission-queries.d.ts +42 -0
- package/dist/governance/engine/submission-queries.js +97 -0
- package/dist/governance/engine/submission-render.d.ts +12 -0
- package/dist/governance/engine/submission-render.js +92 -0
- package/dist/governance/engine/submissions.d.ts +27 -0
- package/dist/governance/engine/submissions.js +455 -0
- package/dist/governance/engine/visibility.d.ts +104 -0
- package/dist/governance/engine/visibility.js +223 -0
- package/dist/governance/governed-dispatch.d.ts +19 -0
- package/dist/governance/governed-dispatch.js +17 -0
- package/dist/governance/limits.d.ts +107 -0
- package/dist/governance/limits.js +131 -0
- package/dist/governance/posture-transition.d.ts +38 -0
- package/dist/governance/posture-transition.js +44 -0
- package/dist/governance/posture.d.ts +35 -0
- package/dist/governance/posture.js +59 -0
- package/dist/governance/profiles.d.ts +48 -0
- package/dist/governance/profiles.js +140 -0
- package/dist/governance/prompts/orchestrator-block.d.ts +40 -0
- package/dist/governance/prompts/orchestrator-block.js +128 -0
- package/dist/governance/prompts/plan-addendum.d.ts +22 -0
- package/dist/governance/prompts/plan-addendum.js +60 -0
- package/dist/governance/prompts/refusals.d.ts +48 -0
- package/dist/governance/prompts/refusals.js +82 -0
- package/dist/governance/prompts/role-blocks.d.ts +40 -0
- package/dist/governance/prompts/role-blocks.js +255 -0
- package/dist/governance/report-reader.d.ts +31 -0
- package/dist/governance/report-reader.js +57 -0
- package/dist/governance/roles.d.ts +83 -0
- package/dist/governance/roles.js +142 -0
- package/dist/governance/rules/claims.d.ts +83 -0
- package/dist/governance/rules/claims.js +250 -0
- package/dist/governance/rules/elimination.d.ts +66 -0
- package/dist/governance/rules/elimination.js +105 -0
- package/dist/governance/rules/events-table.d.ts +46 -0
- package/dist/governance/rules/events-table.js +94 -0
- package/dist/governance/rules/failure-analysis.d.ts +28 -0
- package/dist/governance/rules/failure-analysis.js +93 -0
- package/dist/governance/rules/ledger-replay.d.ts +53 -0
- package/dist/governance/rules/ledger-replay.js +53 -0
- package/dist/governance/rules/ledger-state.d.ts +85 -0
- package/dist/governance/rules/ledger-state.js +175 -0
- package/dist/governance/rules/ledger.d.ts +228 -0
- package/dist/governance/rules/ledger.js +560 -0
- package/dist/governance/rules/rca.d.ts +68 -0
- package/dist/governance/rules/rca.js +220 -0
- package/dist/governance/rules/settlement.d.ts +129 -0
- package/dist/governance/rules/settlement.js +363 -0
- package/dist/governance/rules/suspicion.d.ts +66 -0
- package/dist/governance/rules/suspicion.js +169 -0
- package/dist/governance/store/artifacts.d.ts +81 -0
- package/dist/governance/store/artifacts.js +173 -0
- package/dist/governance/store/atomic.d.ts +79 -0
- package/dist/governance/store/atomic.js +119 -0
- package/dist/governance/store/events-log.d.ts +35 -0
- package/dist/governance/store/events-log.js +86 -0
- package/dist/governance/store/run-lock.d.ts +51 -0
- package/dist/governance/store/run-lock.js +122 -0
- package/dist/governance/store/run-store.d.ts +229 -0
- package/dist/governance/store/run-store.js +644 -0
- package/dist/governance/store/scoreboard-export.d.ts +53 -0
- package/dist/governance/store/scoreboard-export.js +65 -0
- package/dist/governance/tools/child-tools.d.ts +31 -0
- package/dist/governance/tools/child-tools.js +65 -0
- package/dist/governance/tools/guard.d.ts +71 -0
- package/dist/governance/tools/guard.js +194 -0
- package/dist/governance/tools/inspector-tools.d.ts +63 -0
- package/dist/governance/tools/inspector-tools.js +424 -0
- package/dist/governance/tools/lead-tools.d.ts +42 -0
- package/dist/governance/tools/lead-tools.js +226 -0
- package/dist/governance/tools/normalize-util.d.ts +101 -0
- package/dist/governance/tools/normalize-util.js +230 -0
- package/dist/governance/tools/scan-incomplete.d.ts +79 -0
- package/dist/governance/tools/scan-incomplete.js +486 -0
- package/dist/governance/tools/shared-tools.d.ts +44 -0
- package/dist/governance/tools/shared-tools.js +125 -0
- package/dist/governance/tools/submit-normalizers.d.ts +28 -0
- package/dist/governance/tools/submit-normalizers.js +474 -0
- package/dist/governance/tools/submit-tools.d.ts +26 -0
- package/dist/governance/tools/submit-tools.js +171 -0
- package/dist/governance/types.d.ts +661 -0
- package/dist/governance/types.js +27 -0
- package/dist/session/validate-session.js +32 -1
- package/dist/team/runtime.d.ts +8 -0
- package/dist/team/runtime.js +9 -0
- package/dist/team/subagent.d.ts +23 -0
- package/dist/team/subagent.js +14 -3
- package/dist/team/types.d.ts +6 -0
- package/dist/tools/index.d.ts +30 -7
- package/dist/tools/index.js +14 -0
- package/dist/tools/plan-tools.d.ts +14 -2
- package/dist/tools/plan-tools.js +5 -2
- package/dist/ui/App.js +145 -25
- package/dist/ui/BottomStatusRow.js +1 -1
- package/dist/ui/Composer.d.ts +7 -1
- package/dist/ui/Composer.js +9 -6
- package/dist/ui/GovernancePanel.d.ts +50 -0
- package/dist/ui/GovernancePanel.js +77 -0
- package/dist/ui/GovernanceRun.d.ts +18 -0
- package/dist/ui/GovernanceRun.js +11 -0
- package/dist/ui/StatusBar.d.ts +15 -2
- package/dist/ui/StatusBar.js +10 -4
- package/dist/ui/Transcript.js +3 -0
- package/dist/ui/entries/GovernanceCard.d.ts +30 -0
- package/dist/ui/entries/GovernanceCard.js +32 -0
- package/dist/ui/governance-copy.d.ts +69 -0
- package/dist/ui/governance-copy.js +104 -0
- package/dist/ui/governance-status.d.ts +145 -0
- package/dist/ui/governance-status.js +326 -0
- package/dist/ui/interaction-copy.d.ts +4 -0
- package/dist/ui/interaction-copy.js +5 -0
- package/dist/ui/interaction-hints.d.ts +17 -0
- package/dist/ui/interaction-hints.js +14 -2
- package/dist/ui/layout/governance-board.d.ts +121 -0
- package/dist/ui/layout/governance-board.js +382 -0
- package/dist/ui/layout/governance-card.d.ts +53 -0
- package/dist/ui/layout/governance-card.js +134 -0
- package/dist/ui/layout/governance-chip.d.ts +38 -0
- package/dist/ui/layout/governance-chip.js +64 -0
- package/dist/ui/layout/governance-panel.d.ts +85 -0
- package/dist/ui/layout/governance-panel.js +358 -0
- package/dist/ui/layout/governance-roster.d.ts +65 -0
- package/dist/ui/layout/governance-roster.js +275 -0
- package/dist/ui/layout/status-detail-layout.js +3 -3
- package/dist/ui/layout/status-layout.d.ts +5 -2
- package/dist/ui/layout/status-layout.js +10 -6
- package/dist/ui/layout/virtual-window.js +11 -0
- package/dist/ui/overlays/GovernanceBoardOverlay.d.ts +41 -0
- package/dist/ui/overlays/GovernanceBoardOverlay.js +76 -0
- package/dist/ui/overlays/GovernanceSettingsPage.d.ts +48 -0
- package/dist/ui/overlays/GovernanceSettingsPage.js +93 -0
- package/dist/ui/overlays/HelpOverlay.js +4 -3
- package/dist/ui/overlays/QuestionOverlay.d.ts +9 -1
- package/dist/ui/overlays/QuestionOverlay.js +4 -2
- package/dist/ui/overlays/SettingsScreen.d.ts +7 -0
- package/dist/ui/overlays/SettingsScreen.js +21 -1
- package/dist/ui/overlays/governance-settings.d.ts +79 -0
- package/dist/ui/overlays/governance-settings.js +140 -0
- package/dist/ui/overlays/model-profile-state.d.ts +6 -1
- package/dist/ui/overlays/model-profile-state.js +10 -0
- package/dist/ui/palettes.d.ts +17 -0
- package/dist/ui/palettes.js +9 -0
- package/dist/ui/scrollback/live-preview.js +2 -0
- package/dist/ui/scrollback/settled-boundary.js +3 -0
- package/dist/ui/shortcuts.js +2 -2
- package/dist/ui/theme.d.ts +7 -0
- package/dist/ui/theme.js +1 -0
- package/dist/ui/transcript-text.js +9 -0
- package/dist/ui/use-wheel-routing.js +3 -1
- package/package.json +2 -2
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared shapes for the governance subsystem (governance-mode sections 5, 8, 12, 14).
|
|
3
|
+
*
|
|
4
|
+
* ASCII ONLY (`governance/` is glyph-scanned). Pure types plus a handful of tiny
|
|
5
|
+
* constants: no I/O, no React, no `node:*`.
|
|
6
|
+
*
|
|
7
|
+
* THE CONTRACT BETWEEN MODULES. `rules/` (ledger, settlement, rca, elimination),
|
|
8
|
+
* `store/` (run store), `engine/` (planner, state machine, visibility, spec builder,
|
|
9
|
+
* engine), `tools/` (what the model calls), `agent/governance-wiring.ts` and the UI all
|
|
10
|
+
* import from here and nowhere else for shapes, so a field added here is seen by every
|
|
11
|
+
* layer at compile time. `GovernanceEvent` is a CLI-LOCAL stream (D-19): it must never
|
|
12
|
+
* be folded into core's `AgentEvent` (`public-api.test.ts` freezes that union).
|
|
13
|
+
*/
|
|
14
|
+
import type { TokenUsage } from '@aragon-agent/core';
|
|
15
|
+
import type { EventCode, Settlement } from './rules/events-table.js';
|
|
16
|
+
export type { EventCode, Settlement } from './rules/events-table.js';
|
|
17
|
+
/** All four powers. INSP is the fourth power and is never scored (I-G5). */
|
|
18
|
+
export type GovRole = 'DEV' | 'REV' | 'TEST' | 'INSP';
|
|
19
|
+
/** The three scored roles. */
|
|
20
|
+
export type ScoredRole = 'DEV' | 'REV' | 'TEST';
|
|
21
|
+
export type StageKind = 'dev' | 'review' | 'test' | 'settle' | 'integrate' | 'fix';
|
|
22
|
+
export declare const STAGE_KINDS: readonly StageKind[];
|
|
23
|
+
export type ProfileId = 'general' | 'ml' | 'product' | 'api-security';
|
|
24
|
+
export declare const PROFILE_IDS: readonly ProfileId[];
|
|
25
|
+
export type RunStatus = 'executing' | 'escalated' | 'paused' | 'closed' | 'abandoned';
|
|
26
|
+
export type WpStatus = 'pending' | 'dev_running' | 'awaiting_review' | 'review_running' | 'awaiting_test' | 'test_running' | 'rework' | 'tested_ok' | 'integrated' | 'blocked' | 'dropped';
|
|
27
|
+
/** A tool-bound identity. The factories close over this; submissions never carry their own. */
|
|
28
|
+
export interface Identity {
|
|
29
|
+
/** Roster id and subagent label: `dev1`, `rev2`, `tst1`, `insp`, `dev2-r1`. */
|
|
30
|
+
id: string;
|
|
31
|
+
role: GovRole;
|
|
32
|
+
generation: number;
|
|
33
|
+
}
|
|
34
|
+
/** Every `gov_*` / `ledger_*` entry point returns plain text; the tool layer wraps it. */
|
|
35
|
+
export type ToolText = string;
|
|
36
|
+
export interface WorkPackage {
|
|
37
|
+
id: string;
|
|
38
|
+
title: string;
|
|
39
|
+
goal: string;
|
|
40
|
+
/** Owned files, INCLUDING the WP's test paths (RV-12). */
|
|
41
|
+
files: string[];
|
|
42
|
+
acceptance: string[];
|
|
43
|
+
dependsOn: string[];
|
|
44
|
+
/** 0-based phase index assigned by the planner. */
|
|
45
|
+
phase: number;
|
|
46
|
+
/** The DEV identity currently holding the WP; null until first dispatch. */
|
|
47
|
+
assignee: string | null;
|
|
48
|
+
/** REV / TEST identities assigned to the WP (sticky across rework, 5.2). */
|
|
49
|
+
reviewer: string | null;
|
|
50
|
+
tester: string | null;
|
|
51
|
+
status: WpStatus;
|
|
52
|
+
reworkCount: number;
|
|
53
|
+
/** Finding fingerprints from rejected reviews (D8 detection, 5.6). */
|
|
54
|
+
rejections: string[];
|
|
55
|
+
appealUsed: boolean;
|
|
56
|
+
/** Artifact ids per stage, oldest first. */
|
|
57
|
+
submissions: Record<StageKind, string[]>;
|
|
58
|
+
/** L3 `retry` grants consumed (<= GOV_LIMITS.maxReworkGrantsPerWp). */
|
|
59
|
+
reworkGrants: number;
|
|
60
|
+
acceptedWithIssues: boolean;
|
|
61
|
+
blockedAt?: StageKind;
|
|
62
|
+
}
|
|
63
|
+
export interface Contract {
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
producer: string;
|
|
67
|
+
consumers: string[];
|
|
68
|
+
definition: string;
|
|
69
|
+
/** Set when the producer or all consumers were dropped (resolve.disposition=drop). */
|
|
70
|
+
voided?: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface Claim {
|
|
73
|
+
id: string;
|
|
74
|
+
kind: 'missed_by_review' | 'security' | 'false_positive' | 'same_issue' | 'incomplete_impl';
|
|
75
|
+
raisedBy: string;
|
|
76
|
+
against: string;
|
|
77
|
+
wpId: string;
|
|
78
|
+
justification: string;
|
|
79
|
+
status: 'open' | 'upheld' | 'rejected';
|
|
80
|
+
rulingText?: string;
|
|
81
|
+
/** Phase the claim belongs to (settle rules only on its own phase's claims). */
|
|
82
|
+
phase: number;
|
|
83
|
+
}
|
|
84
|
+
export interface EscalationPosition {
|
|
85
|
+
by: string;
|
|
86
|
+
text: string;
|
|
87
|
+
}
|
|
88
|
+
export interface Escalation {
|
|
89
|
+
id: string;
|
|
90
|
+
level: 'L3';
|
|
91
|
+
kind: 'wp_rework_cap' | 'integration_exhausted' | 'dispute';
|
|
92
|
+
wpId?: string;
|
|
93
|
+
phase?: number;
|
|
94
|
+
topic: string;
|
|
95
|
+
positions: EscalationPosition[];
|
|
96
|
+
status: 'open' | 'resolved';
|
|
97
|
+
ruling?: string;
|
|
98
|
+
}
|
|
99
|
+
export interface PhaseState {
|
|
100
|
+
index: number;
|
|
101
|
+
wpIds: string[];
|
|
102
|
+
settled: boolean;
|
|
103
|
+
integrated: boolean;
|
|
104
|
+
integrationAttempts: number;
|
|
105
|
+
fixCycles: number;
|
|
106
|
+
/** resolve.disposition=retry on integration_exhausted (<= 1). */
|
|
107
|
+
extraFixGrants: number;
|
|
108
|
+
/** False when the user accepted a failing integration (disposition accept_failing). */
|
|
109
|
+
integrationAccepted: boolean;
|
|
110
|
+
/** True after the last integrate attempt failed and before a successful one. */
|
|
111
|
+
lastIntegrationFailed: boolean;
|
|
112
|
+
}
|
|
113
|
+
export interface StageState {
|
|
114
|
+
kind: StageKind;
|
|
115
|
+
phase: number;
|
|
116
|
+
wpIds: string[];
|
|
117
|
+
startedAt: number;
|
|
118
|
+
status: 'running' | 'done' | 'aborted' | 'interrupted';
|
|
119
|
+
}
|
|
120
|
+
export interface RunUsage {
|
|
121
|
+
inputTokens: number;
|
|
122
|
+
outputTokens: number;
|
|
123
|
+
costUsd: number | null;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* One run reduced to eight scalars for the `/gov runs` listing (governance-mode-v1-1 7.1).
|
|
127
|
+
* Rides `index.jsonl`; built by `engine/run-digest.ts::buildRunDigest`.
|
|
128
|
+
*/
|
|
129
|
+
export interface RunDigest {
|
|
130
|
+
/** 1-based phase being worked on (the last one once every phase is integrated). */
|
|
131
|
+
phase: number;
|
|
132
|
+
phaseCount: number;
|
|
133
|
+
/** Scored agents that ever existed in this run, respawned ones included. */
|
|
134
|
+
agents: number;
|
|
135
|
+
/** Mean confirmed GT over the active scored agents; `null` before any agent exists. */
|
|
136
|
+
health: number | null;
|
|
137
|
+
/** Team tokens, input + output (the budget's unit). */
|
|
138
|
+
tokens: number;
|
|
139
|
+
/** `null` = pricing unknown. NEVER written as 0 on behalf of an unpriced run. */
|
|
140
|
+
costUsd: number | null;
|
|
141
|
+
/** `gov_dispatch` calls the engine accepted. */
|
|
142
|
+
dispatches: number;
|
|
143
|
+
eliminations: number;
|
|
144
|
+
}
|
|
145
|
+
export interface RunState {
|
|
146
|
+
schemaVersion: number;
|
|
147
|
+
runId: string;
|
|
148
|
+
cwd: string;
|
|
149
|
+
sessionId?: string;
|
|
150
|
+
goal: string;
|
|
151
|
+
profile: ProfileId;
|
|
152
|
+
status: RunStatus;
|
|
153
|
+
createdAt: number;
|
|
154
|
+
updatedAt: number;
|
|
155
|
+
phases: PhaseState[];
|
|
156
|
+
workPackages: Record<string, WorkPackage>;
|
|
157
|
+
/** Stable WP order as given at `start`. */
|
|
158
|
+
wpOrder: string[];
|
|
159
|
+
contracts: Contract[];
|
|
160
|
+
integrationCommands: string[];
|
|
161
|
+
claims: Claim[];
|
|
162
|
+
escalations: Escalation[];
|
|
163
|
+
stage: StageState | null;
|
|
164
|
+
usage: RunUsage;
|
|
165
|
+
/** Dispatches issued (cap: GOV_LIMITS.hardMaxDispatches). */
|
|
166
|
+
dispatches: number;
|
|
167
|
+
/** Monotone event sequence; mirrors the last events.jsonl line. */
|
|
168
|
+
seq: number;
|
|
169
|
+
/** Plan snapshot adopted from PLAN+GOVERN, if any. */
|
|
170
|
+
planSnapshot?: string;
|
|
171
|
+
/** Limits resolved at start (policy keys frozen into the run for reproducibility). */
|
|
172
|
+
limits: {
|
|
173
|
+
maxRework: number;
|
|
174
|
+
maxFixCycles: number;
|
|
175
|
+
budgetTokens: number;
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
export interface LedgerEntry {
|
|
179
|
+
seq: number;
|
|
180
|
+
at: number;
|
|
181
|
+
code: EventCode | 'RESPAWN' | 'ESCROW_RELEASE' | 'CLAWBACK';
|
|
182
|
+
delta: number;
|
|
183
|
+
settlement: Settlement | 'escrow_release' | 'clawback';
|
|
184
|
+
phase: number;
|
|
185
|
+
wpId?: string;
|
|
186
|
+
incidentId?: string;
|
|
187
|
+
by: 'engine' | `inspector:${string}`;
|
|
188
|
+
reason: string;
|
|
189
|
+
evidence?: string;
|
|
190
|
+
/** Set when the single-incident cap clipped the delta. */
|
|
191
|
+
capped?: {
|
|
192
|
+
requested: number;
|
|
193
|
+
applied: number;
|
|
194
|
+
};
|
|
195
|
+
confirmedAfter: number;
|
|
196
|
+
provisionalAfter: number;
|
|
197
|
+
}
|
|
198
|
+
export interface EscrowEntry {
|
|
199
|
+
seq: number;
|
|
200
|
+
at: number;
|
|
201
|
+
phase: number;
|
|
202
|
+
/** `held` when booked, `released` on confirm, `clawed_back` on clawback. */
|
|
203
|
+
action: 'held' | 'released' | 'clawed_back';
|
|
204
|
+
amount: number;
|
|
205
|
+
code?: EventCode;
|
|
206
|
+
reason: string;
|
|
207
|
+
}
|
|
208
|
+
export interface AgentRecord {
|
|
209
|
+
id: string;
|
|
210
|
+
role: ScoredRole;
|
|
211
|
+
generation: number;
|
|
212
|
+
/** KILL uses ONLY this; clamped to >= 0 (I-G3). */
|
|
213
|
+
confirmed: number;
|
|
214
|
+
/** Escrow; counted in the total, never in survival. */
|
|
215
|
+
provisional: number;
|
|
216
|
+
status: 'active' | 'eliminated';
|
|
217
|
+
replacedBy: string | null;
|
|
218
|
+
eliminatedReason?: 'depleted' | 'tail' | 'clawback';
|
|
219
|
+
/** Consecutive phase ends spent as the lowest-ranked member under the tail threshold. */
|
|
220
|
+
tailStrikes: number;
|
|
221
|
+
history: LedgerEntry[];
|
|
222
|
+
escrowHistory: EscrowEntry[];
|
|
223
|
+
}
|
|
224
|
+
export interface LedgerState {
|
|
225
|
+
schemaVersion: number;
|
|
226
|
+
/** Highest event seq folded into this state. */
|
|
227
|
+
seq: number;
|
|
228
|
+
agents: Record<string, AgentRecord>;
|
|
229
|
+
/** Cumulative negative applied per `${agentId}|${incidentId}` (I-G4). */
|
|
230
|
+
incidentNegatives: Record<string, number>;
|
|
231
|
+
/** Failure analyses keyed by eliminated agent id, handed to the successor. */
|
|
232
|
+
failureAnalyses: Record<string, FailureAnalysis>;
|
|
233
|
+
}
|
|
234
|
+
export interface FailureAnalysis {
|
|
235
|
+
agentId: string;
|
|
236
|
+
reason: 'depleted' | 'tail' | 'clawback';
|
|
237
|
+
topPenalties: Array<{
|
|
238
|
+
code: EventCode;
|
|
239
|
+
delta: number;
|
|
240
|
+
reason: string;
|
|
241
|
+
}>;
|
|
242
|
+
/** From a fixed code -> advice table; English, ASCII. */
|
|
243
|
+
avoid: string[];
|
|
244
|
+
}
|
|
245
|
+
export type StandingLabel = 'NORMAL' | 'WARNING' | 'DANGER' | 'KILLED';
|
|
246
|
+
export interface StandingRow {
|
|
247
|
+
id: string;
|
|
248
|
+
role: ScoredRole;
|
|
249
|
+
generation: number;
|
|
250
|
+
confirmed: number;
|
|
251
|
+
provisional: number;
|
|
252
|
+
total: number;
|
|
253
|
+
label: StandingLabel;
|
|
254
|
+
status: 'active' | 'eliminated';
|
|
255
|
+
replacedBy: string | null;
|
|
256
|
+
}
|
|
257
|
+
export interface InterfaceContractCheck {
|
|
258
|
+
interface: string;
|
|
259
|
+
role: 'PRODUCER' | 'CONSUMER';
|
|
260
|
+
verified: 'YES' | 'NOT_APPLICABLE';
|
|
261
|
+
method: string;
|
|
262
|
+
peer: string;
|
|
263
|
+
}
|
|
264
|
+
export interface WorkSubmission {
|
|
265
|
+
kind: 'work';
|
|
266
|
+
id: string;
|
|
267
|
+
identity: string;
|
|
268
|
+
wpId: string;
|
|
269
|
+
phase: number;
|
|
270
|
+
stage: 'dev' | 'fix';
|
|
271
|
+
/** 1-based count of work submissions for this WP. */
|
|
272
|
+
attempt: number;
|
|
273
|
+
at: number;
|
|
274
|
+
summary: string;
|
|
275
|
+
filesChanged: string[];
|
|
276
|
+
interfaceContracts: InterfaceContractCheck[];
|
|
277
|
+
verification: {
|
|
278
|
+
commands: Array<{
|
|
279
|
+
cmd: string;
|
|
280
|
+
result: string;
|
|
281
|
+
note?: string;
|
|
282
|
+
}>;
|
|
283
|
+
};
|
|
284
|
+
appeal?: {
|
|
285
|
+
findingIds: string[];
|
|
286
|
+
argument: string;
|
|
287
|
+
};
|
|
288
|
+
escalate?: boolean;
|
|
289
|
+
}
|
|
290
|
+
export type ReviewVerdict = 'PASS' | 'PASS_WITH_FIXES' | 'NEEDS_REWORK';
|
|
291
|
+
export type FindingSeverity = 'blocker' | 'major' | 'minor' | 'nit';
|
|
292
|
+
export interface ReviewFinding {
|
|
293
|
+
id: string;
|
|
294
|
+
severity: FindingSeverity;
|
|
295
|
+
file: string;
|
|
296
|
+
line?: number;
|
|
297
|
+
issue: string;
|
|
298
|
+
requiredChange: string;
|
|
299
|
+
mustFix?: boolean;
|
|
300
|
+
}
|
|
301
|
+
export interface ReviewChecklistItem {
|
|
302
|
+
status: 'pass' | 'fail' | 'na';
|
|
303
|
+
evidence: string;
|
|
304
|
+
}
|
|
305
|
+
export interface ReviewSubmission {
|
|
306
|
+
kind: 'review';
|
|
307
|
+
id: string;
|
|
308
|
+
identity: string;
|
|
309
|
+
wpId: string;
|
|
310
|
+
phase: number;
|
|
311
|
+
attempt: number;
|
|
312
|
+
at: number;
|
|
313
|
+
verdict: ReviewVerdict;
|
|
314
|
+
checklist: {
|
|
315
|
+
correctness: ReviewChecklistItem;
|
|
316
|
+
quality: ReviewChecklistItem;
|
|
317
|
+
security: ReviewChecklistItem;
|
|
318
|
+
integration: ReviewChecklistItem;
|
|
319
|
+
compliance: ReviewChecklistItem;
|
|
320
|
+
};
|
|
321
|
+
findings: ReviewFinding[];
|
|
322
|
+
fixesApplied: Array<{
|
|
323
|
+
file: string;
|
|
324
|
+
rationale: string;
|
|
325
|
+
}>;
|
|
326
|
+
integrationAssessment: string;
|
|
327
|
+
appealResponses: Array<{
|
|
328
|
+
findingId: string;
|
|
329
|
+
decision: 'uphold' | 'withdraw';
|
|
330
|
+
note?: string;
|
|
331
|
+
}>;
|
|
332
|
+
excellence?: {
|
|
333
|
+
claim: string;
|
|
334
|
+
evidence: string;
|
|
335
|
+
};
|
|
336
|
+
securityFinding?: {
|
|
337
|
+
description: string;
|
|
338
|
+
evidence: string;
|
|
339
|
+
};
|
|
340
|
+
/** Derived by the engine from `findings`; the ONLY feedback surface a DEV sees (D-7). */
|
|
341
|
+
requiredChanges: Array<{
|
|
342
|
+
file: string;
|
|
343
|
+
issue: string;
|
|
344
|
+
change: string;
|
|
345
|
+
}>;
|
|
346
|
+
}
|
|
347
|
+
export type TestVerdict = 'ALL_PASS' | 'ISSUES_FOUND' | 'SPEC_MISMATCH' | 'INCOMPLETE_IMPL';
|
|
348
|
+
export type TraceStatus = 'covered' | 'gap' | 'unverified';
|
|
349
|
+
export interface TestSubmission {
|
|
350
|
+
kind: 'test';
|
|
351
|
+
id: string;
|
|
352
|
+
identity: string;
|
|
353
|
+
wpId: string;
|
|
354
|
+
phase: number;
|
|
355
|
+
attempt: number;
|
|
356
|
+
at: number;
|
|
357
|
+
verdict: TestVerdict;
|
|
358
|
+
traceability: Array<{
|
|
359
|
+
requirement: string;
|
|
360
|
+
evidence: string;
|
|
361
|
+
status: TraceStatus;
|
|
362
|
+
}>;
|
|
363
|
+
commands: Array<{
|
|
364
|
+
cmd: string;
|
|
365
|
+
exit: number;
|
|
366
|
+
summary: string;
|
|
367
|
+
}>;
|
|
368
|
+
issues: Array<{
|
|
369
|
+
severity: FindingSeverity;
|
|
370
|
+
description: string;
|
|
371
|
+
missedByReview?: boolean;
|
|
372
|
+
reviewMissJustification?: string;
|
|
373
|
+
}>;
|
|
374
|
+
boundaryTestsWritten: boolean;
|
|
375
|
+
skeletonRatio?: number;
|
|
376
|
+
skeletonEvidence?: string;
|
|
377
|
+
claims: Array<{
|
|
378
|
+
kind: Claim['kind'];
|
|
379
|
+
justification: string;
|
|
380
|
+
against?: string;
|
|
381
|
+
}>;
|
|
382
|
+
}
|
|
383
|
+
export type Submission = WorkSubmission | ReviewSubmission | TestSubmission;
|
|
384
|
+
/** Inspector settle/integrate summary, persisted as an artifact for the report. */
|
|
385
|
+
export interface InspectorReport {
|
|
386
|
+
kind: 'inspector';
|
|
387
|
+
id: string;
|
|
388
|
+
phase: number;
|
|
389
|
+
stage: 'settle' | 'integrate';
|
|
390
|
+
at: number;
|
|
391
|
+
summary: string;
|
|
392
|
+
contractChecks: Array<{
|
|
393
|
+
contractId: string;
|
|
394
|
+
status: 'ok' | 'mismatch' | 'unverifiable';
|
|
395
|
+
note: string;
|
|
396
|
+
}>;
|
|
397
|
+
integration?: {
|
|
398
|
+
result: 'pass' | 'fail' | 'not_run';
|
|
399
|
+
commands: Array<{
|
|
400
|
+
cmd: string;
|
|
401
|
+
exit: number;
|
|
402
|
+
summary: string;
|
|
403
|
+
}>;
|
|
404
|
+
};
|
|
405
|
+
rca?: RcaInput;
|
|
406
|
+
escalations: Array<{
|
|
407
|
+
kind: Escalation['kind'];
|
|
408
|
+
wpId?: string;
|
|
409
|
+
topic: string;
|
|
410
|
+
positions: EscalationPosition[];
|
|
411
|
+
}>;
|
|
412
|
+
}
|
|
413
|
+
export interface RcaInput {
|
|
414
|
+
failingChecks: Array<{
|
|
415
|
+
name: string;
|
|
416
|
+
files: string[];
|
|
417
|
+
}>;
|
|
418
|
+
/** Cross-module? false => an individual bug, not an integration failure. */
|
|
419
|
+
boundary: boolean;
|
|
420
|
+
attributions: Array<{
|
|
421
|
+
agentId: string;
|
|
422
|
+
level: 'primary' | 'contributing' | 'oversight';
|
|
423
|
+
contract: 'producer' | 'consumer_unverified' | 'none';
|
|
424
|
+
miss?: 'review_integration' | 'test_defect' | 'test_boundary';
|
|
425
|
+
note: string;
|
|
426
|
+
}>;
|
|
427
|
+
/** Cannot isolate to one agent => C4. */
|
|
428
|
+
systemic: boolean;
|
|
429
|
+
}
|
|
430
|
+
export type StoredEventType = 'run_started' | 'stage_started' | 'submission' | 'ledger' | 'claim' | 'ruling' | 'escrow' | 'eliminated' | 'respawned' | 'view_granted' | 'view_denied' | 'ownership_violation' | 'escalation' | 'resolution' | 'budget' | 'stage_ended' | 'run_paused' | 'run_resumed' | 'run_closed' | 'compacted';
|
|
431
|
+
export interface StoredEvent {
|
|
432
|
+
seq: number;
|
|
433
|
+
at: number;
|
|
434
|
+
type: StoredEventType;
|
|
435
|
+
actor: string;
|
|
436
|
+
payload: Record<string, unknown>;
|
|
437
|
+
}
|
|
438
|
+
export type GovAgentState = 'queued' | 'working' | 'submitted' | 'idle' | 'failed' | 'eliminated';
|
|
439
|
+
export interface RosterRow {
|
|
440
|
+
id: string;
|
|
441
|
+
role: GovRole;
|
|
442
|
+
generation: number;
|
|
443
|
+
state: GovAgentState;
|
|
444
|
+
wpId: string | null;
|
|
445
|
+
/** Live activity text from the team stream (already sanitized); '' when none. */
|
|
446
|
+
activity: string;
|
|
447
|
+
/** null for the inspector (not scored). */
|
|
448
|
+
confirmed: number | null;
|
|
449
|
+
provisional: number;
|
|
450
|
+
label: StandingLabel | 'NOT_SCORED';
|
|
451
|
+
/** Last delta and when it landed, for the 4 s emphasis window (10.3). */
|
|
452
|
+
lastDelta: {
|
|
453
|
+
delta: number;
|
|
454
|
+
code: string;
|
|
455
|
+
at: number;
|
|
456
|
+
provisional: boolean;
|
|
457
|
+
} | null;
|
|
458
|
+
replacedBy: string | null;
|
|
459
|
+
}
|
|
460
|
+
export type PipelineStepKey = 'intake' | StageKind;
|
|
461
|
+
export interface PipelineStep {
|
|
462
|
+
key: PipelineStepKey;
|
|
463
|
+
state: 'done' | 'active' | 'pending';
|
|
464
|
+
}
|
|
465
|
+
export interface LedgerTickerRow {
|
|
466
|
+
at: number;
|
|
467
|
+
agentId: string;
|
|
468
|
+
code: string;
|
|
469
|
+
delta: number;
|
|
470
|
+
provisional: boolean;
|
|
471
|
+
reason: string;
|
|
472
|
+
}
|
|
473
|
+
export interface GovernanceSnapshot {
|
|
474
|
+
runId: string;
|
|
475
|
+
goal: string;
|
|
476
|
+
status: RunStatus;
|
|
477
|
+
/** 1-based phase number for display. */
|
|
478
|
+
phase: number;
|
|
479
|
+
phaseCount: number;
|
|
480
|
+
stage: StageKind | null;
|
|
481
|
+
stageRunning: boolean;
|
|
482
|
+
startedAt: number;
|
|
483
|
+
pipeline: PipelineStep[];
|
|
484
|
+
roster: RosterRow[];
|
|
485
|
+
/** Mean `confirmed` over active scored agents; null before any agent exists. */
|
|
486
|
+
health: number | null;
|
|
487
|
+
recent: LedgerTickerRow[];
|
|
488
|
+
usage: RunUsage;
|
|
489
|
+
budgetTokens: number;
|
|
490
|
+
alerts: string[];
|
|
491
|
+
reworkNote: string | null;
|
|
492
|
+
/**
|
|
493
|
+
* A cooperative `/gov pause` is waiting for the running stage to finish
|
|
494
|
+
* (governance-mode-v1-1 6.4). Optional so older fixtures read it as `false`.
|
|
495
|
+
*/
|
|
496
|
+
pauseRequested?: boolean;
|
|
497
|
+
/** Monotone; lets reducers drop stale snapshots. */
|
|
498
|
+
rev: number;
|
|
499
|
+
}
|
|
500
|
+
export type GovernanceEvent = {
|
|
501
|
+
type: 'run_started';
|
|
502
|
+
snapshot: GovernanceSnapshot;
|
|
503
|
+
card: GovernanceCardData | null;
|
|
504
|
+
} | {
|
|
505
|
+
type: 'stage_started';
|
|
506
|
+
snapshot: GovernanceSnapshot;
|
|
507
|
+
} | {
|
|
508
|
+
type: 'agent_state';
|
|
509
|
+
snapshot: GovernanceSnapshot;
|
|
510
|
+
} | {
|
|
511
|
+
type: 'submission';
|
|
512
|
+
snapshot: GovernanceSnapshot;
|
|
513
|
+
identity: string;
|
|
514
|
+
wpId: string;
|
|
515
|
+
kind: Submission['kind'];
|
|
516
|
+
} | {
|
|
517
|
+
type: 'ledger';
|
|
518
|
+
snapshot: GovernanceSnapshot;
|
|
519
|
+
} | {
|
|
520
|
+
type: 'stage_ended';
|
|
521
|
+
snapshot: GovernanceSnapshot;
|
|
522
|
+
card: GovernanceCardData | null;
|
|
523
|
+
} | {
|
|
524
|
+
type: 'escrow';
|
|
525
|
+
snapshot: GovernanceSnapshot;
|
|
526
|
+
phase: number;
|
|
527
|
+
released: boolean;
|
|
528
|
+
} | {
|
|
529
|
+
type: 'eliminated';
|
|
530
|
+
snapshot: GovernanceSnapshot;
|
|
531
|
+
agentId: string;
|
|
532
|
+
reason: FailureAnalysis['reason'];
|
|
533
|
+
} | {
|
|
534
|
+
type: 'respawned';
|
|
535
|
+
snapshot: GovernanceSnapshot;
|
|
536
|
+
agentId: string;
|
|
537
|
+
predecessor: string;
|
|
538
|
+
} | {
|
|
539
|
+
type: 'escalation';
|
|
540
|
+
snapshot: GovernanceSnapshot;
|
|
541
|
+
escalation: Escalation;
|
|
542
|
+
card: GovernanceCardData;
|
|
543
|
+
} | {
|
|
544
|
+
type: 'budget';
|
|
545
|
+
snapshot: GovernanceSnapshot;
|
|
546
|
+
fraction: number;
|
|
547
|
+
} | {
|
|
548
|
+
type: 'run_paused';
|
|
549
|
+
snapshot: GovernanceSnapshot;
|
|
550
|
+
reason: string;
|
|
551
|
+
} | {
|
|
552
|
+
type: 'run_resumed';
|
|
553
|
+
snapshot: GovernanceSnapshot;
|
|
554
|
+
} | {
|
|
555
|
+
type: 'run_closed';
|
|
556
|
+
snapshot: GovernanceSnapshot;
|
|
557
|
+
card: GovernanceCardData;
|
|
558
|
+
};
|
|
559
|
+
export type GovernanceEventListener = (event: GovernanceEvent) => void;
|
|
560
|
+
/**
|
|
561
|
+
* Transcript card payload (`Entry.kind === 'governance'`). PURE DATA: no functions, no
|
|
562
|
+
* Dates, no class instances - it is persisted with `entries` (10.4).
|
|
563
|
+
*/
|
|
564
|
+
export interface GovernanceCardRow {
|
|
565
|
+
id: string;
|
|
566
|
+
role: GovRole;
|
|
567
|
+
confirmed: number | null;
|
|
568
|
+
/** Compact per-row delta text, e.g. `+15P->C D1 +10 D12`. ASCII. */
|
|
569
|
+
deltaText: string;
|
|
570
|
+
}
|
|
571
|
+
export interface GovernanceCardData {
|
|
572
|
+
/** charter = run start; phase = settle+integrate; escalation; final = close. */
|
|
573
|
+
variant: 'charter' | 'phase' | 'escalation' | 'final';
|
|
574
|
+
runId: string;
|
|
575
|
+
title: string;
|
|
576
|
+
/** One line status under the title, e.g. `integration passed (attempt 1)`. */
|
|
577
|
+
headline: string;
|
|
578
|
+
tone: 'ok' | 'warn' | 'error' | 'info';
|
|
579
|
+
rows: GovernanceCardRow[];
|
|
580
|
+
notes: string[];
|
|
581
|
+
}
|
|
582
|
+
export interface GovernanceSpecExt {
|
|
583
|
+
role: GovRole;
|
|
584
|
+
identity: string;
|
|
585
|
+
runId: string;
|
|
586
|
+
/** 1-based phase number. */
|
|
587
|
+
phase: number;
|
|
588
|
+
stage: StageKind;
|
|
589
|
+
/** WP ids this child is responsible for (one for DEV/FIX, several for REV/TEST). */
|
|
590
|
+
wpIds: string[];
|
|
591
|
+
tokens: number;
|
|
592
|
+
generation: number;
|
|
593
|
+
predecessorAnalysis?: FailureAnalysis;
|
|
594
|
+
profile: ProfileId;
|
|
595
|
+
/**
|
|
596
|
+
* The integration commands registered for the run. Carried on the INSPECTOR's spec only:
|
|
597
|
+
* the host reads it to build that child's restricted `bash` (7.4).
|
|
598
|
+
*/
|
|
599
|
+
integrationCommands?: string[];
|
|
600
|
+
}
|
|
601
|
+
export interface WorkPackageInput {
|
|
602
|
+
id: string;
|
|
603
|
+
title: string;
|
|
604
|
+
goal: string;
|
|
605
|
+
files: string[];
|
|
606
|
+
acceptance: string[];
|
|
607
|
+
dependsOn?: string[];
|
|
608
|
+
}
|
|
609
|
+
export interface ContractInput {
|
|
610
|
+
id: string;
|
|
611
|
+
name: string;
|
|
612
|
+
producer: string;
|
|
613
|
+
consumers: string[];
|
|
614
|
+
definition: string;
|
|
615
|
+
}
|
|
616
|
+
export interface StartInput {
|
|
617
|
+
goal: string;
|
|
618
|
+
spec: string;
|
|
619
|
+
profile?: ProfileId;
|
|
620
|
+
workPackages: WorkPackageInput[];
|
|
621
|
+
contracts?: ContractInput[];
|
|
622
|
+
integrationCommands?: string[];
|
|
623
|
+
}
|
|
624
|
+
export interface DispatchInput {
|
|
625
|
+
stage: StageKind;
|
|
626
|
+
wps?: string[];
|
|
627
|
+
notes?: Record<string, string>;
|
|
628
|
+
}
|
|
629
|
+
export type ResolveDisposition = 'retry' | 'accept_as_is' | 'drop' | 'accept_failing';
|
|
630
|
+
export interface ResolveInput {
|
|
631
|
+
escalationId: string;
|
|
632
|
+
ruling: string;
|
|
633
|
+
favor?: string;
|
|
634
|
+
disposition?: ResolveDisposition;
|
|
635
|
+
}
|
|
636
|
+
export interface GovernanceEngineApi {
|
|
637
|
+
start(input: unknown, signal?: AbortSignal): Promise<ToolText>;
|
|
638
|
+
status(): ToolText;
|
|
639
|
+
resume(runId?: string): Promise<ToolText>;
|
|
640
|
+
dispatchStage(input: unknown, signal?: AbortSignal): Promise<ToolText>;
|
|
641
|
+
close(summary?: string): Promise<ToolText>;
|
|
642
|
+
abandon(reason: string): Promise<ToolText>;
|
|
643
|
+
resolve(input: unknown): Promise<ToolText>;
|
|
644
|
+
snapshot(): GovernanceSnapshot | null;
|
|
645
|
+
isStageRunning(): boolean;
|
|
646
|
+
abortStage(): void;
|
|
647
|
+
subscribe(listener: GovernanceEventListener): () => void;
|
|
648
|
+
dispose(): void;
|
|
649
|
+
submitWork(identity: Identity, input: unknown): ToolText;
|
|
650
|
+
submitReview(identity: Identity, input: unknown): ToolText;
|
|
651
|
+
submitTest(identity: Identity, input: unknown): ToolText;
|
|
652
|
+
inspectorApply(input: unknown): ToolText;
|
|
653
|
+
inspectorRule(input: unknown): ToolText;
|
|
654
|
+
inspectorSettle(input: unknown): ToolText;
|
|
655
|
+
standings(): ToolText;
|
|
656
|
+
readArtifact(identity: Identity, input: unknown): ToolText;
|
|
657
|
+
requestView(identity: Identity, input: unknown): ToolText;
|
|
658
|
+
scan(identity: Identity, input: unknown): ToolText | Promise<ToolText>;
|
|
659
|
+
}
|
|
660
|
+
/** Aggregated usage helper type, re-exported for the engine's budget module. */
|
|
661
|
+
export type { TokenUsage };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared shapes for the governance subsystem (governance-mode sections 5, 8, 12, 14).
|
|
3
|
+
*
|
|
4
|
+
* ASCII ONLY (`governance/` is glyph-scanned). Pure types plus a handful of tiny
|
|
5
|
+
* constants: no I/O, no React, no `node:*`.
|
|
6
|
+
*
|
|
7
|
+
* THE CONTRACT BETWEEN MODULES. `rules/` (ledger, settlement, rca, elimination),
|
|
8
|
+
* `store/` (run store), `engine/` (planner, state machine, visibility, spec builder,
|
|
9
|
+
* engine), `tools/` (what the model calls), `agent/governance-wiring.ts` and the UI all
|
|
10
|
+
* import from here and nowhere else for shapes, so a field added here is seen by every
|
|
11
|
+
* layer at compile time. `GovernanceEvent` is a CLI-LOCAL stream (D-19): it must never
|
|
12
|
+
* be folded into core's `AgentEvent` (`public-api.test.ts` freezes that union).
|
|
13
|
+
*/
|
|
14
|
+
export const STAGE_KINDS = [
|
|
15
|
+
'dev',
|
|
16
|
+
'review',
|
|
17
|
+
'test',
|
|
18
|
+
'settle',
|
|
19
|
+
'integrate',
|
|
20
|
+
'fix',
|
|
21
|
+
];
|
|
22
|
+
export const PROFILE_IDS = [
|
|
23
|
+
'general',
|
|
24
|
+
'ml',
|
|
25
|
+
'product',
|
|
26
|
+
'api-security',
|
|
27
|
+
];
|