@aragon-agent/cli 0.6.44 → 0.6.46
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 +120 -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/invocation-card.d.ts +77 -0
- package/dist/agent/invocation-card.js +169 -0
- package/dist/agent/plan-prompt.d.ts +7 -0
- package/dist/agent/plan-prompt.js +2 -1
- package/dist/agent/prompt-options.d.ts +6 -0
- package/dist/agent/queued-messages.d.ts +3 -0
- package/dist/agent/queued-messages.js +4 -1
- package/dist/agent/reducer.d.ts +38 -1
- package/dist/agent/reducer.js +57 -12
- 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 +22 -4
- package/dist/commands/governance-command.d.ts +35 -0
- package/dist/commands/governance-command.js +304 -0
- package/dist/commands/governance-runs-table.d.ts +40 -0
- package/dist/commands/governance-runs-table.js +130 -0
- package/dist/commands/index-build.d.ts +8 -0
- package/dist/commands/index-build.js +11 -0
- package/dist/commands/registry.d.ts +35 -0
- package/dist/commands/registry.js +20 -7
- package/dist/commands/skills.js +36 -2
- package/dist/commands/subagent-command.js +3 -1
- package/dist/commands/team-command.d.ts +6 -0
- package/dist/commands/team-command.js +40 -3
- 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/persist.js +10 -0
- package/dist/session/validate-session.js +36 -3
- package/dist/team/forced-mode.d.ts +19 -0
- package/dist/team/forced-mode.js +42 -20
- 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 +170 -31
- 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 +7 -1
- package/dist/ui/entries/GovernanceCard.d.ts +30 -0
- package/dist/ui/entries/GovernanceCard.js +32 -0
- package/dist/ui/entries/InvocationCard.d.ts +20 -0
- package/dist/ui/entries/InvocationCard.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/invocation-card.d.ts +41 -0
- package/dist/ui/layout/invocation-card.js +91 -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 +22 -1
- 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 +13 -1
- package/dist/ui/use-wheel-routing.js +3 -1
- package/package.json +2 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from 'ink';
|
|
3
|
+
import { toneColor } from './governance-status.js';
|
|
4
|
+
/** The segments as nested `Text`; the CALLER owns wrapping and truncation. */
|
|
5
|
+
export function GovernanceRun({ segments, theme }) {
|
|
6
|
+
return (_jsx(_Fragment, { children: segments.map((part, index) => (_jsx(Text, { color: toneColor(part.tone, theme), ...(part.bold ? { bold: true } : {}), children: part.text }, index))) }));
|
|
7
|
+
}
|
|
8
|
+
/** One display row: the run inside a `wrap="truncate"` `Text`, so it can never wrap. */
|
|
9
|
+
export function GovernanceLine({ segments, theme }) {
|
|
10
|
+
return (_jsx(Text, { wrap: "truncate", children: _jsx(GovernanceRun, { segments: segments, theme: theme }) }));
|
|
11
|
+
}
|
package/dist/ui/StatusBar.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import type { TermCapabilities } from './capabilities.js';
|
|
|
5
5
|
import type { UsageTotal } from '../agent/reducer.js';
|
|
6
6
|
import type { ContextUsageSnapshot } from '../compaction/types.js';
|
|
7
7
|
import type { AgentMode } from '../agent/agent-mode.js';
|
|
8
|
+
import type { GovernanceSnapshot } from '../governance/types.js';
|
|
9
|
+
import type { Posture } from '../governance/posture.js';
|
|
8
10
|
import type { PendingSteering } from '../agent/queued-messages.js';
|
|
9
11
|
import { type RunPhase } from './layout/status-layout.js';
|
|
10
12
|
import type { EscapeAction, StatusFeedback } from './status-feedback.js';
|
|
@@ -63,8 +65,19 @@ export interface StatusBarProps {
|
|
|
63
65
|
modified: boolean;
|
|
64
66
|
otherNames: readonly string[];
|
|
65
67
|
} | null;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
/**
|
|
69
|
+
* The mode word's source. A `Posture` is also accepted (governance-mode 10.2): its
|
|
70
|
+
* governed members render as `GOVERN` / `PLAN+GOVERN` in the governance hue, and
|
|
71
|
+
* `build` / `plan` render exactly as the `AgentMode` of the same name always did.
|
|
72
|
+
*/
|
|
73
|
+
agentMode?: AgentMode | Posture;
|
|
74
|
+
pendingAgentMode?: AgentMode | Posture | null;
|
|
75
|
+
/**
|
|
76
|
+
* The live governed-run snapshot, or absent. Drives the governance chip
|
|
77
|
+
* (`GOV p2/3 REVIEW`); absent plans a hidden chip, which keeps this row byte-identical
|
|
78
|
+
* to the pre-governance build.
|
|
79
|
+
*/
|
|
80
|
+
governance?: GovernanceSnapshot | null;
|
|
68
81
|
/**
|
|
69
82
|
* Forced team mode is armed, with the count it was armed with
|
|
70
83
|
* (team-command-forced-dispatch §3.8 / D-9). ABSENT = not armed, and every
|
package/dist/ui/StatusBar.js
CHANGED
|
@@ -3,10 +3,12 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Box, Text } from 'ink';
|
|
5
5
|
import { pickGlyphs } from './glyphs.js';
|
|
6
|
+
import { planGovernanceChip } from './layout/governance-chip.js';
|
|
6
7
|
import { liveSpinner } from './ActivityLine.js';
|
|
7
8
|
import { planPrimaryStatusFields } from './layout/status-layout.js';
|
|
8
9
|
import { planSessionChip } from './layout/session-chip.js';
|
|
9
10
|
import { planKitChip } from './layout/kit-chip.js';
|
|
11
|
+
import { toneColor } from './governance-status.js';
|
|
10
12
|
/** An invisible leading byte change forces Ink to repaint on Ctrl+L. */
|
|
11
13
|
const redrawChar = (nonce) => nonce % 2 ? String.fromCharCode(0x00a0) : ' ';
|
|
12
14
|
export function StatusBar(props) {
|
|
@@ -28,8 +30,12 @@ export function StatusBar(props) {
|
|
|
28
30
|
// byte-identical to the build before the feature (I-9).
|
|
29
31
|
const kit = planKitChip({ columns: cols - chipCells, kit: props.kit });
|
|
30
32
|
const kitCells = kit.visible ? kit.cells + kit.gap : 0;
|
|
33
|
+
// THE GOVERNANCE CHIP IS PLANNED THIRD, out of what the other two left, by the same
|
|
34
|
+
// comparison (the left half keeps its 34-cell floor). Hidden without a live run.
|
|
35
|
+
const govern = planGovernanceChip({ columns: cols - chipCells - kitCells, snapshot: props.governance });
|
|
36
|
+
const governCells = govern.visible ? govern.cells + govern.gap : 0;
|
|
31
37
|
const plan = planPrimaryStatusFields({
|
|
32
|
-
reserveRight: chipCells + kitCells,
|
|
38
|
+
reserveRight: chipCells + kitCells + governCells,
|
|
33
39
|
columns: cols, phase, pendingCount: props.pendingSteering?.length ?? 0,
|
|
34
40
|
context: props.context, usageTotal: props.usageTotal,
|
|
35
41
|
thinkingLevel: props.thinkingLevel, elapsedMs: props.elapsedMs, tokPerSec: props.tokPerSec,
|
|
@@ -48,8 +54,8 @@ export function StatusBar(props) {
|
|
|
48
54
|
});
|
|
49
55
|
const tones = { normal: props.theme.primary, muted: props.theme.muted,
|
|
50
56
|
warning: props.theme.noticeWarn, error: props.theme.noticeError,
|
|
51
|
-
accent: props.theme.accent };
|
|
52
|
-
return _jsxs(Box, { width: cols, height: 1, flexShrink: 0, flexDirection: "row", overflow: "hidden", children: [_jsx(Box, { width: 1, flexShrink: 0, children: _jsx(Text, { children: redrawChar(props.redrawNonce ?? 0) }) }), _jsx(Box, { width: Math.max(0, cols - 1 - chipCells - kitCells), flexShrink: 0, flexDirection: "row", overflow: "hidden", children: plan.fields.map((item, index) => _jsxs(React.Fragment, { children: [index > 0 && _jsx(Box, { width: plan.separatorCells, flexShrink: 0, children: _jsx(Text, { color: props.theme.muted, children: plan.separator }) }), _jsx(Box, { width: item.cells, flexShrink: 0, children: _jsx(Text, { color: tones[item.tone], wrap: "truncate", children: item.id === 'phase' && active
|
|
57
|
+
accent: props.theme.accent, govern: props.theme.governAccent };
|
|
58
|
+
return _jsxs(Box, { width: cols, height: 1, flexShrink: 0, flexDirection: "row", overflow: "hidden", children: [_jsx(Box, { width: 1, flexShrink: 0, children: _jsx(Text, { children: redrawChar(props.redrawNonce ?? 0) }) }), _jsx(Box, { width: Math.max(0, cols - 1 - chipCells - kitCells - governCells), flexShrink: 0, flexDirection: "row", overflow: "hidden", children: plan.fields.map((item, index) => _jsxs(React.Fragment, { children: [index > 0 && _jsx(Box, { width: plan.separatorCells, flexShrink: 0, children: _jsx(Text, { color: props.theme.muted, children: plan.separator }) }), _jsx(Box, { width: item.cells, flexShrink: 0, children: _jsx(Text, { color: tones[item.tone], wrap: "truncate", children: item.id === 'phase' && active
|
|
53
59
|
? _jsxs(_Fragment, { children: [spinner ?? glyph, item.text.slice(glyph.length)] })
|
|
54
|
-
: item.text }) })] }, item.id)) }), kit.visible && _jsx(Box, { width: kitCells, flexShrink: 0, justifyContent: "flex-end", overflow: "hidden", children: _jsx(Text, { color: props.theme.muted, wrap: "truncate", children: kit.text }) }), chip.visible && _jsx(Box, { width: chipCells, flexShrink: 0, justifyContent: "flex-end", overflow: "hidden", children: _jsx(Text, { color: props.theme.muted, wrap: "truncate", children: chip.text }) })] });
|
|
60
|
+
: item.text }) })] }, item.id)) }), govern.visible && _jsx(Box, { width: governCells, flexShrink: 0, justifyContent: "flex-end", overflow: "hidden", children: _jsx(Text, { color: toneColor(govern.tone, props.theme), wrap: "truncate", bold: true, children: govern.text }) }), kit.visible && _jsx(Box, { width: kitCells, flexShrink: 0, justifyContent: "flex-end", overflow: "hidden", children: _jsx(Text, { color: props.theme.muted, wrap: "truncate", children: kit.text }) }), chip.visible && _jsx(Box, { width: chipCells, flexShrink: 0, justifyContent: "flex-end", overflow: "hidden", children: _jsx(Text, { color: props.theme.muted, wrap: "truncate", children: chip.text }) })] });
|
|
55
61
|
}
|
package/dist/ui/Transcript.js
CHANGED
|
@@ -8,10 +8,12 @@ import { pickGlyphs, toolGlyph } from './glyphs.js';
|
|
|
8
8
|
import { separationRows } from './density.js';
|
|
9
9
|
import { EntryFrame } from './entries/EntryFrame.js';
|
|
10
10
|
import { UserEntry } from './entries/UserEntry.js';
|
|
11
|
+
import { InvocationCard } from './entries/InvocationCard.js';
|
|
11
12
|
import { QueuedEntry } from './entries/QueuedEntry.js';
|
|
12
13
|
import { AssistantEntry } from './entries/AssistantEntry.js';
|
|
13
14
|
import { ToolCard, statusColor, toolEntryGlyph } from './entries/ToolCard.js';
|
|
14
15
|
import { TeamCard, teamCardColor } from './entries/TeamCard.js';
|
|
16
|
+
import { GovernanceCard, governanceCardColor } from './entries/GovernanceCard.js';
|
|
15
17
|
import { isLiveTeamCard, rosterCounts } from './team-status.js';
|
|
16
18
|
import { TodoCard, todoCardColor } from './entries/TodoCard.js';
|
|
17
19
|
import { RetryCard, retryCardColor } from './entries/RetryCard.js';
|
|
@@ -77,7 +79,9 @@ function EntryViewImpl({ entry, prev, expanded, thinkingVisible, reducedMotion,
|
|
|
77
79
|
const frame = (glyph, color, children) => (_jsx(EntryFrame, { glyph: glyph, color: color, continuation: glyphs.railVertical, separation: separation, spacerColor: theme.border, children: children }));
|
|
78
80
|
switch (entry.kind) {
|
|
79
81
|
case 'user':
|
|
80
|
-
return frame(glyphs.user, theme.user,
|
|
82
|
+
return frame(glyphs.user, theme.user, entry.invocation
|
|
83
|
+
? _jsx(InvocationCard, { card: entry.invocation, theme: theme, caps: caps })
|
|
84
|
+
: _jsx(UserEntry, { text: entry.text, theme: theme, caps: caps }));
|
|
81
85
|
case 'queued':
|
|
82
86
|
// `theme.muted`: quieter than a user message, louder than a notice --
|
|
83
87
|
// the row exists to be noticed UNTIL it is accepted, then rewritten in
|
|
@@ -118,6 +122,8 @@ function EntryViewImpl({ entry, prev, expanded, thinkingVisible, reducedMotion,
|
|
|
118
122
|
return null;
|
|
119
123
|
return frame(glyphs.teamAgent, teamCardColor(rosterCounts(entry.runs), entry.active, entry.aborted, theme), _jsx(TeamCard, { requested: entry.requested, runs: entry.runs, aborted: entry.aborted, durationMs: entry.durationMs, active: entry.active, expanded: expanded, reducedMotion: reducedMotion, theme: theme, caps: caps, nowSec: nowSecFor(entry, nowSec) }));
|
|
120
124
|
}
|
|
125
|
+
case 'governance':
|
|
126
|
+
return frame(glyphs.teamAgent, governanceCardColor(entry.card, theme), _jsx(GovernanceCard, { card: entry.card, theme: theme, caps: caps }));
|
|
121
127
|
case 'todo':
|
|
122
128
|
return frame(toolGlyph(glyphs, 'todo_write'), todoCardColor(entry.doneCount, entry.total, entry.live, theme), _jsx(TodoCard, { items: entry.items, doneCount: entry.doneCount, total: entry.total, acceptance: entry.acceptance ?? null, live: entry.live, interrupted: entry.interrupted, theme: theme, caps: caps }));
|
|
123
129
|
case 'retry':
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GovernanceCard - the settlement card for a `kind: 'governance'` entry
|
|
3
|
+
* (governance-mode section 10.4).
|
|
4
|
+
*
|
|
5
|
+
* ASCII ONLY: every glyph comes from `pickGlyphs`, through the layout.
|
|
6
|
+
*
|
|
7
|
+
* It renders inside the `EntryFrame` that `Transcript.tsx` supplies, so the left rail is
|
|
8
|
+
* the card's frame - no second box drawn inside the rail. (The spec sketches a
|
|
9
|
+
* rounded box; nested inside the gutter rail it would be two frames for one thing, and the
|
|
10
|
+
* rail already carries the tone colour. Recorded as a deliberate deviation.)
|
|
11
|
+
*
|
|
12
|
+
* EVERY LINE TRUNCATES, none wraps, so the card's height is a function of its data alone
|
|
13
|
+
* (`governanceCardRows`) and `virtual-window.ts::estimateEntryRows` is exact rather than an
|
|
14
|
+
* upper bound. A narrow terminal therefore degrades by truncation to one plain line per
|
|
15
|
+
* agent without any width-dependent branch here.
|
|
16
|
+
*/
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import type { GovernanceCardData } from '../../governance/types.js';
|
|
19
|
+
import type { Theme } from '../theme.js';
|
|
20
|
+
import type { TermCapabilities } from '../capabilities.js';
|
|
21
|
+
export interface GovernanceCardProps {
|
|
22
|
+
card: GovernanceCardData;
|
|
23
|
+
theme: Theme;
|
|
24
|
+
caps: TermCapabilities;
|
|
25
|
+
}
|
|
26
|
+
/** The rail colour: the card's verdict, resolved like every other governance tone. */
|
|
27
|
+
export declare function governanceCardColor(card: GovernanceCardData, theme: Theme): string | undefined;
|
|
28
|
+
declare function GovernanceCardImpl({ card, theme, caps }: GovernanceCardProps): React.ReactElement;
|
|
29
|
+
export declare const GovernanceCard: React.MemoExoticComponent<typeof GovernanceCardImpl>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* GovernanceCard - the settlement card for a `kind: 'governance'` entry
|
|
4
|
+
* (governance-mode section 10.4).
|
|
5
|
+
*
|
|
6
|
+
* ASCII ONLY: every glyph comes from `pickGlyphs`, through the layout.
|
|
7
|
+
*
|
|
8
|
+
* It renders inside the `EntryFrame` that `Transcript.tsx` supplies, so the left rail is
|
|
9
|
+
* the card's frame - no second box drawn inside the rail. (The spec sketches a
|
|
10
|
+
* rounded box; nested inside the gutter rail it would be two frames for one thing, and the
|
|
11
|
+
* rail already carries the tone colour. Recorded as a deliberate deviation.)
|
|
12
|
+
*
|
|
13
|
+
* EVERY LINE TRUNCATES, none wraps, so the card's height is a function of its data alone
|
|
14
|
+
* (`governanceCardRows`) and `virtual-window.ts::estimateEntryRows` is exact rather than an
|
|
15
|
+
* upper bound. A narrow terminal therefore degrades by truncation to one plain line per
|
|
16
|
+
* agent without any width-dependent branch here.
|
|
17
|
+
*/
|
|
18
|
+
import React from 'react';
|
|
19
|
+
import { Box, Text } from 'ink';
|
|
20
|
+
import { pickGlyphs } from '../glyphs.js';
|
|
21
|
+
import { toneColor } from '../governance-status.js';
|
|
22
|
+
import { GovernanceLine, GovernanceRun } from '../GovernanceRun.js';
|
|
23
|
+
import { buildGovernanceCardLayout, cardTone } from '../layout/governance-card.js';
|
|
24
|
+
/** The rail colour: the card's verdict, resolved like every other governance tone. */
|
|
25
|
+
export function governanceCardColor(card, theme) {
|
|
26
|
+
return toneColor(cardTone(card), theme);
|
|
27
|
+
}
|
|
28
|
+
function GovernanceCardImpl({ card, theme, caps }) {
|
|
29
|
+
const layout = buildGovernanceCardLayout(card, pickGlyphs(caps));
|
|
30
|
+
return (_jsxs(Box, { flexDirection: "column", flexShrink: 0, children: [_jsx(GovernanceLine, { segments: layout.title, theme: theme }), layout.headline && (_jsx(GovernanceLine, { segments: layout.headline, theme: theme })), layout.tableHeader && (_jsx(Text, { wrap: "truncate", children: layout.tableHeader.map((cell, index) => (_jsx(GovernanceRun, { segments: cell, theme: theme }, index))) })), layout.rows.map((row) => (_jsx(Text, { wrap: "truncate", children: row.cells.map((cell, index) => (_jsx(GovernanceRun, { segments: cell, theme: theme }, index))) }, row.key))), layout.notes && _jsx(GovernanceLine, { segments: layout.notes, theme: theme })] }));
|
|
31
|
+
}
|
|
32
|
+
export const GovernanceCard = React.memo(GovernanceCardImpl);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render a `user` entry that carries an invocation card (tui-invocation-cards).
|
|
3
|
+
*
|
|
4
|
+
* Like `UserEntry`, this renders CONTENT only: the role glyph, rail and spacing belong
|
|
5
|
+
* to `EntryFrame`, so the card stays "the user's turn" for density, turn counting and
|
|
6
|
+
* the settled boundary. The header text comes from `invocationHeaderSegments` and is
|
|
7
|
+
* never assembled here (RV-10); the row count it implies is `invocationCardRows`.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import type { Theme } from '../theme.js';
|
|
11
|
+
import type { TermCapabilities } from '../capabilities.js';
|
|
12
|
+
import type { InvocationCard as InvocationCardData } from '../../agent/invocation-card.js';
|
|
13
|
+
declare function InvocationCardImpl({ card, theme, caps, }: {
|
|
14
|
+
card: InvocationCardData;
|
|
15
|
+
theme: Theme;
|
|
16
|
+
caps: TermCapabilities;
|
|
17
|
+
}): React.ReactElement;
|
|
18
|
+
/** Default comparator: `mapEntry` preserves identity for untouched entries (L2 / R3). */
|
|
19
|
+
export declare const InvocationCard: React.MemoExoticComponent<typeof InvocationCardImpl>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Render a `user` entry that carries an invocation card (tui-invocation-cards).
|
|
4
|
+
*
|
|
5
|
+
* Like `UserEntry`, this renders CONTENT only: the role glyph, rail and spacing belong
|
|
6
|
+
* to `EntryFrame`, so the card stays "the user's turn" for density, turn counting and
|
|
7
|
+
* the settled boundary. The header text comes from `invocationHeaderSegments` and is
|
|
8
|
+
* never assembled here (RV-10); the row count it implies is `invocationCardRows`.
|
|
9
|
+
*/
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { Box, Text } from 'ink';
|
|
12
|
+
import { pickGlyphs } from '../glyphs.js';
|
|
13
|
+
import { invocationHeaderSegments, invocationHiddenText, invocationInputText, } from '../layout/invocation-card.js';
|
|
14
|
+
import { GUTTER_WIDTH } from '../layout/Gutter.js';
|
|
15
|
+
import { useTerminalSize } from '../layout/useTerminalSize.js';
|
|
16
|
+
import { fitCells } from '../layout/cells.js';
|
|
17
|
+
function toneColor(tone, theme) {
|
|
18
|
+
if (tone === 'label')
|
|
19
|
+
return theme.accent;
|
|
20
|
+
if (tone === 'name')
|
|
21
|
+
return theme.user;
|
|
22
|
+
return theme.muted;
|
|
23
|
+
}
|
|
24
|
+
function InvocationCardImpl({ card, theme, caps, }) {
|
|
25
|
+
const glyphs = pickGlyphs(caps);
|
|
26
|
+
const { cols } = useTerminalSize();
|
|
27
|
+
const usable = Math.max(1, cols - GUTTER_WIDTH);
|
|
28
|
+
const header = invocationHeaderSegments(card, glyphs, usable);
|
|
29
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { wrap: "truncate", children: header.map((part, index) => (_jsx(Text, { color: toneColor(part.tone, theme), bold: part.bold, children: part.text }, index))) }), card.input !== '' && _jsx(Text, { color: theme.user, children: invocationInputText(card) }), card.inputHidden > 0 && (_jsx(Text, { color: theme.muted, wrap: "truncate", children: invocationHiddenText(card, glyphs) })), card.note !== undefined && card.note !== '' && (_jsx(Text, { color: theme.muted, wrap: "truncate", children: fitCells(card.note, usable, glyphs.ellipsis) }))] }));
|
|
30
|
+
}
|
|
31
|
+
/** Default comparator: `mapEntry` preserves identity for untouched entries (L2 / R3). */
|
|
32
|
+
export const InvocationCard = React.memo(InvocationCardImpl);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Governance TUI copy: every user-visible English phrase of the legion panel, the chip,
|
|
3
|
+
* the settlement card and the `/gov board` overlay (governance-mode section 10.6).
|
|
4
|
+
*
|
|
5
|
+
* ASCII ONLY (`src/ui/**` is glyph-scanned). Phrases that need a symbol take it as a
|
|
6
|
+
* template parameter from `pickGlyphs(caps)` instead of spelling it.
|
|
7
|
+
*
|
|
8
|
+
* WHY THIS LIVES IN `ui/` AND NOT IN `governance/copy.ts`: the engine author owns that
|
|
9
|
+
* file and it carries the model-facing and notice wording. This module holds the strings
|
|
10
|
+
* only the TUI draws, so the two cannot collide while both are being written. When
|
|
11
|
+
* `governance/copy.ts` lands, a phrase that appears in both belongs THERE and this file
|
|
12
|
+
* re-exports it - the unit tests pin these strings, so the move is a compile error and
|
|
13
|
+
* not a silent fork.
|
|
14
|
+
*/
|
|
15
|
+
import type { GovAgentState, GovRole, PipelineStepKey } from '../governance/types.js';
|
|
16
|
+
export declare const GOV_TITLE = "GOVERN";
|
|
17
|
+
/** One word for each pipeline step, as printed in the step strip. */
|
|
18
|
+
export declare const PIPELINE_LABEL: Readonly<Record<PipelineStepKey, string>>;
|
|
19
|
+
/** The role word in the roster's role column. */
|
|
20
|
+
export declare const ROLE_LABEL: Readonly<Record<GovRole, string>>;
|
|
21
|
+
/** What a `working` agent is doing, by role: the row says WHAT, the marker says THAT. */
|
|
22
|
+
export declare const WORKING_VERB: Readonly<Record<GovRole, string>>;
|
|
23
|
+
/** The state column's word for every non-working state. */
|
|
24
|
+
export declare const STATE_WORD: Readonly<Record<Exclude<GovAgentState, 'working'>, string>>;
|
|
25
|
+
export declare const NOT_SCORED = "not scored";
|
|
26
|
+
export declare const MORE_HINT = "(/gov board)";
|
|
27
|
+
export declare const PANEL_LEDGER_LABEL = "ledger";
|
|
28
|
+
export declare const PANEL_HEALTH_LABEL = "health";
|
|
29
|
+
export declare const PANEL_TOKEN_UNIT = "tok";
|
|
30
|
+
export declare const PANEL_BOARD_HINT = "/gov board";
|
|
31
|
+
export declare const STATUS_WORD: {
|
|
32
|
+
readonly pausing: "pausing";
|
|
33
|
+
readonly paused: "paused";
|
|
34
|
+
readonly escalated: "escalated";
|
|
35
|
+
readonly abandoned: "abandoned";
|
|
36
|
+
readonly closed: "closed";
|
|
37
|
+
};
|
|
38
|
+
/** `pausing after REVIEW`: a `/gov pause` is waiting for the running stage to finish. */
|
|
39
|
+
export declare function pausingText(stage: string): string;
|
|
40
|
+
/** `replaced by dev2-r1` (the glyph in front comes from the roster marker). */
|
|
41
|
+
export declare function replacedByText(successor: string | null): string;
|
|
42
|
+
export declare function moreText(hidden: number): string;
|
|
43
|
+
export declare function workingCountText(count: number): string;
|
|
44
|
+
export declare function phaseText(phase: number, phaseCount: number): string;
|
|
45
|
+
export declare function phaseLongText(phase: number, phaseCount: number): string;
|
|
46
|
+
/** Board tab names, in tab order. */
|
|
47
|
+
export declare const BOARD_TAB_LABEL: {
|
|
48
|
+
readonly roster: "Roster";
|
|
49
|
+
readonly work: "Work packages";
|
|
50
|
+
readonly ledger: "Ledger";
|
|
51
|
+
readonly claims: "Claims";
|
|
52
|
+
};
|
|
53
|
+
export declare const BOARD_TITLE = "Governance board";
|
|
54
|
+
export declare const BOARD_EMPTY: {
|
|
55
|
+
readonly noRun: "No governed run yet. Use /gov or Shift+Tab to enter GOVERN.";
|
|
56
|
+
readonly roster: "No agents yet.";
|
|
57
|
+
readonly work: "No work packages recorded for this view.";
|
|
58
|
+
readonly ledger: "No ledger entries yet.";
|
|
59
|
+
readonly claims: "No claims or escalations.";
|
|
60
|
+
};
|
|
61
|
+
export declare const BOARD_COPIED = "Copied the board file path";
|
|
62
|
+
export declare const BOARD_NO_PATH = "No board file path is available yet";
|
|
63
|
+
export declare const CARD_TITLE = "Governance";
|
|
64
|
+
export declare const CARD_COLUMNS: {
|
|
65
|
+
readonly id: "id";
|
|
66
|
+
readonly role: "role";
|
|
67
|
+
readonly confirmed: "confirmed";
|
|
68
|
+
readonly delta: "delta";
|
|
69
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Governance TUI copy: every user-visible English phrase of the legion panel, the chip,
|
|
3
|
+
* the settlement card and the `/gov board` overlay (governance-mode section 10.6).
|
|
4
|
+
*
|
|
5
|
+
* ASCII ONLY (`src/ui/**` is glyph-scanned). Phrases that need a symbol take it as a
|
|
6
|
+
* template parameter from `pickGlyphs(caps)` instead of spelling it.
|
|
7
|
+
*
|
|
8
|
+
* WHY THIS LIVES IN `ui/` AND NOT IN `governance/copy.ts`: the engine author owns that
|
|
9
|
+
* file and it carries the model-facing and notice wording. This module holds the strings
|
|
10
|
+
* only the TUI draws, so the two cannot collide while both are being written. When
|
|
11
|
+
* `governance/copy.ts` lands, a phrase that appears in both belongs THERE and this file
|
|
12
|
+
* re-exports it - the unit tests pin these strings, so the move is a compile error and
|
|
13
|
+
* not a silent fork.
|
|
14
|
+
*/
|
|
15
|
+
export const GOV_TITLE = 'GOVERN';
|
|
16
|
+
/** One word for each pipeline step, as printed in the step strip. */
|
|
17
|
+
export const PIPELINE_LABEL = {
|
|
18
|
+
intake: 'INTAKE',
|
|
19
|
+
dev: 'DEV',
|
|
20
|
+
review: 'REVIEW',
|
|
21
|
+
test: 'TEST',
|
|
22
|
+
settle: 'SETTLE',
|
|
23
|
+
integrate: 'INTEGRATE',
|
|
24
|
+
fix: 'FIX',
|
|
25
|
+
};
|
|
26
|
+
/** The role word in the roster's role column. */
|
|
27
|
+
export const ROLE_LABEL = {
|
|
28
|
+
DEV: 'DEV',
|
|
29
|
+
REV: 'REV',
|
|
30
|
+
TEST: 'TEST',
|
|
31
|
+
INSP: 'INSP',
|
|
32
|
+
};
|
|
33
|
+
/** What a `working` agent is doing, by role: the row says WHAT, the marker says THAT. */
|
|
34
|
+
export const WORKING_VERB = {
|
|
35
|
+
DEV: 'coding',
|
|
36
|
+
REV: 'reviewing',
|
|
37
|
+
TEST: 'testing',
|
|
38
|
+
INSP: 'checking',
|
|
39
|
+
};
|
|
40
|
+
/** The state column's word for every non-working state. */
|
|
41
|
+
export const STATE_WORD = {
|
|
42
|
+
queued: 'queued',
|
|
43
|
+
submitted: 'submitted',
|
|
44
|
+
idle: 'idle',
|
|
45
|
+
failed: 'failed',
|
|
46
|
+
eliminated: 'replaced',
|
|
47
|
+
};
|
|
48
|
+
export const NOT_SCORED = 'not scored';
|
|
49
|
+
export const MORE_HINT = '(/gov board)';
|
|
50
|
+
export const PANEL_LEDGER_LABEL = 'ledger';
|
|
51
|
+
export const PANEL_HEALTH_LABEL = 'health';
|
|
52
|
+
export const PANEL_TOKEN_UNIT = 'tok';
|
|
53
|
+
export const PANEL_BOARD_HINT = '/gov board';
|
|
54
|
+
export const STATUS_WORD = {
|
|
55
|
+
pausing: 'pausing',
|
|
56
|
+
paused: 'paused',
|
|
57
|
+
escalated: 'escalated',
|
|
58
|
+
abandoned: 'abandoned',
|
|
59
|
+
closed: 'closed',
|
|
60
|
+
};
|
|
61
|
+
/** `pausing after REVIEW`: a `/gov pause` is waiting for the running stage to finish. */
|
|
62
|
+
export function pausingText(stage) {
|
|
63
|
+
return stage === '' ? STATUS_WORD.pausing : `${STATUS_WORD.pausing} after ${stage}`;
|
|
64
|
+
}
|
|
65
|
+
/** `replaced by dev2-r1` (the glyph in front comes from the roster marker). */
|
|
66
|
+
export function replacedByText(successor) {
|
|
67
|
+
return successor === null ? 'replaced' : `replaced by ${successor}`;
|
|
68
|
+
}
|
|
69
|
+
export function moreText(hidden) {
|
|
70
|
+
return `+${hidden} more ${MORE_HINT}`;
|
|
71
|
+
}
|
|
72
|
+
export function workingCountText(count) {
|
|
73
|
+
return `${count} working`;
|
|
74
|
+
}
|
|
75
|
+
export function phaseText(phase, phaseCount) {
|
|
76
|
+
return `p${phase}/${phaseCount}`;
|
|
77
|
+
}
|
|
78
|
+
export function phaseLongText(phase, phaseCount) {
|
|
79
|
+
return `phase ${phase}/${phaseCount}`;
|
|
80
|
+
}
|
|
81
|
+
/** Board tab names, in tab order. */
|
|
82
|
+
export const BOARD_TAB_LABEL = {
|
|
83
|
+
roster: 'Roster',
|
|
84
|
+
work: 'Work packages',
|
|
85
|
+
ledger: 'Ledger',
|
|
86
|
+
claims: 'Claims',
|
|
87
|
+
};
|
|
88
|
+
export const BOARD_TITLE = 'Governance board';
|
|
89
|
+
export const BOARD_EMPTY = {
|
|
90
|
+
noRun: 'No governed run yet. Use /gov or Shift+Tab to enter GOVERN.',
|
|
91
|
+
roster: 'No agents yet.',
|
|
92
|
+
work: 'No work packages recorded for this view.',
|
|
93
|
+
ledger: 'No ledger entries yet.',
|
|
94
|
+
claims: 'No claims or escalations.',
|
|
95
|
+
};
|
|
96
|
+
export const BOARD_COPIED = 'Copied the board file path';
|
|
97
|
+
export const BOARD_NO_PATH = 'No board file path is available yet';
|
|
98
|
+
export const CARD_TITLE = 'Governance';
|
|
99
|
+
export const CARD_COLUMNS = {
|
|
100
|
+
id: 'id',
|
|
101
|
+
role: 'role',
|
|
102
|
+
confirmed: 'confirmed',
|
|
103
|
+
delta: 'delta',
|
|
104
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Governance status: snapshot -> display derivations (governance-mode section 10.3).
|
|
3
|
+
*
|
|
4
|
+
* Pure: no Ink, no clock (callers inject `now`), no I/O. ASCII ONLY.
|
|
5
|
+
*
|
|
6
|
+
* WHAT LIVES HERE AND WHAT DOES NOT. The panel, the chip, the card and the board each
|
|
7
|
+
* need the same few JUDGEMENTS - which colour a score label gets, whether a score change
|
|
8
|
+
* is still inside its emphasis window, which pipeline step is current, what an agent's
|
|
9
|
+
* state looks like to `team-status.ts`. Putting each judgement here once is the same
|
|
10
|
+
* discipline `team-status.ts` records: the roster, the card and the chip used to disagree
|
|
11
|
+
* about what "running" looked like because nine files each answered it.
|
|
12
|
+
*
|
|
13
|
+
* COLOUR IS A SEMANTIC KEY, NOT A THEME FIELD. The layout modules emit `Tone` values and
|
|
14
|
+
* the components resolve them through `toneColor`, so a layout test never needs a `Theme`
|
|
15
|
+
* and a theme change never touches a layout.
|
|
16
|
+
*/
|
|
17
|
+
import type { GovAgentState, GovernanceSnapshot, RosterRow, RunStatus, StageKind } from '../governance/types.js';
|
|
18
|
+
import type { ChildStatus } from './team-status.js';
|
|
19
|
+
import type { Theme } from './theme.js';
|
|
20
|
+
/** Semantic colour slots shared by every governance surface. */
|
|
21
|
+
export type Tone = 'text' | 'muted' | 'hint' | 'border' | 'primary' | 'govern' | 'ok' | 'warn' | 'error' | 'pending' | 'running';
|
|
22
|
+
/** Resolve a tone against a theme. The ONLY place a `Tone` becomes a colour. */
|
|
23
|
+
export declare function toneColor(tone: Tone, theme: Theme): string | undefined;
|
|
24
|
+
/** A run of text in one tone: the unit every layout line is made of. */
|
|
25
|
+
export interface Segment {
|
|
26
|
+
text: string;
|
|
27
|
+
tone: Tone;
|
|
28
|
+
bold?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare function segment(text: string, tone: Tone, bold?: boolean): Segment;
|
|
31
|
+
export declare function govChildStatus(state: GovAgentState): ChildStatus;
|
|
32
|
+
export declare function statusTone(status: ChildStatus): Tone;
|
|
33
|
+
/** How a standing label reads on screen. */
|
|
34
|
+
export type ScoreTone = 'ok' | 'warn' | 'danger' | 'muted';
|
|
35
|
+
export declare function scoreTone(label: RosterRow['label']): ScoreTone;
|
|
36
|
+
export declare function scoreToneKey(label: RosterRow['label']): Tone;
|
|
37
|
+
/** The short word for a label in the roster's tag column; `NORMAL` says nothing. */
|
|
38
|
+
export declare function labelTag(label: RosterRow['label']): string;
|
|
39
|
+
/** Scored agents start here; the gauge is full at this value. */
|
|
40
|
+
export declare const GAUGE_FULL_SCORE: 100;
|
|
41
|
+
export declare const GAUGE_CELLS = 10;
|
|
42
|
+
/**
|
|
43
|
+
* Filled cells of the 10-cell score gauge: `round(confirmed / 100 * 10)` clamped to
|
|
44
|
+
* [0, 10] (spec 10.3). Non-finite input draws an empty bar rather than throwing - the
|
|
45
|
+
* gauge is decoration over a number that is printed beside it.
|
|
46
|
+
*/
|
|
47
|
+
export declare function gaugeFilledCells(confirmed: number): number;
|
|
48
|
+
/** `115+` when the score is over the starting value, otherwise the plain number. */
|
|
49
|
+
export declare function scoreText(confirmed: number): string;
|
|
50
|
+
/** How long a score change stays emphasised on its row. */
|
|
51
|
+
export declare const DELTA_EMPHASIS_MS = 4000;
|
|
52
|
+
export interface DeltaCell {
|
|
53
|
+
/** `+10` / `-20`, or '' when the row has nothing to say. */
|
|
54
|
+
text: string;
|
|
55
|
+
tone: Tone;
|
|
56
|
+
bold: boolean;
|
|
57
|
+
}
|
|
58
|
+
/** Signed delta text; a provisional gain carries the `P` suffix (`+15P`). */
|
|
59
|
+
export declare function signedDeltaText(delta: number, provisional: boolean): string;
|
|
60
|
+
/**
|
|
61
|
+
* The emphasised delta of a row.
|
|
62
|
+
*
|
|
63
|
+
* Motion allowed: bold + coloured for `DELTA_EMPHASIS_MS` after the change, then gone.
|
|
64
|
+
* Reduced motion: nothing is time-windowed, so nothing flashes - the delta stays, plain,
|
|
65
|
+
* until the engine replaces or clears `lastDelta` at the next phase (spec 10.3 "the
|
|
66
|
+
* increment text is kept until the next phase"). A zero delta says nothing in either mode.
|
|
67
|
+
*/
|
|
68
|
+
export declare function deltaCell(row: RosterRow, now: number, reducedMotion: boolean): DeltaCell;
|
|
69
|
+
/** The display modes of the legion panel (spec 10.3 mount rules). */
|
|
70
|
+
export type GovernancePanelMode = 'none' | 'run-strip' | 'panel';
|
|
71
|
+
/**
|
|
72
|
+
* Mount rule (D-17): a running stage -> the full panel (which REPLACES the team roster);
|
|
73
|
+
* a live run between stages -> the two-line strip; no run, a closed run or an abandoned
|
|
74
|
+
* run -> nothing at all (zero rows, zero layout shift).
|
|
75
|
+
*/
|
|
76
|
+
export declare function governancePanelMode(snapshot: GovernanceSnapshot | null): GovernancePanelMode;
|
|
77
|
+
/** Which component owns the bottom transient region's live roster. */
|
|
78
|
+
export type LiveRosterSurface = 'governance' | 'team' | 'none';
|
|
79
|
+
/**
|
|
80
|
+
* EXACTLY ONE LIVE ROSTER (D-17 / AC-25). A running governed stage owns the region even
|
|
81
|
+
* though the same children are also in `state.team` (the reducer still writes it for
|
|
82
|
+
* `/agents`); between stages the two-line strip shows only when no dispatch is live; with
|
|
83
|
+
* no live governed run the team roster behaves exactly as it always did.
|
|
84
|
+
*/
|
|
85
|
+
export declare function liveRosterSurface(snapshot: GovernanceSnapshot | null, teamLive: boolean): LiveRosterSurface;
|
|
86
|
+
export declare function isFinishedRun(status: RunStatus): boolean;
|
|
87
|
+
/** Agents currently doing something: the minimal tier's "4 working". */
|
|
88
|
+
export declare function workingCount(snapshot: GovernanceSnapshot): number;
|
|
89
|
+
/** Display position in the pipeline: the active step's key, or the stage, or null. */
|
|
90
|
+
export declare function activeStepKey(snapshot: GovernanceSnapshot): StageKind | null;
|
|
91
|
+
/** Tokens spent by the governed team (spec 8.5: team tokens, never the session total). */
|
|
92
|
+
export declare function teamTokens(snapshot: GovernanceSnapshot): number;
|
|
93
|
+
/**
|
|
94
|
+
* Budget readout for the chip's `$` hint: 'none' without a budget, 'warn' from 80%,
|
|
95
|
+
* 'over' from 100% (spec 8.5). Only budgets > 0 are budgets.
|
|
96
|
+
*/
|
|
97
|
+
export declare function budgetState(snapshot: GovernanceSnapshot): 'none' | 'ok' | 'warn' | 'over';
|
|
98
|
+
/** Short run id for the header: the last five alphanumerics, so ids that share a prefix differ. */
|
|
99
|
+
export declare function shortRunId(runId: string): string;
|
|
100
|
+
/** Phase at which each eliminated id was FIRST seen eliminated. */
|
|
101
|
+
export type EliminatedSince = Readonly<Record<string, number>>;
|
|
102
|
+
/**
|
|
103
|
+
* Fold a snapshot into the first-seen-eliminated map.
|
|
104
|
+
*
|
|
105
|
+
* WHY THE PANEL KEEPS THIS ITSELF: `RosterRow` carries no "eliminated in phase N" field,
|
|
106
|
+
* and the board still needs the full roster from the same snapshot, so the engine cannot
|
|
107
|
+
* simply drop the row. A member that disappears from the map's keys (never happens) or
|
|
108
|
+
* that was never seen eliminated is treated as "eliminated now" by `isRetired`. Returns
|
|
109
|
+
* the SAME object when nothing changed so React memo / ref comparisons stay cheap.
|
|
110
|
+
*/
|
|
111
|
+
export declare function trackEliminated(previous: EliminatedSince, snapshot: GovernanceSnapshot): EliminatedSince;
|
|
112
|
+
/**
|
|
113
|
+
* True when an eliminated member's one visible phase is over: it was first seen in an
|
|
114
|
+
* earlier phase than the one now displayed.
|
|
115
|
+
*/
|
|
116
|
+
export declare function isRetired(row: RosterRow, phase: number, since: EliminatedSince): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Roster order: DEV -> REV -> TEST -> INSP, active members before eliminated ones, then
|
|
119
|
+
* by generation and id so `dev2` precedes its successor `dev2-r1` and the order is total
|
|
120
|
+
* (a stable roster does not reshuffle between snapshots).
|
|
121
|
+
*/
|
|
122
|
+
export declare function sortRoster(roster: readonly RosterRow[]): RosterRow[];
|
|
123
|
+
/**
|
|
124
|
+
* `PLAN+GOVERN interview round 2/2+` while rounds are still owed, and `... 2/2 OK` once
|
|
125
|
+
* the minimum is met (governance-mode 10.6). The trailing `+` reads "at least this many":
|
|
126
|
+
* the model may ask more rounds than the minimum.
|
|
127
|
+
*/
|
|
128
|
+
export declare function interviewChipText(round: number, required: number): string;
|
|
129
|
+
/**
|
|
130
|
+
* A `/gov pause` is waiting for the running stage to finish (governance-mode-v1-1 6.4).
|
|
131
|
+
* Only meaningful while the run is still `executing`: once it is `paused` the request has
|
|
132
|
+
* been redeemed, and an `escalated` run drops it.
|
|
133
|
+
*/
|
|
134
|
+
export declare function isPausePending(snapshot: GovernanceSnapshot): boolean;
|
|
135
|
+
/** True for the two governed postures, given a mode OR posture value as a string. */
|
|
136
|
+
export declare function isGovernedModeValue(value: string | null | undefined): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* The status row's word for a mode OR a posture. `MODE_LABEL` answers for `build` /
|
|
139
|
+
* `plan` (so the byte-identical pre-governance output is preserved); the two governed
|
|
140
|
+
* postures are the only values that reach the second table.
|
|
141
|
+
*
|
|
142
|
+
* Short form: the first letter, except `plan_govern` which is `PG` - `P` is already PLAN
|
|
143
|
+
* and a status row that cannot tell them apart has defeated the badge.
|
|
144
|
+
*/
|
|
145
|
+
export declare function modeWord(value: string, full: boolean): string | undefined;
|