@aragon-agent/cli 0.6.77 → 0.6.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -21
- package/dist/agent/controller.d.ts +36 -0
- package/dist/agent/controller.js +108 -0
- package/dist/agent/system-prompt.d.ts +10 -0
- package/dist/agent/system-prompt.js +6 -0
- package/dist/app/App.js +108 -27
- package/dist/app/index-console.d.ts +59 -0
- package/dist/app/index-console.js +99 -0
- package/dist/cli.js +80 -4
- package/dist/commands/builtins.js +4 -2
- package/dist/commands/catalog.js +7 -1
- package/dist/commands/index-build.js +10 -1
- package/dist/commands/index-command.d.ts +43 -0
- package/dist/commands/index-command.js +244 -0
- package/dist/commands/index-copy.d.ts +50 -0
- package/dist/commands/index-copy.js +82 -0
- package/dist/commands/kit-command.d.ts +10 -0
- package/dist/commands/kit-command.js +8 -2
- package/dist/commands/kits-command.d.ts +35 -0
- package/dist/commands/kits-command.js +137 -0
- package/dist/commands/registry.d.ts +10 -0
- package/dist/compaction/memory-agent.js +61 -0
- package/dist/config/env.d.ts +30 -0
- package/dist/config/env.js +47 -0
- package/dist/config/launch-notice.d.ts +61 -0
- package/dist/config/launch-notice.js +138 -0
- package/dist/config/load.d.ts +20 -0
- package/dist/config/load.js +72 -2
- package/dist/diagnostics/info.d.ts +28 -0
- package/dist/diagnostics/info.js +41 -0
- package/dist/exec/cli-commands.d.ts +24 -0
- package/dist/exec/cli-commands.js +48 -1
- package/dist/exec/index.js +9 -0
- package/dist/exec/options.d.ts +12 -0
- package/dist/host/index-build.d.ts +38 -7
- package/dist/host/index-build.js +74 -20
- package/dist/indexer/commit.d.ts +77 -0
- package/dist/indexer/commit.js +145 -0
- package/dist/indexer/discover.d.ts +50 -0
- package/dist/indexer/discover.js +147 -0
- package/dist/indexer/engine.d.ts +51 -0
- package/dist/indexer/engine.js +477 -0
- package/dist/indexer/errors.d.ts +62 -0
- package/dist/indexer/errors.js +86 -0
- package/dist/indexer/finalize.d.ts +30 -0
- package/dist/indexer/finalize.js +19 -0
- package/dist/indexer/fingerprint.d.ts +41 -0
- package/dist/indexer/fingerprint.js +49 -0
- package/dist/indexer/ignore.d.ts +59 -0
- package/dist/indexer/ignore.js +140 -0
- package/dist/indexer/index.d.ts +21 -0
- package/dist/indexer/index.js +21 -0
- package/dist/indexer/l0.d.ts +55 -0
- package/dist/indexer/l0.js +168 -0
- package/dist/indexer/limits.d.ts +75 -0
- package/dist/indexer/limits.js +106 -0
- package/dist/indexer/link.d.ts +68 -0
- package/dist/indexer/link.js +220 -0
- package/dist/indexer/lock.d.ts +115 -0
- package/dist/indexer/lock.js +270 -0
- package/dist/indexer/parse.d.ts +68 -0
- package/dist/indexer/parse.js +163 -0
- package/dist/indexer/paths.d.ts +99 -0
- package/dist/indexer/paths.js +198 -0
- package/dist/indexer/plan.d.ts +48 -0
- package/dist/indexer/plan.js +80 -0
- package/dist/indexer/rank.d.ts +42 -0
- package/dist/indexer/rank.js +125 -0
- package/dist/indexer/read/cache.d.ts +28 -0
- package/dist/indexer/read/cache.js +54 -0
- package/dist/indexer/read/query.d.ts +48 -0
- package/dist/indexer/read/query.js +361 -0
- package/dist/indexer/scanner/extract.d.ts +36 -0
- package/dist/indexer/scanner/extract.js +134 -0
- package/dist/indexer/scanner/mask.d.ts +44 -0
- package/dist/indexer/scanner/mask.js +198 -0
- package/dist/indexer/scanner/py-extract.d.ts +29 -0
- package/dist/indexer/scanner/py-extract.js +164 -0
- package/dist/indexer/scanner/refs.d.ts +31 -0
- package/dist/indexer/scanner/refs.js +116 -0
- package/dist/indexer/scanner/ts-extract.d.ts +39 -0
- package/dist/indexer/scanner/ts-extract.js +277 -0
- package/dist/indexer/store.d.ts +88 -0
- package/dist/indexer/store.js +309 -0
- package/dist/indexer/tools.d.ts +120 -0
- package/dist/indexer/tools.js +132 -0
- package/dist/indexer/types.d.ts +225 -0
- package/dist/indexer/types.js +44 -0
- package/dist/indexer/wiring.d.ts +45 -0
- package/dist/indexer/wiring.js +42 -0
- package/dist/tools/index.d.ts +16 -2
- package/dist/tools/index.js +23 -0
- package/package.json +3 -3
|
@@ -90,6 +90,52 @@ function blocked(state) {
|
|
|
90
90
|
return 'turn_limit';
|
|
91
91
|
return null;
|
|
92
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* THE FINAL TURN OFFERS `compaction_submit` AND NOTHING ELSE.
|
|
95
|
+
*
|
|
96
|
+
* THE CARD THIS FIXES (compaction-agent-never-submits) printed `12 turns, 20 tool
|
|
97
|
+
* calls` and `0 submissions`: the model kept reading until the budget ended, so
|
|
98
|
+
* "submit" stayed an instruction it never reached. `state.visible` is already
|
|
99
|
+
* dynamic (two schemas, then five after `compaction_outline` answers), so this is
|
|
100
|
+
* one more turn of an existing switch, not a new mechanism.
|
|
101
|
+
*
|
|
102
|
+
* BOTH GATES CONVERGE, because `blocked()` spells the turn ceiling and the
|
|
103
|
+
* tool-call ceiling the same `turn_limit`: `turns` counts COMPLETED turns, so
|
|
104
|
+
* `agentMaxTurns - 1` is the last one that may start; and one more batch is the
|
|
105
|
+
* closest the tool gate can be, which is `toolCallsPerTurn` calls away.
|
|
106
|
+
*
|
|
107
|
+
* THE NARROWING ALONE ONLY BINDS A COOPERATIVE TRANSPORT (analysis I-2).
|
|
108
|
+
* `executeTool` dispatches by NAME and never reads `visible`, so a relay that
|
|
109
|
+
* ignores the tool array would still read the band and spend the turn it was
|
|
110
|
+
* given to submit. `state.converged` is what lets `executeTools` refuse that
|
|
111
|
+
* call, which is the difference between an instruction and a structure.
|
|
112
|
+
*/
|
|
113
|
+
function convergeIfLastTurn(state) {
|
|
114
|
+
const turnGate = state.turns >= LIMITS.agentMaxTurns - 1;
|
|
115
|
+
const toolGate = state.toolCalls >= LIMITS.agentMaxToolCalls - LIMITS.toolCallsPerTurn;
|
|
116
|
+
if (!turnGate && !toolGate)
|
|
117
|
+
return;
|
|
118
|
+
state.visible = ['compaction_submit'];
|
|
119
|
+
state.converged = true;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* What a converged turn is told when it calls anything but `compaction_submit`.
|
|
123
|
+
*
|
|
124
|
+
* PHRASED AS THE REMAINING ACTION, not as a refusal, and it names the staged
|
|
125
|
+
* escape hatch: an empty delta adopts whatever `compaction_note` already
|
|
126
|
+
* validated (`memory-agent-tools.ts::submit`), so a model that staged its work
|
|
127
|
+
* can still land it with one call.
|
|
128
|
+
*
|
|
129
|
+
* WHERE THIS RECEIPT ACTUALLY ARRIVES IS NOT SYMMETRIC, and the asymmetry is
|
|
130
|
+
* worth stating rather than discovering. On the TOOL gate the run has turns
|
|
131
|
+
* left, so the refusal reaches the model and it can still submit. On the TURN
|
|
132
|
+
* gate this is the last turn of the run, so the receipt is recorded in the
|
|
133
|
+
* history and never sent again - there the value is that the call did NOT read,
|
|
134
|
+
* so the turn's remaining output is free for a submission the transport has
|
|
135
|
+
* already been asked for.
|
|
136
|
+
*/
|
|
137
|
+
const CONVERGED_REFUSAL = 'The operation is out of turns: compaction_submit is the only action on this turn. '
|
|
138
|
+
+ 'Submit now - an empty delta adopts every item already staged by compaction_note.';
|
|
93
139
|
/** Append the assistant turn and its tool results to the running history. */
|
|
94
140
|
function appendTurn(state, turn, calls, results) {
|
|
95
141
|
state.messages.push({
|
|
@@ -119,6 +165,17 @@ function executeTools(state, turn, calls) {
|
|
|
119
165
|
const executed = [];
|
|
120
166
|
const results = [];
|
|
121
167
|
for (const call of calls.slice(0, allowance)) {
|
|
168
|
+
// COUNTED AND ANSWERED, NEVER SILENTLY DROPPED (analysis I-2). A refused
|
|
169
|
+
// call still spent a round trip and a batch slot, so it goes on the ledger;
|
|
170
|
+
// and it keeps its `tool_result` so the history stays pairable.
|
|
171
|
+
if (state.converged && call.toolName !== 'compaction_submit') {
|
|
172
|
+
state.toolCalls += 1;
|
|
173
|
+
executed.push(call);
|
|
174
|
+
results.push({
|
|
175
|
+
toolCallId: call.toolCallId, content: CONVERGED_REFUSAL, isError: true,
|
|
176
|
+
});
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
122
179
|
const outcome = executeTool(call.toolName, call.args, {
|
|
123
180
|
input: state.input.band,
|
|
124
181
|
digest: state.input.digest,
|
|
@@ -196,6 +253,7 @@ export async function runMemoryAgent(input, port, deps) {
|
|
|
196
253
|
}),
|
|
197
254
|
tools: newToolState(),
|
|
198
255
|
visible: [...PRIMARY_TOOLS],
|
|
256
|
+
converged: false,
|
|
199
257
|
messages: [{
|
|
200
258
|
role: 'user', content: buildMemoryAgentOpening(input.band, input.digest),
|
|
201
259
|
}],
|
|
@@ -207,6 +265,9 @@ export async function runMemoryAgent(input, port, deps) {
|
|
|
207
265
|
const blockedNow = blocked(state);
|
|
208
266
|
if (blockedNow !== null)
|
|
209
267
|
return fail(state, blockedNow);
|
|
268
|
+
// BEFORE the request, not after the answer: the point is to stop the last turn
|
|
269
|
+
// spending its output on a read that can no longer be followed by a submission.
|
|
270
|
+
convergeIfLastTurn(state);
|
|
210
271
|
const outcome = await nextTurn(state);
|
|
211
272
|
if (outcome !== null)
|
|
212
273
|
return outcome;
|
package/dist/config/env.d.ts
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
* Recognized keys (spec §3.5):
|
|
5
5
|
* - Provider secrets: ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY /
|
|
6
6
|
* GEMINI_API_KEY.
|
|
7
|
+
* - Launch-time model selection (launch-model-and-kit-flags 4.3): ARAGON_KIT,
|
|
8
|
+
* ARAGON_PROFILE, ARAGON_FAST_PROFILE, ARAGON_SUBAGENT_MODEL,
|
|
9
|
+
* ARAGON_SUBAGENT_PROFILE. Read by `readLaunchEnv` below and NOT into
|
|
10
|
+
* `partial`: none of them is a persisted key (D-1 / 5.), so a value there
|
|
11
|
+
* would be one save away from landing in `config.json`.
|
|
7
12
|
* - Overrides: ARAGON_PROVIDER, ARAGON_MODEL, ARAGON_BASE_URL, ARAGON_THINKING,
|
|
8
13
|
* ARAGON_SHOW_THINKING,
|
|
9
14
|
* ARAGON_MAX_TOKENS (a number, or `auto` / `0` for the per-model ceiling),
|
|
@@ -52,6 +57,31 @@ export declare function loadDotenv(cwd: string): void;
|
|
|
52
57
|
export declare const PROVIDER_ENV_KEYS: Record<string, string[]>;
|
|
53
58
|
export declare let managedConfig: boolean;
|
|
54
59
|
export declare function enableManagedConfig(): void;
|
|
60
|
+
/**
|
|
61
|
+
* The launch-selection environment layer (`launch-model-and-kit-flags` 4.3).
|
|
62
|
+
*
|
|
63
|
+
* SEPARATE FROM `EnvConfig.partial` ON PURPOSE: these select a model for THIS
|
|
64
|
+
* invocation and are never persisted, while everything in `partial` is a
|
|
65
|
+
* config-file key an environment variable may override.
|
|
66
|
+
*/
|
|
67
|
+
export interface LaunchEnvConfig {
|
|
68
|
+
kit?: string;
|
|
69
|
+
profile?: string;
|
|
70
|
+
fastProfile?: string;
|
|
71
|
+
subagentModel?: string;
|
|
72
|
+
subagentProfile?: string;
|
|
73
|
+
model?: string;
|
|
74
|
+
provider?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Read the launch-selection overrides.
|
|
78
|
+
*
|
|
79
|
+
* ABSENT MEANS ABSENT: no defaults and no validation here. A misspelt value
|
|
80
|
+
* degrades with a warning in `resolveLaunchSelection` rather than throwing,
|
|
81
|
+
* because "one typo in an environment variable and the CLI will not start"
|
|
82
|
+
* is an unacceptable failure direction on the launch path (4.3).
|
|
83
|
+
*/
|
|
84
|
+
export declare function readLaunchEnv(): LaunchEnvConfig;
|
|
55
85
|
export interface EnvConfig {
|
|
56
86
|
/** Non-secret overrides sourced from ARAGON_* env vars. */
|
|
57
87
|
partial: Partial<PersistedConfig>;
|
package/dist/config/env.js
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
* Recognized keys (spec §3.5):
|
|
5
5
|
* - Provider secrets: ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY /
|
|
6
6
|
* GEMINI_API_KEY.
|
|
7
|
+
* - Launch-time model selection (launch-model-and-kit-flags 4.3): ARAGON_KIT,
|
|
8
|
+
* ARAGON_PROFILE, ARAGON_FAST_PROFILE, ARAGON_SUBAGENT_MODEL,
|
|
9
|
+
* ARAGON_SUBAGENT_PROFILE. Read by `readLaunchEnv` below and NOT into
|
|
10
|
+
* `partial`: none of them is a persisted key (D-1 / 5.), so a value there
|
|
11
|
+
* would be one save away from landing in `config.json`.
|
|
7
12
|
* - Overrides: ARAGON_PROVIDER, ARAGON_MODEL, ARAGON_BASE_URL, ARAGON_THINKING,
|
|
8
13
|
* ARAGON_SHOW_THINKING,
|
|
9
14
|
* ARAGON_MAX_TOKENS (a number, or `auto` / `0` for the per-model ceiling),
|
|
@@ -74,6 +79,11 @@ export function enableManagedConfig() {
|
|
|
74
79
|
for (const name of [
|
|
75
80
|
'ARAGON_PROVIDER', 'ARAGON_MODEL', 'ARAGON_BASE_URL', 'ARAGON_FAST',
|
|
76
81
|
'ARAGON_FAST_PROVIDER', 'ARAGON_FAST_MODEL', 'ARAGON_FAST_BASE_URL',
|
|
82
|
+
// The launch-selection layer belongs to the same scrub: a child CLI must
|
|
83
|
+
// not inherit the parent's kit selection, exactly like the model overrides
|
|
84
|
+
// beside it, or an embedded host would silently change its child's model.
|
|
85
|
+
'ARAGON_KIT', 'ARAGON_PROFILE', 'ARAGON_FAST_PROFILE',
|
|
86
|
+
'ARAGON_SUBAGENT_MODEL', 'ARAGON_SUBAGENT_PROFILE',
|
|
77
87
|
...Object.values(PROVIDER_ENV_KEYS).flat(),
|
|
78
88
|
]) {
|
|
79
89
|
delete process.env[name];
|
|
@@ -87,6 +97,43 @@ function firstEnv(names) {
|
|
|
87
97
|
}
|
|
88
98
|
return undefined;
|
|
89
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Read the launch-selection overrides.
|
|
102
|
+
*
|
|
103
|
+
* ABSENT MEANS ABSENT: no defaults and no validation here. A misspelt value
|
|
104
|
+
* degrades with a warning in `resolveLaunchSelection` rather than throwing,
|
|
105
|
+
* because "one typo in an environment variable and the CLI will not start"
|
|
106
|
+
* is an unacceptable failure direction on the launch path (4.3).
|
|
107
|
+
*/
|
|
108
|
+
export function readLaunchEnv() {
|
|
109
|
+
const take = (name) => {
|
|
110
|
+
const value = process.env[name]?.trim();
|
|
111
|
+
return value ? value : undefined;
|
|
112
|
+
};
|
|
113
|
+
const out = {};
|
|
114
|
+
const kit = take('ARAGON_KIT');
|
|
115
|
+
if (kit)
|
|
116
|
+
out.kit = kit;
|
|
117
|
+
const profile = take('ARAGON_PROFILE');
|
|
118
|
+
if (profile)
|
|
119
|
+
out.profile = profile;
|
|
120
|
+
const fastProfile = take('ARAGON_FAST_PROFILE');
|
|
121
|
+
if (fastProfile)
|
|
122
|
+
out.fastProfile = fastProfile;
|
|
123
|
+
const subagentModel = take('ARAGON_SUBAGENT_MODEL');
|
|
124
|
+
if (subagentModel)
|
|
125
|
+
out.subagentModel = subagentModel;
|
|
126
|
+
const subagentProfile = take('ARAGON_SUBAGENT_PROFILE');
|
|
127
|
+
if (subagentProfile)
|
|
128
|
+
out.subagentProfile = subagentProfile;
|
|
129
|
+
const model = take('ARAGON_MODEL');
|
|
130
|
+
if (model)
|
|
131
|
+
out.model = model;
|
|
132
|
+
const provider = take('ARAGON_PROVIDER');
|
|
133
|
+
if (provider)
|
|
134
|
+
out.provider = provider;
|
|
135
|
+
return out;
|
|
136
|
+
}
|
|
90
137
|
/**
|
|
91
138
|
* Read ARAGON_* overrides and provider secrets from the current environment.
|
|
92
139
|
* Must be called after `loadDotenv()` so `.env` values are visible.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one-line launch notice (launch-model-and-kit-flags §2.5 / P1-7).
|
|
3
|
+
*
|
|
4
|
+
* ASCII ONLY - `src/config/**` is inside `glyphs.test.ts::inScope`.
|
|
5
|
+
*
|
|
6
|
+
* TWO RULES DECIDE EVERYTHING HERE.
|
|
7
|
+
*
|
|
8
|
+
* 1. THE NOTICE IS LOGICALLY ONE LINE AND PHYSICALLY BOUNDED. The full sentence is
|
|
9
|
+
* about 95 characters, so on an 80-column terminal "one line, never wrapped" is
|
|
10
|
+
* not something a renderer can promise - the terminal decides. What this module
|
|
11
|
+
* can promise is a 76-column budget (80 minus a 4-column safety margin), and the
|
|
12
|
+
* acceptance criterion in §6.3 is written against that budget rather than
|
|
13
|
+
* against a wrap the code cannot control.
|
|
14
|
+
*
|
|
15
|
+
* 2. THE KIT NAME IS NEVER TRUNCATED. It is the one token the user typed and the
|
|
16
|
+
* one thing they must be able to verify; everything else is evidence. So the
|
|
17
|
+
* dropping order is: the "unchanged" clauses first, then the subagent clause,
|
|
18
|
+
* and only then is the main connection shortened to `provider:...`.
|
|
19
|
+
*
|
|
20
|
+
* The rendering of a kit's slots is NOT re-implemented here - `describeKit()` in
|
|
21
|
+
* `commands/kit-command.ts` produces `main a:b / sub same as main / fast off`, and
|
|
22
|
+
* this module composes those same three fragments. `--kit cheap` and `/kit use
|
|
23
|
+
* cheap` must describe the same kit the same way (§2.5).
|
|
24
|
+
*/
|
|
25
|
+
import type { LaunchSelectionView } from '@aragon-agent/tui/model/config/launch-selection';
|
|
26
|
+
/**
|
|
27
|
+
* What an 80-column terminal gets: 80 minus a 4-column safety margin (P1-7).
|
|
28
|
+
*
|
|
29
|
+
* IT IS THE REFERENCE VALUE, NOT A CEILING. The budget follows
|
|
30
|
+
* `process.stdout.columns`, so a wide window keeps the full sentence instead
|
|
31
|
+
* of being held to the smallest common width - capping here would discard the
|
|
32
|
+
* `fast off` clause on a 200-column terminal for no reason at all.
|
|
33
|
+
*/
|
|
34
|
+
export declare const NOTICE_BUDGET_COLUMNS = 76;
|
|
35
|
+
/**
|
|
36
|
+
* Format the notice, or `null` when this launch has nothing to announce.
|
|
37
|
+
*
|
|
38
|
+
* `origin` is the gate: a kit inherited from `config.json` was not a command the
|
|
39
|
+
* user just typed, and announcing it on every launch would be noise (§2.5).
|
|
40
|
+
*/
|
|
41
|
+
export declare function formatLaunchNotice(view: LaunchSelectionView | undefined, columns: number | undefined): string | null;
|
|
42
|
+
/**
|
|
43
|
+
* The budget for this terminal: its width minus 4, floored at 40 (P1-7).
|
|
44
|
+
*
|
|
45
|
+
* 80 is the fallback when the width is unknown (a redirected stdout), and 40 is
|
|
46
|
+
* the floor because below that even `Kit "x" applied` cannot be printed
|
|
47
|
+
* honestly - a notice nobody can read is worse than a short one.
|
|
48
|
+
*/
|
|
49
|
+
export declare function resolveBudget(columns: number | undefined): number;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the notice may be written at all (§2.5, two independent gates).
|
|
52
|
+
*
|
|
53
|
+
* BOTH EXIST SO A PIPE STAYS CLEAN WITHOUT ANY FLAG: `--quiet` is the explicit
|
|
54
|
+
* switch, and a non-TTY stdout is the automatic one - machine-readable output must
|
|
55
|
+
* never gain a human sentence because someone upgraded the CLI.
|
|
56
|
+
*/
|
|
57
|
+
export declare function shouldAnnounce(input: {
|
|
58
|
+
quiet: boolean;
|
|
59
|
+
isTTY: boolean;
|
|
60
|
+
notice: string | null;
|
|
61
|
+
}): boolean;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one-line launch notice (launch-model-and-kit-flags §2.5 / P1-7).
|
|
3
|
+
*
|
|
4
|
+
* ASCII ONLY - `src/config/**` is inside `glyphs.test.ts::inScope`.
|
|
5
|
+
*
|
|
6
|
+
* TWO RULES DECIDE EVERYTHING HERE.
|
|
7
|
+
*
|
|
8
|
+
* 1. THE NOTICE IS LOGICALLY ONE LINE AND PHYSICALLY BOUNDED. The full sentence is
|
|
9
|
+
* about 95 characters, so on an 80-column terminal "one line, never wrapped" is
|
|
10
|
+
* not something a renderer can promise - the terminal decides. What this module
|
|
11
|
+
* can promise is a 76-column budget (80 minus a 4-column safety margin), and the
|
|
12
|
+
* acceptance criterion in §6.3 is written against that budget rather than
|
|
13
|
+
* against a wrap the code cannot control.
|
|
14
|
+
*
|
|
15
|
+
* 2. THE KIT NAME IS NEVER TRUNCATED. It is the one token the user typed and the
|
|
16
|
+
* one thing they must be able to verify; everything else is evidence. So the
|
|
17
|
+
* dropping order is: the "unchanged" clauses first, then the subagent clause,
|
|
18
|
+
* and only then is the main connection shortened to `provider:...`.
|
|
19
|
+
*
|
|
20
|
+
* The rendering of a kit's slots is NOT re-implemented here - `describeKit()` in
|
|
21
|
+
* `commands/kit-command.ts` produces `main a:b / sub same as main / fast off`, and
|
|
22
|
+
* this module composes those same three fragments. `--kit cheap` and `/kit use
|
|
23
|
+
* cheap` must describe the same kit the same way (§2.5).
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* What an 80-column terminal gets: 80 minus a 4-column safety margin (P1-7).
|
|
27
|
+
*
|
|
28
|
+
* IT IS THE REFERENCE VALUE, NOT A CEILING. The budget follows
|
|
29
|
+
* `process.stdout.columns`, so a wide window keeps the full sentence instead
|
|
30
|
+
* of being held to the smallest common width - capping here would discard the
|
|
31
|
+
* `fast off` clause on a 200-column terminal for no reason at all.
|
|
32
|
+
*/
|
|
33
|
+
export const NOTICE_BUDGET_COLUMNS = 76;
|
|
34
|
+
function connectionOf(provider, model) {
|
|
35
|
+
if (!provider && !model)
|
|
36
|
+
return 'not set';
|
|
37
|
+
if (!provider)
|
|
38
|
+
return model ?? 'not set';
|
|
39
|
+
if (!model)
|
|
40
|
+
return provider;
|
|
41
|
+
return `${provider}:${model}`;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The same words `describeKit()` uses, derived from the selection view.
|
|
45
|
+
*
|
|
46
|
+
* DERIVED FROM THE VIEW, NOT RE-READ FROM THE LIBRARY: `loadConfig()` already ran
|
|
47
|
+
* the whole ladder, and a second lookup here could disagree with what was actually
|
|
48
|
+
* applied - the "two truths" failure this feature is built to avoid.
|
|
49
|
+
*/
|
|
50
|
+
function fragmentsOf(view) {
|
|
51
|
+
const { main, fast, subagent } = view.slots;
|
|
52
|
+
const sub = subagent.mode === 'main' ? 'same as main'
|
|
53
|
+
: subagent.mode === 'fast' ? 'fast tier'
|
|
54
|
+
: subagent.mode === 'profile' && subagent.model
|
|
55
|
+
? `profile ${subagent.model}` : 'main slot';
|
|
56
|
+
return {
|
|
57
|
+
main: connectionOf(main.provider, main.model),
|
|
58
|
+
sub,
|
|
59
|
+
// `fast off` is a real answer for a kit that turns the tier off (D-8).
|
|
60
|
+
fast: fast.model === 'off' ? 'off' : connectionOf(fast.provider, fast.model),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The sentence. `compact` shortens the FRAME, never the kit name.
|
|
65
|
+
*
|
|
66
|
+
* THE FRAME HAS TO BE ABLE TO SHRINK: at 40 columns
|
|
67
|
+
* `Kit "name" applied for this session (...)` is already about 40 characters
|
|
68
|
+
* before a single slot is printed, so a ladder that only drops clauses cannot
|
|
69
|
+
* honour the budget - it would either wrap (what P1-7 forbids) or overflow.
|
|
70
|
+
*/
|
|
71
|
+
function compose(kitName, fragments, include) {
|
|
72
|
+
const parts = [fragments.main];
|
|
73
|
+
if (include.sub)
|
|
74
|
+
parts.push(`sub ${fragments.sub}`);
|
|
75
|
+
if (include.fast)
|
|
76
|
+
parts.push(`fast ${fragments.fast}`);
|
|
77
|
+
const frame = include.compact
|
|
78
|
+
? `Kit "${kitName}" applied`
|
|
79
|
+
: `Kit "${kitName}" applied for this session`;
|
|
80
|
+
return `${frame} (${parts.join(' / ')}).`;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Format the notice, or `null` when this launch has nothing to announce.
|
|
84
|
+
*
|
|
85
|
+
* `origin` is the gate: a kit inherited from `config.json` was not a command the
|
|
86
|
+
* user just typed, and announcing it on every launch would be noise (§2.5).
|
|
87
|
+
*/
|
|
88
|
+
export function formatLaunchNotice(view, columns) {
|
|
89
|
+
if (!view || !view.kit)
|
|
90
|
+
return null;
|
|
91
|
+
if (view.origin !== 'flag' && view.origin !== 'env')
|
|
92
|
+
return null;
|
|
93
|
+
const budget = resolveBudget(columns);
|
|
94
|
+
const name = view.kit.name;
|
|
95
|
+
const fragments = fragmentsOf(view);
|
|
96
|
+
const full = compose(name, fragments, { sub: true, fast: true });
|
|
97
|
+
if (full.length <= budget)
|
|
98
|
+
return full;
|
|
99
|
+
// 1. Drop the "no change" tail: a fast tier that is off tells the user nothing.
|
|
100
|
+
const withoutFast = compose(name, fragments, { sub: true, fast: fragments.fast !== 'off' });
|
|
101
|
+
if (withoutFast.length <= budget)
|
|
102
|
+
return withoutFast;
|
|
103
|
+
// 2. Drop the subagent clause.
|
|
104
|
+
const mainOnly = compose(name, fragments, { sub: false, fast: false });
|
|
105
|
+
if (mainOnly.length <= budget)
|
|
106
|
+
return mainOnly;
|
|
107
|
+
// 3. Shorten the FRAME, then 4. the connection. The kit name survives both, and
|
|
108
|
+
// these two steps are what make a 40-column terminal honour the budget at all.
|
|
109
|
+
const compact = compose(name, fragments, { sub: false, fast: false, compact: true });
|
|
110
|
+
if (compact.length <= budget)
|
|
111
|
+
return compact;
|
|
112
|
+
return compose(name, { ...fragments, main: 'provider:...' }, { sub: false, fast: false, compact: true });
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The budget for this terminal: its width minus 4, floored at 40 (P1-7).
|
|
116
|
+
*
|
|
117
|
+
* 80 is the fallback when the width is unknown (a redirected stdout), and 40 is
|
|
118
|
+
* the floor because below that even `Kit "x" applied` cannot be printed
|
|
119
|
+
* honestly - a notice nobody can read is worse than a short one.
|
|
120
|
+
*/
|
|
121
|
+
export function resolveBudget(columns) {
|
|
122
|
+
const width = columns && columns > 0 ? columns : 80;
|
|
123
|
+
return Math.max(40, width - 4);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Whether the notice may be written at all (§2.5, two independent gates).
|
|
127
|
+
*
|
|
128
|
+
* BOTH EXIST SO A PIPE STAYS CLEAN WITHOUT ANY FLAG: `--quiet` is the explicit
|
|
129
|
+
* switch, and a non-TTY stdout is the automatic one - machine-readable output must
|
|
130
|
+
* never gain a human sentence because someone upgraded the CLI.
|
|
131
|
+
*/
|
|
132
|
+
export function shouldAnnounce(input) {
|
|
133
|
+
if (!input.notice)
|
|
134
|
+
return false;
|
|
135
|
+
if (input.quiet)
|
|
136
|
+
return false;
|
|
137
|
+
return input.isTTY;
|
|
138
|
+
}
|
package/dist/config/load.d.ts
CHANGED
|
@@ -305,6 +305,26 @@ export interface CliFlags {
|
|
|
305
305
|
resumeSession?: string;
|
|
306
306
|
/** `--save <id>` - name THIS run's persistent session and pin it. */
|
|
307
307
|
saveSessionAs?: string;
|
|
308
|
+
/** `--kit <name|#id|id>` - run this session on that kit. */
|
|
309
|
+
kit?: string;
|
|
310
|
+
/** `--no-kit` - ignore the persisted default kit for this session. */
|
|
311
|
+
noKit?: boolean;
|
|
312
|
+
/**
|
|
313
|
+
* `--kit` and `--no-kit` were BOTH typed (2.4 / C-3).
|
|
314
|
+
*
|
|
315
|
+
* Set from argv by `isKitFlagConflict()`: commander folds the pair into a
|
|
316
|
+
* single `kit: false`, so the value of `--kit` is gone and the parsed options
|
|
317
|
+
* cannot tell the pair apart from a lone `--no-kit`.
|
|
318
|
+
*/
|
|
319
|
+
kitConflict?: boolean;
|
|
320
|
+
/** `--profile <name|#id|id>` - main slot only. */
|
|
321
|
+
profile?: string;
|
|
322
|
+
/** `--fast-profile <name|#id|id>` - fast slot only. */
|
|
323
|
+
fastProfile?: string;
|
|
324
|
+
/** `--subagent-model <main|fast|profile>` - the subagent slot's mode. */
|
|
325
|
+
subagentModel?: string;
|
|
326
|
+
/** `--subagent-profile <name|#id|id>` - what `profile` mode binds to. */
|
|
327
|
+
subagentProfile?: string;
|
|
308
328
|
}
|
|
309
329
|
/**
|
|
310
330
|
* Resolve the effective config by merging all layers, then derive the runtime
|
package/dist/config/load.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import process from 'node:process';
|
|
9
9
|
import { DEFAULT_CONFIG, DEFAULT_SCROLL_MODE, IDLE_TIMEOUT_MARGIN_MS, clampDensity, clampHumanTimeout, clampCompactionConfig, clampLogConfig, clampFastConfig, clampRetryConfig, clampSkillsConfig, clampTeamConfig, clampTodoConfig, clampBashConfig, clampJobsConfig, clampPromptsConfig, clampMemoryConfig, clampRedTeamConfig, clampGeneConfig, clampTaskSummaryConfig, clampUpdateConfig, clampTheme, clampThinkingLevel, clampContextWindow, clampMaxTokens, clampMaxRenderInterval, clampScrollMode, clampScrollResumeMs, clampTranscriptRetain, clampTranscriptWindow, coercePositiveInt, isAutoToken, isSkillsToolPolicyMode, legacyMemoryAutonomyPatch, legacyTeamCeilingPatch, legacyTeamFanoutPatch, LEGACY_TEAM_FANOUT_DEFAULTS, parseThresholdInput, } from '@aragon-agent/tui/model/config/schema';
|
|
10
|
-
import { loadDotenv, readEnvConfig, readEnvDisabledSkills } from './env.js';
|
|
10
|
+
import { loadDotenv, readEnvConfig, readEnvDisabledSkills, readLaunchEnv } from './env.js';
|
|
11
11
|
import { readConfigFile, updatePersistedConfig } from './store.js';
|
|
12
12
|
import { projectModelProfiles, resolveModelProfileState, resolveModelRoleKey, } from '@aragon-agent/tui/model/config/model-profile-resolution';
|
|
13
13
|
import { getConfigPath } from './app-paths.js';
|
|
@@ -18,6 +18,8 @@ import { resolveGovernanceConfig, resolveInitialPosture } from '@aragon-agent/tu
|
|
|
18
18
|
import { getLogger } from '../logging/logger.js';
|
|
19
19
|
import { registerSecret, registerSecretsFrom } from '@aragon-agent/tui/model/logging/secret-registry';
|
|
20
20
|
import { detectCapabilities, resolveTuiCapabilities } from '@aragon-agent/tui/ui/capabilities';
|
|
21
|
+
import { applyHeldToLive } from '@aragon-agent/tui/model/config/kit-resolution';
|
|
22
|
+
import { resolveLaunchSelection } from '@aragon-agent/tui/model/config/launch-selection';
|
|
21
23
|
/** Interpret a boolean-ish env value (`1/true/on/yes`) as `true`. */
|
|
22
24
|
function envFlagTrue(value) {
|
|
23
25
|
if (!value)
|
|
@@ -387,6 +389,46 @@ function resolveLogConfig(flags, env, file) {
|
|
|
387
389
|
// ---------------------------------------------------------------------------
|
|
388
390
|
// loadConfig
|
|
389
391
|
// ---------------------------------------------------------------------------
|
|
392
|
+
/**
|
|
393
|
+
* The launch-selection subset of `CliFlags`, copied field by field.
|
|
394
|
+
*
|
|
395
|
+
* A SHAPED OBJECT rather than `flags` itself, so the pure resolver cannot read a
|
|
396
|
+
* key it was not promised: `LaunchFlagsInput` is the contract, and widening the
|
|
397
|
+
* resolver's input has to be a deliberate edit in two files (3.4 / 5.1).
|
|
398
|
+
*/
|
|
399
|
+
function launchFlagsOf(flags) {
|
|
400
|
+
return { kit: flags.kit, noKit: flags.noKit, kitConflict: flags.kitConflict,
|
|
401
|
+
profile: flags.profile,
|
|
402
|
+
fastProfile: flags.fastProfile, subagentModel: flags.subagentModel,
|
|
403
|
+
subagentProfile: flags.subagentProfile, model: flags.model,
|
|
404
|
+
provider: flags.provider, baseUrl: flags.baseUrl, fastModel: flags.fastModel,
|
|
405
|
+
fastProvider: flags.fastProvider };
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Join the resolver's Step C patch onto the file layer (3.4).
|
|
409
|
+
*
|
|
410
|
+
* THE KIT ITSELF NEVER JOINS HERE (P0-1 / C-1). Step C's patch is applied first;
|
|
411
|
+
* the kit then reaches the config through `applyHeldToLive()`, whose documented
|
|
412
|
+
* contract is that its return may only ever feed a LIVE candidate - which is
|
|
413
|
+
* exactly what this function is: the effective layer for THIS process, never
|
|
414
|
+
* something handed to `commitModelSettings`.
|
|
415
|
+
*
|
|
416
|
+
* The re-projection is load-bearing: `applyHeldToLive` moves the ROLE BINDINGS
|
|
417
|
+
* (`mainId` / `fastId`) and the `fast` / `team` sections, so `provider` / `model`
|
|
418
|
+
* / `baseUrl` only catch up after `projectModelProfiles` reads those bindings
|
|
419
|
+
* again. Skipping it would leave the kit's main binding recorded while the
|
|
420
|
+
* effective model still named the file's - the "two truths" I-7 forbids.
|
|
421
|
+
*/
|
|
422
|
+
function withLaunchSelection(file, launch) {
|
|
423
|
+
const candidate = { ...file, ...launch.patch };
|
|
424
|
+
if (!launch.sessionKit || launch.fatal)
|
|
425
|
+
return candidate;
|
|
426
|
+
const applied = applyHeldToLive(candidate, launch.sessionKit);
|
|
427
|
+
if (applied.dropped.length) {
|
|
428
|
+
getLogger().warn('config', 'launch_selection_slots_dropped', { slots: applied.dropped });
|
|
429
|
+
}
|
|
430
|
+
return projectModelProfiles(applied.candidate).file;
|
|
431
|
+
}
|
|
390
432
|
function pick(...vals) {
|
|
391
433
|
for (const v of vals) {
|
|
392
434
|
if (v !== undefined && v !== null && v !== '')
|
|
@@ -612,8 +654,22 @@ export function loadConfig(flags = {}, options = {}) {
|
|
|
612
654
|
// is the thing a reader has to see.
|
|
613
655
|
migrateLegacyMemoryAutonomy(read.config);
|
|
614
656
|
const projection = projectModelProfiles(read.config ?? {});
|
|
615
|
-
const file = projection.file;
|
|
616
657
|
const env = readEnvConfig();
|
|
658
|
+
// THE ONE JOIN FOR FLAGS + ENV + FILE, extended by one step rather than
|
|
659
|
+
// duplicated: the launch-selection resolver is a PURE function, and its two
|
|
660
|
+
// products reach the rest of this function through `file` (the effective
|
|
661
|
+
// layer) exactly like every other key.
|
|
662
|
+
//
|
|
663
|
+
// IT DOES NOT WRITE ANYTHING (P0-1 / I-3): a kit's three slot values arrive as
|
|
664
|
+
// `sessionKit = { id, held }` and are applied by `applyHeldToLive`, which may
|
|
665
|
+
// only ever feed a LIVE candidate. Nothing here touches the store.
|
|
666
|
+
const launch = resolveLaunchSelection({
|
|
667
|
+
flags: launchFlagsOf(flags),
|
|
668
|
+
env: readLaunchEnv(),
|
|
669
|
+
file: projection.file,
|
|
670
|
+
library: projection.issues.length ? undefined : projection.file.modelProfiles,
|
|
671
|
+
});
|
|
672
|
+
const file = withLaunchSelection(projection.file, launch);
|
|
617
673
|
if (read.parseError) {
|
|
618
674
|
getLogger().error('config', 'config_parse_failed', { error: read.parseError });
|
|
619
675
|
}
|
|
@@ -875,6 +931,20 @@ export function loadConfig(flags = {}, options = {}) {
|
|
|
875
931
|
apiKeyOverride: flags.apiKey && flags.apiKey.trim().length > 0 ? flags.apiKey.trim() : undefined,
|
|
876
932
|
};
|
|
877
933
|
config.modelProfileState = resolveModelProfileState(config, config.modelProfiles, projection.issues.length > 0);
|
|
934
|
+
// CONDITIONAL ASSIGNMENT, never an unconditional write: a launch with no
|
|
935
|
+
// selection flags must produce an object shape identical to a pre-feature
|
|
936
|
+
// build (I-1), which is also why `launchSelection` is published only when the
|
|
937
|
+
// user actually ASKED for a kit (origin flag/env) - that is the same set §2.5
|
|
938
|
+
// prints a notice for, so "shown" and "reported" cannot disagree.
|
|
939
|
+
if (launch.sessionKit)
|
|
940
|
+
config.sessionKit = launch.sessionKit;
|
|
941
|
+
if (launch.suppressDefaultKit)
|
|
942
|
+
config.suppressDefaultKit = true;
|
|
943
|
+
if (launch.view.origin === 'flag' || launch.view.origin === 'env') {
|
|
944
|
+
config.launchSelection = launch.view;
|
|
945
|
+
}
|
|
946
|
+
if (launch.fatal)
|
|
947
|
+
config.launchFatal = launch.fatal;
|
|
878
948
|
if (config.apiKeyOverride && (config.modelProfiles?.mainId || config.modelProfiles?.fastId)) {
|
|
879
949
|
config.apiKeyOverrideTarget = { provider, baseUrl: baseUrl?.trim() || null };
|
|
880
950
|
}
|
|
@@ -21,6 +21,34 @@ export interface ExecInfo {
|
|
|
21
21
|
provider: string;
|
|
22
22
|
model: string;
|
|
23
23
|
hasApiKey: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* How THIS launch resolved the three model slots (launch-model-and-kit-flags 4.2).
|
|
26
|
+
*
|
|
27
|
+
* A WARNING-SHAPED FIELD IN A REPORT: `slots[x].source` answers "why is this
|
|
28
|
+
* slot this model" with an enum rather than prose, which is the one thing CI
|
|
29
|
+
* cannot get out of the human start-up line. `origin: 'none'` means launch had
|
|
30
|
+
* nothing to report - a plain `aragon info` with no selection flags - and is
|
|
31
|
+
* still present so a script never has to distinguish "absent" from "default".
|
|
32
|
+
*
|
|
33
|
+
* READ-ONLY (I-5): nothing may feed this back into resolution.
|
|
34
|
+
*/
|
|
35
|
+
modelSelection: {
|
|
36
|
+
origin: string;
|
|
37
|
+
kit: {
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
} | null;
|
|
41
|
+
held: string[];
|
|
42
|
+
suppressDefault: boolean;
|
|
43
|
+
slots: Record<string, {
|
|
44
|
+
source: string;
|
|
45
|
+
provider: string | null;
|
|
46
|
+
model: string | null;
|
|
47
|
+
baseUrl: string | null;
|
|
48
|
+
mode?: string;
|
|
49
|
+
}>;
|
|
50
|
+
warnings: string[];
|
|
51
|
+
};
|
|
24
52
|
tools: string[];
|
|
25
53
|
outputFormats: string[];
|
|
26
54
|
inputFormats: string[];
|
package/dist/diagnostics/info.js
CHANGED
|
@@ -15,6 +15,7 @@ import { readFileSync } from 'node:fs';
|
|
|
15
15
|
import process from 'node:process';
|
|
16
16
|
import { getConfigPath, getSessionsDir, getUserDataDir } from '../config/app-paths.js';
|
|
17
17
|
import { loadConfig, makeGetApiKey } from '../config/load.js';
|
|
18
|
+
import { resolveActiveKit } from '@aragon-agent/tui/model/config/kit-resolution';
|
|
18
19
|
import { CALLER_GATED_TOOLS, HOST_TOOL_NAMES } from '../tools/index.js';
|
|
19
20
|
import { BRIDGE_CAPABILITIES, BRIDGE_PROTOCOL_VERSION } from '../exec/bridge/protocol.js';
|
|
20
21
|
import { BRIDGE_LIMITS } from '../exec/bridge/limits.js';
|
|
@@ -40,6 +41,41 @@ const FEATURES = [
|
|
|
40
41
|
'skills',
|
|
41
42
|
'fast',
|
|
42
43
|
];
|
|
44
|
+
/**
|
|
45
|
+
* The `modelSelection` block, derived from the RESOLVED config (4.2 / I-4).
|
|
46
|
+
*
|
|
47
|
+
* THREE SOURCES, IN THIS ORDER, and none of them is a second parser:
|
|
48
|
+
* - `config.launchSelection` when the launch actually selected something;
|
|
49
|
+
* - `resolveActiveKit()`, so `held` / `kit` agree with the header chip even when
|
|
50
|
+
* the selection came from `config.json` (3.26 asserts exactly this equality);
|
|
51
|
+
* - the config's own scalars, for a plain run that had nothing to report.
|
|
52
|
+
*
|
|
53
|
+
* `origin: 'none'` IS REPORTED, NOT OMITTED: a script that wants "did launch
|
|
54
|
+
* selection do anything" should read one boolean, not branch on a missing key.
|
|
55
|
+
*/
|
|
56
|
+
function modelSelectionOf(config) {
|
|
57
|
+
const active = resolveActiveKit(config);
|
|
58
|
+
const selection = config.launchSelection;
|
|
59
|
+
const slot = (source, provider, model, baseUrl, mode) => ({ source, provider, model, baseUrl: baseUrl ?? null,
|
|
60
|
+
...(mode === undefined ? {} : { mode }) });
|
|
61
|
+
const slots = selection
|
|
62
|
+
? { main: slot(selection.slots.main.source, selection.slots.main.provider, selection.slots.main.model, selection.slots.main.baseUrl),
|
|
63
|
+
fast: slot(selection.slots.fast.source, selection.slots.fast.provider, selection.slots.fast.model, selection.slots.fast.baseUrl),
|
|
64
|
+
subagent: slot(selection.slots.subagent.source, selection.slots.subagent.provider, selection.slots.subagent.model, selection.slots.subagent.baseUrl, selection.slots.subagent.mode) }
|
|
65
|
+
// A run with no selection flags reports the EFFECTIVE values with the source
|
|
66
|
+
// that the kit resolver already decided, so the answer is never "unknown".
|
|
67
|
+
: { main: slot(active.source === 'none' ? 'file' : active.source, config.provider, config.model, config.baseUrl ?? null),
|
|
68
|
+
fast: slot(active.source === 'none' ? 'file' : active.source, config.fast.provider || null, config.fast.enabled ? config.fast.model : 'off', config.fast.baseUrl || null),
|
|
69
|
+
subagent: slot(active.source === 'none' ? 'file' : active.source, null, null, null, config.team.model) };
|
|
70
|
+
return {
|
|
71
|
+
origin: selection?.origin ?? (active.source === 'default' ? 'default' : 'none'),
|
|
72
|
+
kit: active.id ? { id: active.id, name: active.name } : null,
|
|
73
|
+
held: [...active.held],
|
|
74
|
+
suppressDefault: config.suppressDefaultKit === true,
|
|
75
|
+
slots,
|
|
76
|
+
warnings: selection ? [...selection.warnings] : [],
|
|
77
|
+
};
|
|
78
|
+
}
|
|
43
79
|
export function buildInfo(flags, version) {
|
|
44
80
|
const config = loadConfig(flags);
|
|
45
81
|
const getKey = makeGetApiKey(config);
|
|
@@ -54,6 +90,11 @@ export function buildInfo(flags, version) {
|
|
|
54
90
|
provider: config.provider,
|
|
55
91
|
model: config.model,
|
|
56
92
|
hasApiKey: Boolean(getKey(config.provider)),
|
|
93
|
+
// THE SAME OBJECT THE LAUNCH USED, re-derived from the resolved config rather
|
|
94
|
+
// than re-parsed from the flags (I-4 / 3.26). Re-parsing here would let
|
|
95
|
+
// `aragon info` answer for a launch that never happened - and a second parse
|
|
96
|
+
// is exactly the "two truths" this design refuses.
|
|
97
|
+
modelSelection: modelSelectionOf(config),
|
|
57
98
|
// THE SUPERSET, not "what a run would register right now". This answers
|
|
58
99
|
// "which names can `--allow-tool` take?", which is exactly what
|
|
59
100
|
// `HOST_TOOL_NAMES` means and exactly what `--allow-tool` validates against.
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
import { type Command } from 'commander';
|
|
20
20
|
import type { CliFlags } from '../config/load.js';
|
|
21
21
|
import { type ExecControllerFactory } from './index.js';
|
|
22
|
+
import type { RawExecOptions } from './options.js';
|
|
22
23
|
export interface ExecCommandDeps {
|
|
23
24
|
version: string;
|
|
24
25
|
/**
|
|
@@ -29,3 +30,26 @@ export interface ExecCommandDeps {
|
|
|
29
30
|
makeController: ExecControllerFactory;
|
|
30
31
|
}
|
|
31
32
|
export declare function registerExecCommand(program: Command, toFlags: (opts: Record<string, unknown>) => CliFlags, deps: ExecCommandDeps): void;
|
|
33
|
+
/**
|
|
34
|
+
* Hand the launch-selection flags from `exec`'s own options to `toFlags` (3.7).
|
|
35
|
+
*
|
|
36
|
+
* `toFlags(program.opts())` reads the ROOT program, and these six are declared on
|
|
37
|
+
* the `exec` SUBCOMMAND - so without this merge all six parse and do nothing, the
|
|
38
|
+
* "inert flag, no compile error, no runtime error" trap this package has recorded
|
|
39
|
+
* a dozen times, and the one 3.8 exists to prevent.
|
|
40
|
+
*
|
|
41
|
+
* THESE SIX AND NOT `...opts`: `RawExecOptions` reuses root names for different
|
|
42
|
+
* meanings (`--resume` here is a session file, while `CliFlags.resumeSession` is
|
|
43
|
+
* the TUI's new-branch flag), so a blanket spread would silently re-point a flag
|
|
44
|
+
* that has nothing to do with launch selection.
|
|
45
|
+
*
|
|
46
|
+
* ONLY A SUBCOMMAND VALUE WINS, AND `undefined` IS NOT A VALUE.
|
|
47
|
+
* `packages/cli/README.md` promises the two positions are equivalent
|
|
48
|
+
* (`aragon --model m exec "..."` and `aragon exec --model m "..."` parse alike),
|
|
49
|
+
* and a blanket `{ ...rootOpts, kit: execOpts.kit }` would break that promise for
|
|
50
|
+
* these six: `aragon --kit cheap exec "..."` would have its root value overwritten
|
|
51
|
+
* with the subcommand's `undefined` and the kit would silently not apply - the
|
|
52
|
+
* same inert-flag trap, one layer up.
|
|
53
|
+
* `false` IS a value here, because `--no-kit` arrives folded as `kit: false`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function mergeLaunchSelectionFlags(rootOpts: Record<string, unknown>, execOpts: Pick<RawExecOptions, 'kit' | 'profile' | 'fastProfile' | 'subagentModel' | 'subagentProfile'>): Record<string, unknown>;
|