@agi-fans/dsh-tui 0.23.0 → 0.24.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 +40 -1
- package/lib/commands/diff.js +58 -33
- package/lib/commands/diff.js.map +1 -1
- package/lib/commands/export.js +3 -1
- package/lib/commands/export.js.map +1 -1
- package/lib/commands/files.js +10 -2
- package/lib/commands/files.js.map +1 -1
- package/lib/commands/model.js +15 -8
- package/lib/commands/model.js.map +1 -1
- package/lib/commands/session.js +6 -1
- package/lib/commands/session.js.map +1 -1
- package/lib/definition.d.ts +10 -0
- package/lib/locale/zh.d.ts +26 -6
- package/lib/locale/zh.js +26 -6
- package/lib/locale/zh.js.map +1 -1
- package/lib/runtime/account-settings.d.ts +1 -0
- package/lib/runtime/account-settings.js +2 -2
- package/lib/runtime/account-settings.js.map +1 -1
- package/lib/runtime/model-settings.d.ts +2 -0
- package/lib/runtime/model-settings.js +2 -2
- package/lib/runtime/model-settings.js.map +1 -1
- package/lib/runtime/plugin-settings.d.ts +1 -0
- package/lib/runtime/plugin-settings.js +6 -6
- package/lib/runtime/plugin-settings.js.map +1 -1
- package/lib/runtime/provider-local.d.ts +3 -0
- package/lib/runtime/provider-local.js +110 -22
- package/lib/runtime/provider-local.js.map +1 -1
- package/lib/runtime/settings-preferences.js +1 -1
- package/lib/runtime/settings-preferences.js.map +1 -1
- package/lib/session/feature-toggles.js +2 -2
- package/lib/session/feature-toggles.js.map +1 -1
- package/lib/session/session-controller.d.ts +2 -8
- package/lib/session/session-controller.js +57 -32
- package/lib/session/session-controller.js.map +1 -1
- package/lib/session/session-library.d.ts +3 -1
- package/lib/session/session-library.js +15 -0
- package/lib/session/session-library.js.map +1 -1
- package/lib/session/tui-settings.d.ts +2 -0
- package/lib/session/tui-settings.js +1 -0
- package/lib/session/tui-settings.js.map +1 -1
- package/lib/views/autocomplete.d.ts +3 -6
- package/lib/views/autocomplete.js +10 -8
- package/lib/views/autocomplete.js.map +1 -1
- package/lib/views/document-reader.js +4 -1
- package/lib/views/document-reader.js.map +1 -1
- package/lib/views/settings-list.d.ts +5 -0
- package/lib/views/settings-list.js +46 -10
- package/lib/views/settings-list.js.map +1 -1
- package/lib/views/transcript-render.d.ts +2 -0
- package/lib/views/transcript-render.js +31 -19
- package/lib/views/transcript-render.js.map +1 -1
- package/package.json +1 -1
|
@@ -27,7 +27,7 @@ export function preferencePaths(id) {
|
|
|
27
27
|
const status = { statusEnabled: 'enabled', statusLabels: 'labels', statusContextStyle: 'contextStyle' };
|
|
28
28
|
if (Object.hasOwn(status, id))
|
|
29
29
|
return [['statusBar', status[id]]];
|
|
30
|
-
if (['uiLanguage', 'theme', 'colors', 'motion', 'mathMode', 'mermaidMode', 'hideThinking', 'editor', 'terminalTitle', 'terminalState', 'busyEnter', 'pasteProtection', 'copyOnSelect', 'mouseInteraction', 'checkUpdates', 'startupChangelog', 'notifications', 'notificationFocus', 'notificationThreshold'].includes(id))
|
|
30
|
+
if (['uiLanguage', 'theme', 'colors', 'motion', 'mathMode', 'mermaidMode', 'hideThinking', 'showFileChanges', 'editor', 'terminalTitle', 'terminalState', 'busyEnter', 'pasteProtection', 'copyOnSelect', 'mouseInteraction', 'checkUpdates', 'startupChangelog', 'notifications', 'notificationFocus', 'notificationThreshold'].includes(id))
|
|
31
31
|
return [[id]];
|
|
32
32
|
return undefined;
|
|
33
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-preferences.js","sourceRoot":"","sources":["../../src/runtime/settings-preferences.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAG7C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAE3D,MAAM,UAAU,iBAAiB,CAAC,QAAkB,EAAE,IAAc;IAClE,MAAM,KAAK,GAAqB,EAAE,CAAA;IAClC,MAAM,IAAI,GAAG,CAAC,MAAe,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C/H,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;QAAE,OAAO,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,CAAE,CAAC,CAAC,CAAA;IAClE,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,iBAAiB,EAAE,QAAQ,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE,eAAe,EAAE,mBAAmB,EAAE,uBAAuB,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;QAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAC5V,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
|
@@ -28,8 +28,8 @@ import { join } from 'node:path';
|
|
|
28
28
|
export const FEATURE_TOGGLES = [
|
|
29
29
|
{
|
|
30
30
|
id: 'workspace-changes',
|
|
31
|
-
label: '
|
|
32
|
-
description: '
|
|
31
|
+
label: 'Record file changes',
|
|
32
|
+
description: 'Record changed files and per-turn comparisons. Off skips Git snapshots for future turns.',
|
|
33
33
|
enabledByDefault: true,
|
|
34
34
|
},
|
|
35
35
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-toggles.js","sourceRoot":"","sources":["../../src/session/feature-toggles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAchC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,eAAe,GAA6B;IACvD;QACE,EAAE,EAAE,mBAAmB;QACvB,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"feature-toggles.js","sourceRoot":"","sources":["../../src/session/feature-toggles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,E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f,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,OAAO,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAA;AAC/D,CAAC"}
|
|
@@ -21,7 +21,7 @@ import { type SessionEvent } from '@deepseek-ai/dsh-session';
|
|
|
21
21
|
import type { GoalProjection } from '@deepseek-ai/dsh-goal/types';
|
|
22
22
|
import type { UserQuestionProjectionView } from '@deepseek-ai/dsh-user-questions';
|
|
23
23
|
export { conversationTurns, type ConversationTurn } from './conversation-turns.ts';
|
|
24
|
-
import type { TuiCommand, TuiRecentSession, TuiService, TuiSessionControls, TuiSessionStats, TuiSubmission, TuiQueueEditRequest, TuiInputImage } from '../definition.ts';
|
|
24
|
+
import type { TuiCommand, TuiRecentSession, TuiArgumentOption, TuiService, TuiSessionControls, TuiSessionStats, TuiSubmission, TuiQueueEditRequest, TuiInputImage } from '../definition.ts';
|
|
25
25
|
import type { ContextDiagnostics } from './context-diagnostics.ts';
|
|
26
26
|
/** Projection values consumed as one consistent snapshot when the units exist. */
|
|
27
27
|
export interface TuiStatsProjection {
|
|
@@ -155,10 +155,4 @@ export declare class SessionRuntime {
|
|
|
155
155
|
dispose(): Promise<void>;
|
|
156
156
|
}
|
|
157
157
|
/** Candidates for an argument prefix, matched the way the command list matches. */
|
|
158
|
-
export declare function matchArgumentOptions(options: readonly
|
|
159
|
-
value: string;
|
|
160
|
-
description?: string;
|
|
161
|
-
}[], prefix: string): readonly {
|
|
162
|
-
value: string;
|
|
163
|
-
description?: string;
|
|
164
|
-
}[];
|
|
158
|
+
export declare function matchArgumentOptions(options: readonly TuiArgumentOption[], prefix: string): readonly TuiArgumentOption[];
|
|
@@ -29,7 +29,7 @@ import { buildSessionTree, markedSessionTree, sessionTreeFamily } from "./sessio
|
|
|
29
29
|
export { conversationTurns } from "./conversation-turns.js";
|
|
30
30
|
import { jobNoticeFor } from "./job-notice.js";
|
|
31
31
|
import { descendantDepth, isSteerableSubagent } from "./subagent-roster.js";
|
|
32
|
-
import { readRecentRows, writeRecentRows, readSessionLibrary, sessionLibraryPath, setSessionLabel } from "./session-library.js";
|
|
32
|
+
import { readRecentRows, writeRecentRows, readSessionLibrary, sessionArgumentOptions, sessionLibraryPath, setSessionLabel } from "./session-library.js";
|
|
33
33
|
import { currentWorkingDirectory } from "./working-directory.js";
|
|
34
34
|
import { SubagentTracker } from "./subagent-tracker.js";
|
|
35
35
|
import { commandPermission } from "../commands/permission.js";
|
|
@@ -420,10 +420,11 @@ export class SessionRuntime {
|
|
|
420
420
|
* Live argument vocabularies, keyed by command.
|
|
421
421
|
*
|
|
422
422
|
* A snapshot rather than a callback into the services: completion runs on every
|
|
423
|
-
* keystroke and must not await a catalog.
|
|
424
|
-
*
|
|
423
|
+
* keystroke and must not await a catalog. Session refreshes publish recent
|
|
424
|
+
* rows immediately and load each provider independently.
|
|
425
425
|
*/
|
|
426
426
|
#argumentOptions = new Map();
|
|
427
|
+
#argumentEpoch = 0;
|
|
427
428
|
#started = false;
|
|
428
429
|
#retired = [];
|
|
429
430
|
// Weak: deduplication must not retain disposed session graphs.
|
|
@@ -566,8 +567,10 @@ export class SessionRuntime {
|
|
|
566
567
|
if (session.id === (this.#inspectedId ?? active.handle.agent.id)) {
|
|
567
568
|
tui.setWorkingDirectory?.(currentWorkingDirectory(ctx, session));
|
|
568
569
|
}
|
|
569
|
-
if (session === active.handle.agent.session)
|
|
570
|
+
if (session === active.handle.agent.session) {
|
|
570
571
|
void this.#refreshSkills().catch(error => { ctx.logger.warn(error); });
|
|
572
|
+
void this.refreshRecent().catch(error => { ctx.logger.warn(error); });
|
|
573
|
+
}
|
|
571
574
|
}
|
|
572
575
|
if (session.id === this.#inspectedId) {
|
|
573
576
|
const child = ctx.get('agents')?.get(session.id);
|
|
@@ -1263,7 +1266,12 @@ export class SessionRuntime {
|
|
|
1263
1266
|
inheritedEventCount: SessionLogOffset(selected.branchIndex),
|
|
1264
1267
|
agentOptions: { provider: selection.provider, model: selection.model },
|
|
1265
1268
|
signal,
|
|
1266
|
-
setup: async (agentCtx, agent) => {
|
|
1269
|
+
setup: async (agentCtx, agent) => {
|
|
1270
|
+
// A pre-turn prefix includes admission but excludes the later inbox claim.
|
|
1271
|
+
// Cancel that inherited work durably before publishing the editable fork.
|
|
1272
|
+
agent.inbox.clear();
|
|
1273
|
+
configured = await setupAgentContext(agentCtx, agent);
|
|
1274
|
+
},
|
|
1267
1275
|
});
|
|
1268
1276
|
try {
|
|
1269
1277
|
this.assertActive(agent);
|
|
@@ -1386,34 +1394,41 @@ export class SessionRuntime {
|
|
|
1386
1394
|
/**
|
|
1387
1395
|
* Rebuild the argument vocabularies the composer completes.
|
|
1388
1396
|
*
|
|
1389
|
-
* A snapshot, because completion runs per keystroke
|
|
1390
|
-
* `/resume <id>`
|
|
1397
|
+
* A snapshot, because completion runs per keystroke. `/model provider/model`
|
|
1398
|
+
* and `/resume <id>` are names that already exist in
|
|
1391
1399
|
* this process, so the reader types toward them instead of opening a picker.
|
|
1392
1400
|
*/
|
|
1393
1401
|
async #refreshArgumentOptions() {
|
|
1394
|
-
const
|
|
1402
|
+
const epoch = ++this.#argumentEpoch;
|
|
1395
1403
|
const llm = this.#ctx.get('llm');
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1404
|
+
const providers = llm?.listProviders() ?? [];
|
|
1405
|
+
const previous = this.#argumentOptions.get('model') ?? [];
|
|
1406
|
+
const groups = new Map(providers.map(provider => [provider.id, previous.filter(model => model.value.startsWith(`${provider.id}/`))]));
|
|
1407
|
+
const options = new Map([['resume', sessionArgumentOptions(this.#recent)]]);
|
|
1408
|
+
const publish = () => {
|
|
1409
|
+
if (this.#disposed || epoch !== this.#argumentEpoch)
|
|
1410
|
+
return;
|
|
1411
|
+
options.set('model', providers.flatMap(provider => groups.get(provider.id) ?? []));
|
|
1412
|
+
this.#argumentOptions = options;
|
|
1413
|
+
this.#pushCommands();
|
|
1414
|
+
};
|
|
1415
|
+
publish();
|
|
1416
|
+
await Promise.all(providers.map(async (provider) => {
|
|
1417
|
+
try {
|
|
1418
|
+
const models = await llm?.listModels(provider.id) ?? [];
|
|
1419
|
+
if (this.#disposed || epoch !== this.#argumentEpoch)
|
|
1420
|
+
return;
|
|
1421
|
+
groups.set(provider.id, models.map(model => ({
|
|
1422
|
+
value: `${provider.id}/${model.id}`,
|
|
1423
|
+
...(model.name === undefined ? {} : { description: model.name }),
|
|
1424
|
+
})));
|
|
1407
1425
|
}
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
})));
|
|
1415
|
-
this.#argumentOptions = options;
|
|
1416
|
-
this.#pushCommands();
|
|
1426
|
+
catch {
|
|
1427
|
+
// Preserve the last successful catalog. The model picker owns diagnostics.
|
|
1428
|
+
return;
|
|
1429
|
+
}
|
|
1430
|
+
publish();
|
|
1431
|
+
}));
|
|
1417
1432
|
}
|
|
1418
1433
|
async refreshRecent() {
|
|
1419
1434
|
// Coalesce concurrent callers: the recent list is one snapshot, and a
|
|
@@ -1431,15 +1446,18 @@ export class SessionRuntime {
|
|
|
1431
1446
|
break;
|
|
1432
1447
|
this.#refreshDirty = false;
|
|
1433
1448
|
}
|
|
1434
|
-
})().finally(() => {
|
|
1449
|
+
})().finally(() => {
|
|
1450
|
+
this.#refreshInFlight = null;
|
|
1451
|
+
// Completion must read the newly published rows, not the previous
|
|
1452
|
+
// directory's snapshot while persistence.list() is still pending.
|
|
1453
|
+
queueMicrotask(() => { if (!this.#disposed)
|
|
1454
|
+
void this.#refreshArgumentOptions().catch(() => { }); });
|
|
1455
|
+
});
|
|
1435
1456
|
this.#refreshInFlight = run;
|
|
1436
1457
|
return run;
|
|
1437
1458
|
}
|
|
1438
1459
|
async #refreshRecentNow() {
|
|
1439
1460
|
this.#archivedSessions = new Set(readSessionLibrary(this.#libraryPath).archived);
|
|
1440
|
-
// The recent list is what `/resume` completes from, so a refresh of one is a
|
|
1441
|
-
// refresh of the other. Deferred to avoid recursing through #pushCommands.
|
|
1442
|
-
queueMicrotask(() => { void this.#refreshArgumentOptions().catch(() => { }); });
|
|
1443
1461
|
const persistence = this.#ctx.get('sessionPersistence');
|
|
1444
1462
|
if (persistence === undefined) {
|
|
1445
1463
|
this.#recent = [];
|
|
@@ -1448,6 +1466,8 @@ export class SessionRuntime {
|
|
|
1448
1466
|
}
|
|
1449
1467
|
const snapshots = (await persistence.list()).filter(snapshot => snapshot.header.origin !== 'subagent')
|
|
1450
1468
|
.sort((left, right) => right.header.createdAt - left.header.createdAt);
|
|
1469
|
+
const agent = this.agent;
|
|
1470
|
+
const cwd = agent === undefined ? process.cwd() : currentWorkingDirectory(this.#ctx, agent.session);
|
|
1451
1471
|
// A stored row stays valid while its revision holds, so a cold process
|
|
1452
1472
|
// renders labels for unchanged sessions without reading their logs; only a
|
|
1453
1473
|
// new or changed session pays a read.
|
|
@@ -1467,6 +1487,10 @@ export class SessionRuntime {
|
|
|
1467
1487
|
}
|
|
1468
1488
|
for (const snapshot of snapshots) {
|
|
1469
1489
|
const header = snapshot.header;
|
|
1490
|
+
// Scope before opening logs or consulting shared row caches. Other
|
|
1491
|
+
// directories remain available through an explicit session ID.
|
|
1492
|
+
if (header.cwd !== cwd)
|
|
1493
|
+
continue;
|
|
1470
1494
|
const cached = this.#recentCache.get(header.id);
|
|
1471
1495
|
if (snapshot.formatStatus === 'migration-required') {
|
|
1472
1496
|
// Do not open the log merely to browse it. A previous label is a hint;
|
|
@@ -2018,6 +2042,7 @@ export function matchArgumentOptions(options, prefix) {
|
|
|
2018
2042
|
if (lower === '')
|
|
2019
2043
|
return options;
|
|
2020
2044
|
return options.filter(option => option.value.toLowerCase().includes(lower)
|
|
2045
|
+
|| (option.label ?? '').toLowerCase().includes(lower)
|
|
2021
2046
|
|| (option.description ?? '').toLowerCase().includes(lower));
|
|
2022
2047
|
}
|
|
2023
2048
|
//# sourceMappingURL=session-controller.js.map
|