@athenaintel/react 0.39.0 → 0.40.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.
- package/README.md +9 -1
- package/dist/agent-runtime/src/errors.cjs +8 -0
- package/dist/agent-runtime/src/errors.cjs.map +1 -1
- package/dist/agent-runtime/src/errors.js +8 -0
- package/dist/agent-runtime/src/errors.js.map +1 -1
- package/dist/agent-runtime/src/messages.cjs +76 -16
- package/dist/agent-runtime/src/messages.cjs.map +1 -1
- package/dist/agent-runtime/src/messages.js +76 -16
- package/dist/agent-runtime/src/messages.js.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.cjs +15 -0
- package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.js +15 -0
- package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
- package/dist/assets/use-asset-content.cjs +127 -0
- package/dist/assets/use-asset-content.cjs.map +1 -0
- package/dist/assets/use-asset-content.d.ts +60 -0
- package/dist/assets/use-asset-content.js +127 -0
- package/dist/assets/use-asset-content.js.map +1 -0
- package/dist/chat/super-grouping/CollapsibleGroup.cjs +16 -8
- package/dist/chat/super-grouping/CollapsibleGroup.cjs.map +1 -1
- package/dist/chat/super-grouping/CollapsibleGroup.d.ts +26 -1
- package/dist/chat/super-grouping/CollapsibleGroup.js +16 -8
- package/dist/chat/super-grouping/CollapsibleGroup.js.map +1 -1
- package/dist/chat/super-grouping/GroupedMessageParts.cjs +59 -0
- package/dist/chat/super-grouping/GroupedMessageParts.cjs.map +1 -0
- package/dist/chat/super-grouping/GroupedMessageParts.d.ts +25 -0
- package/dist/chat/super-grouping/GroupedMessageParts.js +59 -0
- package/dist/chat/super-grouping/GroupedMessageParts.js.map +1 -0
- package/dist/chat/super-grouping/SuperGroupingCard.cjs +9 -5
- package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +2 -1
- package/dist/chat/super-grouping/SuperGroupingCard.js +13 -9
- package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +10 -6
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.js +14 -10
- package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
- package/dist/chat/super-grouping/grouped-part-keys.cjs +104 -0
- package/dist/chat/super-grouping/grouped-part-keys.cjs.map +1 -0
- package/dist/chat/super-grouping/grouped-part-keys.d.ts +37 -0
- package/dist/chat/super-grouping/grouped-part-keys.js +104 -0
- package/dist/chat/super-grouping/grouped-part-keys.js.map +1 -0
- package/dist/chat/super-grouping/index.cjs +2 -0
- package/dist/chat/super-grouping/index.cjs.map +1 -1
- package/dist/chat/super-grouping/index.d.ts +3 -1
- package/dist/chat/super-grouping/index.js +2 -0
- package/dist/chat/super-grouping/index.js.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.cjs +25 -19
- package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.d.ts +5 -0
- package/dist/chat-ui/composer/tiptap-composer.js +26 -20
- package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
- package/dist/composer/clipboard.cjs +16 -0
- package/dist/composer/clipboard.cjs.map +1 -1
- package/dist/composer/clipboard.d.ts +9 -0
- package/dist/composer/clipboard.js +17 -1
- package/dist/composer/clipboard.js.map +1 -1
- package/dist/diagnostics/errors.cjs +6 -0
- package/dist/diagnostics/errors.cjs.map +1 -1
- package/dist/diagnostics/errors.d.ts +6 -0
- package/dist/diagnostics/errors.js +6 -0
- package/dist/diagnostics/errors.js.map +1 -1
- package/dist/index.cjs +23 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/dist/react/package.json.cjs +1 -1
- package/dist/react/package.json.js +1 -1
- package/dist/runtime/statewire-lifecycle.cjs +8 -0
- package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
- package/dist/runtime/statewire-lifecycle.js +9 -1
- package/dist/runtime/statewire-lifecycle.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/tools/index.cjs +7 -0
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +7 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/inline-tools.cjs +10 -0
- package/dist/tools/inline-tools.cjs.map +1 -0
- package/dist/tools/inline-tools.d.ts +2 -0
- package/dist/tools/inline-tools.js +10 -0
- package/dist/tools/inline-tools.js.map +1 -0
- package/dist/tools/test-recording-report.cjs +175 -0
- package/dist/tools/test-recording-report.cjs.map +1 -0
- package/dist/tools/test-recording-report.d.ts +82 -0
- package/dist/tools/test-recording-report.js +175 -0
- package/dist/tools/test-recording-report.js.map +1 -0
- package/dist/tools/test-recording-tool-uis.cjs +498 -0
- package/dist/tools/test-recording-tool-uis.cjs.map +1 -0
- package/dist/tools/test-recording-tool-uis.d.ts +32 -0
- package/dist/tools/test-recording-tool-uis.js +498 -0
- package/dist/tools/test-recording-tool-uis.js.map +1 -0
- package/dist/tools/tool-summary.cjs +49 -1
- package/dist/tools/tool-summary.cjs.map +1 -1
- package/dist/tools/tool-summary.js +49 -1
- package/dist/tools/tool-summary.js.map +1 -1
- package/dist/tools/tool-uis.cjs +6 -1
- package/dist/tools/tool-uis.cjs.map +1 -1
- package/dist/tools/tool-uis.js +6 -1
- package/dist/tools/tool-uis.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export { AthenaAssistantActionBar, AthenaAssistantMessage, AthenaChat, AthenaRea
|
|
|
20
20
|
export type { AthenaAssistantActionBarProps, AthenaAssistantMessageProps, AthenaChatComponents, AthenaChatMessagePartComponents, AthenaChatProps, AthenaReasoningPartProps, AthenaUserMessageProps, } from './chat/AthenaChat';
|
|
21
21
|
export type { WelcomeSuggestion } from './chat/athena-chat-welcome';
|
|
22
22
|
export { AthenaChatErrorBoundary } from './chat/AthenaChatErrorBoundary';
|
|
23
|
-
export { type ActivityItem, type ActivityPhase, type ActivityTimelineOptions, type ActivityToolState, buildActivityTimeline, CollapsibleGroup, type CollapsibleGroupProps, countActivityTools, createToolBasedGroupingFunction, DEFAULT_TOOLKIT_THEME, defaultGetToolGroupKey, excludeFinalTextFromGroups, excludePartsFromGroups, type FinalTextPart, type FinalTextSegment, formatWorkDuration, getActivityItemLabel, getActivitySummary, getActivityToolState, getFinalText, getFinalTextParts, getReasoningLabel, type GetToolGroupKey, type GroupablePart, type GroupingFunction, type MessagePartGroup, readTurnTiming, resetRememberedExpansionsForTests, resolveActivityPhase, splitTurnSegments, SuperGroupingCard, type SuperGroupingCardProps, SuperGroupingFinalText, SuperGroupingProvider, SuperGroupingTranscript, type SuperGroupingTranscriptProps, TOOLKIT_THEMES, type ToolGroupKeyOptions, type ToolkitTheme, type TurnSegment, type TurnTiming, useActivityExpansion, workedDurationMs, } from './chat/super-grouping';
|
|
23
|
+
export { type ActivityItem, type ActivityPhase, type ActivityTimelineOptions, type ActivityToolState, buildActivityTimeline, CollapsibleGroup, type CollapsibleGroupProps, countActivityTools, createToolBasedGroupingFunction, DEFAULT_TOOLKIT_THEME, defaultGetToolGroupKey, excludeFinalTextFromGroups, excludePartsFromGroups, type FinalTextPart, type FinalTextSegment, formatWorkDuration, getActivityItemLabel, getActivitySummary, getActivityToolState, getFinalText, getFinalTextParts, getReasoningLabel, type GetToolGroupKey, type GroupablePart, GroupedMessageParts, type GroupedMessagePartsProps, type GroupingFunction, type MessagePartGroup, readTurnTiming, resetRememberedExpansionsForTests, resolveActivityPhase, splitTurnSegments, SuperGroupingCard, type SuperGroupingCardProps, SuperGroupingFinalText, SuperGroupingProvider, SuperGroupingTranscript, type SuperGroupingTranscriptProps, TOOLKIT_THEMES, type ToolGroupKeyOptions, type ToolkitTheme, type TurnSegment, type TurnTiming, useActivityExpansion, workedDurationMs, } from './chat/super-grouping';
|
|
24
24
|
export { StatewireApprovalCard } from './chat/StatewireApprovalCard';
|
|
25
25
|
export type { StatewireApprovalCardProps, StatewireApprovalEditorContext, StatewireApprovalRequestContext, } from './chat/StatewireApprovalCard';
|
|
26
26
|
export { useStatewireApprovalRequest } from './chat/use-statewire-approval-request';
|
|
@@ -76,6 +76,11 @@ export { ToolFallback, ToolFallbackAppearanceProvider, ToolFallbackRoot, ToolFal
|
|
|
76
76
|
export type { ToolAppearance, ToolFallbackContext, ToolFallbackOptions, ToolFallbackProps, ToolFallbackRootProps, ToolFallbackTriggerProps, } from './tools/tool-fallback';
|
|
77
77
|
export { VoiceUpdateCard, VoiceUpdateToolUI } from './tools/voice-update-tool-ui';
|
|
78
78
|
export type { VoiceUpdateCardProps } from './tools/voice-update-tool-ui';
|
|
79
|
+
export { TestRecordingMarkToolUI, TestRecordingReportCard, TestRecordingStartToolUI, TestRecordingStopToolUI, } from './tools/test-recording-tool-uis';
|
|
80
|
+
export type { TestRecordingReportCardProps } from './tools/test-recording-tool-uis';
|
|
81
|
+
export { describeTestRecordingMark, describeTestRecordingStart, formatRecordingClock, formatTestRecordingCounts, parseTestRecordingStopResult, TEST_RECORDING_MARK_TOOL, TEST_RECORDING_START_TOOL, TEST_RECORDING_STOP_TOOL, } from './tools/test-recording-report';
|
|
82
|
+
export type { TestRecordingAssertion, TestRecordingMark, TestRecordingMarkKind, TestRecordingOutcome, TestRecordingReport, TestRecordingStart, TestRecordingStopResult, TestRecordingTest, } from './tools/test-recording-report';
|
|
83
|
+
export { isSdkInlineTool } from './tools/inline-tools';
|
|
79
84
|
export { VoiceDelegationCard, VoiceDelegationMessage, } from './chat-ui/messages/voice-delegation-card';
|
|
80
85
|
export type { VoiceDelegationCardProps } from './chat-ui/messages/voice-delegation-card';
|
|
81
86
|
export { NestedPtcComponentsProvider, NestedPtcMessages, useNestedPtcComponents, } from './tools/NestedPtcMessages';
|
|
@@ -85,6 +90,8 @@ export { DEFAULT_AUTO_OPEN_TOOLS } from './tools/auto-open-tools';
|
|
|
85
90
|
export { AppendDocumentToolUI } from './tools/append-document-tool-ui';
|
|
86
91
|
export { getAssetInfo, tryParseJson } from './tools/asset-utils';
|
|
87
92
|
export { AthenaAssetEmbed } from './assets/AthenaAssetEmbed';
|
|
93
|
+
export { athenaAssetContentPath, fetchAthenaAssetContent, useAthenaAssetContent, useObjectUrl, } from './assets/use-asset-content';
|
|
94
|
+
export type { UseAthenaAssetContentOptions } from './assets/use-asset-content';
|
|
88
95
|
export type { AthenaAssetEmbedProps } from './assets/AthenaAssetEmbed';
|
|
89
96
|
export type { AthenaAssetCitationAction, AthenaAssetCitationActionEvent, AthenaAssetCitationBehavior, AthenaAssetCitationClickEvent, AthenaAssetCitationReference, } from './assets/asset-embed-messages';
|
|
90
97
|
export { AssetPanel } from './assets/AssetPanel';
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import { AthenaAssistantActionBar, AthenaAssistantMessage, AthenaChat, AthenaRea
|
|
|
12
12
|
import { AthenaChatErrorBoundary } from "./chat/AthenaChatErrorBoundary.js";
|
|
13
13
|
import { buildActivityTimeline, countActivityTools, excludeFinalTextFromGroups, excludePartsFromGroups, getActivityItemLabel, getActivitySummary, getActivityToolState, getFinalText, getFinalTextParts, getReasoningLabel, resolveActivityPhase } from "./chat/super-grouping/activity-timeline.js";
|
|
14
14
|
import { CollapsibleGroup, DEFAULT_TOOLKIT_THEME, SuperGroupingProvider, TOOLKIT_THEMES } from "./chat/super-grouping/CollapsibleGroup.js";
|
|
15
|
+
import { GroupedMessageParts } from "./chat/super-grouping/GroupedMessageParts.js";
|
|
15
16
|
import { createToolBasedGroupingFunction } from "./chat/super-grouping/grouping-function.js";
|
|
16
17
|
import { SuperGroupingCard, SuperGroupingFinalText, resetRememberedExpansionsForTests, useActivityExpansion } from "./chat/super-grouping/SuperGroupingCard.js";
|
|
17
18
|
import { SuperGroupingTranscript } from "./chat/super-grouping/SuperGroupingTranscript.js";
|
|
@@ -48,6 +49,9 @@ import { EditFileToolUI, ListFilesToolUI, ReadFileToolUI, SearchFilesToolUI, Wri
|
|
|
48
49
|
import { collectAssetTitles, friendlyWorkspacePath, humanizeToolName, summarizeToolCall } from "./tools/tool-summary.js";
|
|
49
50
|
import { ToolFallback, ToolFallbackAppearanceProvider, ToolFallbackArgs, ToolFallbackContent, ToolFallbackError, ToolFallbackNotice, ToolFallbackResult, ToolFallbackRoot, ToolFallbackTrigger, clearAutoOpenedAssets } from "./tools/tool-fallback.js";
|
|
50
51
|
import { VoiceUpdateCard, VoiceUpdateToolUI } from "./tools/voice-update-tool-ui.js";
|
|
52
|
+
import { TestRecordingMarkToolUI, TestRecordingReportCard, TestRecordingStartToolUI, TestRecordingStopToolUI } from "./tools/test-recording-tool-uis.js";
|
|
53
|
+
import { TEST_RECORDING_MARK_TOOL, TEST_RECORDING_START_TOOL, TEST_RECORDING_STOP_TOOL, describeTestRecordingMark, describeTestRecordingStart, formatRecordingClock, formatTestRecordingCounts, parseTestRecordingStopResult } from "./tools/test-recording-report.js";
|
|
54
|
+
import { isSdkInlineTool } from "./tools/inline-tools.js";
|
|
51
55
|
import { VoiceDelegationCard, VoiceDelegationMessage } from "./chat-ui/messages/voice-delegation-card.js";
|
|
52
56
|
import { NestedPtcComponentsProvider, NestedPtcMessages, useNestedPtcComponents } from "./tools/NestedPtcMessages.js";
|
|
53
57
|
import { ReadAssetToolUI } from "./tools/read-asset-tool-ui.js";
|
|
@@ -55,6 +59,7 @@ import { DEFAULT_AUTO_OPEN_TOOLS } from "./tools/auto-open-tools.js";
|
|
|
55
59
|
import { AppendDocumentToolUI } from "./tools/append-document-tool-ui.js";
|
|
56
60
|
import { getAssetInfo, tryParseJson } from "./tools/asset-utils.js";
|
|
57
61
|
import { AthenaAssetEmbed } from "./assets/AthenaAssetEmbed.js";
|
|
62
|
+
import { athenaAssetContentPath, fetchAthenaAssetContent, useAthenaAssetContent, useObjectUrl } from "./assets/use-asset-content.js";
|
|
58
63
|
import { AssetPanel } from "./assets/AssetPanel.js";
|
|
59
64
|
import { AthenaLayout } from "./assets/AthenaLayout.js";
|
|
60
65
|
import { useAssetPanelStore } from "./assets/asset-panel-store.js";
|
|
@@ -184,6 +189,7 @@ export {
|
|
|
184
189
|
ExpandableSection,
|
|
185
190
|
FileUploadButton,
|
|
186
191
|
GetDatabaseTableSchemaToolUI,
|
|
192
|
+
GroupedMessageParts,
|
|
187
193
|
HITL_PENDING_RESUME_GRACE_MS,
|
|
188
194
|
HiddenWriteTodosToolUI,
|
|
189
195
|
INBOX_PAGE_SIZE,
|
|
@@ -247,12 +253,19 @@ export {
|
|
|
247
253
|
SuperGroupingFinalText,
|
|
248
254
|
SuperGroupingProvider,
|
|
249
255
|
SuperGroupingTranscript,
|
|
256
|
+
TEST_RECORDING_MARK_TOOL,
|
|
257
|
+
TEST_RECORDING_START_TOOL,
|
|
258
|
+
TEST_RECORDING_STOP_TOOL,
|
|
250
259
|
THREAD_PREFETCH_HOVER_DELAY_MS,
|
|
251
260
|
THREAD_PREFETCH_MAX_CONCURRENT,
|
|
252
261
|
THREAD_TITLE_MAX_LENGTH,
|
|
253
262
|
TOOLKIT_THEMES,
|
|
254
263
|
TOOL_ICONS,
|
|
255
264
|
TOOL_UI_REGISTRY,
|
|
265
|
+
TestRecordingMarkToolUI,
|
|
266
|
+
TestRecordingReportCard,
|
|
267
|
+
TestRecordingStartToolUI,
|
|
268
|
+
TestRecordingStopToolUI,
|
|
256
269
|
ThreadList,
|
|
257
270
|
ThreadLoadingOverlay,
|
|
258
271
|
TiptapText,
|
|
@@ -293,6 +306,7 @@ export {
|
|
|
293
306
|
asHitlApproval,
|
|
294
307
|
assetPanelTypeOf,
|
|
295
308
|
assetTypeLabel,
|
|
309
|
+
athenaAssetContentPath,
|
|
296
310
|
athenaDiagnostics,
|
|
297
311
|
athenaLinkAppUrl,
|
|
298
312
|
athenaStatewireErrorNotice,
|
|
@@ -336,10 +350,13 @@ export {
|
|
|
336
350
|
deriveShellRows,
|
|
337
351
|
deriveStatewireSyncUrl,
|
|
338
352
|
deriveTaskSteps,
|
|
353
|
+
describeTestRecordingMark,
|
|
354
|
+
describeTestRecordingStart,
|
|
339
355
|
describeToolArgs,
|
|
340
356
|
dismissThreadFromInbox,
|
|
341
357
|
excludeFinalTextFromGroups,
|
|
342
358
|
excludePartsFromGroups,
|
|
359
|
+
fetchAthenaAssetContent,
|
|
343
360
|
fetchComputerRuntimeStatus,
|
|
344
361
|
fetchComputerSshAccess,
|
|
345
362
|
fetchRepoSearch,
|
|
@@ -349,6 +366,8 @@ export {
|
|
|
349
366
|
finalLiveDesktopCloseNotice,
|
|
350
367
|
formatA1Cell,
|
|
351
368
|
formatA1Range,
|
|
369
|
+
formatRecordingClock,
|
|
370
|
+
formatTestRecordingCounts,
|
|
352
371
|
formatToolName,
|
|
353
372
|
formatWorkDuration,
|
|
354
373
|
friendlyWorkspacePath,
|
|
@@ -377,6 +396,7 @@ export {
|
|
|
377
396
|
isCriticalPosthogEvent,
|
|
378
397
|
isGithubWakeMessage,
|
|
379
398
|
isPendingInterrupt,
|
|
399
|
+
isSdkInlineTool,
|
|
380
400
|
isThreadArchiveUnavailableError,
|
|
381
401
|
isThreadFavoriteUnavailableError,
|
|
382
402
|
isThreadRenameUnavailableError,
|
|
@@ -393,6 +413,7 @@ export {
|
|
|
393
413
|
parseA1Range,
|
|
394
414
|
parseAthenaCitationLink,
|
|
395
415
|
parseCollabAgentRef,
|
|
416
|
+
parseTestRecordingStopResult,
|
|
396
417
|
parseTodoPlan,
|
|
397
418
|
planSessionsQuery,
|
|
398
419
|
pullRequestChip,
|
|
@@ -456,6 +477,7 @@ export {
|
|
|
456
477
|
useAssetPanelStore,
|
|
457
478
|
useAthenaAgentCatalog,
|
|
458
479
|
useAthenaAgentModelOptions,
|
|
480
|
+
useAthenaAssetContent,
|
|
459
481
|
useAthenaChatMode,
|
|
460
482
|
useAthenaCitationLinkHandler,
|
|
461
483
|
useAthenaComputerSshAccess,
|
|
@@ -487,6 +509,7 @@ export {
|
|
|
487
509
|
useIsInPopoutDocument,
|
|
488
510
|
useLatestTodoPlan,
|
|
489
511
|
useNestedPtcComponents,
|
|
512
|
+
useObjectUrl,
|
|
490
513
|
useOwnerDocument,
|
|
491
514
|
useParentAuth,
|
|
492
515
|
useParentBridge,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -22,6 +22,14 @@ function athenaStatewireErrorNotice(error) {
|
|
|
22
22
|
...withCode
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
+
if (errors.isConversationArchivedRejection(error)) {
|
|
26
|
+
return {
|
|
27
|
+
kind: "read-only",
|
|
28
|
+
title: "Message was not sent",
|
|
29
|
+
message: errors.CONVERSATION_ARCHIVED_MESSAGE,
|
|
30
|
+
...withCode
|
|
31
|
+
};
|
|
32
|
+
}
|
|
25
33
|
if (code === errors.COLLAB_AGENT_CHANNEL_SESSION_MISMATCH) {
|
|
26
34
|
return {
|
|
27
35
|
kind: "read-only",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statewire-lifecycle.cjs","sources":["../../src/runtime/statewire-lifecycle.ts"],"sourcesContent":["import {\n COLLAB_AGENT_CHANNEL_SESSION_MISMATCH,\n isLegacyThreadReadOnlyRejection,\n isStatewireChannelTeardown,\n statewireRejectionCode,\n statewireRejectionDetailMessage,\n statewireRejectionPayload,\n} from '@athenaintel/agent-runtime';\nimport type { DeepAgentConnectionState } from '@athenaintel/agent-runtime';\n\n/** A user-visible notice mapped from a statewire transport error. */\nexport interface AthenaStatewireErrorNotice {\n kind: 'paywall' | 'read-only' | 'command';\n title: string;\n message: string;\n /**\n * The server's structured `detail.code` (`collab_agent_channel_session_mismatch`,\n * `legacy_thread_read_only`, …), when the rejection carried one — what a\n * host matches on to offer the right next step.\n */\n code?: string;\n}\n\n/**\n * Map the statewire failure envelope to a concise, actionable notice.\n * Returns null for expected channel teardowns (thread switch, unmount),\n * which must not surface as errors.\n */\nexport function athenaStatewireErrorNotice(\n error: unknown,\n): AthenaStatewireErrorNotice | null {\n if (isStatewireChannelTeardown(error)) return null;\n const rejection = statewireRejectionPayload(error);\n // The server's own detail names the actionable reason; the Error message is\n // generic client-side text like `command rejected (500)`.\n const detail = statewireRejectionDetailMessage(error);\n\n if (rejection?.status === 402) {\n return {\n kind: 'paywall',\n title: 'Usage limit reached',\n message:\n detail ?? 'Athena could not start this run. Review usage or billing to continue.',\n };\n }\n\n const code = statewireRejectionCode(error);\n const withCode = code === null ? {} : { code };\n\n // Legacy-thread dispatch fence: an out-of-band run is writing this\n // pre-cutover thread (or its adoption failed). A per-send failure, not a\n // standing state — the server's detail names the actionable reason (wait\n // for the run vs. start a new chat).\n if (isLegacyThreadReadOnlyRejection(error)) {\n return {\n kind: 'read-only',\n title: 'Message was not sent',\n message:\n detail ??\n 'This conversation cannot take new messages right now. Try again shortly, or start a new chat.',\n ...withCode,\n };\n }\n\n // A session keeps the collab-agent channel (the app's mode) it started on:\n // the send asked for another one. Nothing about the chat is broken — the\n // way on is a new session — so it reads as the amber \"not sent\", not red.\n if (code === COLLAB_AGENT_CHANNEL_SESSION_MISMATCH) {\n return {\n kind: 'read-only',\n title: 'Message was not sent',\n message: detail ?? 'This session runs in another mode. Start a new session to use this one.',\n code,\n };\n }\n\n return {\n kind: 'command',\n title: 'Message was not sent',\n message:\n detail ??\n (error instanceof Error && error.message.length > 0\n ? error.message\n : 'The chat runtime rejected the command. Please try again.'),\n ...withCode,\n };\n}\n\n/** Shared lifecycle state for the statewire transport, provided by\n * `AthenaProvider` in statewire mode and read by the chat banners. */\nexport interface AthenaStatewireLifecycleState {\n connection: DeepAgentConnectionState | null;\n error: AthenaStatewireErrorNotice | null;\n reconnect: (() => void) | null;\n dismissError: () => void;\n}\n\n/** The provider's reducer state behind {@link AthenaStatewireLifecycleState}. */\nexport interface StatewireLifecycleReducerState {\n connection: DeepAgentConnectionState | null;\n error: AthenaStatewireErrorNotice | null;\n reconnect: (() => void) | null;\n}\n\nexport type StatewireLifecycleAction =\n | { type: 'connection'; connection: DeepAgentConnectionState | null }\n | { type: 'error'; error: AthenaStatewireErrorNotice | null }\n | { type: 'raw-connection'; reconnect: () => void };\n\nexport const initialStatewireLifecycle: StatewireLifecycleReducerState = {\n connection: null,\n error: null,\n reconnect: null,\n};\n\n/**\n * Folds the runtime's lifecycle observations into the banner state. A healthy\n * channel — connected, or disconnected only because the instance is quiet\n * (`idle`) or the chat has not sent yet (`deferred`) — clears a stale\n * send/transport error: leaving it up tells the user the chat is broken after\n * it has come back.\n */\n/**\n * Whether the statewire channel can take a command now: connected, or on\n * standby (attached and idle). `null` (no connection observed yet) is not.\n */\nexport function isStatewireChannelLive(connection: DeepAgentConnectionState | null): boolean {\n return connection?.status === 'connected' || connection?.status === 'standby';\n}\n\nexport function statewireLifecycleReducer(\n state: StatewireLifecycleReducerState,\n action: StatewireLifecycleAction,\n): StatewireLifecycleReducerState {\n switch (action.type) {\n case 'connection': {\n const healthy = isStatewireChannelLive(action.connection);\n return {\n ...state,\n connection: action.connection,\n error: healthy ? null : state.error,\n };\n }\n case 'error':\n return { ...state, error: action.error };\n case 'raw-connection':\n return { ...state, reconnect: action.reconnect };\n }\n}\n"],"names":["isStatewireChannelTeardown","statewireRejectionPayload","statewireRejectionDetailMessage","statewireRejectionCode","isLegacyThreadReadOnlyRejection","COLLAB_AGENT_CHANNEL_SESSION_MISMATCH"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"statewire-lifecycle.cjs","sources":["../../src/runtime/statewire-lifecycle.ts"],"sourcesContent":["import {\n COLLAB_AGENT_CHANNEL_SESSION_MISMATCH,\n CONVERSATION_ARCHIVED_MESSAGE,\n isConversationArchivedRejection,\n isLegacyThreadReadOnlyRejection,\n isStatewireChannelTeardown,\n statewireRejectionCode,\n statewireRejectionDetailMessage,\n statewireRejectionPayload,\n} from '@athenaintel/agent-runtime';\nimport type { DeepAgentConnectionState } from '@athenaintel/agent-runtime';\n\n/** A user-visible notice mapped from a statewire transport error. */\nexport interface AthenaStatewireErrorNotice {\n kind: 'paywall' | 'read-only' | 'command';\n title: string;\n message: string;\n /**\n * The server's structured `detail.code` (`collab_agent_channel_session_mismatch`,\n * `legacy_thread_read_only`, …), when the rejection carried one — what a\n * host matches on to offer the right next step.\n */\n code?: string;\n}\n\n/**\n * Map the statewire failure envelope to a concise, actionable notice.\n * Returns null for expected channel teardowns (thread switch, unmount),\n * which must not surface as errors.\n */\nexport function athenaStatewireErrorNotice(\n error: unknown,\n): AthenaStatewireErrorNotice | null {\n if (isStatewireChannelTeardown(error)) return null;\n const rejection = statewireRejectionPayload(error);\n // The server's own detail names the actionable reason; the Error message is\n // generic client-side text like `command rejected (500)`.\n const detail = statewireRejectionDetailMessage(error);\n\n if (rejection?.status === 402) {\n return {\n kind: 'paywall',\n title: 'Usage limit reached',\n message:\n detail ?? 'Athena could not start this run. Review usage or billing to continue.',\n };\n }\n\n const code = statewireRejectionCode(error);\n const withCode = code === null ? {} : { code };\n\n // Legacy-thread dispatch fence: an out-of-band run is writing this\n // pre-cutover thread (or its adoption failed). A per-send failure, not a\n // standing state — the server's detail names the actionable reason (wait\n // for the run vs. start a new chat).\n if (isLegacyThreadReadOnlyRejection(error)) {\n return {\n kind: 'read-only',\n title: 'Message was not sent',\n message:\n detail ??\n 'This conversation cannot take new messages right now. Try again shortly, or start a new chat.',\n ...withCode,\n };\n }\n\n // The conversation is archived (in the trash): it takes no new turns until\n // it is restored. Not broken and not retriable — the amber \"not sent\".\n if (isConversationArchivedRejection(error)) {\n return {\n kind: 'read-only',\n title: 'Message was not sent',\n message: CONVERSATION_ARCHIVED_MESSAGE,\n ...withCode,\n };\n }\n\n // A session keeps the collab-agent channel (the app's mode) it started on:\n // the send asked for another one. Nothing about the chat is broken — the\n // way on is a new session — so it reads as the amber \"not sent\", not red.\n if (code === COLLAB_AGENT_CHANNEL_SESSION_MISMATCH) {\n return {\n kind: 'read-only',\n title: 'Message was not sent',\n message: detail ?? 'This session runs in another mode. Start a new session to use this one.',\n code,\n };\n }\n\n return {\n kind: 'command',\n title: 'Message was not sent',\n message:\n detail ??\n (error instanceof Error && error.message.length > 0\n ? error.message\n : 'The chat runtime rejected the command. Please try again.'),\n ...withCode,\n };\n}\n\n/** Shared lifecycle state for the statewire transport, provided by\n * `AthenaProvider` in statewire mode and read by the chat banners. */\nexport interface AthenaStatewireLifecycleState {\n connection: DeepAgentConnectionState | null;\n error: AthenaStatewireErrorNotice | null;\n reconnect: (() => void) | null;\n dismissError: () => void;\n}\n\n/** The provider's reducer state behind {@link AthenaStatewireLifecycleState}. */\nexport interface StatewireLifecycleReducerState {\n connection: DeepAgentConnectionState | null;\n error: AthenaStatewireErrorNotice | null;\n reconnect: (() => void) | null;\n}\n\nexport type StatewireLifecycleAction =\n | { type: 'connection'; connection: DeepAgentConnectionState | null }\n | { type: 'error'; error: AthenaStatewireErrorNotice | null }\n | { type: 'raw-connection'; reconnect: () => void };\n\nexport const initialStatewireLifecycle: StatewireLifecycleReducerState = {\n connection: null,\n error: null,\n reconnect: null,\n};\n\n/**\n * Folds the runtime's lifecycle observations into the banner state. A healthy\n * channel — connected, or disconnected only because the instance is quiet\n * (`idle`) or the chat has not sent yet (`deferred`) — clears a stale\n * send/transport error: leaving it up tells the user the chat is broken after\n * it has come back.\n */\n/**\n * Whether the statewire channel can take a command now: connected, or on\n * standby (attached and idle). `null` (no connection observed yet) is not.\n */\nexport function isStatewireChannelLive(connection: DeepAgentConnectionState | null): boolean {\n return connection?.status === 'connected' || connection?.status === 'standby';\n}\n\nexport function statewireLifecycleReducer(\n state: StatewireLifecycleReducerState,\n action: StatewireLifecycleAction,\n): StatewireLifecycleReducerState {\n switch (action.type) {\n case 'connection': {\n const healthy = isStatewireChannelLive(action.connection);\n return {\n ...state,\n connection: action.connection,\n error: healthy ? null : state.error,\n };\n }\n case 'error':\n return { ...state, error: action.error };\n case 'raw-connection':\n return { ...state, reconnect: action.reconnect };\n }\n}\n"],"names":["isStatewireChannelTeardown","statewireRejectionPayload","statewireRejectionDetailMessage","statewireRejectionCode","isLegacyThreadReadOnlyRejection","isConversationArchivedRejection","CONVERSATION_ARCHIVED_MESSAGE","COLLAB_AGENT_CHANNEL_SESSION_MISMATCH"],"mappings":";;;AA8BO,SAAS,2BACd,OACmC;AACnC,MAAIA,OAAAA,2BAA2B,KAAK,EAAG,QAAO;AAC9C,QAAM,YAAYC,OAAAA,0BAA0B,KAAK;AAGjD,QAAM,SAASC,OAAAA,gCAAgC,KAAK;AAEpD,OAAI,uCAAW,YAAW,KAAK;AAC7B,WAAO;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,MACP,SACE,UAAU;AAAA,IAAA;AAAA,EAEhB;AAEA,QAAM,OAAOC,OAAAA,uBAAuB,KAAK;AACzC,QAAM,WAAW,SAAS,OAAO,CAAA,IAAK,EAAE,KAAA;AAMxC,MAAIC,OAAAA,gCAAgC,KAAK,GAAG;AAC1C,WAAO;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,MACP,SACE,UACA;AAAA,MACF,GAAG;AAAA,IAAA;AAAA,EAEP;AAIA,MAAIC,OAAAA,gCAAgC,KAAK,GAAG;AAC1C,WAAO;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,MACP,SAASC,OAAAA;AAAAA,MACT,GAAG;AAAA,IAAA;AAAA,EAEP;AAKA,MAAI,SAASC,OAAAA,uCAAuC;AAClD,WAAO;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,MACP,SAAS,UAAU;AAAA,MACnB;AAAA,IAAA;AAAA,EAEJ;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SACE,WACC,iBAAiB,SAAS,MAAM,QAAQ,SAAS,IAC9C,MAAM,UACN;AAAA,IACN,GAAG;AAAA,EAAA;AAEP;AAuBO,MAAM,4BAA4D;AAAA,EACvE,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,WAAW;AACb;AAaO,SAAS,uBAAuB,YAAsD;AAC3F,UAAO,yCAAY,YAAW,gBAAe,yCAAY,YAAW;AACtE;AAEO,SAAS,0BACd,OACA,QACgC;AAChC,UAAQ,OAAO,MAAA;AAAA,IACb,KAAK,cAAc;AACjB,YAAM,UAAU,uBAAuB,OAAO,UAAU;AACxD,aAAO;AAAA,QACL,GAAG;AAAA,QACH,YAAY,OAAO;AAAA,QACnB,OAAO,UAAU,OAAO,MAAM;AAAA,MAAA;AAAA,IAElC;AAAA,IACA,KAAK;AACH,aAAO,EAAE,GAAG,OAAO,OAAO,OAAO,MAAA;AAAA,IACnC,KAAK;AACH,aAAO,EAAE,GAAG,OAAO,WAAW,OAAO,UAAA;AAAA,EAAU;AAErD;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isStatewireChannelTeardown, statewireRejectionPayload, statewireRejectionDetailMessage, statewireRejectionCode, isLegacyThreadReadOnlyRejection, COLLAB_AGENT_CHANNEL_SESSION_MISMATCH } from "../agent-runtime/src/errors.js";
|
|
1
|
+
import { isStatewireChannelTeardown, statewireRejectionPayload, statewireRejectionDetailMessage, statewireRejectionCode, isLegacyThreadReadOnlyRejection, isConversationArchivedRejection, CONVERSATION_ARCHIVED_MESSAGE, COLLAB_AGENT_CHANNEL_SESSION_MISMATCH } from "../agent-runtime/src/errors.js";
|
|
2
2
|
function athenaStatewireErrorNotice(error) {
|
|
3
3
|
if (isStatewireChannelTeardown(error)) return null;
|
|
4
4
|
const rejection = statewireRejectionPayload(error);
|
|
@@ -20,6 +20,14 @@ function athenaStatewireErrorNotice(error) {
|
|
|
20
20
|
...withCode
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
+
if (isConversationArchivedRejection(error)) {
|
|
24
|
+
return {
|
|
25
|
+
kind: "read-only",
|
|
26
|
+
title: "Message was not sent",
|
|
27
|
+
message: CONVERSATION_ARCHIVED_MESSAGE,
|
|
28
|
+
...withCode
|
|
29
|
+
};
|
|
30
|
+
}
|
|
23
31
|
if (code === COLLAB_AGENT_CHANNEL_SESSION_MISMATCH) {
|
|
24
32
|
return {
|
|
25
33
|
kind: "read-only",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statewire-lifecycle.js","sources":["../../src/runtime/statewire-lifecycle.ts"],"sourcesContent":["import {\n COLLAB_AGENT_CHANNEL_SESSION_MISMATCH,\n isLegacyThreadReadOnlyRejection,\n isStatewireChannelTeardown,\n statewireRejectionCode,\n statewireRejectionDetailMessage,\n statewireRejectionPayload,\n} from '@athenaintel/agent-runtime';\nimport type { DeepAgentConnectionState } from '@athenaintel/agent-runtime';\n\n/** A user-visible notice mapped from a statewire transport error. */\nexport interface AthenaStatewireErrorNotice {\n kind: 'paywall' | 'read-only' | 'command';\n title: string;\n message: string;\n /**\n * The server's structured `detail.code` (`collab_agent_channel_session_mismatch`,\n * `legacy_thread_read_only`, …), when the rejection carried one — what a\n * host matches on to offer the right next step.\n */\n code?: string;\n}\n\n/**\n * Map the statewire failure envelope to a concise, actionable notice.\n * Returns null for expected channel teardowns (thread switch, unmount),\n * which must not surface as errors.\n */\nexport function athenaStatewireErrorNotice(\n error: unknown,\n): AthenaStatewireErrorNotice | null {\n if (isStatewireChannelTeardown(error)) return null;\n const rejection = statewireRejectionPayload(error);\n // The server's own detail names the actionable reason; the Error message is\n // generic client-side text like `command rejected (500)`.\n const detail = statewireRejectionDetailMessage(error);\n\n if (rejection?.status === 402) {\n return {\n kind: 'paywall',\n title: 'Usage limit reached',\n message:\n detail ?? 'Athena could not start this run. Review usage or billing to continue.',\n };\n }\n\n const code = statewireRejectionCode(error);\n const withCode = code === null ? {} : { code };\n\n // Legacy-thread dispatch fence: an out-of-band run is writing this\n // pre-cutover thread (or its adoption failed). A per-send failure, not a\n // standing state — the server's detail names the actionable reason (wait\n // for the run vs. start a new chat).\n if (isLegacyThreadReadOnlyRejection(error)) {\n return {\n kind: 'read-only',\n title: 'Message was not sent',\n message:\n detail ??\n 'This conversation cannot take new messages right now. Try again shortly, or start a new chat.',\n ...withCode,\n };\n }\n\n // A session keeps the collab-agent channel (the app's mode) it started on:\n // the send asked for another one. Nothing about the chat is broken — the\n // way on is a new session — so it reads as the amber \"not sent\", not red.\n if (code === COLLAB_AGENT_CHANNEL_SESSION_MISMATCH) {\n return {\n kind: 'read-only',\n title: 'Message was not sent',\n message: detail ?? 'This session runs in another mode. Start a new session to use this one.',\n code,\n };\n }\n\n return {\n kind: 'command',\n title: 'Message was not sent',\n message:\n detail ??\n (error instanceof Error && error.message.length > 0\n ? error.message\n : 'The chat runtime rejected the command. Please try again.'),\n ...withCode,\n };\n}\n\n/** Shared lifecycle state for the statewire transport, provided by\n * `AthenaProvider` in statewire mode and read by the chat banners. */\nexport interface AthenaStatewireLifecycleState {\n connection: DeepAgentConnectionState | null;\n error: AthenaStatewireErrorNotice | null;\n reconnect: (() => void) | null;\n dismissError: () => void;\n}\n\n/** The provider's reducer state behind {@link AthenaStatewireLifecycleState}. */\nexport interface StatewireLifecycleReducerState {\n connection: DeepAgentConnectionState | null;\n error: AthenaStatewireErrorNotice | null;\n reconnect: (() => void) | null;\n}\n\nexport type StatewireLifecycleAction =\n | { type: 'connection'; connection: DeepAgentConnectionState | null }\n | { type: 'error'; error: AthenaStatewireErrorNotice | null }\n | { type: 'raw-connection'; reconnect: () => void };\n\nexport const initialStatewireLifecycle: StatewireLifecycleReducerState = {\n connection: null,\n error: null,\n reconnect: null,\n};\n\n/**\n * Folds the runtime's lifecycle observations into the banner state. A healthy\n * channel — connected, or disconnected only because the instance is quiet\n * (`idle`) or the chat has not sent yet (`deferred`) — clears a stale\n * send/transport error: leaving it up tells the user the chat is broken after\n * it has come back.\n */\n/**\n * Whether the statewire channel can take a command now: connected, or on\n * standby (attached and idle). `null` (no connection observed yet) is not.\n */\nexport function isStatewireChannelLive(connection: DeepAgentConnectionState | null): boolean {\n return connection?.status === 'connected' || connection?.status === 'standby';\n}\n\nexport function statewireLifecycleReducer(\n state: StatewireLifecycleReducerState,\n action: StatewireLifecycleAction,\n): StatewireLifecycleReducerState {\n switch (action.type) {\n case 'connection': {\n const healthy = isStatewireChannelLive(action.connection);\n return {\n ...state,\n connection: action.connection,\n error: healthy ? null : state.error,\n };\n }\n case 'error':\n return { ...state, error: action.error };\n case 'raw-connection':\n return { ...state, reconnect: action.reconnect };\n }\n}\n"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"statewire-lifecycle.js","sources":["../../src/runtime/statewire-lifecycle.ts"],"sourcesContent":["import {\n COLLAB_AGENT_CHANNEL_SESSION_MISMATCH,\n CONVERSATION_ARCHIVED_MESSAGE,\n isConversationArchivedRejection,\n isLegacyThreadReadOnlyRejection,\n isStatewireChannelTeardown,\n statewireRejectionCode,\n statewireRejectionDetailMessage,\n statewireRejectionPayload,\n} from '@athenaintel/agent-runtime';\nimport type { DeepAgentConnectionState } from '@athenaintel/agent-runtime';\n\n/** A user-visible notice mapped from a statewire transport error. */\nexport interface AthenaStatewireErrorNotice {\n kind: 'paywall' | 'read-only' | 'command';\n title: string;\n message: string;\n /**\n * The server's structured `detail.code` (`collab_agent_channel_session_mismatch`,\n * `legacy_thread_read_only`, …), when the rejection carried one — what a\n * host matches on to offer the right next step.\n */\n code?: string;\n}\n\n/**\n * Map the statewire failure envelope to a concise, actionable notice.\n * Returns null for expected channel teardowns (thread switch, unmount),\n * which must not surface as errors.\n */\nexport function athenaStatewireErrorNotice(\n error: unknown,\n): AthenaStatewireErrorNotice | null {\n if (isStatewireChannelTeardown(error)) return null;\n const rejection = statewireRejectionPayload(error);\n // The server's own detail names the actionable reason; the Error message is\n // generic client-side text like `command rejected (500)`.\n const detail = statewireRejectionDetailMessage(error);\n\n if (rejection?.status === 402) {\n return {\n kind: 'paywall',\n title: 'Usage limit reached',\n message:\n detail ?? 'Athena could not start this run. Review usage or billing to continue.',\n };\n }\n\n const code = statewireRejectionCode(error);\n const withCode = code === null ? {} : { code };\n\n // Legacy-thread dispatch fence: an out-of-band run is writing this\n // pre-cutover thread (or its adoption failed). A per-send failure, not a\n // standing state — the server's detail names the actionable reason (wait\n // for the run vs. start a new chat).\n if (isLegacyThreadReadOnlyRejection(error)) {\n return {\n kind: 'read-only',\n title: 'Message was not sent',\n message:\n detail ??\n 'This conversation cannot take new messages right now. Try again shortly, or start a new chat.',\n ...withCode,\n };\n }\n\n // The conversation is archived (in the trash): it takes no new turns until\n // it is restored. Not broken and not retriable — the amber \"not sent\".\n if (isConversationArchivedRejection(error)) {\n return {\n kind: 'read-only',\n title: 'Message was not sent',\n message: CONVERSATION_ARCHIVED_MESSAGE,\n ...withCode,\n };\n }\n\n // A session keeps the collab-agent channel (the app's mode) it started on:\n // the send asked for another one. Nothing about the chat is broken — the\n // way on is a new session — so it reads as the amber \"not sent\", not red.\n if (code === COLLAB_AGENT_CHANNEL_SESSION_MISMATCH) {\n return {\n kind: 'read-only',\n title: 'Message was not sent',\n message: detail ?? 'This session runs in another mode. Start a new session to use this one.',\n code,\n };\n }\n\n return {\n kind: 'command',\n title: 'Message was not sent',\n message:\n detail ??\n (error instanceof Error && error.message.length > 0\n ? error.message\n : 'The chat runtime rejected the command. Please try again.'),\n ...withCode,\n };\n}\n\n/** Shared lifecycle state for the statewire transport, provided by\n * `AthenaProvider` in statewire mode and read by the chat banners. */\nexport interface AthenaStatewireLifecycleState {\n connection: DeepAgentConnectionState | null;\n error: AthenaStatewireErrorNotice | null;\n reconnect: (() => void) | null;\n dismissError: () => void;\n}\n\n/** The provider's reducer state behind {@link AthenaStatewireLifecycleState}. */\nexport interface StatewireLifecycleReducerState {\n connection: DeepAgentConnectionState | null;\n error: AthenaStatewireErrorNotice | null;\n reconnect: (() => void) | null;\n}\n\nexport type StatewireLifecycleAction =\n | { type: 'connection'; connection: DeepAgentConnectionState | null }\n | { type: 'error'; error: AthenaStatewireErrorNotice | null }\n | { type: 'raw-connection'; reconnect: () => void };\n\nexport const initialStatewireLifecycle: StatewireLifecycleReducerState = {\n connection: null,\n error: null,\n reconnect: null,\n};\n\n/**\n * Folds the runtime's lifecycle observations into the banner state. A healthy\n * channel — connected, or disconnected only because the instance is quiet\n * (`idle`) or the chat has not sent yet (`deferred`) — clears a stale\n * send/transport error: leaving it up tells the user the chat is broken after\n * it has come back.\n */\n/**\n * Whether the statewire channel can take a command now: connected, or on\n * standby (attached and idle). `null` (no connection observed yet) is not.\n */\nexport function isStatewireChannelLive(connection: DeepAgentConnectionState | null): boolean {\n return connection?.status === 'connected' || connection?.status === 'standby';\n}\n\nexport function statewireLifecycleReducer(\n state: StatewireLifecycleReducerState,\n action: StatewireLifecycleAction,\n): StatewireLifecycleReducerState {\n switch (action.type) {\n case 'connection': {\n const healthy = isStatewireChannelLive(action.connection);\n return {\n ...state,\n connection: action.connection,\n error: healthy ? null : state.error,\n };\n }\n case 'error':\n return { ...state, error: action.error };\n case 'raw-connection':\n return { ...state, reconnect: action.reconnect };\n }\n}\n"],"names":[],"mappings":";AA8BO,SAAS,2BACd,OACmC;AACnC,MAAI,2BAA2B,KAAK,EAAG,QAAO;AAC9C,QAAM,YAAY,0BAA0B,KAAK;AAGjD,QAAM,SAAS,gCAAgC,KAAK;AAEpD,OAAI,uCAAW,YAAW,KAAK;AAC7B,WAAO;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,MACP,SACE,UAAU;AAAA,IAAA;AAAA,EAEhB;AAEA,QAAM,OAAO,uBAAuB,KAAK;AACzC,QAAM,WAAW,SAAS,OAAO,CAAA,IAAK,EAAE,KAAA;AAMxC,MAAI,gCAAgC,KAAK,GAAG;AAC1C,WAAO;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,MACP,SACE,UACA;AAAA,MACF,GAAG;AAAA,IAAA;AAAA,EAEP;AAIA,MAAI,gCAAgC,KAAK,GAAG;AAC1C,WAAO;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,MACP,SAAS;AAAA,MACT,GAAG;AAAA,IAAA;AAAA,EAEP;AAKA,MAAI,SAAS,uCAAuC;AAClD,WAAO;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,MACP,SAAS,UAAU;AAAA,MACnB;AAAA,IAAA;AAAA,EAEJ;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SACE,WACC,iBAAiB,SAAS,MAAM,QAAQ,SAAS,IAC9C,MAAM,UACN;AAAA,IACN,GAAG;AAAA,EAAA;AAEP;AAuBO,MAAM,4BAA4D;AAAA,EACvE,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,WAAW;AACb;AAaO,SAAS,uBAAuB,YAAsD;AAC3F,UAAO,yCAAY,YAAW,gBAAe,yCAAY,YAAW;AACtE;AAEO,SAAS,0BACd,OACA,QACgC;AAChC,UAAQ,OAAO,MAAA;AAAA,IACb,KAAK,cAAc;AACjB,YAAM,UAAU,uBAAuB,OAAO,UAAU;AACxD,aAAO;AAAA,QACL,GAAG;AAAA,QACH,YAAY,OAAO;AAAA,QACnB,OAAO,UAAU,OAAO,MAAM;AAAA,MAAA;AAAA,IAElC;AAAA,IACA,KAAK;AACH,aAAO,EAAE,GAAG,OAAO,OAAO,OAAO,MAAA;AAAA,IACnC,KAAK;AACH,aAAO,EAAE,GAAG,OAAO,WAAW,OAAO,UAAA;AAAA,EAAU;AAErD;"}
|