@gemies/sdk 10.9.0 → 10.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,7 @@ import { useDocumentUpload } from './oxy-files';
13
13
  import { useGemieRuntime } from './config';
14
14
  import { releaseAttachments, useComposerDraftStore } from './composer-draft-store';
15
15
  import { useConversationStore } from './conversation-store';
16
+ import { splitTurnText } from './thread/diff-comments';
16
17
  import {
17
18
  useClearConversation,
18
19
  useConversation,
@@ -219,7 +220,10 @@ export function useConversationThread({
219
220
  const lastUserText = useMemo(() => {
220
221
  for (let i = messages.length - 1; i >= 0; i--) {
221
222
  const message = messages[i];
222
- if (message?.role === 'user') return getTextFromContent(message.content);
223
+ // The sidebar row reads the person's words, not the blocks of their diff comments.
224
+ if (message?.role === 'user') {
225
+ return splitTurnText(getTextFromContent(message.content)).text;
226
+ }
223
227
  }
224
228
  return '';
225
229
  }, [messages]);
@@ -315,7 +319,7 @@ export function useConversationThread({
315
319
  // A failed delete still leaves the user whole — it only leaves the row.
316
320
  await deleteConversation(conversationId).catch(() => {});
317
321
  useComposerDraftStore.getState().restore(newChatDraft, {
318
- text: pending.text,
322
+ ...splitTurnText(pending.text),
319
323
  attachments: pending.attachments,
320
324
  mcpServerId: pending.mcpServerId,
321
325
  skillNames: pending.skillNames,
@@ -361,7 +365,7 @@ export function useConversationThread({
361
365
  // and the composer stays clear because the text is already on screen.
362
366
  if (outcome === 'failed') {
363
367
  useComposerDraftStore.getState().restore(draft, {
364
- text: content,
368
+ ...splitTurnText(content),
365
369
  attachments: attachments ?? [],
366
370
  mcpServerId: options?.mcpServerId ?? null,
367
371
  skillNames: options?.skillNames ?? [],
@@ -465,7 +469,9 @@ export function useConversationThread({
465
469
  if (outcome === 'failed') {
466
470
  setMessages(beforeEdit);
467
471
  useComposerDraftStore.getState().restore(draft, {
468
- text: typeof newContent === 'string' ? newContent : getTextFromContent(content),
472
+ ...splitTurnText(
473
+ typeof newContent === 'string' ? newContent : getTextFromContent(content),
474
+ ),
469
475
  attachments: attachments ?? [],
470
476
  mcpServerId: options?.mcpServerId ?? null,
471
477
  skillNames: options?.skillNames ?? [],
@@ -8,6 +8,7 @@ import { useComposerDraftStore, type DraftTarget } from './composer-draft-store'
8
8
  import { useGemieRuntime } from './config';
9
9
  import { useConversationStore } from './conversation-store';
10
10
  import { useCreateConversation } from './conversations';
11
+ import { splitTurnText } from './thread/diff-comments';
11
12
  import type { SendOptions } from './types';
12
13
 
13
14
  /**
@@ -83,7 +84,7 @@ export function useStartConversation({ agentId }: { agentId?: string } = {}) {
83
84
  const conversation = await createConversation({ agentId }).catch(() => undefined);
84
85
  if (conversation === undefined) {
85
86
  useComposerDraftStore.getState().restore(draft, {
86
- text,
87
+ ...splitTurnText(text),
87
88
  attachments,
88
89
  mcpServerId: options?.mcpServerId ?? null,
89
90
  skillNames: options?.skillNames ?? [],
@@ -1,5 +1,6 @@
1
1
  import { useCallback, useRef } from 'react';
2
2
  import { getTextFromContent } from '../lib/content-utils';
3
+ import { splitTurnText } from './thread/diff-comments';
3
4
  import type { Message, SendOptions } from './types';
4
5
  import type { GemieAttachment } from '../types';
5
6
  import { useComposerDraft, useComposerDraftStore, type DraftTarget } from './composer-draft-store';
@@ -28,8 +29,9 @@ export interface TurnEditOptions {
28
29
  * chat's draft now (`composer-draft-store.ts`), like the text it is made of:
29
30
  * per account and per conversation, and gone when the draft is.
30
31
  *
31
- * - `start` loads the question's words and the connector and skills it was sent
32
- * with into the composer, keeping aside what the composer held. A question
32
+ * - `start` loads the question's words, the diff comments it carried and the
33
+ * connector and skills it was sent with into the composer, keeping aside what
34
+ * the composer held. A question
33
35
  * this screen did not send has no record of its options, so the composer's
34
36
  * own choice stays.
35
37
  * - `cancel` gives the composer back what it held.
@@ -61,7 +63,7 @@ export function useTurnEdit({ target, messages, turnOptionsOf, onEditMessage }:
61
63
  const sentWith = turnOptionsOf?.(messageId);
62
64
  store.startEdit(store.address(target), {
63
65
  messageId,
64
- text: getTextFromContent(message.content),
66
+ ...splitTurnText(getTextFromContent(message.content)),
65
67
  mcpServerId: sentWith?.mcpServerId ?? current?.mcpServerId ?? null,
66
68
  skillNames: sentWith?.skillNames ?? current?.skillNames ?? [],
67
69
  });