@askdkc/dsh-cli 0.12.3 → 0.13.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.
Files changed (162) hide show
  1. package/cordis.patch.yml +12 -131
  2. package/lib/types/adapter/channel/session-projection.d.ts.map +1 -1
  3. package/lib/types/adapter/channel/session-projection.js +0 -7
  4. package/lib/types/adapter/ports/channel-view.d.ts +1 -1
  5. package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
  6. package/lib/types/dsh-adapter/bundled-presets.d.ts +3 -8
  7. package/lib/types/dsh-adapter/bundled-presets.d.ts.map +1 -1
  8. package/lib/types/dsh-adapter/bundled-presets.js +5 -20
  9. package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
  10. package/lib/types/dsh-adapter/channel/binding-events.js +2 -9
  11. package/lib/types/dsh-adapter/channel/external-commands.d.ts.map +1 -1
  12. package/lib/types/dsh-adapter/channel/external-commands.js +9 -33
  13. package/lib/types/dsh-adapter/channel/local-actions.d.ts +2 -1
  14. package/lib/types/dsh-adapter/channel/local-actions.d.ts.map +1 -1
  15. package/lib/types/dsh-adapter/channel/local-actions.js +6 -2
  16. package/lib/types/dsh-adapter/channel/model-actions.js +3 -3
  17. package/lib/types/dsh-adapter/channel/model-switch.d.ts.map +1 -1
  18. package/lib/types/dsh-adapter/channel/model-switch.js +0 -1
  19. package/lib/types/dsh-adapter/channel/permissions.d.ts +1 -6
  20. package/lib/types/dsh-adapter/channel/permissions.d.ts.map +1 -1
  21. package/lib/types/dsh-adapter/channel/permissions.js +2 -54
  22. package/lib/types/dsh-adapter/channel/projection.d.ts.map +1 -1
  23. package/lib/types/dsh-adapter/channel/projection.js +15 -70
  24. package/lib/types/dsh-adapter/channel/session-fork.d.ts.map +1 -1
  25. package/lib/types/dsh-adapter/channel/session-fork.js +0 -1
  26. package/lib/types/dsh-adapter/channel/session-metadata.d.ts.map +1 -1
  27. package/lib/types/dsh-adapter/channel/session-metadata.js +1 -4
  28. package/lib/types/dsh-adapter/channel/session-resume.js +2 -2
  29. package/lib/types/dsh-adapter/channel/session-rewind.d.ts.map +1 -1
  30. package/lib/types/dsh-adapter/channel/session-rewind.js +0 -1
  31. package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts.map +1 -1
  32. package/lib/types/dsh-adapter/channel/session-tree-actions.js +1 -2
  33. package/lib/types/dsh-adapter/channel/session-tree.d.ts.map +1 -1
  34. package/lib/types/dsh-adapter/channel/session-tree.js +9 -62
  35. package/lib/types/dsh-adapter/channel/skill-catalog.js +1 -1
  36. package/lib/types/dsh-adapter/channel/subagent-projection.d.ts.map +1 -1
  37. package/lib/types/dsh-adapter/channel/subagent-projection.js +2 -8
  38. package/lib/types/dsh-adapter/channel/transcript.d.ts +0 -16
  39. package/lib/types/dsh-adapter/channel/transcript.d.ts.map +1 -1
  40. package/lib/types/dsh-adapter/channel/transcript.js +0 -43
  41. package/lib/types/dsh-adapter/channel.js +2 -2
  42. package/lib/types/dsh-adapter/compat/index.d.ts +5 -25
  43. package/lib/types/dsh-adapter/compat/index.d.ts.map +1 -1
  44. package/lib/types/dsh-adapter/compat/index.js +5 -25
  45. package/lib/types/dsh-adapter/compat/liveSession.d.ts +12 -23
  46. package/lib/types/dsh-adapter/compat/liveSession.d.ts.map +1 -1
  47. package/lib/types/dsh-adapter/compat/liveSession.js +15 -68
  48. package/lib/types/dsh-adapter/compat/messages.d.ts +1 -3
  49. package/lib/types/dsh-adapter/compat/messages.d.ts.map +1 -1
  50. package/lib/types/dsh-adapter/compat/messages.js +2 -10
  51. package/lib/types/dsh-adapter/compat/persistence.d.ts +2 -3
  52. package/lib/types/dsh-adapter/compat/persistence.d.ts.map +1 -1
  53. package/lib/types/dsh-adapter/compat/persistence.js +9 -14
  54. package/lib/types/dsh-adapter/compat/sessionLog.d.ts +10 -144
  55. package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -1
  56. package/lib/types/dsh-adapter/compat/sessionLog.js +45 -275
  57. package/lib/types/dsh-adapter/compat/settings.d.ts +4 -10
  58. package/lib/types/dsh-adapter/compat/settings.d.ts.map +1 -1
  59. package/lib/types/dsh-adapter/compat/settings.js +6 -23
  60. package/lib/types/dsh-adapter/compat/shell.d.ts +2 -3
  61. package/lib/types/dsh-adapter/compat/shell.d.ts.map +1 -1
  62. package/lib/types/dsh-adapter/compat/shell.js +2 -7
  63. package/lib/types/dsh-adapter/contract.d.ts +4 -34
  64. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  65. package/lib/types/dsh-adapter/contract.js +8 -83
  66. package/lib/types/dsh-adapter/packaged-presets.d.ts +0 -19
  67. package/lib/types/dsh-adapter/packaged-presets.d.ts.map +1 -1
  68. package/lib/types/dsh-adapter/packaged-presets.js +1 -83
  69. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  70. package/lib/types/dsh-adapter/plugin.js +25 -168
  71. package/lib/types/dsh-adapter/preset-resolution.d.ts +1 -22
  72. package/lib/types/dsh-adapter/preset-resolution.d.ts.map +1 -1
  73. package/lib/types/dsh-adapter/preset-resolution.js +0 -34
  74. package/lib/types/dsh-adapter/presets.d.ts +1 -4
  75. package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
  76. package/lib/types/dsh-adapter/presets.js +3 -6
  77. package/lib/types/dsh-adapter/questions-answerer.d.ts +5 -43
  78. package/lib/types/dsh-adapter/questions-answerer.d.ts.map +1 -1
  79. package/lib/types/dsh-adapter/questions-answerer.js +7 -63
  80. package/lib/types/dsh-adapter/sessionTree.d.ts +0 -19
  81. package/lib/types/dsh-adapter/sessionTree.d.ts.map +1 -1
  82. package/lib/types/dsh-adapter/sessionTree.js +2 -112
  83. package/lib/types/dsh-adapter/sessions/header.d.ts +2 -2
  84. package/lib/types/dsh-adapter/sessions/header.d.ts.map +1 -1
  85. package/lib/types/dsh-adapter/sessions/header.js +2 -8
  86. package/lib/types/dsh-adapter/sessions/list.d.ts +7 -28
  87. package/lib/types/dsh-adapter/sessions/list.d.ts.map +1 -1
  88. package/lib/types/dsh-adapter/sessions/list.js +48 -103
  89. package/lib/types/dsh-adapter/sessions/store.d.ts +1 -2
  90. package/lib/types/dsh-adapter/sessions/store.d.ts.map +1 -1
  91. package/lib/types/dsh-adapter/sessions/store.js +7 -10
  92. package/lib/types/dsh-adapter/sharp.d.ts.map +1 -1
  93. package/lib/types/dsh-adapter/sharp.js +0 -1
  94. package/lib/types/dsh-adapter/subagents.d.ts +1 -2
  95. package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
  96. package/lib/types/dsh-adapter/subagents.js +1 -12
  97. package/lib/types/dsh-adapter/trajectory/aggregate.d.ts +1 -1
  98. package/lib/types/dsh-adapter/trajectory/aggregate.js +1 -1
  99. package/lib/types/dsh-adapter/trajectory/guards.d.ts +5 -22
  100. package/lib/types/dsh-adapter/trajectory/guards.d.ts.map +1 -1
  101. package/lib/types/dsh-adapter/trajectory/guards.js +5 -23
  102. package/lib/types/dsh-adapter/trajectory/projection.d.ts +5 -21
  103. package/lib/types/dsh-adapter/trajectory/projection.d.ts.map +1 -1
  104. package/lib/types/dsh-adapter/trajectory/projection.js +4 -38
  105. package/lib/types/dsh-adapter/trajectory/types.d.ts +1 -1
  106. package/lib/types/dsh-adapter/trajectory/types.d.ts.map +1 -1
  107. package/lib/types/i18n.d.ts +2 -22
  108. package/lib/types/i18n.d.ts.map +1 -1
  109. package/lib/types/i18n.js +2 -10
  110. package/lib/types/presetPrefs.d.ts +1 -3
  111. package/lib/types/presetPrefs.d.ts.map +1 -1
  112. package/lib/types/presetPrefs.js +2 -4
  113. package/node_modules/@askdkc/dsh-auth/README.ja.md +28 -9
  114. package/node_modules/@askdkc/dsh-auth/README.md +19 -8
  115. package/node_modules/@askdkc/dsh-auth/dsh-plugin.json +3 -3
  116. package/node_modules/@askdkc/dsh-auth/lib/THIRD_PARTY_NOTICES.txt +168 -0
  117. package/node_modules/@askdkc/dsh-auth/lib/abortable.d.ts +2 -0
  118. package/node_modules/@askdkc/dsh-auth/lib/abortable.js +9 -0
  119. package/node_modules/@askdkc/dsh-auth/lib/auth-contract.d.ts +66 -0
  120. package/node_modules/@askdkc/dsh-auth/lib/auth-contract.js +1 -0
  121. package/node_modules/@askdkc/dsh-auth/lib/command.js +15 -1
  122. package/node_modules/@askdkc/dsh-auth/lib/credentials.d.ts +8 -14
  123. package/node_modules/@askdkc/dsh-auth/lib/credentials.js +1 -1
  124. package/node_modules/@askdkc/dsh-auth/lib/index.d.ts +8 -28
  125. package/node_modules/@askdkc/dsh-auth/lib/index.js +67 -65
  126. package/node_modules/@askdkc/dsh-auth/lib/interaction.d.ts +5 -5
  127. package/node_modules/@askdkc/dsh-auth/lib/opencode-adapter.d.ts +37 -0
  128. package/node_modules/@askdkc/dsh-auth/lib/opencode-adapter.js +197 -0
  129. package/node_modules/@askdkc/dsh-auth/lib/opencode-catalog.d.ts +72 -0
  130. package/node_modules/@askdkc/dsh-auth/lib/opencode-catalog.js +252 -0
  131. package/node_modules/@askdkc/dsh-auth/lib/opencode-codec.d.ts +6 -0
  132. package/node_modules/@askdkc/dsh-auth/lib/opencode-codec.js +93 -0
  133. package/node_modules/@askdkc/dsh-auth/lib/opencode-owned.generated.d.ts +113 -0
  134. package/node_modules/@askdkc/dsh-auth/lib/opencode-owned.generated.js +2866 -0
  135. package/node_modules/@askdkc/dsh-auth/lib/opencode-replay.d.ts +15 -0
  136. package/node_modules/@askdkc/dsh-auth/lib/opencode-replay.js +141 -0
  137. package/node_modules/@askdkc/dsh-auth/lib/opencode-sdk.d.ts +5 -0
  138. package/node_modules/@askdkc/dsh-auth/lib/opencode-sdk.js +43465 -0
  139. package/node_modules/@askdkc/dsh-auth/lib/opencode-sdk.js.map +7 -0
  140. package/node_modules/@askdkc/dsh-auth/lib/opencode-transport.d.ts +5 -0
  141. package/node_modules/@askdkc/dsh-auth/lib/opencode-transport.js +69 -0
  142. package/node_modules/@askdkc/dsh-auth/lib/pi-routes.d.ts +32 -0
  143. package/node_modules/@askdkc/dsh-auth/lib/pi-routes.js +45 -0
  144. package/node_modules/@askdkc/dsh-auth/lib/profiles.d.ts +2 -20
  145. package/node_modules/@askdkc/dsh-auth/lib/profiles.js +6 -41
  146. package/node_modules/@askdkc/dsh-auth/lib/routes.d.ts +20 -0
  147. package/node_modules/@askdkc/dsh-auth/lib/routes.js +13 -0
  148. package/node_modules/@askdkc/dsh-auth/lib/service.d.ts +11 -2
  149. package/node_modules/@askdkc/dsh-auth/lib/service.js +26 -16
  150. package/node_modules/@askdkc/dsh-auth/package.json +26 -15
  151. package/package.json +100 -96
  152. package/lib/types/dsh-adapter/providerGuard.d.ts +0 -75
  153. package/lib/types/dsh-adapter/providerGuard.d.ts.map +0 -1
  154. package/lib/types/dsh-adapter/providerGuard.js +0 -104
  155. package/lib/types/migrationPrefs.d.ts +0 -60
  156. package/lib/types/migrationPrefs.d.ts.map +0 -1
  157. package/lib/types/migrationPrefs.js +0 -97
  158. package/node_modules/@askdkc/dsh-auth/lib/fresh-models.d.ts +0 -59
  159. package/node_modules/@askdkc/dsh-auth/lib/fresh-models.js +0 -246
  160. package/node_modules/@askdkc/dsh-auth/lib/opencode-snapshot.generated.d.ts +0 -321
  161. package/node_modules/@askdkc/dsh-auth/lib/opencode-snapshot.generated.js +0 -528
  162. package/presets/liangshen/.dsh-tui-managed.json +0 -5
@@ -54,20 +54,4 @@ export declare function harnessToolResultView(name: string, data: SessionEvent<'
54
54
  export declare function toolErrorText(event: SessionEvent<'tool/result'>): string;
55
55
  /** Restore a folded tool row's result text from its tool/result event. */
56
56
  export declare function restoreToolResult(row: ChatRow, event: SessionEvent<'tool/result'>): void;
57
- /**
58
- * Prepare durable events for REPLAY (resume / rewind / model-switch fork):
59
- * drop settled `assistant/chunk` stream deltas — the sealed
60
- * `assistant/message` events carry the full text and reasoning blocks, so
61
- * per-token chunks add nothing to the replayed transcript while costing a
62
- * per-chunk renderEvent pass (a real 4.5MB session logs ~19k chunks against
63
- * ~30 messages). The trailing chunk run AFTER the last message belongs to an
64
- * unfinished step (crash-orphaned turn) and is kept, so a resumed session
65
- * still shows its partial content. Storage-level packed rows
66
- * (`text-chunks`/`reasoning-chunks`/`tool-call-chunks`) are dropped the
67
- * same way — defensive: the jsonl reader expands them, but a future
68
- * direct-pass path must not resurrect them. Replay-side tps sampling is
69
- * lost with the chunks (a live metric; lastUsage comes from the message's
70
- * own usage). Live events never go through this.
71
- */
72
- export declare function prepareReplayEvents(events: readonly SessionEvent[]): SessionEvent[];
73
57
  //# sourceMappingURL=transcript.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/transcript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAE5D,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAG5E,eAAO,MAAM,kBAAkB,MAAM,CAAA;AAErC,eAAO,MAAM,oBAAoB,MAAM,CAAA;AAEvC,uEAAuE;AACvE,eAAO,MAAM,kBAAkB,MAAM,CAAA;AAErC;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,MAAM,CAAA;AAE3B,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAG3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,OAAO,EAAE,EACf,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACxC,MAAM,CAsCR;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,SAAS,YAAY,EAAE,EAAE,KAAK,CAAC,EAAE,iBAAiB,GAAG,MAAM,CA8C5G;AAED,sEAAsE;AACtE,wBAAgB,mBAAmB,CAAC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;;;;GASG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,OAAO,EAAE,EACf,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACxC,MAAM,CAsCR;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,SAAS,YAAY,EAAE,EAAE,KAAK,CAAC,EAAE,iBAAiB,GAAG,MAAM,CA8C5G;AAED,sEAAsE;AACtE,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI,CA+B3E;AAED,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,CAAC,aAAa,CAAC,GAAG,MAAM,CAEzE;AAED,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAKpD,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,GACxC,cAAc,GAAG,SAAS,CA4C5B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,CAAC,aAAa,CAAC,GAAG,MAAM,CAMxE;AAED,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,aAAa,CAAC,GAAG,IAAI,CAUxF"}
@@ -261,46 +261,3 @@ export function restoreToolResult(row, event) {
261
261
  const result = toolResultText(event);
262
262
  row.tool.resultFull = result || undefined;
263
263
  }
264
- /**
265
- * Prepare durable events for REPLAY (resume / rewind / model-switch fork):
266
- * drop settled `assistant/chunk` stream deltas — the sealed
267
- * `assistant/message` events carry the full text and reasoning blocks, so
268
- * per-token chunks add nothing to the replayed transcript while costing a
269
- * per-chunk renderEvent pass (a real 4.5MB session logs ~19k chunks against
270
- * ~30 messages). The trailing chunk run AFTER the last message belongs to an
271
- * unfinished step (crash-orphaned turn) and is kept, so a resumed session
272
- * still shows its partial content. Storage-level packed rows
273
- * (`text-chunks`/`reasoning-chunks`/`tool-call-chunks`) are dropped the
274
- * same way — defensive: the jsonl reader expands them, but a future
275
- * direct-pass path must not resurrect them. Replay-side tps sampling is
276
- * lost with the chunks (a live metric; lastUsage comes from the message's
277
- * own usage). Live events never go through this.
278
- */
279
- export function prepareReplayEvents(events) {
280
- let lastMessageSeq = -1;
281
- for (const event of events) {
282
- if (event.type === 'assistant/message')
283
- lastMessageSeq = event.seq;
284
- }
285
- return events.filter(event => {
286
- if (event.type === 'assistant/message')
287
- return true;
288
- // Pre-V3 chunk events and storage-level packed rows are not in the
289
- // current SessionEvent union (0.1.5 embeds the stream inside
290
- // `assistant/message`), so compare through a widened view — the filters
291
- // below exist exactly for data the static type doesn't know.
292
- const packedType = event.type;
293
- if (packedType === 'assistant/chunk') {
294
- // Keep only the in-flight tail (no message sealed after it).
295
- return lastMessageSeq < 0 || event.seq > lastMessageSeq;
296
- }
297
- // Storage-level packed rows: the jsonl reader expands them, but a future
298
- // direct-pass path must not resurrect them.
299
- if (packedType === 'text-chunks' ||
300
- packedType === 'reasoning-chunks' ||
301
- packedType === 'tool-call-chunks') {
302
- return false;
303
- }
304
- return true;
305
- });
306
- }
@@ -48,7 +48,7 @@ import { runForegroundShell } from './compat/shell.js';
48
48
  import { createPermissionModeRoster } from './channel/mode-roster.js';
49
49
  import { createPermissionModeActions } from './channel/mode-permission-actions.js';
50
50
  import { mentionAttachments } from './channel/mentions.js';
51
- import { legacyPermissionPresetSnapshot, permissionPresetSnapshotFromService, unavailablePermissionPresetSnapshot } from './channel/permissions.js';
51
+ import { permissionPresetSnapshotFromService, unavailablePermissionPresetSnapshot } from './channel/permissions.js';
52
52
  import { createPreferences } from './channel/preferences.js';
53
53
  import { createSettingsHosts } from './channel/settings-host.js';
54
54
  import { createChannelOwner, registerChannelOwner } from './channel/owner.js';
@@ -445,7 +445,7 @@ function createChannelWithOwner(ctx, initialAgent, options, owner) {
445
445
  return unavailablePermissionPresetSnapshot();
446
446
  }
447
447
  if (service === undefined)
448
- return legacyPermissionPresetSnapshot(state.mode.sandbox);
448
+ return unavailablePermissionPresetSnapshot();
449
449
  return permissionPresetSnapshotFromService(service, binding.agent.session);
450
450
  },
451
451
  settingsSections() {
@@ -1,29 +1,9 @@
1
1
  /**
2
- * Compat boundary — every inelegant patch aimed at the harness core lives
3
- * here, behind one import seam, so the render/interaction code stays clean.
4
- *
5
- * House rules for modules in this directory:
6
- * - Each patch carries its own capability probe and self-disables or
7
- * degrades to pre-patch behavior when upstream absorbs the quirk.
8
- * - Optional compatibility patches degrade to pre-patch behavior. Required
9
- * transcript contracts fail loudly rather than fabricating an empty log.
10
- * - A patch states plainly which upstream change would retire it.
11
- *
12
- * Current residents:
13
- * - liveSession: rc.2 `events`/`seedLength` vs alpha.4
14
- * `snapshotEvents`/`seq`/`isSeeded`/`inheritedEventCount`. Seed copies
15
- * slice the source log; they never use `sessions.fork()` as an extractor.
16
- * A child snapshot length cannot reliably be used as the inherited cut.
17
- * - sessionLog: tolerant title reads plus offline rename/delete helpers for
18
- * persisted sessions that are not currently owned by a live Agent, the
19
- * resume-seam registration of vouched-for legacy event types into every
20
- * reachable KNOWN_SESSION_EVENT_TYPES copy (retiring the day upstream's
21
- * shared catalog adopts the types or ships a real registration API —
22
- * issue #153), and the bounded read-only log reader behind the session
23
- * tree (chunked I/O, lazy zstd frame walk, event + scan budgets,
24
- * inherited-prefix skip).
25
- * @module dsh-cli/compat
2
+ * Current DSH boundary helpers: strict live snapshots, Config-backed settings,
3
+ * foreground shell execution, persistence handles and bounded session logs.
4
+ * No older host API dispatch is retained. Current TUI event registration and
5
+ * read limits remain here so consumers share one storage contract.
26
6
  */
27
7
  export { appendInterruptedTurnEnd, liveSessionCreateOptions, liveSessionListingFields, liveSessionOffset, sliceLiveSessionSeed, snapshotLiveSessionEvents, } from './liveSession.js';
28
- export { appendSessionTitle, defaultMaxScanned, deleteSessionLog, ensureLegacySessionEventTypes, findSessionLogFile, LEGACY_SESSION_EVENT_TYPES, readPhysicalHeaderSeedLength, readPhysicalHeaderSeedLengthForSession, readSessionEventsFromFile, readSessionEventsFromLog, readSessionTitleFromLog, type SessionLogRead, sessionsRoots, userTitleData, } from './sessionLog.js';
8
+ export { appendSessionTitle, defaultMaxScanned, deleteSessionLog, registerTuiSessionEventTypes, findSessionLogFile, TUI_SESSION_EVENT_TYPES, readPhysicalHeaderSeedLength, readPhysicalHeaderSeedLengthForSession, readSessionEventsFromFile, readSessionEventsFromLog, readSessionTitleFromLog, type SessionLogRead, sessionsRoots, userTitleData, } from './sessionLog.js';
29
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/compat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,6BAA6B,EAC7B,kBAAkB,EAClB,0BAA0B,EAC1B,4BAA4B,EAC5B,sCAAsC,EACtC,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,cAAc,EACnB,aAAa,EACb,aAAa,GACd,MAAM,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/compat/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,4BAA4B,EAC5B,kBAAkB,EAClB,uBAAuB,EACvB,4BAA4B,EAC5B,sCAAsC,EACtC,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,cAAc,EACnB,aAAa,EACb,aAAa,GACd,MAAM,iBAAiB,CAAA"}
@@ -1,28 +1,8 @@
1
1
  /**
2
- * Compat boundary — every inelegant patch aimed at the harness core lives
3
- * here, behind one import seam, so the render/interaction code stays clean.
4
- *
5
- * House rules for modules in this directory:
6
- * - Each patch carries its own capability probe and self-disables or
7
- * degrades to pre-patch behavior when upstream absorbs the quirk.
8
- * - Optional compatibility patches degrade to pre-patch behavior. Required
9
- * transcript contracts fail loudly rather than fabricating an empty log.
10
- * - A patch states plainly which upstream change would retire it.
11
- *
12
- * Current residents:
13
- * - liveSession: rc.2 `events`/`seedLength` vs alpha.4
14
- * `snapshotEvents`/`seq`/`isSeeded`/`inheritedEventCount`. Seed copies
15
- * slice the source log; they never use `sessions.fork()` as an extractor.
16
- * A child snapshot length cannot reliably be used as the inherited cut.
17
- * - sessionLog: tolerant title reads plus offline rename/delete helpers for
18
- * persisted sessions that are not currently owned by a live Agent, the
19
- * resume-seam registration of vouched-for legacy event types into every
20
- * reachable KNOWN_SESSION_EVENT_TYPES copy (retiring the day upstream's
21
- * shared catalog adopts the types or ships a real registration API —
22
- * issue #153), and the bounded read-only log reader behind the session
23
- * tree (chunked I/O, lazy zstd frame walk, event + scan budgets,
24
- * inherited-prefix skip).
25
- * @module dsh-cli/compat
2
+ * Current DSH boundary helpers: strict live snapshots, Config-backed settings,
3
+ * foreground shell execution, persistence handles and bounded session logs.
4
+ * No older host API dispatch is retained. Current TUI event registration and
5
+ * read limits remain here so consumers share one storage contract.
26
6
  */
27
7
  export { appendInterruptedTurnEnd, liveSessionCreateOptions, liveSessionListingFields, liveSessionOffset, sliceLiveSessionSeed, snapshotLiveSessionEvents, } from './liveSession.js';
28
- export { appendSessionTitle, defaultMaxScanned, deleteSessionLog, ensureLegacySessionEventTypes, findSessionLogFile, LEGACY_SESSION_EVENT_TYPES, readPhysicalHeaderSeedLength, readPhysicalHeaderSeedLengthForSession, readSessionEventsFromFile, readSessionEventsFromLog, readSessionTitleFromLog, sessionsRoots, userTitleData, } from './sessionLog.js';
8
+ export { appendSessionTitle, defaultMaxScanned, deleteSessionLog, registerTuiSessionEventTypes, findSessionLogFile, TUI_SESSION_EVENT_TYPES, readPhysicalHeaderSeedLength, readPhysicalHeaderSeedLengthForSession, readSessionEventsFromFile, readSessionEventsFromLog, readSessionTitleFromLog, sessionsRoots, userTitleData, } from './sessionLog.js';
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Live Session snapshots and exact inherited-prefix boundaries.
3
+ * Source slices never infer their cut from a child-owned end-seed marker.
4
+ * Physical JSONL seedLength belongs to the storage reader, not the live API.
5
+ */
6
+ import { SessionLogOffset } from '@deepseek-ai/dsh-session';
1
7
  import type { CreateAgentOptions } from '@deepseek-ai/dsh-agent';
2
8
  import type { Session, SessionEvent, SessionId } from '@deepseek-ai/dsh-session';
3
9
  /**
@@ -36,24 +42,13 @@ export declare function liveSessionListingFields(session: unknown): {
36
42
  * `sessions.fork()`.
37
43
  */
38
44
  export declare function sliceLiveSessionSeed(session: unknown, boundary?: number): SessionEvent[];
39
- export interface LiveSessionSeedMetadata {
45
+ /** Seed ownership is independent of whether the child is shown as a root. */
46
+ export declare function liveSessionSeedMetadata(inheritedCount: number): {
40
47
  readonly meta: {
41
- readonly seedLength?: number;
42
- readonly isSeeded?: boolean;
48
+ readonly isSeeded: true;
43
49
  };
44
- readonly inheritedEventCount?: number;
45
- }
46
- /**
47
- * Create-time seed ownership fields. Every copied source prefix is inherited
48
- * state for domain projections, even when `/fork` deliberately omits
49
- * `parentSession` so the copy is presented as an independent root. The exact
50
- * cut distinguishes copied history from child-owned events. Not every
51
- * projection skips inherited events: newer inbox folds restore pending input
52
- * from them, so rewind must cancel that work through the child's Inbox API.
53
- * A child snapshot length cannot reliably be used as the cut because
54
- * construction may append `session/end-seed`.
55
- */
56
- export declare function liveSessionSeedMetadata(session: unknown, inheritedCount: number): LiveSessionSeedMetadata;
50
+ readonly inheritedEventCount: ReturnType<typeof SessionLogOffset>;
51
+ };
57
52
  /** Close an open turn with the `turn/end` shape a real user cancellation writes. */
58
53
  export declare function appendInterruptedTurnEnd(seed: SessionEvent[], turn: number): void;
59
54
  /** Close a V3 fork's open inherited turn as child-owned events, after its marker. */
@@ -61,8 +56,6 @@ export declare function closeLiveForkTurn(session: Session, turn: number): void;
61
56
  export interface LiveSessionCreateRequest {
62
57
  readonly sessionId: SessionId;
63
58
  readonly seed: readonly SessionEvent[];
64
- /** Live Session whose shape identifies the active upstream runtime line. */
65
- readonly runtimeSession: unknown;
66
59
  readonly inheritedCount: number;
67
60
  readonly cwd: string;
68
61
  readonly parentSession?: SessionId;
@@ -70,10 +63,6 @@ export interface LiveSessionCreateRequest {
70
63
  readonly agentOptions: CreateAgentOptions['agentOptions'];
71
64
  readonly setup?: CreateAgentOptions['setup'];
72
65
  }
73
- /**
74
- * Dual-runtime seed metadata for `agents.create`. The only
75
- * CreateAgentOptions assertion lives here: rc.2 meta carries `seedLength`,
76
- * alpha.4 carries `isSeeded` plus top-level `inheritedEventCount`.
77
- */
66
+ /** Create a seeded agent using the current host contract. */
78
67
  export declare function liveSessionCreateOptions(request: LiveSessionCreateRequest): CreateAgentOptions;
79
68
  //# sourceMappingURL=liveSession.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"liveSession.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/compat/liveSession.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAoChF;;;;GA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,IAAI,CAoBtE;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,IAAI,EAAE,SAAS,YAAY,EAAE,CAAA;IACtC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,CAAA;IAClC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAA;IACzD,QAAQ,CAAC,KAAK,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAA;CAC7C;AAED,6DAA6D;AAC7D,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,wBAAwB,GAAG,kBAAkB,CAe9F"}
@@ -1,42 +1,15 @@
1
1
  /**
2
- * Live Session compatibility facade.
3
- *
4
- * rc.2 / alpha.3 expose `Session.events` and header `seedLength`. alpha.4
5
- * deletes `events` in favour of `snapshotEvents` / `eventAt` / exclusive
6
- * `seq`, and moves fork lineage from header `seedLength` onto `isSeeded` plus
7
- * `Session.inheritedEventCount`. Feature detection stays here; callers must
8
- * not probe the two shapes themselves.
9
- *
10
- * `ctx.sessions.fork()` is not a seed extractor: it creates and registers a
11
- * real child. A child snapshot MAY include child-owned `session/end-seed`,
12
- * so snapshot length cannot reliably be inferred as the inherited cut.
13
- * Seed copies are sliced from the *source* snapshot through an inclusive
14
- * event seq. The cut is that source-slice length (or
15
- * `Session.inheritedEventCount` / physical `seedLength`), never a child
16
- * snapshot length.
17
- *
18
- * Physical JSONL still stores optional `seedLength`. That encoding belongs to
19
- * `sessionLog` / `sessions/header`, not this module.
20
- *
21
- * @module dsh-cli/compat/liveSession
2
+ * Live Session snapshots and exact inherited-prefix boundaries.
3
+ * Source slices never infer their cut from a child-owned end-seed marker.
4
+ * Physical JSONL seedLength belongs to the storage reader, not the live API.
22
5
  */
23
- import * as dshSession from '@deepseek-ai/dsh-session';
6
+ import { SessionSeq, SessionLogOffset, interruptedTurnClosers } from '@deepseek-ai/dsh-session';
24
7
  function liveOf(session) {
25
8
  if (session === null || typeof session !== 'object') {
26
9
  throw new Error('live Session contract violation: session is not an object');
27
10
  }
28
11
  return session;
29
12
  }
30
- function brandCtor(name) {
31
- const ctor = dshSession[name];
32
- return typeof ctor === 'function' ? ctor : undefined;
33
- }
34
- function brandSessionSeq(value) {
35
- return brandCtor('SessionSeq')?.(value) ?? value;
36
- }
37
- function brandSessionLogOffset(value) {
38
- return brandCtor('SessionLogOffset')?.(value) ?? value;
39
- }
40
13
  function asNonNegativeInt(value) {
41
14
  return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0 && !Object.is(value, -0)
42
15
  ? value
@@ -56,9 +29,7 @@ export function snapshotLiveSessionEvents(session) {
56
29
  }
57
30
  return snap;
58
31
  }
59
- if (Array.isArray(live.events))
60
- return live.events;
61
- throw new Error('live Session contract violation: neither snapshotEvents() nor events is available');
32
+ throw new Error('live Session contract violation: snapshotEvents() is unavailable');
62
33
  }
63
34
  /**
64
35
  * Exclusive log offset (`seq = log.length`). Empty log is 0, not -1, and this
@@ -68,10 +39,7 @@ export function liveSessionOffset(session) {
68
39
  const seq = asNonNegativeInt(liveOf(session).seq);
69
40
  if (seq !== undefined)
70
41
  return seq;
71
- return snapshotLiveSessionEvents(session).length;
72
- }
73
- function usesIsSeeded(session) {
74
- return typeof liveOf(session).header?.['isSeeded'] === 'boolean';
42
+ throw new Error('live Session contract violation: seq is not a non-negative safe integer');
75
43
  }
76
44
  /**
77
45
  * Physical/wire `seedLength` for a live Session: present whenever an exact
@@ -88,7 +56,7 @@ export function liveSessionPhysicalSeedLength(session) {
88
56
  return undefined;
89
57
  return asNonNegativeInt(live.inheritedEventCount);
90
58
  }
91
- return asNonNegativeInt(header?.['seedLength']);
59
+ return undefined;
92
60
  }
93
61
  /** Listing-shaped fields for overlaying a live Session onto the session tree. */
94
62
  export function liveSessionListingFields(session) {
@@ -144,24 +112,9 @@ export function sliceLiveSessionSeed(session, boundary) {
144
112
  assertTurnClosed(sliced, String(boundary));
145
113
  return sliced;
146
114
  }
147
- /**
148
- * Create-time seed ownership fields. Every copied source prefix is inherited
149
- * state for domain projections, even when `/fork` deliberately omits
150
- * `parentSession` so the copy is presented as an independent root. The exact
151
- * cut distinguishes copied history from child-owned events. Not every
152
- * projection skips inherited events: newer inbox folds restore pending input
153
- * from them, so rewind must cancel that work through the child's Inbox API.
154
- * A child snapshot length cannot reliably be used as the cut because
155
- * construction may append `session/end-seed`.
156
- */
157
- export function liveSessionSeedMetadata(session, inheritedCount) {
158
- if (usesIsSeeded(session)) {
159
- return {
160
- meta: { isSeeded: true },
161
- inheritedEventCount: brandSessionLogOffset(inheritedCount),
162
- };
163
- }
164
- return { meta: { seedLength: inheritedCount } };
115
+ /** Seed ownership is independent of whether the child is shown as a root. */
116
+ export function liveSessionSeedMetadata(inheritedCount) {
117
+ return { meta: { isSeeded: true }, inheritedEventCount: SessionLogOffset(inheritedCount) };
165
118
  }
166
119
  /** Close an open turn with the `turn/end` shape a real user cancellation writes. */
167
120
  export function appendInterruptedTurnEnd(seed, turn) {
@@ -170,14 +123,14 @@ export function appendInterruptedTurnEnd(seed, turn) {
170
123
  return;
171
124
  seed.push({
172
125
  type: 'turn/end',
173
- seq: brandSessionSeq(Number(last.seq) + 1),
126
+ seq: SessionSeq(Number(last.seq) + 1),
174
127
  time: last.time + 1,
175
128
  data: { turn, reason: { kind: 'aborted', reason: { kind: 'user' } } },
176
129
  });
177
130
  }
178
131
  /** Close a V3 fork's open inherited turn as child-owned events, after its marker. */
179
132
  export function closeLiveForkTurn(session, turn) {
180
- for (const event of dshSession.interruptedTurnClosers(snapshotLiveSessionEvents(session))) {
133
+ for (const event of interruptedTurnClosers(snapshotLiveSessionEvents(session))) {
181
134
  switch (event.type) {
182
135
  case 'tool/result':
183
136
  session.append('tool/result', event.data, {
@@ -198,13 +151,9 @@ export function closeLiveForkTurn(session, turn) {
198
151
  }
199
152
  }
200
153
  }
201
- /**
202
- * Dual-runtime seed metadata for `agents.create`. The only
203
- * CreateAgentOptions assertion lives here: rc.2 meta carries `seedLength`,
204
- * alpha.4 carries `isSeeded` plus top-level `inheritedEventCount`.
205
- */
154
+ /** Create a seeded agent using the current host contract. */
206
155
  export function liveSessionCreateOptions(request) {
207
- const seedMetadata = liveSessionSeedMetadata(request.runtimeSession, request.inheritedCount);
156
+ const seedMetadata = liveSessionSeedMetadata(request.inheritedCount);
208
157
  return {
209
158
  sessionId: request.sessionId,
210
159
  seed: request.seed,
@@ -214,9 +163,7 @@ export function liveSessionCreateOptions(request) {
214
163
  ...seedMetadata.meta,
215
164
  ...(request.agentPreset === undefined ? {} : { agentPreset: request.agentPreset }),
216
165
  },
217
- ...(seedMetadata.inheritedEventCount === undefined
218
- ? {}
219
- : { inheritedEventCount: seedMetadata.inheritedEventCount }),
166
+ inheritedEventCount: seedMetadata.inheritedEventCount,
220
167
  agentOptions: request.agentOptions,
221
168
  ...(request.setup === undefined ? {} : { setup: request.setup }),
222
169
  };
@@ -1,5 +1,5 @@
1
1
  import type { ContentBlock } from '@deepseek-ai/dsh-llm';
2
- /** 0.1.7 puts tool output on the message; older logs wrap it in one block. */
2
+ /** Current tool messages carry output and error state directly. */
3
3
  export declare function toolResultPayload(message: {
4
4
  readonly content?: readonly ContentBlock[];
5
5
  readonly isError?: boolean;
@@ -7,9 +7,7 @@ export declare function toolResultPayload(message: {
7
7
  content: readonly ContentBlock[];
8
8
  isError: boolean;
9
9
  };
10
- /** Preserve old checkpoints while recognizing the V4 producer-owned source. */
11
10
  export declare function isCompactionCheckpointSource(source: {
12
11
  kind: string;
13
- plugin?: string;
14
12
  }): boolean;
15
13
  //# sourceMappingURL=messages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/compat/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,YAAY,EAAE,CAAA;IAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAC3B,GAAG,SAAS,GAAG;IAAE,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAarE;AAED,+EAA+E;AAC/E,wBAAgB,4BAA4B,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAE/F"}
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/compat/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,mEAAmE;AACnE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,YAAY,EAAE,CAAA;IAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAC3B,GAAG,SAAS,GAAG;IAAE,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAErE;AAED,wBAAgB,4BAA4B,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAE9E"}
@@ -1,15 +1,7 @@
1
- /** 0.1.7 puts tool output on the message; older logs wrap it in one block. */
1
+ /** Current tool messages carry output and error state directly. */
2
2
  export function toolResultPayload(message) {
3
- const first = message?.content?.[0];
4
- if (first?.type === 'tool-result') {
5
- return {
6
- content: Array.isArray(first.content) ? first.content : [],
7
- isError: first.isError === true,
8
- };
9
- }
10
3
  return { content: message?.content ?? [], isError: message?.isError === true };
11
4
  }
12
- /** Preserve old checkpoints while recognizing the V4 producer-owned source. */
13
5
  export function isCompactionCheckpointSource(source) {
14
- return source.kind === 'compact-checkpoint' || (source.kind === 'plugin' && source.plugin === 'compact');
6
+ return source.kind === 'compact-checkpoint';
15
7
  }
@@ -4,10 +4,9 @@ interface StoredSession {
4
4
  readonly events: readonly SessionEvent[];
5
5
  readonly inheritedEventCount?: number;
6
6
  }
7
- /** Read-only persistence seam for legacy services and per-session handles. */
7
+ /** Read stored events through a read handle and always release ownership. */
8
8
  export interface SessionReader {
9
- load?(id: SessionId): Promise<StoredSession>;
10
- open?(id: SessionId, access: 'read'): Promise<{
9
+ open(id: SessionId, access: 'read'): Promise<{
11
10
  readonly header: SessionHeader;
12
11
  readonly inheritedEventCount?: number;
13
12
  read(): Promise<{
@@ -1 +1 @@
1
- {"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/compat/persistence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAGtF,UAAU,aAAa;IACrB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;IACxC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;CACtC;AAED,8EAA8E;AAC9E,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,CAAC,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;IAC5C,IAAI,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QAC5C,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;QAC9B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;QACrC,IAAI,IAAI,OAAO,CAAC;YAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;SAAE,CAAC,CAAA;QAC7D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;KACvB,CAAC,CAAA;CACH;AAED,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,CAavG"}
1
+ {"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/compat/persistence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAGtF,UAAU,aAAa;IACrB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;IACxC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;CACtC;AAED,6EAA6E;AAC7E,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QAC3C,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;QAC9B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;QACrC,IAAI,IAAI,OAAO,CAAC;YAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;SAAE,CAAC,CAAA;QAC7D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;KACvB,CAAC,CAAA;CACH;AAED,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,CASvG"}
@@ -1,17 +1,12 @@
1
- import { ensureLegacySessionEventTypes } from './sessionLog.js';
1
+ import { registerTuiSessionEventTypes } from './sessionLog.js';
2
2
  export async function readPersistedSession(source, id) {
3
- ensureLegacySessionEventTypes();
4
- if (typeof source.open === 'function') {
5
- const handle = await source.open(id, 'read');
6
- try {
7
- const { events } = await handle.read();
8
- return { meta: handle.header, events, inheritedEventCount: handle.inheritedEventCount };
9
- }
10
- finally {
11
- await handle.close();
12
- }
3
+ registerTuiSessionEventTypes();
4
+ const handle = await source.open(id, 'read');
5
+ try {
6
+ const { events } = await handle.read();
7
+ return { meta: handle.header, events, inheritedEventCount: handle.inheritedEventCount };
8
+ }
9
+ finally {
10
+ await handle.close();
13
11
  }
14
- if (typeof source.load === 'function')
15
- return source.load(id);
16
- throw new Error('dsh-tui: session persistence has no read API');
17
12
  }