dsh-coding-sidebar 1.0.2 → 1.0.4

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 (96) hide show
  1. package/README.md +27 -42
  2. package/lib/client-editor.js +449 -4278
  3. package/lib/client-registry.js +641 -1343
  4. package/lib/client-terminal.js +172 -262
  5. package/lib/client.js +645 -1347
  6. package/lib/index.js +24 -122
  7. package/lib/types/bundle-route.d.ts +1 -1
  8. package/lib/types/client/SideCardSection.d.ts +3 -3
  9. package/lib/types/client/TextEditor.d.ts +20 -10
  10. package/lib/types/client/add-plugin-modal.d.ts +0 -4
  11. package/lib/types/client/api.d.ts +8 -11
  12. package/lib/types/client/builtins/index.d.ts +10 -10
  13. package/lib/types/client/chunk-loader.d.ts +7 -8
  14. package/lib/types/client/locales.d.ts +0 -26
  15. package/lib/types/client/native-avoid.d.ts +2 -0
  16. package/lib/types/client/plugins-shared.d.ts +6 -6
  17. package/lib/types/client/service.d.ts +13 -83
  18. package/lib/types/context-types.d.ts +19 -10
  19. package/lib/types/index.d.ts +1 -1
  20. package/lib/types/prefs-shared.d.ts +1 -24
  21. package/package.json +26 -30
  22. package/src/bundle-route.ts +1 -1
  23. package/src/client/EditorHost.tsx +52 -122
  24. package/src/client/SandboxStatusBar.tsx +12 -9
  25. package/src/client/SideCardSection.module.css +2 -2
  26. package/src/client/SideCardSection.tsx +28 -81
  27. package/src/client/SideChatView.module.css +12 -12
  28. package/src/client/TextEditor.tsx +89 -266
  29. package/src/client/add-plugin-modal.tsx +16 -24
  30. package/src/client/api.ts +1 -25
  31. package/src/client/builtins/index.ts +10 -14
  32. package/src/client/chunk-loader.ts +7 -8
  33. package/src/client/index.tsx +12 -3
  34. package/src/client/locales-ar.ts +0 -6
  35. package/src/client/locales-de.ts +0 -6
  36. package/src/client/locales-fr.ts +0 -6
  37. package/src/client/locales-hi.ts +0 -6
  38. package/src/client/locales-id.ts +0 -6
  39. package/src/client/locales-it.ts +0 -6
  40. package/src/client/locales-ja.ts +0 -6
  41. package/src/client/locales-ko.ts +0 -6
  42. package/src/client/locales-nl.ts +0 -6
  43. package/src/client/locales-pl.ts +0 -6
  44. package/src/client/locales-pt.ts +0 -6
  45. package/src/client/locales-ru.ts +0 -6
  46. package/src/client/locales-sv.ts +0 -6
  47. package/src/client/locales-th.ts +0 -6
  48. package/src/client/locales-tr.ts +0 -6
  49. package/src/client/locales-vi.ts +0 -6
  50. package/src/client/locales-zh-HK.ts +0 -6
  51. package/src/client/locales-zh-MO.ts +0 -6
  52. package/src/client/locales-zh-TW.ts +0 -6
  53. package/src/client/locales.ts +0 -52
  54. package/src/client/native-avoid.ts +155 -0
  55. package/src/client/plugins-shared.ts +6 -6
  56. package/src/client/prefs.ts +0 -7
  57. package/src/client/service.ts +13 -150
  58. package/src/client/sidebar.module.css +1 -425
  59. package/src/config.ts +1 -4
  60. package/src/context-types.ts +12 -7
  61. package/src/index.ts +12 -78
  62. package/src/jobs-routes.ts +3 -2
  63. package/src/prefs-shared.ts +1 -27
  64. package/src/sidechat-routes.ts +13 -8
  65. package/src/subagent-live-route.ts +2 -1
  66. package/lib/client-mermaid.js +0 -200753
  67. package/lib/types/client/MarkdownHtml.d.ts +0 -32
  68. package/lib/types/client/PdfView.d.ts +0 -6
  69. package/lib/types/client/builtins/viewers.d.ts +0 -3
  70. package/lib/types/client/chunks/mermaid.d.ts +0 -10
  71. package/lib/types/client/editor-load.d.ts +0 -66
  72. package/lib/types/client/image-types.d.ts +0 -3
  73. package/lib/types/client/markdown-html.d.ts +0 -96
  74. package/lib/types/client/markdown-images.d.ts +0 -45
  75. package/lib/types/client/md-toc.d.ts +0 -4
  76. package/lib/types/client/mermaid-blocks.d.ts +0 -47
  77. package/lib/types/client/mermaid-sanitize.d.ts +0 -2
  78. package/lib/types/client/mermaid.d.ts +0 -12
  79. package/lib/types/client/pdf-types.d.ts +0 -2
  80. package/lib/types/client/plugins-viewers.d.ts +0 -3
  81. package/lib/types/html-route.d.ts +0 -59
  82. package/src/client/MarkdownHtml.tsx +0 -296
  83. package/src/client/PdfView.tsx +0 -110
  84. package/src/client/builtins/viewers.tsx +0 -125
  85. package/src/client/chunks/mermaid.tsx +0 -10
  86. package/src/client/editor-load.ts +0 -92
  87. package/src/client/image-types.ts +0 -8
  88. package/src/client/markdown-html.ts +0 -331
  89. package/src/client/markdown-images.ts +0 -137
  90. package/src/client/md-toc.tsx +0 -127
  91. package/src/client/mermaid-blocks.ts +0 -110
  92. package/src/client/mermaid-sanitize.ts +0 -93
  93. package/src/client/mermaid.tsx +0 -406
  94. package/src/client/pdf-types.ts +0 -4
  95. package/src/client/plugins-viewers.ts +0 -30
  96. package/src/html-route.ts +0 -106
@@ -126,22 +126,6 @@ export interface SidebarPrefs {
126
126
  * starts `strip` px below its top edge.
127
127
  */
128
128
  titleBarStripPx: number
129
- /**
130
- * Whether the HTML previewer drops its sandboxed iframe. Sandbox ON (the
131
- * default) renders previewed HTML in an opaque-origin iframe that cannot
132
- * touch the GUI; turning it OFF runs the previewed page with the GUI's
133
- * own origin — full read/write access to session files and internal
134
- * APIs. Only for trusted local content; the setting copy warns.
135
- */
136
- htmlViewerNoSandbox: boolean
137
- /**
138
- * Whether a newly opened HTML preview starts UNSANDBOXED (the per-surface
139
- * temporary unlock pre-applied). Off by default: previews open sandboxed
140
- * and the status row offers the one-tap unlock; when on, previews open
141
- * in the red unsandboxed state and the status row offers a one-tap
142
- * restore for the current file.
143
- */
144
- htmlViewerDefaultUnsafe: boolean
145
129
  /**
146
130
  * Whether the browser tab drops its sandboxed iframe. Sandbox ON (the
147
131
  * default) keeps browsed sites in an opaque origin with no GUI access;
@@ -196,16 +180,9 @@ export interface SidebarPrefs {
196
180
  * own layouts" rule.
197
181
  */
198
182
  tabsEnabled: Record<string, boolean>
199
- /**
200
- * Per-viewer enable switches, keyed by file viewer descriptor id
201
- * (`'image'`, `'my-plugin:csv'`). An ABSENT key means enabled; a disabled
202
- * viewer is skipped by `matchFileViewer` so files fall through to the
203
- * next matching viewer (or the download button when none match).
204
- */
205
- viewersEnabled: Record<string, boolean>
206
183
  /**
207
184
  * Plugin-owned settings blobs (v0.12.0+), keyed by descriptor id: each
208
- * registered tab/viewer that declares `settings.pluginToggles` (or writes
185
+ * registered tab that declares `settings.pluginToggles` (or writes
209
186
  * through `settings.render`'s `updatePluginSetting`) persists its values
210
187
  * here — an open map, so third-party keys need no host PrefsSchema field.
211
188
  * Values are JSON-serializable (the row controls produce strings /
@@ -252,15 +229,12 @@ export const SIDEBAR_PREFS_DEFAULTS: SidebarPrefs = {
252
229
  customCss: '',
253
230
  titleBarCompat: false,
254
231
  titleBarStripPx: TITLE_BAR_STRIP_DEFAULT,
255
- htmlViewerNoSandbox: false,
256
- htmlViewerDefaultUnsafe: false,
257
232
  browserNoSandbox: false,
258
233
  browserInterceptLinks: true,
259
234
  browserInterceptHttp: true,
260
235
  browserInterceptHttps: false,
261
236
  browserAllowedLoopback: '',
262
237
  tabsEnabled: {},
263
- viewersEnabled: {},
264
238
  pluginSettings: {},
265
239
  }
266
240
 
@@ -26,6 +26,7 @@ import type { Agent, AgentSetup, CreateAgentOptions, ResumeAgentOptions } from '
26
26
  import { snapshotSubagentDescriptor } from '@deepseek-ai/dsh-subagent'
27
27
  import type { Context as CordisContext } from '@deepseek-ai/cordis'
28
28
  import type { SessionEvent, SessionId } from '@deepseek-ai/dsh-session'
29
+ import type { SidebarSessionEvent } from './context-types.ts'
29
30
  import type {
30
31
  Context,
31
32
  SidebarAgentPresetsService,
@@ -104,8 +105,10 @@ async function composePersistedSetup(
104
105
  if (persistence === undefined) {
105
106
  return () => Promise.resolve()
106
107
  }
107
- const inspected = await persistence.inspect(childId)
108
- const presetId = resolvePresetId(inspected.meta, inspected.events)
108
+ const handle = await persistence.open(childId, 'read')
109
+ const { events } = await handle.read()
110
+ const presetId = resolvePresetId(handle.header as never, events as unknown as readonly SidebarSessionEvent[])
111
+ await handle.close()
109
112
  const presets = ctx.get('agentPresets') as SidebarAgentPresetsService | undefined
110
113
  if (presets === undefined || presetId === undefined) {
111
114
  return () => Promise.resolve()
@@ -166,11 +169,11 @@ export function buildSidechatApi(ctx: Context): SidechatRoutes {
166
169
  }
167
170
  const parentSession = parent.session
168
171
  const inheritance = buildSidechatInheritance(
169
- parentSession.events as unknown as readonly SidechatLogEvent[],
172
+ parentSession.snapshotEvents() as unknown as readonly SidechatLogEvent[],
170
173
  )
171
174
  const { agentPreset, setup } = await composeChildSetup(
172
175
  ctx,
173
- resolvePresetId(parentSession.header, parentSession.events),
176
+ resolvePresetId(parentSession.header, parentSession.snapshotEvents()),
174
177
  )
175
178
  const childId = `session-${randomUUID()}` as SessionId
176
179
  const label = question === '' ? SIDE_NEW_THREAD_TITLE : sideLabel(question)
@@ -198,7 +201,7 @@ export function buildSidechatApi(ctx: Context): SidechatRoutes {
198
201
  meta: {
199
202
  ...(parentSession.header.cwd === undefined ? {} : { cwd: parentSession.header.cwd }),
200
203
  parentSession: parentSession.id,
201
- seedLength: seed.length,
204
+ isSeeded: seed.length > 0,
202
205
  origin: 'subagent',
203
206
  delegationDepth: (parentSession.header.delegationDepth ?? 0) + 1,
204
207
  ...(agentPreset === undefined ? {} : { agentPreset }),
@@ -267,7 +270,7 @@ export function buildSidechatApi(ctx: Context): SidechatRoutes {
267
270
  throw new SidebarError('sidechat-error', `thread resume failed: ${error instanceof Error ? error.message : String(error)}`, 500)
268
271
  }
269
272
  }
270
- if (boundaryDelivered(agent.session.events as unknown as readonly SidechatLogEvent[])) {
273
+ if (boundaryDelivered(agent.session.snapshotEvents() as unknown as readonly SidechatLogEvent[])) {
271
274
  admitFollowup(agent, textPrompt(text))
272
275
  } else {
273
276
  // First message of an immediately-created thread: it carries the
@@ -331,8 +334,10 @@ export function buildSidechatApi(ctx: Context): SidechatRoutes {
331
334
  const persistence = ctx.get('sessionPersistence') as SidebarSessionPersistenceService | undefined
332
335
  if (persistence !== undefined) {
333
336
  try {
334
- const inspected = await persistence.inspect(childId)
335
- const preset = resolvePresetId(inspected.meta, inspected.events)
337
+ const handle = await persistence.open(childId, 'read')
338
+ const { events } = await handle.read()
339
+ const preset = resolvePresetId(handle.header as never, events as unknown as readonly SidebarSessionEvent[])
340
+ await handle.close()
336
341
  return { live: false, ...(preset === undefined ? {} : { preset }) }
337
342
  } catch {
338
343
  // Unknown/gone session: report a bare cold info.
@@ -76,8 +76,9 @@ export function buildSubagentLiveApi(ctx: Context): SidebarSubagentLiveRoutes {
76
76
  // never topology — keep them out of the live map too.
77
77
  if (entry.label?.startsWith(SIDE_LABEL_PREFIX) ?? false) continue
78
78
  try {
79
+ const stored = ctx.sessions.get(entry.id)
79
80
  const activity = lastActivity(
80
- ctx.sessions.get(entry.id)?.events ?? [],
81
+ stored?.snapshotEvents !== undefined ? stored.snapshotEvents() : [],
81
82
  LIVE_WINDOW_MESSAGES,
82
83
  )
83
84
  if (activity.text !== undefined || activity.tool !== undefined) {