@agi-fans/dsh-tui 0.17.0 → 0.18.0
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/lib/CHANGELOG.md +36 -1
- package/lib/chrome/status-config.d.ts +4 -1
- package/lib/chrome/status-config.js.map +1 -1
- package/lib/chrome/tool-renderers.js +0 -2
- package/lib/chrome/tool-renderers.js.map +1 -1
- package/lib/commands/auth.js +4 -2
- package/lib/commands/auth.js.map +1 -1
- package/lib/commands/jobs.d.ts +2 -2
- package/lib/commands/jobs.js +2 -2
- package/lib/commands/jobs.js.map +1 -1
- package/lib/definition.d.ts +3 -0
- package/lib/definition.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/runtime/provider-local.d.ts +43 -7
- package/lib/runtime/provider-local.js +75 -32
- package/lib/runtime/provider-local.js.map +1 -1
- package/lib/runtime/session-runtime.d.ts +9 -1
- package/lib/runtime/session-runtime.js +2 -2
- package/lib/runtime/session-runtime.js.map +1 -1
- package/lib/runtime/startup-notices.js +6 -9
- package/lib/runtime/startup-notices.js.map +1 -1
- package/lib/runtime/tool-presentation.js +3 -3
- package/lib/runtime/tool-presentation.js.map +1 -1
- package/lib/session/job-notice.d.ts +2 -2
- package/lib/session/job-notice.js.map +1 -1
- package/lib/session/session-configuration.d.ts +0 -3
- package/lib/session/session-configuration.js +0 -4
- package/lib/session/session-configuration.js.map +1 -1
- package/lib/session/session-controller.d.ts +6 -4
- package/lib/session/session-controller.js +96 -42
- package/lib/session/session-controller.js.map +1 -1
- package/lib/session/session-library.d.ts +20 -0
- package/lib/session/session-library.js +52 -0
- package/lib/session/session-library.js.map +1 -1
- package/lib/session/subagent-roster.js +3 -3
- package/lib/session/subagent-roster.js.map +1 -1
- package/lib/session/subagent-tracker.d.ts +2 -9
- package/lib/session/subagent-tracker.js +3 -4
- package/lib/session/subagent-tracker.js.map +1 -1
- package/lib/session/tui-settings.d.ts +41 -18
- package/lib/session/tui-settings.js +57 -39
- package/lib/session/tui-settings.js.map +1 -1
- package/lib/views/at-complete.d.ts +2 -0
- package/lib/views/at-complete.js +2 -2
- package/lib/views/at-complete.js.map +1 -1
- package/lib/views/event-views.js +9 -12
- package/lib/views/event-views.js.map +1 -1
- package/lib/views/settings-list.d.ts +2 -2
- package/lib/views/settings-list.js.map +1 -1
- package/lib/views/transcript-export.js +0 -2
- package/lib/views/transcript-export.js.map +1 -1
- package/package.json +39 -38
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-presentation.js","sourceRoot":"","sources":["../../src/runtime/tool-presentation.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAQ7E,MAAM,CAAC,MAAM,IAAI,GAAG,yBAAyB,CAAA;AAC7C,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,CAAA;AAc/B,SAAS,eAAe,CAAC,GAAW;IAClC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAA;IACZ,CAAC;AACH,CAAC;AAED,MAAM,uBAAuB;IAClB,IAAI,CAAS;IACtB;;;;OAIG;IACM,UAAU,GAAG,IAAI,OAAO,EAAsC,CAAA;IAEvE,YAAY,GAAY;QACtB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAA;IACjB,CAAC;IAED,KAAK,CAAC,KAAY,EAAE,KAAmB;QACrC,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YAC/B,IAAI,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC9C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,KAAK,GAAG,IAAI,GAAG,EAAE,CAAA;gBACjB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,KA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AAC,CAAC,CAAA;AACvE,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @module @agi-fans/dsh-tui/job-notice
|
|
5
5
|
*/
|
|
6
6
|
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
7
|
-
import type {
|
|
7
|
+
import type { JobStatus, JobView } from '@deepseek-ai/dsh-jobs';
|
|
8
8
|
/** Past- or present-tense word for one lifecycle status. */
|
|
9
9
|
export declare const JOB_STATUS_WORD: Record<JobStatus, string>;
|
|
10
10
|
/** One human-facing completion line for a background job. */
|
|
@@ -20,7 +20,7 @@ export declare function formatJobNotice(snapshot: {
|
|
|
20
20
|
* owned by another session is not this terminal's business.
|
|
21
21
|
*/
|
|
22
22
|
export declare function jobNoticeFor(snapshot: {
|
|
23
|
-
readonly kind:
|
|
23
|
+
readonly kind: JobView['kind'];
|
|
24
24
|
readonly id: string;
|
|
25
25
|
readonly label: string;
|
|
26
26
|
readonly status: JobStatus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-notice.js","sourceRoot":"","sources":["../../src/session/job-notice.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,eAAe,GAA8B;IACxD,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,QAAQ;CACjB,CAAA;AAED,6DAA6D;AAC7D,MAAM,UAAU,eAAe,CAAC,QAK/B;IACC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;IACnC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;IAC1E,OAAO,kBAAkB,QAAQ,CAAC,EAAE,IAAI,eAAe,CAAC,QAAQ,CAAC,M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AK,UAAU;QAAE,OAAO,SAAS,CAAA;IAClD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,SAAS,CAAA;IAC7D,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAA;AAClC,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
/** Agent-preset configuration and composition guards for one session. */
|
|
2
2
|
import { type Session } from '@deepseek-ai/dsh-session';
|
|
3
|
-
import type { ToolPresentationMode } from '@deepseek-ai/dsh-tools';
|
|
4
|
-
/** PTC uses Code presentation; every other preset exposes native functions. */
|
|
5
|
-
export declare function toolPresentationForPreset(agentPreset: string): ToolPresentationMode;
|
|
6
3
|
/** Agent composition may change only before any model-visible history exists. */
|
|
7
4
|
export declare function isBlankSession(session: Session): boolean;
|
|
8
5
|
export declare function formatAgentPreset(id: string): string;
|
|
@@ -8,10 +8,6 @@ function registerLegacyOmdshSessionEvents() {
|
|
|
8
8
|
KNOWN_SESSION_EVENT_TYPES.add('omdsh/tools-selected');
|
|
9
9
|
}
|
|
10
10
|
registerLegacyOmdshSessionEvents();
|
|
11
|
-
/** PTC uses Code presentation; every other preset exposes native functions. */
|
|
12
|
-
export function toolPresentationForPreset(agentPreset) {
|
|
13
|
-
return agentPreset === 'code' ? 'ptc' : 'native';
|
|
14
|
-
}
|
|
15
11
|
/** Agent composition may change only before any model-visible history exists. */
|
|
16
12
|
export function isBlankSession(session) {
|
|
17
13
|
if (session.deriveMessages().length > 0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-configuration.js","sourceRoot":"","sources":["../../src/session/session-configuration.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAEzE,OAAO,EAAE,yBAAyB,EAAgB,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"session-configuration.js","sourceRoot":"","sources":["../../src/session/session-configuration.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAEzE,OAAO,EAAE,yBAAyB,EAAgB,MAAM,0BAA0B,CAAA;AAElF;;;GAGG;AACH,SAAS,gCAAgC;IACtC,yBAAyC,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;AACxE,CAAC;AAED,gCAAgC,EAAE,CAAA;AAElC,iFAAiF;AACjF,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,KAAK,CAAA;IACrD,OAAO,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,gBAAgB;WACzE,KAAK,CAAC,IAAI,KAAK,iBAAiB;WAChC,KAAK,CAAC,IAAI,KAAK,YAAY;WAC3B,KAAK,CAAC,IAAI,KAAK,YAAY;WAC3B,KAAK,CAAC,IAAI,KAAK,mBAAmB;WAClC,KAAK,CAAC,IAAI,KAAK,WAAW;WAC1B,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC,CAAA;AACpC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,EAAU;IAC1C,IAAI,EAAE,KAAK,UAAU;QAAE,OAAO,UAAU,CAAA;IACxC,IAAI,EAAE,KAAK,MAAM;QAAE,OAAO,KAAK,CAAA;IAC/B,IAAI,EAAE,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IACtC,IAAI,EAAE,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAA;IACpC,OAAO,EAAE,CAAA;AACX,CAAC"}
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { Context } from '@deepseek-ai/cordis';
|
|
10
10
|
import { type Agent, type ModelSelection } from '@deepseek-ai/dsh-agent';
|
|
11
|
-
import type { AgentPreset } from '@deepseek-ai/dsh-agent-
|
|
11
|
+
import type { AgentPreset } from '@deepseek-ai/dsh-agent-preset-registry';
|
|
12
12
|
import { type LlmResolvedModelInfo, type UserMessage } from '@deepseek-ai/dsh-llm';
|
|
13
13
|
import type { ImageAttachmentRef, SaveImageAttachment, StoredImageAttachment } from '@deepseek-ai/dsh-attachment';
|
|
14
14
|
import type { CommandSubmitAttachment } from '@deepseek-ai/dsh-commands';
|
|
15
|
-
import type {
|
|
15
|
+
import type { PermissionSelection } from '@deepseek-ai/dsh-permission-presets/types';
|
|
16
16
|
import type { PlanProjection } from '@deepseek-ai/dsh-plan-mode/types';
|
|
17
17
|
import { type SkillSummary } from '@deepseek-ai/dsh-skill';
|
|
18
18
|
import type { SessionStatsProjection } from '@deepseek-ai/dsh-session-stats/types';
|
|
@@ -28,7 +28,7 @@ export interface TuiStatsProjection {
|
|
|
28
28
|
contextPressure?: ContextPressureProjection;
|
|
29
29
|
contextBreakdown?: ContextBreakdownProjection;
|
|
30
30
|
plan?: PlanProjection;
|
|
31
|
-
permissions?:
|
|
31
|
+
permissions?: PermissionSelection;
|
|
32
32
|
goal?: GoalProjection | null;
|
|
33
33
|
/** Last logged sandbox-mode override, or null before one; outranks the preset while set. */
|
|
34
34
|
sandboxMode?: 'read-only' | 'workspace-write' | 'danger-full-access' | null;
|
|
@@ -101,7 +101,9 @@ export declare function restoreSubmissionMessage(message: UserMessage, attachmen
|
|
|
101
101
|
/** Own one switchable top-level Agent and project it onto a TuiService. */
|
|
102
102
|
export declare class SessionRuntime {
|
|
103
103
|
#private;
|
|
104
|
-
constructor(ctx: Context, tui: TuiService
|
|
104
|
+
constructor(ctx: Context, tui: TuiService, options?: {
|
|
105
|
+
stateDir?: string;
|
|
106
|
+
});
|
|
105
107
|
get agent(): Agent | undefined;
|
|
106
108
|
/**
|
|
107
109
|
* Interrupt the visible continuable child when one is inspected.
|
|
@@ -7,34 +7,36 @@
|
|
|
7
7
|
* @module @agi-fans/dsh-tui/session-controller
|
|
8
8
|
*/
|
|
9
9
|
import { randomUUID } from 'node:crypto';
|
|
10
|
+
import { join } from 'node:path';
|
|
10
11
|
import { installModelSelection, } from '@deepseek-ai/dsh-agent';
|
|
11
12
|
import { createUserMessage, } from '@deepseek-ai/dsh-llm';
|
|
12
13
|
import { isUserInvocable } from '@deepseek-ai/dsh-skill';
|
|
14
|
+
import { SessionAlreadyOwnedError } from '@deepseek-ai/dsh-session-persistence';
|
|
13
15
|
import { readColdSessionLog } from '@deepseek-ai/dsh-session-query';
|
|
14
|
-
import { SessionId, SessionLogOffset } from '@deepseek-ai/dsh-session';
|
|
16
|
+
import { SESSION_FORMAT_VERSION, SessionId, SessionLogOffset } from '@deepseek-ai/dsh-session';
|
|
15
17
|
import { queueHostSubagentPrompt } from '@deepseek-ai/dsh-subagent/internal';
|
|
16
18
|
import { firstVisibleStreamTime } from "../views/stream-time.js";
|
|
17
19
|
import { LiveAttemptTracker } from "./live-attempt-tracker.js";
|
|
18
20
|
import { blocksText } from "./content-text.js";
|
|
19
21
|
import { jobNoticeFor } from "./job-notice.js";
|
|
20
22
|
import { descendantDepth, isSteerableSubagent } from "./subagent-roster.js";
|
|
23
|
+
import { readRecentRows, writeRecentRows } from "./session-library.js";
|
|
24
|
+
import { readJsonFile, writeJsonAtomic } from "./json-file.js";
|
|
21
25
|
import { SubagentTracker } from "./subagent-tracker.js";
|
|
22
26
|
import { commandPermission } from "../commands/permission.js";
|
|
23
|
-
import { isBlankSession,
|
|
27
|
+
import { isBlankSession, } from "./session-configuration.js";
|
|
24
28
|
import { stripComposerImageMarkers } from "../input/image-paste.js";
|
|
25
29
|
async function setupAgentContext(agentCtx, agent, selection) {
|
|
26
30
|
installModelSelection(agentCtx, selection);
|
|
27
31
|
const agentPresets = agentCtx.get('agentPresets');
|
|
28
32
|
const sessionProjections = agentCtx.get('sessionProjections');
|
|
29
|
-
|
|
30
|
-
if (agentPresets === undefined || sessionProjections === undefined || tools === undefined) {
|
|
33
|
+
if (agentPresets === undefined || sessionProjections === undefined) {
|
|
31
34
|
throw new Error('agent configuration services are unavailable');
|
|
32
35
|
}
|
|
33
36
|
const agentPreset = sessionProjections.stateOf(agent.session, 'agentPreset') ?? agentPresets.defaultId;
|
|
34
37
|
const mounted = await agentPresets.mount(agentCtx, agentPreset);
|
|
35
|
-
const disposeToolPresentation = tools.presentAs(toolPresentationForPreset(mounted.id));
|
|
36
38
|
await agentCtx.plugin(commandPermission(agent));
|
|
37
|
-
return { agentPreset: mounted.id
|
|
39
|
+
return { agentPreset: mounted.id };
|
|
38
40
|
}
|
|
39
41
|
function parseControl(line) {
|
|
40
42
|
const match = /^\/([a-z][a-z0-9_-]*(?::[a-z0-9][a-z0-9_-]*)?)(?:\s+(.*))?$/su.exec(line.trim());
|
|
@@ -393,14 +395,19 @@ export class SessionRuntime {
|
|
|
393
395
|
#tracker;
|
|
394
396
|
#streamAttempts = new LiveAttemptTracker();
|
|
395
397
|
#recentCache = new Map();
|
|
398
|
+
#recentRowsPath;
|
|
399
|
+
#upgradeMarkerPath;
|
|
400
|
+
#recentRowsLoaded = false;
|
|
396
401
|
#refreshInFlight = null;
|
|
397
402
|
#refreshDirty = false;
|
|
398
403
|
#inspectEpoch = 0;
|
|
399
404
|
#activationEpoch = 0;
|
|
400
405
|
#inspectedId;
|
|
401
|
-
constructor(ctx, tui) {
|
|
406
|
+
constructor(ctx, tui, options = {}) {
|
|
402
407
|
this.#ctx = ctx;
|
|
403
408
|
this.#tui = tui;
|
|
409
|
+
this.#recentRowsPath = options.stateDir === undefined ? undefined : join(options.stateDir, 'recent-sessions.json');
|
|
410
|
+
this.#upgradeMarkerPath = options.stateDir === undefined ? undefined : join(options.stateDir, 'sessions-upgraded.json');
|
|
404
411
|
this.#tracker = new SubagentTracker({
|
|
405
412
|
rootId: () => this.#active?.handle.agent.id,
|
|
406
413
|
depth: (session) => {
|
|
@@ -446,8 +453,13 @@ export class SessionRuntime {
|
|
|
446
453
|
}
|
|
447
454
|
const jobs = this.#ctx.get('jobs');
|
|
448
455
|
if (jobs !== undefined) {
|
|
449
|
-
|
|
450
|
-
|
|
456
|
+
// Settlements speak session ids, so the owning Agent is resolved here;
|
|
457
|
+
// a job whose owner is gone has no notice to show.
|
|
458
|
+
this.#off.push(jobs.events.subscribe({ owners: 'scope' }, (event) => {
|
|
459
|
+
if (event.type !== 'settled')
|
|
460
|
+
return;
|
|
461
|
+
const owner = event.job.owner === undefined ? undefined : this.#ctx.get('agents')?.get(event.job.owner);
|
|
462
|
+
const notice = jobNoticeFor(event.job, owner, this.#active?.handle.agent);
|
|
451
463
|
if (notice !== undefined)
|
|
452
464
|
tui.notice(notice);
|
|
453
465
|
}));
|
|
@@ -535,6 +547,13 @@ export class SessionRuntime {
|
|
|
535
547
|
this.#pushSessionInfo();
|
|
536
548
|
}));
|
|
537
549
|
}
|
|
550
|
+
// One-time per session format, off the first render: stored logs an earlier
|
|
551
|
+
// release wrote get their current-format generation here rather than on the
|
|
552
|
+
// next listing or search that has to decode them.
|
|
553
|
+
ctx.inject(['sessionPersistence'], (persistenceCtx) => {
|
|
554
|
+
void this.#upgradeStoredSessions(persistenceCtx.sessionPersistence)
|
|
555
|
+
.catch((error) => { persistenceCtx.logger.warn(error); });
|
|
556
|
+
});
|
|
538
557
|
}
|
|
539
558
|
get agent() {
|
|
540
559
|
return this.#active?.handle.agent;
|
|
@@ -688,7 +707,6 @@ export class SessionRuntime {
|
|
|
688
707
|
contextWindow: undefined,
|
|
689
708
|
reasoningEffort: undefined,
|
|
690
709
|
agentPreset: configuration.agentPreset,
|
|
691
|
-
disposeToolPresentation: configuration.disposeToolPresentation,
|
|
692
710
|
});
|
|
693
711
|
await this.refreshRecent();
|
|
694
712
|
}
|
|
@@ -817,7 +835,6 @@ export class SessionRuntime {
|
|
|
817
835
|
contextWindow: undefined,
|
|
818
836
|
reasoningEffort: undefined,
|
|
819
837
|
agentPreset: configuration.agentPreset,
|
|
820
|
-
disposeToolPresentation: configuration.disposeToolPresentation,
|
|
821
838
|
});
|
|
822
839
|
this.#tui.restoreInput({ text, images });
|
|
823
840
|
this.#tui.notice(`Rewound to before turn ${selected.turn}. The original session remains available in /resume.`);
|
|
@@ -864,15 +881,7 @@ export class SessionRuntime {
|
|
|
864
881
|
const active = this.#requiredActive();
|
|
865
882
|
if (active.agentPreset === id)
|
|
866
883
|
return active.agentPreset;
|
|
867
|
-
const previousPreset = active.agentPreset;
|
|
868
884
|
const preset = await this.#ctx.agentPresets.recompose(agent.ctx, id);
|
|
869
|
-
try {
|
|
870
|
-
this.#replaceToolPresentation(active, toolPresentationForPreset(preset.id));
|
|
871
|
-
}
|
|
872
|
-
catch (error) {
|
|
873
|
-
await this.#ctx.agentPresets.recompose(agent.ctx, previousPreset);
|
|
874
|
-
throw error;
|
|
875
|
-
}
|
|
876
885
|
active.agentPreset = preset.id;
|
|
877
886
|
agent.session.append('agent-preset/selected', { agentPreset: preset.id });
|
|
878
887
|
this.#pushTools();
|
|
@@ -892,6 +901,50 @@ export class SessionRuntime {
|
|
|
892
901
|
this.#pushSessionInfo();
|
|
893
902
|
return outcome;
|
|
894
903
|
}
|
|
904
|
+
/**
|
|
905
|
+
* Publish a current-format generation for every stored session an earlier
|
|
906
|
+
* release wrote. A read open never upgrades a log, so without this pass
|
|
907
|
+
* every listing and search keeps decoding the historical corpus — the pass
|
|
908
|
+
* runs once per session format, in the background, and skips a session
|
|
909
|
+
* another live process owns.
|
|
910
|
+
*/
|
|
911
|
+
async #upgradeStoredSessions(persistence) {
|
|
912
|
+
const markerPath = this.#upgradeMarkerPath;
|
|
913
|
+
if (markerPath === undefined)
|
|
914
|
+
return;
|
|
915
|
+
const marker = readJsonFile(markerPath);
|
|
916
|
+
if (typeof marker?.sessionFormat === 'number' && marker.sessionFormat >= SESSION_FORMAT_VERSION)
|
|
917
|
+
return;
|
|
918
|
+
const before = await persistence.list();
|
|
919
|
+
const revisions = new Map(before.map(snapshot => [String(snapshot.header.id), snapshot.revision]));
|
|
920
|
+
const active = this.#active?.handle.agent.id;
|
|
921
|
+
for (const snapshot of before) {
|
|
922
|
+
if (this.#disposed)
|
|
923
|
+
return;
|
|
924
|
+
if (String(snapshot.header.id) === active)
|
|
925
|
+
continue;
|
|
926
|
+
try {
|
|
927
|
+
const handle = await persistence.open(snapshot.header.id, 'write');
|
|
928
|
+
await handle.close();
|
|
929
|
+
}
|
|
930
|
+
catch (error) {
|
|
931
|
+
// Another process owns it, or the log is unreadable: leave it alone.
|
|
932
|
+
if (!(error instanceof SessionAlreadyOwnedError))
|
|
933
|
+
this.#ctx.logger.debug(error);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
if (this.#disposed)
|
|
937
|
+
return;
|
|
938
|
+
let upgraded = 0;
|
|
939
|
+
for (const snapshot of await persistence.list()) {
|
|
940
|
+
if (revisions.get(String(snapshot.header.id)) !== snapshot.revision)
|
|
941
|
+
upgraded += 1;
|
|
942
|
+
}
|
|
943
|
+
writeJsonAtomic(markerPath, { sessionFormat: SESSION_FORMAT_VERSION });
|
|
944
|
+
if (upgraded > 0) {
|
|
945
|
+
this.#tui.notice(`Upgraded ${upgraded} stored session${upgraded === 1 ? '' : 's'} to the current format.`);
|
|
946
|
+
}
|
|
947
|
+
}
|
|
895
948
|
async refreshRecent() {
|
|
896
949
|
// Coalesce concurrent callers: the recent list is one snapshot, and a
|
|
897
950
|
// burst of title/status events must not queue a read of every stored log.
|
|
@@ -921,24 +974,40 @@ export class SessionRuntime {
|
|
|
921
974
|
}
|
|
922
975
|
const snapshots = (await persistence.list()).filter(snapshot => snapshot.header.origin !== 'subagent')
|
|
923
976
|
.sort((left, right) => right.header.createdAt - left.header.createdAt);
|
|
977
|
+
// A stored row stays valid while its revision holds, so a cold process
|
|
978
|
+
// renders labels for unchanged sessions without reading their logs; only a
|
|
979
|
+
// new or changed session pays a read.
|
|
980
|
+
if (!this.#recentRowsLoaded && this.#recentRowsPath !== undefined) {
|
|
981
|
+
this.#recentRowsLoaded = true;
|
|
982
|
+
for (const [id, memo] of readRecentRows(this.#recentRowsPath))
|
|
983
|
+
this.#recentCache.set(id, memo);
|
|
984
|
+
}
|
|
924
985
|
const rows = [];
|
|
986
|
+
let memoChanged = false;
|
|
925
987
|
const liveIds = new Set(snapshots.map(snapshot => snapshot.header.id));
|
|
926
|
-
for (const id of this.#recentCache.keys())
|
|
927
|
-
if (
|
|
928
|
-
|
|
988
|
+
for (const id of this.#recentCache.keys()) {
|
|
989
|
+
if (liveIds.has(id))
|
|
990
|
+
continue;
|
|
991
|
+
this.#recentCache.delete(id);
|
|
992
|
+
memoChanged = true;
|
|
993
|
+
}
|
|
929
994
|
for (const snapshot of snapshots) {
|
|
930
995
|
const header = snapshot.header;
|
|
931
996
|
const cached = this.#recentCache.get(header.id);
|
|
932
997
|
if (cached?.revision === snapshot.revision) {
|
|
933
|
-
|
|
998
|
+
if (cached.row !== null)
|
|
999
|
+
rows.push(cached.row);
|
|
934
1000
|
continue;
|
|
935
1001
|
}
|
|
936
1002
|
try {
|
|
937
1003
|
const log = await readColdSessionLog(persistence, header.id);
|
|
938
1004
|
const status = recentSessionStatus(log.events);
|
|
939
1005
|
const content = recentSessionContent(log.events);
|
|
940
|
-
if (content === undefined)
|
|
1006
|
+
if (content === undefined) {
|
|
1007
|
+
this.#recentCache.set(header.id, { revision: snapshot.revision, row: null });
|
|
1008
|
+
memoChanged = true;
|
|
941
1009
|
continue;
|
|
1010
|
+
}
|
|
942
1011
|
const row = {
|
|
943
1012
|
id: header.id,
|
|
944
1013
|
...content,
|
|
@@ -948,12 +1017,15 @@ export class SessionRuntime {
|
|
|
948
1017
|
...(status === undefined ? {} : { status }),
|
|
949
1018
|
};
|
|
950
1019
|
this.#recentCache.set(header.id, { revision: snapshot.revision, row });
|
|
1020
|
+
memoChanged = true;
|
|
951
1021
|
rows.push(row);
|
|
952
1022
|
}
|
|
953
1023
|
catch {
|
|
954
1024
|
rows.push({ id: header.id, title: '(unavailable session)', createdAt: header.createdAt });
|
|
955
1025
|
}
|
|
956
1026
|
}
|
|
1027
|
+
if (memoChanged && this.#recentRowsPath !== undefined)
|
|
1028
|
+
writeRecentRows(this.#recentRowsPath, this.#recentCache);
|
|
957
1029
|
this.#recent = rows;
|
|
958
1030
|
this.#pushSessionInfo();
|
|
959
1031
|
}
|
|
@@ -1002,7 +1074,6 @@ export class SessionRuntime {
|
|
|
1002
1074
|
contextWindow: undefined,
|
|
1003
1075
|
reasoningEffort: undefined,
|
|
1004
1076
|
agentPreset: configuration.agentPreset,
|
|
1005
|
-
disposeToolPresentation: configuration.disposeToolPresentation,
|
|
1006
1077
|
};
|
|
1007
1078
|
}
|
|
1008
1079
|
/**
|
|
@@ -1238,23 +1309,6 @@ export class SessionRuntime {
|
|
|
1238
1309
|
controls: this.#sessionControls(active, projection),
|
|
1239
1310
|
});
|
|
1240
1311
|
}
|
|
1241
|
-
#replaceToolPresentation(active, mode) {
|
|
1242
|
-
const previousMode = toolPresentationForPreset(active.agentPreset);
|
|
1243
|
-
active.disposeToolPresentation();
|
|
1244
|
-
try {
|
|
1245
|
-
const tools = active.handle.agent.ctx.get('tools');
|
|
1246
|
-
if (tools === undefined)
|
|
1247
|
-
throw new Error('tool registry is unavailable');
|
|
1248
|
-
active.disposeToolPresentation = tools.presentAs(mode);
|
|
1249
|
-
}
|
|
1250
|
-
catch (error) {
|
|
1251
|
-
const tools = active.handle.agent.ctx.get('tools');
|
|
1252
|
-
if (tools === undefined)
|
|
1253
|
-
throw error;
|
|
1254
|
-
active.disposeToolPresentation = tools.presentAs(previousMode);
|
|
1255
|
-
throw error;
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
1312
|
#replaceTranscript(agent) {
|
|
1259
1313
|
const events = agent.session.snapshotEvents();
|
|
1260
1314
|
this.#tracker.observeCatalog(agent.session, events);
|