dsh-side-chat-plus 0.3.3 → 0.3.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.
package/lib/index.js CHANGED
@@ -20,7 +20,8 @@ const SUBCHAT_PREFS_DEFAULTS = {
20
20
  lookupDefault: false,
21
21
  sendImmediately: true,
22
22
  defaultPrompt: "",
23
- bringMode: "draft"
23
+ bringMode: "draft",
24
+ panelHome: "sidebar-right"
24
25
  };
25
26
  //#endregion
26
27
  //#region src/trust-fence.ts
@@ -268,12 +269,21 @@ function openTurnStart(events) {
268
269
  if (lastEnd !== void 0 && lastEnd >= lastStart) return void 0;
269
270
  return lastStart;
270
271
  }
272
+ /**
273
+ * Read a session's event log across DSH versions: 0.1.5+ exposes
274
+ * `snapshotEvents()`; 0.1.2-era sessions carried a plain `events` getter.
275
+ */
276
+ function sessionEvents(session) {
277
+ if (typeof session.snapshotEvents === "function") return session.snapshotEvents();
278
+ return session.events ?? [];
279
+ }
271
280
  /** Schemastery schema for the user-facing preferences (validated by the settings service). */
272
281
  const PrefsSchema = z.object({
273
282
  lookupDefault: z.boolean().default(SUBCHAT_PREFS_DEFAULTS.lookupDefault),
274
283
  sendImmediately: z.boolean().default(SUBCHAT_PREFS_DEFAULTS.sendImmediately),
275
284
  defaultPrompt: z.string().default(SUBCHAT_PREFS_DEFAULTS.defaultPrompt),
276
- bringMode: z.union(["draft", "context"]).default(SUBCHAT_PREFS_DEFAULTS.bringMode)
285
+ bringMode: z.union(["draft", "context"]).default(SUBCHAT_PREFS_DEFAULTS.bringMode),
286
+ panelHome: z.union(["floating", "sidebar-right"]).default(SUBCHAT_PREFS_DEFAULTS.panelHome)
277
287
  });
278
288
  /** The API method table bound to the plugin context and the live side-chat map. */
279
289
  function buildApi(ctx, sideChats, getSettings) {
@@ -387,12 +397,12 @@ function buildApi(ctx, sideChats, getSettings) {
387
397
  const childId = requireString(payload, "childId");
388
398
  const line = requireString(payload, "line");
389
399
  const child = childOf(childId);
390
- return { executed: await ctx.commands.execute(child, line, new AbortController().signal) !== void 0 };
400
+ return { executed: await ctx.commands.execute(child, line, [], new AbortController().signal) !== void 0 };
391
401
  };
392
402
  /** Fold one side-chat agent's plan/goal state for its composer chrome. */
393
403
  const state = (payload) => {
394
404
  const childId = requireString(payload, "childId");
395
- const events = childOf(childId).session.events ?? [];
405
+ const events = sessionEvents(childOf(childId).session);
396
406
  let planActive = false;
397
407
  let planWanted = null;
398
408
  let goal = null;
@@ -482,7 +492,7 @@ function buildApi(ctx, sideChats, getSettings) {
482
492
  });
483
493
  try {
484
494
  const explicitPreset = typeof record.preset === "string" && record.preset !== "" ? record.preset : void 0;
485
- const parentPreset = ctx.permissionPresets.current(parent.session.events ?? []);
495
+ const parentPreset = ctx.permissionPresets.current(parent.session);
486
496
  const preset = explicitPreset ?? parentPreset;
487
497
  if (preset !== "custom") ctx.permissionPresets.set(handle.agent.session, preset);
488
498
  } catch (error) {
@@ -522,7 +532,7 @@ function buildApi(ctx, sideChats, getSettings) {
522
532
  const agent = record.handle.agent;
523
533
  const status = agent.status;
524
534
  const statusRunning = status === "running";
525
- const eventRunningSince = openTurnStart(agent.session.events ?? []);
535
+ const eventRunningSince = openTurnStart(sessionEvents(agent.session));
526
536
  const running = statusRunning || status === void 0 && eventRunningSince !== void 0;
527
537
  const runningSince = running ? eventRunningSince ?? Date.now() : void 0;
528
538
  items.push({
@@ -66,6 +66,15 @@ export declare const zh: {
66
66
  'settings.bringModeDraftDesc': string;
67
67
  'settings.bringModeContextTitle': string;
68
68
  'settings.bringModeContextDesc': string;
69
+ 'settings.panelHomeTitle': string;
70
+ 'settings.panelHomeDesc': string;
71
+ 'settings.panelHomeFloatingTitle': string;
72
+ 'settings.panelHomeFloatingDesc': string;
73
+ 'settings.panelHomeDockTitle': string;
74
+ 'settings.panelHomeDockDesc': string;
75
+ 'dock.title': string;
76
+ 'dock.unavailable': string;
77
+ 'dock.openFailed': string;
69
78
  'insert.direct': string;
70
79
  'insert.summarize': string;
71
80
  'insert.summarizing': string;
@@ -152,6 +161,15 @@ export declare const en: {
152
161
  'settings.bringModeDraftDesc': string;
153
162
  'settings.bringModeContextTitle': string;
154
163
  'settings.bringModeContextDesc': string;
164
+ 'settings.panelHomeTitle': string;
165
+ 'settings.panelHomeDesc': string;
166
+ 'settings.panelHomeFloatingTitle': string;
167
+ 'settings.panelHomeFloatingDesc': string;
168
+ 'settings.panelHomeDockTitle': string;
169
+ 'settings.panelHomeDockDesc': string;
170
+ 'dock.title': string;
171
+ 'dock.unavailable': string;
172
+ 'dock.openFailed': string;
155
173
  'insert.direct': string;
156
174
  'insert.summarize': string;
157
175
  'insert.summarizing': string;
@@ -42,7 +42,13 @@ export interface SideSessionEvent {
42
42
  export interface SideSession {
43
43
  id: string;
44
44
  header: SideSessionHeader;
45
+ /**
46
+ * 0.1.2-era event getter. Removed in 0.1.5 (snapshotEvents takes over), so
47
+ * host code reads through `sessionEvents()` which prefers the new method.
48
+ */
45
49
  events?: readonly SideSessionEvent[];
50
+ /** 0.1.5+ snapshot of the full event log; absent on 0.1.2-era sessions. */
51
+ snapshotEvents?: (fromSeq?: number, toSeqExclusive?: number) => readonly SideSessionEvent[];
46
52
  requestHeader?: () => {
47
53
  config?: {
48
54
  provider?: string;
@@ -204,9 +210,9 @@ export interface SidePresetOption {
204
210
  name: string;
205
211
  description?: string;
206
212
  }
207
- /** The permission presets face. */
213
+ /** The permission presets face (`current` reads the SESSION, not event rows). */
208
214
  export interface SidePermissionPresets {
209
- current(events: readonly SideSessionEvent[]): string;
215
+ current(session: SideSession): string;
210
216
  set(session: SideSession, name: string): void;
211
217
  selectFor(state: unknown): {
212
218
  options: SidePresetOption[];
@@ -299,9 +305,35 @@ export interface SideSettingsService {
299
305
  }
300
306
  /** The client slots service face (settings.section registration). */
301
307
  export interface SideSlotsService {
302
- inject(name: string, factory: () => () => void): void;
308
+ inject(name: string, factory: () => () => void): () => void;
303
309
  register(options: Record<string, unknown>, component: unknown): () => void;
304
310
  }
311
+ /** One right-sidebar tab type definition (dsh-client-ui-sidebar-right contract, mirror). */
312
+ export interface SideTabDefinition {
313
+ /** Stable unique key; the body seat entry registers under the same key. */
314
+ id: string;
315
+ /** Discriminator used by `openTab(kind)` and the pane dispatch. */
316
+ kind: string;
317
+ /** Registry band ('builtin' | 'extension' | 'fallback'); defaults to the extension band. */
318
+ priority?: string;
319
+ /** Fresh title for the tab chip captured at open time. */
320
+ title(address: string): string;
321
+ }
322
+ /** The right-sidebar tab-type registry face (`ctx.sidebarRight.tabs`). */
323
+ export interface SideSidebarRightTabs {
324
+ /** Register a tab type; returns a disposer (hold it in the caller's ctx.effect). */
325
+ register(definition: SideTabDefinition): () => void;
326
+ }
327
+ /** The cross-plugin right-sidebar face (`ctx.sidebarRight`, ui-sidebar-right). */
328
+ export interface SideSidebarRight {
329
+ tabs: SideSidebarRightTabs;
330
+ /** Open a page type by kind in the mounted session; reveals the column. */
331
+ openTab(kind: string, options?: {
332
+ paneId?: string;
333
+ replaceTab?: boolean;
334
+ revealIfOpened?: boolean;
335
+ }): void;
336
+ }
305
337
  /** One durable image reference (mirror of ImageAttachmentRef). */
306
338
  export interface SideImageAttachmentRef {
307
339
  attachmentId: string;
@@ -341,7 +373,7 @@ export interface SideCommandsService {
341
373
  name: string;
342
374
  description: string;
343
375
  }>;
344
- execute(agent: SideAgent, line: string, signal: AbortSignal): Promise<unknown>;
376
+ execute(agent: SideAgent, line: string, submittedAttachments: readonly unknown[], signal: AbortSignal): Promise<unknown>;
345
377
  }
346
378
  /** The per-session composer input face this plugin writes to (draft-only). */
347
379
  export interface SideSessionInput {
@@ -9,6 +9,8 @@
9
9
  export declare const SUBCHAT_PREFS_NS = "dsh-side-chat";
10
10
  /** How a brought-back reply lands in the main conversation. */
11
11
  export type BringMode = 'draft' | 'context';
12
+ /** Where the side-chat panel lives when a side chat is open. */
13
+ export type PanelHome = 'floating' | 'sidebar-right';
12
14
  /** User-facing side-chat preferences. */
13
15
  export interface SubchatPrefs {
14
16
  /** Whether the "look up workspace / parent when needed" switch defaults on. */
@@ -19,6 +21,8 @@ export interface SubchatPrefs {
19
21
  defaultPrompt: string;
20
22
  /** How brought-back content lands: into the composer draft, or as a collapsed context row. */
21
23
  bringMode: BringMode;
24
+ /** Which container hosts the panel: the classic floating right-edge panel, or the new built-in right sidebar. */
25
+ panelHome: PanelHome;
22
26
  }
23
27
  /** Fallback prefs used whenever the settings document is unreachable or malformed. */
24
28
  export declare const SUBCHAT_PREFS_DEFAULTS: SubchatPrefs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-side-chat-plus",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "侧边聊天 Plus (Side chat Plus) — DSH web plugin: select text in a conversation and ask it in a per-session side chat (hidden ordinary session, own right-side panel, inherits model/effort/permissions, lookup toggle).",
5
5
  "private": false,
6
6
  "type": "module",
@@ -67,47 +67,47 @@
67
67
  "schemastery": "^3.18.0"
68
68
  },
69
69
  "peerDependencies": {
70
- "@deepseek-ai/dsh-agent": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
71
- "@deepseek-ai/dsh-attachment": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
72
- "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
73
- "@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
74
- "@deepseek-ai/dsh-client-ui-renderer": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
75
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
76
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
77
- "@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
78
- "@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
79
- "@deepseek-ai/dsh-llm": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
80
- "@deepseek-ai/dsh-session": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
81
- "@deepseek-ai/dsh-session-query": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
82
- "@deepseek-ai/dsh-workspace": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
83
- "@deepseek-ai/dsh-permission-presets": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
84
- "@deepseek-ai/dsh-sandbox-policy": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
85
- "@deepseek-ai/dsh-agent-presets": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
86
- "@deepseek-ai/dsh-settings": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
87
- "@deepseek-ai/dsh-home-paths": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
70
+ "@deepseek-ai/dsh-agent": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
71
+ "@deepseek-ai/dsh-attachment": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
72
+ "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
73
+ "@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
74
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
75
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
76
+ "@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
77
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
78
+ "@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
79
+ "@deepseek-ai/dsh-llm": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
80
+ "@deepseek-ai/dsh-session": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
81
+ "@deepseek-ai/dsh-session-query": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
82
+ "@deepseek-ai/dsh-workspace": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
83
+ "@deepseek-ai/dsh-permission-presets": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
84
+ "@deepseek-ai/dsh-sandbox-policy": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
85
+ "@deepseek-ai/dsh-agent-presets": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
86
+ "@deepseek-ai/dsh-settings": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
87
+ "@deepseek-ai/dsh-home-paths": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1",
88
88
  "cordis": "^4.0.0-rc.7",
89
89
  "react": "^18.2.0",
90
90
  "react-dom": "^18.2.0"
91
91
  },
92
92
  "devDependencies": {
93
- "@deepseek-ai/dsh-agent": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
94
- "@deepseek-ai/dsh-attachment": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
95
- "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
96
- "@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
97
- "@deepseek-ai/dsh-client-ui-renderer": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
98
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
99
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
100
- "@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
101
- "@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
102
- "@deepseek-ai/dsh-llm": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
103
- "@deepseek-ai/dsh-session": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
104
- "@deepseek-ai/dsh-session-query": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
105
- "@deepseek-ai/dsh-workspace": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
106
- "@deepseek-ai/dsh-permission-presets": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
107
- "@deepseek-ai/dsh-sandbox-policy": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
108
- "@deepseek-ai/dsh-agent-presets": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
109
- "@deepseek-ai/dsh-settings": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
110
- "@deepseek-ai/dsh-home-paths": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0",
93
+ "@deepseek-ai/dsh-agent": "^0.1.5-alpha.2",
94
+ "@deepseek-ai/dsh-attachment": "^0.1.5-alpha.2",
95
+ "@deepseek-ai/dsh-client-locale": "^0.1.5-alpha.2",
96
+ "@deepseek-ai/dsh-client-ui-conversation": "^0.1.5-alpha.2",
97
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.1.5-alpha.2",
98
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.5-alpha.2",
99
+ "@deepseek-ai/dsh-client-ui-settings": "^0.1.5-alpha.2",
100
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.1.5-alpha.2",
101
+ "@deepseek-ai/dsh-host-webserver": "^0.1.5-alpha.2",
102
+ "@deepseek-ai/dsh-llm": "^0.1.5-alpha.2",
103
+ "@deepseek-ai/dsh-session": "^0.1.5-alpha.2",
104
+ "@deepseek-ai/dsh-session-query": "^0.1.5-alpha.2",
105
+ "@deepseek-ai/dsh-workspace": "^0.1.5-alpha.2",
106
+ "@deepseek-ai/dsh-permission-presets": "^0.1.5-alpha.2",
107
+ "@deepseek-ai/dsh-sandbox-policy": "^0.1.5-alpha.2",
108
+ "@deepseek-ai/dsh-agent-presets": "^0.1.5-alpha.2",
109
+ "@deepseek-ai/dsh-settings": "^0.1.5-alpha.2",
110
+ "@deepseek-ai/dsh-home-paths": "^0.1.5-alpha.2",
111
111
  "@types/node": "^24.0.0",
112
112
  "@types/react": "~18.3.1",
113
113
  "@types/react-dom": "~18.3.1",
@@ -56,6 +56,25 @@
56
56
  font-family: var(--dsw-font-family);
57
57
  font-size: 14px;
58
58
  pointer-events: auto;
59
+ transition: transform var(--ds-transition-duration-slow) var(--ds-ease-in-out);
60
+ }
61
+
62
+ /* Embedded in the built-in right sidebar (dock mode): fill the tab pane,
63
+ drop the floating chrome (fixed positioning, resize rail, own border). */
64
+ .panelEmbedded {
65
+ position: absolute;
66
+ inset: 0;
67
+ width: 100%;
68
+ border-left: none;
69
+ border-radius: 0;
70
+ }
71
+
72
+ /* A built-in sidebar overlay (fullscreen preview / floated panel) owns the
73
+ viewport: slide this panel out of the way; the layout margin is dropped by
74
+ the matching width effect so the main column reclaims the space. */
75
+ .panelConflictHidden {
76
+ transform: translateX(calc(100% + 24px));
77
+ pointer-events: none;
59
78
  }
60
79
 
61
80
  .panelResize {