@antst/dashi 0.1.0-alpha.14 → 0.1.0-alpha.15

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/rewind.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { ModelSelection } from '@deepseek-ai/dsh-api-session-controller';
1
2
  import type { SessionEvent } from '@deepseek-ai/dsh-session';
2
3
  import type { Overlay, OverlayValue } from './state.js';
3
4
  export interface RewindBoundary {
@@ -5,6 +6,11 @@ export interface RewindBoundary {
5
6
  readonly label: string;
6
7
  readonly prompt: string;
7
8
  }
9
+ /** Return only a selection that DSH recorded for the source session. */
10
+ export declare function rewindModelSelection(projection: {
11
+ readonly lastUsed: ModelSelection | null;
12
+ readonly next: ModelSelection | null;
13
+ } | undefined): ModelSelection | undefined;
8
14
  /** Return the text of a direct human message, excluding injected context. */
9
15
  export declare function humanPrompt(event: SessionEvent): string | undefined;
10
16
  /** Recover one composer input from DSH's durable log. */
package/lib/rewind.js CHANGED
@@ -1,3 +1,7 @@
1
+ /** Return only a selection that DSH recorded for the source session. */
2
+ export function rewindModelSelection(projection) {
3
+ return projection?.next ?? projection?.lastUsed ?? undefined;
4
+ }
1
5
  /** Return the text of a direct human message, excluding injected context. */
2
6
  export function humanPrompt(event) {
3
7
  if (event.type !== 'user/message' || event.data.source.kind !== 'user')
@@ -9,7 +9,7 @@ import { diffOverlay } from './diff-view.js';
9
9
  import { eventsFromRecords } from './history-records.js';
10
10
  import { admitDraftImages, encodeDraftImages, readDraftImages } from './image-input.js';
11
11
  import { contextPercent, jobViews, subagentViews } from './presentation.js';
12
- import { historyInput, historyInputs, humanPrompt, inheritedTurn, rewindActionOverlay, rewindOverlay, } from './rewind.js';
12
+ import { historyInput, historyInputs, humanPrompt, inheritedTurn, rewindActionOverlay, rewindOverlay, rewindModelSelection, } from './rewind.js';
13
13
  import { createToolPresenter } from './tool-presentation.js';
14
14
  import { quoteShellWord, runHumanShell } from './shell-command.js';
15
15
  import { markdownTranscript } from './session-export.js';
@@ -449,13 +449,12 @@ export async function createSessionRuntime(ctx, options, tuiRoot, dispatch, deci
449
449
  ?? ctx.agentPresets.defaultId;
450
450
  const modelProjection = ctx.sessionProjections.snapshot(bound.agent.session, ['modelSelection'])
451
451
  .values.modelSelection;
452
- const selection = modelProjection?.next ?? modelProjection?.lastUsed ?? undefined;
452
+ const selection = rewindModelSelection(modelProjection);
453
453
  const created = await ctx.sessionController.create({ cwd: bound.root.cwd, agentPreset });
454
454
  let selectionFailure;
455
455
  try {
456
- if (selection === undefined)
457
- throw new Error('the current session has no durable model selection');
458
- await ctx.sessionController.selectModel({ sessionId: created.sessionId, ...selection });
456
+ if (selection !== undefined)
457
+ await ctx.sessionController.selectModel({ sessionId: created.sessionId, ...selection });
459
458
  }
460
459
  catch (error) {
461
460
  selectionFailure = error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antst/dashi",
3
- "version": "0.1.0-alpha.14",
3
+ "version": "0.1.0-alpha.15",
4
4
  "description": "A terminal UI for DeepSeek Harness",
5
5
  "publishConfig": {
6
6
  "access": "public"