@aragon-agent/cli 0.6.52 → 0.6.54
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 +38 -0
- package/README.md +4042 -3982
- package/dist/agent/controller.d.ts +26 -0
- package/dist/agent/controller.js +129 -1
- package/dist/agent/system-prompt.d.ts +14 -0
- package/dist/agent/system-prompt.js +3 -0
- package/dist/app/App.d.ts +7 -0
- package/dist/app/App.js +135 -6
- package/dist/cli.js +25 -1
- package/dist/commands/builtins.js +10 -0
- package/dist/commands/catalog.js +1 -0
- package/dist/commands/registry.d.ts +7 -0
- package/dist/compaction/compactor.d.ts +26 -0
- package/dist/compaction/compactor.js +81 -8
- package/dist/compaction/summarize-call.d.ts +22 -0
- package/dist/compaction/summarize-call.js +29 -0
- package/dist/compaction/wiring.js +22 -3
- package/dist/config/app-paths.d.ts +13 -0
- package/dist/config/app-paths.js +15 -0
- package/dist/config/cli-commands.d.ts +15 -0
- package/dist/config/cli-commands.js +32 -1
- package/dist/config/env.d.ts +1 -0
- package/dist/config/env.js +11 -0
- package/dist/config/load.d.ts +6 -0
- package/dist/config/load.js +10 -1
- package/dist/config/store.js +10 -1
- package/dist/exec/bridge/server.js +9 -2
- package/dist/exec/options.js +16 -2
- package/dist/governance/prompts/orchestrator-block.js +2 -2
- package/dist/host/controller-factory.d.ts +25 -0
- package/dist/host/controller-factory.js +7 -0
- package/dist/host/follow-up-seed.d.ts +109 -0
- package/dist/host/follow-up-seed.js +196 -0
- package/dist/host/follow-up.d.ts +73 -0
- package/dist/host/follow-up.js +123 -0
- package/dist/host/index.d.ts +3 -0
- package/dist/host/index.js +3 -0
- package/dist/host/memory.d.ts +21 -0
- package/dist/host/memory.js +17 -0
- package/dist/host/sessions.d.ts +32 -2
- package/dist/host/sessions.js +40 -2
- package/dist/logging/install.d.ts +1 -0
- package/dist/logging/install.js +4 -0
- package/dist/logging/logger.d.ts +1 -1
- package/dist/memory/block.d.ts +24 -0
- package/dist/memory/block.js +54 -0
- package/dist/memory/command.d.ts +31 -0
- package/dist/memory/command.js +350 -0
- package/dist/memory/format.d.ts +51 -0
- package/dist/memory/format.js +308 -0
- package/dist/memory/paths.d.ts +68 -0
- package/dist/memory/paths.js +172 -0
- package/dist/memory/plan.d.ts +37 -0
- package/dist/memory/plan.js +184 -0
- package/dist/memory/resolve.d.ts +45 -0
- package/dist/memory/resolve.js +54 -0
- package/dist/memory/secrets.d.ts +30 -0
- package/dist/memory/secrets.js +73 -0
- package/dist/memory/service.d.ts +175 -0
- package/dist/memory/service.js +576 -0
- package/dist/memory/store.d.ts +133 -0
- package/dist/memory/store.js +694 -0
- package/dist/memory/tools.d.ts +36 -0
- package/dist/memory/tools.js +527 -0
- package/dist/memory/transfer.d.ts +53 -0
- package/dist/memory/transfer.js +93 -0
- package/dist/session/checkpoint.d.ts +18 -0
- package/dist/session/checkpoint.js +34 -0
- package/dist/session/limits.d.ts +16 -0
- package/dist/session/limits.js +16 -0
- package/dist/session/persist.d.ts +47 -0
- package/dist/session/persist.js +1 -0
- package/dist/session/startup-session.d.ts +6 -0
- package/dist/session/startup-session.js +3 -0
- package/dist/session/store.d.ts +14 -0
- package/dist/session/store.js +18 -0
- package/dist/session/validate-session.js +98 -0
- package/dist/tools/index.d.ts +21 -2
- package/dist/tools/index.js +33 -0
- package/package.json +3 -3
|
@@ -28,6 +28,9 @@ import { type ToolOutputListener } from '@aragon-agent/tui/model/tools/tool-outp
|
|
|
28
28
|
import type { FilePatch } from '@aragon-agent/tui/model/tools/patch';
|
|
29
29
|
import type { SubagentModelResolution } from '@aragon-agent/tui/model/team/model';
|
|
30
30
|
import { type ForcedTeamState } from '../team/forced-mode.js';
|
|
31
|
+
import { MemoryService } from '../memory/service.js';
|
|
32
|
+
import type { MemorySessionView } from '@aragon-agent/tui/model/memory/types';
|
|
33
|
+
import type { MemoryConfig } from '@aragon-agent/tui/model/config/schema';
|
|
31
34
|
import type { TeamModeOutcome, TeamModeRequest, TeamModeView } from '@aragon-agent/tui/model/team/team-mode';
|
|
32
35
|
import type { TeamEvent, TeamSnapshot } from '@aragon-agent/tui/model/team/types';
|
|
33
36
|
import { ProcSupervisor } from '../proc/supervisor.js';
|
|
@@ -319,6 +322,7 @@ export declare class AgentController {
|
|
|
319
322
|
*/
|
|
320
323
|
private readonly governance;
|
|
321
324
|
private readonly teamMode;
|
|
325
|
+
private readonly memory;
|
|
322
326
|
private readonly todoRegistered;
|
|
323
327
|
private todoEnabled;
|
|
324
328
|
private readonly todos;
|
|
@@ -899,6 +903,28 @@ export declare class AgentController {
|
|
|
899
903
|
/** Tell `listener` whenever the switch's view changes. Returns the unsubscribe. */
|
|
900
904
|
subscribeTeamMode(listener: () => void): () => void;
|
|
901
905
|
getTeamConfig(): TeamConfig;
|
|
906
|
+
/** The memory service, or `undefined` when memory is off / headless / a subagent. */
|
|
907
|
+
getMemoryService(): MemoryService | undefined;
|
|
908
|
+
/**
|
|
909
|
+
* Adopt the memory state a saved session carried (mounts, switches). Tolerant: anything
|
|
910
|
+
* malformed is dropped by the service. The prompt is rebuilt so the restored mounts are in
|
|
911
|
+
* effect for the first turn.
|
|
912
|
+
*/
|
|
913
|
+
restoreMemory(state: unknown): void;
|
|
914
|
+
/** The whole session view; `available: false` when there is no service. */
|
|
915
|
+
getMemoryView(): MemorySessionView;
|
|
916
|
+
/** Subscribe to view changes; the returned function unsubscribes. */
|
|
917
|
+
subscribeMemory(listener: () => void): () => void;
|
|
918
|
+
/**
|
|
919
|
+
* Adopt a new memory config for this session (Settings > Memory), clamped here as well as
|
|
920
|
+
* on the persist path. Like `setTeamConfig` this does NOT persist: `persistConfig` writes
|
|
921
|
+
* the file, this updates the runtime.
|
|
922
|
+
*/
|
|
923
|
+
setMemoryConfig(patch: Partial<MemoryConfig>): MemoryConfig;
|
|
924
|
+
/** The window of the model `cfg` selects, or `undefined` when only a fallback is known. */
|
|
925
|
+
private memoryWindowTokens;
|
|
926
|
+
/** Configured API keys, so a note that contains one is refused by value. */
|
|
927
|
+
private memoryKnownSecrets;
|
|
902
928
|
/**
|
|
903
929
|
* Adopt a new team config for this session and re-render the prompt (the block
|
|
904
930
|
* quotes the numbers). Clamped here as well as on the persist path, so a bad
|
package/dist/agent/controller.js
CHANGED
|
@@ -10,7 +10,7 @@ import { countAllImages, countHistoryImages, makeImageProjection, projectImagesF
|
|
|
10
10
|
import { buildImageInputBlock } from './image-input-prompt.js';
|
|
11
11
|
import { isImageCapabilityRefusal } from '@aragon-agent/tui/model/agent/image-refusal';
|
|
12
12
|
import { Agent, IMAGE_TOKEN_ESTIMATE, initProviders, ModelRegistry, } from '@aragon-agent/core';
|
|
13
|
-
import { clampCompactionConfig, clampFastConfig, clampRetryConfig, clampTeamConfig, clampTodoConfig, isAdapterProvider, toRetryPolicy, } from '@aragon-agent/tui/model/config/schema';
|
|
13
|
+
import { clampCompactionConfig, clampFastConfig, clampRetryConfig, clampMemoryConfig, clampTeamConfig, clampTodoConfig, isAdapterProvider, toRetryPolicy, } from '@aragon-agent/tui/model/config/schema';
|
|
14
14
|
import { resolveModelProfileState } from '@aragon-agent/tui/model/config/model-profile-resolution';
|
|
15
15
|
import { makeGetApiKey } from '../config/load.js';
|
|
16
16
|
import { updatePersistedConfig } from '../config/store.js';
|
|
@@ -30,6 +30,8 @@ import { buildTeamBlock } from '../team/prompt.js';
|
|
|
30
30
|
import { buildForcedTeamBlock } from '../team/forced-prompt.js';
|
|
31
31
|
import { DEFAULT_FORCED_COUNT } from '../team/forced-mode.js';
|
|
32
32
|
import { TeamModeWiring, effectiveForced } from './team-mode-wiring.js';
|
|
33
|
+
import { MemoryService, UNAVAILABLE_VIEW } from '../memory/service.js';
|
|
34
|
+
import { createMemoryTools } from '../memory/tools.js';
|
|
33
35
|
import { buildFastBlock } from '../fast/prompt.js';
|
|
34
36
|
import { ProcSupervisor } from '../proc/supervisor.js';
|
|
35
37
|
import { buildBackgroundJobsBlock, buildBackgroundServicesBlock } from '../proc/prompt.js';
|
|
@@ -224,6 +226,15 @@ export class AgentController {
|
|
|
224
226
|
// -----------------------------------------------------------------------
|
|
225
227
|
teamMode;
|
|
226
228
|
// -----------------------------------------------------------------------
|
|
229
|
+
// Agent memory (agent-memory spec 8.4)
|
|
230
|
+
// -----------------------------------------------------------------------
|
|
231
|
+
// `undefined` when memory is off, the host is headless, or this is a subagent - which is
|
|
232
|
+
// what leaves the tool array, the prompt and the status bar byte-identical to the build
|
|
233
|
+
// before this feature existed (I-2 / I-17). Fixed at construction: tools cannot be
|
|
234
|
+
// unregistered, so `memory.enabled` turned off mid-session makes the block disappear and
|
|
235
|
+
// the tools refuse, but a fully clean session needs a restart.
|
|
236
|
+
memory;
|
|
237
|
+
// -----------------------------------------------------------------------
|
|
227
238
|
// Todo planning (todo-plan-execution §3.6a) — THE SAME TWO FLAGS, FOR THE
|
|
228
239
|
// SAME REASON.
|
|
229
240
|
//
|
|
@@ -645,6 +656,22 @@ export class AgentController {
|
|
|
645
656
|
// With either off, no `job_*` tool, no prompt block, no mirror - which is what
|
|
646
657
|
// makes I-3 (byte-identical when off) measurable rather than asserted.
|
|
647
658
|
this.jobsRegistered = config.jobs.enabled && config.bash.background;
|
|
659
|
+
// AGENT MEMORY (agent-memory spec 8.4), ABOVE `createBuiltinTools` because its tools are
|
|
660
|
+
// passed in. THREE CONDITIONS, ALL REQUIRED: the section exists and is on (a hand-built
|
|
661
|
+
// test fixture without one is simply not asking for the feature), and the host can show a
|
|
662
|
+
// human a preview - `planInteractive` is the same signal `planTools` and `bash` use, so a
|
|
663
|
+
// headless run and a subagent never build the block or register the tools (D-20).
|
|
664
|
+
this.memory =
|
|
665
|
+
config.memory?.enabled === true && this.planInteractive
|
|
666
|
+
? new MemoryService({
|
|
667
|
+
getConfig: () => this.config,
|
|
668
|
+
getCwd: () => this.cwd,
|
|
669
|
+
resolveWindowTokens: (cfg) => this.memoryWindowTokens(cfg),
|
|
670
|
+
isBusy: () => this.isRunning() || this.isCompactionBusy(),
|
|
671
|
+
rebuildPrompt: () => this.rebuildSystemPrompt(),
|
|
672
|
+
knownSecrets: () => this.memoryKnownSecrets(),
|
|
673
|
+
})
|
|
674
|
+
: undefined;
|
|
648
675
|
this.jobMirror =
|
|
649
676
|
this.jobsRegistered && config.jobs.persistLog
|
|
650
677
|
? new JobLogMirror({
|
|
@@ -820,6 +847,23 @@ export class AgentController {
|
|
|
820
847
|
}),
|
|
821
848
|
]
|
|
822
849
|
: [],
|
|
850
|
+
// THE THREE MEMORY TOOLS, spread conditionally for the reason `resultTool` is: with the
|
|
851
|
+
// feature off the options bag has no such key and the array is the one built before it
|
|
852
|
+
// existed. `memory_write` is left out when `agentWrites` is `off` (D-7). The approval
|
|
853
|
+
// gate is `deps.approval`, which defaults to DENY-ALL: a memory write must never be
|
|
854
|
+
// approved by the `confirm` channel, whose fallback with no human attached is `true`.
|
|
855
|
+
...(this.memory
|
|
856
|
+
? {
|
|
857
|
+
memoryTools: createMemoryTools({
|
|
858
|
+
service: this.memory,
|
|
859
|
+
approval: deps.approval ?? DENY_ALL_APPROVAL,
|
|
860
|
+
withHumanWait: (fn) => this.withHumanWait(fn),
|
|
861
|
+
isEnabled: () => this.config.memory?.enabled === true,
|
|
862
|
+
agentWrites: () => this.memory?.effectiveAgentWrites() ?? 'off',
|
|
863
|
+
includeWrite: config.memory?.agentWrites !== 'off',
|
|
864
|
+
}),
|
|
865
|
+
}
|
|
866
|
+
: {}),
|
|
823
867
|
// SPREAD, NEVER `resultTool: deps.resultTool` (the D-12 lesson, and the shape
|
|
824
868
|
// every optional dep in this bag follows). With no schema the options bag has no
|
|
825
869
|
// such key, so `createBuiltinTools` adds nothing and the tool array is the one it
|
|
@@ -1004,6 +1048,11 @@ export class AgentController {
|
|
|
1004
1048
|
toolTimeoutOverrides: {
|
|
1005
1049
|
ask_user: config.planModeHumanTimeoutMs,
|
|
1006
1050
|
submit_plan: config.planModeHumanTimeoutMs,
|
|
1051
|
+
// A memory write waits on a human reading a preview (agent-memory RV-4). Only
|
|
1052
|
+
// while the tool is registered, so every other session's table is unchanged.
|
|
1053
|
+
...(this.memory && config.memory?.agentWrites !== 'off'
|
|
1054
|
+
? { memory_write: config.planModeHumanTimeoutMs }
|
|
1055
|
+
: {}),
|
|
1007
1056
|
// THE TWO PHASES, ADDED (headless-host-bridge §2.3.4). The executor
|
|
1008
1057
|
// arms its timer BEFORE the approval wrapper runs, so a ceiling of
|
|
1009
1058
|
// `toolTimeoutMs` alone would leave the tool less than its configured
|
|
@@ -1142,6 +1191,10 @@ export class AgentController {
|
|
|
1142
1191
|
this.jobRelay?.requeueUndelivered();
|
|
1143
1192
|
}
|
|
1144
1193
|
if (event.type === 'agent_end') {
|
|
1194
|
+
// A mount changed mid-turn lands now (agent-memory D-13): the flag clears and surfaces
|
|
1195
|
+
// stop saying "applies after this turn". The prompt itself is rebuilt at the START of
|
|
1196
|
+
// the next turn, which is also where outside edits are picked up.
|
|
1197
|
+
this.memory?.onTurnEnd();
|
|
1145
1198
|
// The same reconciliation at the other end of a run. Both ends are
|
|
1146
1199
|
// required: `turn_start` covers the next turn of the same run, and this
|
|
1147
1200
|
// covers a run that ended with a notice stranded in the queue.
|
|
@@ -1227,6 +1280,10 @@ export class AgentController {
|
|
|
1227
1280
|
cwd: this.cwd,
|
|
1228
1281
|
tools: this.tools,
|
|
1229
1282
|
skillsBlock: this.skillsEnabled ? skillsCatalog + this.skills.alwaysBlock() : '',
|
|
1283
|
+
// FROM THE `config` ARGUMENT, never `this.config` (agent-memory I-5): a model switch
|
|
1284
|
+
// pre-builds the INCOMING model's prompt, and budgets sized for the outgoing window
|
|
1285
|
+
// would overrun a smaller one. `''` when memory is off, which splices nothing.
|
|
1286
|
+
memoryBlock: this.memory?.renderBlock(config) ?? '',
|
|
1230
1287
|
// Immediately after the catalog it refers to, before the plan block whose
|
|
1231
1288
|
// first step defers to it (§4.2.4).
|
|
1232
1289
|
skillTriageBlock: triageBlock,
|
|
@@ -1337,6 +1394,7 @@ export class AgentController {
|
|
|
1337
1394
|
// LAST: every change to what the switch shows passes through here, so one notification
|
|
1338
1395
|
// point replaces "each call site remembers to notify" (D-7).
|
|
1339
1396
|
this.teamMode.emitIfChanged();
|
|
1397
|
+
this.memory?.emitIfChanged();
|
|
1340
1398
|
}
|
|
1341
1399
|
currentImageKey() {
|
|
1342
1400
|
if (!this.toolImagesEnabled)
|
|
@@ -1468,6 +1526,8 @@ export class AgentController {
|
|
|
1468
1526
|
// survived the cancellation check, so neither a superseded `prompt()` nor a live turn
|
|
1469
1527
|
// can apply it early (team-mode-toggle-keys RV-P1-3).
|
|
1470
1528
|
this.teamMode.applyPending();
|
|
1529
|
+
// The same net for memory: `agent_end` may never have reached us (agent-memory RV-3).
|
|
1530
|
+
this.memory?.applyPending();
|
|
1471
1531
|
return await this.startPrompt(text, options, request);
|
|
1472
1532
|
}
|
|
1473
1533
|
catch (err) {
|
|
@@ -1563,6 +1623,11 @@ export class AgentController {
|
|
|
1563
1623
|
// one turn late. This is also why steer does not rebuild: `continue()` runs
|
|
1564
1624
|
// while the loop already holds its snapshot, so the cost would be an idle
|
|
1565
1625
|
// compaction aborted for a prompt nothing has read yet (§4.2.5).
|
|
1626
|
+
//
|
|
1627
|
+
// `memory.sync()` FIRST (agent-memory RV-3): the one place an edit made by another
|
|
1628
|
+
// process, another window or a text editor reaches the model, because the rebuild
|
|
1629
|
+
// below is the only thing that reads the directory's contents into the prompt.
|
|
1630
|
+
this.memory?.sync();
|
|
1566
1631
|
this.rebuildSystemPrompt();
|
|
1567
1632
|
}
|
|
1568
1633
|
this.fast?.setGoal(text);
|
|
@@ -2238,6 +2303,61 @@ export class AgentController {
|
|
|
2238
2303
|
getTeamConfig() {
|
|
2239
2304
|
return this.config.team;
|
|
2240
2305
|
}
|
|
2306
|
+
// -----------------------------------------------------------------------
|
|
2307
|
+
// Agent memory - public surface (agent-memory spec 8.4)
|
|
2308
|
+
// -----------------------------------------------------------------------
|
|
2309
|
+
/** The memory service, or `undefined` when memory is off / headless / a subagent. */
|
|
2310
|
+
getMemoryService() {
|
|
2311
|
+
return this.memory;
|
|
2312
|
+
}
|
|
2313
|
+
/**
|
|
2314
|
+
* Adopt the memory state a saved session carried (mounts, switches). Tolerant: anything
|
|
2315
|
+
* malformed is dropped by the service. The prompt is rebuilt so the restored mounts are in
|
|
2316
|
+
* effect for the first turn.
|
|
2317
|
+
*/
|
|
2318
|
+
restoreMemory(state) {
|
|
2319
|
+
if (!this.memory)
|
|
2320
|
+
return;
|
|
2321
|
+
this.memory.restoreState(state);
|
|
2322
|
+
this.rebuildSystemPrompt();
|
|
2323
|
+
}
|
|
2324
|
+
/** The whole session view; `available: false` when there is no service. */
|
|
2325
|
+
getMemoryView() {
|
|
2326
|
+
return this.memory?.getView() ?? UNAVAILABLE_VIEW;
|
|
2327
|
+
}
|
|
2328
|
+
/** Subscribe to view changes; the returned function unsubscribes. */
|
|
2329
|
+
subscribeMemory(listener) {
|
|
2330
|
+
return this.memory?.subscribe(listener) ?? (() => { });
|
|
2331
|
+
}
|
|
2332
|
+
/**
|
|
2333
|
+
* Adopt a new memory config for this session (Settings > Memory), clamped here as well as
|
|
2334
|
+
* on the persist path. Like `setTeamConfig` this does NOT persist: `persistConfig` writes
|
|
2335
|
+
* the file, this updates the runtime.
|
|
2336
|
+
*/
|
|
2337
|
+
setMemoryConfig(patch) {
|
|
2338
|
+
const memory = clampMemoryConfig({ ...this.config.memory, ...patch });
|
|
2339
|
+
this.advanceSettingsRevision();
|
|
2340
|
+
this.config = { ...this.config, memory };
|
|
2341
|
+
this.memory?.updateConfig(memory);
|
|
2342
|
+
this.rebuildSystemPrompt();
|
|
2343
|
+
return memory;
|
|
2344
|
+
}
|
|
2345
|
+
/** The window of the model `cfg` selects, or `undefined` when only a fallback is known. */
|
|
2346
|
+
memoryWindowTokens(cfg) {
|
|
2347
|
+
if (typeof cfg.contextWindow === 'number' && cfg.contextWindow > 0)
|
|
2348
|
+
return cfg.contextWindow;
|
|
2349
|
+
const info = this.getModelInfoFor({
|
|
2350
|
+
providerId: cfg.provider,
|
|
2351
|
+
modelId: cfg.model,
|
|
2352
|
+
...(cfg.baseUrl ? { baseUrl: cfg.baseUrl } : {}),
|
|
2353
|
+
});
|
|
2354
|
+
return info.contextWindowSource === 'fallback' ? undefined : info.contextWindow;
|
|
2355
|
+
}
|
|
2356
|
+
/** Configured API keys, so a note that contains one is refused by value. */
|
|
2357
|
+
memoryKnownSecrets() {
|
|
2358
|
+
const key = this.resolveKey(this.config.provider);
|
|
2359
|
+
return key ? [key] : [];
|
|
2360
|
+
}
|
|
2241
2361
|
/**
|
|
2242
2362
|
* Adopt a new team config for this session and re-render the prompt (the block
|
|
2243
2363
|
* quotes the numbers). Clamped here as well as on the persist path, so a bad
|
|
@@ -2562,6 +2682,11 @@ export class AgentController {
|
|
|
2562
2682
|
this.modelRegistry.clearCache();
|
|
2563
2683
|
}
|
|
2564
2684
|
this.fast?.onConfigChanged(false, snapshot.config.fast.enabled);
|
|
2685
|
+
// The memory service keeps its own copy of the section (for `effectiveAgentWrites` and the
|
|
2686
|
+
// view); a Settings > Memory save must reach it, or the page would say "auto" while the tool
|
|
2687
|
+
// still asked (agent-memory 8.4).
|
|
2688
|
+
if (snapshot.config.memory)
|
|
2689
|
+
this.memory?.updateConfig(snapshot.config.memory);
|
|
2565
2690
|
this.compaction?.onConfigChanged(snapshot.config.compaction.enabled);
|
|
2566
2691
|
if (connectionChanged) {
|
|
2567
2692
|
this.requestVersion += 1;
|
|
@@ -2662,6 +2787,9 @@ export class AgentController {
|
|
|
2662
2787
|
// directory and the new skill set (I-S2 / AC-17).
|
|
2663
2788
|
if (this.skillsEnabled)
|
|
2664
2789
|
this.skills.discover();
|
|
2790
|
+
// The PROJECT scope moved with the directory: recompute which notes are visible before
|
|
2791
|
+
// the rebuild reads them (agent-memory 5.3).
|
|
2792
|
+
this.memory?.setCwd(cwd);
|
|
2665
2793
|
this.rebuildSystemPrompt();
|
|
2666
2794
|
this.onSkillsChanged?.();
|
|
2667
2795
|
}
|
|
@@ -22,6 +22,20 @@ export interface SystemPromptParams {
|
|
|
22
22
|
* an unconditional extra guidance line would quietly break all three.
|
|
23
23
|
*/
|
|
24
24
|
skillsBlock?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The rendered `<memory>` block, or `''` / absent (agent-memory spec 6.4, I-2).
|
|
27
|
+
*
|
|
28
|
+
* POSITION IS THE SEMANTICS (D-5): after `<project_guidance>` and BEFORE the skills catalog.
|
|
29
|
+
* The system prompt is ordered "most stable first" so the provider's prefix cache survives:
|
|
30
|
+
* memory changes only when the user (or an approved tool call) edits a note or a mount, which
|
|
31
|
+
* is rarer than a plan / team mode switch, so it sits in front of them. It must NOT go between
|
|
32
|
+
* `<available_skills>` and `<skill_triage>`: the triage block's first sentence points at the
|
|
33
|
+
* catalog "above", and adjacency is part of its meaning.
|
|
34
|
+
*
|
|
35
|
+
* Spliced conditionally exactly as `skillsBlock` is, so an absent or empty value produces the
|
|
36
|
+
* pre-memory prompt BYTE FOR BYTE (`memory.enabled: false`, `-p`, and every subagent).
|
|
37
|
+
*/
|
|
38
|
+
memoryBlock?: string;
|
|
25
39
|
/**
|
|
26
40
|
* The session's current mode. Absent or `'build'` produces a BYTE-IDENTICAL
|
|
27
41
|
* prompt to the pre-plan-mode output for a fixed `tools` array (I-P1) — the
|
|
@@ -32,6 +32,7 @@ export function buildSystemPrompt(params) {
|
|
|
32
32
|
: `The bash tool runs commands through ${shell} ("/bin/sh -c"). Standard POSIX syntax is fine.`;
|
|
33
33
|
const skillsBlock = params.skillsBlock ?? '';
|
|
34
34
|
const hasSkills = skillsBlock.length > 0;
|
|
35
|
+
const memoryBlock = params.memoryBlock ?? '';
|
|
35
36
|
const planBlock = params.agentMode === 'plan'
|
|
36
37
|
? buildPlanModeBlock({
|
|
37
38
|
interactive: params.planInteractive !== false,
|
|
@@ -67,6 +68,8 @@ export function buildSystemPrompt(params) {
|
|
|
67
68
|
// Base-prompt upgrade; optional blocks still preserve empty/absent equivalence.
|
|
68
69
|
'',
|
|
69
70
|
buildProjectGuidanceBlock(),
|
|
71
|
+
// AFTER the project guidance and BEFORE the skills catalog (agent-memory D-5).
|
|
72
|
+
...(memoryBlock ? ['', memoryBlock] : []),
|
|
70
73
|
...(hasSkills ? ['', skillsBlock] : []),
|
|
71
74
|
// AFTER <available_skills> (it refers to it as "above") and BEFORE <plan_mode>
|
|
72
75
|
// (whose step 1 defers to it). Conditional like every other optional block.
|
package/dist/app/App.d.ts
CHANGED
|
@@ -153,6 +153,13 @@ export interface TerminalBridge {
|
|
|
153
153
|
setMouseCapture?: (on: boolean) => void;
|
|
154
154
|
/** Whether the mouse is captured right now — read at command time. */
|
|
155
155
|
isMouseCaptured?: () => boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Whether keyboard enhancement is on - `cli.tsx::enhancedKeysOn`, the SAME expression the
|
|
158
|
+
* `Ctrl+M` / `Shift+Enter` translation runs under. Only an explicit `false` makes the memory
|
|
159
|
+
* pages say that `Ctrl+M` is Enter in this terminal (agent-memory 9.1, RV2-2); absent means
|
|
160
|
+
* "not told", which is every test that builds no bridge.
|
|
161
|
+
*/
|
|
162
|
+
enhancedKeys?: boolean;
|
|
156
163
|
writeForeign?: (text: string) => void;
|
|
157
164
|
selection?: SelectionBridge;
|
|
158
165
|
}
|
package/dist/app/App.js
CHANGED
|
@@ -71,7 +71,7 @@ import { useRenderGovernor } from '@aragon-agent/tui/ui/use-render-governor';
|
|
|
71
71
|
import { readScrollbarPerf, setPerfResetHook, setPerfSnapshotProvider, } from '../commands/perf.js';
|
|
72
72
|
import { buildFrameBudget, POPUP_CAPACITY_SHARE } from '@aragon-agent/tui/ui/layout/budget';
|
|
73
73
|
import { useWheelRouting } from '@aragon-agent/tui/ui/use-wheel-routing';
|
|
74
|
-
import { DEV_MODE_KEY_FRAME, INDEX_KEY_FRAME } from '@aragon-agent/tui/input/limits';
|
|
74
|
+
import { DEV_MODE_KEY_FRAME, INDEX_KEY_FRAME, MEMORY_KEY_FRAME, } from '@aragon-agent/tui/input/limits';
|
|
75
75
|
import { INDEX_SKILL_NAME, buildIndexConfirmSummary, hasProjectIndex, indexBuildInvocationArgs, } from '../commands/index-build.js';
|
|
76
76
|
import { installConsoleBridge } from '@aragon-agent/tui/ui/console-bridge';
|
|
77
77
|
import { publishExitSnapshot } from '@aragon-agent/tui/ui/exit-snapshot';
|
|
@@ -82,6 +82,13 @@ import { ModelPicker } from '@aragon-agent/tui/ui/overlays/ModelPicker';
|
|
|
82
82
|
import { KitPicker } from '@aragon-agent/tui/ui/overlays/KitPicker';
|
|
83
83
|
import { PromptLibraryOverlay } from '@aragon-agent/tui/ui/overlays/PromptLibraryOverlay';
|
|
84
84
|
import { PromptPicker } from '@aragon-agent/tui/ui/overlays/PromptPicker';
|
|
85
|
+
// Agent memory (agent-memory spec 9): the manager, its state machine (OWNED HERE, RV-11), the
|
|
86
|
+
// status chip and the shared types.
|
|
87
|
+
import { MemoryOverlay } from '@aragon-agent/tui/ui/overlays/MemoryOverlay';
|
|
88
|
+
import { INITIAL_MEMORY_STATE, memoryReducer } from '@aragon-agent/tui/ui/overlays/memory-state';
|
|
89
|
+
import { memoryChipFacts } from '@aragon-agent/tui/ui/layout/memory-chip';
|
|
90
|
+
import { memoryRepairCopy } from '@aragon-agent/tui/model/memory/copy';
|
|
91
|
+
import { takeMemoryRepairNotice } from '../memory/store.js';
|
|
85
92
|
import { draftToInput } from '@aragon-agent/tui/ui/overlays/prompt-library-state';
|
|
86
93
|
import { createPrompt, deletePrompt, flushPromptStats, loadPromptLibrary, movePrompt, recordPromptUse, setPromptFavorite, takePromptRepairNotice, updatePrompt, } from '../prompts/store.js';
|
|
87
94
|
import { resolvePromptRef } from '../prompts/resolve.js';
|
|
@@ -225,6 +232,16 @@ function firstUserText(entries) {
|
|
|
225
232
|
* shape of refusal as `tooSmall` - and the header keeps naming `Esc close`.
|
|
226
233
|
*/
|
|
227
234
|
const DECISION_OVERLAYS = new Set(['confirm', 'question', 'plan']);
|
|
235
|
+
/** The LAST finished assistant message's text, or `null` — the source for memory `l`. */
|
|
236
|
+
function lastAssistantText(entries) {
|
|
237
|
+
for (let index = entries.length - 1; index >= 0; index -= 1) {
|
|
238
|
+
const entry = entries[index];
|
|
239
|
+
if (entry && entry.kind === 'assistant' && !entry.streaming && entry.text.trim().length > 0) {
|
|
240
|
+
return entry.text;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
228
245
|
/** The LAST user message in a transcript, or `''` — the anchor `/task refresh` uses. */
|
|
229
246
|
function lastUserText(entries) {
|
|
230
247
|
for (let index = entries.length - 1; index >= 0; index -= 1) {
|
|
@@ -258,6 +275,19 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
258
275
|
const [promptLibrary, setPromptLibrary] = useState(loadPromptLibrary);
|
|
259
276
|
const [promptIntent, setPromptIntent] = useState(null);
|
|
260
277
|
const promptIntentNonce = useRef(0);
|
|
278
|
+
// --- Agent memory (agent-memory spec 9.2) ----------------------------------------------
|
|
279
|
+
//
|
|
280
|
+
// THE MANAGER'S PAGE STACK AND EDITOR DRAFT LIVE HERE, NOT IN THE OVERLAY (RV-11). `overlay`
|
|
281
|
+
// is one field: when the agent asks for an approval the view reducer swaps the memory
|
|
282
|
+
// overlay for the decision overlay and (via `suspendedOverlay`) back again. State owned by
|
|
283
|
+
// the component would be unmounted with it, and a half-typed note would vanish.
|
|
284
|
+
const [memoryState, memoryDispatch] = useReducer(memoryReducer, INITIAL_MEMORY_STATE);
|
|
285
|
+
const [memoryIntent, setMemoryIntent] = useState(null);
|
|
286
|
+
const memoryIntentNonce = useRef(0);
|
|
287
|
+
/** The composer's draft text, kept current by `PromptInput`; read on ONE keypress. */
|
|
288
|
+
const draftTextRef = useRef('');
|
|
289
|
+
/** What the manager was opened with: the draft and the last reply, for `c` and `l`. */
|
|
290
|
+
const memoryContext = useRef({ draft: '', lastReply: null });
|
|
261
291
|
// The fill channel's payload (D-6). `null` until the first fill, so the composer's
|
|
262
292
|
// effect has nothing to do on every mount.
|
|
263
293
|
const [draftFill, setDraftFill] = useState(null);
|
|
@@ -1283,6 +1313,64 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
1283
1313
|
setPromptIntent({ nonce: promptIntentNonce.current, entry });
|
|
1284
1314
|
dispatch({ type: 'setOverlay', overlay: 'prompts' });
|
|
1285
1315
|
}, []);
|
|
1316
|
+
/**
|
|
1317
|
+
* Open the memory manager on a page (agent-memory spec 9.2). The nonce is bumped BEFORE the
|
|
1318
|
+
* overlay opens and the overlay consumes it at most once, so two `/memory add` in a row are
|
|
1319
|
+
* two intents rather than one that looks like a no-op.
|
|
1320
|
+
*/
|
|
1321
|
+
const openMemory = useCallback((entry) => {
|
|
1322
|
+
memoryIntentNonce.current += 1;
|
|
1323
|
+
memoryContext.current = {
|
|
1324
|
+
draft: draftTextRef.current,
|
|
1325
|
+
lastReply: lastAssistantText(stateRef.current.entries),
|
|
1326
|
+
};
|
|
1327
|
+
setMemoryIntent({ nonce: memoryIntentNonce.current, entry });
|
|
1328
|
+
dispatch({ type: 'setOverlay', overlay: 'memory' });
|
|
1329
|
+
}, []);
|
|
1330
|
+
const closeMemory = useCallback(() => {
|
|
1331
|
+
memoryDispatch({ type: 'reset' });
|
|
1332
|
+
dispatch({ type: 'setOverlay', overlay: null });
|
|
1333
|
+
}, []);
|
|
1334
|
+
// The overlay's whole view of the session: a port over the controller's service. Absent for a
|
|
1335
|
+
// host without memory (a test double, a headless run), in which case the overlay never opens.
|
|
1336
|
+
const memoryPort = useMemo(() => {
|
|
1337
|
+
const service = typeof controller.getMemoryService === 'function'
|
|
1338
|
+
? controller.getMemoryService() : undefined;
|
|
1339
|
+
if (!service)
|
|
1340
|
+
return null;
|
|
1341
|
+
return {
|
|
1342
|
+
getView: () => service.getView(),
|
|
1343
|
+
listRows: () => service.listRows(),
|
|
1344
|
+
getNote: (id) => service.getNote(id),
|
|
1345
|
+
save: (draft, options) => service.saveNote(draft, options),
|
|
1346
|
+
remove: (id, rev) => service.deleteNote(id, rev),
|
|
1347
|
+
toggleMount: (id) => service.toggleMount(id),
|
|
1348
|
+
resetMount: (id) => service.setOverride(id, 'reset'),
|
|
1349
|
+
setAutoload: (value) => service.setAutoload(value),
|
|
1350
|
+
subscribe: (listener) => service.subscribe(listener),
|
|
1351
|
+
};
|
|
1352
|
+
}, [controller]);
|
|
1353
|
+
// The status chip's data. The service emits only when the whole view CHANGED, so this does
|
|
1354
|
+
// not re-render the tree per keystroke.
|
|
1355
|
+
const [memoryView, setMemoryView] = useState(() => (typeof controller.getMemoryView === 'function' ? controller.getMemoryView() : null));
|
|
1356
|
+
useEffect(() => {
|
|
1357
|
+
if (typeof controller.subscribeMemory !== 'function')
|
|
1358
|
+
return undefined;
|
|
1359
|
+
return controller.subscribeMemory(() => {
|
|
1360
|
+
setMemoryView(controller.getMemoryView());
|
|
1361
|
+
// A scan that skipped files (bad name, not UTF-8, too large) is told ONCE.
|
|
1362
|
+
const repair = takeMemoryRepairNotice();
|
|
1363
|
+
if (repair !== null)
|
|
1364
|
+
notify('warn', memoryRepairCopy(repair.skipped));
|
|
1365
|
+
});
|
|
1366
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1367
|
+
}, [controller]);
|
|
1368
|
+
useEffect(() => {
|
|
1369
|
+
const repair = takeMemoryRepairNotice();
|
|
1370
|
+
if (repair !== null)
|
|
1371
|
+
notify('warn', memoryRepairCopy(repair.skipped));
|
|
1372
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1373
|
+
}, []);
|
|
1286
1374
|
/**
|
|
1287
1375
|
* Hand the composer a body to insert (D-6 / §4.6).
|
|
1288
1376
|
*
|
|
@@ -1813,6 +1901,17 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
1813
1901
|
openManager: (entry) => openPromptLibrary(entry),
|
|
1814
1902
|
resolve: (ref) => resolvePromptRef(loadPromptLibrary(), ref),
|
|
1815
1903
|
},
|
|
1904
|
+
// The memory manager's two capabilities (agent-memory spec 9.5). Present even when memory is
|
|
1905
|
+
// off: `/memory` has to be able to SAY that it is off.
|
|
1906
|
+
memory: {
|
|
1907
|
+
// No port means nothing would render under `overlay === 'memory'` and the keyboard would be
|
|
1908
|
+
// captured by a blank screen, so "no service" reads as "not enabled" here, like the key.
|
|
1909
|
+
isEnabled: () => controller.getConfig().memory?.enabled === true && memoryPort !== null,
|
|
1910
|
+
openManager: (entry) => {
|
|
1911
|
+
if (memoryPort)
|
|
1912
|
+
openMemory(entry);
|
|
1913
|
+
},
|
|
1914
|
+
},
|
|
1816
1915
|
setOverlay: (overlay) => dispatch({ type: 'setOverlay', overlay }),
|
|
1817
1916
|
// THE TASK LABEL PORT (`/keys`, `/task`; §6.4). Reads go through `stateRef` so a
|
|
1818
1917
|
// command always sees the LATEST label rather than the one from the render that
|
|
@@ -2479,6 +2578,25 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
2479
2578
|
requestIndexBuild();
|
|
2480
2579
|
return;
|
|
2481
2580
|
}
|
|
2581
|
+
// Ctrl+M arrives as MEMORY_KEY_FRAME, never as key.ctrl + 'm': the traditional encoding of
|
|
2582
|
+
// Ctrl+M IS Enter, so the stdin filter's translators are the only layer that can tell them
|
|
2583
|
+
// apart (agent-memory D-9 / input/limits.ts). Alt+M is the always-available twin, in BOTH
|
|
2584
|
+
// byte shapes: Ink's `meta` + 'm', and the raw `ESC m` that win32-input-mode produces.
|
|
2585
|
+
//
|
|
2586
|
+
// THE POSITION IS THE POINT (RV-10): beside Ctrl+I and BEFORE the `tooSmall` return below,
|
|
2587
|
+
// so "the key did nothing" stays distinguishable from "the key never arrived". The guards
|
|
2588
|
+
// are Ctrl+I's: an overlay owns the keyboard, a too-small frame has nowhere to go - and
|
|
2589
|
+
// `memory.enabled` is read at KEY TIME, so the switch needs no restart.
|
|
2590
|
+
if (input.includes(MEMORY_KEY_FRAME)
|
|
2591
|
+
|| (key.meta && !key.ctrl && input.toLowerCase() === 'm')
|
|
2592
|
+
|| input === '\x1bm') {
|
|
2593
|
+
if (tooSmall || stateRef.current.overlay)
|
|
2594
|
+
return;
|
|
2595
|
+
if (controller.getConfig().memory?.enabled !== true || !memoryPort)
|
|
2596
|
+
return;
|
|
2597
|
+
openMemory({ kind: 'list' });
|
|
2598
|
+
return;
|
|
2599
|
+
}
|
|
2482
2600
|
// Ctrl+L: branch this session into a NEW terminal (tui-branch-terminal-
|
|
2483
2601
|
// shortcut D-1 / D-2). Guarded exactly like Ctrl+G and Ctrl+I above it: an
|
|
2484
2602
|
// overlay owns the keyboard, and on a too-small terminal the feedback has
|
|
@@ -2517,7 +2635,9 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
2517
2635
|
// The prompt surfaces page themselves through `overlayScroll` too
|
|
2518
2636
|
// (quick-prompt-library appendix B-1). Without them a `PgDn` in the list does
|
|
2519
2637
|
// nothing and the wheel falls through to the transcript behind it.
|
|
2520
|
-
|| overlay === 'prompts' || overlay === 'prompt-pick'
|
|
2638
|
+
|| overlay === 'prompts' || overlay === 'prompt-pick'
|
|
2639
|
+
// The memory manager pages through `overlayScroll` too (agent-memory V-4).
|
|
2640
|
+
|| overlay === 'memory';
|
|
2521
2641
|
if (key.pageUp) {
|
|
2522
2642
|
if (controlled)
|
|
2523
2643
|
setOverlayScroll((n) => Math.max(0, n - overlayPage));
|
|
@@ -2680,6 +2800,12 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
2680
2800
|
const overlay = stateRef.current.overlay;
|
|
2681
2801
|
if (overlay === 'settings')
|
|
2682
2802
|
return;
|
|
2803
|
+
// THE MEMORY MANAGER OWNS ITS Esc, like settings: the editor's first Esc only ARMS the
|
|
2804
|
+
// discard, and closing the overlay here as well would throw the half-typed note away on
|
|
2805
|
+
// that first press (AC-31). Only when it is actually mounted: with no port nothing renders
|
|
2806
|
+
// and nothing else could close it.
|
|
2807
|
+
if (overlay === 'memory' && memoryPort)
|
|
2808
|
+
return;
|
|
2683
2809
|
if (overlay) {
|
|
2684
2810
|
cancelConfirmation();
|
|
2685
2811
|
if (overlay === 'confirm' && confirmRef.current) {
|
|
@@ -2795,6 +2921,7 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
2795
2921
|
otherNames: (cfg.modelProfiles?.kits ?? [])
|
|
2796
2922
|
.filter((kit) => kit.id !== activeKit.id).map((kit) => kit.name),
|
|
2797
2923
|
};
|
|
2924
|
+
const memoryChip = memoryChipFacts(memoryView) ?? undefined;
|
|
2798
2925
|
const empty = state.entries.length === 0;
|
|
2799
2926
|
// RENDER SCOPE, so the chip and the composer hint agree with what the Ctrl+C
|
|
2800
2927
|
// handler will do on the very next keystroke.
|
|
@@ -3010,7 +3137,9 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3010
3137
|
} })) : overlay === 'queue' ? (_jsx(QueueOverlay, { pending: state.pendingSteering, cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps })) : overlay === 'help' ? (_jsx(OverlayFrame, { title: "Help", hint: `Esc close ${glyphs.midDot} PgUp/PgDn scroll`, maxRows: overlayMaxRows, cols: viewCols, rows: helpRows(theme, caps, native), scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps })) : overlay === 'model' ? (_jsx(ModelPicker, { isActive: !tooSmall, registry: controller.getModelRegistry(), currentProvider: cfg.provider, currentModel: cfg.model, maxRows: overlayMaxRows, cols: viewCols, theme: theme, caps: caps, onSelect: handleModelSelect })) : overlay === 'kit' ? (_jsx(KitPicker, { isActive: !tooSmall, library: cfg.modelProfiles, config: cfg, ...(kitDiskConfig ? { diskConfig: kitDiskConfig } : {}), active: activeKit,
|
|
3011
3138
|
// ONLY THE APPLY IS BLOCKED while work is in flight (§4.7): a list a
|
|
3012
3139
|
// user cannot even OPEN reads as a broken key.
|
|
3013
|
-
busy: controller.isModelSettingsBusy(), maxRows: overlayMaxRows, cols: viewCols, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, onChoose: handleKitChoose, onClose: () => dispatch({ type: 'setOverlay', overlay: null }) })) : overlay === 'prompts' ? (_jsx(PromptLibraryOverlay, { isActive: !tooSmall, library: promptLibrary, ...(promptIntent ? { intent: promptIntent } : {}), cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, onMutate: handlePromptMutate, onNotice: notify, onClose: () => dispatch({ type: 'setOverlay', overlay: null }) })) : overlay === 'prompt-pick' ? (_jsx(PromptPicker, { isActive: !tooSmall, library: promptLibrary, cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, onFill: handlePromptFill, onManage: (entry) => openPromptLibrary(entry), onClose: closePromptPicker })) : overlay === '
|
|
3140
|
+
busy: controller.isModelSettingsBusy(), maxRows: overlayMaxRows, cols: viewCols, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, onChoose: handleKitChoose, onClose: () => dispatch({ type: 'setOverlay', overlay: null }) })) : overlay === 'prompts' ? (_jsx(PromptLibraryOverlay, { isActive: !tooSmall, library: promptLibrary, ...(promptIntent ? { intent: promptIntent } : {}), cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, onMutate: handlePromptMutate, onNotice: notify, onClose: () => dispatch({ type: 'setOverlay', overlay: null }) })) : overlay === 'prompt-pick' ? (_jsx(PromptPicker, { isActive: !tooSmall, library: promptLibrary, cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, onFill: handlePromptFill, onManage: (entry) => openPromptLibrary(entry), onClose: closePromptPicker })) : overlay === 'memory' && memoryPort ? (_jsx(MemoryOverlay, { isActive: !tooSmall, state: memoryState, dispatch: memoryDispatch, port: memoryPort, ...(memoryIntent ? { intent: memoryIntent } : {}), context: memoryContext.current, cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, reducedMotion: cfg.reducedMotion ?? false, ...(terminal?.enhancedKeys === undefined ? {} : { enhancedKeys: terminal.enhancedKeys }),
|
|
3141
|
+
// Outcomes are toasts (they expire); the editor's own error row is what stays on screen.
|
|
3142
|
+
onNotice: (level, text) => toast(level === 'info' ? 'success' : level, text), onClose: closeMemory })) : overlay === 'settings' ? (_jsx(SettingsScreen, { isActive: !tooSmall, initial: {
|
|
3014
3143
|
provider: cfg.provider,
|
|
3015
3144
|
model: cfg.model,
|
|
3016
3145
|
baseUrl: cfg.baseUrl ?? '',
|
|
@@ -3054,7 +3183,7 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3054
3183
|
// mounted with `{...props}` and an undeclared prop arrives as
|
|
3055
3184
|
// `undefined`. A construction-time snapshot, so reading it per frame is
|
|
3056
3185
|
// honest (I-7).
|
|
3057
|
-
teamRegistered: controller.isTeamRegistered(), governanceRegistered: controller.isGovernanceRegistered(), probe: probe, onProfileSave: handleProfileSave, onReload: () => controller.createModelSettingsDraft(), onClose: () => dispatch({ type: 'setOverlay', overlay: null }),
|
|
3186
|
+
teamRegistered: controller.isTeamRegistered(), governanceRegistered: controller.isGovernanceRegistered(), memoryRegistered: typeof controller.getMemoryService === 'function' && controller.getMemoryService() !== undefined, ...(terminal?.enhancedKeys === undefined ? {} : { enhancedKeys: terminal.enhancedKeys }), probe: probe, onProfileSave: handleProfileSave, onReload: () => controller.createModelSettingsDraft(), onClose: () => dispatch({ type: 'setOverlay', overlay: null }),
|
|
3058
3187
|
// Read from `cfg` (render scope, re-read every frame), so `/retry off`
|
|
3059
3188
|
// while the screen is open shows the new value on the next paint.
|
|
3060
3189
|
retrySummary: cfg.retry.enabled && cfg.retry.maxRetries > 0 ? String(cfg.retry.maxRetries) : 'off' })) : overlay === 'agents' ? (
|
|
@@ -3201,7 +3330,7 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3201
3330
|
...(state.governance?.pauseRequested === true ? { govPausePending: true } : {}),
|
|
3202
3331
|
interruptPhase: interruptGesture.current.phase,
|
|
3203
3332
|
updateAvailable: !!updateSnapshot && shouldRenderUpdateLine(updateSnapshot) } });
|
|
3204
|
-
const composer = (_jsx(Composer, { deleteDisambiguated: terminal?.deleteDisambiguated ?? false, onCompletionContextChange: setCompletion, cols: frameBudget.composerCols, terminalRows: rows, statusExpanded: statusExpanded, onInteraction: returnToComposer, reducedMotion: cfg.reducedMotion ?? false, onEscape: handleComposerEscape, onEscapeDismiss: cancelConfirmation, isActive: overlay === null && !tooSmall, running: state.status === 'running', history: promptHistory, commands: commandOptions, cwd: controller.getCwd(), showHint: false, submitCount: cfg.submitCount, hintsEnabled: cfg.hints, agentMode: state.agentMode, posture: state.posture, services: liveServices, modeToggleKey: modeToggleKey, popupMaxRows: popupMaxRows, popupMaxHeight: frameBudget.popupMaxHeight, onPopupRowsChange: onPopupRowsChange, onDraftRows: onDraftRows, onDraftPresence: onDraftPresence, draftClearNonce: draftClearNonce, ...(draftFill ? { draftFill } : {}), insertMode: cfg.prompts?.insertMode ?? 'insert', onNotice: notify, theme: theme, caps: caps, onSubmit: handleSubmit, onHelp: () => dispatch({ type: 'setOverlay', overlay: 'help' }) }));
|
|
3333
|
+
const composer = (_jsx(Composer, { deleteDisambiguated: terminal?.deleteDisambiguated ?? false, onCompletionContextChange: setCompletion, cols: frameBudget.composerCols, terminalRows: rows, statusExpanded: statusExpanded, onInteraction: returnToComposer, reducedMotion: cfg.reducedMotion ?? false, onEscape: handleComposerEscape, onEscapeDismiss: cancelConfirmation, isActive: overlay === null && !tooSmall, running: state.status === 'running', history: promptHistory, commands: commandOptions, cwd: controller.getCwd(), showHint: false, submitCount: cfg.submitCount, hintsEnabled: cfg.hints, agentMode: state.agentMode, posture: state.posture, services: liveServices, modeToggleKey: modeToggleKey, popupMaxRows: popupMaxRows, popupMaxHeight: frameBudget.popupMaxHeight, onPopupRowsChange: onPopupRowsChange, onDraftRows: onDraftRows, onDraftPresence: onDraftPresence, draftClearNonce: draftClearNonce, draftTextRef: draftTextRef, ...(draftFill ? { draftFill } : {}), insertMode: cfg.prompts?.insertMode ?? 'insert', onNotice: notify, theme: theme, caps: caps, onSubmit: handleSubmit, onHelp: () => dispatch({ type: 'setOverlay', overlay: 'help' }) }));
|
|
3205
3334
|
const team = governanceLayout ? (_jsx(GovernancePanel, { layout: governanceLayout, theme: theme, caps: caps })) : state.team ? (_jsx(TeamPanel, { snapshot: state.team, layout: teamLayout, rows: rows, cols: contentCols, reducedMotion: viewReducedMotion, voice: teamVoice, theme: theme, caps: caps })) : null;
|
|
3206
3335
|
// --- Native panel band (release-gate-and-native-panels §6.3/§6.4) -------------
|
|
3207
3336
|
//
|
|
@@ -3227,7 +3356,7 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3227
3356
|
const rail = fullscreenRailVisible && state.todos ? (_jsx(TodoPanel, { snapshot: state.todos, width: railWidth, rows: railRows, running: running, reducedMotion: viewReducedMotion, theme: theme, caps: caps })) : null;
|
|
3228
3357
|
const viewport = (_jsxs(ScrollViewport, { active: overlay === null && !tooSmall, overlay: overlayNode, footer: _jsxs(_Fragment, { children: [team, _jsx(QueuePanel, { layout: queueLayout, theme: theme })] }), rail: rail, scrollbar: terminal?.scrollbar, resetKey: scrollResetKey, intent: scrollIntent, pinToBottomNonce: pinToBottomNonce, onScrolledLinesChange: setScrolledLines, onViewportShiftChange: onViewportShiftChange, onGeometryChange: onGeometryChange, geometryKey: `${rows}:${cols}:${viewportBudget}:${frameBudget.composerSlotRows}:${frameBudget.statusRows}:${contentCols}:${overlay}:${tooSmall}`, tailRowsRef: tailSink, hold: selectionHold, resumeMs: cfg.scrollResumeMs, showScrollIndicator: true, cols: contentCols, theme: theme, caps: caps, children: [opener, _jsx(TranscriptList, { entries: transcriptEntries, expandedToolIds: state.expandedToolIds, thinkingVisible: state.thinkingVisible, reducedMotion: viewReducedMotion, voice: voice, density: density, nowSec: nowSec, theme: theme, caps: caps, windowSize: transcriptWindow, cols: contentCols, heights: heights, mountedSink: mountedCount, tailSink: tailSink })] }));
|
|
3229
3358
|
const detailsNode = _jsx(BottomStatusRow, { plan: details, columns: viewCols, theme: theme });
|
|
3230
|
-
const statusNode = (_jsx(StatusBar, { columns: viewCols, speedKnown: speedKnown, ...feedbackProjection, interruptPhase: interruptGesture.current.phase, pendingSteering: state.pendingSteering, runPhase: state.runPhase, activeTool: state.activeTool, ...(wait ? { wait } : {}), runOutcome: state.runOutcome, reducedMotion: reducedMotion, ...(sessionId ? { sessionId } : {}), developerMode: state.developerMode, ...(kitChip ? { kit: kitChip } : {}), waitingForConfirmation: !!humanRequest || !!confirmState, stopping: interruptGesture.current.phase === 'stopping', interruptHint: interruptGesture.current.phase === 'stopping'
|
|
3359
|
+
const statusNode = (_jsx(StatusBar, { columns: viewCols, speedKnown: speedKnown, ...feedbackProjection, interruptPhase: interruptGesture.current.phase, pendingSteering: state.pendingSteering, runPhase: state.runPhase, activeTool: state.activeTool, ...(wait ? { wait } : {}), runOutcome: state.runOutcome, reducedMotion: reducedMotion, ...(sessionId ? { sessionId } : {}), developerMode: state.developerMode, ...(kitChip ? { kit: kitChip } : {}), ...(memoryChip ? { memory: memoryChip } : {}), waitingForConfirmation: !!humanRequest || !!confirmState, stopping: interruptGesture.current.phase === 'stopping', interruptHint: interruptGesture.current.phase === 'stopping'
|
|
3231
3360
|
? 'Esc force-stop' : 'Esc x2 interrupt', model: cfg.model, provider: cfg.provider, usageTotal: state.usageTotal,
|
|
3232
3361
|
// ONE OBJECT INSTEAD OF FOUR PARALLEL PROPS (§4.3). The four were a
|
|
3233
3362
|
// projection of "many sources of truth" into the props layer, and a
|