@chatcode/cco-better-sidebar 0.18.0-alpha.0 → 0.18.0-alpha.1

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.
@@ -16,11 +16,21 @@ export declare function SidebarProducedFiles(props: {
16
16
  /** Reveal the produced files in the explorer ("Show in folder" twin). */
17
17
  onShowInFolder: (files: readonly string[]) => void;
18
18
  }): import("react").JSX.Element;
19
+ interface SidebarProducedFilesEntryProps {
20
+ /** Present only when an older chain slot selected the owner before render. */
21
+ matched?: readonly string[];
22
+ store: SidebarStore;
23
+ openInSidebar: (path: string) => void;
24
+ onShowInFolder: (files: readonly string[]) => void;
25
+ }
26
+ /** Adapt both the legacy chain match and the current list owner to the row. */
27
+ export declare function SidebarProducedFilesEntry(props: SidebarProducedFilesEntryProps): ReturnType<typeof SidebarProducedFiles> | null;
19
28
  /**
20
29
  * Register the turn-tail interception (returns the disposer).
21
30
  *
22
31
  * The slot is a CHILD slot the host's ui-conversation declares in its
23
- * `conversation.chat.node` children table (kind: chain, scope: session).
32
+ * `conversation.chat.node` children table (currently kind: list, scope:
33
+ * session; older compatible Hosts declared a chain).
24
34
  * Registering it directly races the declaration — the ui-slots core's
25
35
  * load-time validation throws "not declared (a parent entry's children
26
36
  * table must declare it)" when the parent entry is not on the ledger yet.
@@ -42,3 +52,4 @@ export declare function registerTurnTailInterception(ctx: Context, store: Sideba
42
52
  * disposer restoring the original (HMR-safe).
43
53
  */
44
54
  export declare function registerOpenPathInterception(ctx: Context, store: SidebarStore): () => void;
55
+ export {};
@@ -101,7 +101,7 @@ export interface SidebarSlotRegisterOptions {
101
101
  id?: string;
102
102
  order?: number;
103
103
  label?: string | (() => string);
104
- /** Chain routing selector (returns the matched value, or null to pass on). */
104
+ /** Legacy chain routing selector (returns the matched value, or null to pass on). */
105
105
  select?: (owner: unknown) => unknown;
106
106
  priority?: number;
107
107
  locale?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatcode/cco-better-sidebar",
3
- "version": "0.18.0-alpha.0",
3
+ "version": "0.18.0-alpha.1",
4
4
  "description": "ChatCode CLI Web plugin: a VS Code-like right sidebar (explorer / editor / terminal / git / browser), isolated per conversation session. Exposes a service for other plugins to register sidebar tabs and file viewers.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Interception of the chat's produced-files row: the turn-tail chain entry
3
- * that replaces ui-deliverables' row when the closing turn produced files.
4
- * The takeover looks identical (same chip row); the chips open the file in
5
- * the sidebar instead of the host OS. Priority -1 runs before the default-0
6
- * deliverables entry; when nothing was produced the selector returns null
7
- * and the original row renders unchanged.
2
+ * Contribution of the chat's produced-files row. Current Hosts expose the
3
+ * turn-tail surface as a list; older Hosts exposed it as a chain. The
4
+ * registration supplies both shapes' routing fields so one bundle remains
5
+ * compatible across that transition. The chips open the file in the sidebar
6
+ * instead of the host OS.
8
7
  */
9
8
  import { IconCodeOutline16 } from '@deepseek-ai/dsh-client-ui-primitives'
10
9
  import type { Context } from '../context-types.ts'
@@ -113,11 +112,33 @@ export function SidebarProducedFiles(props: {
113
112
  )
114
113
  }
115
114
 
115
+ interface SidebarProducedFilesEntryProps {
116
+ /** Present only when an older chain slot selected the owner before render. */
117
+ matched?: readonly string[]
118
+ store: SidebarStore
119
+ openInSidebar: (path: string) => void
120
+ onShowInFolder: (files: readonly string[]) => void
121
+ }
122
+
123
+ /** Adapt both the legacy chain match and the current list owner to the row. */
124
+ export function SidebarProducedFilesEntry(props: SidebarProducedFilesEntryProps): ReturnType<typeof SidebarProducedFiles> | null {
125
+ if (props.store.getSuspended() || props.store.getPrefs().tabsEnabled['editor'] === false) return null
126
+ const matched = props.matched ?? selectProducedFiles(props)
127
+ if (matched === null) return null
128
+ lastProduced = matched
129
+ return <SidebarProducedFiles
130
+ matched={matched}
131
+ openInSidebar={props.openInSidebar}
132
+ onShowInFolder={props.onShowInFolder}
133
+ />
134
+ }
135
+
116
136
  /**
117
137
  * Register the turn-tail interception (returns the disposer).
118
138
  *
119
139
  * The slot is a CHILD slot the host's ui-conversation declares in its
120
- * `conversation.chat.node` children table (kind: chain, scope: session).
140
+ * `conversation.chat.node` children table (currently kind: list, scope:
141
+ * session; older compatible Hosts declared a chain).
121
142
  * Registering it directly races the declaration — the ui-slots core's
122
143
  * load-time validation throws "not declared (a parent entry's children
123
144
  * table must declare it)" when the parent entry is not on the ledger yet.
@@ -130,6 +151,9 @@ export function SidebarProducedFiles(props: {
130
151
  export function registerTurnTailInterception(ctx: Context, store: SidebarStore): () => void {
131
152
  return ctx.slots.inject('conversation.chat.turnTail', () => ctx.slots.register({
132
153
  name: 'conversation.chat.turnTail',
154
+ // Required by the current list slot. Older chain runtimes harmlessly
155
+ // retain this extra field while using `select` below.
156
+ id: 'dsh-better-sidebar:produced-files',
133
157
  // Decline the takeover while the editor tab type is disabled in the side
134
158
  // card settings: the produced-files row falls back to the default
135
159
  // deliverables behavior instead of offering chips that cannot open. Also
@@ -144,10 +168,11 @@ export function registerTurnTailInterception(ctx: Context, store: SidebarStore):
144
168
  priority: -1,
145
169
  registrant: 'dsh-better-sidebar',
146
170
  inject: (sessionId: string) => ({
171
+ store,
147
172
  openInSidebar: (path: string) => { openSidebarFile(ctx, store, sessionId, path) },
148
173
  onShowInFolder: (files: readonly string[]) => { revealInExplorer(ctx, store, sessionId, files) },
149
174
  }),
150
- }, SidebarProducedFiles))
175
+ }, SidebarProducedFilesEntry))
151
176
  }
152
177
 
153
178
  /**
@@ -112,7 +112,7 @@ export interface SidebarSlotRegisterOptions {
112
112
  id?: string
113
113
  order?: number
114
114
  label?: string | (() => string)
115
- /** Chain routing selector (returns the matched value, or null to pass on). */
115
+ /** Legacy chain routing selector (returns the matched value, or null to pass on). */
116
116
  select?: (owner: unknown) => unknown
117
117
  priority?: number
118
118
  locale?: string