@mgamadeus/ddd-agents 0.5.16 → 0.6.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 (109) hide show
  1. package/README.md +170 -6
  2. package/boundary.json +13 -0
  3. package/dist/chat.js +148 -773
  4. package/dist/chat.js.map +1 -1
  5. package/dist/chunks/{canvas-title-slot-context-DK4sfhkl.js → ConversationMarkdown-BsCjyhj4.js} +14 -43
  6. package/dist/chunks/ConversationMarkdown-BsCjyhj4.js.map +1 -0
  7. package/dist/chunks/{ConversationMessageInputComposerWidgets-B3Zf69rD.js → ConversationMessageInputComposerWidgets-CE8LpyXY.js} +10 -37
  8. package/dist/chunks/ConversationMessageInputComposerWidgets-CE8LpyXY.js.map +1 -0
  9. package/dist/chunks/VoiceBarsIcon-BIcURsBF.js +643 -0
  10. package/dist/chunks/VoiceBarsIcon-BIcURsBF.js.map +1 -0
  11. package/dist/chunks/{WebSearchResultsConversationWidget-887v8Wen.js → WebSearchResultsConversationWidget-DXhfSikV.js} +2 -2
  12. package/dist/chunks/{WebSearchResultsConversationWidget-887v8Wen.js.map → WebSearchResultsConversationWidget-DXhfSikV.js.map} +1 -1
  13. package/dist/chunks/browser-request-interception-BnzFbH0m.js +335 -0
  14. package/dist/chunks/browser-request-interception-BnzFbH0m.js.map +1 -0
  15. package/dist/chunks/{canvas-reducers-CwFA3rQ6.js → canvas-reducers-D-YxAR4B.js} +2 -2
  16. package/dist/chunks/{canvas-reducers-CwFA3rQ6.js.map → canvas-reducers-D-YxAR4B.js.map} +1 -1
  17. package/dist/chunks/canvas-title-slot-context-D6UXrkdJ.js +36 -0
  18. package/dist/chunks/canvas-title-slot-context-D6UXrkdJ.js.map +1 -0
  19. package/dist/chunks/{canvasBodies-C7qqThc9.js → canvasBodies-CQEBkIVw.js} +4 -4
  20. package/dist/chunks/{canvasBodies-C7qqThc9.js.map → canvasBodies-CQEBkIVw.js.map} +1 -1
  21. package/dist/chunks/{canvasStorage-i2wKVSBf.js → canvasStorage-BbEI3h-8.js} +2 -2
  22. package/dist/chunks/{canvasStorage-i2wKVSBf.js.map → canvasStorage-BbEI3h-8.js.map} +1 -1
  23. package/dist/chunks/format-agent-voice-call-duration-C-3hRc9p.js +10 -0
  24. package/dist/chunks/format-agent-voice-call-duration-C-3hRc9p.js.map +1 -0
  25. package/dist/chunks/{link-navigation-CNX8Am2L.js → link-navigation-BUcy5qWW.js} +2 -2
  26. package/dist/chunks/{link-navigation-CNX8Am2L.js.map → link-navigation-BUcy5qWW.js.map} +1 -1
  27. package/dist/chunks/{realtime-arrival-BTLE3jjt.js → realtime-arrival-BfsAPwqQ.js} +8 -3
  28. package/dist/chunks/realtime-arrival-BfsAPwqQ.js.map +1 -0
  29. package/dist/chunks/use-agents-chat-store-CuIkCz9v.js +34 -0
  30. package/dist/chunks/use-agents-chat-store-CuIkCz9v.js.map +1 -0
  31. package/dist/chunks/{widget-name-resolver-BVEuAsW5.js → widget-name-resolver-B9k-s_cF.js} +3 -3
  32. package/dist/chunks/{widget-name-resolver-BVEuAsW5.js.map → widget-name-resolver-B9k-s_cF.js.map} +1 -1
  33. package/dist/chunks/withPollingChangeSubscription-CnQnubfK.js.map +1 -1
  34. package/dist/client-testing.js +4 -4
  35. package/dist/client.js +14 -3
  36. package/dist/client.js.map +1 -1
  37. package/dist/files/i18n-keys.json +1128 -100
  38. package/dist/image-render.js +65 -38
  39. package/dist/image-render.js.map +1 -1
  40. package/dist/index.js +6 -6
  41. package/dist/kit.js +2 -2
  42. package/dist/preview.js +23 -26
  43. package/dist/preview.js.map +1 -1
  44. package/dist/provider.js +1 -1
  45. package/dist/renderer.js +25 -24
  46. package/dist/renderer.js.map +1 -1
  47. package/dist/styles.css +531 -93
  48. package/dist/types/client/AgentsConversationClient.d.ts +4 -1
  49. package/dist/types/client/http/createAgentsHttpConversationClient.d.ts +2 -1
  50. package/dist/types/entries/voice-admin.d.ts +7 -0
  51. package/dist/types/entries/voice.d.ts +24 -0
  52. package/dist/types/image-render/frozen-widget-requests.d.ts +11 -2
  53. package/dist/types/image-render/widget-image-google-map.d.ts +5 -0
  54. package/dist/types/image-render/widget-image-static-assets.d.ts +2 -0
  55. package/dist/types/preview/widget-preview-requests.d.ts +6 -5
  56. package/dist/types/request-interception/browser-request-interception.d.ts +48 -0
  57. package/dist/types/request-interception/intercepted-xml-http-request-upload.d.ts +15 -0
  58. package/dist/types/ui/account-realtime.d.ts +50 -11
  59. package/dist/types/voice/AgentVoiceCallBand/AgentVoiceCallBand.d.ts +49 -0
  60. package/dist/types/voice/AgentVoiceCallBand/agent-voice-call-outcome-title-text-key.d.ts +8 -0
  61. package/dist/types/voice/AgentVoiceCallCaptions/AgentVoiceCallCaptions.d.ts +15 -0
  62. package/dist/types/voice/AgentVoiceCallCaptions/saved-messages-of-agent-voice-chat.d.ts +12 -0
  63. package/dist/types/voice/AgentVoiceCallProvider/AgentVoiceCallProvider.d.ts +21 -0
  64. package/dist/types/voice/AgentVoiceCallProvider/agent-voice-call-context.d.ts +17 -0
  65. package/dist/types/voice/AgentVoiceChatStartButton/AgentVoiceChatStartButton.d.ts +15 -0
  66. package/dist/types/voice/AgentVoiceIcons/AgentVoiceIcons.d.ts +10 -0
  67. package/dist/types/voice/AgentVoiceIncomingCall/AgentVoiceIncomingCall.d.ts +28 -0
  68. package/dist/types/voice/AgentVoiceInputGlow/AgentVoiceInputGlow.d.ts +11 -0
  69. package/dist/types/voice/AgentVoiceInputGlow/agent-voice-input-glow-voice.d.ts +8 -0
  70. package/dist/types/voice/admin/AgentVoiceCallConversationLink/AgentVoiceCallConversationLink.d.ts +10 -0
  71. package/dist/types/voice/admin/AgentVoiceCallDetailScreen/AgentVoiceCallDetailScreen.d.ts +27 -0
  72. package/dist/types/voice/admin/AgentVoiceCallStateBadges/AgentVoiceCallStateBadges.d.ts +12 -0
  73. package/dist/types/voice/admin/AgentVoiceCallsScreen/AgentVoiceCallsScreen.d.ts +33 -0
  74. package/dist/types/voice/admin/agent-voice-admin-api.d.ts +59 -0
  75. package/dist/types/voice/admin/agent-voice-admin-format.d.ts +38 -0
  76. package/dist/types/voice/admin/agent-voice-admin-types.d.ts +110 -0
  77. package/dist/types/voice/agent-voice-api.d.ts +114 -0
  78. package/dist/types/voice/call/agent-voice-call-elapsed-seconds.d.ts +6 -0
  79. package/dist/types/voice/call/agent-voice-call-end-reasons.d.ts +3 -0
  80. package/dist/types/voice/call/agent-voice-call-store.d.ts +111 -0
  81. package/dist/types/voice/call/agent-voice-call-turn.d.ts +4 -0
  82. package/dist/types/voice/call/build-unsaved-agent-voice-call-lines.d.ts +14 -0
  83. package/dist/types/voice/call/format-agent-voice-call-duration.d.ts +2 -0
  84. package/dist/types/voice/call/use-agent-voice-call-elapsed-seconds.d.ts +3 -0
  85. package/dist/types/voice/call/use-agent-voice-call-server-end.d.ts +15 -0
  86. package/dist/types/voice/call/use-agent-voice-call.d.ts +12 -0
  87. package/dist/types/voice/call/use-follow-agent-voice-call-conversation.d.ts +9 -0
  88. package/dist/types/voice/ring/agent-voice-caller-label.d.ts +21 -0
  89. package/dist/types/voice/ring/agent-voice-incoming-ring-list.d.ts +10 -0
  90. package/dist/types/voice/ring/agent-voice-incoming-ring-store.d.ts +47 -0
  91. package/dist/types/voice/ring/agent-voice-ring-source.d.ts +75 -0
  92. package/dist/types/voice/ring/agent-voice-ring.d.ts +35 -0
  93. package/dist/types/voice/ring/answer-incoming-agent-voice-call.d.ts +13 -0
  94. package/dist/types/voice/ring/use-agent-voice-incoming-rings.d.ts +14 -0
  95. package/dist/types/voice/ring/use-agent-voice-ring-tone.d.ts +6 -0
  96. package/dist/ui.js +82 -19
  97. package/dist/ui.js.map +1 -1
  98. package/dist/voice-admin.js +738 -0
  99. package/dist/voice-admin.js.map +1 -0
  100. package/dist/voice.js +1586 -0
  101. package/dist/voice.js.map +1 -0
  102. package/dist/widgets.js +4 -4
  103. package/package.json +23 -4
  104. package/public-api.json +156 -0
  105. package/dist/chunks/ConversationMessageInputComposerWidgets-B3Zf69rD.js.map +0 -1
  106. package/dist/chunks/canvas-title-slot-context-DK4sfhkl.js.map +0 -1
  107. package/dist/chunks/realtime-arrival-BTLE3jjt.js.map +0 -1
  108. package/dist/chunks/widget-image-readiness-signal-C58JkCQA.js +0 -25
  109. package/dist/chunks/widget-image-readiness-signal-C58JkCQA.js.map +0 -1
package/README.md CHANGED
@@ -12,15 +12,22 @@ npm install @mgamadeus/ddd-agents@~0.1.1 @types/google.maps@^3.55.0 apexcharts@^
12
12
  remark-directive@^4.0.0 remark-gfm@^4.0.1 remark-parse@^11.0.0 unified@^11.0.5 unist-util-visit@^5.0.0
13
13
  ```
14
14
 
15
- The second part is the peer set (React 19 assumed present; `axios` ^0.28.0 only for the optional axios client).
15
+ The second part is the peer set (React 19 assumed present). `@mgamadeus/ddd-admin-ui`, `@mgamadeus/ddd-web` and
16
+ `lucide-react` are optional peers: only `/voice/admin` loads them.
16
17
  `react-apexcharts` stays below 1.6.0: from 1.6.0 it needs apexcharts 4, the package draws with apexcharts 3.
17
18
  The agent skills come with the Composer package (`vendor/mgamadeus/ddd-agents/.claude/skills`), not with this one.
18
19
 
19
20
  Entries: `@mgamadeus/ddd-agents` (provider and setup), `/provider` (the provider alone), `/chat`, `/renderer`, `/widgets`, `/kit`, `/contract`,
20
- `/client`, `/client/testing`, `/preview`, `/image-render`, `/ui`, and the stylesheet `@mgamadeus/ddd-agents/styles.css`
21
+ `/client`, `/client/testing`, `/preview`, `/image-render`, `/ui`, `/voice`, `/voice/admin`, and the stylesheet `@mgamadeus/ddd-agents/styles.css`
21
22
  (import it once). Non-code files (widget documentation, preview fixtures, contracts, the node schema, the
22
23
  sandbox frame, SCSS tokens) are exported one subpath per file at their path below `src`. React 19 and the libraries listed under `peerDependencies` come from the application.
23
24
 
25
+ The request stand-ins of `/preview` (`installWidgetPreviewRequests`) and `/image-render` (`installFrozenWidgetRequests`,
26
+ `installLiveWidgetRequests`) replace `XMLHttpRequest` (the transport of axios's browser adapter) until the returned
27
+ function is called; the preview and the live capture answer `fetch` as well. The frozen capture leaves `fetch` alone
28
+ unless asked: `installFrozenWidgetRequests(responses, fail, { interceptFetch: true })` for an application that reads
29
+ through `fetch`. No request needs to route through axios.
30
+
24
31
  ## The conversation client over HTTP
25
32
 
26
33
  `createAgentsHttpConversationClient` (`/client`) binds the client port to the module's own conversation routes
@@ -120,10 +127,20 @@ const uiClient = useAgentUIClient({
120
127
  `readRunStateAfterClientToolRequestPing(conversationId, client.getConversationRunState, uiClient)`: a read that
121
128
  finds no request is repeated once after `CLIENT_TOOL_REQUEST_PING_REREAD_DELAY_MS` (400 ms).
122
129
  - A client that shows no conversation reads the messages addressed to its account (e.g. a call's ring) with
123
- `createAccountRealtimePoll({ readAccountRealtime: client.getAccountRealtimeMessages, onMessage, onListenerCredential,
124
- isTransportBound })`: a read at once, then every 5 s while no transport is bound; `onMessage` gets each message once.
130
+ `createAccountRealtimePoll({ readAccountRealtime: client.getAccountRealtimeMessages, onMessage, onMessageCleared,
131
+ onListenerCredential, isTransportBound })`: a read at once, then every 5 s while no transport is bound; `onMessage`
132
+ gets each message once, `onMessageCleared` each message a read finds gone, once (the answer holds no message of its
133
+ type and key any more: it was answered or withdrawn on the server, or its time is over; a replacement is an arrival).
134
+ `poll.subscribe({ onMessage, onMessageCleared })` adds a subscriber after the poll was created: it gets the messages
135
+ open now, then every arrival, and the clear only of a message it was handed (a message past its `secondsLeft` when
136
+ the subscriber came is not handed to it, and neither is its clear); the function it returns removes it.
125
137
  A transport hands what it carries to `poll.acceptArrivedMessage(message)`; one that only pings calls
126
- `poll.readAfterPing()` (one re-read after 400 ms when nothing new arrived). `runClientToolRequestForDevelopment(uiClient, 'LIST_TARGETS')` tries the
138
+ `poll.readAfterPing()` (one re-read after 400 ms when nothing new arrived); while a transport is bound, only such a
139
+ read or `poll.readNow()` tells a clear. The account read always states a client id (query parameter `clientId`, as
140
+ on the run-state read): the server knows a client that only polls by that id. The HTTP binding decides which: the
141
+ `clientId` option of the poll (`createAccountRealtimePoll({ …, clientId })`, for a host that manages its own ids),
142
+ else the id of its `uiClient`, else an id it creates once and keeps while it lives. The conversation reads state a
143
+ client id only with a `uiClient`. `runClientToolRequestForDevelopment(uiClient, 'LIST_TARGETS')` tries the
127
144
  adapters without a model.
128
145
 
129
146
  ## Texts and translations
@@ -141,7 +158,9 @@ setAgentsEnvironment({
141
158
 
142
159
  Icon-only buttons carry their accessible name through the same function (the composer's send button: `Send message`;
143
160
  the scroll-to-latest button beside it: `Scroll to the latest message`). In the package, `pnpm i18n-keys` rewrites the manifest from the sources; the build and the specs fail when it is stale. A
144
- key the generator cannot see as a literal is wrapped in `textKey("…")`.
161
+ key the generator cannot see as a literal is wrapped in `textKey("…")`. The admin screens of `/voice/admin` are the one
162
+ exception to the first sentence: they ask the text function of `@mgamadeus/ddd-admin-ui` (see there); the manifest lists
163
+ their keys with their contexts.
145
164
 
146
165
  ## Links, entities and default components
147
166
 
@@ -233,6 +252,151 @@ overflowing horizontally (`box-sizing: border-box`, the split clipped with `over
233
252
  thread at the top of the pane (`--agents-chat-top-padding: 24px` on its chat area); a host with a top bar floating over
234
253
  the thread sets that variable on `[data-agents-chat-scroll]` or through its own `chatAreaClassName`.
235
254
 
255
+ ## Voice (`/voice`, `/voice/admin`)
256
+
257
+ The voice chat with the agent in the browser window (WebRTC straight to the voice provider) and the agent ringing the
258
+ owner's open clients. The chat shows the call's conversation; the routes are `AgentVoiceSessionsTrait`.
259
+
260
+ ```tsx
261
+ import { createAccountRealtimePoll } from "@mgamadeus/ddd-agents/ui";
262
+ import {
263
+ AgentVoiceCallProvider,
264
+ AgentVoiceIncomingCall,
265
+ createAgentVoiceApi,
266
+ createAgentVoiceFetchBaseApi,
267
+ createAgentVoiceRingSource,
268
+ } from "@mgamadeus/ddd-agents/voice";
269
+
270
+ const agentVoiceApi = createAgentVoiceApi({
271
+ baseApi: createAgentVoiceFetchBaseApi({ fetchOptions: () => ({ headers: { Authorization: `Bearer ${readAccessToken()}` } }) }),
272
+ apiPrefix: "/api/agents/voiceSession", // the #[Route] of the application's voice session controller
273
+ });
274
+ const accountRealtimePoll = createAccountRealtimePoll({ readAccountRealtime: client.getAccountRealtimeMessages });
275
+ const agentVoiceRingSource = createAgentVoiceRingSource(accountRealtimePoll);
276
+
277
+ <AgentsProvider client={client}>
278
+ <AgentVoiceCallProvider
279
+ api={agentVoiceApi}
280
+ ringSource={agentVoiceRingSource}
281
+ onConversationOfCallChanged={(conversationId) => showConversation(conversationId)}
282
+ >
283
+ <App />
284
+ <AgentVoiceIncomingCall />
285
+ </AgentVoiceCallProvider>
286
+ </AgentsProvider>;
287
+ ```
288
+
289
+ What the application passes to `AgentVoiceCallProvider`:
290
+
291
+ - **`api`** (`AgentVoiceApi`): six functions, one per voice route (`openSession`, `hangUp`, `reportDeviceStatus`,
292
+ `readCallState`, `answerRing`, `declineRing`). `createAgentVoiceApi({ baseApi, apiPrefix })` builds it for an
293
+ application whose routes are the trait's own paths with the agent space in the body of `open`; `baseApi` is the
294
+ application's request layer as one function (`request({ url, method, body })` answering a Promise), for which
295
+ `createAgentVoiceFetchBaseApi()` is the binding over `fetch`. An application whose `open` names its space in the path
296
+ writes the six functions itself. A refused request rejects with the route's error code where
297
+ `readAgentVoiceErrorCode` finds it (`error`, `data.error`, `code` or the message).
298
+ - **`ringSource`** (`AgentVoiceRingSource`): the stream of the `agent.voice.ring` messages.
299
+ `createAgentVoiceRingSource(accountRealtimePoll)` listens to the account realtime poll of `/ui` while the incoming
300
+ call is mounted: a ring message that arrives rings, and one a read finds gone (answered or declined on another
301
+ client, canceled) ends the ring on this client with that read instead of at its deadline. The poll stays the
302
+ application's, which stops it. Given a function instead,
303
+ `createAgentVoiceRingSource((onMessage) => createAccountRealtimePoll({ readAccountRealtime, onMessage }))`, the ring
304
+ source starts the poll with its first subscriber and stops it with its last. An application with its own transport
305
+ passes its own source (and reports a cleared ring through `onRingCleared`). Without a ring source nothing rings. The
306
+ backend rings an account only while it knows one of its clients: the account read of the poll states the client's id
307
+ (see `/ui`), with or without a `uiClient`.
308
+ - **`onConversationOfCallChanged(conversationId, agentSpaceId)`**: called once per call when the conversation the call
309
+ writes into is known; the application shows that conversation.
310
+
311
+ The call lives in a store at module level, so it goes on when the chat that shows it closes. `useAgentVoiceCall()`
312
+ returns it: `phase` (`idle`, `connecting`, `live`, `ended`, `failed`), `callId`, `conversationId`, `lines` (what was
313
+ said), `isMuted`, `endReason`, `elapsedSeconds`; `useAgentVoiceCallValue(selector)` reads one field without rendering
314
+ on every transcript delta. Actions: `startAgentVoiceCall({ agentSpaceId?, conversationId?, callId? })` (call it straight
315
+ from the click: the microphone prompt needs the user's gesture), `hangUpAgentVoiceCall(reason?)`,
316
+ `toggleAgentVoiceCallMute()`, `dismissAgentVoiceCallOutcome()`. The store asks for the microphone, opens the peer
317
+ connection and the provider's event channel, reports the device status, and ends the call when the server says it ended.
318
+
319
+ | Component | Where it goes | Props |
320
+ |---|---|---|
321
+ | `AgentVoiceCallProvider` | once, above every voice component, below the conversation client (`AgentsProvider`) | `api`, `ringSource`, `onConversationOfCallChanged` |
322
+ | `AgentVoiceChatStartButton` | the chat input's send spot while nothing is typed | `agentSpaceId?`, `conversationId?`, `disabled?`, `testId?` |
323
+ | `AgentVoiceCallBand` | over the chat input | `renderAgentSpot?(call)`, `agentSpaceId?`, `isPresented?` |
324
+ | `AgentVoiceCallCaptions` | after the chat's message list, inside the chat | `agentSpaceId?`, `ownerMessageTheme?` |
325
+ | `AgentVoiceInputGlow` | the chat input's underlay | `agentSpaceId?` |
326
+ | `AgentVoiceIncomingCall` | once, outside the chat | `resolveCallerLabel?(ring)`, `renderAgentSpot?()` |
327
+
328
+ - The band also shows the agent's ring while a chat is in sight (`isPresented`); the incoming call then keeps its own
329
+ card away. A surface that covers the chats reports it with `useAgentVoiceRingCover(true)`.
330
+ - The server-side end of a call is read after the change signal of the call's conversation
331
+ (`subscribeToConversationChanges` of the conversation client in the React context). An application without that
332
+ client calls `useAgentVoiceCallServerEnd(subscribeToConversationChanges)` with its own signal, or
333
+ `checkAgentVoiceCallEndedOnServer()` when it knows the conversation changed.
334
+ - Texts go through `AgentsEnvironment.texts` like every other text of the package; `%agentName%` is filled from
335
+ `AgentsEnvironment.agentDisplayName`. `useAgentVoiceTranslateText()` is that text function for an application's own
336
+ caller line (`resolveCallerLabel`).
337
+ - The styles are part of `styles.css`. Every colour and size is a custom property starting with `--agents-voice-`,
338
+ read with its default (`--agents-voice-surface`, `--agents-voice-on-surface`, `--agents-voice-end`,
339
+ `--agents-voice-accept`, `--agents-voice-band-max-width`, `--agents-voice-glow-color-1` … `-4`, …; each component's
340
+ SCSS module lists its own at the top). Test ids start with `agent-voice-`.
341
+
342
+ ### The admin screens of the calls (`/voice/admin`)
343
+
344
+ The calls an administrator may read, on the blocks of `@mgamadeus/ddd-admin-ui`: the RTK Query client of the admin
345
+ call routes (`AdminAgentVoiceCallsTrait`) and two screens. This is the one entry that loads the optional peers
346
+ `@mgamadeus/ddd-admin-ui` (≥ 0.7.0), `@mgamadeus/ddd-web` (≥ 0.13.0) and `lucide-react`; an application that uses the
347
+ other entries installs none of them (`boundary.json` names the three for this entry, `scripts/check-package.mjs` fails
348
+ the build when another entry loads one).
349
+
350
+ ```tsx
351
+ import { AgentVoiceCallDetailScreen, AgentVoiceCallsScreen, createAgentVoiceAdminApi } from "@mgamadeus/ddd-agents/voice/admin";
352
+
353
+ export const agentVoiceAdminApi = createAgentVoiceAdminApi({ baseApi: adminApi, apiPrefix: "/api/admin/ai/voiceCalls" });
354
+
355
+ <AgentVoiceCallsScreen
356
+ api={agentVoiceAdminApi}
357
+ onOpenCall={(callId) => router.push(`/voice-calls/${callId}`)}
358
+ buildConversationHref={(conversationId) => `/conversations/${conversationId}`}
359
+ />;
360
+ <AgentVoiceCallDetailScreen api={agentVoiceAdminApi} callId={callId} buildConversationHref={(conversationId) => `/conversations/${conversationId}`} />;
361
+ ```
362
+
363
+ - `createAgentVoiceAdminApi({ baseApi, apiPrefix })` injects two queries into the host's RTK Query api (one with the
364
+ React hooks module): `useAgentVoiceCallsQuery({ accountId?, conversationId?, createdFrom?, createdTo?,
365
+ bookedSecondsFrom?, bookedSecondsTo?, endReason?, limit?, offset? })` (`GET <prefix>/calls` with `filters`, `top`,
366
+ `skip`; newest first) and `useAgentVoiceCallQuery({ callId })` (`GET <prefix>/calls/{callId}`).
367
+ `createStaticAgentVoiceAdminApi` answers fixed payloads for reviews and tests.
368
+ - `AgentVoiceCallsScreen`: one row per call (when it began, the account, who started it, the state with the end
369
+ reason, the duration, the booked seconds, their costs, the task, the conversation); filters for the account, the day
370
+ the call was created, the booked seconds and the end reason; pages of `pageSize` calls (default 50). Props: `api`,
371
+ `title?`, `description?`, `headerActions?`, `onOpenCall?(callId)`, `accountId?`, `conversationId?`,
372
+ `buildConversationHref?(conversationId)`, `linkComponent?`, `pageSize?`.
373
+ - `AgentVoiceCallDetailScreen`: the same values in full, the call's times, its provider, and the link that opens the
374
+ call's conversation, whose messages are what was said. Props: `api`, `callId`, `backLink?`, `headerActions?`,
375
+ `buildConversationHref?(conversationId)`, `linkComponent?`.
376
+ - Conversation links (`buildConversationHref`) render with the host's router link: `AdminUiProvider.linkComponent`,
377
+ or a screen's own `linkComponent` prop; without either they are a plain `<a>` (full page load). Without
378
+ `buildConversationHref` the conversation shows as its id. `AgentVoiceCallConversationLink` is the same link on its
379
+ own.
380
+ - While the voice channel is switched off (`403 feature_not_available`) both screens say so instead of showing an
381
+ error; a call outside what the signed-in account may read (`404 call_not_found`) reads as not found.
382
+ - A call's state (ringing, running, ended) is the server's reading at answer time (`callState`): the screens show it
383
+ as it came and derive none from the call's times, so a call a dead session worker left open reads as ended. The
384
+ duration is the difference of the call's two times. Costs are missing while no price is known for the call's model
385
+ or nothing was booked; the screens then show no amount, never zero.
386
+ - Date-times: the backend writes them without an offset in the time zone of its PHP processes, and the screens read
387
+ them as UTC, as the admin UI's date cells do; the day filter sends the bounds of the viewer's day in UTC. So the
388
+ application has to run its PHP processes in UTC; in another zone every time on the screens is off by its offset.
389
+ - A call's task is written by the agent or the owner: the screens show it as text only.
390
+ - Texts: the screens translate through the admin UI's text function (`useTranslate().t`, the marker `m`), not through
391
+ `AgentsEnvironment.texts`, because the blocks they stand on (status maps, filters, badges) do. Their keys are in
392
+ `i18n-keys.json` too (`usedIn` below `src/voice/admin/`), each with the contexts it is asked in (`agent-voice-call`,
393
+ `agent-voice-call-state`, `agent-voice-call-end-reason`, `agent-voice-call-direction`, `agent-voice-call-filter`,
394
+ `agent-voice-pagination`); in the admin UI's translation bundle the key of a text with a context is
395
+ `<text>__<context>`. Every state and every end reason has its own key.
396
+ - The screens need `AdminUiProvider` above them and Tailwind scanning
397
+ `node_modules/@mgamadeus/ddd-agents/dist/voice-admin.js`. They use neither the package stylesheet nor
398
+ `AgentVoiceCallProvider`.
399
+
236
400
  ## Stylesheet and theme
237
401
 
238
402
  - The package's root rules (`:root` variables, the image render's `html, body` reset) sit in the cascade layer
package/boundary.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "files": 518,
3
+ "filesLeaving": 0,
4
+ "targets": [],
5
+ "optionalPeerImports": {
6
+ "./voice": [],
7
+ "./voice/admin": [
8
+ "@mgamadeus/ddd-admin-ui",
9
+ "@mgamadeus/ddd-web",
10
+ "lucide-react"
11
+ ]
12
+ }
13
+ }