@mgamadeus/ddd-agents 0.5.17 → 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 (99) hide show
  1. package/README.md +164 -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-BdKjYz31.js → browser-request-interception-BnzFbH0m.js} +2 -2
  14. package/dist/chunks/{browser-request-interception-BdKjYz31.js.map → browser-request-interception-BnzFbH0m.js.map} +1 -1
  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 +7 -7
  39. package/dist/index.js +6 -6
  40. package/dist/kit.js +2 -2
  41. package/dist/preview.js +7 -7
  42. package/dist/provider.js +1 -1
  43. package/dist/renderer.js +25 -24
  44. package/dist/renderer.js.map +1 -1
  45. package/dist/styles.css +531 -93
  46. package/dist/types/client/AgentsConversationClient.d.ts +4 -1
  47. package/dist/types/client/http/createAgentsHttpConversationClient.d.ts +2 -1
  48. package/dist/types/entries/voice-admin.d.ts +7 -0
  49. package/dist/types/entries/voice.d.ts +24 -0
  50. package/dist/types/ui/account-realtime.d.ts +50 -11
  51. package/dist/types/voice/AgentVoiceCallBand/AgentVoiceCallBand.d.ts +49 -0
  52. package/dist/types/voice/AgentVoiceCallBand/agent-voice-call-outcome-title-text-key.d.ts +8 -0
  53. package/dist/types/voice/AgentVoiceCallCaptions/AgentVoiceCallCaptions.d.ts +15 -0
  54. package/dist/types/voice/AgentVoiceCallCaptions/saved-messages-of-agent-voice-chat.d.ts +12 -0
  55. package/dist/types/voice/AgentVoiceCallProvider/AgentVoiceCallProvider.d.ts +21 -0
  56. package/dist/types/voice/AgentVoiceCallProvider/agent-voice-call-context.d.ts +17 -0
  57. package/dist/types/voice/AgentVoiceChatStartButton/AgentVoiceChatStartButton.d.ts +15 -0
  58. package/dist/types/voice/AgentVoiceIcons/AgentVoiceIcons.d.ts +10 -0
  59. package/dist/types/voice/AgentVoiceIncomingCall/AgentVoiceIncomingCall.d.ts +28 -0
  60. package/dist/types/voice/AgentVoiceInputGlow/AgentVoiceInputGlow.d.ts +11 -0
  61. package/dist/types/voice/AgentVoiceInputGlow/agent-voice-input-glow-voice.d.ts +8 -0
  62. package/dist/types/voice/admin/AgentVoiceCallConversationLink/AgentVoiceCallConversationLink.d.ts +10 -0
  63. package/dist/types/voice/admin/AgentVoiceCallDetailScreen/AgentVoiceCallDetailScreen.d.ts +27 -0
  64. package/dist/types/voice/admin/AgentVoiceCallStateBadges/AgentVoiceCallStateBadges.d.ts +12 -0
  65. package/dist/types/voice/admin/AgentVoiceCallsScreen/AgentVoiceCallsScreen.d.ts +33 -0
  66. package/dist/types/voice/admin/agent-voice-admin-api.d.ts +59 -0
  67. package/dist/types/voice/admin/agent-voice-admin-format.d.ts +38 -0
  68. package/dist/types/voice/admin/agent-voice-admin-types.d.ts +110 -0
  69. package/dist/types/voice/agent-voice-api.d.ts +114 -0
  70. package/dist/types/voice/call/agent-voice-call-elapsed-seconds.d.ts +6 -0
  71. package/dist/types/voice/call/agent-voice-call-end-reasons.d.ts +3 -0
  72. package/dist/types/voice/call/agent-voice-call-store.d.ts +111 -0
  73. package/dist/types/voice/call/agent-voice-call-turn.d.ts +4 -0
  74. package/dist/types/voice/call/build-unsaved-agent-voice-call-lines.d.ts +14 -0
  75. package/dist/types/voice/call/format-agent-voice-call-duration.d.ts +2 -0
  76. package/dist/types/voice/call/use-agent-voice-call-elapsed-seconds.d.ts +3 -0
  77. package/dist/types/voice/call/use-agent-voice-call-server-end.d.ts +15 -0
  78. package/dist/types/voice/call/use-agent-voice-call.d.ts +12 -0
  79. package/dist/types/voice/call/use-follow-agent-voice-call-conversation.d.ts +9 -0
  80. package/dist/types/voice/ring/agent-voice-caller-label.d.ts +21 -0
  81. package/dist/types/voice/ring/agent-voice-incoming-ring-list.d.ts +10 -0
  82. package/dist/types/voice/ring/agent-voice-incoming-ring-store.d.ts +47 -0
  83. package/dist/types/voice/ring/agent-voice-ring-source.d.ts +75 -0
  84. package/dist/types/voice/ring/agent-voice-ring.d.ts +35 -0
  85. package/dist/types/voice/ring/answer-incoming-agent-voice-call.d.ts +13 -0
  86. package/dist/types/voice/ring/use-agent-voice-incoming-rings.d.ts +14 -0
  87. package/dist/types/voice/ring/use-agent-voice-ring-tone.d.ts +6 -0
  88. package/dist/ui.js +82 -19
  89. package/dist/ui.js.map +1 -1
  90. package/dist/voice-admin.js +738 -0
  91. package/dist/voice-admin.js.map +1 -0
  92. package/dist/voice.js +1586 -0
  93. package/dist/voice.js.map +1 -0
  94. package/dist/widgets.js +4 -4
  95. package/package.json +27 -1
  96. package/public-api.json +156 -0
  97. package/dist/chunks/ConversationMessageInputComposerWidgets-B3Zf69rD.js.map +0 -1
  98. package/dist/chunks/canvas-title-slot-context-DK4sfhkl.js.map +0 -1
  99. package/dist/chunks/realtime-arrival-BTLE3jjt.js.map +0 -1
package/dist/ui.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use client";
2
+ import { c as createAgentUIClientId } from "./chunks/realtime-arrival-BfsAPwqQ.js";
3
+ import { C, b, a, r, d, e } from "./chunks/realtime-arrival-BfsAPwqQ.js";
2
4
  import { useRef } from "react";
3
- import { C, b, a, r, c, d } from "./chunks/realtime-arrival-BTLE3jjt.js";
4
5
  const MIN_SECONDS_LEFT_TO_START = 3;
5
6
  const MAX_ANSWER_TEXT_CHARS = 24e3;
6
7
  const CLIENT_TOOL_OUTCOMES = {
@@ -73,10 +74,6 @@ const buildTargetRoute = (target, recordIds, tab) => {
73
74
  if (tab) segments.push(tab);
74
75
  return `/${segments.join("/")}`;
75
76
  };
76
- const createAgentUIClientId = () => {
77
- const randomPart = typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
78
- return `ui-${randomPart}`.slice(0, 64);
79
- };
80
77
  const PACKAGE_REQUEST_TYPES = ["READ_SCREEN", "LIST_TARGETS", "OPEN_TARGET", "HIGHLIGHT", "SET_WINDOW_MODE"];
81
78
  const STEP_ASIDE_REQUEST_TYPES = ["OPEN_TARGET", "HIGHLIGHT", "READ_SCREEN"];
82
79
  const PICTURE_SIZES = ["small", "medium", "large"];
@@ -1178,32 +1175,97 @@ const createAgentWindowAdapter = (options) => {
1178
1175
  const ACCOUNT_REALTIME_POLL_INTERVAL_MS = 5e3;
1179
1176
  const ACCOUNT_REALTIME_PING_REREAD_DELAY_MS = 400;
1180
1177
  const identityOf = (message) => `${message.messageType}\0${message.messageKey}\0${message.payloadJson}`;
1178
+ const placeOf = (message) => `${message.messageType}\0${message.messageKey}`;
1181
1179
  const createAccountRealtimePoll = (options) => {
1182
1180
  const intervalMs = options.intervalMs ?? ACCOUNT_REALTIME_POLL_INTERVAL_MS;
1183
1181
  const rereadDelayMs = options.rereadDelayMs ?? ACCOUNT_REALTIME_PING_REREAD_DELAY_MS;
1184
- let knownIdentities = /* @__PURE__ */ new Set();
1182
+ let knownMessages = /* @__PURE__ */ new Map();
1183
+ const subscriptions = /* @__PURE__ */ new Set([{ subscriber: options }]);
1184
+ let startedReadCount = 0;
1185
+ let newestAnsweredRead = 0;
1185
1186
  let stopped = false;
1186
1187
  let timer = null;
1188
+ const knownMessageOf = (message, nowMs) => ({
1189
+ message,
1190
+ startedReadCount,
1191
+ expiresAtMs: nowMs + message.secondsLeft * 1e3,
1192
+ handedTo: /* @__PURE__ */ new Set()
1193
+ });
1194
+ const handMessage = (knownMessage, subscription) => {
1195
+ knownMessage.handedTo.add(subscription);
1196
+ subscription.subscriber.onMessage?.(knownMessage.message);
1197
+ };
1198
+ const handToSubscribers = (arrivedMessages, goneMessagesOfClearedPlaces) => {
1199
+ const subscriptionsNow = [...subscriptions];
1200
+ for (const arrivedMessage of arrivedMessages) {
1201
+ for (const subscription of subscriptionsNow) {
1202
+ if (subscriptions.has(subscription)) handMessage(arrivedMessage, subscription);
1203
+ }
1204
+ }
1205
+ for (const goneMessages of goneMessagesOfClearedPlaces) {
1206
+ for (const subscription of subscriptionsNow) {
1207
+ if (!subscriptions.has(subscription)) continue;
1208
+ const handedMessage = goneMessages.filter((goneMessage) => goneMessage.handedTo.has(subscription)).pop();
1209
+ if (handedMessage !== void 0) subscription.subscriber.onMessageCleared?.(handedMessage.message);
1210
+ }
1211
+ }
1212
+ };
1187
1213
  const acceptArrivedMessage = (message) => {
1188
1214
  const identity = identityOf(message);
1189
- if (knownIdentities.has(identity)) return false;
1190
- knownIdentities.add(identity);
1191
- options.onMessage(message);
1215
+ if (knownMessages.has(identity)) return false;
1216
+ const knownMessage = knownMessageOf(message, Date.now());
1217
+ knownMessages.set(identity, knownMessage);
1218
+ handToSubscribers([knownMessage], []);
1192
1219
  return true;
1193
1220
  };
1194
1221
  const readNow = async () => {
1195
- const read = await options.readAccountRealtime();
1196
- const identitiesOfRead = new Set(read.messages.map(identityOf));
1197
- let arrivedCount = 0;
1222
+ startedReadCount += 1;
1223
+ const readNumber = startedReadCount;
1224
+ const read = await options.readAccountRealtime(options.clientId);
1225
+ if (readNumber < newestAnsweredRead) return 0;
1226
+ newestAnsweredRead = readNumber;
1227
+ const nowMs = Date.now();
1228
+ const knownAfterRead = /* @__PURE__ */ new Map();
1229
+ const openPlaces = /* @__PURE__ */ new Set();
1230
+ const arrivedMessages = [];
1198
1231
  for (const message of read.messages) {
1199
- if (!knownIdentities.has(identityOf(message))) {
1200
- arrivedCount += 1;
1201
- options.onMessage(message);
1232
+ const identity = identityOf(message);
1233
+ const knownMessage = knownMessages.get(identity) ?? knownMessageOf(message, nowMs);
1234
+ if (!knownMessages.has(identity)) arrivedMessages.push(knownMessage);
1235
+ knownAfterRead.set(identity, knownMessage);
1236
+ openPlaces.add(placeOf(message));
1237
+ }
1238
+ const goneMessages = [];
1239
+ for (const [identity, knownMessage] of knownMessages) {
1240
+ if (knownAfterRead.has(identity)) continue;
1241
+ if (knownMessage.startedReadCount >= readNumber) {
1242
+ knownAfterRead.set(identity, knownMessage);
1243
+ openPlaces.add(placeOf(knownMessage.message));
1244
+ } else {
1245
+ goneMessages.push(knownMessage);
1202
1246
  }
1203
1247
  }
1204
- knownIdentities = identitiesOfRead;
1248
+ const goneMessagesByClearedPlace = /* @__PURE__ */ new Map();
1249
+ for (const goneMessage of goneMessages) {
1250
+ const place = placeOf(goneMessage.message);
1251
+ if (openPlaces.has(place)) continue;
1252
+ goneMessagesByClearedPlace.set(place, [...goneMessagesByClearedPlace.get(place) ?? [], goneMessage]);
1253
+ }
1254
+ knownMessages = knownAfterRead;
1255
+ handToSubscribers(arrivedMessages, [...goneMessagesByClearedPlace.values()]);
1205
1256
  options.onListenerCredential?.(read.listenerCredential);
1206
- return arrivedCount;
1257
+ return arrivedMessages.length;
1258
+ };
1259
+ const subscribe = (subscriber) => {
1260
+ const subscription = { subscriber };
1261
+ subscriptions.add(subscription);
1262
+ const nowMs = Date.now();
1263
+ for (const knownMessage of [...knownMessages.values()]) {
1264
+ if (knownMessage.expiresAtMs > nowMs) handMessage(knownMessage, subscription);
1265
+ }
1266
+ return () => {
1267
+ subscriptions.delete(subscription);
1268
+ };
1207
1269
  };
1208
1270
  const schedule = () => {
1209
1271
  if (stopped) return;
@@ -1233,6 +1295,7 @@ const createAccountRealtimePoll = (options) => {
1233
1295
  readNow,
1234
1296
  acceptArrivedMessage,
1235
1297
  readAfterPing,
1298
+ subscribe,
1236
1299
  stop: () => {
1237
1300
  stopped = true;
1238
1301
  if (timer !== null) clearTimeout(timer);
@@ -1307,10 +1370,10 @@ export {
1307
1370
  planHighlightScroll,
1308
1371
  prepareScreenCloneForPicture,
1309
1372
  r as readClientToolRequestOfRealtimeMessage,
1310
- c as readRunStateAfterClientToolRequestPing,
1373
+ d as readRunStateAfterClientToolRequestPing,
1311
1374
  readScreenTargetOfMark,
1312
1375
  rowKeyOf,
1313
- d as runClientToolRequestForDevelopment,
1376
+ e as runClientToolRequestForDevelopment,
1314
1377
  slugOf,
1315
1378
  useAgentUIClient
1316
1379
  };