@aintela/chat 0.6.0 → 0.8.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.
Files changed (71) hide show
  1. package/README.md +43 -0
  2. package/dist/components.js +9004 -7708
  3. package/dist/components.js.map +1 -1
  4. package/dist/{httpArtifactService-DYQDPVVH.js → detachedRunActivity-RNg1JDDW.js} +799 -334
  5. package/dist/detachedRunActivity-RNg1JDDW.js.map +1 -0
  6. package/dist/detachedRunModel-X59Pb5V-.js +67 -0
  7. package/dist/{detachedRunModel-1ii9qGTW.js.map → detachedRunModel-X59Pb5V-.js.map} +1 -1
  8. package/dist/hooks.js +1 -1
  9. package/dist/httpSessionService-DLdoBZRW.js +320 -0
  10. package/dist/httpSessionService-DLdoBZRW.js.map +1 -0
  11. package/dist/index.js +325 -275
  12. package/dist/models.js +47 -41
  13. package/dist/{serializer-BNsp8xs2.js → serializer-DvR3nOcf.js} +781 -652
  14. package/dist/serializer-DvR3nOcf.js.map +1 -0
  15. package/dist/services.js +22 -15
  16. package/dist/src/components/AgentTeam/BillingLimitBanner.d.ts +7 -0
  17. package/dist/src/components/AgentTeam/ChatAgentHeader.d.ts +34 -0
  18. package/dist/src/components/AgentTeam/HandoffDivider.d.ts +13 -0
  19. package/dist/src/components/AgentTeam/PersonaAvatar.d.ts +20 -0
  20. package/dist/src/components/AgentTeam/__tests__/agentTeam.test.d.ts +0 -0
  21. package/dist/src/components/AgentTeam/__tests__/billingLimit.test.d.ts +0 -0
  22. package/dist/src/components/AgentTeam/__tests__/messagePersona.test.d.ts +0 -0
  23. package/dist/src/components/AgentTeam/agentRoles.d.ts +33 -0
  24. package/dist/src/components/AgentTeam/chatAgent.d.ts +24 -0
  25. package/dist/src/components/AgentTeam/index.d.ts +7 -0
  26. package/dist/src/components/AgentTeam/personas.d.ts +60 -0
  27. package/dist/src/components/AiChat/AiChatContext.d.ts +9 -1
  28. package/dist/src/components/AiChat/AiChatTypes.d.ts +17 -1
  29. package/dist/src/components/AiChat/ChatPane/InteractionOriginBadge.d.ts +15 -0
  30. package/dist/src/components/AiChat/ChatPane/messageUserOrigin.test.d.ts +1 -0
  31. package/dist/src/components/AiChat/aiChatEngine.d.ts +13 -1
  32. package/dist/src/components/AiChat/stateConfiguration.d.ts +7 -0
  33. package/dist/src/components/index.d.ts +3 -0
  34. package/dist/src/components/v2/DetachedRunTaskBox.d.ts +30 -5
  35. package/dist/src/components/v2/DetachedRunTaskBox.live.test.d.ts +1 -0
  36. package/dist/src/components/v2/DetachedRunTranscript.d.ts +89 -0
  37. package/dist/src/components/v2/DetachedRunTranscript.test.d.ts +1 -0
  38. package/dist/src/components/v2/index.d.ts +5 -0
  39. package/dist/src/components/v2/useDetachedRunLiveActivity.d.ts +30 -0
  40. package/dist/src/components/v2/useDetachedRunResumeKey.d.ts +15 -0
  41. package/dist/src/components/v2/useDetachedRunResumeKey.test.d.ts +1 -0
  42. package/dist/src/models/Interaction.d.ts +26 -0
  43. package/dist/src/models/ServerEvent.d.ts +3 -0
  44. package/dist/src/models/billingLimit.d.ts +23 -0
  45. package/dist/src/models/detachedRunModel.d.ts +11 -0
  46. package/dist/src/models/enums.d.ts +3 -1
  47. package/dist/src/models/index.d.ts +5 -3
  48. package/dist/src/models/semanticKernelModel/models.d.ts +40 -1
  49. package/dist/src/services/WebSocketConnection/WebSocketConnectionV2.d.ts +4 -1
  50. package/dist/src/services/WebSocketConnection/webSocketConnection.d.ts +18 -2
  51. package/dist/src/services/detachedRun/DetachedRunFramesTransport.d.ts +68 -0
  52. package/dist/src/services/detachedRun/DetachedRunFramesTransport.test.d.ts +1 -0
  53. package/dist/src/services/detachedRun/detachedRunActivity.d.ts +25 -0
  54. package/dist/src/services/detachedRun/streamDetachedRunFrames.d.ts +110 -0
  55. package/dist/src/services/detachedRun/streamDetachedRunFrames.test.d.ts +1 -0
  56. package/dist/src/services/index.d.ts +7 -0
  57. package/dist/src/services/servers/AgentGatewayService.d.ts +1 -1
  58. package/dist/src/services/servers/AgentGatewayWSAsync.d.ts +67 -1
  59. package/dist/src/services/servers/gatewayAnnounceDetachedRun.test.d.ts +1 -0
  60. package/dist/src/services/servers/gatewayInteractionStarted.test.d.ts +1 -0
  61. package/dist/src/services/wire/decodeFrame.d.ts +6 -1
  62. package/dist/tests/fakes/fakeWebSocket.d.ts +8 -2
  63. package/dist/tests/fakes/makeGateway.d.ts +3 -1
  64. package/dist/{useChatSessions-Q41Jmr6P.js → useChatSessions-DwqgYo79.js} +2 -2
  65. package/dist/{useChatSessions-Q41Jmr6P.js.map → useChatSessions-DwqgYo79.js.map} +1 -1
  66. package/package.json +1 -1
  67. package/dist/detachedRunModel-1ii9qGTW.js +0 -50
  68. package/dist/httpArtifactService-DYQDPVVH.js.map +0 -1
  69. package/dist/httpSessionService-BY7JeW8d.js +0 -309
  70. package/dist/httpSessionService-BY7JeW8d.js.map +0 -1
  71. package/dist/serializer-BNsp8xs2.js.map +0 -1
package/README.md CHANGED
@@ -128,6 +128,49 @@ flag is available on its own as `useTurnOpen()`
128
128
  (prefer it over `UiToolContext.onGoing`, which is a per-surface snapshot: `false`
129
129
  forever on a card that has settled into history, even while a later turn streams).
130
130
 
131
+ ### Turns this tab did not send, and a detached run as a transcript (AIA Issue 1548)
132
+
133
+ The server announces every turn with an `InteractionStarted` frame before its first delta. A
134
+ turn this tab did not send — a WhatsApp message, a platform turn after a task settled, another
135
+ tab's turn — opens with its text as the user's bubble and a small origin badge ("WhatsApp",
136
+ "Plataforma", "API"; override the words with `interactionOriginLabels`). It never takes the
137
+ place of a local turn that is still streaming, and neither turn unlocks the composer for the
138
+ other. History reload reads the same origin from the session (`InteractionOriginContent`).
139
+
140
+ `DetachedRunTranscript` draws one detached run as a read-only chat — the same engine and
141
+ `ChatPane`, fed by the run's frames stream (`GET /detached-runs/{id}/frames`, SSE read over
142
+ `fetch` because the route needs a bearer):
143
+
144
+ ```tsx
145
+ import { DetachedRunTranscript } from '@aintela/chat';
146
+
147
+ <DetachedRunTranscript
148
+ runId={runId}
149
+ baseUrl={agentsServerUrl}
150
+ fetchImpl={authenticatedFetch} // or getToken={() => token}; default: user.access_token
151
+ getUser={readLiveUser} // whose token reads the run's artifacts
152
+ uiTools={uiTools} // any <AiChat> presentation prop passes through
153
+ onUnauthorized={refreshToken} // on a 401: refresh, resolve true ⇒ one retry with the fresh token
154
+ onError={(e) => setStopped(e.kind)} // 'notFound' | 'forbidden' | 'unauthorized' | 'gaveUp'
155
+ resumeKey={answersSent} // change it after answering: the stream ends when the run stops
156
+ footer={<AnswerComposer runId={runId} />}
157
+ />
158
+ ```
159
+
160
+ `DetachedRunTaskBox` polls the run's record (the source of truth) and, given the same `baseUrl` +
161
+ `fetchImpl`/`getToken`, follows its frames while it is Pending/Running: a one-line activity ticker
162
+ and a task list that moves the moment the agent updates it. "ver detalhes" mounts the run's
163
+ `DetachedRunTranscript` inline (`uiTools` / `partRenderers` pass through). `onSettled(run)` fires
164
+ once per settle the conversation was not told about (`run.announced === false`); answer it with
165
+ `engine.announceDetachedRun(run.id, run.settledAt)`, which sends the `AnnounceDetachedRun` socket
166
+ action — held while a turn is open in this tab, deduped per settle — and the server's announcement
167
+ arrives as an ordinary `platform` turn.
168
+
169
+ A host with its own `<AiChat>` wrapper takes the engine instead —
170
+ `const { engine } = useDetachedRunTranscript({ runId, baseUrl, … })`, then
171
+ `<MyScopedAiChat engine={engine}><ChatPane /></MyScopedAiChat>` with `hidePromptInput`. The
172
+ reader on its own is `streamDetachedRunFrames(…)` (services).
173
+
131
174
  ### Component names (breaking in 0.3.0)
132
175
 
133
176
  Every v2 component is exported under its **plain name** — `AppBar`, `Prompt`,