@gemies/sdk 10.0.0 → 10.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gemies/sdk",
3
- "version": "10.0.0",
3
+ "version": "10.0.2",
4
4
  "description": "The Gemies SDK: the conversation runtime, chat UI, voice calls and dictation for Oxy apps that talk to a gemie",
5
5
  "main": "src/index.ts",
6
6
  "react-native": "src/index.ts",
@@ -20,6 +20,7 @@ import { useReadAloud } from '../../hooks/useReadAloud';
20
20
  import { useThoughtScope } from '../../hooks/useThoughtScope';
21
21
  import { useThreadRows } from '../../hooks/useThreadRows';
22
22
  import { useTimelineWindow } from '../../hooks/useTimelineWindow';
23
+ import { useAgentRunFailureToast } from '../../hooks/useAgentRunFailureToast';
23
24
  import { useFailedTurnToast } from '../../hooks/useFailedTurnToast';
24
25
  import { copyText } from '../../lib/clipboard';
25
26
  import { messageText } from '../../lib/content-utils';
@@ -159,6 +160,7 @@ export const GemieThread = memo(function GemieThread({
159
160
  const { messages: pastMessages, loading: loadingHistory = false, loadMore } = historyProps ?? {};
160
161
 
161
162
  useFailedTurnToast(failedTurn, onRetryTurn);
163
+ useAgentRunFailureToast(agentActivity, failedTurn);
162
164
 
163
165
  const { rows, live, history, ids, arrived, dayLabels, seamIds, lastReplyIndex, timingOf } =
164
166
  useThreadRows({
@@ -374,8 +376,9 @@ export const GemieThread = memo(function GemieThread({
374
376
  .map((message, offset) => renderRow(message, timeline.start + offset))}
375
377
  </View>
376
378
 
377
- {/* Agent execution — in-progress card or completed result card */}
378
- {agentActivity && agentActivity.eventCount > 0 ? (
379
+ {/* Agent execution — in-progress card or completed result card. A run that failed has no
380
+ card, finished or still open: it is told with a toast (`useAgentRunFailureToast`). */}
381
+ {agentActivity && agentActivity.eventCount > 0 && !agentActivity.hasError ? (
379
382
  agentActivity.isComplete ? (
380
383
  <AgentResultCard activity={agentActivity} />
381
384
  ) : (
@@ -0,0 +1,34 @@
1
+ import { useLabels } from '../lib/labels';
2
+ import type { AgentActivityState } from '../runtime/thread/agent-activity';
3
+ import { toast } from '@oxy.so/bloom/toast';
4
+ import { useEffect } from 'react';
5
+
6
+ /** One toast for the run that failed, replaced by the next failure. */
7
+ export const AGENT_RUN_FAILURE_TOAST_ID = 'agent-run-failure';
8
+ const AGENT_RUN_FAILURE_TOAST_MS = 10_000;
9
+
10
+ /**
11
+ * A run that ended in error is told with a toast, never with a panel in the conversation: the
12
+ * thread keeps the person's words and the agent's, and a failure is not part of either. The words
13
+ * are the server's (why it failed), under the app's own line. A run that ended well still leaves its
14
+ * summary card (`AgentResultCard`); this is for the one that did not, unless the turn's own failure
15
+ * toast already told it.
16
+ */
17
+ export function useAgentRunFailureToast(
18
+ activity: AgentActivityState | null | undefined,
19
+ failedTurn?: unknown,
20
+ ) {
21
+ const { t } = useLabels();
22
+ // When the turn itself failed, its own toast already says so (`useFailedTurnToast`).
23
+ const failed = activity?.hasError === true && !failedTurn;
24
+ const detail = activity?.lastError ?? undefined;
25
+
26
+ useEffect(() => {
27
+ if (!failed) return;
28
+ toast.error(t('chat.agentRun.taskFailed'), {
29
+ id: AGENT_RUN_FAILURE_TOAST_ID,
30
+ description: detail,
31
+ duration: AGENT_RUN_FAILURE_TOAST_MS,
32
+ });
33
+ }, [failed, detail, t]);
34
+ }