@athenaintel/react 0.39.0 → 0.40.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 (126) hide show
  1. package/README.md +39 -3
  2. package/dist/agent-runtime/src/errors.cjs +8 -0
  3. package/dist/agent-runtime/src/errors.cjs.map +1 -1
  4. package/dist/agent-runtime/src/errors.js +8 -0
  5. package/dist/agent-runtime/src/errors.js.map +1 -1
  6. package/dist/agent-runtime/src/messages.cjs +76 -16
  7. package/dist/agent-runtime/src/messages.cjs.map +1 -1
  8. package/dist/agent-runtime/src/messages.js +76 -16
  9. package/dist/agent-runtime/src/messages.js.map +1 -1
  10. package/dist/agent-runtime/src/tool-metadata.cjs +15 -0
  11. package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
  12. package/dist/agent-runtime/src/tool-metadata.js +15 -0
  13. package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
  14. package/dist/assets/use-asset-content.cjs +127 -0
  15. package/dist/assets/use-asset-content.cjs.map +1 -0
  16. package/dist/assets/use-asset-content.d.ts +60 -0
  17. package/dist/assets/use-asset-content.js +127 -0
  18. package/dist/assets/use-asset-content.js.map +1 -0
  19. package/dist/chat/AthenaChat.cjs +24 -10
  20. package/dist/chat/AthenaChat.cjs.map +1 -1
  21. package/dist/chat/AthenaChat.js +25 -11
  22. package/dist/chat/AthenaChat.js.map +1 -1
  23. package/dist/chat/run-activity.cjs +29 -10
  24. package/dist/chat/run-activity.cjs.map +1 -1
  25. package/dist/chat/run-activity.d.ts +30 -4
  26. package/dist/chat/run-activity.js +29 -10
  27. package/dist/chat/run-activity.js.map +1 -1
  28. package/dist/chat/super-grouping/CollapsibleGroup.cjs +16 -8
  29. package/dist/chat/super-grouping/CollapsibleGroup.cjs.map +1 -1
  30. package/dist/chat/super-grouping/CollapsibleGroup.d.ts +26 -1
  31. package/dist/chat/super-grouping/CollapsibleGroup.js +16 -8
  32. package/dist/chat/super-grouping/CollapsibleGroup.js.map +1 -1
  33. package/dist/chat/super-grouping/GroupedMessageParts.cjs +59 -0
  34. package/dist/chat/super-grouping/GroupedMessageParts.cjs.map +1 -0
  35. package/dist/chat/super-grouping/GroupedMessageParts.d.ts +25 -0
  36. package/dist/chat/super-grouping/GroupedMessageParts.js +59 -0
  37. package/dist/chat/super-grouping/GroupedMessageParts.js.map +1 -0
  38. package/dist/chat/super-grouping/SuperGroupingCard.cjs +9 -5
  39. package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
  40. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +2 -1
  41. package/dist/chat/super-grouping/SuperGroupingCard.js +13 -9
  42. package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
  43. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +10 -6
  44. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
  45. package/dist/chat/super-grouping/SuperGroupingTranscript.js +14 -10
  46. package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
  47. package/dist/chat/super-grouping/grouped-part-keys.cjs +104 -0
  48. package/dist/chat/super-grouping/grouped-part-keys.cjs.map +1 -0
  49. package/dist/chat/super-grouping/grouped-part-keys.d.ts +37 -0
  50. package/dist/chat/super-grouping/grouped-part-keys.js +104 -0
  51. package/dist/chat/super-grouping/grouped-part-keys.js.map +1 -0
  52. package/dist/chat/super-grouping/index.cjs +2 -0
  53. package/dist/chat/super-grouping/index.cjs.map +1 -1
  54. package/dist/chat/super-grouping/index.d.ts +3 -1
  55. package/dist/chat/super-grouping/index.js +2 -0
  56. package/dist/chat/super-grouping/index.js.map +1 -1
  57. package/dist/chat-ui/composer/tiptap-composer.cjs +25 -19
  58. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  59. package/dist/chat-ui/composer/tiptap-composer.d.ts +5 -0
  60. package/dist/chat-ui/composer/tiptap-composer.js +26 -20
  61. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  62. package/dist/composer/clipboard.cjs +16 -0
  63. package/dist/composer/clipboard.cjs.map +1 -1
  64. package/dist/composer/clipboard.d.ts +9 -0
  65. package/dist/composer/clipboard.js +17 -1
  66. package/dist/composer/clipboard.js.map +1 -1
  67. package/dist/diagnostics/errors.cjs +6 -0
  68. package/dist/diagnostics/errors.cjs.map +1 -1
  69. package/dist/diagnostics/errors.d.ts +6 -0
  70. package/dist/diagnostics/errors.js +6 -0
  71. package/dist/diagnostics/errors.js.map +1 -1
  72. package/dist/index.cjs +23 -0
  73. package/dist/index.cjs.map +1 -1
  74. package/dist/index.d.ts +8 -1
  75. package/dist/index.js +23 -0
  76. package/dist/index.js.map +1 -1
  77. package/dist/lib/use-document-active.cjs +40 -0
  78. package/dist/lib/use-document-active.cjs.map +1 -0
  79. package/dist/lib/use-document-active.d.ts +9 -0
  80. package/dist/lib/use-document-active.js +40 -0
  81. package/dist/lib/use-document-active.js.map +1 -0
  82. package/dist/react/package.json.cjs +1 -1
  83. package/dist/react/package.json.js +1 -1
  84. package/dist/runtime/statewire-lifecycle.cjs +8 -0
  85. package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
  86. package/dist/runtime/statewire-lifecycle.js +9 -1
  87. package/dist/runtime/statewire-lifecycle.js.map +1 -1
  88. package/dist/styles.css +1 -1
  89. package/dist/threads/Inbox.cjs +6 -2
  90. package/dist/threads/Inbox.cjs.map +1 -1
  91. package/dist/threads/Inbox.js +6 -2
  92. package/dist/threads/Inbox.js.map +1 -1
  93. package/dist/threads/mark-viewed-thread-read.cjs +97 -0
  94. package/dist/threads/mark-viewed-thread-read.cjs.map +1 -0
  95. package/dist/threads/mark-viewed-thread-read.d.ts +7 -0
  96. package/dist/threads/mark-viewed-thread-read.js +97 -0
  97. package/dist/threads/mark-viewed-thread-read.js.map +1 -0
  98. package/dist/tools/index.cjs +7 -0
  99. package/dist/tools/index.cjs.map +1 -1
  100. package/dist/tools/index.d.ts +2 -0
  101. package/dist/tools/index.js +7 -0
  102. package/dist/tools/index.js.map +1 -1
  103. package/dist/tools/inline-tools.cjs +10 -0
  104. package/dist/tools/inline-tools.cjs.map +1 -0
  105. package/dist/tools/inline-tools.d.ts +2 -0
  106. package/dist/tools/inline-tools.js +10 -0
  107. package/dist/tools/inline-tools.js.map +1 -0
  108. package/dist/tools/test-recording-report.cjs +175 -0
  109. package/dist/tools/test-recording-report.cjs.map +1 -0
  110. package/dist/tools/test-recording-report.d.ts +82 -0
  111. package/dist/tools/test-recording-report.js +175 -0
  112. package/dist/tools/test-recording-report.js.map +1 -0
  113. package/dist/tools/test-recording-tool-uis.cjs +498 -0
  114. package/dist/tools/test-recording-tool-uis.cjs.map +1 -0
  115. package/dist/tools/test-recording-tool-uis.d.ts +32 -0
  116. package/dist/tools/test-recording-tool-uis.js +498 -0
  117. package/dist/tools/test-recording-tool-uis.js.map +1 -0
  118. package/dist/tools/tool-summary.cjs +49 -1
  119. package/dist/tools/tool-summary.cjs.map +1 -1
  120. package/dist/tools/tool-summary.js +49 -1
  121. package/dist/tools/tool-summary.js.map +1 -1
  122. package/dist/tools/tool-uis.cjs +6 -1
  123. package/dist/tools/tool-uis.cjs.map +1 -1
  124. package/dist/tools/tool-uis.js +6 -1
  125. package/dist/tools/tool-uis.js.map +1 -1
  126. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sources":["../../src/diagnostics/errors.ts"],"sourcesContent":["/**\n * Typed SDK errors. Every failure the SDK surfaces to a consumer carries a\n * stable `code` (matchable in code), a human `message`, and a `hint` — the\n * one-line \"what to do about it\" that turns a silent failure into a debuggable\n * one. Backend rejections keep their structured `{ status, detail }` payload.\n */\n\nexport const ATHENA_SDK_ERROR_CODES = {\n /** No token and no API key resolved before a request had to be sent. */\n auth_missing: 'auth_missing',\n /** The server refused the credential (401 / statewire `unauthorized` fin). */\n auth_rejected: 'auth_rejected',\n /**\n * `/_athena/auth` did not answer within the timeout on the last attempt of\n * its bounded retry cycle. The bridge stopped retrying (see\n * `ParentBridgeState.error`).\n */\n auth_bridge_timeout: 'auth_bridge_timeout',\n /**\n * `/_athena/auth` refused the mint (a 4xx other than 404), answered a body\n * it cannot read, or kept failing (5xx, 408, 429, network) through its\n * bounded retry cycle. The bridge stopped retrying and hands out no token\n * (see `ParentBridgeState.error`).\n */\n auth_bridge_failed: 'auth_bridge_failed',\n /**\n * `AthenaSSOProvider`'s session read (`/api/sso/userinfo`) kept failing\n * (5xx, 408, 429, network, timeout) through its bounded retries, or\n * answered another status it does not retry, or a 2xx without a JSON body.\n * The provider shows `displayOnError` with reason `request_failed`.\n */\n auth_sso_failed: 'auth_sso_failed',\n /** The statewire sync URL could not be derived from the configuration. */\n config_invalid: 'config_invalid',\n /** The thread list request failed. */\n threads_list_failed: 'threads_list_failed',\n /** Loading a thread's history failed. */\n thread_load_failed: 'thread_load_failed',\n /**\n * Pinning / unpinning a thread failed. `status` 404 / 405 means the backend\n * predates `POST /api/conversations/threads/favorite` (see\n * `isThreadFavoriteUnavailableError`); the pin then stays read-only.\n */\n thread_favorite_failed: 'thread_favorite_failed',\n /**\n * Renaming a thread failed. `status` 404 / 405 means the backend predates\n * `POST /api/conversations/threads/rename` (see\n * `isThreadRenameUnavailableError`); the list then offers no rename.\n */\n thread_rename_failed: 'thread_rename_failed',\n /**\n * Archiving a thread failed. `status` 404 / 405 means the backend has no\n * archive route (see `isThreadArchiveUnavailableError`); the list then\n * offers no archive action.\n */\n thread_archive_failed: 'thread_archive_failed',\n /** The statewire host rejected a command (structured `{status, detail}`). */\n statewire_rejected: 'statewire_rejected',\n /** The statewire connection is gone and will not reconnect on its own. */\n statewire_gone: 'statewire_gone',\n /** The selected collab agent / channel was refused by the backend. */\n collab_agent_rejected: 'collab_agent_rejected',\n /** A React render error crashed the chat surface (caught by the SDK's error boundary). */\n chat_render_crash: 'chat_render_crash',\n /** A pasted or dropped file could not be uploaded as a composer attachment. */\n attachment_failed: 'attachment_failed',\n /** Mention suggestions for a scope failed after every retry. */\n mentions_fetch_failed: 'mentions_fetch_failed',\n /** A composer write queued before the chat was ready can no longer land (thread switched, identity changed, provider unmounted). */\n composer_write_dropped: 'composer_write_dropped',\n /** The repository code search request (`/api/search/repositories`) failed. */\n repo_search_failed: 'repo_search_failed',\n /**\n * A session workbench read failed: the session's workspace\n * (`/api/conversations/threads/{id}/workspace`) or a computer's status or\n * SSH target.\n */\n session_workspace_failed: 'session_workspace_failed',\n /**\n * A computer's live desktop session\n * (`/api/sandbox/computer/{id}/live-desktop/session`) was refused or failed.\n */\n live_desktop_failed: 'live_desktop_failed',\n /** Anything else. */\n unknown: 'unknown',\n} as const;\n\nexport type AthenaSdkErrorCode =\n (typeof ATHENA_SDK_ERROR_CODES)[keyof typeof ATHENA_SDK_ERROR_CODES];\n\nexport interface AthenaSdkErrorOptions {\n code: AthenaSdkErrorCode;\n message: string;\n /** One line telling the integrator what to check or change. */\n hint?: string;\n /** HTTP-ish status when the failure came from a server. */\n status?: number;\n /** Structured server detail (e.g. `{ code, message }` from agora). */\n detail?: unknown;\n cause?: unknown;\n /** Extra structured context safe to log (never credentials). */\n context?: Record<string, unknown>;\n}\n\nexport class AthenaSdkError extends Error {\n readonly code: AthenaSdkErrorCode;\n readonly hint: string | undefined;\n readonly status: number | undefined;\n readonly detail: unknown;\n readonly context: Record<string, unknown>;\n\n constructor(options: AthenaSdkErrorOptions) {\n super(options.message, options.cause === undefined ? undefined : { cause: options.cause });\n this.name = 'AthenaSdkError';\n this.code = options.code;\n this.hint = options.hint;\n this.status = options.status;\n this.detail = options.detail;\n this.context = options.context ?? {};\n }\n\n /** A log/console-friendly one-liner: `[code] message — hint`. */\n describe(): string {\n return `[${this.code}] ${this.message}${this.hint ? ` — ${this.hint}` : ''}`;\n }\n\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n code: this.code,\n message: this.message,\n hint: this.hint,\n status: this.status,\n detail: this.detail,\n context: this.context,\n };\n }\n}\n\nexport function isAthenaSdkError(value: unknown): value is AthenaSdkError {\n return value instanceof AthenaSdkError;\n}\n\n/** Wrap any thrown value as an `AthenaSdkError` (idempotent for SDK errors). */\nexport function toAthenaSdkError(\n value: unknown,\n fallback: Omit<AthenaSdkErrorOptions, 'cause'>,\n): AthenaSdkError {\n if (isAthenaSdkError(value)) return value;\n const message =\n value instanceof Error && value.message ? value.message : fallback.message;\n return new AthenaSdkError({ ...fallback, message, cause: value });\n}\n\n/** Structured `{ code, message }` detail from an agora rejection, if present. */\nexport function readRejectionDetail(\n detail: unknown,\n): { code: string | null; message: string | null } {\n if (typeof detail === 'string') return { code: null, message: detail || null };\n if (!detail || typeof detail !== 'object') return { code: null, message: null };\n const record = detail as { code?: unknown; message?: unknown };\n return {\n code: typeof record.code === 'string' ? record.code : null,\n message: typeof record.message === 'string' ? record.message : null,\n };\n}\n"],"names":[],"mappings":";;;AAOO,MAAM,yBAAyB;AAAA;AAAA,EAEpC,cAAc;AAAA;AAAA,EAEd,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMf,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOrB,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOpB,iBAAiB;AAAA;AAAA,EAEjB,gBAAgB;AAAA;AAAA,EAEhB,qBAAqB;AAAA;AAAA,EAErB,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpB,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMxB,sBAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMtB,uBAAuB;AAAA;AAAA,EAEvB,oBAAoB;AAAA;AAAA,EAEpB,gBAAgB;AAAA;AAAA,EAEhB,uBAAuB;AAAA;AAAA,EAEvB,mBAAmB;AAAA;AAAA,EAEnB,mBAAmB;AAAA;AAAA,EAEnB,uBAAuB;AAAA;AAAA,EAEvB,wBAAwB;AAAA;AAAA,EAExB,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpB,0BAA0B;AAAA;AAAA;AAAA;AAAA;AAAA,EAK1B,qBAAqB;AAAA;AAAA,EAErB,SAAS;AACX;AAmBO,MAAM,uBAAuB,MAAM;AAAA,EAOxC,YAAY,SAAgC;AAC1C,UAAM,QAAQ,SAAS,QAAQ,UAAU,SAAY,SAAY,EAAE,OAAO,QAAQ,MAAA,CAAO;AAPlF;AACA;AACA;AACA;AACA;AAIP,SAAK,OAAO;AACZ,SAAK,OAAO,QAAQ;AACpB,SAAK,OAAO,QAAQ;AACpB,SAAK,SAAS,QAAQ;AACtB,SAAK,SAAS,QAAQ;AACtB,SAAK,UAAU,QAAQ,WAAW,CAAA;AAAA,EACpC;AAAA;AAAA,EAGA,WAAmB;AACjB,WAAO,IAAI,KAAK,IAAI,KAAK,KAAK,OAAO,GAAG,KAAK,OAAO,MAAM,KAAK,IAAI,KAAK,EAAE;AAAA,EAC5E;AAAA,EAEA,SAAkC;AAChC,WAAO;AAAA,MACL,MAAM,KAAK;AAAA,MACX,MAAM,KAAK;AAAA,MACX,SAAS,KAAK;AAAA,MACd,MAAM,KAAK;AAAA,MACX,QAAQ,KAAK;AAAA,MACb,QAAQ,KAAK;AAAA,MACb,SAAS,KAAK;AAAA,IAAA;AAAA,EAElB;AACF;AAEO,SAAS,iBAAiB,OAAyC;AACxE,SAAO,iBAAiB;AAC1B;AAGO,SAAS,iBACd,OACA,UACgB;AAChB,MAAI,iBAAiB,KAAK,EAAG,QAAO;AACpC,QAAM,UACJ,iBAAiB,SAAS,MAAM,UAAU,MAAM,UAAU,SAAS;AACrE,SAAO,IAAI,eAAe,EAAE,GAAG,UAAU,SAAS,OAAO,OAAO;AAClE;AAGO,SAAS,oBACd,QACiD;AACjD,MAAI,OAAO,WAAW,SAAU,QAAO,EAAE,MAAM,MAAM,SAAS,UAAU,KAAA;AACxE,MAAI,CAAC,UAAU,OAAO,WAAW,iBAAiB,EAAE,MAAM,MAAM,SAAS,KAAA;AACzE,QAAM,SAAS;AACf,SAAO;AAAA,IACL,MAAM,OAAO,OAAO,SAAS,WAAW,OAAO,OAAO;AAAA,IACtD,SAAS,OAAO,OAAO,YAAY,WAAW,OAAO,UAAU;AAAA,EAAA;AAEnE;"}
1
+ {"version":3,"file":"errors.js","sources":["../../src/diagnostics/errors.ts"],"sourcesContent":["/**\n * Typed SDK errors. Every failure the SDK surfaces to a consumer carries a\n * stable `code` (matchable in code), a human `message`, and a `hint` — the\n * one-line \"what to do about it\" that turns a silent failure into a debuggable\n * one. Backend rejections keep their structured `{ status, detail }` payload.\n */\n\nexport const ATHENA_SDK_ERROR_CODES = {\n /** No token and no API key resolved before a request had to be sent. */\n auth_missing: 'auth_missing',\n /** The server refused the credential (401 / statewire `unauthorized` fin). */\n auth_rejected: 'auth_rejected',\n /**\n * `/_athena/auth` did not answer within the timeout on the last attempt of\n * its bounded retry cycle. The bridge stopped retrying (see\n * `ParentBridgeState.error`).\n */\n auth_bridge_timeout: 'auth_bridge_timeout',\n /**\n * `/_athena/auth` refused the mint (a 4xx other than 404), answered a body\n * it cannot read, or kept failing (5xx, 408, 429, network) through its\n * bounded retry cycle. The bridge stopped retrying and hands out no token\n * (see `ParentBridgeState.error`).\n */\n auth_bridge_failed: 'auth_bridge_failed',\n /**\n * `AthenaSSOProvider`'s session read (`/api/sso/userinfo`) kept failing\n * (5xx, 408, 429, network, timeout) through its bounded retries, or\n * answered another status it does not retry, or a 2xx without a JSON body.\n * The provider shows `displayOnError` with reason `request_failed`.\n */\n auth_sso_failed: 'auth_sso_failed',\n /** The statewire sync URL could not be derived from the configuration. */\n config_invalid: 'config_invalid',\n /** The thread list request failed. */\n threads_list_failed: 'threads_list_failed',\n /** Loading a thread's history failed. */\n thread_load_failed: 'thread_load_failed',\n /**\n * Pinning / unpinning a thread failed. `status` 404 / 405 means the backend\n * predates `POST /api/conversations/threads/favorite` (see\n * `isThreadFavoriteUnavailableError`); the pin then stays read-only.\n */\n thread_favorite_failed: 'thread_favorite_failed',\n /**\n * Renaming a thread failed. `status` 404 / 405 means the backend predates\n * `POST /api/conversations/threads/rename` (see\n * `isThreadRenameUnavailableError`); the list then offers no rename.\n */\n thread_rename_failed: 'thread_rename_failed',\n /**\n * Archiving a thread failed. `status` 404 / 405 means the backend has no\n * archive route (see `isThreadArchiveUnavailableError`); the list then\n * offers no archive action.\n */\n thread_archive_failed: 'thread_archive_failed',\n /** The statewire host rejected a command (structured `{status, detail}`). */\n statewire_rejected: 'statewire_rejected',\n /** The statewire connection is gone and will not reconnect on its own. */\n statewire_gone: 'statewire_gone',\n /** The selected collab agent / channel was refused by the backend. */\n collab_agent_rejected: 'collab_agent_rejected',\n /** A React render error crashed the chat surface (caught by the SDK's error boundary). */\n chat_render_crash: 'chat_render_crash',\n /** A pasted or dropped file could not be uploaded as a composer attachment. */\n attachment_failed: 'attachment_failed',\n /** Mention suggestions for a scope failed after every retry. */\n mentions_fetch_failed: 'mentions_fetch_failed',\n /** A composer write queued before the chat was ready can no longer land (thread switched, identity changed, provider unmounted). */\n composer_write_dropped: 'composer_write_dropped',\n /** The repository code search request (`/api/search/repositories`) failed. */\n repo_search_failed: 'repo_search_failed',\n /**\n * A session workbench read failed: the session's workspace\n * (`/api/conversations/threads/{id}/workspace`) or a computer's status or\n * SSH target.\n */\n session_workspace_failed: 'session_workspace_failed',\n /**\n * A computer's live desktop session\n * (`/api/sandbox/computer/{id}/live-desktop/session`) was refused or failed.\n */\n live_desktop_failed: 'live_desktop_failed',\n /**\n * Reading an asset's stored file (`GET /api/asset/content/{id}`, e.g. a\n * test recording's video) failed for a reason other than a refused\n * credential (those are `auth_rejected`).\n */\n asset_content_failed: 'asset_content_failed',\n /** Anything else. */\n unknown: 'unknown',\n} as const;\n\nexport type AthenaSdkErrorCode =\n (typeof ATHENA_SDK_ERROR_CODES)[keyof typeof ATHENA_SDK_ERROR_CODES];\n\nexport interface AthenaSdkErrorOptions {\n code: AthenaSdkErrorCode;\n message: string;\n /** One line telling the integrator what to check or change. */\n hint?: string;\n /** HTTP-ish status when the failure came from a server. */\n status?: number;\n /** Structured server detail (e.g. `{ code, message }` from agora). */\n detail?: unknown;\n cause?: unknown;\n /** Extra structured context safe to log (never credentials). */\n context?: Record<string, unknown>;\n}\n\nexport class AthenaSdkError extends Error {\n readonly code: AthenaSdkErrorCode;\n readonly hint: string | undefined;\n readonly status: number | undefined;\n readonly detail: unknown;\n readonly context: Record<string, unknown>;\n\n constructor(options: AthenaSdkErrorOptions) {\n super(options.message, options.cause === undefined ? undefined : { cause: options.cause });\n this.name = 'AthenaSdkError';\n this.code = options.code;\n this.hint = options.hint;\n this.status = options.status;\n this.detail = options.detail;\n this.context = options.context ?? {};\n }\n\n /** A log/console-friendly one-liner: `[code] message — hint`. */\n describe(): string {\n return `[${this.code}] ${this.message}${this.hint ? ` — ${this.hint}` : ''}`;\n }\n\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n code: this.code,\n message: this.message,\n hint: this.hint,\n status: this.status,\n detail: this.detail,\n context: this.context,\n };\n }\n}\n\nexport function isAthenaSdkError(value: unknown): value is AthenaSdkError {\n return value instanceof AthenaSdkError;\n}\n\n/** Wrap any thrown value as an `AthenaSdkError` (idempotent for SDK errors). */\nexport function toAthenaSdkError(\n value: unknown,\n fallback: Omit<AthenaSdkErrorOptions, 'cause'>,\n): AthenaSdkError {\n if (isAthenaSdkError(value)) return value;\n const message =\n value instanceof Error && value.message ? value.message : fallback.message;\n return new AthenaSdkError({ ...fallback, message, cause: value });\n}\n\n/** Structured `{ code, message }` detail from an agora rejection, if present. */\nexport function readRejectionDetail(\n detail: unknown,\n): { code: string | null; message: string | null } {\n if (typeof detail === 'string') return { code: null, message: detail || null };\n if (!detail || typeof detail !== 'object') return { code: null, message: null };\n const record = detail as { code?: unknown; message?: unknown };\n return {\n code: typeof record.code === 'string' ? record.code : null,\n message: typeof record.message === 'string' ? record.message : null,\n };\n}\n"],"names":[],"mappings":";;;AAOO,MAAM,yBAAyB;AAAA;AAAA,EAEpC,cAAc;AAAA;AAAA,EAEd,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMf,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOrB,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOpB,iBAAiB;AAAA;AAAA,EAEjB,gBAAgB;AAAA;AAAA,EAEhB,qBAAqB;AAAA;AAAA,EAErB,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpB,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMxB,sBAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMtB,uBAAuB;AAAA;AAAA,EAEvB,oBAAoB;AAAA;AAAA,EAEpB,gBAAgB;AAAA;AAAA,EAEhB,uBAAuB;AAAA;AAAA,EAEvB,mBAAmB;AAAA;AAAA,EAEnB,mBAAmB;AAAA;AAAA,EAEnB,uBAAuB;AAAA;AAAA,EAEvB,wBAAwB;AAAA;AAAA,EAExB,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpB,0BAA0B;AAAA;AAAA;AAAA;AAAA;AAAA,EAK1B,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMrB,sBAAsB;AAAA;AAAA,EAEtB,SAAS;AACX;AAmBO,MAAM,uBAAuB,MAAM;AAAA,EAOxC,YAAY,SAAgC;AAC1C,UAAM,QAAQ,SAAS,QAAQ,UAAU,SAAY,SAAY,EAAE,OAAO,QAAQ,MAAA,CAAO;AAPlF;AACA;AACA;AACA;AACA;AAIP,SAAK,OAAO;AACZ,SAAK,OAAO,QAAQ;AACpB,SAAK,OAAO,QAAQ;AACpB,SAAK,SAAS,QAAQ;AACtB,SAAK,SAAS,QAAQ;AACtB,SAAK,UAAU,QAAQ,WAAW,CAAA;AAAA,EACpC;AAAA;AAAA,EAGA,WAAmB;AACjB,WAAO,IAAI,KAAK,IAAI,KAAK,KAAK,OAAO,GAAG,KAAK,OAAO,MAAM,KAAK,IAAI,KAAK,EAAE;AAAA,EAC5E;AAAA,EAEA,SAAkC;AAChC,WAAO;AAAA,MACL,MAAM,KAAK;AAAA,MACX,MAAM,KAAK;AAAA,MACX,SAAS,KAAK;AAAA,MACd,MAAM,KAAK;AAAA,MACX,QAAQ,KAAK;AAAA,MACb,QAAQ,KAAK;AAAA,MACb,SAAS,KAAK;AAAA,IAAA;AAAA,EAElB;AACF;AAEO,SAAS,iBAAiB,OAAyC;AACxE,SAAO,iBAAiB;AAC1B;AAGO,SAAS,iBACd,OACA,UACgB;AAChB,MAAI,iBAAiB,KAAK,EAAG,QAAO;AACpC,QAAM,UACJ,iBAAiB,SAAS,MAAM,UAAU,MAAM,UAAU,SAAS;AACrE,SAAO,IAAI,eAAe,EAAE,GAAG,UAAU,SAAS,OAAO,OAAO;AAClE;AAGO,SAAS,oBACd,QACiD;AACjD,MAAI,OAAO,WAAW,SAAU,QAAO,EAAE,MAAM,MAAM,SAAS,UAAU,KAAA;AACxE,MAAI,CAAC,UAAU,OAAO,WAAW,iBAAiB,EAAE,MAAM,MAAM,SAAS,KAAA;AACzE,QAAM,SAAS;AACf,SAAO;AAAA,IACL,MAAM,OAAO,OAAO,SAAS,WAAW,OAAO,OAAO;AAAA,IACtD,SAAS,OAAO,OAAO,YAAY,WAAW,OAAO,UAAU;AAAA,EAAA;AAEnE;"}
package/dist/index.cjs CHANGED
@@ -14,6 +14,7 @@ const AthenaChat = require("./chat/AthenaChat.cjs");
14
14
  const AthenaChatErrorBoundary = require("./chat/AthenaChatErrorBoundary.cjs");
15
15
  const activityTimeline = require("./chat/super-grouping/activity-timeline.cjs");
16
16
  const CollapsibleGroup = require("./chat/super-grouping/CollapsibleGroup.cjs");
17
+ const GroupedMessageParts = require("./chat/super-grouping/GroupedMessageParts.cjs");
17
18
  const groupingFunction = require("./chat/super-grouping/grouping-function.cjs");
18
19
  const SuperGroupingCard = require("./chat/super-grouping/SuperGroupingCard.cjs");
19
20
  const SuperGroupingTranscript = require("./chat/super-grouping/SuperGroupingTranscript.cjs");
@@ -50,6 +51,9 @@ const fileToolUis = require("./tools/file-tool-uis.cjs");
50
51
  const toolSummary = require("./tools/tool-summary.cjs");
51
52
  const toolFallback = require("./tools/tool-fallback.cjs");
52
53
  const voiceUpdateToolUi = require("./tools/voice-update-tool-ui.cjs");
54
+ const testRecordingToolUis = require("./tools/test-recording-tool-uis.cjs");
55
+ const testRecordingReport = require("./tools/test-recording-report.cjs");
56
+ const inlineTools = require("./tools/inline-tools.cjs");
53
57
  const voiceDelegationCard = require("./chat-ui/messages/voice-delegation-card.cjs");
54
58
  const NestedPtcMessages = require("./tools/NestedPtcMessages.cjs");
55
59
  const readAssetToolUi = require("./tools/read-asset-tool-ui.cjs");
@@ -57,6 +61,7 @@ const autoOpenTools = require("./tools/auto-open-tools.cjs");
57
61
  const appendDocumentToolUi = require("./tools/append-document-tool-ui.cjs");
58
62
  const assetUtils = require("./tools/asset-utils.cjs");
59
63
  const AthenaAssetEmbed = require("./assets/AthenaAssetEmbed.cjs");
64
+ const useAssetContent = require("./assets/use-asset-content.cjs");
60
65
  const AssetPanel = require("./assets/AssetPanel.cjs");
61
66
  const AthenaLayout = require("./assets/AthenaLayout.cjs");
62
67
  const assetPanelStore = require("./assets/asset-panel-store.cjs");
@@ -177,6 +182,7 @@ exports.CollapsibleGroup = CollapsibleGroup.CollapsibleGroup;
177
182
  exports.DEFAULT_TOOLKIT_THEME = CollapsibleGroup.DEFAULT_TOOLKIT_THEME;
178
183
  exports.SuperGroupingProvider = CollapsibleGroup.SuperGroupingProvider;
179
184
  exports.TOOLKIT_THEMES = CollapsibleGroup.TOOLKIT_THEMES;
185
+ exports.GroupedMessageParts = GroupedMessageParts.GroupedMessageParts;
180
186
  exports.createToolBasedGroupingFunction = groupingFunction.createToolBasedGroupingFunction;
181
187
  exports.SuperGroupingCard = SuperGroupingCard.SuperGroupingCard;
182
188
  exports.SuperGroupingFinalText = SuperGroupingCard.SuperGroupingFinalText;
@@ -272,6 +278,19 @@ exports.ToolFallbackTrigger = toolFallback.ToolFallbackTrigger;
272
278
  exports.clearAutoOpenedAssets = toolFallback.clearAutoOpenedAssets;
273
279
  exports.VoiceUpdateCard = voiceUpdateToolUi.VoiceUpdateCard;
274
280
  exports.VoiceUpdateToolUI = voiceUpdateToolUi.VoiceUpdateToolUI;
281
+ exports.TestRecordingMarkToolUI = testRecordingToolUis.TestRecordingMarkToolUI;
282
+ exports.TestRecordingReportCard = testRecordingToolUis.TestRecordingReportCard;
283
+ exports.TestRecordingStartToolUI = testRecordingToolUis.TestRecordingStartToolUI;
284
+ exports.TestRecordingStopToolUI = testRecordingToolUis.TestRecordingStopToolUI;
285
+ exports.TEST_RECORDING_MARK_TOOL = testRecordingReport.TEST_RECORDING_MARK_TOOL;
286
+ exports.TEST_RECORDING_START_TOOL = testRecordingReport.TEST_RECORDING_START_TOOL;
287
+ exports.TEST_RECORDING_STOP_TOOL = testRecordingReport.TEST_RECORDING_STOP_TOOL;
288
+ exports.describeTestRecordingMark = testRecordingReport.describeTestRecordingMark;
289
+ exports.describeTestRecordingStart = testRecordingReport.describeTestRecordingStart;
290
+ exports.formatRecordingClock = testRecordingReport.formatRecordingClock;
291
+ exports.formatTestRecordingCounts = testRecordingReport.formatTestRecordingCounts;
292
+ exports.parseTestRecordingStopResult = testRecordingReport.parseTestRecordingStopResult;
293
+ exports.isSdkInlineTool = inlineTools.isSdkInlineTool;
275
294
  exports.VoiceDelegationCard = voiceDelegationCard.VoiceDelegationCard;
276
295
  exports.VoiceDelegationMessage = voiceDelegationCard.VoiceDelegationMessage;
277
296
  exports.NestedPtcComponentsProvider = NestedPtcMessages.NestedPtcComponentsProvider;
@@ -283,6 +302,10 @@ exports.AppendDocumentToolUI = appendDocumentToolUi.AppendDocumentToolUI;
283
302
  exports.getAssetInfo = assetUtils.getAssetInfo;
284
303
  exports.tryParseJson = assetUtils.tryParseJson;
285
304
  exports.AthenaAssetEmbed = AthenaAssetEmbed.AthenaAssetEmbed;
305
+ exports.athenaAssetContentPath = useAssetContent.athenaAssetContentPath;
306
+ exports.fetchAthenaAssetContent = useAssetContent.fetchAthenaAssetContent;
307
+ exports.useAthenaAssetContent = useAssetContent.useAthenaAssetContent;
308
+ exports.useObjectUrl = useAssetContent.useObjectUrl;
286
309
  exports.AssetPanel = AssetPanel.AssetPanel;
287
310
  exports.AthenaLayout = AthenaLayout.AthenaLayout;
288
311
  exports.useAssetPanelStore = assetPanelStore.useAssetPanelStore;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const react = require("react");
4
+ function isActive(doc) {
5
+ if (!doc) return false;
6
+ return doc.visibilityState === "visible" && doc.hasFocus();
7
+ }
8
+ function getServerSnapshot() {
9
+ return false;
10
+ }
11
+ function subscribeTo(doc, onChange) {
12
+ const view = doc == null ? void 0 : doc.defaultView;
13
+ if (!doc || !view) return () => {
14
+ };
15
+ let afterBlur = null;
16
+ const onBlur = () => {
17
+ onChange();
18
+ if (afterBlur !== null) clearTimeout(afterBlur);
19
+ afterBlur = setTimeout(() => {
20
+ afterBlur = null;
21
+ onChange();
22
+ }, 0);
23
+ };
24
+ view.addEventListener("focus", onChange);
25
+ view.addEventListener("blur", onBlur);
26
+ doc.addEventListener("visibilitychange", onChange);
27
+ return () => {
28
+ view.removeEventListener("focus", onChange);
29
+ view.removeEventListener("blur", onBlur);
30
+ doc.removeEventListener("visibilitychange", onChange);
31
+ if (afterBlur !== null) clearTimeout(afterBlur);
32
+ };
33
+ }
34
+ function useDocumentActive(doc) {
35
+ const subscribe = react.useCallback((onChange) => subscribeTo(doc, onChange), [doc]);
36
+ const getSnapshot = react.useCallback(() => isActive(doc), [doc]);
37
+ return react.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
38
+ }
39
+ exports.useDocumentActive = useDocumentActive;
40
+ //# sourceMappingURL=use-document-active.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-document-active.cjs","sources":["../../src/lib/use-document-active.ts"],"sourcesContent":["import { useCallback, useSyncExternalStore } from 'react';\n\nfunction isActive(doc: Document | null): boolean {\n if (!doc) return false;\n return doc.visibilityState === 'visible' && doc.hasFocus();\n}\n\nfunction getServerSnapshot(): boolean {\n return false;\n}\n\nfunction subscribeTo(doc: Document | null, onChange: () => void): () => void {\n const view = doc?.defaultView;\n if (!doc || !view) return () => {};\n let afterBlur: ReturnType<typeof setTimeout> | null = null;\n // `blur` fires before focus has landed. Focus that moved into a frame of\n // this page (a computer's live desktop, an embedded asset) leaves the\n // document focused, so it is read again once the browser has moved it.\n const onBlur = () => {\n onChange();\n if (afterBlur !== null) clearTimeout(afterBlur);\n afterBlur = setTimeout(() => {\n afterBlur = null;\n onChange();\n }, 0);\n };\n view.addEventListener('focus', onChange);\n view.addEventListener('blur', onBlur);\n doc.addEventListener('visibilitychange', onChange);\n return () => {\n view.removeEventListener('focus', onChange);\n view.removeEventListener('blur', onBlur);\n doc.removeEventListener('visibilitychange', onChange);\n if (afterBlur !== null) clearTimeout(afterBlur);\n };\n}\n\n/**\n * Whether `doc` is in front of the person: visible and focused\n * (`hasFocus()`, which stays true while focus is inside a frame of the page).\n * Pass the document a subtree renders into (`useOwnerDocument()`), so a pane\n * popped out into another window reads that window. Re-read on its window's\n * `focus` / `blur` and its `visibilitychange`; nothing polls. `false` on the\n * server and without a document.\n */\nexport function useDocumentActive(doc: Document | null): boolean {\n const subscribe = useCallback((onChange: () => void) => subscribeTo(doc, onChange), [doc]);\n const getSnapshot = useCallback(() => isActive(doc), [doc]);\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n"],"names":["useCallback","useSyncExternalStore"],"mappings":";;;AAEA,SAAS,SAAS,KAA+B;AAC/C,MAAI,CAAC,IAAK,QAAO;AACjB,SAAO,IAAI,oBAAoB,aAAa,IAAI,SAAA;AAClD;AAEA,SAAS,oBAA6B;AACpC,SAAO;AACT;AAEA,SAAS,YAAY,KAAsB,UAAkC;AAC3E,QAAM,OAAO,2BAAK;AAClB,MAAI,CAAC,OAAO,CAAC,aAAa,MAAM;AAAA,EAAC;AACjC,MAAI,YAAkD;AAItD,QAAM,SAAS,MAAM;AACnB,aAAA;AACA,QAAI,cAAc,KAAM,cAAa,SAAS;AAC9C,gBAAY,WAAW,MAAM;AAC3B,kBAAY;AACZ,eAAA;AAAA,IACF,GAAG,CAAC;AAAA,EACN;AACA,OAAK,iBAAiB,SAAS,QAAQ;AACvC,OAAK,iBAAiB,QAAQ,MAAM;AACpC,MAAI,iBAAiB,oBAAoB,QAAQ;AACjD,SAAO,MAAM;AACX,SAAK,oBAAoB,SAAS,QAAQ;AAC1C,SAAK,oBAAoB,QAAQ,MAAM;AACvC,QAAI,oBAAoB,oBAAoB,QAAQ;AACpD,QAAI,cAAc,KAAM,cAAa,SAAS;AAAA,EAChD;AACF;AAUO,SAAS,kBAAkB,KAA+B;AAC/D,QAAM,YAAYA,kBAAY,CAAC,aAAyB,YAAY,KAAK,QAAQ,GAAG,CAAC,GAAG,CAAC;AACzF,QAAM,cAAcA,MAAAA,YAAY,MAAM,SAAS,GAAG,GAAG,CAAC,GAAG,CAAC;AAC1D,SAAOC,2BAAqB,WAAW,aAAa,iBAAiB;AACvE;;"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Whether `doc` is in front of the person: visible and focused
3
+ * (`hasFocus()`, which stays true while focus is inside a frame of the page).
4
+ * Pass the document a subtree renders into (`useOwnerDocument()`), so a pane
5
+ * popped out into another window reads that window. Re-read on its window's
6
+ * `focus` / `blur` and its `visibilitychange`; nothing polls. `false` on the
7
+ * server and without a document.
8
+ */
9
+ export declare function useDocumentActive(doc: Document | null): boolean;
@@ -0,0 +1,40 @@
1
+ import { useCallback, useSyncExternalStore } from "react";
2
+ function isActive(doc) {
3
+ if (!doc) return false;
4
+ return doc.visibilityState === "visible" && doc.hasFocus();
5
+ }
6
+ function getServerSnapshot() {
7
+ return false;
8
+ }
9
+ function subscribeTo(doc, onChange) {
10
+ const view = doc == null ? void 0 : doc.defaultView;
11
+ if (!doc || !view) return () => {
12
+ };
13
+ let afterBlur = null;
14
+ const onBlur = () => {
15
+ onChange();
16
+ if (afterBlur !== null) clearTimeout(afterBlur);
17
+ afterBlur = setTimeout(() => {
18
+ afterBlur = null;
19
+ onChange();
20
+ }, 0);
21
+ };
22
+ view.addEventListener("focus", onChange);
23
+ view.addEventListener("blur", onBlur);
24
+ doc.addEventListener("visibilitychange", onChange);
25
+ return () => {
26
+ view.removeEventListener("focus", onChange);
27
+ view.removeEventListener("blur", onBlur);
28
+ doc.removeEventListener("visibilitychange", onChange);
29
+ if (afterBlur !== null) clearTimeout(afterBlur);
30
+ };
31
+ }
32
+ function useDocumentActive(doc) {
33
+ const subscribe = useCallback((onChange) => subscribeTo(doc, onChange), [doc]);
34
+ const getSnapshot = useCallback(() => isActive(doc), [doc]);
35
+ return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
36
+ }
37
+ export {
38
+ useDocumentActive
39
+ };
40
+ //# sourceMappingURL=use-document-active.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-document-active.js","sources":["../../src/lib/use-document-active.ts"],"sourcesContent":["import { useCallback, useSyncExternalStore } from 'react';\n\nfunction isActive(doc: Document | null): boolean {\n if (!doc) return false;\n return doc.visibilityState === 'visible' && doc.hasFocus();\n}\n\nfunction getServerSnapshot(): boolean {\n return false;\n}\n\nfunction subscribeTo(doc: Document | null, onChange: () => void): () => void {\n const view = doc?.defaultView;\n if (!doc || !view) return () => {};\n let afterBlur: ReturnType<typeof setTimeout> | null = null;\n // `blur` fires before focus has landed. Focus that moved into a frame of\n // this page (a computer's live desktop, an embedded asset) leaves the\n // document focused, so it is read again once the browser has moved it.\n const onBlur = () => {\n onChange();\n if (afterBlur !== null) clearTimeout(afterBlur);\n afterBlur = setTimeout(() => {\n afterBlur = null;\n onChange();\n }, 0);\n };\n view.addEventListener('focus', onChange);\n view.addEventListener('blur', onBlur);\n doc.addEventListener('visibilitychange', onChange);\n return () => {\n view.removeEventListener('focus', onChange);\n view.removeEventListener('blur', onBlur);\n doc.removeEventListener('visibilitychange', onChange);\n if (afterBlur !== null) clearTimeout(afterBlur);\n };\n}\n\n/**\n * Whether `doc` is in front of the person: visible and focused\n * (`hasFocus()`, which stays true while focus is inside a frame of the page).\n * Pass the document a subtree renders into (`useOwnerDocument()`), so a pane\n * popped out into another window reads that window. Re-read on its window's\n * `focus` / `blur` and its `visibilitychange`; nothing polls. `false` on the\n * server and without a document.\n */\nexport function useDocumentActive(doc: Document | null): boolean {\n const subscribe = useCallback((onChange: () => void) => subscribeTo(doc, onChange), [doc]);\n const getSnapshot = useCallback(() => isActive(doc), [doc]);\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n"],"names":[],"mappings":";AAEA,SAAS,SAAS,KAA+B;AAC/C,MAAI,CAAC,IAAK,QAAO;AACjB,SAAO,IAAI,oBAAoB,aAAa,IAAI,SAAA;AAClD;AAEA,SAAS,oBAA6B;AACpC,SAAO;AACT;AAEA,SAAS,YAAY,KAAsB,UAAkC;AAC3E,QAAM,OAAO,2BAAK;AAClB,MAAI,CAAC,OAAO,CAAC,aAAa,MAAM;AAAA,EAAC;AACjC,MAAI,YAAkD;AAItD,QAAM,SAAS,MAAM;AACnB,aAAA;AACA,QAAI,cAAc,KAAM,cAAa,SAAS;AAC9C,gBAAY,WAAW,MAAM;AAC3B,kBAAY;AACZ,eAAA;AAAA,IACF,GAAG,CAAC;AAAA,EACN;AACA,OAAK,iBAAiB,SAAS,QAAQ;AACvC,OAAK,iBAAiB,QAAQ,MAAM;AACpC,MAAI,iBAAiB,oBAAoB,QAAQ;AACjD,SAAO,MAAM;AACX,SAAK,oBAAoB,SAAS,QAAQ;AAC1C,SAAK,oBAAoB,QAAQ,MAAM;AACvC,QAAI,oBAAoB,oBAAoB,QAAQ;AACpD,QAAI,cAAc,KAAM,cAAa,SAAS;AAAA,EAChD;AACF;AAUO,SAAS,kBAAkB,KAA+B;AAC/D,QAAM,YAAY,YAAY,CAAC,aAAyB,YAAY,KAAK,QAAQ,GAAG,CAAC,GAAG,CAAC;AACzF,QAAM,cAAc,YAAY,MAAM,SAAS,GAAG,GAAG,CAAC,GAAG,CAAC;AAC1D,SAAO,qBAAqB,WAAW,aAAa,iBAAiB;AACvE;"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const version = "0.39.0";
3
+ const version = "0.40.1";
4
4
  const packageJson = {
5
5
  version
6
6
  };
@@ -1,4 +1,4 @@
1
- const version = "0.39.0";
1
+ const version = "0.40.1";
2
2
  const packageJson = {
3
3
  version
4
4
  };
@@ -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":";;;AA4BO,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;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
+ {"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":";AA4BO,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;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;"}
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;"}