@signalcore/ui 1.0.0-beta.1 → 1.0.0-beta.3

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 (138) hide show
  1. package/README.md +55 -22
  2. package/dist/AgentAbout.js +11 -4
  3. package/dist/AgentAbout.js.map +1 -1
  4. package/dist/AgentChat.d.ts +7 -1
  5. package/dist/AgentChat.js +154 -2
  6. package/dist/AgentChat.js.map +1 -1
  7. package/dist/AgentSpace.d.ts +12 -3
  8. package/dist/AgentSpace.js +53 -11
  9. package/dist/AgentSpace.js.map +1 -1
  10. package/dist/AgentTasks.js +2 -1
  11. package/dist/AgentTasks.js.map +1 -1
  12. package/dist/Threads.d.ts +73 -0
  13. package/dist/Threads.js +140 -0
  14. package/dist/Threads.js.map +1 -0
  15. package/dist/VoiceCall.js +1 -1
  16. package/dist/VoiceCall.js.map +1 -1
  17. package/dist/about.d.ts +34 -144
  18. package/dist/about.js +6 -8
  19. package/dist/about.js.map +1 -1
  20. package/dist/automation/cron.d.ts +1 -1
  21. package/dist/automation/cron.js.map +1 -1
  22. package/dist/automation/marks.js +13 -5
  23. package/dist/automation/marks.js.map +1 -1
  24. package/dist/automation/messages.d.ts +6 -0
  25. package/dist/automation/messages.js +7 -1
  26. package/dist/automation/messages.js.map +1 -1
  27. package/dist/automation/types.d.ts +25 -128
  28. package/dist/automation/types.js +36 -0
  29. package/dist/automation/types.js.map +1 -0
  30. package/dist/automation/when.d.ts +1 -1
  31. package/dist/automation/when.js +13 -1
  32. package/dist/automation/when.js.map +1 -1
  33. package/dist/blocks.d.ts +23 -1
  34. package/dist/browser.js +2 -2
  35. package/dist/browser.js.map +1 -1
  36. package/dist/call.d.ts +1 -1
  37. package/dist/call.js.map +1 -1
  38. package/dist/client.d.ts +14 -4
  39. package/dist/client.js +7 -2
  40. package/dist/client.js.map +1 -1
  41. package/dist/contract.d.ts +267 -0
  42. package/dist/credentials.js.map +1 -1
  43. package/dist/dev.js +1 -1
  44. package/dist/dev.js.map +1 -1
  45. package/dist/es.d.ts +2 -0
  46. package/dist/es.js +31 -4
  47. package/dist/es.js.map +1 -1
  48. package/dist/frames.d.ts +7 -1
  49. package/dist/frames.js.map +1 -1
  50. package/dist/index.d.ts +6 -5
  51. package/dist/index.js +6 -4
  52. package/dist/kit/AudioPlayer.js +1 -1
  53. package/dist/kit/AudioPlayer.js.map +1 -1
  54. package/dist/kit/Choices.js +1 -1
  55. package/dist/kit/Choices.js.map +1 -1
  56. package/dist/kit/FileField.js +1 -1
  57. package/dist/kit/FileField.js.map +1 -1
  58. package/dist/kit/Popover.js.map +1 -1
  59. package/dist/kit/Tile.d.ts +1 -1
  60. package/dist/kit/Tile.js +1 -1
  61. package/dist/kit/Tile.js.map +1 -1
  62. package/dist/kit/messages.d.ts +13 -0
  63. package/dist/kit/messages.js +7 -1
  64. package/dist/kit/messages.js.map +1 -1
  65. package/dist/kit/uploads.d.ts +2 -1
  66. package/dist/kit/uploads.js +1 -1
  67. package/dist/kit/uploads.js.map +1 -1
  68. package/dist/kit/waveform.js.map +1 -1
  69. package/dist/markdown.js.map +1 -1
  70. package/dist/marks.js +2 -3
  71. package/dist/marks.js.map +1 -1
  72. package/dist/surface/Form.js +1 -1
  73. package/dist/surface/Markdown.js +1 -1
  74. package/dist/surface/Markdown.js.map +1 -1
  75. package/dist/surface/Surface.js +43 -4
  76. package/dist/surface/Surface.js.map +1 -1
  77. package/dist/surface/scope.d.ts +1 -1
  78. package/dist/surface/scope.js.map +1 -1
  79. package/dist/surface/values.js +1 -1
  80. package/dist/surface/values.js.map +1 -1
  81. package/dist/tint.d.ts +1 -1
  82. package/dist/tint.js +1 -1
  83. package/dist/tint.js.map +1 -1
  84. package/dist/types.d.ts +11 -0
  85. package/dist/types.js.map +1 -1
  86. package/dist/useConversation.d.ts +2 -0
  87. package/dist/useConversation.js +16 -0
  88. package/dist/useConversation.js.map +1 -1
  89. package/dist/usePolled.js +1 -1
  90. package/dist/usePolled.js.map +1 -1
  91. package/dist/voice/webgl.js +1 -1
  92. package/dist/voice/webgl.js.map +1 -1
  93. package/dist/widget.js +17 -16
  94. package/package.json +1 -1
  95. package/src/AgentAbout.tsx +14 -3
  96. package/src/AgentChat.tsx +203 -1
  97. package/src/AgentSpace.tsx +89 -13
  98. package/src/AgentTasks.tsx +2 -2
  99. package/src/Threads.tsx +218 -0
  100. package/src/VoiceCall.tsx +1 -1
  101. package/src/about.ts +42 -144
  102. package/src/automation/cron.ts +1 -1
  103. package/src/automation/marks.tsx +13 -2
  104. package/src/automation/messages.ts +12 -0
  105. package/src/automation/types.ts +58 -118
  106. package/src/automation/when.ts +7 -1
  107. package/src/blocks.ts +25 -0
  108. package/src/browser.ts +4 -4
  109. package/src/call.ts +1 -1
  110. package/src/client.ts +26 -10
  111. package/src/contract.ts +1934 -0
  112. package/src/credentials.ts +2 -2
  113. package/src/dev.ts +1 -1
  114. package/src/es.ts +29 -0
  115. package/src/frames.ts +3 -1
  116. package/src/index.ts +10 -1
  117. package/src/kit/AudioPlayer.tsx +1 -1
  118. package/src/kit/Choices.tsx +1 -1
  119. package/src/kit/FileField.tsx +1 -1
  120. package/src/kit/Popover.tsx +1 -1
  121. package/src/kit/Tile.tsx +1 -1
  122. package/src/kit/messages.ts +20 -0
  123. package/src/kit/uploads.ts +2 -2
  124. package/src/kit/waveform.ts +1 -1
  125. package/src/markdown.ts +1 -1
  126. package/src/marks.tsx +3 -123
  127. package/src/styles.css +206 -0
  128. package/src/surface/Markdown.tsx +1 -1
  129. package/src/surface/Surface.tsx +53 -4
  130. package/src/surface/scope.ts +3 -1
  131. package/src/surface/values.ts +5 -5
  132. package/src/tint.ts +1 -1
  133. package/src/types.ts +11 -0
  134. package/src/useConversation.ts +10 -0
  135. package/src/usePolled.ts +2 -2
  136. package/src/voice/webgl.ts +1 -1
  137. package/src/widget/element.tsx +13 -4
  138. package/src/widget/widget.css +13 -0
package/README.md CHANGED
@@ -185,6 +185,29 @@ couldn't begin again), `close`, `agent` (its name when the face can't be read),
185
185
  (`--text`, `--voice`; `aria-checked` on the one on), `sc-space__caption` (`--person`, `--agent`),
186
186
  `sc-space__status`.
187
187
 
188
+ ### Threads, unread, and several yeses at once
189
+
190
+ A person keeps several conversations (threads) with the agent, each with its title: one your
191
+ backend opened for them (`conversations.start` with `contact`, `title`, `say`), one they began.
192
+ `AgentSpace` shows a line over the chat, **Conversaciones**, with a dot while another thread has
193
+ something for them; it lists them by title with how many of the agent's messages are unread, to
194
+ go to one or start another (`threads={false}` turns it off). The chat reads what comes as it
195
+ shows it on a person's page (`POST /conversations/{id}/read`), so `unread` follows; the widget's
196
+ launcher wears a dot while something waits, for someone who talked before.
197
+
198
+ For your own layout: `useUnread(client, agentId)` (`{threads, unread, waiting, refresh}`, read
199
+ every 20 s and when the page comes back into sight), `<Threads threads current onSelect onNew
200
+ onBack />` and `<Conversation client id … />` (the chat of one thread, `AgentChat`'s props).
201
+ Words: `THREAD_MESSAGES`, `THREAD_MESSAGES_ES`. Parts: `sc-threads`, `sc-threads__head`,
202
+ `sc-threads__title`, `sc-threads__list`, `sc-threads__item` (`--current`), `sc-threads__name`,
203
+ `sc-threads__badge`, `sc-threads__dot`, `sc-space__threads`, `sc-space__dot`.
204
+
205
+ When one reply waits on the person's yes for several actions, they come in one card
206
+ (`sc-chat__requests`): a box ticked for each, what each would take under it, editable, and one
207
+ button, **Aprobar todo** (or as many as are ticked), sending a yes for each ticked (with what was
208
+ changed: `data.input`) and a no for the rest, in one `actions` frame. Words: `approvals`,
209
+ `approveAll`, `approveSome`, `declineAll`.
210
+
188
211
  ## The widget
189
212
 
190
213
  `<signalcore-chat>` for pages without React: one script, React and the stylesheet inside it,
@@ -317,23 +340,26 @@ from its credentials: `"business"` (our app's cookie) or `"person"` (a token, a
317
340
  visitor); the chat draws a yes the business decides by it, and shows a person none of the
318
341
  agent's steps (`steps`).
319
342
 
320
- | Method | Does |
321
- | --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
322
- | `agents.face(id)` | what a person may know of the agent (`GET /agents/{id}/face`): `AgentFace {id, name, role, icon, voice: {enabled}}` |
323
- | `agents.about(id)` | what the agent says about itself (`about`, null until written; `about_at`, null once stale) and its `facts` |
324
- | `agents.describe(id)` | has the agent write about itself anew (a model call, a few seconds); answers like `about` |
325
- | `agents.files(id)` | the agent's own files (`StoredFile`: `id, path, media_type, size, searchable, created_at`), by path |
326
- | `agents.putFile(id, path, blob, searchable)` | stores the blob's bytes under the path (replacing a file of that name), its type as the file's; `searchable` makes it knowledge `search_files` reads (text, Markdown, JSON, YAML, PDF). 50 MB at most, 5 GB per organization |
327
- | `agents.deleteFile(id, path)` | removes one of the agent's own files |
328
- | `agents.memories(id)` | what the agent remembered (`MemoryFact`: `id, text, created_at`), newest first |
329
- | `agents.forget(id, memoryId)` | takes one memory from it |
330
- | `agents.call(id)` | the owner's call with the agent from our app (`POST /agents/{id}/voice/token`, `/api` only): `CallToken {url, token, room, call_id, conversation_id}`, LiveKit's address and a token for the call's room, and the call's conversation (a test), made now |
331
- | `files.list()` · `files.put(path, blob, searchable)` · `files.delete(path)` | the organization's files, shared with every agent: the same three as the agent's own |
332
- | `conversations.get(id)` | one conversation with its messages, who answers it (`handled_by`: `agent`, `person` or `nobody`) and every change of it (`handovers`); on a channel, `channel`, `contact` (`muted`) and each message's `author`, `delivery` and `decision` |
333
- | `conversations.start(agentId)` | a new conversation with an agent |
334
- | `conversations.call(agentId)` | a call with the agent for whoever may talk to it, a person's as theirs (`POST /agents/{id}/calls`): a `CallToken`, what `VoiceCall`'s `connect` answers, with the call's own conversation, made now, where what is said lands |
335
- | `channels.list(agentId?)` | the organization's channels, or one agent's (`Channel`: `id, agent_id, kind, provider, name, external_id, status, detail, settings, created_at`), the disconnected ones too |
336
- | `liveUrl(conversationId, { fresh? })` | the socket's address, signed in (a promise): `ws:` beside `http:` and `wss:` beside `https:`, with `?token=` (and `&visitor=`) but in our app; `fresh` asks `getToken` for a new token first |
343
+ | Method | Does |
344
+ | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
345
+ | `agents.face(id)` | what a person may know of the agent (`GET /agents/{id}/face`): `AgentFace {id, name, role, icon, voice: {enabled}}` |
346
+ | `agents.about(id)` | what the agent says about itself (`about`, null until written; `about_at`, null once stale) and its `facts` |
347
+ | `agents.describe(id)` | has the agent write about itself anew (a model call, a few seconds); answers like `about` |
348
+ | `agents.files(id)` | the agent's own files (`StoredFile`: `id, path, media_type, size, searchable, created_at`), by path |
349
+ | `agents.putFile(id, path, blob, searchable)` | stores the blob's bytes under the path (replacing a file of that name), its type as the file's; `searchable` makes it knowledge `search_files` reads (text, Markdown, JSON, YAML, PDF). 50 MB at most, 5 GB per organization |
350
+ | `agents.deleteFile(id, path)` | removes one of the agent's own files |
351
+ | `agents.memories(id)` | what the agent remembered (`MemoryFact`: `id, text, created_at`), newest first |
352
+ | `agents.forget(id, memoryId)` | takes one memory from it |
353
+ | `agents.call(id)` | **app only** (`POST /agents/{id}/voice/token` is `/api`'s, 404 on `/v1`): the owner's call with the agent from our app, `CallToken {url, token, room, call_id, conversation_id}`, LiveKit's address and a token for the call's room, and the call's conversation (a test), made now. A host's page uses `conversations.call(agentId)` |
354
+ | `files.list()` · `files.put(path, blob, searchable)` · `files.delete(path)` | the organization's files, shared with every agent: the same three as the agent's own |
355
+ | `conversations.get(id)` | one conversation with its messages, who answers it (`handled_by`: `agent`, `person` or `nobody`) and every change of it (`handovers`); on a channel, `channel`, `contact` (`muted`) and each message's `author`, `delivery` and `decision` |
356
+ | `conversations.list(agentId)` | the agent's conversations, newest first (a person's own), each with `title`, `unread` and `waiting_on_person` |
357
+ | `conversations.start(agentId, { title })` | a new conversation with an agent, titled when given |
358
+ | `conversations.read(id)` | how far the person has read it: all of it, now (the chat calls it as it shows what comes) |
359
+ | `conversations.rename(id, title)` | its title, as the person gives it |
360
+ | `conversations.call(agentId)` | a call with the agent for whoever may talk to it, a person's as theirs (`POST /agents/{id}/calls`): a `CallToken`, what `VoiceCall`'s `connect` answers, with the call's own conversation, made now, where what is said lands |
361
+ | `channels.list(agentId?)` | the organization's channels, or one agent's (`Channel`: `id, agent_id, kind, provider, name, external_id, status, detail, settings, created_at`), the disconnected ones too |
362
+ | `liveUrl(conversationId, { fresh? })` | the socket's address, signed in (a promise): `ws:` beside `http:` and `wss:` beside `https:`, with `?token=` (and `&visitor=`) but in our app; `fresh` asks `getToken` for a new token first |
337
363
 
338
364
  ## The frames
339
365
 
@@ -378,15 +404,15 @@ from how the call's promise settled).
378
404
  the page and its answer goes up (each call once; one told again is answered again with what it
379
405
  gave; the turn stays under way until its step settles); without it each is refused with
380
406
  `NO_TOOL`. It answers `{ messages, draft, pending,
381
- awaiting, open, loading, error, say(text), act(action), stop(), browser,
407
+ awaiting, open, loading, error, say(text), act(action), actAll(actions), stop(), browser,
382
408
  watchScreen(listener), control(to), input(event), holder, handovers }`. The history, read each
383
409
  time the socket opens and kept live by its frames;
384
410
  `pending` from the person's message to `done`, `stopped` or a turn error, `draft` the reply so
385
411
  far. What `step`, `ui` and `request` frames say lands on the reply's steps, so a message is
386
412
  the one place a step is drawn from, live or read back. `awaiting` is the step the turn waits
387
413
  on: a surface to answer, or an action waiting for the person's leave (the step's `request`,
388
- `decides: "person"`; `act` on its id with `approve` or `decline`); `say` is refused until they
389
- act. A yes the business gives (`decides: "business"`) waits on its step and holds nothing; the
414
+ `decides: "person"`; `act` on its id with `approve` or `decline`, `actAll` on several at once,
415
+ a yes's `data.input` changing what it runs with); `say` is refused until they act. A yes the business gives (`decides: "business"`) waits on its step and holds nothing; the
390
416
  person's answer on one, refused `business`, puts it back as the business's. `onError(code)`
391
417
  hears the socket's codes and `load` (the
392
418
  history could not be read): the host words them, the hook shows no text; `tool` (an answer of
@@ -509,7 +535,7 @@ an agent, the one a customer has on the phone, through LiveKit (`livekit-client`
509
535
  when it mounts and ends when it unmounts (key it on the attempt for another). It opens the
510
536
  microphone first (no call is made for someone who can't be heard), then asks `connect()` where to
511
537
  join (`{url, token}`: our API's `client.conversations.call(agentId)` answers both, with the
512
- call's conversation; `client.agents.call(id)` for the owner's test), joins the room and publishes the microphone; the agent's voice plays as it comes,
538
+ call's conversation; `client.agents.call(id)` for the owner's test in our own app, never on `/v1`), joins the room and publishes the microphone; the agent's voice plays as it comes,
513
539
  and the call is on once the agent joins (its time counts from then).
514
540
 
515
541
  What it draws, centred: the `Orb`, large (`orbSize`, 280 px; `orb`: `"wave"`, the default, or
@@ -696,7 +722,14 @@ it is instead (`part="media"`, `sc-surface__media`), in the browser's own player
696
722
  address the host gives (`files.play`; the conversation's asks `client.conversations.play`, a link
697
723
  the API signs for an hour that needs no credential and answers `Range`); a picture pressed opens
698
724
  in the viewer, a player whose address ran out asks for a new one once, and a host that can't play
699
- it keeps the row. Until the API has filled in `file` it is only named, quietly.
725
+ it keeps the row. Until the API has filled in `file` it is only named, quietly. A `connect`
726
+ block (`ConnectBlock`) is an app for the person to connect, drawn by the platform alone (the
727
+ agent's `connect_app`, never composed): a card with the app's logo and name over the line the
728
+ agent wrote of what it will do with it, and, while the connection waits for them, a primary
729
+ "Autorizar en <app>" (`messages.connect.authorize`) that opens its consent page apart; once it
730
+ works, a check and "Conectada" in its place (`sc-surface__connect--done`), and a quiet word when
731
+ it failed. It changes as the connection does, from the `ui` frames the API sends again on the
732
+ same id; before the API has asked for it (`connection` null), only the app as the agent named it.
700
733
 
701
734
  ## AgentAbout
702
735
 
@@ -44,7 +44,10 @@ const ABOUT_MESSAGES = {
44
44
  kinds: {
45
45
  schedule: "At a time",
46
46
  webhook: "When called",
47
- event: "On an event"
47
+ event: "On an event",
48
+ platform: "On a message",
49
+ manual: "When started",
50
+ after: "After another"
48
51
  },
49
52
  topics: {
50
53
  apps: "Apps",
@@ -569,11 +572,15 @@ function Gone({ classNames, children }) {
569
572
  children
570
573
  });
571
574
  }
572
- /** An automation's mark says its kind: a time, a call from another system, an event. */
575
+ /** An automation's mark says its kind: a time, a call from another system, an event, a
576
+ * message. */
573
577
  const KIND_ICONS = {
574
578
  schedule: "clock",
575
579
  webhook: "code",
576
- event: "bell"
580
+ event: "bell",
581
+ platform: "message",
582
+ manual: "hand",
583
+ after: "check"
577
584
  };
578
585
  /** An app's mark: the host's logo when it draws one, else the provider's, bare. */
579
586
  function appMark(app, apps, size) {
@@ -678,7 +685,7 @@ function Automations({ told, live, words, classNames, tools, controls, apps, onO
678
685
  const now = standing.get(automation.name);
679
686
  const going = now?.last_run?.status === "running";
680
687
  return /* @__PURE__ */ jsx(Row, {
681
- mark: automation.provider === void 0 ? /* @__PURE__ */ jsx(Mark, { icon: GLYPHS[KIND_ICONS[automation.kind]] }) : appMark({
688
+ mark: automation.provider === void 0 || automation.provider === null ? /* @__PURE__ */ jsx(Mark, { icon: GLYPHS[KIND_ICONS[automation.kind]] }) : appMark({
682
689
  provider: automation.provider,
683
690
  name: automation.app_title ?? toolName(automation.app ?? automation.provider),
684
691
  icon: automation.icon
@@ -1 +1 @@
1
- {"version":3,"file":"AgentAbout.js","names":[],"sources":["../src/AgentAbout.tsx"],"sourcesContent":["import {\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\n\nimport {\n BooksIcon,\n BroadcastIcon,\n KeyIcon,\n LightbulbIcon,\n PuzzlePieceIcon,\n WrenchIcon,\n type Icon as Glyph,\n} from \"@phosphor-icons/react\";\nimport {\n aboutState,\n appTitle,\n automationsOf,\n countOf,\n formatSize,\n toneOf,\n toolName,\n toolTitle,\n type AboutOut,\n type ActionFact,\n type AutomationFact,\n type AutomationKind,\n type ChannelFact,\n type ChannelKind,\n type ConnectionFact,\n type DataFact,\n type Facts,\n type FileFact,\n type Icon,\n type MemoryFact,\n type Provider,\n type StatusTone,\n type Told,\n type Topic,\n type VaultFact,\n} from \"./about\";\nimport { Automation } from \"./automation/Automation\";\nimport { RunView } from \"./automation/RunView\";\nimport type { Automation as Standing, Run } from \"./automation/types\";\nimport { agentGlyph } from \"./agentIcons\";\nimport { classes } from \"./classes\";\nimport { ApiError, type Client } from \"./client\";\nimport { baseName } from \"./files\";\nimport { GLYPHS } from \"./icons\";\nimport { KitProvider, useKit, type KitClassNames, type KitPart } from \"./kit/context\";\nimport { FileMark } from \"./kit/FileMark\";\nimport { List, Row } from \"./kit/List\";\nimport { Mark } from \"./kit/Mark\";\nimport { MarkStack } from \"./kit/MarkStack\";\nimport { Tag } from \"./kit/Tag\";\nimport { KIT_MESSAGES, type KitLocale, type KitMessages } from \"./kit/messages\";\nimport { actionMark, channelMark, deviceMark, providerMark } from \"./marks\";\n\n/** What each part of what it works with is, at a glance: bare, beside its name. */\nconst TOPIC_GLYPHS: Readonly<Record<Topic, Glyph>> = {\n apps: PuzzlePieceIcon,\n tools: WrenchIcon,\n knowledge: BooksIcon,\n learning: LightbulbIcon,\n channels: BroadcastIcon,\n keys: KeyIcon,\n};\nimport type { Channel, ChannelStatus } from \"./types\";\nimport { agentTint } from \"./tint\";\nimport { usePolled } from \"./usePolled\";\n\n/** The words Qué puede says; a host gives its own, in its language. */\nexport interface AboutMessages {\n /** While the words are read, before anything is known. */\n loading: string;\n /** While the agent writes what it does the first time: a model call, a few seconds. */\n writing: (name: string) => string;\n /** Under the words while the agent writes them again, because it changed since. */\n updating: string;\n /** The button that tries again when the words could not be read or written. */\n refresh: string;\n /** Over what it asks the person's leave for. */\n asks: string;\n /** Over the tools that come with every agent, when it has its own too. */\n builtIn: string;\n /** The words could not be read or written; the server's own sentence follows when it gave one. */\n failed: string;\n /** Over what it does on its own. */\n does: string;\n /** In their place when it does nothing on its own yet. */\n noAutomations: string;\n /** On an automation that is off. */\n paused: string;\n /** What an automation waits for, when the agent hasn't said when yet. */\n kinds: Readonly<Record<AutomationKind, string>>;\n /** Each topic's name, on its tile and over it when open. */\n topics: Readonly<Record<Topic, string>>;\n /** A topic with nothing: on its row, and as its one line when open. */\n empty: Readonly<Record<Topic, string>>;\n /** Under an open topic's name: what it is, in a line. */\n hints: Readonly<Record<Topic, string>>;\n /** Over what is the agent's own, inside what it knows and its keys. */\n theirs: (name: string) => string;\n /** Over what is the organization's, shared with every agent: said once, by this heading. */\n organization: string;\n /** Over the tables, inside what it knows. */\n tables: string;\n /** Under a file `search_files` does not read: it is only kept. */\n kept: string;\n /** Beside a tool that is off. */\n off: string;\n /** What it may do in a table, beside it. */\n can: Readonly<Record<string, string>>;\n /** Over the words, and on the way back from a topic: who this is about. */\n title: (name: string) => string;\n /** Over the topics. */\n facts: string;\n /** In place of a run that is no longer there. */\n runGone: string;\n /** What the kit's pieces say in it (an automation, a run): their words, in the host's language. */\n kit: Partial<KitMessages>;\n /** A shipped action's name in the owner's words, by its code name; the rest keep the code name. */\n actions: Readonly<Record<string, string>>;\n /** A file's size, as the host's people read it. */\n size: (bytes: number) => string;\n /** When a memory was kept, beside it. */\n ago: (when: Date) => string;\n /** A channel's name, by its kind: its row's title. */\n channelNames: Readonly<Record<ChannelKind, string>>;\n /** How a channel stands, beside its dot. */\n channelStates: Readonly<Record<ChannelStatus, string>>;\n /** The provider's word on a channel's status (English, as the API keeps it), in the host's. */\n channelDetail: (detail: string) => string;\n}\n\nexport const ABOUT_MESSAGES: AboutMessages = {\n loading: \"Loading…\",\n writing: (name) => `${name} is writing down what it does…`,\n updating: \"Updating…\",\n refresh: \"Try again\",\n asks: \"It asks you before\",\n builtIn: \"Built in\",\n failed: \"What it can do could not be read.\",\n does: \"What it does on its own\",\n noAutomations: \"Nothing on its own yet: it answers when someone writes to it.\",\n paused: \"Paused\",\n kinds: { schedule: \"At a time\", webhook: \"When called\", event: \"On an event\" },\n topics: {\n apps: \"Apps\",\n tools: \"Tools\",\n knowledge: \"Knowledge\",\n learning: \"Learning\",\n channels: \"Channels\",\n keys: \"Keys\",\n },\n empty: {\n apps: \"None yet\",\n tools: \"None on\",\n knowledge: \"Nothing yet\",\n learning: \"Nothing yet\",\n channels: \"None yet\",\n keys: \"None\",\n },\n hints: {\n apps: \"The business's apps it uses, and what it may do in each.\",\n tools: \"What it can do while it talks with someone.\",\n knowledge: \"The documents and tables it reads to answer.\",\n learning: \"What it has learned from its conversations.\",\n channels: \"Where it works: where people write to it, and the devices it uses.\",\n keys: \"Passwords and keys it uses, kept sealed.\",\n },\n theirs: (name) => `${name}'s own`,\n organization: \"The organization's\",\n tables: \"Tables\",\n kept: \"Only kept\",\n off: \"off\",\n can: { find: \"looks up\", add: \"adds\", update: \"changes\" },\n title: (name) => `About ${name}`,\n facts: \"What it works with\",\n runGone: \"This run is no longer there.\",\n kit: KIT_MESSAGES,\n actions: {},\n size: (bytes) => formatSize(bytes),\n ago: (when) => when.toLocaleDateString(),\n channelNames: {\n whatsapp: \"WhatsApp\",\n instagram: \"Instagram\",\n sms: \"SMS\",\n email: \"Email\",\n web: \"Web chat\",\n phone: \"Phone\",\n },\n channelStates: {\n active: \"Active\",\n pending: \"Pending\",\n error: \"Error\",\n disconnected: \"Disconnected\",\n },\n channelDetail: (detail) => detail,\n};\n\n/** The parts, by the class each carries; `classNames` adds a host's own under the same keys. */\nexport type AboutPart =\n | \"sc-about\"\n | \"sc-about__pane\"\n | \"sc-about__intro\"\n | \"sc-about__heading\"\n | \"sc-about__name\"\n | \"sc-about__topics\"\n | \"sc-about__topic\"\n | \"sc-about__topic-name\"\n | \"sc-about__topic-none\"\n | \"sc-about__topic-count\"\n | \"sc-about__topic-go\"\n | \"sc-about__lead\"\n | \"sc-about__updated\"\n | \"sc-about__updating\"\n | \"sc-about__section\"\n | \"sc-about__label\"\n | \"sc-about__asks\"\n | \"sc-about__menu\"\n | \"sc-about__memory\"\n | \"sc-about__back\"\n | \"sc-about__bar\"\n | \"sc-about__bar-end\"\n | \"sc-about__automation\"\n | \"sc-about__run\"\n | \"sc-about__group\"\n | \"sc-about__title\"\n | \"sc-about__subtitle\"\n | \"sc-about__file\"\n | \"sc-about__detail\"\n | \"sc-about__hint\"\n | \"sc-about__count\"\n | \"sc-about__tools\"\n | \"sc-about__dot\"\n | \"sc-about__state\"\n | \"sc-about__empty\"\n | \"sc-about__writing\";\n\n/** The panel's own parts and the kit's it is drawn with: a host styles both under one prop. */\ntype ClassNames = Partial<Record<AboutPart | KitPart, string>> | undefined;\n\n/** What a host's control is given, besides the thing it stands beside. */\nexport interface AboutTools {\n /**\n * Reads the facts again, and has the agent write its words anew when the change made them\n * stale; the open topic stays. Call it after a change.\n */\n refresh: () => Promise<void>;\n}\n\ntype Control<T> = ((thing: T, tools: AboutTools) => ReactNode) | undefined;\n\n/**\n * The host's own controls: the package only reads, a host that lets its people change things\n * draws them here. Each one is drawn at the right end of what it stands beside.\n */\nexport interface AboutControls {\n /** Over what it does on its own (a new automation). */\n newAutomation?: ((tools: AboutTools) => ReactNode) | undefined;\n /** On each automation (switch it off, delete it). */\n automation?: Control<AutomationFact>;\n /** Under its automations: what else it does on its own (the tasks it runs for contacts). */\n automationsNote?: ((tools: AboutTools) => ReactNode) | undefined;\n /** Over an open topic (add an app, upload a file, add a key). */\n topic?: Partial<Record<Topic, (tools: AboutTools) => ReactNode>> | undefined;\n app?: Control<ConnectionFact>;\n tool?: Control<ActionFact>;\n file?: Control<FileFact>;\n table?: Control<DataFact>;\n memory?: Control<MemoryFact>;\n key?: Control<VaultFact>;\n /** On each channel the agent answers (its settings, a check, disconnecting it). */\n channel?: Control<Channel>;\n}\n\n/**\n * How a host draws an app's mark, with its own brands (the package carries none): v2's\n * `AppDirectory`. `provider` says the catalog and the app (`arcade:gmail`); `icon` is the one the\n * provider declares, when it does.\n */\nexport interface AppDirectory {\n logo: (app: {\n provider: string;\n name: string;\n icon?: string | null | undefined;\n size: number;\n }) => ReactNode;\n}\n\nexport interface AgentAboutProps {\n client: Client;\n agentId: string;\n /** Its mark (`AGENT_ICONS`), drawn beside its name in its tint; a sparkle until it has one. */\n icon?: string | null | undefined;\n /** The agent's name, for the words that address it. */\n name: string;\n messages?: Partial<AboutMessages> | undefined;\n classNames?: ClassNames;\n controls?: AboutControls | undefined;\n /** The host's logos for apps; without them an app shows the mark its provider gives. */\n apps?: AppDirectory | undefined;\n /**\n * Opens a file the owner presses in what it knows (in the host's viewer: `FileView` in a\n * dialog); without it the files are only listed.\n */\n onOpenFile?: ((file: FileFact) => void) | undefined;\n /**\n * What is open in it: its home, a topic, an automation, a run of one. Given, the host keeps it\n * (in its address, say) and hears each move through `onViewChange`; without it the panel keeps\n * its own.\n */\n view?: AboutView | undefined;\n onViewChange?: ((view: AboutView) => void) | undefined;\n /** Opens a conversation a run opened or was asked in; without it, none opens. */\n onOpenConversation?: ((id: string) => void) | undefined;\n /** The language its dates and times are said in. */\n locale?: KitLocale | undefined;\n}\n\n/**\n * What is open in the panel, one level under another: its home; a topic or an automation from\n * it; a run from its automation.\n */\nexport type AboutView =\n | { kind: \"home\" }\n | { kind: \"topic\"; topic: Topic }\n | { kind: \"automation\"; name: string }\n | { kind: \"run\"; name: string; run: string };\n\nexport const ABOUT_HOME: AboutView = { kind: \"home\" };\n\n/** How far a view is from the home: what says whether a move goes in or back out. */\nconst depthOf = (view: AboutView): number =>\n view.kind === \"home\" ? 0 : view.kind === \"run\" ? 2 : 1;\n\n/** A view as one string: what tells two apart. */\nconst keyOf = (view: AboutView): string =>\n view.kind === \"home\"\n ? \"home\"\n : view.kind === \"topic\"\n ? `topic:${view.topic}`\n : view.kind === \"automation\"\n ? `automation:${view.name}`\n : `run:${view.name}:${view.run}`;\n\n/** The view a step back from `view` goes to. */\nexport function aboutBack(view: AboutView): AboutView {\n return view.kind === \"run\" ? { kind: \"automation\", name: view.name } : ABOUT_HOME;\n}\n\n/**\n * Qué puede, made to sit beside the conversation: who it is about, in its own words (a line or\n * two); what it does on its own, one row per automation (its kind's mark, or its app's logo),\n * what it does and when, as the agent tells it; what it asks leave for; then what it works with,\n * as a grid of tiles, one per topic (its apps, tools, what it knows and has learned, where it\n * works, its keys), each with its count and a glimpse of what it holds, opening it in the same\n * place. Every list is the kit's `List` and `Row`, and every tile its `Tile`, the ones an agent's\n * screens use, so a host styles them once. The words are written by the agent the first time and\n * again whenever it changed since, by themselves. The component only reads; a host draws its own\n * controls through `controls` and calls `tools.refresh()` after a change, and opens a file\n * through `onOpenFile`. An automation opens in the panel itself, one level in (what it does, its\n * steps, its runs), and a run one more, each with its way back; `view` lets the host keep where\n * it is. Another agent starts afresh.\n */\nexport function AgentAbout(props: AgentAboutProps) {\n return (\n <KitProvider\n classNames={props.classNames as KitClassNames}\n messages={props.messages?.kit}\n locale={props.locale}\n >\n <View key={props.agentId} {...props} />\n </KitProvider>\n );\n}\n\nfunction View({\n client,\n agentId,\n icon,\n name,\n messages,\n classNames,\n controls,\n apps,\n onOpenFile,\n view: given,\n onViewChange,\n onOpenConversation,\n}: AgentAboutProps) {\n const words = { ...ABOUT_MESSAGES, ...messages };\n const [data, setData] = useState<AboutOut | null>(null);\n const [live, setLive] = useState<readonly Standing[] | null>(null);\n const [writing, setWriting] = useState(false);\n const [problem, setProblem] = useState<unknown>(null);\n // Every change the host makes reads the open automation or run again, too.\n const [version, setVersion] = useState(0);\n const [own, setOwn] = useState<AboutView>(ABOUT_HOME);\n const view = given ?? own;\n const motion = useMotion(view);\n const root = useRef<HTMLDivElement>(null);\n const scrolled = useRef(new Map<string, number>());\n const intro = useId();\n\n /** Opens `next`, keeping where the panel was scrolled to on the way in, for the way back. */\n const go = (next: AboutView) => {\n const scroller = scrollerOf(root.current);\n if (scroller !== null && depthOf(next) > depthOf(view)) {\n scrolled.current.set(keyOf(view), scroller.scrollTop);\n }\n (onViewChange ?? setOwn)(next);\n };\n\n // A view opens at its top, or back where it was left.\n const shown = keyOf(view);\n useLayoutEffect(() => {\n const scroller = scrollerOf(root.current);\n if (scroller !== null) scroller.scrollTop = scrolled.current.get(shown) ?? 0;\n }, [shown]);\n\n // Each call takes `still`, whether its answer is still wanted: a mount undone before the answer\n // (StrictMode runs effects twice) keeps nothing, so one writing runs, not two.\n\n /** Has the agent write about itself anew; what it answers is the words and the facts both. */\n const write = useCallback(\n async (still: () => boolean) => {\n setProblem(null);\n setWriting(true);\n try {\n const written = await client.agents.describe(agentId);\n if (still()) setData(written);\n } catch (error) {\n if (still()) setProblem(error);\n } finally {\n if (still()) setWriting(false);\n }\n },\n [client, agentId],\n );\n\n /**\n * Reads the words and the facts, and how each automation stands (a server without them leaves\n * the rows as they were told); when the words are missing or stale, has the agent write them.\n */\n const read = useCallback(\n async (still: () => boolean) => {\n setProblem(null);\n try {\n const [first, standing] = await Promise.all([\n client.agents.about(agentId),\n client.automations.list(agentId).catch(() => null),\n ]);\n if (!still()) return;\n setData(first);\n setLive(standing);\n // Words never written, or written before the agent last changed: it writes them again\n // by itself, so what it says stays true without anyone asking.\n if (first.about === null || first.about_at === null) await write(still);\n } catch (error) {\n if (still()) setProblem(error);\n }\n },\n [client, agentId, write],\n );\n\n useEffect(() => {\n let gone = false;\n void read(() => !gone);\n return () => {\n gone = true;\n };\n }, [read]);\n\n const tools = useMemo<AboutTools>(\n () => ({\n refresh: async () => {\n setVersion((count) => count + 1);\n await read(() => true);\n },\n }),\n [read],\n );\n // What to try again after a failure: the reading when nothing was read, the writing otherwise.\n const retry = () => (data === null ? read(() => true) : write(() => true));\n // A tool by the owner's words for it; one of its own code, by its name made words.\n const label = (action: ActionFact) =>\n action.source === \"own\" ? toolName(action.name) : (words.actions[action.name] ?? action.name);\n const pane = (bar: ReactNode, children: ReactNode) => (\n <div ref={root} className={`sc ${classes(classNames, \"sc-about\")}`}>\n <div key={shown} data-motion={motion} className={classes(classNames, \"sc-about__pane\")}>\n {bar}\n {children}\n </div>\n </div>\n );\n const home = words.title(name);\n\n if (view.kind === \"topic\" && data !== null) {\n return pane(\n <Bar back={home} onBack={() => go(ABOUT_HOME)} classNames={classNames} />,\n <TopicView\n client={client}\n agentId={agentId}\n name={name}\n version={version}\n topic={view.topic}\n facts={data.facts}\n apps={apps}\n label={label}\n words={words}\n classNames={classNames}\n tools={tools}\n controls={controls}\n onOpenFile={onOpenFile}\n />,\n );\n }\n\n if (view.kind === \"automation\") {\n const fact = data?.facts.automations.find((each) => each.name === view.name);\n return pane(\n <Bar\n back={home}\n onBack={() => go(ABOUT_HOME)}\n end={fact !== undefined ? controls?.automation?.(fact, tools) : undefined}\n classNames={classNames}\n />,\n <AutomationPane\n key={version}\n client={client}\n agentId={agentId}\n name={view.name}\n apps={apps}\n words={words}\n classNames={classNames}\n onOpenRun={(run) => go({ kind: \"run\", name: view.name, run: run.id })}\n />,\n );\n }\n\n if (view.kind === \"run\") {\n return pane(\n <Bar\n back={live?.find((each) => each.name === view.name)?.title ?? home}\n onBack={() => go({ kind: \"automation\", name: view.name })}\n classNames={classNames}\n />,\n <RunPane\n key={version}\n client={client}\n agentId={agentId}\n name={view.name}\n run={view.run}\n apps={apps}\n words={words}\n classNames={classNames}\n onOpenConversation={onOpenConversation}\n />,\n );\n }\n\n const state = data === null ? null : aboutState(data.about, data.about_at, writing);\n return pane(\n null,\n <>\n <section aria-labelledby={intro} className={classes(classNames, \"sc-about__intro\")}>\n <AgentName\n id={intro}\n agentId={agentId}\n icon={icon}\n name={name}\n label={home}\n classNames={classNames}\n />\n {problem !== null ? (\n <Problem words={words} classNames={classNames} onRetry={retry}>\n {words.failed}\n {problem instanceof ApiError && ` ${problem.detail}`}\n </Problem>\n ) : data === null || data.about === null ? (\n <Writing\n text={data === null ? words.loading : words.writing(name)}\n classNames={classNames}\n />\n ) : (\n <p className={classes(classNames, \"sc-about__lead\")}>{data.about.summary}</p>\n )}\n {state === \"writing\" && data?.about != null && (\n <p role=\"status\" className={classes(classNames, \"sc-about__updating\")}>\n {words.updating}\n </p>\n )}\n </section>\n {data !== null && (\n <>\n <Automations\n apps={apps}\n told={automationsOf(data.about, data.facts)}\n live={live}\n words={words}\n classNames={classNames}\n tools={tools}\n controls={controls}\n onOpen={(automation) => go({ kind: \"automation\", name: automation.name })}\n />\n {data.about !== null && data.about.asks.length > 0 && (\n <Asks asks={data.about.asks} words={words} classNames={classNames} />\n )}\n <nav aria-label={words.facts} className={classes(classNames, \"sc-about__menu\")}>\n <p className={classes(classNames, \"sc-about__label\")}>{words.facts}</p>\n <div className={classes(classNames, \"sc-about__topics\")}>\n {HOME_TOPICS.map((topic) => (\n <TopicRow\n key={topic}\n topic={topic}\n facts={data.facts}\n apps={apps}\n words={words}\n classNames={classNames}\n onOpen={() => go({ kind: \"topic\", topic })}\n />\n ))}\n </div>\n </nav>\n </>\n )}\n </>,\n );\n}\n\n/**\n * What the panel's home shows the agent works with, in the order the owner looks for it: where\n * people reach it, the apps it uses, what it knows, what it learned, its keys. Its tools are\n * the platform's business: they show in the technical view, not here.\n */\nconst HOME_TOPICS: readonly Topic[] = [\"channels\", \"apps\", \"knowledge\", \"learning\", \"keys\"];\n\n/** How many icons a topic's row draws before \"+N\". */\nconst MOST_MARKS = 5;\n\n/**\n * A topic on the panel's home, as icons: its name, then what it holds as their logos or marks\n * (the channels', the apps', the files') and how many; a topic with nothing says so, quietly.\n * Pressing it opens the topic.\n */\nfunction TopicRow({\n topic,\n facts,\n apps,\n words,\n classNames,\n onOpen,\n}: {\n topic: Topic;\n facts: Facts;\n apps: AppDirectory | undefined;\n words: AboutMessages;\n classNames: ClassNames;\n onOpen: () => void;\n}) {\n const count = countOf(topic, facts);\n return (\n <button\n type=\"button\"\n onClick={onOpen}\n data-empty={count === 0 || undefined}\n className={classes(classNames, \"sc-about__topic\")}\n >\n <span className={classes(classNames, \"sc-about__topic-name\")}>{words.topics[topic]}</span>\n {count === 0 ? (\n <span className={classes(classNames, \"sc-about__topic-none\")}>{words.empty[topic]}</span>\n ) : (\n <>\n <TopicMarks topic={topic} facts={facts} apps={apps} words={words} count={count} />\n <span className={classes(classNames, \"sc-about__topic-count\")}>{count}</span>\n </>\n )}\n <svg\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n aria-hidden\n className={classes(classNames, \"sc-about__topic-go\")}\n >\n <path\n d=\"M6 3.5 10.5 8 6 12.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </button>\n );\n}\n\n/** What a topic holds, as icons: each channel's and app's logo, each file's mark; else its glyph. */\nfunction TopicMarks({\n topic,\n facts,\n apps,\n words,\n count,\n}: {\n topic: Topic;\n facts: Facts;\n apps: AppDirectory | undefined;\n words: AboutMessages;\n count: number;\n}) {\n const marks: ReactNode[] =\n topic === \"channels\"\n ? facts.channels.map((channel) => (\n <span key={`${channel.kind}:${channel.name}`}>\n {channelLogo(channel.kind, apps, words, 20)}\n </span>\n ))\n : topic === \"apps\"\n ? facts.connections.map((connection) => (\n <span key={connection.name}>{appMark(connectionApp(connection), apps, 20)}</span>\n ))\n : topic === \"knowledge\"\n ? facts.files.map((file) => <FileMark key={file.path} name={file.path} size={20} />)\n : [<Mark key={topic} icon={TOPIC_GLYPHS[topic]} size={20} />];\n const shown = marks.slice(0, MOST_MARKS);\n const drawn = topic === \"learning\" || topic === \"keys\" ? 0 : count;\n return <MarkStack more={Math.max(0, drawn - shown.length)}>{shown}</MarkStack>;\n}\n\n/**\n * Who the panel is about, at its top: the agent's mark in its tint, bare, beside its name; the\n * panel's title (\"About Ana\") stays for screen readers.\n */\nfunction AgentName({\n id,\n agentId,\n icon,\n name,\n label,\n classNames,\n}: {\n id: string;\n agentId: string;\n icon: string | null | undefined;\n name: string;\n label: string;\n classNames: ClassNames;\n}) {\n const Glyph = agentGlyph(icon);\n return (\n <h2\n id={id}\n aria-label={label}\n data-tint={agentTint(agentId)}\n className={classes(classNames, \"sc-about__name\")}\n >\n <Glyph aria-hidden weight=\"duotone\" />\n <span>{name}</span>\n </h2>\n );\n}\n\n/**\n * Which way the panel moved to show `view`: in (one level deeper), back out, or nowhere (the first\n * view). Kept per view, so a view's own updates never replay it.\n */\nfunction useMotion(view: AboutView): \"in\" | \"out\" | undefined {\n const key = keyOf(view);\n const depth = depthOf(view);\n const [moved, setMoved] = useState<{\n key: string;\n depth: number;\n motion: \"in\" | \"out\" | undefined;\n }>({ key, depth, motion: undefined });\n if (moved.key !== key) {\n setMoved({ key, depth, motion: depth >= moved.depth ? \"in\" : \"out\" });\n }\n return moved.motion;\n}\n\n/** The nearest box around `element` that scrolls: where the panel's place is kept. */\nfunction scrollerOf(element: HTMLElement | null): HTMLElement | null {\n for (let at = element?.parentElement ?? null; at !== null; at = at.parentElement) {\n const overflow = getComputedStyle(at).overflowY;\n if (overflow === \"auto\" || overflow === \"scroll\") return at;\n }\n return null;\n}\n\n/**\n * The bar over a view opened from another: the way back to it, named, at its start; the host's\n * controls at its end. It stays at the top as the view scrolls.\n */\nfunction Bar({\n back,\n onBack,\n end,\n classNames,\n}: {\n back: string;\n onBack: () => void;\n end?: ReactNode;\n classNames: ClassNames;\n}) {\n return (\n <div className={classes(classNames, \"sc-about__bar\")}>\n <button type=\"button\" onClick={onBack} className={classes(classNames, \"sc-about__back\")}>\n <svg viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden>\n <path\n d=\"M10 3.5 5.5 8l4.5 4.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n <span>{back}</span>\n </button>\n {end != null && <span className={classes(classNames, \"sc-about__bar-end\")}>{end}</span>}\n </div>\n );\n}\n\n/**\n * An automation, open in the panel: what starts it and when it runs next, the owner's sentence,\n * its steps, the table it moves, its runs (each opening its record). Read again every few\n * seconds while a run of it is under way.\n */\nfunction AutomationPane({\n client,\n agentId,\n name,\n apps,\n words,\n classNames,\n onOpenRun,\n}: Drawn & {\n client: Client;\n agentId: string;\n name: string;\n apps: AppDirectory | undefined;\n onOpenRun: (run: Run) => void;\n}) {\n const { messages } = useKit();\n const read = usePolled(\n () => client.automations.get(agentId, name),\n `${agentId}:${name}`,\n (automation) => automation.runs.some((run) => run.status === \"running\"),\n );\n if (read.gone) return <Gone classNames={classNames}>{messages.automation.gone}</Gone>;\n if (read.value === null) {\n return read.problem === null ? (\n <Loading words={words} classNames={classNames} />\n ) : (\n <Gone classNames={classNames}>{words.failed}</Gone>\n );\n }\n return (\n <Automation\n className={classes(classNames, \"sc-about__automation\")}\n automation={read.value}\n runs={read.value.runs}\n apps={apps}\n onOpenRun={onOpenRun}\n />\n );\n}\n\n/**\n * A run, open in the panel: how it went, step by step in words, what it opened. Read with its\n * automation (its steps' order and its apps' names), again while it is under way.\n */\nfunction RunPane({\n client,\n agentId,\n name,\n run,\n apps,\n words,\n classNames,\n onOpenConversation,\n}: Drawn & {\n client: Client;\n agentId: string;\n name: string;\n run: string;\n apps: AppDirectory | undefined;\n onOpenConversation: ((id: string) => void) | undefined;\n}) {\n const read = usePolled(\n async () => {\n const [record, automation] = await Promise.all([\n client.runs.get(run),\n client.automations.get(agentId, name).catch(() => null),\n ]);\n return { record, automation };\n },\n run,\n ({ record }) => record.status === \"running\",\n );\n if (read.gone) return <Gone classNames={classNames}>{words.runGone}</Gone>;\n if (read.value === null) {\n return read.problem === null ? (\n <Loading words={words} classNames={classNames} />\n ) : (\n <Gone classNames={classNames}>{words.failed}</Gone>\n );\n }\n return (\n <RunView\n className={classes(classNames, \"sc-about__run\")}\n run={read.value.record}\n automation={read.value.automation}\n apps={apps}\n onOpenConversation={onOpenConversation}\n />\n );\n}\n\n/** A view whose thing is being read: lines with a light sweeping them. */\nfunction Loading({ words, classNames }: Drawn) {\n return <Writing text={words.loading} classNames={classNames} />;\n}\n\n/** In place of what is no longer there, or could not be read. */\nfunction Gone({ classNames, children }: { classNames: ClassNames; children: ReactNode }) {\n return <p className={classes(classNames, \"sc-about__empty\")}>{children}</p>;\n}\n\n/** An automation's mark says its kind: a time, a call from another system, an event. */\nconst KIND_ICONS: Readonly<Record<AutomationKind, Icon>> = {\n schedule: \"clock\",\n webhook: \"code\",\n event: \"bell\",\n};\n\n/** An app's mark: the host's logo when it draws one, else the provider's, bare. */\nfunction appMark(\n app: { provider: string; name: string; icon?: string | null | undefined },\n apps: AppDirectory | undefined,\n size: number,\n) {\n if (apps !== undefined) return apps.logo({ ...app, size });\n return (\n <Mark logo size={size}>\n {providerMark(app.provider.split(\":\")[0] as Provider, app.icon ?? undefined)}\n </Mark>\n );\n}\n\nconst connectionApp = (connection: ConnectionFact) => ({\n provider: `${connection.provider}:${connection.toolkit ?? connection.name}`,\n name: appTitle(connection),\n icon: connection.icon,\n});\n\n/**\n * A channel's mark: the host's logo for its brand when it draws apps (WhatsApp, Instagram, the\n * plain mark of a text message), else the package's glyph, bare.\n */\nfunction channelLogo(\n kind: ChannelKind,\n apps: AppDirectory | undefined,\n words: AboutMessages,\n size: number,\n) {\n if (apps !== undefined)\n return apps.logo({ provider: kind, name: words.channelNames[kind], size });\n return <Mark size={size}>{channelMark(kind)}</Mark>;\n}\n\ninterface Drawn {\n words: AboutMessages;\n classNames: ClassNames;\n}\n\n/** What could not be read or written, in the warning tone, and the button to try again. */\nfunction Problem({\n words,\n classNames,\n onRetry,\n children,\n}: Drawn & { onRetry: () => Promise<void>; children: ReactNode }) {\n return (\n <p role=\"alert\" className={classes(classNames, \"sc-about__updated\")}>\n <span>{children}</span>\n <button type=\"button\" onClick={() => void onRetry()}>\n {words.refresh}\n </button>\n </p>\n );\n}\n\n/** The agent writing: the lead's lines with a light sweeping them, and the sentence saying so. */\nfunction Writing({ text, classNames }: { text: string; classNames: ClassNames }) {\n return (\n <div role=\"status\" className={classes(classNames, \"sc-about__writing\")}>\n <div aria-hidden>\n <i />\n <i />\n </div>\n <p>{text}</p>\n </div>\n );\n}\n\n/** What it asks leave for: its label, then the things, a short list. */\nfunction Asks({ asks, words, classNames }: Drawn & { asks: string[] }) {\n const id = useId();\n return (\n <section\n aria-labelledby={id}\n className={classes(classNames, \"sc-about__section\", \"sc-about__asks\")}\n >\n <div className={classes(classNames, \"sc-about__label\")}>\n <h3 id={id}>{words.asks}</h3>\n </div>\n <ul>\n {asks.map((ask, index) => (\n <li key={index}>{ask}</li>\n ))}\n </ul>\n </section>\n );\n}\n\n/**\n * What it does on its own: one row per automation, its kind's mark (or, on an app's event, the\n * app's logo), what it does then over when, as the agent tells it (its title and its kind until\n * it has), a paused one quieter; how it stands now when that needs a look (a run under way, the\n * last one failed); the host's control at each row's end, and over them the way to a new one. A\n * row opens its automation.\n */\nfunction Automations({\n told,\n live,\n words,\n classNames,\n tools,\n controls,\n apps,\n onOpen,\n}: Drawn & {\n told: Told[];\n live: readonly Standing[] | null;\n tools: AboutTools;\n controls: AboutControls | undefined;\n apps: AppDirectory | undefined;\n onOpen: (automation: AutomationFact) => void;\n}) {\n const id = useId();\n const { messages } = useKit();\n const standing = new Map(live?.map((automation) => [automation.name, automation]));\n return (\n <section aria-labelledby={id} className={classes(classNames, \"sc-about__section\")}>\n <div className={classes(classNames, \"sc-about__label\")}>\n <h3 id={id}>{words.does}</h3>\n {controls?.newAutomation !== undefined && (\n <span className={classes(classNames, \"sc-about__tools\")}>\n {controls.newAutomation(tools)}\n </span>\n )}\n </div>\n {told.length === 0 ? (\n <p className={classes(classNames, \"sc-about__empty\")}>{words.noAutomations}</p>\n ) : (\n <List>\n {told.map(({ automation, line }) => {\n const when = line?.when ?? words.kinds[automation.kind];\n const now = standing.get(automation.name);\n const going = now?.last_run?.status === \"running\";\n return (\n <Row\n key={automation.id}\n mark={\n automation.provider === undefined ? (\n <Mark icon={GLYPHS[KIND_ICONS[automation.kind]]} />\n ) : (\n appMark(\n {\n provider: automation.provider,\n name:\n automation.app_title ?? toolName(automation.app ?? automation.provider),\n icon: automation.icon,\n },\n apps,\n 28,\n )\n )\n }\n title={line?.text ?? automation.title}\n subtitle={when}\n error={now?.state === \"failing\" ? messages.automation.states.failing : undefined}\n meta={\n going ? (\n <Tag tone=\"info\">\n <i aria-hidden className={classes(classNames, \"sc-run__live\")} />\n {messages.automation.statuses.running}\n </Tag>\n ) : automation.on ? undefined : (\n <Tag>{words.paused}</Tag>\n )\n }\n quiet={!automation.on}\n onPress={() => onOpen(automation)}\n trailing={controls?.automation?.(automation, tools)}\n />\n );\n })}\n </List>\n )}\n {controls?.automationsNote?.(tools)}\n </section>\n );\n}\n\n/**\n * One topic, open: its name with its count and the host's control, a line saying what it is, then\n * its rows (what it knows as its files and its tables; what it learned; the rest with a mark and\n * a note), or its one line when it holds nothing.\n */\nfunction TopicView({\n client,\n agentId,\n name,\n version,\n topic,\n facts,\n apps,\n label,\n words,\n classNames,\n tools,\n controls,\n onOpenFile,\n}: Drawn & {\n client: Client;\n agentId: string;\n /** The agent's name, over what is its own. */\n name: string;\n /** Moves with every change the host makes: what the topic reads itself, it reads again. */\n version: number;\n topic: Topic;\n facts: Facts;\n apps: AppDirectory | undefined;\n label: (action: ActionFact) => string;\n tools: AboutTools;\n controls: AboutControls | undefined;\n onOpenFile: ((file: FileFact) => void) | undefined;\n}) {\n const id = useId();\n const tool = controls?.topic?.[topic];\n const count = countOf(topic, facts);\n // The tools are all listed, the ones that are off too: they are what the owner turns on.\n const shown = topic === \"tools\" ? facts.actions.length : count;\n return (\n <section aria-labelledby={id} className={classes(classNames, \"sc-about__group\")}>\n <h3 id={id} className={classes(classNames, \"sc-about__title\")}>\n <span>{words.topics[topic]}</span>\n {count > 0 && <b className={classes(classNames, \"sc-about__count\")}>{count}</b>}\n {tool !== undefined && (\n <span className={classes(classNames, \"sc-about__tools\")}>{tool(tools)}</span>\n )}\n </h3>\n <p className={classes(classNames, \"sc-about__hint\")}>{words.hints[topic]}</p>\n {topic === \"channels\" ? (\n <Channels\n client={client}\n agentId={agentId}\n version={version}\n facts={facts}\n apps={apps}\n words={words}\n classNames={classNames}\n tools={tools}\n controls={controls}\n />\n ) : shown === 0 ? (\n <p className={classes(classNames, \"sc-about__empty\")}>{words.empty[topic]}</p>\n ) : topic === \"knowledge\" ? (\n <Knowledge\n name={name}\n facts={facts}\n words={words}\n classNames={classNames}\n tools={tools}\n controls={controls}\n onOpenFile={onOpenFile}\n />\n ) : topic === \"tools\" ? (\n <Tools\n name={name}\n facts={facts}\n label={label}\n words={words}\n classNames={classNames}\n tools={tools}\n controls={controls}\n />\n ) : topic === \"keys\" ? (\n <Keys\n name={name}\n facts={facts}\n words={words}\n classNames={classNames}\n tools={tools}\n controls={controls}\n />\n ) : topic === \"learning\" ? (\n <List>\n {facts.memories.map((memory) => (\n <Row\n key={memory.id}\n className={classes(classNames, \"sc-about__memory\")}\n title={memory.text}\n subtitle={words.ago(new Date(memory.created_at))}\n trailing={controls?.memory?.(memory, tools)}\n />\n ))}\n </List>\n ) : (\n <Rows items={appItems(facts, tools, controls, apps)} classNames={classNames} />\n )}\n </section>\n );\n}\n\n/** How each state of a channel reads beside its dot: working, waiting, broken, or off. */\nconst CHANNEL_TONES: Readonly<Record<ChannelStatus, StatusTone | \"wait\">> = {\n active: \"on\",\n pending: \"wait\",\n error: \"off\",\n disconnected: \"quiet\",\n};\n\nconst isStatus = (status: string): status is ChannelStatus => status in CHANNEL_TONES;\n\n/** The order channels are listed in: by kind, as people reach a business most; disconnected last. */\nconst KIND_ORDER: readonly ChannelKind[] = [\n \"whatsapp\",\n \"instagram\",\n \"sms\",\n \"email\",\n \"web\",\n \"phone\",\n];\n\nconst inOrder = (channels: readonly Channel[]): Channel[] =>\n [...channels].sort(\n (a, b) =>\n Number(a.status === \"disconnected\") - Number(b.status === \"disconnected\") ||\n KIND_ORDER.indexOf(a.kind) - KIND_ORDER.indexOf(b.kind),\n );\n\n/**\n * Where it works: each channel it answers, as the API lists them (WhatsApp, Instagram, SMS; the\n * disconnected ones last, quieter), by its brand's mark and name, its number or handle, how it stands with the\n * provider's word on it, and the host's control at its end; then the devices it uses. Read\n * when the topic opens and after each change the host makes; until then, or on a server without\n * the list, the facts' rows.\n */\nfunction Channels({\n client,\n agentId,\n version,\n facts,\n apps,\n words,\n classNames,\n tools,\n controls,\n}: Drawn & {\n client: Client;\n agentId: string;\n version: number;\n facts: Facts;\n apps: AppDirectory | undefined;\n tools: AboutTools;\n controls: AboutControls | undefined;\n}) {\n const [listed, setListed] = useState<readonly Channel[] | null>(null);\n useEffect(() => {\n let gone = false;\n client.channels.list(agentId).then(\n (channels) => {\n if (!gone) setListed(channels);\n },\n () => undefined,\n );\n return () => {\n gone = true;\n };\n }, [client, agentId, version]);\n\n const state = (status: string) => {\n const known = isStatus(status);\n return (\n <span\n data-tone={known ? CHANNEL_TONES[status] : toneOf(status)}\n className={classes(classNames, \"sc-about__state\")}\n >\n <i aria-hidden className={classes(classNames, \"sc-about__dot\")} />\n {known ? words.channelStates[status] : status}\n </span>\n );\n };\n // Its number or handle, and under it the provider's word on it; on an error, that word is why.\n const told = (channel: Channel) => {\n const detail = channel.detail === null ? null : words.channelDetail(channel.detail);\n const error = channel.status === \"error\";\n return {\n subtitle: (\n <>\n {channel.name}\n {!error && detail !== null && detail !== \"\" && (\n <span className={classes(classNames, \"sc-about__detail\")}>{detail}</span>\n )}\n </>\n ),\n error: error ? (detail ?? undefined) : undefined,\n };\n };\n const rows =\n listed === null\n ? facts.channels.map((channel: ChannelFact) => (\n <Row\n key={`${channel.kind}:${channel.name}`}\n mark={channelLogo(channel.kind, apps, words, 28)}\n title={words.channelNames[channel.kind]}\n subtitle={channel.name}\n meta={state(channel.status)}\n />\n ))\n : inOrder(listed).map((channel) => (\n <Row\n key={channel.id}\n mark={channelLogo(channel.kind, apps, words, 28)}\n title={words.channelNames[channel.kind]}\n {...told(channel)}\n meta={state(channel.status)}\n quiet={channel.status === \"disconnected\"}\n trailing={controls?.channel?.(channel, tools) ?? undefined}\n />\n ));\n const devices = facts.devices.map((device) => (\n <Row\n key={`device:${device.kind}:${device.name}`}\n mark={<Mark>{deviceMark(device.kind)}</Mark>}\n title={device.name}\n meta={\n <i\n aria-hidden\n data-tone={toneOf(device.status)}\n className={classes(classNames, \"sc-about__dot\")}\n />\n }\n />\n ));\n if (rows.length + devices.length === 0) {\n return <p className={classes(classNames, \"sc-about__empty\")}>{words.empty.channels}</p>;\n }\n return (\n <List>\n {rows}\n {devices}\n </List>\n );\n}\n\n/**\n * One row of a topic: a mark, a name, a quieter line (what an app may do there, a note), a dot\n * for a status, and the host's control at its end.\n */\ninterface Item {\n key: string;\n mark: ReactNode;\n label: string;\n note?: string | undefined;\n status?: StatusTone | undefined;\n off?: boolean | undefined;\n control?: ReactNode;\n}\n\n/** Its apps: each by its logo and name, what it may do there under it, how it stands at its end. */\nfunction appItems(\n facts: Facts,\n tools: AboutTools,\n controls: AboutControls | undefined,\n apps: AppDirectory | undefined,\n): Item[] {\n return facts.connections.map((connection) => ({\n key: `${connection.provider}:${connection.name}`,\n mark: appMark(connectionApp(connection), apps, 28),\n label: appTitle(connection),\n note: connection.actions.map((action) => toolTitle(connection, action)).join(\", \"),\n status: connection.status === undefined ? undefined : toneOf(connection.status),\n control: controls?.app?.(connection, tools),\n }));\n}\n\n/**\n * What it can do while it talks: its own code's actions, then the ones every agent comes with\n * (each under its heading when it has both); in each, the ones it has first, then the ones the\n * owner can turn on, quieter, saying so.\n */\nfunction Tools({\n name,\n facts,\n label,\n words,\n classNames,\n tools,\n controls,\n}: Drawn & {\n name: string;\n facts: Facts;\n label: (action: ActionFact) => string;\n tools: AboutTools;\n controls: AboutControls | undefined;\n}) {\n const groups = [\n { key: \"own\", title: words.theirs(name), actions: facts.actions.filter(isOwn) },\n { key: \"built\", title: words.builtIn, actions: facts.actions.filter((a) => !isOwn(a)) },\n ].filter((group) => group.actions.length > 0);\n const rows = (actions: readonly ActionFact[]) => (\n <Rows\n items={[...actions.filter((a) => a.on), ...actions.filter((a) => !a.on)].map((action) => ({\n key: `${action.source}:${action.name}`,\n mark: <Mark>{actionMark(action.name, action.source)}</Mark>,\n label: label(action),\n note: action.on ? undefined : words.off,\n off: !action.on,\n control: controls?.tool?.(action, tools),\n }))}\n classNames={classNames}\n />\n );\n if (groups.length === 1) return rows(groups[0]?.actions ?? []);\n return (\n <>\n {groups.map((group) => (\n <Group key={group.key} title={group.title} classNames={classNames}>\n {rows(group.actions)}\n </Group>\n ))}\n </>\n );\n}\n\nconst isOwn = (action: ActionFact): boolean => action.source === \"own\";\n\n/** A part of a topic under its small heading: whose things they are, or what kind. */\nfunction Group({\n title,\n classNames,\n children,\n}: {\n title: string;\n classNames: ClassNames;\n children: ReactNode;\n}) {\n return (\n <>\n <h4 className={classes(classNames, \"sc-about__subtitle\")}>{title}</h4>\n {children}\n </>\n );\n}\n\n/** What is the agent's own, then the organization's: the heading says whose, once. */\nfunction byOwner<T extends { shared?: boolean | undefined }>(\n things: readonly T[],\n name: string,\n words: AboutMessages,\n): { key: string; title: string; things: T[] }[] {\n return [\n { key: \"own\", title: words.theirs(name), things: things.filter((thing) => !thing.shared) },\n {\n key: \"shared\",\n title: words.organization,\n things: things.filter((thing) => thing.shared === true),\n },\n ].filter((group) => group.things.length > 0);\n}\n\n/**\n * What it knows, by whose it is: its own files, then the organization's (shared with every\n * agent: the heading says so, once), then the tables it reads or writes. A file is its kind's\n * mark, its name on one line, its folder under it (and that it is only kept, when `search_files`\n * does not read it), its size at the right; pressed, the host opens it; the host's controls at\n * its end.\n */\nfunction Knowledge({\n name,\n facts,\n words,\n classNames,\n tools,\n controls,\n onOpenFile,\n}: Drawn & {\n name: string;\n facts: Facts;\n tools: AboutTools;\n controls: AboutControls | undefined;\n onOpenFile: ((file: FileFact) => void) | undefined;\n}) {\n return (\n <>\n {byOwner(facts.files, name, words).map((group) => (\n <Group key={group.key} title={group.title} classNames={classNames}>\n <List>\n {group.things.map((file) => (\n <Row\n key={file.path}\n className={classes(classNames, \"sc-about__file\")}\n mark={<FileMark name={file.path} />}\n title={<span title={file.path}>{baseName(file.path)}</span>}\n subtitle={fileLine(file, words)}\n meta={words.size(file.size)}\n onPress={onOpenFile && (() => onOpenFile(file))}\n trailing={controls?.file?.(file, tools) ?? undefined}\n />\n ))}\n </List>\n </Group>\n ))}\n {facts.data.length > 0 && (\n <Group title={words.tables} classNames={classNames}>\n <Rows\n items={facts.data.map((table) => ({\n key: table.table,\n mark: <Mark icon={GLYPHS.table} />,\n label: table.title ?? table.table,\n note: table.can.map((can) => words.can[can] ?? can).join(\", \"),\n control: controls?.table?.(table, tools),\n }))}\n classNames={classNames}\n />\n </Group>\n )}\n </>\n );\n}\n\n/** Under a file's name: its folder, and that it is only kept when nothing reads it at a search. */\nfunction fileLine(file: FileFact, words: AboutMessages): string | undefined {\n const folder = folderOf(file.path);\n if (file.searchable) return folder === \"\" ? undefined : folder;\n return folder === \"\" ? words.kept : `${folder} · ${words.kept}`;\n}\n\n/** Its keys, its own then the organization's, each with where it may be sent. */\nfunction Keys({\n name,\n facts,\n words,\n classNames,\n tools,\n controls,\n}: Drawn & {\n name: string;\n facts: Facts;\n tools: AboutTools;\n controls: AboutControls | undefined;\n}) {\n return (\n <>\n {byOwner(facts.vault, name, words).map((group) => (\n <Group key={group.key} title={group.title} classNames={classNames}>\n <Rows\n items={group.things.map((secret) => ({\n key: `${group.key}:${secret.name}`,\n mark: <Mark icon={GLYPHS.lock} />,\n label: secret.name,\n note: secret.hosts?.join(\", \"),\n control: controls?.key?.(secret, tools),\n }))}\n classNames={classNames}\n />\n </Group>\n ))}\n </>\n );\n}\n\n/** The folders a file sits in: \"\" for one at the top. */\nconst folderOf = (path: string): string => path.slice(0, Math.max(0, path.lastIndexOf(\"/\")));\n\nfunction Rows({ items, classNames }: { items: Item[]; classNames: ClassNames }) {\n return (\n <List>\n {items.map((item) => (\n <Row\n key={item.key}\n mark={item.mark}\n title={item.label}\n subtitle={item.note === undefined || item.note === \"\" ? undefined : item.note}\n meta={\n item.status === undefined ? undefined : (\n <i\n aria-hidden\n data-tone={item.status}\n className={classes(classNames, \"sc-about__dot\")}\n />\n )\n }\n quiet={item.off}\n trailing={item.control ?? undefined}\n />\n ))}\n </List>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiEA,MAAM,eAA+C;CACnD,MAAM;CACN,OAAO;CACP,WAAW;CACX,UAAU;CACV,UAAU;CACV,MAAM;AACR;AAqEA,MAAa,iBAAgC;CAC3C,SAAS;CACT,UAAU,SAAS,GAAG,KAAK;CAC3B,UAAU;CACV,SAAS;CACT,MAAM;CACN,SAAS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AAA;AAEV"}
1
+ {"version":3,"file":"AgentAbout.js","names":[],"sources":["../src/AgentAbout.tsx"],"sourcesContent":["import {\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\n\nimport {\n BooksIcon,\n BroadcastIcon,\n KeyIcon,\n LightbulbIcon,\n PuzzlePieceIcon,\n WrenchIcon,\n type Icon as Glyph,\n} from \"@phosphor-icons/react\";\nimport {\n aboutState,\n appTitle,\n automationsOf,\n countOf,\n formatSize,\n toneOf,\n toolName,\n toolTitle,\n type AboutOut,\n type ActionFact,\n type AutomationFact,\n type AutomationKind,\n type ChannelFact,\n type ChannelKind,\n type ConnectionFact,\n type DataFact,\n type Facts,\n type FileFact,\n type Icon,\n type MemoryFact,\n type Provider,\n type StatusTone,\n type Told,\n type Topic,\n type VaultFact,\n} from \"./about\";\nimport { Automation } from \"./automation/Automation\";\nimport { RunView } from \"./automation/RunView\";\nimport type { Automation as Standing, Run } from \"./automation/types\";\nimport { agentGlyph } from \"./agentIcons\";\nimport { classes } from \"./classes\";\nimport { ApiError, type Client } from \"./client\";\nimport { baseName } from \"./files\";\nimport { GLYPHS } from \"./icons\";\nimport { KitProvider, useKit, type KitClassNames, type KitPart } from \"./kit/context\";\nimport { FileMark } from \"./kit/FileMark\";\nimport { List, Row } from \"./kit/List\";\nimport { Mark } from \"./kit/Mark\";\nimport { MarkStack } from \"./kit/MarkStack\";\nimport { Tag } from \"./kit/Tag\";\nimport { KIT_MESSAGES, type KitLocale, type KitMessages } from \"./kit/messages\";\nimport { actionMark, channelMark, deviceMark, providerMark } from \"./marks\";\n\n/** What each part of what it works with is, at a glance: bare, beside its name. */\nconst TOPIC_GLYPHS: Readonly<Record<Topic, Glyph>> = {\n apps: PuzzlePieceIcon,\n tools: WrenchIcon,\n knowledge: BooksIcon,\n learning: LightbulbIcon,\n channels: BroadcastIcon,\n keys: KeyIcon,\n};\nimport type { Channel, ChannelStatus } from \"./types\";\nimport { agentTint } from \"./tint\";\nimport { usePolled } from \"./usePolled\";\n\n/** The words Qué puede says; a host gives its own, in its language. */\nexport interface AboutMessages {\n /** While the words are read, before anything is known. */\n loading: string;\n /** While the agent writes what it does the first time: a model call, a few seconds. */\n writing: (name: string) => string;\n /** Under the words while the agent writes them again, because it changed since. */\n updating: string;\n /** The button that tries again when the words could not be read or written. */\n refresh: string;\n /** Over what it asks the person's leave for. */\n asks: string;\n /** Over the tools that come with every agent, when it has its own too. */\n builtIn: string;\n /** The words could not be read or written; the server's own sentence follows when it gave one. */\n failed: string;\n /** Over what it does on its own. */\n does: string;\n /** In their place when it does nothing on its own yet. */\n noAutomations: string;\n /** On an automation that is off. */\n paused: string;\n /** What an automation waits for, when the agent hasn't said when yet. */\n kinds: Readonly<Record<AutomationKind, string>>;\n /** Each topic's name, on its tile and over it when open. */\n topics: Readonly<Record<Topic, string>>;\n /** A topic with nothing: on its row, and as its one line when open. */\n empty: Readonly<Record<Topic, string>>;\n /** Under an open topic's name: what it is, in a line. */\n hints: Readonly<Record<Topic, string>>;\n /** Over what is the agent's own, inside what it knows and its keys. */\n theirs: (name: string) => string;\n /** Over what is the organization's, shared with every agent: said once, by this heading. */\n organization: string;\n /** Over the tables, inside what it knows. */\n tables: string;\n /** Under a file `search_files` does not read: it is only kept. */\n kept: string;\n /** Beside a tool that is off. */\n off: string;\n /** What it may do in a table, beside it. */\n can: Readonly<Record<string, string>>;\n /** Over the words, and on the way back from a topic: who this is about. */\n title: (name: string) => string;\n /** Over the topics. */\n facts: string;\n /** In place of a run that is no longer there. */\n runGone: string;\n /** What the kit's pieces say in it (an automation, a run): their words, in the host's language. */\n kit: Partial<KitMessages>;\n /** A shipped action's name in the owner's words, by its code name; the rest keep the code name. */\n actions: Readonly<Record<string, string>>;\n /** A file's size, as the host's people read it. */\n size: (bytes: number) => string;\n /** When a memory was kept, beside it. */\n ago: (when: Date) => string;\n /** A channel's name, by its kind: its row's title. */\n channelNames: Readonly<Record<ChannelKind, string>>;\n /** How a channel stands, beside its dot. */\n channelStates: Readonly<Record<ChannelStatus, string>>;\n /** The provider's word on a channel's status (English, as the API keeps it), in the host's. */\n channelDetail: (detail: string) => string;\n}\n\nexport const ABOUT_MESSAGES: AboutMessages = {\n loading: \"Loading…\",\n writing: (name) => `${name} is writing down what it does…`,\n updating: \"Updating…\",\n refresh: \"Try again\",\n asks: \"It asks you before\",\n builtIn: \"Built in\",\n failed: \"What it can do could not be read.\",\n does: \"What it does on its own\",\n noAutomations: \"Nothing on its own yet: it answers when someone writes to it.\",\n paused: \"Paused\",\n kinds: {\n schedule: \"At a time\",\n webhook: \"When called\",\n event: \"On an event\",\n platform: \"On a message\",\n manual: \"When started\",\n after: \"After another\",\n },\n topics: {\n apps: \"Apps\",\n tools: \"Tools\",\n knowledge: \"Knowledge\",\n learning: \"Learning\",\n channels: \"Channels\",\n keys: \"Keys\",\n },\n empty: {\n apps: \"None yet\",\n tools: \"None on\",\n knowledge: \"Nothing yet\",\n learning: \"Nothing yet\",\n channels: \"None yet\",\n keys: \"None\",\n },\n hints: {\n apps: \"The business's apps it uses, and what it may do in each.\",\n tools: \"What it can do while it talks with someone.\",\n knowledge: \"The documents and tables it reads to answer.\",\n learning: \"What it has learned from its conversations.\",\n channels: \"Where it works: where people write to it, and the devices it uses.\",\n keys: \"Passwords and keys it uses, kept sealed.\",\n },\n theirs: (name) => `${name}'s own`,\n organization: \"The organization's\",\n tables: \"Tables\",\n kept: \"Only kept\",\n off: \"off\",\n can: { find: \"looks up\", add: \"adds\", update: \"changes\" },\n title: (name) => `About ${name}`,\n facts: \"What it works with\",\n runGone: \"This run is no longer there.\",\n kit: KIT_MESSAGES,\n actions: {},\n size: (bytes) => formatSize(bytes),\n ago: (when) => when.toLocaleDateString(),\n channelNames: {\n whatsapp: \"WhatsApp\",\n instagram: \"Instagram\",\n sms: \"SMS\",\n email: \"Email\",\n web: \"Web chat\",\n phone: \"Phone\",\n },\n channelStates: {\n active: \"Active\",\n pending: \"Pending\",\n error: \"Error\",\n disconnected: \"Disconnected\",\n },\n channelDetail: (detail) => detail,\n};\n\n/** The parts, by the class each carries; `classNames` adds a host's own under the same keys. */\nexport type AboutPart =\n | \"sc-about\"\n | \"sc-about__pane\"\n | \"sc-about__intro\"\n | \"sc-about__heading\"\n | \"sc-about__name\"\n | \"sc-about__topics\"\n | \"sc-about__topic\"\n | \"sc-about__topic-name\"\n | \"sc-about__topic-none\"\n | \"sc-about__topic-count\"\n | \"sc-about__topic-go\"\n | \"sc-about__lead\"\n | \"sc-about__updated\"\n | \"sc-about__updating\"\n | \"sc-about__section\"\n | \"sc-about__label\"\n | \"sc-about__asks\"\n | \"sc-about__menu\"\n | \"sc-about__memory\"\n | \"sc-about__back\"\n | \"sc-about__bar\"\n | \"sc-about__bar-end\"\n | \"sc-about__automation\"\n | \"sc-about__run\"\n | \"sc-about__group\"\n | \"sc-about__title\"\n | \"sc-about__subtitle\"\n | \"sc-about__file\"\n | \"sc-about__detail\"\n | \"sc-about__hint\"\n | \"sc-about__count\"\n | \"sc-about__tools\"\n | \"sc-about__dot\"\n | \"sc-about__state\"\n | \"sc-about__empty\"\n | \"sc-about__writing\";\n\n/** The panel's own parts and the kit's it is drawn with: a host styles both under one prop. */\ntype ClassNames = Partial<Record<AboutPart | KitPart, string>> | undefined;\n\n/** What a host's control is given, besides the thing it stands beside. */\nexport interface AboutTools {\n /**\n * Reads the facts again, and has the agent write its words anew when the change made them\n * stale; the open topic stays. Call it after a change.\n */\n refresh: () => Promise<void>;\n}\n\ntype Control<T> = ((thing: T, tools: AboutTools) => ReactNode) | undefined;\n\n/**\n * The host's own controls: the package only reads, a host that lets its people change things\n * draws them here. Each one is drawn at the right end of what it stands beside.\n */\nexport interface AboutControls {\n /** Over what it does on its own (a new automation). */\n newAutomation?: ((tools: AboutTools) => ReactNode) | undefined;\n /** On each automation (switch it off, delete it). */\n automation?: Control<AutomationFact>;\n /** Under its automations: what else it does on its own (the tasks it runs for contacts). */\n automationsNote?: ((tools: AboutTools) => ReactNode) | undefined;\n /** Over an open topic (add an app, upload a file, add a key). */\n topic?: Partial<Record<Topic, (tools: AboutTools) => ReactNode>> | undefined;\n app?: Control<ConnectionFact>;\n tool?: Control<ActionFact>;\n file?: Control<FileFact>;\n table?: Control<DataFact>;\n memory?: Control<MemoryFact>;\n key?: Control<VaultFact>;\n /** On each channel the agent answers (its settings, a check, disconnecting it). */\n channel?: Control<Channel>;\n}\n\n/**\n * How a host draws an app's mark, with its own brands (the package carries none): v2's\n * `AppDirectory`. `provider` says the catalog and the app (`arcade:gmail`); `icon` is the one the\n * provider declares, when it does.\n */\nexport interface AppDirectory {\n logo: (app: {\n provider: string;\n name: string;\n icon?: string | null | undefined;\n size: number;\n }) => ReactNode;\n}\n\nexport interface AgentAboutProps {\n client: Client;\n agentId: string;\n /** Its mark (`AGENT_ICONS`), drawn beside its name in its tint; a sparkle until it has one. */\n icon?: string | null | undefined;\n /** The agent's name, for the words that address it. */\n name: string;\n messages?: Partial<AboutMessages> | undefined;\n classNames?: ClassNames;\n controls?: AboutControls | undefined;\n /** The host's logos for apps; without them an app shows the mark its provider gives. */\n apps?: AppDirectory | undefined;\n /**\n * Opens a file the owner presses in what it knows (in the host's viewer: `FileView` in a\n * dialog); without it the files are only listed.\n */\n onOpenFile?: ((file: FileFact) => void) | undefined;\n /**\n * What is open in it: its home, a topic, an automation, a run of one. Given, the host keeps it\n * (in its address, say) and hears each move through `onViewChange`; without it the panel keeps\n * its own.\n */\n view?: AboutView | undefined;\n onViewChange?: ((view: AboutView) => void) | undefined;\n /** Opens a conversation a run opened or was asked in; without it, none opens. */\n onOpenConversation?: ((id: string) => void) | undefined;\n /** The language its dates and times are said in. */\n locale?: KitLocale | undefined;\n}\n\n/**\n * What is open in the panel, one level under another: its home; a topic or an automation from\n * it; a run from its automation.\n */\nexport type AboutView =\n | { kind: \"home\" }\n | { kind: \"topic\"; topic: Topic }\n | { kind: \"automation\"; name: string }\n | { kind: \"run\"; name: string; run: string };\n\nexport const ABOUT_HOME: AboutView = { kind: \"home\" };\n\n/** How far a view is from the home: what says whether a move goes in or back out. */\nconst depthOf = (view: AboutView): number =>\n view.kind === \"home\" ? 0 : view.kind === \"run\" ? 2 : 1;\n\n/** A view as one string: what tells two apart. */\nconst keyOf = (view: AboutView): string =>\n view.kind === \"home\"\n ? \"home\"\n : view.kind === \"topic\"\n ? `topic:${view.topic}`\n : view.kind === \"automation\"\n ? `automation:${view.name}`\n : `run:${view.name}:${view.run}`;\n\n/** The view a step back from `view` goes to. */\nexport function aboutBack(view: AboutView): AboutView {\n return view.kind === \"run\" ? { kind: \"automation\", name: view.name } : ABOUT_HOME;\n}\n\n/**\n * Qué puede, made to sit beside the conversation: who it is about, in its own words (a line or\n * two); what it does on its own, one row per automation (its kind's mark, or its app's logo),\n * what it does and when, as the agent tells it; what it asks leave for; then what it works with,\n * as a grid of tiles, one per topic (its apps, tools, what it knows and has learned, where it\n * works, its keys), each with its count and a glimpse of what it holds, opening it in the same\n * place. Every list is the kit's `List` and `Row`, and every tile its `Tile`, the ones an agent's\n * screens use, so a host styles them once. The words are written by the agent the first time and\n * again whenever it changed since, by themselves. The component only reads; a host draws its own\n * controls through `controls` and calls `tools.refresh()` after a change, and opens a file\n * through `onOpenFile`. An automation opens in the panel itself, one level in (what it does, its\n * steps, its runs), and a run one more, each with its way back; `view` lets the host keep where\n * it is. Another agent starts afresh.\n */\nexport function AgentAbout(props: AgentAboutProps) {\n return (\n <KitProvider\n classNames={props.classNames as KitClassNames}\n messages={props.messages?.kit}\n locale={props.locale}\n >\n <View key={props.agentId} {...props} />\n </KitProvider>\n );\n}\n\nfunction View({\n client,\n agentId,\n icon,\n name,\n messages,\n classNames,\n controls,\n apps,\n onOpenFile,\n view: given,\n onViewChange,\n onOpenConversation,\n}: AgentAboutProps) {\n const words = { ...ABOUT_MESSAGES, ...messages };\n const [data, setData] = useState<AboutOut | null>(null);\n const [live, setLive] = useState<readonly Standing[] | null>(null);\n const [writing, setWriting] = useState(false);\n const [problem, setProblem] = useState<unknown>(null);\n // Every change the host makes reads the open automation or run again, too.\n const [version, setVersion] = useState(0);\n const [own, setOwn] = useState<AboutView>(ABOUT_HOME);\n const view = given ?? own;\n const motion = useMotion(view);\n const root = useRef<HTMLDivElement>(null);\n const scrolled = useRef(new Map<string, number>());\n const intro = useId();\n\n /** Opens `next`, keeping where the panel was scrolled to on the way in, for the way back. */\n const go = (next: AboutView) => {\n const scroller = scrollerOf(root.current);\n if (scroller !== null && depthOf(next) > depthOf(view)) {\n scrolled.current.set(keyOf(view), scroller.scrollTop);\n }\n (onViewChange ?? setOwn)(next);\n };\n\n // A view opens at its top, or back where it was left.\n const shown = keyOf(view);\n useLayoutEffect(() => {\n const scroller = scrollerOf(root.current);\n if (scroller !== null) scroller.scrollTop = scrolled.current.get(shown) ?? 0;\n }, [shown]);\n\n // Each call takes `still`, whether its answer is still wanted: a mount undone before the answer\n // (StrictMode runs effects twice) keeps nothing, so one writing runs, not two.\n\n /** Has the agent write about itself anew; what it answers is the words and the facts both. */\n const write = useCallback(\n async (still: () => boolean) => {\n setProblem(null);\n setWriting(true);\n try {\n const written = await client.agents.describe(agentId);\n if (still()) setData(written);\n } catch (error) {\n if (still()) setProblem(error);\n } finally {\n if (still()) setWriting(false);\n }\n },\n [client, agentId],\n );\n\n /**\n * Reads the words and the facts, and how each automation stands (a server without them leaves\n * the rows as they were told); when the words are missing or stale, has the agent write them.\n */\n const read = useCallback(\n async (still: () => boolean) => {\n setProblem(null);\n try {\n const [first, standing] = await Promise.all([\n client.agents.about(agentId),\n client.automations.list(agentId).catch(() => null),\n ]);\n if (!still()) return;\n setData(first);\n setLive(standing);\n // Words never written, or written before the agent last changed: it writes them again\n // by itself, so what it says stays true without anyone asking.\n if (first.about === null || first.about_at === null) await write(still);\n } catch (error) {\n if (still()) setProblem(error);\n }\n },\n [client, agentId, write],\n );\n\n useEffect(() => {\n let gone = false;\n void read(() => !gone);\n return () => {\n gone = true;\n };\n }, [read]);\n\n const tools = useMemo<AboutTools>(\n () => ({\n refresh: async () => {\n setVersion((count) => count + 1);\n await read(() => true);\n },\n }),\n [read],\n );\n // What to try again after a failure: the reading when nothing was read, the writing otherwise.\n const retry = () => (data === null ? read(() => true) : write(() => true));\n // A tool by the owner's words for it; one of its own code, by its name made words.\n const label = (action: ActionFact) =>\n action.source === \"own\" ? toolName(action.name) : (words.actions[action.name] ?? action.name);\n const pane = (bar: ReactNode, children: ReactNode) => (\n <div ref={root} className={`sc ${classes(classNames, \"sc-about\")}`}>\n <div key={shown} data-motion={motion} className={classes(classNames, \"sc-about__pane\")}>\n {bar}\n {children}\n </div>\n </div>\n );\n const home = words.title(name);\n\n if (view.kind === \"topic\" && data !== null) {\n return pane(\n <Bar back={home} onBack={() => go(ABOUT_HOME)} classNames={classNames} />,\n <TopicView\n client={client}\n agentId={agentId}\n name={name}\n version={version}\n topic={view.topic}\n facts={data.facts}\n apps={apps}\n label={label}\n words={words}\n classNames={classNames}\n tools={tools}\n controls={controls}\n onOpenFile={onOpenFile}\n />,\n );\n }\n\n if (view.kind === \"automation\") {\n const fact = data?.facts.automations.find((each) => each.name === view.name);\n return pane(\n <Bar\n back={home}\n onBack={() => go(ABOUT_HOME)}\n end={fact !== undefined ? controls?.automation?.(fact, tools) : undefined}\n classNames={classNames}\n />,\n <AutomationPane\n key={version}\n client={client}\n agentId={agentId}\n name={view.name}\n apps={apps}\n words={words}\n classNames={classNames}\n onOpenRun={(run) => go({ kind: \"run\", name: view.name, run: run.id })}\n />,\n );\n }\n\n if (view.kind === \"run\") {\n return pane(\n <Bar\n back={live?.find((each) => each.name === view.name)?.title ?? home}\n onBack={() => go({ kind: \"automation\", name: view.name })}\n classNames={classNames}\n />,\n <RunPane\n key={version}\n client={client}\n agentId={agentId}\n name={view.name}\n run={view.run}\n apps={apps}\n words={words}\n classNames={classNames}\n onOpenConversation={onOpenConversation}\n />,\n );\n }\n\n const state = data === null ? null : aboutState(data.about, data.about_at, writing);\n return pane(\n null,\n <>\n <section aria-labelledby={intro} className={classes(classNames, \"sc-about__intro\")}>\n <AgentName\n id={intro}\n agentId={agentId}\n icon={icon}\n name={name}\n label={home}\n classNames={classNames}\n />\n {problem !== null ? (\n <Problem words={words} classNames={classNames} onRetry={retry}>\n {words.failed}\n {problem instanceof ApiError && ` ${problem.detail}`}\n </Problem>\n ) : data === null || data.about === null ? (\n <Writing\n text={data === null ? words.loading : words.writing(name)}\n classNames={classNames}\n />\n ) : (\n <p className={classes(classNames, \"sc-about__lead\")}>{data.about.summary}</p>\n )}\n {state === \"writing\" && data?.about != null && (\n <p role=\"status\" className={classes(classNames, \"sc-about__updating\")}>\n {words.updating}\n </p>\n )}\n </section>\n {data !== null && (\n <>\n <Automations\n apps={apps}\n told={automationsOf(data.about, data.facts)}\n live={live}\n words={words}\n classNames={classNames}\n tools={tools}\n controls={controls}\n onOpen={(automation) => go({ kind: \"automation\", name: automation.name })}\n />\n {data.about !== null && data.about.asks.length > 0 && (\n <Asks asks={data.about.asks} words={words} classNames={classNames} />\n )}\n <nav aria-label={words.facts} className={classes(classNames, \"sc-about__menu\")}>\n <p className={classes(classNames, \"sc-about__label\")}>{words.facts}</p>\n <div className={classes(classNames, \"sc-about__topics\")}>\n {HOME_TOPICS.map((topic) => (\n <TopicRow\n key={topic}\n topic={topic}\n facts={data.facts}\n apps={apps}\n words={words}\n classNames={classNames}\n onOpen={() => go({ kind: \"topic\", topic })}\n />\n ))}\n </div>\n </nav>\n </>\n )}\n </>,\n );\n}\n\n/**\n * What the panel's home shows the agent works with, in the order the owner looks for it: where\n * people reach it, the apps it uses, what it knows, what it learned, its keys. Its tools are\n * the platform's business: they show in the technical view, not here.\n */\nconst HOME_TOPICS: readonly Topic[] = [\"channels\", \"apps\", \"knowledge\", \"learning\", \"keys\"];\n\n/** How many icons a topic's row draws before \"+N\". */\nconst MOST_MARKS = 5;\n\n/**\n * A topic on the panel's home, as icons: its name, then what it holds as their logos or marks\n * (the channels', the apps', the files') and how many; a topic with nothing says so, quietly.\n * Pressing it opens the topic.\n */\nfunction TopicRow({\n topic,\n facts,\n apps,\n words,\n classNames,\n onOpen,\n}: {\n topic: Topic;\n facts: Facts;\n apps: AppDirectory | undefined;\n words: AboutMessages;\n classNames: ClassNames;\n onOpen: () => void;\n}) {\n const count = countOf(topic, facts);\n return (\n <button\n type=\"button\"\n onClick={onOpen}\n data-empty={count === 0 || undefined}\n className={classes(classNames, \"sc-about__topic\")}\n >\n <span className={classes(classNames, \"sc-about__topic-name\")}>{words.topics[topic]}</span>\n {count === 0 ? (\n <span className={classes(classNames, \"sc-about__topic-none\")}>{words.empty[topic]}</span>\n ) : (\n <>\n <TopicMarks topic={topic} facts={facts} apps={apps} words={words} count={count} />\n <span className={classes(classNames, \"sc-about__topic-count\")}>{count}</span>\n </>\n )}\n <svg\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n aria-hidden\n className={classes(classNames, \"sc-about__topic-go\")}\n >\n <path\n d=\"M6 3.5 10.5 8 6 12.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </button>\n );\n}\n\n/** What a topic holds, as icons: each channel's and app's logo, each file's mark; else its glyph. */\nfunction TopicMarks({\n topic,\n facts,\n apps,\n words,\n count,\n}: {\n topic: Topic;\n facts: Facts;\n apps: AppDirectory | undefined;\n words: AboutMessages;\n count: number;\n}) {\n const marks: ReactNode[] =\n topic === \"channels\"\n ? facts.channels.map((channel) => (\n <span key={`${channel.kind}:${channel.name}`}>\n {channelLogo(channel.kind, apps, words, 20)}\n </span>\n ))\n : topic === \"apps\"\n ? facts.connections.map((connection) => (\n <span key={connection.name}>{appMark(connectionApp(connection), apps, 20)}</span>\n ))\n : topic === \"knowledge\"\n ? facts.files.map((file) => <FileMark key={file.path} name={file.path} size={20} />)\n : [<Mark key={topic} icon={TOPIC_GLYPHS[topic]} size={20} />];\n const shown = marks.slice(0, MOST_MARKS);\n const drawn = topic === \"learning\" || topic === \"keys\" ? 0 : count;\n return <MarkStack more={Math.max(0, drawn - shown.length)}>{shown}</MarkStack>;\n}\n\n/**\n * Who the panel is about, at its top: the agent's mark in its tint, bare, beside its name; the\n * panel's title (\"About Ana\") stays for screen readers.\n */\nfunction AgentName({\n id,\n agentId,\n icon,\n name,\n label,\n classNames,\n}: {\n id: string;\n agentId: string;\n icon: string | null | undefined;\n name: string;\n label: string;\n classNames: ClassNames;\n}) {\n const Glyph = agentGlyph(icon);\n return (\n <h2\n id={id}\n aria-label={label}\n data-tint={agentTint(agentId)}\n className={classes(classNames, \"sc-about__name\")}\n >\n <Glyph aria-hidden weight=\"duotone\" />\n <span>{name}</span>\n </h2>\n );\n}\n\n/**\n * Which way the panel moved to show `view`: in (one level deeper), back out, or nowhere (the first\n * view). Kept per view, so a view's own updates never replay it.\n */\nfunction useMotion(view: AboutView): \"in\" | \"out\" | undefined {\n const key = keyOf(view);\n const depth = depthOf(view);\n const [moved, setMoved] = useState<{\n key: string;\n depth: number;\n motion: \"in\" | \"out\" | undefined;\n }>({ key, depth, motion: undefined });\n if (moved.key !== key) {\n setMoved({ key, depth, motion: depth >= moved.depth ? \"in\" : \"out\" });\n }\n return moved.motion;\n}\n\n/** The nearest box around `element` that scrolls: where the panel's place is kept. */\nfunction scrollerOf(element: HTMLElement | null): HTMLElement | null {\n for (let at = element?.parentElement ?? null; at !== null; at = at.parentElement) {\n const overflow = getComputedStyle(at).overflowY;\n if (overflow === \"auto\" || overflow === \"scroll\") return at;\n }\n return null;\n}\n\n/**\n * The bar over a view opened from another: the way back to it, named, at its start; the host's\n * controls at its end. It stays at the top as the view scrolls.\n */\nfunction Bar({\n back,\n onBack,\n end,\n classNames,\n}: {\n back: string;\n onBack: () => void;\n end?: ReactNode;\n classNames: ClassNames;\n}) {\n return (\n <div className={classes(classNames, \"sc-about__bar\")}>\n <button type=\"button\" onClick={onBack} className={classes(classNames, \"sc-about__back\")}>\n <svg viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden>\n <path\n d=\"M10 3.5 5.5 8l4.5 4.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n <span>{back}</span>\n </button>\n {end != null && <span className={classes(classNames, \"sc-about__bar-end\")}>{end}</span>}\n </div>\n );\n}\n\n/**\n * An automation, open in the panel: what starts it and when it runs next, the owner's sentence,\n * its steps, the table it moves, its runs (each opening its record). Read again every few\n * seconds while a run of it is under way.\n */\nfunction AutomationPane({\n client,\n agentId,\n name,\n apps,\n words,\n classNames,\n onOpenRun,\n}: Drawn & {\n client: Client;\n agentId: string;\n name: string;\n apps: AppDirectory | undefined;\n onOpenRun: (run: Run) => void;\n}) {\n const { messages } = useKit();\n const read = usePolled(\n () => client.automations.get(agentId, name),\n `${agentId}:${name}`,\n (automation) => automation.runs.some((run) => run.status === \"running\"),\n );\n if (read.gone) return <Gone classNames={classNames}>{messages.automation.gone}</Gone>;\n if (read.value === null) {\n return read.problem === null ? (\n <Loading words={words} classNames={classNames} />\n ) : (\n <Gone classNames={classNames}>{words.failed}</Gone>\n );\n }\n return (\n <Automation\n className={classes(classNames, \"sc-about__automation\")}\n automation={read.value}\n runs={read.value.runs}\n apps={apps}\n onOpenRun={onOpenRun}\n />\n );\n}\n\n/**\n * A run, open in the panel: how it went, step by step in words, what it opened. Read with its\n * automation (its steps' order and its apps' names), again while it is under way.\n */\nfunction RunPane({\n client,\n agentId,\n name,\n run,\n apps,\n words,\n classNames,\n onOpenConversation,\n}: Drawn & {\n client: Client;\n agentId: string;\n name: string;\n run: string;\n apps: AppDirectory | undefined;\n onOpenConversation: ((id: string) => void) | undefined;\n}) {\n const read = usePolled(\n async () => {\n const [record, automation] = await Promise.all([\n client.runs.get(run),\n client.automations.get(agentId, name).catch(() => null),\n ]);\n return { record, automation };\n },\n run,\n ({ record }) => record.status === \"running\",\n );\n if (read.gone) return <Gone classNames={classNames}>{words.runGone}</Gone>;\n if (read.value === null) {\n return read.problem === null ? (\n <Loading words={words} classNames={classNames} />\n ) : (\n <Gone classNames={classNames}>{words.failed}</Gone>\n );\n }\n return (\n <RunView\n className={classes(classNames, \"sc-about__run\")}\n run={read.value.record}\n automation={read.value.automation}\n apps={apps}\n onOpenConversation={onOpenConversation}\n />\n );\n}\n\n/** A view whose thing is being read: lines with a light sweeping them. */\nfunction Loading({ words, classNames }: Drawn) {\n return <Writing text={words.loading} classNames={classNames} />;\n}\n\n/** In place of what is no longer there, or could not be read. */\nfunction Gone({ classNames, children }: { classNames: ClassNames; children: ReactNode }) {\n return <p className={classes(classNames, \"sc-about__empty\")}>{children}</p>;\n}\n\n/** An automation's mark says its kind: a time, a call from another system, an event, a\n * message. */\nconst KIND_ICONS: Readonly<Record<AutomationKind, Icon>> = {\n schedule: \"clock\",\n webhook: \"code\",\n event: \"bell\",\n platform: \"message\",\n manual: \"hand\",\n after: \"check\",\n};\n\n/** An app's mark: the host's logo when it draws one, else the provider's, bare. */\nfunction appMark(\n app: { provider: string; name: string; icon?: string | null | undefined },\n apps: AppDirectory | undefined,\n size: number,\n) {\n if (apps !== undefined) return apps.logo({ ...app, size });\n return (\n <Mark logo size={size}>\n {providerMark(app.provider.split(\":\")[0] as Provider, app.icon ?? undefined)}\n </Mark>\n );\n}\n\nconst connectionApp = (connection: ConnectionFact) => ({\n provider: `${connection.provider}:${connection.toolkit ?? connection.name}`,\n name: appTitle(connection),\n icon: connection.icon,\n});\n\n/**\n * A channel's mark: the host's logo for its brand when it draws apps (WhatsApp, Instagram, the\n * plain mark of a text message), else the package's glyph, bare.\n */\nfunction channelLogo(\n kind: ChannelKind,\n apps: AppDirectory | undefined,\n words: AboutMessages,\n size: number,\n) {\n if (apps !== undefined)\n return apps.logo({ provider: kind, name: words.channelNames[kind], size });\n return <Mark size={size}>{channelMark(kind)}</Mark>;\n}\n\ninterface Drawn {\n words: AboutMessages;\n classNames: ClassNames;\n}\n\n/** What could not be read or written, in the warning tone, and the button to try again. */\nfunction Problem({\n words,\n classNames,\n onRetry,\n children,\n}: Drawn & { onRetry: () => Promise<void>; children: ReactNode }) {\n return (\n <p role=\"alert\" className={classes(classNames, \"sc-about__updated\")}>\n <span>{children}</span>\n <button type=\"button\" onClick={() => void onRetry()}>\n {words.refresh}\n </button>\n </p>\n );\n}\n\n/** The agent writing: the lead's lines with a light sweeping them, and the sentence saying so. */\nfunction Writing({ text, classNames }: { text: string; classNames: ClassNames }) {\n return (\n <div role=\"status\" className={classes(classNames, \"sc-about__writing\")}>\n <div aria-hidden>\n <i />\n <i />\n </div>\n <p>{text}</p>\n </div>\n );\n}\n\n/** What it asks leave for: its label, then the things, a short list. */\nfunction Asks({ asks, words, classNames }: Drawn & { asks: string[] }) {\n const id = useId();\n return (\n <section\n aria-labelledby={id}\n className={classes(classNames, \"sc-about__section\", \"sc-about__asks\")}\n >\n <div className={classes(classNames, \"sc-about__label\")}>\n <h3 id={id}>{words.asks}</h3>\n </div>\n <ul>\n {asks.map((ask, index) => (\n <li key={index}>{ask}</li>\n ))}\n </ul>\n </section>\n );\n}\n\n/**\n * What it does on its own: one row per automation, its kind's mark (or, on an app's event, the\n * app's logo), what it does then over when, as the agent tells it (its title and its kind until\n * it has), a paused one quieter; how it stands now when that needs a look (a run under way, the\n * last one failed); the host's control at each row's end, and over them the way to a new one. A\n * row opens its automation.\n */\nfunction Automations({\n told,\n live,\n words,\n classNames,\n tools,\n controls,\n apps,\n onOpen,\n}: Drawn & {\n told: Told[];\n live: readonly Standing[] | null;\n tools: AboutTools;\n controls: AboutControls | undefined;\n apps: AppDirectory | undefined;\n onOpen: (automation: AutomationFact) => void;\n}) {\n const id = useId();\n const { messages } = useKit();\n const standing = new Map(live?.map((automation) => [automation.name, automation]));\n return (\n <section aria-labelledby={id} className={classes(classNames, \"sc-about__section\")}>\n <div className={classes(classNames, \"sc-about__label\")}>\n <h3 id={id}>{words.does}</h3>\n {controls?.newAutomation !== undefined && (\n <span className={classes(classNames, \"sc-about__tools\")}>\n {controls.newAutomation(tools)}\n </span>\n )}\n </div>\n {told.length === 0 ? (\n <p className={classes(classNames, \"sc-about__empty\")}>{words.noAutomations}</p>\n ) : (\n <List>\n {told.map(({ automation, line }) => {\n const when = line?.when ?? words.kinds[automation.kind];\n const now = standing.get(automation.name);\n const going = now?.last_run?.status === \"running\";\n return (\n <Row\n key={automation.id}\n mark={\n automation.provider === undefined || automation.provider === null ? (\n <Mark icon={GLYPHS[KIND_ICONS[automation.kind]]} />\n ) : (\n appMark(\n {\n provider: automation.provider,\n name:\n automation.app_title ?? toolName(automation.app ?? automation.provider),\n icon: automation.icon,\n },\n apps,\n 28,\n )\n )\n }\n title={line?.text ?? automation.title}\n subtitle={when}\n error={now?.state === \"failing\" ? messages.automation.states.failing : undefined}\n meta={\n going ? (\n <Tag tone=\"info\">\n <i aria-hidden className={classes(classNames, \"sc-run__live\")} />\n {messages.automation.statuses.running}\n </Tag>\n ) : automation.on ? undefined : (\n <Tag>{words.paused}</Tag>\n )\n }\n quiet={!automation.on}\n onPress={() => onOpen(automation)}\n trailing={controls?.automation?.(automation, tools)}\n />\n );\n })}\n </List>\n )}\n {controls?.automationsNote?.(tools)}\n </section>\n );\n}\n\n/**\n * One topic, open: its name with its count and the host's control, a line saying what it is, then\n * its rows (what it knows as its files and its tables; what it learned; the rest with a mark and\n * a note), or its one line when it holds nothing.\n */\nfunction TopicView({\n client,\n agentId,\n name,\n version,\n topic,\n facts,\n apps,\n label,\n words,\n classNames,\n tools,\n controls,\n onOpenFile,\n}: Drawn & {\n client: Client;\n agentId: string;\n /** The agent's name, over what is its own. */\n name: string;\n /** Moves with every change the host makes: what the topic reads itself, it reads again. */\n version: number;\n topic: Topic;\n facts: Facts;\n apps: AppDirectory | undefined;\n label: (action: ActionFact) => string;\n tools: AboutTools;\n controls: AboutControls | undefined;\n onOpenFile: ((file: FileFact) => void) | undefined;\n}) {\n const id = useId();\n const tool = controls?.topic?.[topic];\n const count = countOf(topic, facts);\n // The tools are all listed, the ones that are off too: they are what the owner turns on.\n const shown = topic === \"tools\" ? facts.actions.length : count;\n return (\n <section aria-labelledby={id} className={classes(classNames, \"sc-about__group\")}>\n <h3 id={id} className={classes(classNames, \"sc-about__title\")}>\n <span>{words.topics[topic]}</span>\n {count > 0 && <b className={classes(classNames, \"sc-about__count\")}>{count}</b>}\n {tool !== undefined && (\n <span className={classes(classNames, \"sc-about__tools\")}>{tool(tools)}</span>\n )}\n </h3>\n <p className={classes(classNames, \"sc-about__hint\")}>{words.hints[topic]}</p>\n {topic === \"channels\" ? (\n <Channels\n client={client}\n agentId={agentId}\n version={version}\n facts={facts}\n apps={apps}\n words={words}\n classNames={classNames}\n tools={tools}\n controls={controls}\n />\n ) : shown === 0 ? (\n <p className={classes(classNames, \"sc-about__empty\")}>{words.empty[topic]}</p>\n ) : topic === \"knowledge\" ? (\n <Knowledge\n name={name}\n facts={facts}\n words={words}\n classNames={classNames}\n tools={tools}\n controls={controls}\n onOpenFile={onOpenFile}\n />\n ) : topic === \"tools\" ? (\n <Tools\n name={name}\n facts={facts}\n label={label}\n words={words}\n classNames={classNames}\n tools={tools}\n controls={controls}\n />\n ) : topic === \"keys\" ? (\n <Keys\n name={name}\n facts={facts}\n words={words}\n classNames={classNames}\n tools={tools}\n controls={controls}\n />\n ) : topic === \"learning\" ? (\n <List>\n {facts.memories.map((memory) => (\n <Row\n key={memory.id}\n className={classes(classNames, \"sc-about__memory\")}\n title={memory.text}\n subtitle={words.ago(new Date(memory.created_at))}\n trailing={controls?.memory?.(memory, tools)}\n />\n ))}\n </List>\n ) : (\n <Rows items={appItems(facts, tools, controls, apps)} classNames={classNames} />\n )}\n </section>\n );\n}\n\n/** How each state of a channel reads beside its dot: working, waiting, broken, or off. */\nconst CHANNEL_TONES: Readonly<Record<ChannelStatus, StatusTone | \"wait\">> = {\n active: \"on\",\n pending: \"wait\",\n error: \"off\",\n disconnected: \"quiet\",\n};\n\nconst isStatus = (status: string): status is ChannelStatus => status in CHANNEL_TONES;\n\n/** The order channels are listed in: by kind, as people reach a business most; disconnected last. */\nconst KIND_ORDER: readonly ChannelKind[] = [\n \"whatsapp\",\n \"instagram\",\n \"sms\",\n \"email\",\n \"web\",\n \"phone\",\n];\n\nconst inOrder = (channels: readonly Channel[]): Channel[] =>\n [...channels].sort(\n (a, b) =>\n Number(a.status === \"disconnected\") - Number(b.status === \"disconnected\") ||\n KIND_ORDER.indexOf(a.kind) - KIND_ORDER.indexOf(b.kind),\n );\n\n/**\n * Where it works: each channel it answers, as the API lists them (WhatsApp, Instagram, SMS; the\n * disconnected ones last, quieter), by its brand's mark and name, its number or handle, how it stands with the\n * provider's word on it, and the host's control at its end; then the devices it uses. Read\n * when the topic opens and after each change the host makes; until then, or on a server without\n * the list, the facts' rows.\n */\nfunction Channels({\n client,\n agentId,\n version,\n facts,\n apps,\n words,\n classNames,\n tools,\n controls,\n}: Drawn & {\n client: Client;\n agentId: string;\n version: number;\n facts: Facts;\n apps: AppDirectory | undefined;\n tools: AboutTools;\n controls: AboutControls | undefined;\n}) {\n const [listed, setListed] = useState<readonly Channel[] | null>(null);\n useEffect(() => {\n let gone = false;\n client.channels.list(agentId).then(\n (channels) => {\n if (!gone) setListed(channels);\n },\n () => undefined,\n );\n return () => {\n gone = true;\n };\n }, [client, agentId, version]);\n\n const state = (status: string) => {\n const known = isStatus(status);\n return (\n <span\n data-tone={known ? CHANNEL_TONES[status] : toneOf(status)}\n className={classes(classNames, \"sc-about__state\")}\n >\n <i aria-hidden className={classes(classNames, \"sc-about__dot\")} />\n {known ? words.channelStates[status] : status}\n </span>\n );\n };\n // Its number or handle, and under it the provider's word on it; on an error, that word is why.\n const told = (channel: Channel) => {\n const detail = channel.detail === null ? null : words.channelDetail(channel.detail);\n const error = channel.status === \"error\";\n return {\n subtitle: (\n <>\n {channel.name}\n {!error && detail !== null && detail !== \"\" && (\n <span className={classes(classNames, \"sc-about__detail\")}>{detail}</span>\n )}\n </>\n ),\n error: error ? (detail ?? undefined) : undefined,\n };\n };\n const rows =\n listed === null\n ? facts.channels.map((channel: ChannelFact) => (\n <Row\n key={`${channel.kind}:${channel.name}`}\n mark={channelLogo(channel.kind, apps, words, 28)}\n title={words.channelNames[channel.kind]}\n subtitle={channel.name}\n meta={state(channel.status)}\n />\n ))\n : inOrder(listed).map((channel) => (\n <Row\n key={channel.id}\n mark={channelLogo(channel.kind, apps, words, 28)}\n title={words.channelNames[channel.kind]}\n {...told(channel)}\n meta={state(channel.status)}\n quiet={channel.status === \"disconnected\"}\n trailing={controls?.channel?.(channel, tools) ?? undefined}\n />\n ));\n const devices = facts.devices.map((device) => (\n <Row\n key={`device:${device.kind}:${device.name}`}\n mark={<Mark>{deviceMark(device.kind)}</Mark>}\n title={device.name}\n meta={\n <i\n aria-hidden\n data-tone={toneOf(device.status)}\n className={classes(classNames, \"sc-about__dot\")}\n />\n }\n />\n ));\n if (rows.length + devices.length === 0) {\n return <p className={classes(classNames, \"sc-about__empty\")}>{words.empty.channels}</p>;\n }\n return (\n <List>\n {rows}\n {devices}\n </List>\n );\n}\n\n/**\n * One row of a topic: a mark, a name, a quieter line (what an app may do there, a note), a dot\n * for a status, and the host's control at its end.\n */\ninterface Item {\n key: string;\n mark: ReactNode;\n label: string;\n note?: string | undefined;\n status?: StatusTone | undefined;\n off?: boolean | undefined;\n control?: ReactNode;\n}\n\n/** Its apps: each by its logo and name, what it may do there under it, how it stands at its end. */\nfunction appItems(\n facts: Facts,\n tools: AboutTools,\n controls: AboutControls | undefined,\n apps: AppDirectory | undefined,\n): Item[] {\n return facts.connections.map((connection) => ({\n key: `${connection.provider}:${connection.name}`,\n mark: appMark(connectionApp(connection), apps, 28),\n label: appTitle(connection),\n note: connection.actions.map((action) => toolTitle(connection, action)).join(\", \"),\n status: connection.status === undefined ? undefined : toneOf(connection.status),\n control: controls?.app?.(connection, tools),\n }));\n}\n\n/**\n * What it can do while it talks: its own code's actions, then the ones every agent comes with\n * (each under its heading when it has both); in each, the ones it has first, then the ones the\n * owner can turn on, quieter, saying so.\n */\nfunction Tools({\n name,\n facts,\n label,\n words,\n classNames,\n tools,\n controls,\n}: Drawn & {\n name: string;\n facts: Facts;\n label: (action: ActionFact) => string;\n tools: AboutTools;\n controls: AboutControls | undefined;\n}) {\n const groups = [\n { key: \"own\", title: words.theirs(name), actions: facts.actions.filter(isOwn) },\n { key: \"built\", title: words.builtIn, actions: facts.actions.filter((a) => !isOwn(a)) },\n ].filter((group) => group.actions.length > 0);\n const rows = (actions: readonly ActionFact[]) => (\n <Rows\n items={[...actions.filter((a) => a.on), ...actions.filter((a) => !a.on)].map((action) => ({\n key: `${action.source}:${action.name}`,\n mark: <Mark>{actionMark(action.name, action.source)}</Mark>,\n label: label(action),\n note: action.on ? undefined : words.off,\n off: !action.on,\n control: controls?.tool?.(action, tools),\n }))}\n classNames={classNames}\n />\n );\n if (groups.length === 1) return rows(groups[0]?.actions ?? []);\n return (\n <>\n {groups.map((group) => (\n <Group key={group.key} title={group.title} classNames={classNames}>\n {rows(group.actions)}\n </Group>\n ))}\n </>\n );\n}\n\nconst isOwn = (action: ActionFact): boolean => action.source === \"own\";\n\n/** A part of a topic under its small heading: whose things they are, or what kind. */\nfunction Group({\n title,\n classNames,\n children,\n}: {\n title: string;\n classNames: ClassNames;\n children: ReactNode;\n}) {\n return (\n <>\n <h4 className={classes(classNames, \"sc-about__subtitle\")}>{title}</h4>\n {children}\n </>\n );\n}\n\n/** What is the agent's own, then the organization's: the heading says whose, once. */\nfunction byOwner<T extends { shared?: boolean | undefined }>(\n things: readonly T[],\n name: string,\n words: AboutMessages,\n): { key: string; title: string; things: T[] }[] {\n return [\n { key: \"own\", title: words.theirs(name), things: things.filter((thing) => !thing.shared) },\n {\n key: \"shared\",\n title: words.organization,\n things: things.filter((thing) => thing.shared === true),\n },\n ].filter((group) => group.things.length > 0);\n}\n\n/**\n * What it knows, by whose it is: its own files, then the organization's (shared with every\n * agent: the heading says so, once), then the tables it reads or writes. A file is its kind's\n * mark, its name on one line, its folder under it (and that it is only kept, when `search_files`\n * does not read it), its size at the right; pressed, the host opens it; the host's controls at\n * its end.\n */\nfunction Knowledge({\n name,\n facts,\n words,\n classNames,\n tools,\n controls,\n onOpenFile,\n}: Drawn & {\n name: string;\n facts: Facts;\n tools: AboutTools;\n controls: AboutControls | undefined;\n onOpenFile: ((file: FileFact) => void) | undefined;\n}) {\n return (\n <>\n {byOwner(facts.files, name, words).map((group) => (\n <Group key={group.key} title={group.title} classNames={classNames}>\n <List>\n {group.things.map((file) => (\n <Row\n key={file.path}\n className={classes(classNames, \"sc-about__file\")}\n mark={<FileMark name={file.path} />}\n title={<span title={file.path}>{baseName(file.path)}</span>}\n subtitle={fileLine(file, words)}\n meta={words.size(file.size)}\n onPress={onOpenFile && (() => onOpenFile(file))}\n trailing={controls?.file?.(file, tools) ?? undefined}\n />\n ))}\n </List>\n </Group>\n ))}\n {facts.data.length > 0 && (\n <Group title={words.tables} classNames={classNames}>\n <Rows\n items={facts.data.map((table) => ({\n key: table.table,\n mark: <Mark icon={GLYPHS.table} />,\n label: table.title ?? table.table,\n note: table.can.map((can) => words.can[can] ?? can).join(\", \"),\n control: controls?.table?.(table, tools),\n }))}\n classNames={classNames}\n />\n </Group>\n )}\n </>\n );\n}\n\n/** Under a file's name: its folder, and that it is only kept when nothing reads it at a search. */\nfunction fileLine(file: FileFact, words: AboutMessages): string | undefined {\n const folder = folderOf(file.path);\n if (file.searchable) return folder === \"\" ? undefined : folder;\n return folder === \"\" ? words.kept : `${folder} · ${words.kept}`;\n}\n\n/** Its keys, its own then the organization's, each with where it may be sent. */\nfunction Keys({\n name,\n facts,\n words,\n classNames,\n tools,\n controls,\n}: Drawn & {\n name: string;\n facts: Facts;\n tools: AboutTools;\n controls: AboutControls | undefined;\n}) {\n return (\n <>\n {byOwner(facts.vault, name, words).map((group) => (\n <Group key={group.key} title={group.title} classNames={classNames}>\n <Rows\n items={group.things.map((secret) => ({\n key: `${group.key}:${secret.name}`,\n mark: <Mark icon={GLYPHS.lock} />,\n label: secret.name,\n note: secret.hosts?.join(\", \"),\n control: controls?.key?.(secret, tools),\n }))}\n classNames={classNames}\n />\n </Group>\n ))}\n </>\n );\n}\n\n/** The folders a file sits in: \"\" for one at the top. */\nconst folderOf = (path: string): string => path.slice(0, Math.max(0, path.lastIndexOf(\"/\")));\n\nfunction Rows({ items, classNames }: { items: Item[]; classNames: ClassNames }) {\n return (\n <List>\n {items.map((item) => (\n <Row\n key={item.key}\n mark={item.mark}\n title={item.label}\n subtitle={item.note === undefined || item.note === \"\" ? undefined : item.note}\n meta={\n item.status === undefined ? undefined : (\n <i\n aria-hidden\n data-tone={item.status}\n className={classes(classNames, \"sc-about__dot\")}\n />\n )\n }\n quiet={item.off}\n trailing={item.control ?? undefined}\n />\n ))}\n </List>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiEA,MAAM,eAA+C;CACnD,MAAM;CACN,OAAO;CACP,WAAW;CACX,UAAU;CACV,UAAU;CACV,MAAM;AACR;AAqEA,MAAa,iBAAgC;CAC3C,SAAS;CACT,UAAU,SAAS,GAAG,KAAK;CAC3B,UAAU;CACV,SAAS;CACT,MAAM;CACN,SAAS;CACT,QAAQ;CACR,MAAM;CACN,eAAe;CACf,QAAQ;CACR,OAAO;EACL,UAAU;EACV,SAAS;EACT,OAAO;EACP,UAAU;EACV,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,MAAM;EACN,OAAO;EACP,WAAW;EACX,UAAU;EACV,UAAU;EACV,MAAM;CACR;CACA,OAAO;EACL,MAAM;EACN,OAAO;EACP,WAAW;EACX,UAAU;EACV,UAAU;EACV,MAAM;CACR;CACA,OAAO;EACL,MAAM;EACN,OAAO;EACP,WAAW;EACX,UAAU;EACV,UAAU;EACV,MAAM;CACR;CACA,SAAS,SAAS,GAAG,KAAK;CAC1B,cAAc;CACd,QAAQ;CACR,MAAM;CACN,KAAK;CACL,KAAK;EAAE,MAAM;EAAY,KAAK;EAAQ,QAAQ;CAAU;CACxD,QAAQ,SAAS,SAAS;CAC1B,OAAO;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AAG,MAAM,IAAI,GAAG,OAAO;IAC5B,MAAM,oBAAC,MAAD,EAAM,MAAM,OAAO,KAAO,CAAA;IAChC,OAAO,OAAO;IACd,MAAM,OAAO,OAAO,KAAK,IAAI;IAC7B,SAAS,UAAU,MAAM,QAAQ,KAAK;GACxC,EAAE;GACU;EACb,CAAA;CACI,GAXK,MAAM,GAWX,CACR,EACD,CAAA;AAEN;;AAGA,MAAM,YAAY,SAAyB,KAAK,MAAM,GAAG,KAAK,IAAI,GAAG,KAAK,YAAY,GAAG,CAAC,CAAC;AAE3F,SAAS,KAAK,EAAE,OAAO,cAAyD;CAC9E,OACE,oBAAC,MAAD,EAAA,UACG,MAAM,KAAK,SACV,oBAAC,KAAD;EAEE,MAAM,KAAK;EACX,OAAO,KAAK;EACZ,UAAU,KAAK,SAAS,KAAA,KAAa,KAAK,SAAS,KAAK,KAAA,IAAY,KAAK;EACzE,MACE,KAAK,WAAW,KAAA,IAAY,KAAA,IAC1B,oBAAC,KAAD;GACE,eAAA;GACA,aAAW,KAAK;GAChB,WAAW,QAAQ,YAAY,eAAe;EAC/C,CAAA;EAGL,OAAO,KAAK;EACZ,UAAU,KAAK,WAAW,KAAA;CAC3B,GAfM,KAAK,GAeX,CACF,EACG,CAAA;AAEV"}
@@ -61,6 +61,12 @@ export interface ChatMessages {
61
61
  inputs: Readonly<Record<string, string>>;
62
62
  allow: string;
63
63
  decline: string;
64
+ /** What heads the card of several actions that wait for the person's leave, by how many. */
65
+ approvals: (count: number) => string;
66
+ /** The card's one button, as many as are ticked: every one, some, or none (all declined). */
67
+ approveAll: string;
68
+ approveSome: (count: number) => string;
69
+ declineAll: string;
64
70
  /**
65
71
  * On a person's page, in place of the approval card: what the agent asked to do waits for the
66
72
  * business's yes (`decides: "business"`), which its people give from their app.
@@ -102,7 +108,7 @@ export interface ChatMessages {
102
108
  }
103
109
  export declare const CHAT_MESSAGES: ChatMessages;
104
110
  /** The chat's parts, by the class each carries; `classNames` adds a host's own under the same keys. */
105
- export type ChatPart = "sc-chat" | "sc-chat--builder" | "sc-chat--console" | "sc-chat__log" | "sc-chat__log--channel" | "sc-chat__message" | "sc-chat__message--person" | "sc-chat__message--agent" | "sc-chat__message--action" | "sc-chat__message--business" | "sc-chat__said" | "sc-chat__business" | "sc-chat__meta" | "sc-chat__delivery" | "sc-chat__text" | "sc-chat__steps" | "sc-chat__step" | "sc-chat__mark" | "sc-chat__step--running" | "sc-chat__step--queued" | "sc-chat__step--waiting" | "sc-chat__step--done" | "sc-chat__step--failed" | "sc-chat__output" | "sc-chat__request" | "sc-chat__confirming" | "sc-chat__screen" | "sc-chat__screen--bare" | "sc-chat__handoff" | "sc-chat__handover" | "sc-chat__decision" | "sc-chat__message--heard" | "sc-chat__message--voice" | "sc-chat__transcript" | "sc-chat__cut" | "sc-chat__reply" | "sc-chat__status" | "sc-chat__done" | "sc-chat__empty" | "sc-chat__suggestion" | "sc-chat__composer" | "sc-chat__files" | "sc-chat__attach" | "sc-chat__dictate" | "sc-chat__typing" | "sc-chat__dictation" | "sc-chat__drop" | "sc-chat__input" | "sc-chat__actions" | "sc-chat__send" | "sc-chat__stop";
111
+ export type ChatPart = "sc-chat" | "sc-chat--builder" | "sc-chat--console" | "sc-chat__log" | "sc-chat__log--channel" | "sc-chat__message" | "sc-chat__message--person" | "sc-chat__message--agent" | "sc-chat__message--action" | "sc-chat__message--business" | "sc-chat__said" | "sc-chat__business" | "sc-chat__meta" | "sc-chat__delivery" | "sc-chat__text" | "sc-chat__steps" | "sc-chat__step" | "sc-chat__mark" | "sc-chat__step--running" | "sc-chat__step--queued" | "sc-chat__step--waiting" | "sc-chat__step--done" | "sc-chat__step--failed" | "sc-chat__output" | "sc-chat__request" | "sc-chat__requests" | "sc-chat__ask" | "sc-chat__ask-fields" | "sc-chat__confirming" | "sc-chat__screen" | "sc-chat__screen--bare" | "sc-chat__handoff" | "sc-chat__handover" | "sc-chat__decision" | "sc-chat__message--heard" | "sc-chat__message--voice" | "sc-chat__transcript" | "sc-chat__cut" | "sc-chat__reply" | "sc-chat__status" | "sc-chat__done" | "sc-chat__empty" | "sc-chat__suggestion" | "sc-chat__composer" | "sc-chat__files" | "sc-chat__attach" | "sc-chat__dictate" | "sc-chat__typing" | "sc-chat__dictation" | "sc-chat__drop" | "sc-chat__input" | "sc-chat__actions" | "sc-chat__send" | "sc-chat__stop";
106
112
  type ClassNames = Partial<Record<ChatPart | SurfacePart | KitPart | BrowserPart, string>> | undefined;
107
113
  /**
108
114
  * How the chat looks. `agent` is an agent's conversation. `builder` is the builder's, v2's: the