@jini-ai/chat 0.6.23 → 0.7.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +8 -0
  3. package/dist/core/accepted-input.d.ts +1 -1
  4. package/dist/core/accepted-input.js +5 -4
  5. package/dist/core/durable-projection.js +8 -1
  6. package/dist/core/question-answer.js +2 -1
  7. package/dist/core/turn-usage.d.ts +1 -1
  8. package/dist/core/turn-usage.js +4 -5
  9. package/dist/react/components/AttachmentTray.d.ts +4 -1
  10. package/dist/react/components/AttachmentTray.js +20 -5
  11. package/dist/react/components/Composer.d.ts +3 -1
  12. package/dist/react/components/Composer.js +16 -14
  13. package/dist/react/components/ComposerDiscovery.d.ts +2 -0
  14. package/dist/react/components/ComposerDiscovery.js +4 -3
  15. package/dist/react/components/ConversationList.d.ts +4 -2
  16. package/dist/react/components/ConversationList.js +16 -7
  17. package/dist/react/components/CopyMessageButton.d.ts +3 -1
  18. package/dist/react/components/CopyMessageButton.js +3 -2
  19. package/dist/react/components/FolderChips.d.ts +3 -1
  20. package/dist/react/components/FolderChips.js +8 -5
  21. package/dist/react/components/MessageList.js +1 -1
  22. package/dist/react/components/MessageRow.js +1 -1
  23. package/dist/react/components/ToolCard.js +7 -7
  24. package/dist/react/components/ToolCard.rules.d.ts +5 -0
  25. package/dist/react/components/ToolCard.rules.js +9 -2
  26. package/dist/react/components/mcp-ui-surface-state.js +11 -0
  27. package/dist/react/features/chat-pane/components/AgentRuntimePicker.d.ts +1 -1
  28. package/dist/react/features/chat-pane/components/AgentRuntimePicker.js +38 -27
  29. package/dist/react/features/chat-pane/components/ChatPane.js +19 -8
  30. package/dist/react/features/chat-pane/components/RuntimeDropUp.d.ts +2 -1
  31. package/dist/react/features/chat-pane/components/RuntimeDropUp.js +11 -6
  32. package/dist/react/features/chat-pane/hooks/useChatPane.hooks.js +8 -0
  33. package/dist/react/features/chat-pane/rules.d.ts +22 -1
  34. package/dist/react/features/chat-pane/rules.js +36 -10
  35. package/dist/react/features/chat-pane/styles.d.ts +1 -1
  36. package/dist/react/features/chat-pane/styles.js +32 -39
  37. package/dist/react/features/chat-pane/types.d.ts +10 -0
  38. package/dist/react/index.d.ts +1 -0
  39. package/dist/react/styles/chat-settings.css +149 -0
  40. package/package.json +21 -18
package/CHANGELOG.md CHANGED
@@ -1,3 +1,35 @@
1
+ ## 0.7.1
2
+
3
+ ### Patch Changes
4
+
5
+ - Updated dependencies [873f10c]
6
+ - @jini-ai/core@0.7.1
7
+ - @jini-ai/db@0.7.1
8
+ - @jini-ai/agentic@0.7.1
9
+ - @jini-ai/diagnostics@0.7.1
10
+
11
+ ## 0.7.0
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [8fe045b]
16
+ - Updated dependencies [41ff2ff]
17
+ - Updated dependencies [a266ba8]
18
+ - Updated dependencies [39cf677]
19
+ - Updated dependencies [2364f89]
20
+ - Updated dependencies [27063ef]
21
+ - Updated dependencies [6ab1d81]
22
+ - Updated dependencies [699b478]
23
+ - Updated dependencies [1cf0306]
24
+ - Updated dependencies [39cf677]
25
+ - @jini-ai/core@0.7.0
26
+ - @jini-ai/ui@0.7.0
27
+ - @jini-ai/db@0.7.0
28
+ - @jini-ai/agent-runtime@0.7.0
29
+ - @jini-ai/agentic@0.7.0
30
+ - @jini-ai/diagnostics@0.7.0
31
+ - @jini-ai/protocol@0.7.0
32
+
1
33
  ## 0.6.23
2
34
 
3
35
  - Security hardening.
package/README.md CHANGED
@@ -258,3 +258,11 @@ uses the same fetch for upload and partial-upload cleanup; omission uses
258
258
  inherit the failed upload's cancellation. Upload quotas and its 30-second batch
259
259
  deadline are unchanged. Browser timeout reasons remain native; platform is no
260
260
  longer a dependency of this package.
261
+
262
+ ## Optional chat settings presentation
263
+
264
+ React hosts can import `@jini-ai/chat/react/styles/chat-settings.css` for
265
+ `ChatSettingsDialog` and `ChatSettingsSegmented`. The stylesheet includes standalone
266
+ colors, controls, keyboard focus, and bounded scrolling. Bind its
267
+ `--jini-chat-settings-*` custom properties to the host theme when needed; no
268
+ reference or host stylesheet is required for the settings presentation.
@@ -74,7 +74,7 @@ export declare function projectAcceptedInputEvents({ events }: {
74
74
  events: readonly AgentEvent[];
75
75
  }, options?: AcceptedInputProjectionOptions): AgentEvent[];
76
76
  /** The sole transcript-to-recall projection. A merged queued turn retains its original inputs.
77
- * @returns Accepted inputs once by id/alias, in send order; pending input is excluded.
77
+ * @returns Accepted inputs once by id/alias, in send order; unaccepted pending input is excluded.
78
78
  * @complexity O(m + e + i + a) time/space for messages, events, inputs and aliases; no I/O.
79
79
  * @example acceptedInputsFromMessages({ messages });
80
80
  */
@@ -275,7 +275,7 @@ function projectEvents({ events }, options) {
275
275
  return projected;
276
276
  }
277
277
  /** The sole transcript-to-recall projection. A merged queued turn retains its original inputs.
278
- * @returns Accepted inputs once by id/alias, in send order; pending input is excluded.
278
+ * @returns Accepted inputs once by id/alias, in send order; unaccepted pending input is excluded.
279
279
  * @complexity O(m + e + i + a) time/space for messages, events, inputs and aliases; no I/O.
280
280
  * @example acceptedInputsFromMessages({ messages });
281
281
  */
@@ -288,15 +288,16 @@ export function acceptedInputsFromMessages({ messages }, _options = {}) {
288
288
  * @complexity O(e + i) time/space for the message's events and expanded inputs; no effects.
289
289
  */
290
290
  function inputsFromMessage({ message }, _options = {}) {
291
- if (message.inputPending)
292
- return [];
293
291
  // Queue constituents travel in events_json, already preserved by the existing chat store.
292
+ // A confirmed queue receipt predates its later run start: that carrier may still be pending.
294
293
  const receipts = projectAcceptedInputEvents({ events: message.events ?? [] }).flatMap(event => {
295
294
  const input = acceptedInputEvent({ event });
296
- if (!input)
295
+ if (!input || (message.inputPending && input.data.optimistic))
297
296
  return [];
298
297
  return receiptInputs({ receipt: input });
299
298
  });
299
+ if (message.inputPending && receipts.length === 0)
300
+ return [];
300
301
  if (message.role !== 'user' || receipts.length > 0)
301
302
  return receipts;
302
303
  return [{ id: message.id, text: message.content, ...(message.folders ? { folders: message.folders } : {}) }];
@@ -85,9 +85,16 @@ export function terminalMessageNotice({ message }, _optional = {}) {
85
85
  const notice = message.events?.filter((event) => event.kind === 'status' &&
86
86
  (event.code === 'run_terminal' || /failed|stopped|restarted|could not|not logged in|cancell?ed/i.test(event.label))).at(-1);
87
87
  if (notice?.kind === 'status')
88
- return [notice.label, notice.detail].filter(Boolean).join(' ').replace(/Send your message again to retry\.?/gi, '').trim();
88
+ return terminalStatusText({ notice, canceled: message.runStatus === 'canceled' });
89
89
  return message.runStatus === 'failed' ? 'This turn failed.' : 'Stopped.';
90
90
  }
91
+ /** Cancellation is an ordinary decision; saved process diagnostics remain available to the host.
92
+ * Keep meaningful stop/recovery explanations while hiding CLI exit metadata. O(n) notice text. */
93
+ function terminalStatusText({ notice, canceled }) {
94
+ const label = canceled && /^(?:Run )?cancell?ed[.!]?$/i.test(notice.label) ? 'Canceled.' : notice.label;
95
+ const detail = canceled && /^exit code (?:none|-?\d+), signal (?:none|SIG[A-Z0-9]+), resumable (?:yes|no)(?:[., ]|$)/i.test(notice.detail ?? '') ? undefined : notice.detail;
96
+ return [label, detail].filter(Boolean).join(' ').replace(/Send your message again to retry\.?/gi, '').trim();
97
+ }
91
98
  /** The first answer has no earlier segment to divide, even if startup was retried. Only saved
92
99
  * visible text can justify a Continued divider; the recovery marker still records the attempt. */
93
100
  export function recoveredRunEvents({ saved }, { notice = 'visible' } = {}) {
@@ -29,7 +29,8 @@ function selectedAnswerText({ result, input }, _options = {}) {
29
29
  if (typeof result.choice === 'string')
30
30
  labels.push(optionLabel({ group: question.singleSelect ?? question, value: result.choice }));
31
31
  if (Array.isArray(result.selections)) {
32
- labels.push(...selectionLabels({ selections: result.selections, question }));
32
+ for (const label of selectionLabels({ selections: result.selections, question }))
33
+ labels.push(label);
33
34
  }
34
35
  if (labels.length > 0)
35
36
  return labels.join(', ');
@@ -40,7 +40,7 @@ export declare function turnUsage({ events }: {
40
40
  agentId?: string;
41
41
  }): UsageEvent | undefined;
42
42
  /** Derive per-turn charges and prefix totals from persisted events_json, for live and reloaded
43
- * chats alike. A single reply's duration is the message's elapsed run time, from send to finish.
43
+ * chats alike. A single reply keeps its reported duration; elapsed run time fills a missing one.
44
44
  * A message with mid-run replies also gets per-reply `segments`. O(e + m) for e events
45
45
  * and m messages; no per-row transcript scans or I/O.
46
46
  * @example conversationUsage({ messages: savedMessages }).get('assistant-2') */
@@ -113,7 +113,7 @@ function addUsage({ total, usage }, _optional = {}) {
113
113
  return next;
114
114
  }
115
115
  /** Derive per-turn charges and prefix totals from persisted events_json, for live and reloaded
116
- * chats alike. A single reply's duration is the message's elapsed run time, from send to finish.
116
+ * chats alike. A single reply keeps its reported duration; elapsed run time fills a missing one.
117
117
  * A message with mid-run replies also gets per-reply `segments`. O(e + m) for e events
118
118
  * and m messages; no per-row transcript scans or I/O.
119
119
  * @example conversationUsage({ messages: savedMessages }).get('assistant-2') */
@@ -157,11 +157,10 @@ function messageUsage({ message, sessions, totalCostUsd }, _optional = {}) {
157
157
  }
158
158
  return { usage, segments, totalCostUsd: prefixTotal };
159
159
  }
160
- /** Time one reply from the person's send (`startedAt`) to the run's end, the same way for every CLI.
161
- * A CLI's own reported duration leaves out its start-up wait (Claude Code said 42 s for a turn that took
162
- * 46.5 s from send to finish), so it is only the fallback when the timestamps are missing or invalid. */
160
+ /** Fill a single reply's missing duration from send/end timestamps. Reported CLI duration wins,
161
+ * including zero: it measures the runtime's work rather than the host's startup wait. */
163
162
  function fillRunDuration({ usage, message }, _optional = {}) {
164
- if (message.startedAt === undefined || message.endedAt === undefined)
163
+ if (usage.durationMs !== undefined || message.startedAt === undefined || message.endedAt === undefined)
165
164
  return;
166
165
  const durationMs = message.endedAt - message.startedAt;
167
166
  if (Number.isFinite(durationMs) && durationMs >= 0)
@@ -3,8 +3,11 @@ import { type ObjectUrlPort } from './SentAttachment.hooks.js';
3
3
  import { formatAttachmentSize } from './attachment-size.js';
4
4
  export { formatAttachmentSize };
5
5
  export type AttachmentTrayProps = AttachmentTraySlot & {
6
+ agentHandle?: string | false | undefined;
6
7
  /** Blob-URL port for chip thumbnails; defaults to the platform's (see `SentAttachment.hooks.ts`). */
7
8
  objectUrls?: ObjectUrlPort | undefined;
9
+ /** An upload is still running: shows a spinning placeholder chip after the staged ones. */
10
+ uploading?: boolean | undefined;
8
11
  };
9
- export declare function AttachmentTray({ attachments, onRemove, renderItem, objectUrls }: AttachmentTrayProps): import("react").JSX.Element | null;
12
+ export declare function AttachmentTray({ agentHandle, attachments, onRemove, renderItem, objectUrls, uploading }: AttachmentTrayProps): import("react").JSX.Element | null;
10
13
  //# sourceMappingURL=AttachmentTray.d.ts.map
@@ -1,4 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * @module AttachmentTray
4
+ *
5
+ * Renders staged composer attachments as removable chips. A dumb,
6
+ * props-in/JSX-out implementation of the `AttachmentTraySlot` shape from
7
+ * `ADS-memory/reports/jini-port/recon/r4b-webui-design.md` §2 — a host can pass its own
8
+ * `renderItem` for exotic attachment kinds (screenshots, Figma frames, ...)
9
+ * and this component falls back to the built-in chip otherwise.
10
+ *
11
+ * The built-in chip shows a thumbnail for an image this browser staged (the same preview cache a
12
+ * sent message's thumbnail reads) and opens the shared `AttachmentPreviewModal`, with previous/next
13
+ * across the staged images - before sending, the operator can check which screenshots are going.
14
+ */
15
+ import { agentHandleProps, agentHandleSegment } from '@jini-ai/agentic';
2
16
  import { useT } from '../hooks/context.js';
3
17
  import { Icon } from './Icon.js';
4
18
  import { AttachmentPreviewModal } from './AttachmentPreviewModal.js';
@@ -8,18 +22,19 @@ import { useSentAttachmentThumbnail } from './SentAttachment.hooks.js';
8
22
  import { formatAttachmentSize } from './attachment-size.js';
9
23
  // Re-exported: callers and tests have always imported it from here.
10
24
  export { formatAttachmentSize };
11
- export function AttachmentTray({ attachments, onRemove, renderItem, objectUrls }) {
25
+ export function AttachmentTray({ agentHandle, attachments, onRemove, renderItem, objectUrls, uploading = false }) {
26
+ const base = agentHandle || undefined;
12
27
  const t = useT();
13
28
  const gallery = useAttachmentGallery({ attachments });
14
- if (attachments.length === 0)
29
+ if (attachments.length === 0 && !uploading)
15
30
  return null;
16
- return (_jsxs("div", { className: "jini-attachment-tray", "data-testid": "composer-attachment-tray", children: [attachments.map((a) => (_jsxs("div", { className: "jini-attachment-chip", "data-testid": "attachment-chip", "data-attachment-kind": a.kind, "data-attachment-name": a.name, children: [renderItem ? renderItem(a) : _jsx(DefaultAttachmentChip, { attachment: a, onOpen: gallery.open, objectUrls: objectUrls }), _jsx("button", { type: "button", className: "jini-attachment-remove", onClick: () => onRemove(a.path), title: t('Remove {name}', { name: a.name }), "aria-label": t('Remove {name}', { name: a.name }), children: _jsx(Icon, { name: "close", size: 12 }) })] }, a.path))), gallery.opened ? (_jsx(AttachmentPreviewModal, { attachment: gallery.opened, onClose: gallery.close, navigation: gallery.navigation })) : null] }));
31
+ return (_jsxs("div", { className: "jini-attachment-tray", "data-testid": "composer-attachment-tray", children: [attachments.map((a) => (_jsxs("div", { className: "jini-attachment-chip", "data-testid": "attachment-chip", "data-attachment-kind": a.kind, "data-attachment-name": a.name, children: [renderItem ? renderItem(a) : _jsx(DefaultAttachmentChip, { base: base, attachment: a, onOpen: gallery.open, objectUrls: objectUrls }), _jsx("button", { ...agentHandleProps({}, { base, action: `remove-${agentHandleSegment({ value: a.path })}`, role: 'button', label: t('Remove {name}', { name: a.name }) }), type: "button", className: "jini-attachment-remove", onClick: () => onRemove(a.path), title: t('Remove {name}', { name: a.name }), "aria-label": t('Remove {name}', { name: a.name }), children: _jsx(Icon, { name: "close", size: 12 }) })] }, a.path))), uploading ? (_jsxs("div", { className: "jini-attachment-chip is-uploading", "data-testid": "attachment-uploading-chip", children: [_jsx("span", { className: "jini-attachment-chip-icon", children: _jsx(Icon, { name: "spinner", size: 15 }) }), _jsx("span", { className: "jini-attachment-chip-copy", children: _jsx("span", { className: "jini-attachment-chip-name", children: t('Uploading…') }) })] })) : null, gallery.opened ? (_jsx(AttachmentPreviewModal, { attachment: gallery.opened, onClose: gallery.close, navigation: gallery.navigation })) : null] }));
17
32
  }
18
- function DefaultAttachmentChip({ attachment, onOpen, objectUrls }) {
33
+ function DefaultAttachmentChip({ base, attachment, onOpen, objectUrls }) {
19
34
  const t = useT();
20
35
  const { thumbnailUrl, onThumbnailError } = useSentAttachmentThumbnail({ attachment }, objectUrls === undefined ? {} : { objectUrls });
21
36
  const size = formatAttachmentSize({ size: attachment.size });
22
37
  const label = thumbnailUrl && isOpaqueAttachmentName({ name: attachment.name }) ? t('Image') : attachment.name;
23
- return (_jsxs("button", { type: "button", className: "jini-attachment-chip-body", onClick: () => onOpen(attachment), title: t('Open {name}', { name: attachment.name }), "aria-label": t('Open {name}', { name: attachment.name }), children: [thumbnailUrl ? (_jsx("img", { className: "jini-attachment-chip-thumb", src: thumbnailUrl, alt: "", onError: onThumbnailError })) : (_jsx("span", { className: `jini-attachment-chip-icon is-${attachment.kind}`, children: _jsx(Icon, { name: attachment.kind === 'image' ? 'image' : 'file', size: 15 }) })), _jsxs("span", { className: "jini-attachment-chip-copy", children: [_jsx("span", { className: "jini-attachment-chip-name", children: label }), size ? _jsx("small", { className: "jini-attachment-chip-size", children: size }) : null] })] }));
38
+ return (_jsxs("button", { type: "button", ...agentHandleProps({}, { base, action: `open-${agentHandleSegment({ value: attachment.path })}`, role: 'button', label: t('Open {name}', { name: attachment.name }) }), className: "jini-attachment-chip-body", onClick: () => onOpen(attachment), title: t('Open {name}', { name: attachment.name }), "aria-label": t('Open {name}', { name: attachment.name }), children: [thumbnailUrl ? (_jsx("img", { className: "jini-attachment-chip-thumb", src: thumbnailUrl, alt: "", onError: onThumbnailError })) : (_jsx("span", { className: `jini-attachment-chip-icon is-${attachment.kind}`, children: _jsx(Icon, { name: attachment.kind === 'image' ? 'image' : 'file', size: 15 }) })), _jsxs("span", { className: "jini-attachment-chip-copy", children: [_jsx("span", { className: "jini-attachment-chip-name", children: label }), size ? _jsx("small", { className: "jini-attachment-chip-size", children: size }) : null] })] }));
24
39
  }
25
40
  //# sourceMappingURL=AttachmentTray.js.map
@@ -1,6 +1,8 @@
1
1
  import type { UseComposerResult } from '../hooks/useComposer.js';
2
2
  import type { ComposerSlots } from '../slots.js';
3
3
  export interface ComposerProps {
4
+ /** Stable automation base; false suppresses every package-owned control handle. */
5
+ agentHandle?: string | false | undefined;
4
6
  composer: UseComposerResult;
5
7
  onSend: () => void;
6
8
  disabled?: boolean;
@@ -71,5 +73,5 @@ export interface ComposerProps {
71
73
  * @complexity Time/space: O(n) in rendered attachments and supplied menu items.
72
74
  * @overallScore 100/100
73
75
  */
74
- export declare function Composer({ composer, onSend, disabled, sendDisabled, sendDisabledReason, sendDisabledReasonId, placeholder, slots, attachmentPicker, running, onCancel, onInterrupt, workingDirectory, onChangeWorkingDirectory, onPickWorkingDirectory, }: ComposerProps): import("react").JSX.Element;
76
+ export declare function Composer({ agentHandle, composer, onSend, disabled, sendDisabled, sendDisabledReason, sendDisabledReasonId, placeholder, slots, attachmentPicker, running, onCancel, onInterrupt, workingDirectory, onChangeWorkingDirectory, onPickWorkingDirectory, }: ComposerProps): import("react").JSX.Element;
75
77
  //# sourceMappingURL=Composer.d.ts.map
@@ -15,7 +15,8 @@ import { formatErrorForLog } from '@jini-ai/core';
15
15
  */
16
16
  import { FolderChips } from './FolderChips.js';
17
17
  import { useEffect, useLayoutEffect, useRef, useState, } from 'react';
18
- import { RemixIcon } from '@jini-ai/ui';
18
+ import { RemixIcon, useAgentHandle } from '@jini-ai/ui';
19
+ import { agentHandleProps, agentHandleSegment } from '@jini-ai/agentic';
19
20
  import { useT } from '../hooks/context.js';
20
21
  import { useComposerHistoryKeys } from '../hooks/useComposerHistoryKeys.hooks.js';
21
22
  import { AttachmentTray } from './AttachmentTray.js';
@@ -67,7 +68,8 @@ function runComposerHostEffect(effectName, effect, onSettled, onResolved) {
67
68
  * @complexity Time/space: O(n) in rendered attachments and supplied menu items.
68
69
  * @overallScore 100/100
69
70
  */
70
- export function Composer({ composer, onSend, disabled = false, sendDisabled = false, sendDisabledReason, sendDisabledReasonId, placeholder, slots, attachmentPicker, running = false, onCancel, onInterrupt, workingDirectory, onChangeWorkingDirectory, onPickWorkingDirectory, }) {
71
+ export function Composer({ agentHandle, composer, onSend, disabled = false, sendDisabled = false, sendDisabledReason, sendDisabledReasonId, placeholder, slots, attachmentPicker, running = false, onCancel, onInterrupt, workingDirectory, onChangeWorkingDirectory, onPickWorkingDirectory, }) {
72
+ const base = useAgentHandle({ agentHandle });
71
73
  const t = useT();
72
74
  const attachmentInputRef = useRef(null);
73
75
  const textareaRef = useRef(null);
@@ -322,14 +324,14 @@ export function Composer({ composer, onSend, disabled = false, sendDisabled = fa
322
324
  event.preventDefault();
323
325
  runComposerHostEffect('attachmentPicker.onFiles', () => attachmentPicker.onFiles(files));
324
326
  }
325
- return (_jsxs("div", { className: "jini-composer", children: [_jsx(AccessorySlot, { className: "jini-composer-leading", children: leadingAccessories }), _jsxs("div", { className: "jini-composer-attachments", children: [_jsx(AttachmentTray, { attachments: composer.attachments, onRemove: composer.removeAttachment }), _jsx(FolderChips, { folders: composer.folders, onRemove: composer.removeFolder })] }), _jsx("textarea", { ref: textareaRef, className: "jini-composer-input", value: composer.draft, placeholder: placeholder ?? t('Send a message…'), disabled: disabled, onChange: (e) => {
327
+ return (_jsxs("div", { className: "jini-composer", children: [_jsx(AccessorySlot, { className: "jini-composer-leading", children: leadingAccessories }), _jsxs("div", { className: "jini-composer-attachments", children: [_jsx(AttachmentTray, { agentHandle: base, attachments: composer.attachments, onRemove: composer.removeAttachment, uploading: attachmentPicker?.uploading === true }), _jsx(FolderChips, { agentHandle: base, folders: composer.folders, onRemove: composer.removeFolder })] }), _jsx("textarea", { ...agentHandleProps({}, { base, action: 'draft', role: 'field', label: t('Message draft') }), ref: textareaRef, className: "jini-composer-input", value: composer.draft, placeholder: placeholder ?? t('Send a message…'), disabled: disabled, onChange: (e) => {
326
328
  composer.setDraft(e.target.value);
327
329
  setSlashActiveIndex(0);
328
330
  setDismissedSlashDraft(null);
329
331
  }, onKeyDown: handleKeyDown,
330
332
  // Draft persistence is debounced (see `DRAFT_PERSIST_DEBOUNCE_MS`); leaving the field is a
331
333
  // natural point to make it durable now.
332
- onBlur: () => composer.flushDraft?.(), onPaste: handleAttachmentPaste, ...slashTextareaAria(slashOpen, slashActiveOption), rows: 3 }), slashOpen ? (_jsx(ComposerSlashMenu, { matches: slash.matches, activeIndex: slashActiveOption, onSelect: selectSlashItem, showFilterHint: slash.showFilterHint, style: slashMenuPosition, t: t })) : null, _jsxs("div", { className: "jini-composer-footer", children: [_jsx(ComposerAttachButton, { attachmentPicker: attachmentPicker, hidden: hasDiscoveryItems, disabled: disabled, inputRef: attachmentInputRef, onChange: handleAttachmentChange, t: t }), _jsx(ComposerDiscoveryMenu, { groups: discoveryGroups, open: discoveryMenuOpen, disabled: disabled, ...(attachmentPicker ? { attachmentPicker } : {}), attachmentInputRef: attachmentInputRef, onToggle: () => setDiscoveryMenuOpen((open) => !open), onClose: () => setDiscoveryMenuOpen(false), onSelect: selectPlusItem, onAttachmentChange: handleAttachmentChange, style: discoveryMenuPosition, t: t }), _jsx(AccessorySlot, { className: "jini-composer-footer-leading", children: footerLeadingAccessory }), _jsx(ComposerWorkdirControl, { workingDirectory: workingDirectory, onChangeWorkingDirectory: onChangeWorkingDirectory, onPickWorkingDirectory: onPickWorkingDirectory, disabled: disabled, open: workdirOpen, draft: workdirDraft, position: workdirPosition, onToggle: toggleWorkdir, onDraftChange: setWorkdirDraft, onConfirm: confirmWorkdir, onClose: () => setWorkdirOpen(false), t: t }), _jsxs("div", { className: "jini-composer-footer-trailing", children: [_jsx(AccessorySlot, { className: "jini-composer-footer-accessories", children: footerAccessories }), _jsx(ComposerPlusMenu, { items: plusMenuItems, t: t }), _jsx(ComposerSendGroup, { running: running, disabled: disabled, sendDisabled: sendDisabled, canSubmit: composer.canSubmit, onSend: onSend, onCancel: onCancel, sendDisabledReason: sendDisabledReason, sendDisabledReasonId: sendDisabledReasonId, t: t })] })] })] }));
334
+ onBlur: () => composer.flushDraft?.(), onPaste: handleAttachmentPaste, ...slashTextareaAria(slashOpen, slashActiveOption), rows: 3 }), slashOpen ? (_jsx(ComposerSlashMenu, { base: base, matches: slash.matches, activeIndex: slashActiveOption, onSelect: selectSlashItem, showFilterHint: slash.showFilterHint, style: slashMenuPosition, t: t })) : null, _jsxs("div", { className: "jini-composer-footer", children: [_jsx(ComposerAttachButton, { base: base, attachmentPicker: attachmentPicker, hidden: hasDiscoveryItems, disabled: disabled, inputRef: attachmentInputRef, onChange: handleAttachmentChange, t: t }), _jsx(ComposerDiscoveryMenu, { base: base, groups: discoveryGroups, open: discoveryMenuOpen, disabled: disabled, ...(attachmentPicker ? { attachmentPicker } : {}), attachmentInputRef: attachmentInputRef, onToggle: () => setDiscoveryMenuOpen((open) => !open), onClose: () => setDiscoveryMenuOpen(false), onSelect: selectPlusItem, onAttachmentChange: handleAttachmentChange, style: discoveryMenuPosition, t: t }), _jsx(AccessorySlot, { className: "jini-composer-footer-leading", children: footerLeadingAccessory }), _jsx(ComposerWorkdirControl, { base: base, workingDirectory: workingDirectory, onChangeWorkingDirectory: onChangeWorkingDirectory, onPickWorkingDirectory: onPickWorkingDirectory, disabled: disabled, open: workdirOpen, draft: workdirDraft, position: workdirPosition, onToggle: toggleWorkdir, onDraftChange: setWorkdirDraft, onConfirm: confirmWorkdir, onClose: () => setWorkdirOpen(false), t: t }), _jsxs("div", { className: "jini-composer-footer-trailing", children: [_jsx(AccessorySlot, { className: "jini-composer-footer-accessories", children: footerAccessories }), _jsx(ComposerPlusMenu, { base: base, items: plusMenuItems, t: t }), _jsx(ComposerSendGroup, { base: base, running: running, disabled: disabled, sendDisabled: sendDisabled, canSubmit: composer.canSubmit, onSend: onSend, onCancel: onCancel, sendDisabledReason: sendDisabledReason, sendDisabledReasonId: sendDisabledReasonId, t: t })] })] })] }));
333
335
  }
334
336
  function anyPopoverOpen({ discoveryMenuOpen, slashOpen, workdirOpen }) {
335
337
  return discoveryMenuOpen || slashOpen || workdirOpen;
@@ -366,19 +368,19 @@ function AccessorySlot({ className, children }) {
366
368
  return children ? _jsx("div", { className: className, children: children }) : null;
367
369
  }
368
370
  /** The plain paperclip, shown only when there is no "+" discovery menu to carry attaching instead. */
369
- function ComposerAttachButton({ attachmentPicker, hidden, disabled, inputRef, onChange, t }) {
371
+ function ComposerAttachButton({ base, attachmentPicker, hidden, disabled, inputRef, onChange, t }) {
370
372
  if (!attachmentPicker || hidden)
371
373
  return null;
372
374
  const uploading = attachmentPicker.uploading;
373
375
  const label = t(uploading ? 'Attaching files…' : 'Attach files');
374
- return (_jsxs("div", { className: "jini-composer-attachment-picker", children: [_jsx("input", { ref: inputRef, className: "jini-composer-file-input", "data-testid": "composer-attachment-input", type: "file", multiple: true, "aria-label": t('Attach files'), accept: attachmentPicker.accept, disabled: disabled || uploading, onChange: onChange }), _jsx("button", { type: "button", className: "jini-composer-attach", disabled: disabled || uploading, onClick: () => inputRef.current?.click(), title: label, "aria-label": label, children: _jsx(RemixIcon, { name: uploading ? 'refresh-line' : 'add-line', size: 20, ...(uploading ? { className: 'jini-composer-spinner' } : {}) }) })] }));
376
+ return (_jsxs("div", { className: "jini-composer-attachment-picker", children: [_jsx("input", { ref: inputRef, className: "jini-composer-file-input", "data-testid": "composer-attachment-input", type: "file", multiple: true, "aria-label": t('Attach files'), accept: attachmentPicker.accept, disabled: disabled || uploading, onChange: onChange }), _jsx("button", { type: "button", ...agentHandleProps({}, { base, action: 'attach', role: 'button', label }), className: "jini-composer-attach", disabled: disabled || uploading, onClick: () => inputRef.current?.click(), title: label, "aria-label": label, children: _jsx(RemixIcon, { name: uploading ? 'refresh-line' : 'add-line', size: 20, ...(uploading ? { className: 'jini-composer-spinner' } : {}) }) })] }));
375
377
  }
376
- function ComposerWorkdirControl({ workingDirectory, onChangeWorkingDirectory, onPickWorkingDirectory, disabled, open, draft, position, onToggle, onDraftChange, onConfirm, onClose, t }) {
378
+ function ComposerWorkdirControl({ base, workingDirectory, onChangeWorkingDirectory, onPickWorkingDirectory, disabled, open, draft, position, onToggle, onDraftChange, onConfirm, onClose, t }) {
377
379
  if (!onChangeWorkingDirectory && !onPickWorkingDirectory)
378
380
  return null;
379
- return (_jsxs("div", { className: "jini-composer-workdir", "data-testid": "composer-workdir", children: [_jsx("button", { type: "button", className: "jini-composer-attach", "data-testid": "composer-workdir-trigger", disabled: disabled, onClick: onPickWorkingDirectory ? () => onPickWorkingDirectory() : onToggle, ...(onPickWorkingDirectory ? {} : { 'aria-haspopup': 'dialog', 'aria-expanded': open }), title: workingDirectory ?? t('Set working directory'), "aria-label": workingDirectory
381
+ return (_jsxs("div", { className: "jini-composer-workdir", "data-testid": "composer-workdir", children: [_jsx("button", { type: "button", className: "jini-composer-attach", ...agentHandleProps({}, { base, action: 'workdir', role: 'button', label: t('Set working directory') }), "data-testid": "composer-workdir-trigger", disabled: disabled, onClick: onPickWorkingDirectory ? () => onPickWorkingDirectory() : onToggle, ...(onPickWorkingDirectory ? {} : { 'aria-haspopup': 'dialog', 'aria-expanded': open }), title: workingDirectory ?? t('Set working directory'), "aria-label": workingDirectory
380
382
  ? t('Working directory: {dir}', { dir: workingDirectory })
381
- : t('Set working directory'), children: _jsx(RemixIcon, { name: "folder-line", size: 20 }) }), !onPickWorkingDirectory && open ? (_jsxs("div", { className: "jini-composer-workdir-panel", "data-testid": "composer-workdir-panel", role: "dialog", "aria-label": t('Working directory'), style: position, children: [_jsx("input", { type: "text", className: "jini-composer-workdir-input", "data-testid": "composer-workdir-input", value: draft, onChange: (e) => onDraftChange(e.target.value), onKeyDown: (e) => {
383
+ : t('Set working directory'), children: _jsx(RemixIcon, { name: "folder-line", size: 20 }) }), !onPickWorkingDirectory && open ? (_jsxs("div", { className: "jini-composer-workdir-panel", "data-testid": "composer-workdir-panel", role: "dialog", "aria-label": t('Working directory'), style: position, children: [_jsx("input", { type: "text", className: "jini-composer-workdir-input", ...agentHandleProps({}, { base, action: 'workdir-path', role: 'field', label: t('Working directory path') }), "data-testid": "composer-workdir-input", value: draft, onChange: (e) => onDraftChange(e.target.value), onKeyDown: (e) => {
382
384
  if (e.key === 'Enter') {
383
385
  e.preventDefault();
384
386
  onConfirm();
@@ -388,19 +390,19 @@ function ComposerWorkdirControl({ workingDirectory, onChangeWorkingDirectory, on
388
390
  e.preventDefault();
389
391
  onClose();
390
392
  }
391
- }, placeholder: t('Working directory path'), "aria-label": t('Working directory path'), autoFocus: true }), _jsx("button", { type: "button", className: "jini-composer-workdir-confirm", "data-testid": "composer-workdir-confirm", onClick: onConfirm, children: t('Set') })] })) : null] }));
393
+ }, placeholder: t('Working directory path'), "aria-label": t('Working directory path'), autoFocus: true }), _jsx("button", { type: "button", className: "jini-composer-workdir-confirm", ...agentHandleProps({}, { base, action: 'workdir-set', role: 'button', label: t('Set working directory') }), "data-testid": "composer-workdir-confirm", onClick: onConfirm, children: t('Set') })] })) : null] }));
392
394
  }
393
- function ComposerPlusMenu({ items, t }) {
395
+ function ComposerPlusMenu({ base, items, t }) {
394
396
  if (!items || items.length === 0)
395
397
  return null;
396
- return (_jsx("div", { className: "jini-composer-plus-menu", children: items.map((item) => (_jsxs("button", { type: "button", className: "jini-composer-plus-item", onClick: () => runComposerHostEffect('plusMenuItems.onSelect', () => item.onSelect()), title: t(item.label), children: [item.icon ?? null, _jsx("span", { children: t(item.label) })] }, item.id))) }));
398
+ return (_jsx("div", { className: "jini-composer-plus-menu", children: items.map((item) => (_jsxs("button", { type: "button", ...agentHandleProps({}, { base, action: `extra-${agentHandleSegment({ value: item.id })}`, role: 'button', label: t(item.label) }), className: "jini-composer-plus-item", onClick: () => runComposerHostEffect('plusMenuItems.onSelect', () => item.onSelect()), title: t(item.label), children: [item.icon ?? null, _jsx("span", { children: t(item.label) })] }, item.id))) }));
397
399
  }
398
- function ComposerSendGroup({ running, disabled, sendDisabled, canSubmit, onSend, onCancel, sendDisabledReason, sendDisabledReasonId, t }) {
400
+ function ComposerSendGroup({ base, running, disabled, sendDisabled, canSubmit, onSend, onCancel, sendDisabledReason, sendDisabledReasonId, t }) {
399
401
  const canSend = !disabled && !sendDisabled && canSubmit;
400
402
  return (
401
403
  // While a run streams, Send sits beside Stop once there is something to send: a message
402
404
  // sent mid-run goes to the running agent (or next, if it cannot take it now). One group so
403
405
  // the footer's space-between keeps the two together at the trailing edge.
404
- _jsxs("span", { className: "jini-composer-send-group", children: [!running || canSend ? (_jsx("button", { type: "button", className: "jini-composer-send", disabled: !canSend, onClick: onSend, title: sendDisabledReason ?? t('Send'), "aria-label": t('Send'), "aria-describedby": sendDisabledReasonId, children: _jsx(RemixIcon, { name: "send-plane-2-line", size: 16 }) })) : null, running ? (_jsx("button", { type: "button", className: "jini-composer-send jini-composer-send--stop", onClick: onCancel, title: t('Stop run'), "aria-label": t('Stop run'), children: _jsx(RemixIcon, { name: "stop-fill", size: 14 }) })) : null] }));
406
+ _jsxs("span", { className: "jini-composer-send-group", children: [!running || canSend ? (_jsx("button", { ...agentHandleProps({}, { base, action: 'send', role: 'button', label: t('Send') }), type: "button", className: "jini-composer-send", disabled: !canSend, onClick: onSend, title: sendDisabledReason ?? t('Send'), "aria-label": t('Send'), "aria-describedby": sendDisabledReasonId, children: _jsx(RemixIcon, { name: "send-plane-2-line", size: 16 }) })) : null, running ? (_jsx("button", { ...agentHandleProps({}, { base, action: 'stop', role: 'button', label: t('Stop run') }), type: "button", className: "jini-composer-send jini-composer-send--stop", onClick: onCancel, title: t('Stop run'), "aria-label": t('Stop run'), children: _jsx(RemixIcon, { name: "stop-fill", size: 14 }) })) : null] }));
405
407
  }
406
408
  //# sourceMappingURL=Composer.js.map
@@ -7,6 +7,7 @@ interface AttachmentPicker {
7
7
  uploading?: boolean;
8
8
  }
9
9
  export interface ComposerDiscoveryMenuProps {
10
+ base?: string | undefined;
10
11
  groups: readonly ComposerDiscoveryGroup[];
11
12
  open: boolean;
12
13
  disabled: boolean;
@@ -27,6 +28,7 @@ export interface ComposerDiscoveryMenuProps {
27
28
  /** Generic grouped add-menu; the host owns all inventory labels and items. */
28
29
  export declare function ComposerDiscoveryMenu(props: ComposerDiscoveryMenuProps): import("react").JSX.Element | null;
29
30
  export interface ComposerSlashMenuProps {
31
+ base?: string | undefined;
30
32
  matches: readonly ComposerDiscoveryMatch[];
31
33
  activeIndex: number;
32
34
  onSelect: (item: ComposerDiscoveryItem) => void;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { RemixIcon } from '@jini-ai/ui';
3
+ import { agentHandleProps, agentHandleSegment } from '@jini-ai/agentic';
3
4
  /** Generic grouped add-menu; the host owns all inventory labels and items. */
4
5
  export function ComposerDiscoveryMenu(props) {
5
6
  const hasItems = props.groups.some((group) => group.items.length > 0);
@@ -10,13 +11,13 @@ export function ComposerDiscoveryMenu(props) {
10
11
  return;
11
12
  event.preventDefault();
12
13
  props.onClose();
13
- }, children: [props.attachmentPicker ? (_jsx("input", { ref: props.attachmentInputRef, className: "jini-composer-file-input", "data-testid": "composer-attachment-input", type: "file", multiple: true, "aria-label": props.t('Attach files'), accept: props.attachmentPicker.accept, disabled: props.disabled || props.attachmentPicker.uploading, onChange: props.onAttachmentChange })) : null, _jsx("button", { type: "button", className: "jini-composer-attach", disabled: props.disabled, onClick: props.onToggle, "aria-expanded": props.open, "aria-haspopup": "menu", title: props.t('Add context'), "aria-label": props.t('Add context'), children: _jsx(RemixIcon, { name: "add-line", size: 20 }) }), props.open ? (_jsxs("div", { className: "jini-composer-discovery-menu", style: props.style, role: "menu", "aria-label": props.t('Add context'), children: [props.attachmentPicker ? (_jsxs("div", { className: "jini-composer-discovery-group", role: "group", "aria-label": props.t('Files'), children: [_jsx("span", { className: "jini-composer-discovery-group-label", children: props.t('Files') }), _jsx("button", { type: "button", role: "menuitem", className: "jini-composer-discovery-item", disabled: props.disabled || props.attachmentPicker.uploading, onClick: () => {
14
+ }, children: [props.attachmentPicker ? (_jsx("input", { ref: props.attachmentInputRef, className: "jini-composer-file-input", "data-testid": "composer-attachment-input", type: "file", multiple: true, "aria-label": props.t('Attach files'), accept: props.attachmentPicker.accept, disabled: props.disabled || props.attachmentPicker.uploading, onChange: props.onAttachmentChange })) : null, _jsx("button", { type: "button", ...agentHandleProps({}, { base: props.base, action: 'discovery', role: 'button', label: props.t('Add context') }), className: "jini-composer-attach", disabled: props.disabled, onClick: props.onToggle, "aria-expanded": props.open, "aria-haspopup": "menu", title: props.t('Add context'), "aria-label": props.t('Add context'), children: _jsx(RemixIcon, { name: "add-line", size: 20 }) }), props.open ? (_jsxs("div", { className: "jini-composer-discovery-menu", style: props.style, role: "menu", "aria-label": props.t('Add context'), children: [props.attachmentPicker ? (_jsxs("div", { className: "jini-composer-discovery-group", role: "group", "aria-label": props.t('Files'), children: [_jsx("span", { className: "jini-composer-discovery-group-label", children: props.t('Files') }), _jsx("button", { type: "button", role: "menuitem", ...agentHandleProps({}, { base: props.base, action: 'attach', role: 'button', label: props.t('Attach files') }), className: "jini-composer-discovery-item", disabled: props.disabled || props.attachmentPicker.uploading, onClick: () => {
14
15
  props.onClose();
15
16
  props.attachmentInputRef.current?.click();
16
17
  }, children: props.t(props.attachmentPicker.uploading ? 'Attaching files…' : 'Attach files') })] })) : null, props.groups.map((group) => group.items.length > 0 ? (_jsxs("div", { className: "jini-composer-discovery-group", role: "group", "aria-label": props.t(group.label), children: [_jsx("span", { className: "jini-composer-discovery-group-label", children: props.t(group.label) }), group.items.map((item) => {
17
18
  const description = item.description ? props.t(item.description) : undefined;
18
19
  const descriptionId = description ? `jini-composer-discovery-desc-${item.id}` : undefined;
19
- return (_jsxs("button", { type: "button", role: "menuitem", className: "jini-composer-discovery-item", "aria-describedby": descriptionId, onClick: () => props.onSelect(item), children: [_jsx("span", { children: props.t(item.label) }), description ? (_jsx("small", { id: descriptionId, className: "jini-composer-discovery-description", children: description })) : null] }, item.id));
20
+ return (_jsxs("button", { type: "button", role: "menuitem", ...agentHandleProps({}, { base: props.base, action: `discover-${agentHandleSegment({ value: group.id })}-${agentHandleSegment({ value: item.id })}`, role: 'button', label: props.t(item.label) }), className: "jini-composer-discovery-item", "aria-describedby": descriptionId, onClick: () => props.onSelect(item), children: [_jsx("span", { children: props.t(item.label) }), description ? (_jsx("small", { id: descriptionId, className: "jini-composer-discovery-description", children: description })) : null] }, item.id));
20
21
  })] }, group.id)) : null)] })) : null] }));
21
22
  }
22
23
  /** Keyboard navigation is owned by Composer so focus stays in the textarea. */
@@ -32,7 +33,7 @@ export function ComposerSlashMenu(props) {
32
33
  _jsx("div", { className: "jini-composer-discovery-group-label", role: "presentation", children: props.t('Keep typing to narrow the list') })) : null, props.matches.map((match, index) => {
33
34
  const description = props.t(match.item.description ?? match.groupLabel);
34
35
  const descriptionId = `jini-composer-slash-option-${index}-desc`;
35
- return (_jsxs("button", { id: `jini-composer-slash-option-${index}`, type: "button", role: "option", "aria-selected": index === props.activeIndex, "aria-describedby": descriptionId, className: `jini-composer-discovery-item${index === props.activeIndex ? ' is-active' : ''}`, onMouseDown: (event) => event.preventDefault(), onClick: () => props.onSelect(match.item), children: [_jsxs("span", { children: [props.t(match.item.label), match.item.argument ? (_jsxs("code", { className: "jini-composer-slash-argument", children: [" ", match.item.argument.placeholder] })) : null, match.item.needsConfirmation ? (_jsxs("small", { className: "jini-composer-slash-confirm-badge", children: [" ", props.t('Confirm')] })) : null] }), _jsx("small", { id: descriptionId, className: "jini-composer-discovery-description", children: description })] }, `${match.groupId}:${match.item.id}`));
36
+ return (_jsxs("button", { id: `jini-composer-slash-option-${index}`, ...agentHandleProps({}, { base: props.base, action: `command-${agentHandleSegment({ value: match.groupId })}-${agentHandleSegment({ value: match.item.id })}`, role: 'button', label: props.t(match.item.label) }), type: "button", role: "option", "aria-selected": index === props.activeIndex, "aria-describedby": descriptionId, className: `jini-composer-discovery-item${index === props.activeIndex ? ' is-active' : ''}`, onMouseDown: (event) => event.preventDefault(), onClick: () => props.onSelect(match.item), children: [_jsxs("span", { children: [props.t(match.item.label), match.item.argument ? (_jsxs("code", { className: "jini-composer-slash-argument", children: [" ", match.item.argument.placeholder] })) : null, match.item.needsConfirmation ? (_jsxs("small", { className: "jini-composer-slash-confirm-badge", children: [" ", props.t('Confirm')] })) : null] }), _jsx("small", { id: descriptionId, className: "jini-composer-discovery-description", children: description })] }, `${match.groupId}:${match.item.id}`));
36
37
  })] }));
37
38
  }
38
39
  //# sourceMappingURL=ComposerDiscovery.js.map
@@ -10,8 +10,10 @@ export interface ConversationListProps {
10
10
  activeConversationId: string | null;
11
11
  onSelect: (id: string) => void;
12
12
  onCreate: () => void | Promise<void>;
13
- onDelete: (id: string) => void | Promise<void>;
14
- onRename: (id: string, title: string) => void | Promise<void>;
13
+ /** Omit to hide deletion controls. */
14
+ onDelete?: (id: string) => void | Promise<void>;
15
+ /** Omit to hide renaming controls and its double-click shortcut. */
16
+ onRename?: (id: string, title: string) => void | Promise<void>;
15
17
  /**
16
18
  * Server-backed search. Omit for the built-in client filter.
17
19
  *
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { formatErrorForLog } from '@jini-ai/core';
3
3
  /**
4
4
  * @module ConversationList
@@ -64,6 +64,13 @@ function relativeTime(updatedAt, now) {
64
64
  return `${hours}h ago`;
65
65
  return `${Math.round(hours / 24)}d ago`;
66
66
  }
67
+ /** Only the host-supported actions are rendered; row selection remains independent. */
68
+ function ConversationActions({ itemId, editing, canRename, canDelete, onRename, onDelete, t }) {
69
+ return _jsxs(_Fragment, { children: [canRename && !editing ? _jsx("button", { type: "button", className: "jini-conv-item-rename", "aria-label": t('Rename chat'), "data-testid": `conversation-rename-button-${itemId}`, onClick: onRename, children: _jsx(Icon, { name: "pencil", size: 12 }) }) : null, canDelete ? _jsx("button", { type: "button", className: "jini-conv-item-delete", "aria-label": t('Delete conversation'), "data-testid": `conversation-delete-${itemId}`, onClick: (event) => {
70
+ event.stopPropagation();
71
+ onDelete();
72
+ }, children: _jsx(Icon, { name: "close", size: 12 }) }) : null] });
73
+ }
67
74
  export function ConversationList({ conversations: savedConversations, activeConversationId, onSelect, onCreate, onDelete, onRename, onSearch, confirmDelete, createDisabled = false, emptyState, triggerLabel, nativeTitle = true, }) {
68
75
  const t = useT();
69
76
  const [open, setOpen] = useState(false);
@@ -170,13 +177,18 @@ export function ConversationList({ conversations: savedConversations, activeConv
170
177
  // No optimistic title update happens here — the row keeps rendering `item.title` from
171
178
  // props until the host's own state updates, so a rejection cannot leave the UI showing a
172
179
  // title the server didn't accept. Reporting the failure is what closes the remaining gap.
173
- runConversationListHostEffect('onRename', () => onRename(id, next));
180
+ if (onRename)
181
+ runConversationListHostEffect('onRename', () => onRename(id, next));
174
182
  }, [onRename]);
175
183
  const startRename = (id) => {
184
+ if (!onRename)
185
+ return;
176
186
  cancelPendingSelect();
177
187
  setEditingId(id);
178
188
  };
179
189
  const requestDelete = useCallback((item) => {
190
+ if (!onDelete)
191
+ return;
180
192
  const confirmer = confirmDelete ??
181
193
  // Only ever called from a click handler, so a browser `window` always exists here.
182
194
  ((c) => window.confirm(t('Delete "{title}"? This cannot be undone.').replace('{title}', c.title ?? t('Untitled'))));
@@ -201,16 +213,13 @@ export function ConversationList({ conversations: savedConversations, activeConv
201
213
  // the remaining gap between "switcher closed" and "the host actually knows".
202
214
  runConversationListHostEffect('onCreate', () => onCreate());
203
215
  setOpen(false);
204
- }, children: [_jsx(Icon, { name: "plus", size: 12 }), _jsx("span", { children: t('New') })] })] }), _jsxs("label", { className: "jini-conv-search", children: [_jsx(Icon, { name: "search", size: 13 }), _jsx("input", { type: "search", value: query, placeholder: t('Search conversations'), "data-testid": "conversation-search", onChange: (event) => setQuery(event.currentTarget.value) })] }), _jsx("div", { className: "jini-conv-list", "data-testid": "conversation-list", children: conversations.length === 0 || visible.length === 0 ? (_jsx("div", { className: "jini-conv-empty", children: emptyLabel() })) : (visible.map((item) => (_jsxs("div", { className: `jini-conv-item${item.id === activeConversationId ? ' jini-conv-item-active' : ''}`, "data-testid": `conversation-item-${item.id}`, children: [editingId === item.id ? (_jsx(ConversationTitleEditor, { title: rawTitles.get(item.id) ?? null, "data-testid": `conversation-rename-${item.id}`, onCommit: (next) => commitRename(item.id, next), onCancel: () => setEditingId(null) })) : (_jsxs("button", { type: "button", className: "jini-conv-item-select", "data-testid": `conversation-select-${item.id}`, title: t('Double-click to rename'), onClick: () => {
216
+ }, children: [_jsx(Icon, { name: "plus", size: 12 }), _jsx("span", { children: t('New') })] })] }), _jsxs("label", { className: "jini-conv-search", children: [_jsx(Icon, { name: "search", size: 13 }), _jsx("input", { type: "search", value: query, placeholder: t('Search conversations'), "data-testid": "conversation-search", onChange: (event) => setQuery(event.currentTarget.value) })] }), _jsx("div", { className: "jini-conv-list", "data-testid": "conversation-list", children: conversations.length === 0 || visible.length === 0 ? (_jsx("div", { className: "jini-conv-empty", children: emptyLabel() })) : (visible.map((item) => (_jsxs("div", { className: `jini-conv-item${item.id === activeConversationId ? ' jini-conv-item-active' : ''}`, "data-testid": `conversation-item-${item.id}`, children: [onRename && editingId === item.id ? (_jsx(ConversationTitleEditor, { title: rawTitles.get(item.id) ?? null, "data-testid": `conversation-rename-${item.id}`, onCommit: (next) => commitRename(item.id, next), onCancel: () => setEditingId(null) })) : (_jsxs("button", { type: "button", className: "jini-conv-item-select", "data-testid": `conversation-select-${item.id}`, title: onRename ? t('Double-click to rename') : undefined, onClick: () => {
205
217
  cancelPendingSelect();
206
218
  pendingSelectRef.current = setTimeout(() => {
207
219
  pendingSelectRef.current = null;
208
220
  onSelect(item.id);
209
221
  setOpen(false);
210
222
  }, DOUBLE_CLICK_GRACE_MS);
211
- }, onDoubleClick: () => startRename(item.id), children: [_jsx("span", { className: "jini-conv-item-title", children: item.title ?? t('Untitled') }), _jsxs("span", { className: "jini-conv-item-meta", children: [item.messageCount === undefined ? '' : `${item.messageCount} msg · `, relativeTime(item.updatedAt, now)] })] })), editingId !== item.id ? _jsx("button", { type: "button", className: "jini-conv-item-rename", "aria-label": t('Rename chat'), "data-testid": `conversation-rename-button-${item.id}`, onClick: () => startRename(item.id), children: _jsx(Icon, { name: "pencil", size: 12 }) }) : null, _jsx("button", { type: "button", className: "jini-conv-item-delete", "aria-label": t('Delete conversation'), "data-testid": `conversation-delete-${item.id}`, onClick: (event) => {
212
- event.stopPropagation();
213
- requestDelete(item);
214
- }, children: _jsx(Icon, { name: "close", size: 12 }) })] }, item.id)))) })] })) : null] }));
223
+ }, onDoubleClick: onRename ? () => startRename(item.id) : undefined, children: [_jsx("span", { className: "jini-conv-item-title", children: item.title ?? t('Untitled') }), _jsxs("span", { className: "jini-conv-item-meta", children: [item.messageCount === undefined ? '' : `${item.messageCount} msg · `, relativeTime(item.updatedAt, now)] })] })), _jsx(ConversationActions, { itemId: item.id, editing: editingId === item.id, canRename: Boolean(onRename), canDelete: Boolean(onDelete), onRename: () => startRename(item.id), onDelete: () => requestDelete(item), t: t })] }, item.id)))) })] })) : null] }));
215
224
  }
216
225
  //# sourceMappingURL=ConversationList.js.map
@@ -1,4 +1,6 @@
1
1
  interface CopyMessageButtonProps {
2
+ /** Inherited control identity; ordinary message-copy buttons remain opt-in. */
3
+ agentHandle?: string | false | undefined;
2
4
  /** The raw markdown source to place on the clipboard — never rendered/flattened text. */
3
5
  text: string;
4
6
  /** Accessible name while idle; swaps to a "Copied" label once the copy lands. */
@@ -16,6 +18,6 @@ interface CopyMessageButtonProps {
16
18
  * @param props.title - Optional hover tooltip (already translated); swaps to "Copied" like the label.
17
19
  * @complexity O(1) — one child hook call, no branching beyond the copied-state read.
18
20
  */
19
- export declare function CopyMessageButton({ text, label, title }: CopyMessageButtonProps): import("react").JSX.Element;
21
+ export declare function CopyMessageButton({ agentHandle, text, label, title }: CopyMessageButtonProps): import("react").JSX.Element;
20
22
  export {};
21
23
  //# sourceMappingURL=CopyMessageButton.d.ts.map
@@ -3,6 +3,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
3
3
  import { useT } from '../hooks/context.js';
4
4
  import { useCopyToClipboard } from '../hooks/useCopyToClipboard.js';
5
5
  import { Icon } from './Icon.js';
6
+ import { agentHandleProps } from '@jini-ai/agentic';
6
7
  /**
7
8
  * Quiet, icon-only copy affordance shared by the user- and assistant-message
8
9
  * action rows. Delegates the actual clipboard write (and its
@@ -13,10 +14,10 @@ import { Icon } from './Icon.js';
13
14
  * @param props.title - Optional hover tooltip (already translated); swaps to "Copied" like the label.
14
15
  * @complexity O(1) — one child hook call, no branching beyond the copied-state read.
15
16
  */
16
- export function CopyMessageButton({ text, label, title }) {
17
+ export function CopyMessageButton({ agentHandle, text, label, title }) {
17
18
  const t = useT();
18
19
  const { copied, copy } = useCopyToClipboard();
19
- return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "jini-message-action-btn", "aria-label": copied ? t('Copied') : label, title: title && (copied ? t('Copied') : title), onClick: () => {
20
+ return (_jsxs(_Fragment, { children: [_jsx("button", { ...agentHandleProps({}, { base: agentHandle || undefined, role: 'button', label }), type: "button", className: "jini-message-action-btn", "aria-label": copied ? t('Copied') : label, title: title && (copied ? t('Copied') : title), onClick: () => {
20
21
  void copy(text);
21
22
  }, children: _jsx(Icon, { name: copied ? 'check' : 'copy' }) }), _jsx("span", { className: "jini-message-copy-status", "aria-live": "polite", children: copied ? t('Copied to clipboard') : '' })] }));
22
23
  }
@@ -5,7 +5,9 @@ type OnRemove = (input: {
5
5
  * Shared composer/sent-message folder indicator; references never participate in uploads.
6
6
  * One folder shows its chip directly; a "Folders (n)" toggle would only repeat its name.
7
7
  */
8
- export declare function FolderChips({ folders, onRemove }: {
8
+ export declare function FolderChips({ agentHandle, folders, onRemove }: {
9
+ /** Inherited Composer base; standalone sent-message folders remain opt-in. */
10
+ agentHandle?: string | false | undefined;
9
11
  folders?: readonly string[] | undefined;
10
12
  onRemove?: OnRemove | undefined;
11
13
  }): import("react").JSX.Element | null;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useId, useState } from 'react';
3
+ import { agentHandleProps, agentHandleSegment } from '@jini-ai/agentic';
3
4
  import { useT } from '../hooks/context.js';
4
5
  import { CopyMessageButton } from './CopyMessageButton.js';
5
6
  import { Icon } from './Icon.js';
@@ -8,25 +9,27 @@ function folderName({ path }, _options = {}) {
8
9
  return path.split(/[\\/]/).filter(Boolean).at(-1) ?? path;
9
10
  }
10
11
  /** One folder: last name (full path on hover), copy, and × when removable. */
11
- function FolderChip({ path, onRemove }) {
12
+ function FolderChip({ base, path, onRemove }) {
12
13
  const t = useT();
14
+ const segment = agentHandleSegment({ value: path });
13
15
  const copyLabel = t('Copy folder path: {path}', { path });
14
16
  const removeLabel = t('Remove folder: {path}', { path });
15
- return _jsxs("li", { className: "jini-folder-chips__item", children: [_jsx(Icon, { name: "folder" }), _jsx("span", { className: "jini-folder-chips__name", title: path, "aria-label": path, children: folderName({ path }) }), _jsx(CopyMessageButton, { text: path, label: copyLabel, title: copyLabel }), onRemove && _jsx("button", { type: "button", className: "jini-folder-chips__remove", title: removeLabel, "aria-label": removeLabel, onClick: () => onRemove({ path }), children: _jsx(Icon, { name: "close" }) })] });
17
+ return _jsxs("li", { className: "jini-folder-chips__item", children: [_jsx(Icon, { name: "folder" }), _jsx("span", { className: "jini-folder-chips__name", title: path, "aria-label": path, children: folderName({ path }) }), _jsx(CopyMessageButton, { agentHandle: base ? `${base}-folder-copy-${segment}` : false, text: path, label: copyLabel, title: copyLabel }), onRemove && _jsx("button", { type: "button", className: "jini-folder-chips__remove", title: removeLabel, ...agentHandleProps({}, { base, action: `folder-remove-${segment}`, role: 'button', label: removeLabel }), "aria-label": removeLabel, onClick: () => onRemove({ path }), children: _jsx(Icon, { name: "close" }) })] });
16
18
  }
17
19
  /**
18
20
  * Shared composer/sent-message folder indicator; references never participate in uploads.
19
21
  * One folder shows its chip directly; a "Folders (n)" toggle would only repeat its name.
20
22
  */
21
- export function FolderChips({ folders = [], onRemove }) {
23
+ export function FolderChips({ agentHandle, folders = [], onRemove }) {
24
+ const base = agentHandle || undefined;
22
25
  const t = useT();
23
26
  const [expanded, setExpanded] = useState(false);
24
27
  const id = useId();
25
28
  if (folders.length === 0)
26
29
  return null;
27
- const list = (listId) => _jsx("ul", { id: listId, className: "jini-folder-chips__list", children: folders.map(path => _jsx(FolderChip, { path: path, onRemove: onRemove }, path)) });
30
+ const list = (listId) => _jsx("ul", { id: listId, className: "jini-folder-chips__list", children: folders.map(path => _jsx(FolderChip, { base: base, path: path, onRemove: onRemove }, path)) });
28
31
  if (folders.length === 1)
29
32
  return _jsx("div", { className: "jini-folder-chips", children: list() });
30
- return _jsxs("div", { className: "jini-folder-chips", children: [_jsxs("button", { type: "button", className: "jini-folder-chips__toggle", "aria-expanded": expanded, "aria-controls": id, onClick: () => setExpanded(value => !value), children: [_jsx(Icon, { name: "folder" }), _jsx("span", { children: t('Folders ({count})', { count: folders.length }) }), _jsx(Icon, { name: expanded ? 'chevron-down' : 'chevron-right' })] }), expanded && list(id)] });
33
+ return _jsxs("div", { className: "jini-folder-chips", children: [_jsxs("button", { type: "button", className: "jini-folder-chips__toggle", "aria-expanded": expanded, "aria-controls": id, ...agentHandleProps({}, { base, action: 'folders-toggle', role: 'button', label: t('Folders ({count})', { count: folders.length }) }), onClick: () => setExpanded(value => !value), children: [_jsx(Icon, { name: "folder" }), _jsx("span", { children: t('Folders ({count})', { count: folders.length }) }), _jsx(Icon, { name: expanded ? 'chevron-down' : 'chevron-right' })] }), expanded && list(id)] });
31
34
  }
32
35
  //# sourceMappingURL=FolderChips.js.map
@@ -61,6 +61,6 @@ function QueuedMessage({ prompt, renderAttachment }) {
61
61
  const t = useT();
62
62
  const attachments = prompt.attachments ?? [];
63
63
  const gallery = useAttachmentGallery({ attachments });
64
- return (_jsxs("div", { className: "jini-chat-pane__queued", role: "status", "aria-label": t('Message queued — not yet sent, will send once the current run finishes'), "data-testid": "chat-pane-queued", "data-agent-element": "chat-message-pending", "data-agent-role": "region", "data-agent-label": "A message queued to send once the current run finishes", children: [_jsx("div", { children: t('Queued — sends when this reply finishes') }), prompt.folders?.length ? _jsx("div", { className: "jini-message-attachments", children: _jsx(FolderChips, { folders: prompt.folders }) }) : null, _jsx("div", { className: "jini-chat-pane__queued-text", children: prompt.text }), attachments.length > 0 && _jsx("div", { className: "jini-message-attachments", children: attachments.map(attachment => _jsx(SentAttachmentButton, { attachment: attachment, onOpen: gallery.open, renderAttachment: renderAttachment }, attachment.path)) }), gallery.opened !== null && _jsx(AttachmentPreviewModal, { attachment: gallery.opened, onClose: gallery.close, navigation: gallery.navigation }), _jsx("div", { className: "jini-chat-pane__queued-actions", children: _jsx("button", { type: "button", className: "jini-chat-pane__queued-cancel", onClick: () => prompt.onCancel(), title: t('Cancel queued message'), children: t('Cancel') }) })] }));
64
+ return (_jsxs("div", { className: "jini-chat-pane__queued", role: "status", "aria-label": t('Message queued — not yet sent, will send once the current run finishes'), "data-testid": "chat-pane-queued", "data-agent-element": "chat-message-pending", "data-agent-role": "region", "data-agent-label": "A message queued to send once the current run finishes", children: [_jsx("div", { className: "jini-chat-pane__status", children: t('Queued — sends when this reply finishes') }), prompt.folders?.length ? _jsx("div", { className: "jini-message-attachments", children: _jsx(FolderChips, { folders: prompt.folders }) }) : null, _jsx("div", { className: "jini-chat-pane__queued-text", children: prompt.text }), attachments.length > 0 && _jsx("div", { className: "jini-message-attachments", children: attachments.map(attachment => _jsx(SentAttachmentButton, { attachment: attachment, onOpen: gallery.open, renderAttachment: renderAttachment }, attachment.path)) }), gallery.opened !== null && _jsx(AttachmentPreviewModal, { attachment: gallery.opened, onClose: gallery.close, navigation: gallery.navigation }), _jsx("div", { className: "jini-chat-pane__queued-actions", children: _jsx("button", { type: "button", className: "jini-chat-pane__queued-cancel", onClick: () => prompt.onCancel(), title: t('Cancel queued message'), children: t('Cancel') }) })] }));
65
65
  }
66
66
  //# sourceMappingURL=MessageList.js.map