@mgamadeus/ddd-agents 0.5.17 → 0.6.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.
- package/README.md +162 -6
- package/boundary.json +13 -0
- package/dist/chat.js +148 -773
- package/dist/chat.js.map +1 -1
- package/dist/chunks/{canvas-title-slot-context-DK4sfhkl.js → ConversationMarkdown-BsCjyhj4.js} +14 -43
- package/dist/chunks/ConversationMarkdown-BsCjyhj4.js.map +1 -0
- package/dist/chunks/{ConversationMessageInputComposerWidgets-B3Zf69rD.js → ConversationMessageInputComposerWidgets-CE8LpyXY.js} +10 -37
- package/dist/chunks/ConversationMessageInputComposerWidgets-CE8LpyXY.js.map +1 -0
- package/dist/chunks/VoiceBarsIcon-BIcURsBF.js +643 -0
- package/dist/chunks/VoiceBarsIcon-BIcURsBF.js.map +1 -0
- package/dist/chunks/{WebSearchResultsConversationWidget-887v8Wen.js → WebSearchResultsConversationWidget-DXhfSikV.js} +2 -2
- package/dist/chunks/{WebSearchResultsConversationWidget-887v8Wen.js.map → WebSearchResultsConversationWidget-DXhfSikV.js.map} +1 -1
- package/dist/chunks/{browser-request-interception-BdKjYz31.js → browser-request-interception-BnzFbH0m.js} +2 -2
- package/dist/chunks/{browser-request-interception-BdKjYz31.js.map → browser-request-interception-BnzFbH0m.js.map} +1 -1
- package/dist/chunks/{canvas-reducers-CwFA3rQ6.js → canvas-reducers-D-YxAR4B.js} +2 -2
- package/dist/chunks/{canvas-reducers-CwFA3rQ6.js.map → canvas-reducers-D-YxAR4B.js.map} +1 -1
- package/dist/chunks/canvas-title-slot-context-D6UXrkdJ.js +36 -0
- package/dist/chunks/canvas-title-slot-context-D6UXrkdJ.js.map +1 -0
- package/dist/chunks/{canvasBodies-C7qqThc9.js → canvasBodies-CQEBkIVw.js} +4 -4
- package/dist/chunks/{canvasBodies-C7qqThc9.js.map → canvasBodies-CQEBkIVw.js.map} +1 -1
- package/dist/chunks/{canvasStorage-i2wKVSBf.js → canvasStorage-BbEI3h-8.js} +2 -2
- package/dist/chunks/{canvasStorage-i2wKVSBf.js.map → canvasStorage-BbEI3h-8.js.map} +1 -1
- package/dist/chunks/format-agent-voice-call-duration-C-3hRc9p.js +10 -0
- package/dist/chunks/format-agent-voice-call-duration-C-3hRc9p.js.map +1 -0
- package/dist/chunks/{link-navigation-CNX8Am2L.js → link-navigation-BUcy5qWW.js} +2 -2
- package/dist/chunks/{link-navigation-CNX8Am2L.js.map → link-navigation-BUcy5qWW.js.map} +1 -1
- package/dist/chunks/{realtime-arrival-BTLE3jjt.js → realtime-arrival-BfsAPwqQ.js} +8 -3
- package/dist/chunks/realtime-arrival-BfsAPwqQ.js.map +1 -0
- package/dist/chunks/use-agents-chat-store-CuIkCz9v.js +34 -0
- package/dist/chunks/use-agents-chat-store-CuIkCz9v.js.map +1 -0
- package/dist/chunks/{widget-name-resolver-BVEuAsW5.js → widget-name-resolver-B9k-s_cF.js} +3 -3
- package/dist/chunks/{widget-name-resolver-BVEuAsW5.js.map → widget-name-resolver-B9k-s_cF.js.map} +1 -1
- package/dist/chunks/withPollingChangeSubscription-CnQnubfK.js.map +1 -1
- package/dist/client-testing.js +4 -4
- package/dist/client.js +14 -3
- package/dist/client.js.map +1 -1
- package/dist/files/i18n-keys.json +1128 -100
- package/dist/image-render.js +7 -7
- package/dist/index.js +6 -6
- package/dist/kit.js +2 -2
- package/dist/preview.js +7 -7
- package/dist/provider.js +1 -1
- package/dist/renderer.js +25 -24
- package/dist/renderer.js.map +1 -1
- package/dist/styles.css +531 -93
- package/dist/types/client/AgentsConversationClient.d.ts +4 -1
- package/dist/types/client/http/createAgentsHttpConversationClient.d.ts +2 -1
- package/dist/types/entries/voice-admin.d.ts +7 -0
- package/dist/types/entries/voice.d.ts +24 -0
- package/dist/types/ui/account-realtime.d.ts +50 -11
- package/dist/types/voice/AgentVoiceCallBand/AgentVoiceCallBand.d.ts +49 -0
- package/dist/types/voice/AgentVoiceCallBand/agent-voice-call-outcome-title-text-key.d.ts +8 -0
- package/dist/types/voice/AgentVoiceCallCaptions/AgentVoiceCallCaptions.d.ts +15 -0
- package/dist/types/voice/AgentVoiceCallCaptions/saved-messages-of-agent-voice-chat.d.ts +12 -0
- package/dist/types/voice/AgentVoiceCallProvider/AgentVoiceCallProvider.d.ts +21 -0
- package/dist/types/voice/AgentVoiceCallProvider/agent-voice-call-context.d.ts +17 -0
- package/dist/types/voice/AgentVoiceChatStartButton/AgentVoiceChatStartButton.d.ts +15 -0
- package/dist/types/voice/AgentVoiceIcons/AgentVoiceIcons.d.ts +10 -0
- package/dist/types/voice/AgentVoiceIncomingCall/AgentVoiceIncomingCall.d.ts +28 -0
- package/dist/types/voice/AgentVoiceInputGlow/AgentVoiceInputGlow.d.ts +11 -0
- package/dist/types/voice/AgentVoiceInputGlow/agent-voice-input-glow-voice.d.ts +8 -0
- package/dist/types/voice/admin/AgentVoiceCallConversationLink/AgentVoiceCallConversationLink.d.ts +10 -0
- package/dist/types/voice/admin/AgentVoiceCallDetailScreen/AgentVoiceCallDetailScreen.d.ts +27 -0
- package/dist/types/voice/admin/AgentVoiceCallStateBadges/AgentVoiceCallStateBadges.d.ts +12 -0
- package/dist/types/voice/admin/AgentVoiceCallsScreen/AgentVoiceCallsScreen.d.ts +33 -0
- package/dist/types/voice/admin/agent-voice-admin-api.d.ts +59 -0
- package/dist/types/voice/admin/agent-voice-admin-format.d.ts +39 -0
- package/dist/types/voice/admin/agent-voice-admin-types.d.ts +114 -0
- package/dist/types/voice/agent-voice-api.d.ts +114 -0
- package/dist/types/voice/call/agent-voice-call-elapsed-seconds.d.ts +6 -0
- package/dist/types/voice/call/agent-voice-call-end-reasons.d.ts +3 -0
- package/dist/types/voice/call/agent-voice-call-store.d.ts +111 -0
- package/dist/types/voice/call/agent-voice-call-turn.d.ts +4 -0
- package/dist/types/voice/call/build-unsaved-agent-voice-call-lines.d.ts +14 -0
- package/dist/types/voice/call/format-agent-voice-call-duration.d.ts +2 -0
- package/dist/types/voice/call/use-agent-voice-call-elapsed-seconds.d.ts +3 -0
- package/dist/types/voice/call/use-agent-voice-call-server-end.d.ts +15 -0
- package/dist/types/voice/call/use-agent-voice-call.d.ts +12 -0
- package/dist/types/voice/call/use-follow-agent-voice-call-conversation.d.ts +9 -0
- package/dist/types/voice/ring/agent-voice-caller-label.d.ts +21 -0
- package/dist/types/voice/ring/agent-voice-incoming-ring-list.d.ts +10 -0
- package/dist/types/voice/ring/agent-voice-incoming-ring-store.d.ts +47 -0
- package/dist/types/voice/ring/agent-voice-ring-source.d.ts +60 -0
- package/dist/types/voice/ring/agent-voice-ring.d.ts +35 -0
- package/dist/types/voice/ring/answer-incoming-agent-voice-call.d.ts +13 -0
- package/dist/types/voice/ring/use-agent-voice-incoming-rings.d.ts +14 -0
- package/dist/types/voice/ring/use-agent-voice-ring-tone.d.ts +6 -0
- package/dist/ui.js +82 -19
- package/dist/ui.js.map +1 -1
- package/dist/voice-admin.js +738 -0
- package/dist/voice-admin.js.map +1 -0
- package/dist/voice.js +1568 -0
- package/dist/voice.js.map +1 -0
- package/dist/widgets.js +4 -4
- package/package.json +27 -1
- package/public-api.json +155 -0
- package/dist/chunks/ConversationMessageInputComposerWidgets-B3Zf69rD.js.map +0 -1
- package/dist/chunks/canvas-title-slot-context-DK4sfhkl.js.map +0 -1
- package/dist/chunks/realtime-arrival-BTLE3jjt.js.map +0 -1
package/README.md
CHANGED
|
@@ -12,12 +12,13 @@ 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).
|
|
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
|
|
|
@@ -126,10 +127,20 @@ const uiClient = useAgentUIClient({
|
|
|
126
127
|
`readRunStateAfterClientToolRequestPing(conversationId, client.getConversationRunState, uiClient)`: a read that
|
|
127
128
|
finds no request is repeated once after `CLIENT_TOOL_REQUEST_PING_REREAD_DELAY_MS` (400 ms).
|
|
128
129
|
- A client that shows no conversation reads the messages addressed to its account (e.g. a call's ring) with
|
|
129
|
-
`createAccountRealtimePoll({ readAccountRealtime: client.getAccountRealtimeMessages, onMessage,
|
|
130
|
-
isTransportBound })`: a read at once, then every 5 s while no transport is bound; `onMessage`
|
|
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.
|
|
131
137
|
A transport hands what it carries to `poll.acceptArrivedMessage(message)`; one that only pings calls
|
|
132
|
-
`poll.readAfterPing()` (one re-read after 400 ms when nothing new arrived)
|
|
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
|
|
133
144
|
adapters without a model.
|
|
134
145
|
|
|
135
146
|
## Texts and translations
|
|
@@ -147,7 +158,9 @@ setAgentsEnvironment({
|
|
|
147
158
|
|
|
148
159
|
Icon-only buttons carry their accessible name through the same function (the composer's send button: `Send message`;
|
|
149
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
|
|
150
|
-
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.
|
|
151
164
|
|
|
152
165
|
## Links, entities and default components
|
|
153
166
|
|
|
@@ -239,6 +252,149 @@ overflowing horizontally (`box-sizing: border-box`, the split clipped with `over
|
|
|
239
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
|
|
240
253
|
the thread sets that variable on `[data-agents-chat-scroll]` or through its own `chatAreaClassName`.
|
|
241
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 creates and stops it; the ring source never stops it. An application with its own transport
|
|
303
|
+
passes its own source (and reports a cleared ring through `onRingCleared`). Without a ring source nothing rings. The
|
|
304
|
+
backend rings an account only while it knows one of its clients: the account read of the poll states the client's id
|
|
305
|
+
(see `/ui`), with or without a `uiClient`.
|
|
306
|
+
- **`onConversationOfCallChanged(conversationId, agentSpaceId)`**: called once per call when the conversation the call
|
|
307
|
+
writes into is known; the application shows that conversation.
|
|
308
|
+
|
|
309
|
+
The call lives in a store at module level, so it goes on when the chat that shows it closes. `useAgentVoiceCall()`
|
|
310
|
+
returns it: `phase` (`idle`, `connecting`, `live`, `ended`, `failed`), `callId`, `conversationId`, `lines` (what was
|
|
311
|
+
said), `isMuted`, `endReason`, `elapsedSeconds`; `useAgentVoiceCallValue(selector)` reads one field without rendering
|
|
312
|
+
on every transcript delta. Actions: `startAgentVoiceCall({ agentSpaceId?, conversationId?, callId? })` (call it straight
|
|
313
|
+
from the click: the microphone prompt needs the user's gesture), `hangUpAgentVoiceCall(reason?)`,
|
|
314
|
+
`toggleAgentVoiceCallMute()`, `dismissAgentVoiceCallOutcome()`. The store asks for the microphone, opens the peer
|
|
315
|
+
connection and the provider's event channel, reports the device status, and ends the call when the server says it ended.
|
|
316
|
+
|
|
317
|
+
| Component | Where it goes | Props |
|
|
318
|
+
|---|---|---|
|
|
319
|
+
| `AgentVoiceCallProvider` | once, above every voice component, below the conversation client (`AgentsProvider`) | `api`, `ringSource`, `onConversationOfCallChanged` |
|
|
320
|
+
| `AgentVoiceChatStartButton` | the chat input's send spot while nothing is typed | `agentSpaceId?`, `conversationId?`, `disabled?`, `testId?` |
|
|
321
|
+
| `AgentVoiceCallBand` | over the chat input | `renderAgentSpot?(call)`, `agentSpaceId?`, `isPresented?` |
|
|
322
|
+
| `AgentVoiceCallCaptions` | after the chat's message list, inside the chat | `agentSpaceId?`, `ownerMessageTheme?` |
|
|
323
|
+
| `AgentVoiceInputGlow` | the chat input's underlay | `agentSpaceId?` |
|
|
324
|
+
| `AgentVoiceIncomingCall` | once, outside the chat | `resolveCallerLabel?(ring)`, `renderAgentSpot?()` |
|
|
325
|
+
|
|
326
|
+
- The band also shows the agent's ring while a chat is in sight (`isPresented`); the incoming call then keeps its own
|
|
327
|
+
card away. A surface that covers the chats reports it with `useAgentVoiceRingCover(true)`.
|
|
328
|
+
- The server-side end of a call is read after the change signal of the call's conversation
|
|
329
|
+
(`subscribeToConversationChanges` of the conversation client in the React context). An application without that
|
|
330
|
+
client calls `useAgentVoiceCallServerEnd(subscribeToConversationChanges)` with its own signal, or
|
|
331
|
+
`checkAgentVoiceCallEndedOnServer()` when it knows the conversation changed.
|
|
332
|
+
- Texts go through `AgentsEnvironment.texts` like every other text of the package; `%agentName%` is filled from
|
|
333
|
+
`AgentsEnvironment.agentDisplayName`. `useAgentVoiceTranslateText()` is that text function for an application's own
|
|
334
|
+
caller line (`resolveCallerLabel`).
|
|
335
|
+
- The styles are part of `styles.css`. Every colour and size is a custom property starting with `--agents-voice-`,
|
|
336
|
+
read with its default (`--agents-voice-surface`, `--agents-voice-on-surface`, `--agents-voice-end`,
|
|
337
|
+
`--agents-voice-accept`, `--agents-voice-band-max-width`, `--agents-voice-glow-color-1` … `-4`, …; each component's
|
|
338
|
+
SCSS module lists its own at the top). Test ids start with `agent-voice-`.
|
|
339
|
+
|
|
340
|
+
### The admin screens of the calls (`/voice/admin`)
|
|
341
|
+
|
|
342
|
+
The calls an administrator may read, on the blocks of `@mgamadeus/ddd-admin-ui`: the RTK Query client of the admin
|
|
343
|
+
call routes (`AdminAgentVoiceCallsTrait`) and two screens. This is the one entry that loads the optional peers
|
|
344
|
+
`@mgamadeus/ddd-admin-ui` (≥ 0.7.0), `@mgamadeus/ddd-web` (≥ 0.13.0) and `lucide-react`; an application that uses the
|
|
345
|
+
other entries installs none of them (`boundary.json` names the three for this entry, `scripts/check-package.mjs` fails
|
|
346
|
+
the build when another entry loads one).
|
|
347
|
+
|
|
348
|
+
```tsx
|
|
349
|
+
import { AgentVoiceCallDetailScreen, AgentVoiceCallsScreen, createAgentVoiceAdminApi } from "@mgamadeus/ddd-agents/voice/admin";
|
|
350
|
+
|
|
351
|
+
export const agentVoiceAdminApi = createAgentVoiceAdminApi({ baseApi: adminApi, apiPrefix: "/api/admin/ai/voiceCalls" });
|
|
352
|
+
|
|
353
|
+
<AgentVoiceCallsScreen
|
|
354
|
+
api={agentVoiceAdminApi}
|
|
355
|
+
onOpenCall={(callId) => router.push(`/voice-calls/${callId}`)}
|
|
356
|
+
buildConversationHref={(conversationId) => `/conversations/${conversationId}`}
|
|
357
|
+
/>;
|
|
358
|
+
<AgentVoiceCallDetailScreen api={agentVoiceAdminApi} callId={callId} buildConversationHref={(conversationId) => `/conversations/${conversationId}`} />;
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
- `createAgentVoiceAdminApi({ baseApi, apiPrefix })` injects two queries into the host's RTK Query api (one with the
|
|
362
|
+
React hooks module): `useAgentVoiceCallsQuery({ accountId?, conversationId?, createdFrom?, createdTo?,
|
|
363
|
+
bookedSecondsFrom?, bookedSecondsTo?, endReason?, limit?, offset? })` (`GET <prefix>/calls` with `filters`, `top`,
|
|
364
|
+
`skip`; newest first) and `useAgentVoiceCallQuery({ callId })` (`GET <prefix>/calls/{callId}`).
|
|
365
|
+
`createStaticAgentVoiceAdminApi` answers fixed payloads for reviews and tests.
|
|
366
|
+
- `AgentVoiceCallsScreen`: one row per call (when it began, the account, who started it, the state with the end
|
|
367
|
+
reason, the duration, the booked seconds, their costs, the task, the conversation); filters for the account, the day
|
|
368
|
+
the call was created, the booked seconds and the end reason; pages of `pageSize` calls (default 50). Props: `api`,
|
|
369
|
+
`title?`, `description?`, `headerActions?`, `onOpenCall?(callId)`, `accountId?`, `conversationId?`,
|
|
370
|
+
`buildConversationHref?(conversationId)`, `linkComponent?`, `pageSize?`.
|
|
371
|
+
- `AgentVoiceCallDetailScreen`: the same values in full, the call's times, its provider, and the link that opens the
|
|
372
|
+
call's conversation, whose messages are what was said. Props: `api`, `callId`, `backLink?`, `headerActions?`,
|
|
373
|
+
`buildConversationHref?(conversationId)`, `linkComponent?`.
|
|
374
|
+
- Conversation links (`buildConversationHref`) render with the host's router link: `AdminUiProvider.linkComponent`,
|
|
375
|
+
or a screen's own `linkComponent` prop; without either they are a plain `<a>` (full page load). Without
|
|
376
|
+
`buildConversationHref` the conversation shows as its id. `AgentVoiceCallConversationLink` is the same link on its
|
|
377
|
+
own.
|
|
378
|
+
- While the voice channel is switched off (`403 feature_not_available`) both screens say so instead of showing an
|
|
379
|
+
error; a call outside what the signed-in account may read (`404 call_not_found`) reads as not found.
|
|
380
|
+
- A call's state (ringing, running, ended) is the server's reading at answer time (`callState`): the screens show it
|
|
381
|
+
as it came and derive none from the call's times, so a call a dead session worker left open reads as ended. The
|
|
382
|
+
duration is the difference of the call's two times. Costs are missing while no price is known for the call's model
|
|
383
|
+
or nothing was booked; the screens then show no amount, never zero.
|
|
384
|
+
- Date-times: the backend writes them without an offset in the time zone of its PHP processes, and the screens read
|
|
385
|
+
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
|
|
386
|
+
application has to run its PHP processes in UTC; in another zone every time on the screens is off by its offset.
|
|
387
|
+
- A call's task is written by the agent or the owner: the screens show it as text only.
|
|
388
|
+
- Texts: the screens translate through the admin UI's text function (`useTranslate().t`, the marker `m`), not through
|
|
389
|
+
`AgentsEnvironment.texts`, because the blocks they stand on (status maps, filters, badges) do. Their keys are in
|
|
390
|
+
`i18n-keys.json` too (`usedIn` below `src/voice/admin/`), each with the contexts it is asked in (`agent-voice-call`,
|
|
391
|
+
`agent-voice-call-state`, `agent-voice-call-end-reason`, `agent-voice-call-direction`, `agent-voice-call-filter`,
|
|
392
|
+
`agent-voice-pagination`); in the admin UI's translation bundle the key of a text with a context is
|
|
393
|
+
`<text>__<context>`. Every state and every end reason has its own key.
|
|
394
|
+
- The screens need `AdminUiProvider` above them and Tailwind scanning
|
|
395
|
+
`node_modules/@mgamadeus/ddd-agents/dist/voice-admin.js`. They use neither the package stylesheet nor
|
|
396
|
+
`AgentVoiceCallProvider`.
|
|
397
|
+
|
|
242
398
|
## Stylesheet and theme
|
|
243
399
|
|
|
244
400
|
- The package's root rules (`:root` variables, the image render's `html, body` reset) sit in the cascade layer
|