@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,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `gov_run start` argument normalization (governance-mode 7.2).
|
|
3
|
+
*
|
|
4
|
+
* ASCII ONLY (`governance/` is glyph-scanned).
|
|
5
|
+
*
|
|
6
|
+
* REPAIR FIRST, REJECT SECOND, and never create anything on a rejection: a malformed
|
|
7
|
+
* `start` must leave no run directory, no ledger and no lock behind, because the model's
|
|
8
|
+
* natural response to `NOT ACCEPTED` is to call `start` again with a corrected payload.
|
|
9
|
+
* Every problem is listed at once - a model that learns about one defect per call burns a
|
|
10
|
+
* round trip per defect, and each round trip is an LLM turn.
|
|
11
|
+
*
|
|
12
|
+
* The schema in `lead-tools.ts` declares SHAPE only (plan-tools.ts P0-4: `ajv` is an
|
|
13
|
+
* optional dependency, so a numeric bound in the schema would behave differently depending
|
|
14
|
+
* on whether it installed). Every bound is enforced HERE, deterministically.
|
|
15
|
+
*/
|
|
16
|
+
import { GOV_LIMITS } from '../limits.js';
|
|
17
|
+
import { isProfileId } from '../profiles.js';
|
|
18
|
+
import { Issues, isRecord } from '../tools/normalize-util.js';
|
|
19
|
+
function normalizeWorkPackage(issues, raw, index) {
|
|
20
|
+
const label = `workPackages[${index}]`;
|
|
21
|
+
if (!isRecord(raw)) {
|
|
22
|
+
issues.fail(`${label} must be an object.`);
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const id = issues.str(raw.id, `${label}.id`, GOV_LIMITS.wpIdChars * 4, true).toLowerCase();
|
|
26
|
+
const title = issues.str(raw.title, `${label}.title`, GOV_LIMITS.wpTitleChars, true);
|
|
27
|
+
const goal = issues.str(raw.goal, `${label}.goal`, GOV_LIMITS.wpGoalChars, true);
|
|
28
|
+
const files = issues.list(raw.files, `${label}.files`, GOV_LIMITS.wpFilesMax, 200);
|
|
29
|
+
const acceptance = issues.list(raw.acceptance, `${label}.acceptance`, GOV_LIMITS.wpAcceptanceMax, GOV_LIMITS.wpAcceptanceChars);
|
|
30
|
+
if (acceptance.length === 0) {
|
|
31
|
+
issues.fail(`${label} (${id || index}) needs at least one acceptance criterion.`);
|
|
32
|
+
}
|
|
33
|
+
const dependsOn = issues
|
|
34
|
+
.list(raw.dependsOn, `${label}.dependsOn`, 16, GOV_LIMITS.wpIdChars * 4)
|
|
35
|
+
.map((d) => d.toLowerCase());
|
|
36
|
+
return { id, title, goal, files, acceptance, ...(dependsOn.length > 0 ? { dependsOn } : {}) };
|
|
37
|
+
}
|
|
38
|
+
function normalizeContract(issues, raw, index) {
|
|
39
|
+
const label = `contracts[${index}]`;
|
|
40
|
+
if (!isRecord(raw)) {
|
|
41
|
+
issues.fail(`${label} must be an object.`);
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const id = issues.str(raw.id, `${label}.id`, 40, true);
|
|
45
|
+
const name = issues.str(raw.name, `${label}.name`, GOV_LIMITS.contractNameChars, true);
|
|
46
|
+
const producer = issues.str(raw.producer, `${label}.producer`, 80, true).toLowerCase();
|
|
47
|
+
const consumers = issues
|
|
48
|
+
.list(raw.consumers, `${label}.consumers`, 8, 80)
|
|
49
|
+
.map((c) => c.toLowerCase());
|
|
50
|
+
if (consumers.length === 0)
|
|
51
|
+
issues.fail(`${label} (${id}) needs at least one consumer.`);
|
|
52
|
+
const definition = issues.str(raw.definition, `${label}.definition`, GOV_LIMITS.contractDefinitionChars, true);
|
|
53
|
+
return { id, name, producer, consumers, definition };
|
|
54
|
+
}
|
|
55
|
+
function duplicates(values) {
|
|
56
|
+
const seen = new Set();
|
|
57
|
+
const dup = new Set();
|
|
58
|
+
for (const v of values) {
|
|
59
|
+
if (seen.has(v))
|
|
60
|
+
dup.add(v);
|
|
61
|
+
seen.add(v);
|
|
62
|
+
}
|
|
63
|
+
return [...dup];
|
|
64
|
+
}
|
|
65
|
+
/** Validate a raw `gov_run start` payload. Pure; never throws. */
|
|
66
|
+
export function normalizeStartInput(raw) {
|
|
67
|
+
const issues = new Issues();
|
|
68
|
+
const args = isRecord(raw) ? raw : {};
|
|
69
|
+
const goal = issues.str(args.goal, 'goal', GOV_LIMITS.goalChars, true);
|
|
70
|
+
// The spec is allowed to be empty when a PLAN+GOVERN snapshot supplies it; the lifecycle
|
|
71
|
+
// decides that, so it is not required here.
|
|
72
|
+
const spec = issues.str(args.spec, 'spec', GOV_LIMITS.specChars);
|
|
73
|
+
let profile;
|
|
74
|
+
if (args.profile !== undefined && args.profile !== null && args.profile !== '') {
|
|
75
|
+
if (isProfileId(args.profile))
|
|
76
|
+
profile = args.profile;
|
|
77
|
+
else
|
|
78
|
+
issues.fail(`profile must be one of general, ml, product, api-security.`);
|
|
79
|
+
}
|
|
80
|
+
const wpRaw = issues.items(args.workPackages, 'workPackages', GOV_LIMITS.hardMaxWorkPackages * 4);
|
|
81
|
+
if (wpRaw.length === 0)
|
|
82
|
+
issues.fail('workPackages needs at least one work package.');
|
|
83
|
+
const workPackages = [];
|
|
84
|
+
wpRaw.forEach((item, i) => {
|
|
85
|
+
const wp = normalizeWorkPackage(issues, item, i);
|
|
86
|
+
if (wp)
|
|
87
|
+
workPackages.push(wp);
|
|
88
|
+
});
|
|
89
|
+
const dupIds = duplicates(workPackages.map((w) => w.id));
|
|
90
|
+
if (dupIds.length > 0)
|
|
91
|
+
issues.fail(`duplicate work package id(s): ${dupIds.join(', ')}.`);
|
|
92
|
+
const contractRaw = issues.items(args.contracts, 'contracts', GOV_LIMITS.contractsMax);
|
|
93
|
+
const contracts = [];
|
|
94
|
+
contractRaw.forEach((item, i) => {
|
|
95
|
+
const c = normalizeContract(issues, item, i);
|
|
96
|
+
if (c)
|
|
97
|
+
contracts.push(c);
|
|
98
|
+
});
|
|
99
|
+
const dupContracts = duplicates(contracts.map((c) => c.id));
|
|
100
|
+
if (dupContracts.length > 0)
|
|
101
|
+
issues.fail(`duplicate contract id(s): ${dupContracts.join(', ')}.`);
|
|
102
|
+
const integrationCommands = issues.list(args.integrationCommands, 'integrationCommands', GOV_LIMITS.integrationCommandsMax, GOV_LIMITS.integrationCommandChars);
|
|
103
|
+
return issues.result({
|
|
104
|
+
goal,
|
|
105
|
+
spec,
|
|
106
|
+
...(profile !== undefined ? { profile } : {}),
|
|
107
|
+
workPackages,
|
|
108
|
+
...(contracts.length > 0 ? { contracts } : {}),
|
|
109
|
+
...(integrationCommands.length > 0 ? { integrationCommands } : {}),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stage legality, `NEXT` generation and escalation handling (governance-mode 8.2, I-G6).
|
|
3
|
+
*
|
|
4
|
+
* ASCII ONLY (`governance/` is glyph-scanned). Pure apart from the explicitly named
|
|
5
|
+
* mutators (`recordRework`, `markBlocked`, `openEscalation`, `closeEscalation`,
|
|
6
|
+
* `applyResolveDisposition`), which edit the `RunState` they are handed IN PLACE and do
|
|
7
|
+
* no I/O, so the engine can replay or persist around them.
|
|
8
|
+
*
|
|
9
|
+
* WHY A TABLE AND NOT TRUST. The orchestrator is an LLM; "do not skip review" in a prompt
|
|
10
|
+
* drifts over a multi-hour run. Here the stage order is a hard fact: `checkStage` is the
|
|
11
|
+
* only gate `gov_dispatch` passes through, and every refusal teaches (it names the
|
|
12
|
+
* blocking WPs and ends with the legal next calls) so a refused call is one cheap
|
|
13
|
+
* correction, not a dead end. Refusals are plain text, never errors (D-15).
|
|
14
|
+
*
|
|
15
|
+
* The current phase is the FIRST phase with `integrated === false`; stages only ever act
|
|
16
|
+
* on it. `dropped` and `integrated` WPs never block anything.
|
|
17
|
+
*/
|
|
18
|
+
import { type Escalation, type PhaseState, type ResolveDisposition, type RunState, type StageKind, type WorkPackage } from '../types.js';
|
|
19
|
+
export declare const NOT_ACCEPTED = "NOT ACCEPTED:";
|
|
20
|
+
export interface StageCheckOptions {
|
|
21
|
+
/** `min(team.maxSubagents, hardMaxSubagents)`; defaults to the structural maximum. */
|
|
22
|
+
teamCeiling?: number;
|
|
23
|
+
}
|
|
24
|
+
export type StageCheck = {
|
|
25
|
+
ok: true;
|
|
26
|
+
phase: number;
|
|
27
|
+
wpIds: string[];
|
|
28
|
+
} | {
|
|
29
|
+
ok: false;
|
|
30
|
+
message: string;
|
|
31
|
+
};
|
|
32
|
+
/** Index of the first phase that is not integrated, or null when all are. */
|
|
33
|
+
export declare function currentPhaseIndex(run: RunState): number | null;
|
|
34
|
+
export declare function currentPhase(run: RunState): PhaseState | null;
|
|
35
|
+
export declare function wpsInPhase(run: RunState, phase: PhaseState): WorkPackage[];
|
|
36
|
+
/** `maxRework` plus L3 grants for one WP, never above the structural ceiling. */
|
|
37
|
+
export declare function reworkLimit(run: RunState, wp: WorkPackage): number;
|
|
38
|
+
/** Fix cycles allowed in a phase: `maxFixCycles + extraFixGrants`, capped structurally. */
|
|
39
|
+
export declare function fixCycleLimit(run: RunState, phase: PhaseState): number;
|
|
40
|
+
/**
|
|
41
|
+
* The last integrate failed, every allowed fix has been spent, and no newer integrate
|
|
42
|
+
* attempt is pending: the engine must open an `integration_exhausted` escalation.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isIntegrationExhausted(run: RunState, phase: PhaseState): boolean;
|
|
45
|
+
/** `gov_run close` precondition: every phase integrated (accepted failing counts). */
|
|
46
|
+
export declare function canClose(run: RunState): boolean;
|
|
47
|
+
/** "WPs awaiting review: a, b; pending: c" over the not-yet-finished WPs of a phase. */
|
|
48
|
+
export declare function describePhaseStatus(run: RunState, phase: PhaseState): string;
|
|
49
|
+
/** Number of children a stage over `wpCount` WPs launches. */
|
|
50
|
+
export declare function stageWidth(stage: StageKind, wpCount: number): number;
|
|
51
|
+
/** Most WPs one call may carry so that `stageWidth` stays within `ceiling`. */
|
|
52
|
+
export declare function stageChunkSize(stage: StageKind, ceiling: number): number;
|
|
53
|
+
/** `gov_dispatch {"stage":"dev","wps":["a","b"]}` */
|
|
54
|
+
export declare function dispatchCall(stage: StageKind, wps?: readonly string[]): string;
|
|
55
|
+
/** Render actions as the trailing `NEXT:` block every `gov_*` result ends with (D-16). */
|
|
56
|
+
export declare function formatNext(actions: readonly string[]): string;
|
|
57
|
+
/**
|
|
58
|
+
* Ordered legal next calls for the run's current state. Pure. Stage width beyond
|
|
59
|
+
* `teamCeiling` is split into chunk calls (D-24), each independently legal.
|
|
60
|
+
*/
|
|
61
|
+
export declare function nextActions(run: RunState, options?: StageCheckOptions): string[];
|
|
62
|
+
/**
|
|
63
|
+
* The single legality gate for `gov_dispatch` (I-G6). `wps` omitted means "every eligible
|
|
64
|
+
* WP of the current phase". On success `wpIds` is the validated list the stage will run.
|
|
65
|
+
*/
|
|
66
|
+
export declare function checkStage(run: RunState, stage: StageKind, wps?: readonly string[], options?: StageCheckOptions): StageCheck;
|
|
67
|
+
/** Stages that are legal right now (ignores `teamCeiling`; chunking is not legality). */
|
|
68
|
+
export declare function legalStages(run: RunState): StageKind[];
|
|
69
|
+
export declare function nextEscalationId(run: RunState): string;
|
|
70
|
+
export interface ReworkOutcome {
|
|
71
|
+
outcome: 'rework' | 'blocked';
|
|
72
|
+
reworkCount: number;
|
|
73
|
+
limit: number;
|
|
74
|
+
/** Not yet added to the run: the engine persists it, then calls `openEscalation`. */
|
|
75
|
+
escalation: Escalation | null;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Count one rejection against `wpId`. Beyond `maxRework + reworkGrants` the WP becomes
|
|
79
|
+
* `blocked` (retry stage `dev`, where the rework would have run) and an L3 escalation is
|
|
80
|
+
* proposed; otherwise it goes to `rework`.
|
|
81
|
+
*/
|
|
82
|
+
export declare function recordRework(run: RunState, wpId: string): ReworkOutcome;
|
|
83
|
+
/** A stage produced no submission for this WP: block it at that stage, no penalty. */
|
|
84
|
+
export declare function markBlocked(run: RunState, wpId: string, stage: StageKind): void;
|
|
85
|
+
export declare function openEscalation(run: RunState, escalation: Escalation): void;
|
|
86
|
+
/** Mark resolved; the run leaves `escalated` once no escalation remains open. */
|
|
87
|
+
export declare function closeEscalation(run: RunState, escalation: Escalation, ruling: string): void;
|
|
88
|
+
export type ResolveApplyResult = {
|
|
89
|
+
ok: true;
|
|
90
|
+
message: string;
|
|
91
|
+
affectedDependents: string[];
|
|
92
|
+
} | {
|
|
93
|
+
ok: false;
|
|
94
|
+
message: string;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Apply the user's `disposition` for an escalation (spec 7.2 table). Mismatched or
|
|
98
|
+
* over-cap dispositions are refused with a reason; no disposition changes nothing.
|
|
99
|
+
* Mutates `run`; does NOT mark the escalation resolved (`closeEscalation` does).
|
|
100
|
+
*/
|
|
101
|
+
export declare function applyResolveDisposition(run: RunState, escalation: Escalation, disposition?: ResolveDisposition): ResolveApplyResult;
|