@signalcore/ui 0.1.0 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +896 -513
- package/dist/AgentAbout.d.ts +186 -0
- package/dist/AgentAbout.js +1020 -0
- package/dist/AgentAbout.js.map +1 -0
- package/dist/AgentCard.d.ts +49 -0
- package/dist/AgentCard.js +77 -0
- package/dist/AgentCard.js.map +1 -0
- package/dist/AgentChat.d.ts +233 -0
- package/dist/AgentChat.js +1119 -0
- package/dist/AgentChat.js.map +1 -0
- package/dist/AgentSpace.d.ts +112 -0
- package/dist/AgentSpace.js +339 -0
- package/dist/AgentSpace.js.map +1 -0
- package/dist/AgentTasks.d.ts +48 -0
- package/dist/AgentTasks.js +120 -0
- package/dist/AgentTasks.js.map +1 -0
- package/dist/BrowserView.d.ts +52 -0
- package/dist/BrowserView.js +328 -0
- package/dist/BrowserView.js.map +1 -0
- package/dist/FileView.d.ts +63 -0
- package/dist/FileView.js +449 -0
- package/dist/FileView.js.map +1 -0
- package/dist/Modes.d.ts +13 -0
- package/dist/Modes.js +75 -0
- package/dist/Modes.js.map +1 -0
- package/dist/VoiceCall.d.ts +91 -0
- package/dist/VoiceCall.js +302 -0
- package/dist/VoiceCall.js.map +1 -0
- package/dist/about.d.ts +212 -0
- package/dist/about.js +136 -0
- package/dist/about.js.map +1 -0
- package/dist/agentIcons.d.ts +33 -0
- package/dist/agentIcons.js +36 -0
- package/dist/agentIcons.js.map +1 -0
- package/dist/automation/Automation.d.ts +35 -0
- package/dist/automation/Automation.js +268 -0
- package/dist/automation/Automation.js.map +1 -0
- package/dist/automation/RunView.d.ts +25 -0
- package/dist/automation/RunView.js +187 -0
- package/dist/automation/RunView.js.map +1 -0
- package/dist/automation/cron.d.ts +41 -0
- package/dist/automation/cron.js +169 -0
- package/dist/automation/cron.js.map +1 -0
- package/dist/automation/marks.js +121 -0
- package/dist/automation/marks.js.map +1 -0
- package/dist/automation/messages.d.ts +113 -0
- package/dist/automation/messages.js +113 -0
- package/dist/automation/messages.js.map +1 -0
- package/dist/automation/record.d.ts +47 -0
- package/dist/automation/record.js +177 -0
- package/dist/automation/record.js.map +1 -0
- package/dist/automation/types.d.ts +143 -0
- package/dist/automation/when.d.ts +36 -0
- package/dist/automation/when.js +168 -0
- package/dist/automation/when.js.map +1 -0
- package/dist/blocks.d.ts +185 -0
- package/dist/browser.js +292 -0
- package/dist/browser.js.map +1 -0
- package/dist/call.d.ts +89 -0
- package/dist/call.js +218 -0
- package/dist/call.js.map +1 -0
- package/dist/channelParts.js +26 -0
- package/dist/channelParts.js.map +1 -0
- package/dist/classes.js +8 -3
- package/dist/classes.js.map +1 -0
- package/dist/client.d.ts +146 -54
- package/dist/client.js +204 -1
- package/dist/client.js.map +1 -0
- package/dist/conversationFiles.js +46 -0
- package/dist/conversationFiles.js.map +1 -0
- package/dist/credentials.d.ts +45 -0
- package/dist/credentials.js +98 -0
- package/dist/credentials.js.map +1 -0
- package/dist/dev.js +17 -0
- package/dist/dev.js.map +1 -0
- package/dist/es.d.ts +17 -0
- package/dist/es.js +382 -0
- package/dist/es.js.map +1 -0
- package/dist/files.d.ts +21 -0
- package/dist/files.js +214 -0
- package/dist/files.js.map +1 -0
- package/dist/frames.d.ts +115 -0
- package/dist/frames.js +219 -0
- package/dist/frames.js.map +1 -0
- package/dist/icons.js +29 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +63 -60
- package/dist/index.js +59 -45
- package/dist/kit/AudioPlayer.d.ts +20 -0
- package/dist/kit/AudioPlayer.js +116 -0
- package/dist/kit/AudioPlayer.js.map +1 -0
- package/dist/kit/Button.d.ts +29 -0
- package/dist/kit/Button.js +59 -0
- package/dist/kit/Button.js.map +1 -0
- package/dist/kit/Card.d.ts +16 -0
- package/dist/kit/Card.js +36 -0
- package/dist/kit/Card.js.map +1 -0
- package/dist/kit/Chart.js +152 -0
- package/dist/kit/Chart.js.map +1 -0
- package/dist/kit/Choices.d.ts +21 -0
- package/dist/kit/Choices.js +99 -0
- package/dist/kit/Choices.js.map +1 -0
- package/dist/kit/Combobox.d.ts +26 -0
- package/dist/kit/Combobox.js +190 -0
- package/dist/kit/Combobox.js.map +1 -0
- package/dist/kit/DateField.d.ts +17 -0
- package/dist/kit/DateField.js +133 -0
- package/dist/kit/DateField.js.map +1 -0
- package/dist/kit/Field.d.ts +40 -0
- package/dist/kit/Field.js +98 -0
- package/dist/kit/Field.js.map +1 -0
- package/dist/kit/FileField.d.ts +113 -0
- package/dist/kit/FileField.js +341 -0
- package/dist/kit/FileField.js.map +1 -0
- package/dist/kit/FileMark.d.ts +15 -0
- package/dist/kit/FileMark.js +39 -0
- package/dist/kit/FileMark.js.map +1 -0
- package/dist/kit/Inputs.d.ts +59 -0
- package/dist/kit/Inputs.js +205 -0
- package/dist/kit/Inputs.js.map +1 -0
- package/dist/kit/List.d.ts +47 -0
- package/dist/kit/List.js +85 -0
- package/dist/kit/List.js.map +1 -0
- package/dist/kit/Mark.d.ts +30 -0
- package/dist/kit/Mark.js +27 -0
- package/dist/kit/Mark.js.map +1 -0
- package/dist/kit/MarkStack.d.ts +15 -0
- package/dist/kit/MarkStack.js +26 -0
- package/dist/kit/MarkStack.js.map +1 -0
- package/dist/kit/Note.d.ts +11 -0
- package/dist/kit/Note.js +31 -0
- package/dist/kit/Note.js.map +1 -0
- package/dist/kit/Popover.js +90 -0
- package/dist/kit/Popover.js.map +1 -0
- package/dist/kit/RangeField.d.ts +14 -0
- package/dist/kit/RangeField.js +47 -0
- package/dist/kit/RangeField.js.map +1 -0
- package/dist/kit/RatingField.d.ts +14 -0
- package/dist/kit/RatingField.js +50 -0
- package/dist/kit/RatingField.js.map +1 -0
- package/dist/kit/Stat.d.ts +26 -0
- package/dist/kit/Stat.js +46 -0
- package/dist/kit/Stat.js.map +1 -0
- package/dist/kit/Switch.d.ts +14 -0
- package/dist/kit/Switch.js +21 -0
- package/dist/kit/Switch.js.map +1 -0
- package/dist/kit/Tag.d.ts +16 -0
- package/dist/kit/Tag.js +20 -0
- package/dist/kit/Tag.js.map +1 -0
- package/dist/kit/Tile.d.ts +34 -0
- package/dist/kit/Tile.js +52 -0
- package/dist/kit/Tile.js.map +1 -0
- package/dist/kit/TimeField.d.ts +31 -0
- package/dist/kit/TimeField.js +109 -0
- package/dist/kit/TimeField.js.map +1 -0
- package/dist/kit/context.d.ts +22 -0
- package/dist/kit/context.js +46 -0
- package/dist/kit/context.js.map +1 -0
- package/dist/kit/dates.d.ts +14 -0
- package/dist/kit/dates.js +129 -0
- package/dist/kit/dates.js.map +1 -0
- package/dist/kit/messages.d.ts +99 -0
- package/dist/kit/messages.js +66 -0
- package/dist/kit/messages.js.map +1 -0
- package/dist/kit/numbers.d.ts +12 -0
- package/dist/kit/numbers.js +40 -0
- package/dist/kit/numbers.js.map +1 -0
- package/dist/kit/options.d.ts +10 -0
- package/dist/kit/options.js +23 -0
- package/dist/kit/options.js.map +1 -0
- package/dist/kit/uploads.d.ts +42 -0
- package/dist/kit/uploads.js +165 -0
- package/dist/kit/uploads.js.map +1 -0
- package/dist/kit/waveform.js +76 -0
- package/dist/kit/waveform.js.map +1 -0
- package/dist/locale.d.ts +1 -0
- package/dist/locale.js +1 -0
- package/dist/markdown.js +84 -0
- package/dist/markdown.js.map +1 -0
- package/dist/marks.js +217 -0
- package/dist/marks.js.map +1 -0
- package/dist/reveal.js +48 -0
- package/dist/reveal.js.map +1 -0
- package/dist/stepGlyphs.js +62 -0
- package/dist/stepGlyphs.js.map +1 -0
- package/dist/surface/Form.js +264 -0
- package/dist/surface/Form.js.map +1 -0
- package/dist/surface/Markdown.js +42 -0
- package/dist/surface/Markdown.js.map +1 -0
- package/dist/surface/Surface.d.ts +31 -17
- package/dist/surface/Surface.js +480 -57
- package/dist/surface/Surface.js.map +1 -0
- package/dist/surface/scope.d.ts +32 -0
- package/dist/surface/scope.js +23 -0
- package/dist/surface/scope.js.map +1 -0
- package/dist/surface/values.d.ts +44 -0
- package/dist/surface/values.js +237 -0
- package/dist/surface/values.js.map +1 -0
- package/dist/tint.d.ts +10 -0
- package/dist/tint.js +19 -0
- package/dist/tint.js.map +1 -0
- package/dist/types.d.ts +534 -0
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -0
- package/dist/useAgentFace.d.ts +18 -0
- package/dist/useAgentFace.js +45 -0
- package/dist/useAgentFace.js.map +1 -0
- package/dist/useCall.d.ts +39 -0
- package/dist/useCall.js +273 -0
- package/dist/useCall.js.map +1 -0
- package/dist/useConversation.d.ts +77 -0
- package/dist/useConversation.js +523 -0
- package/dist/useConversation.js.map +1 -0
- package/dist/useDictation.d.ts +17 -0
- package/dist/useDictation.js +68 -0
- package/dist/useDictation.js.map +1 -0
- package/dist/useLive.d.ts +26 -0
- package/dist/useLive.js +88 -0
- package/dist/useLive.js.map +1 -0
- package/dist/usePolled.js +68 -0
- package/dist/usePolled.js.map +1 -0
- package/dist/voice/Orb.d.ts +10 -9
- package/dist/voice/Orb.js +43 -39
- package/dist/voice/Orb.js.map +1 -0
- package/dist/voice/StillOrb.js +33 -0
- package/dist/voice/StillOrb.js.map +1 -0
- package/dist/voice/WebGLOrb.js +98 -0
- package/dist/voice/WebGLOrb.js.map +1 -0
- package/dist/voice/fluidDots.js +161 -0
- package/dist/voice/fluidDots.js.map +1 -0
- package/dist/voice/motion.js +84 -0
- package/dist/voice/motion.js.map +1 -0
- package/dist/voice/orbs.d.ts +32 -0
- package/dist/voice/orbs.js +16 -0
- package/dist/voice/orbs.js.map +1 -0
- package/dist/voice/useReducedMotion.js +16 -16
- package/dist/voice/useReducedMotion.js.map +1 -0
- package/dist/voice/wave.js +116 -0
- package/dist/voice/wave.js.map +1 -0
- package/dist/voice/webgl.js +177 -0
- package/dist/voice/webgl.js.map +1 -0
- package/dist/widget.js +284 -8
- package/package.json +49 -39
- package/src/AgentAbout.tsx +1621 -0
- package/src/AgentCard.tsx +123 -0
- package/src/AgentChat.tsx +1795 -0
- package/src/AgentSpace.tsx +540 -0
- package/src/AgentTasks.tsx +163 -0
- package/src/BrowserView.tsx +442 -0
- package/src/FileView.tsx +620 -0
- package/src/Modes.tsx +112 -0
- package/src/VoiceCall.tsx +411 -0
- package/src/about.ts +355 -0
- package/src/agentIcons.ts +56 -0
- package/src/automation/Automation.tsx +308 -0
- package/src/automation/RunView.tsx +213 -0
- package/src/automation/cron.ts +196 -0
- package/src/automation/marks.tsx +144 -0
- package/src/automation/messages.ts +231 -0
- package/src/automation/record.ts +206 -0
- package/src/automation/types.ts +146 -0
- package/src/automation/when.ts +195 -0
- package/src/blocks.ts +249 -0
- package/src/browser.ts +334 -0
- package/src/call.ts +300 -0
- package/src/channelParts.ts +17 -0
- package/src/classes.ts +10 -0
- package/src/client.ts +397 -0
- package/src/conversationFiles.ts +54 -0
- package/src/credentials.ts +158 -0
- package/src/dev.ts +20 -0
- package/src/es.ts +423 -0
- package/src/files.ts +238 -0
- package/src/frames.ts +291 -0
- package/src/icons.tsx +49 -0
- package/src/index.ts +270 -0
- package/src/kit/AudioPlayer.tsx +129 -0
- package/src/kit/Button.tsx +97 -0
- package/src/kit/Card.tsx +47 -0
- package/src/kit/Chart.tsx +129 -0
- package/src/kit/Choices.tsx +131 -0
- package/src/kit/Combobox.tsx +247 -0
- package/src/kit/DateField.tsx +156 -0
- package/src/kit/Field.tsx +137 -0
- package/src/kit/FileField.tsx +492 -0
- package/src/kit/FileMark.tsx +56 -0
- package/src/kit/Inputs.tsx +250 -0
- package/src/kit/List.tsx +135 -0
- package/src/kit/Mark.tsx +64 -0
- package/src/kit/MarkStack.tsx +29 -0
- package/src/kit/Note.tsx +42 -0
- package/src/kit/Popover.tsx +121 -0
- package/src/kit/RangeField.tsx +53 -0
- package/src/kit/RatingField.tsx +62 -0
- package/src/kit/Stat.tsx +60 -0
- package/src/kit/Switch.tsx +28 -0
- package/src/kit/Tag.tsx +32 -0
- package/src/kit/Tile.tsx +74 -0
- package/src/kit/TimeField.tsx +157 -0
- package/src/kit/context.tsx +246 -0
- package/src/kit/dates.ts +150 -0
- package/src/kit/messages.ts +160 -0
- package/src/kit/numbers.ts +44 -0
- package/src/kit/options.ts +30 -0
- package/src/kit/uploads.ts +244 -0
- package/src/kit/waveform.ts +84 -0
- package/src/locale.ts +6 -0
- package/src/markdown.ts +69 -0
- package/src/marks.tsx +328 -0
- package/src/reveal.ts +52 -0
- package/src/stepGlyphs.ts +83 -0
- package/src/styles.css +6961 -0
- package/src/surface/Form.tsx +299 -0
- package/src/surface/Markdown.tsx +55 -0
- package/src/surface/Surface.tsx +605 -0
- package/src/surface/scope.ts +82 -0
- package/src/surface/values.ts +361 -0
- package/src/tint.ts +14 -0
- package/src/types.ts +596 -0
- package/src/useAgentFace.ts +47 -0
- package/src/useCall.ts +292 -0
- package/src/useConversation.ts +627 -0
- package/src/useDictation.ts +83 -0
- package/src/useLive.ts +115 -0
- package/src/usePolled.ts +60 -0
- package/src/voice/Orb.tsx +45 -0
- package/src/voice/StillOrb.tsx +29 -0
- package/src/voice/WebGLOrb.tsx +98 -0
- package/src/voice/fluidDots.tsx +171 -0
- package/src/voice/motion.ts +112 -0
- package/src/voice/orbs.ts +39 -0
- package/src/voice/useReducedMotion.ts +24 -0
- package/src/voice/wave.tsx +129 -0
- package/src/voice/webgl.ts +209 -0
- package/src/widget/css.d.ts +5 -0
- package/src/widget/element.tsx +535 -0
- package/src/widget/index.ts +10 -0
- package/src/widget/mount.ts +27 -0
- package/src/widget/widget.css +253 -0
- package/dist/SignalcoreProvider.d.ts +0 -113
- package/dist/SignalcoreProvider.js +0 -84
- package/dist/automations/AppMarks.d.ts +0 -11
- package/dist/automations/AppMarks.js +0 -18
- package/dist/automations/AutomationCard.d.ts +0 -27
- package/dist/automations/AutomationCard.js +0 -53
- package/dist/automations/AutomationsWindow.d.ts +0 -38
- package/dist/automations/AutomationsWindow.js +0 -57
- package/dist/automations/Card.d.ts +0 -46
- package/dist/automations/Card.js +0 -45
- package/dist/automations/ScheduleMarks.d.ts +0 -13
- package/dist/automations/ScheduleMarks.js +0 -24
- package/dist/automations/presentationIcons.d.ts +0 -7
- package/dist/automations/presentationIcons.js +0 -67
- package/dist/automations/schedule.d.ts +0 -25
- package/dist/automations/schedule.js +0 -59
- package/dist/automations/time.d.ts +0 -3
- package/dist/automations/time.js +0 -25
- package/dist/browser/BrowserView.d.ts +0 -43
- package/dist/browser/BrowserView.js +0 -94
- package/dist/browser/room.d.ts +0 -21
- package/dist/browser/room.js +0 -33
- package/dist/browser/useBrowserSession.d.ts +0 -17
- package/dist/browser/useBrowserSession.js +0 -67
- package/dist/builder/BuilderChat.d.ts +0 -32
- package/dist/builder/BuilderChat.js +0 -41
- package/dist/builder/BuilderTranscript.d.ts +0 -49
- package/dist/builder/BuilderTranscript.js +0 -62
- package/dist/builder/StatusLine.d.ts +0 -8
- package/dist/builder/StatusLine.js +0 -17
- package/dist/builder/answer.d.ts +0 -7
- package/dist/builder/answer.js +0 -8
- package/dist/builder/blocks.d.ts +0 -31
- package/dist/builder/blocks.js +0 -74
- package/dist/builder/items.d.ts +0 -15
- package/dist/builder/items.js +0 -21
- package/dist/builder/steps.d.ts +0 -20
- package/dist/builder/steps.js +0 -120
- package/dist/builder/time.d.ts +0 -4
- package/dist/builder/time.js +0 -24
- package/dist/builder/useBuildSession.d.ts +0 -36
- package/dist/builder/useBuildSession.js +0 -130
- package/dist/builder/workingOn.d.ts +0 -7
- package/dist/builder/workingOn.js +0 -15
- package/dist/chat/AgentChat.d.ts +0 -37
- package/dist/chat/AgentChat.js +0 -21
- package/dist/chat/ChatView.d.ts +0 -25
- package/dist/chat/ChatView.js +0 -34
- package/dist/chat/Composer.d.ts +0 -20
- package/dist/chat/Composer.js +0 -22
- package/dist/chat/MessageRow.d.ts +0 -22
- package/dist/chat/MessageRow.js +0 -32
- package/dist/chat/arrival.d.ts +0 -15
- package/dist/chat/arrival.js +0 -25
- package/dist/chat/history.d.ts +0 -24
- package/dist/chat/history.js +0 -45
- package/dist/chat/moments.d.ts +0 -25
- package/dist/chat/moments.js +0 -72
- package/dist/chat/types.d.ts +0 -12
- package/dist/chat/types.js +0 -1
- package/dist/chat/useComposer.d.ts +0 -46
- package/dist/chat/useComposer.js +0 -62
- package/dist/chat/useConversation.d.ts +0 -35
- package/dist/chat/useConversation.js +0 -71
- package/dist/chat/useStickToBottom.d.ts +0 -9
- package/dist/chat/useStickToBottom.js +0 -33
- package/dist/chat/useTurns.d.ts +0 -49
- package/dist/chat/useTurns.js +0 -111
- package/dist/classes.d.ts +0 -2
- package/dist/development.d.ts +0 -5
- package/dist/development.js +0 -8
- package/dist/flow/FlowWindow.d.ts +0 -42
- package/dist/flow/FlowWindow.js +0 -126
- package/dist/flow/index.d.ts +0 -16
- package/dist/flow/index.js +0 -16
- package/dist/flow/kinds.d.ts +0 -23
- package/dist/flow/kinds.js +0 -48
- package/dist/flow/map.d.ts +0 -44
- package/dist/flow/map.js +0 -225
- package/dist/flow/nodePaths.d.ts +0 -7
- package/dist/flow/nodePaths.js +0 -17
- package/dist/flow/relations.d.ts +0 -42
- package/dist/flow/relations.js +0 -174
- package/dist/host.d.ts +0 -124
- package/dist/host.js +0 -1
- package/dist/live/LiveView.d.ts +0 -28
- package/dist/live/LiveView.js +0 -55
- package/dist/live/capture.d.ts +0 -20
- package/dist/live/capture.js +0 -100
- package/dist/live/follow.d.ts +0 -26
- package/dist/live/follow.js +0 -72
- package/dist/live/paint.d.ts +0 -13
- package/dist/live/paint.js +0 -77
- package/dist/live/useLiveStream.d.ts +0 -16
- package/dist/live/useLiveStream.js +0 -57
- package/dist/look.d.ts +0 -33
- package/dist/look.js +0 -241
- package/dist/messages/en.d.ts +0 -3
- package/dist/messages/en.js +0 -251
- package/dist/messages/es.d.ts +0 -3
- package/dist/messages/es.js +0 -251
- package/dist/messages/index.d.ts +0 -16
- package/dist/messages/index.js +0 -33
- package/dist/messages/types.d.ts +0 -246
- package/dist/messages/types.js +0 -1
- package/dist/parts/Button.d.ts +0 -18
- package/dist/parts/Button.js +0 -17
- package/dist/parts/Icon.d.ts +0 -39
- package/dist/parts/Icon.js +0 -37
- package/dist/parts/Input.d.ts +0 -6
- package/dist/parts/Input.js +0 -11
- package/dist/parts/Spinner.d.ts +0 -2
- package/dist/parts/Spinner.js +0 -7
- package/dist/patterns.d.ts +0 -15
- package/dist/patterns.js +0 -5
- package/dist/presets.d.ts +0 -82
- package/dist/presets.js +0 -81
- package/dist/primitives.d.ts +0 -22
- package/dist/primitives.js +0 -58
- package/dist/request/RequestCard.d.ts +0 -34
- package/dist/request/RequestCard.js +0 -101
- package/dist/request/approval/ApprovalPreview.d.ts +0 -5
- package/dist/request/approval/ApprovalPreview.js +0 -27
- package/dist/request/approval/shapes.d.ts +0 -32
- package/dist/request/approval/shapes.js +0 -68
- package/dist/request/apps.d.ts +0 -11
- package/dist/request/apps.js +0 -27
- package/dist/request/cards.d.ts +0 -12
- package/dist/request/cards.js +0 -24
- package/dist/request/deliver.d.ts +0 -12
- package/dist/request/deliver.js +0 -21
- package/dist/request/handOver.d.ts +0 -18
- package/dist/request/handOver.js +0 -33
- package/dist/request/kinds/Approval.d.ts +0 -3
- package/dist/request/kinds/Approval.js +0 -9
- package/dist/request/kinds/Choice.d.ts +0 -3
- package/dist/request/kinds/Choice.js +0 -8
- package/dist/request/kinds/Connect.d.ts +0 -9
- package/dist/request/kinds/Connect.js +0 -119
- package/dist/request/kinds/FreeText.d.ts +0 -3
- package/dist/request/kinds/FreeText.js +0 -20
- package/dist/request/kinds/HandOver.d.ts +0 -13
- package/dist/request/kinds/HandOver.js +0 -20
- package/dist/request/kinds/Secret.d.ts +0 -7
- package/dist/request/kinds/Secret.js +0 -49
- package/dist/request/kinds/Upload.d.ts +0 -6
- package/dist/request/kinds/Upload.js +0 -47
- package/dist/request/types.d.ts +0 -83
- package/dist/request/types.js +0 -1
- package/dist/safeUrl.d.ts +0 -6
- package/dist/safeUrl.js +0 -8
- package/dist/stream/builder.d.ts +0 -176
- package/dist/stream/builder.js +0 -202
- package/dist/stream/reduce.d.ts +0 -51
- package/dist/stream/reduce.js +0 -58
- package/dist/stream/untilAborted.d.ts +0 -7
- package/dist/stream/untilAborted.js +0 -32
- package/dist/stream/useRunStream.d.ts +0 -26
- package/dist/stream/useRunStream.js +0 -137
- package/dist/styles.css +0 -2318
- package/dist/surface/HostNode.d.ts +0 -14
- package/dist/surface/HostNode.js +0 -30
- package/dist/surface/Node.d.ts +0 -7
- package/dist/surface/Node.js +0 -49
- package/dist/surface/SurfaceBoundary.d.ts +0 -26
- package/dist/surface/SurfaceBoundary.js +0 -20
- package/dist/surface/bindings.d.ts +0 -14
- package/dist/surface/bindings.js +0 -37
- package/dist/surface/check.d.ts +0 -27
- package/dist/surface/check.js +0 -102
- package/dist/surface/format.d.ts +0 -10
- package/dist/surface/format.js +0 -32
- package/dist/surface/hosts.d.ts +0 -6
- package/dist/surface/hosts.js +0 -11
- package/dist/surface/scene.d.ts +0 -21
- package/dist/surface/scene.js +0 -8
- package/dist/surface/templates/Browser.d.ts +0 -6
- package/dist/surface/templates/Browser.js +0 -11
- package/dist/surface/templates/Chart.d.ts +0 -6
- package/dist/surface/templates/Chart.js +0 -13
- package/dist/surface/templates/Choices.d.ts +0 -3
- package/dist/surface/templates/Choices.js +0 -12
- package/dist/surface/templates/Form.d.ts +0 -3
- package/dist/surface/templates/Form.js +0 -44
- package/dist/surface/templates/KeyValue.d.ts +0 -3
- package/dist/surface/templates/KeyValue.js +0 -7
- package/dist/surface/templates/Layout.d.ts +0 -5
- package/dist/surface/templates/Layout.js +0 -16
- package/dist/surface/templates/Live.d.ts +0 -6
- package/dist/surface/templates/Live.js +0 -9
- package/dist/surface/templates/Media.d.ts +0 -5
- package/dist/surface/templates/Media.js +0 -13
- package/dist/surface/templates/Slots.d.ts +0 -3
- package/dist/surface/templates/Slots.js +0 -19
- package/dist/surface/templates/Table.d.ts +0 -3
- package/dist/surface/templates/Table.js +0 -12
- package/dist/surface/templates/Text.d.ts +0 -4
- package/dist/surface/templates/Text.js +0 -15
- package/dist/surface/templates/index.d.ts +0 -7
- package/dist/surface/templates/index.js +0 -32
- package/dist/surface/types.d.ts +0 -68
- package/dist/surface/types.js +0 -6
- package/dist/theme.d.ts +0 -62
- package/dist/theme.js +0 -9
- package/dist/useTokens.d.ts +0 -7
- package/dist/useTokens.js +0 -41
- package/dist/voice/VoiceWindow.d.ts +0 -18
- package/dist/voice/VoiceWindow.js +0 -35
- package/dist/voice/index.d.ts +0 -13
- package/dist/voice/index.js +0 -12
- package/dist/voice/meter.d.ts +0 -16
- package/dist/voice/meter.js +0 -52
- package/dist/voice/orbColors.d.ts +0 -16
- package/dist/voice/orbColors.js +0 -75
- package/dist/voice/pushable.d.ts +0 -16
- package/dist/voice/pushable.js +0 -56
- package/dist/voice/useDictation.d.ts +0 -24
- package/dist/voice/useDictation.js +0 -60
- package/dist/voice/useReducedMotion.d.ts +0 -5
- package/dist/voice/useVoice.d.ts +0 -70
- package/dist/voice/useVoice.js +0 -197
- package/dist/voice/useVoicePrimitives.d.ts +0 -7
- package/dist/voice/useVoicePrimitives.js +0 -11
- package/dist/voice/voice.d.ts +0 -55
- package/dist/voice/voice.js +0 -9
- package/dist/voice/webSpeech.d.ts +0 -33
- package/dist/voice/webSpeech.js +0 -258
- package/dist/widget.js.map +0 -1
- package/dist/windows/AgentSpace.d.ts +0 -78
- package/dist/windows/AgentSpace.js +0 -135
- package/dist/windows/Captions.d.ts +0 -13
- package/dist/windows/Captions.js +0 -22
- package/dist/windows/Dock.d.ts +0 -37
- package/dist/windows/Dock.js +0 -22
- package/dist/windows/Journal.d.ts +0 -15
- package/dist/windows/Journal.js +0 -19
- package/dist/windows/KindMark.d.ts +0 -7
- package/dist/windows/KindMark.js +0 -31
- package/dist/windows/Pending.d.ts +0 -8
- package/dist/windows/Pending.js +0 -17
- package/dist/windows/Stage.d.ts +0 -18
- package/dist/windows/Stage.js +0 -21
- package/dist/windows/StatusLabel.d.ts +0 -9
- package/dist/windows/StatusLabel.js +0 -7
- package/dist/windows/Strip.d.ts +0 -17
- package/dist/windows/Strip.js +0 -42
- package/dist/windows/SurfaceWindow.d.ts +0 -20
- package/dist/windows/SurfaceWindow.js +0 -12
- package/dist/windows/WindowFrame.d.ts +0 -23
- package/dist/windows/WindowFrame.js +0 -22
- package/dist/windows/hearing.d.ts +0 -11
- package/dist/windows/hearing.js +0 -26
- package/dist/windows/kinds.d.ts +0 -47
- package/dist/windows/kinds.js +0 -28
- package/dist/windows/reduce.d.ts +0 -98
- package/dist/windows/reduce.js +0 -151
- package/dist/windows/registry.d.ts +0 -18
- package/dist/windows/registry.js +0 -61
- package/dist/windows/reveal.d.ts +0 -9
- package/dist/windows/reveal.js +0 -6
- package/dist/windows/space.d.ts +0 -21
- package/dist/windows/space.js +0 -6
- package/dist/windows/status.d.ts +0 -11
- package/dist/windows/status.js +0 -30
- package/dist/windows/types.d.ts +0 -15
- package/dist/windows/types.js +0 -1
- package/dist/windows/useLoaded.d.ts +0 -44
- package/dist/windows/useLoaded.js +0 -58
- package/dist/windows/useUnread.d.ts +0 -7
- package/dist/windows/useUnread.js +0 -21
- package/dist/windows/useWindows.d.ts +0 -70
- package/dist/windows/useWindows.js +0 -60
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { KitPart } from "./kit/context.js";
|
|
2
|
+
import { AgentTint } from "./tint.js";
|
|
3
|
+
import { OrbStyle } from "./voice/orbs.js";
|
|
4
|
+
import { CallEndedBy, CallLook, CallProblem } from "./call.js";
|
|
5
|
+
import { CallJoin } from "./useCall.js";
|
|
6
|
+
import { ReactNode } from "react";
|
|
7
|
+
//#region src/VoiceCall.d.ts
|
|
8
|
+
/** The words a call says; a host gives its own, in its language. */
|
|
9
|
+
export interface VoiceCallMessages {
|
|
10
|
+
/** The call's name, for those who can't see it. */
|
|
11
|
+
call: (name: string) => string;
|
|
12
|
+
/** What the call is doing, in a word or two. */
|
|
13
|
+
states: Readonly<Record<Exclude<CallLook, "problem">, string>>;
|
|
14
|
+
/** Under the state while the call connects. */
|
|
15
|
+
calling: (name: string) => string;
|
|
16
|
+
/** Why the call ended, before how long it lasted. */
|
|
17
|
+
ended: Readonly<Record<CallEndedBy, (name: string) => string>>;
|
|
18
|
+
/** Why the call never began, and what the person can do about it. */
|
|
19
|
+
problems: Readonly<Record<CallProblem, {
|
|
20
|
+
title: (name: string) => string;
|
|
21
|
+
help: string;
|
|
22
|
+
}>>;
|
|
23
|
+
mute: string;
|
|
24
|
+
hangUp: string;
|
|
25
|
+
/** Under the controls, where there is a keyboard. */
|
|
26
|
+
keys: string;
|
|
27
|
+
/** Under the controls while the microphone is off. */
|
|
28
|
+
muted: string;
|
|
29
|
+
/** The browser held the agent's voice until a press: the button that lets it play. */
|
|
30
|
+
hear: (name: string) => string;
|
|
31
|
+
}
|
|
32
|
+
export declare const VOICE_CALL_MESSAGES: VoiceCallMessages;
|
|
33
|
+
/** The call's parts, by the class each carries; `classNames` adds a host's own under the same keys. */
|
|
34
|
+
export type VoiceCallPart = "sc-call" | `sc-call--${CallLook}` | `sc-call--${AgentTint}` | "sc-call--on" | "sc-call--muted" | "sc-call__stage" | "sc-call__orb" | "sc-call__state" | "sc-call__line" | "sc-call__sound" | "sc-call__controls" | "sc-call__control" | "sc-call__mute" | "sc-call__hangup" | "sc-call__hint" | "sc-call__captions" | "sc-call__after";
|
|
35
|
+
export interface VoiceCallProps {
|
|
36
|
+
/**
|
|
37
|
+
* Where to join: LiveKit's address and a token for the call's room (our API's
|
|
38
|
+
* `client.conversations.call(agentId)` answers both, `client.agents.call(id)` for the owner's
|
|
39
|
+
* test). Called once, when the call starts, after the microphone is open.
|
|
40
|
+
*/
|
|
41
|
+
connect: () => Promise<CallJoin>;
|
|
42
|
+
/** The agent's name, for the words that say it. */
|
|
43
|
+
name: string;
|
|
44
|
+
/**
|
|
45
|
+
* The agent's own tint (`agentTint(id)`), worn by the call's chrome: the orb's shader paints its
|
|
46
|
+
* own colours, and the still orb that stands in where there is no WebGL wears it.
|
|
47
|
+
*/
|
|
48
|
+
tint?: AgentTint | undefined;
|
|
49
|
+
/** How the orb is drawn: `"wave"` (the default) or `"fluid-dots"`. */
|
|
50
|
+
orb?: OrbStyle | undefined;
|
|
51
|
+
/** The orb's diameter in pixels: 280 by default, less for a call in a small panel. */
|
|
52
|
+
orbSize?: number | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Why the call ended as the API keeps it, once the host has read it (`endedByReason` of its
|
|
55
|
+
* conversation's call): what the end says when the agent's side closed the room (its goodbye,
|
|
56
|
+
* or its longest time), which the room doesn't tell. Until then the end says how long it was.
|
|
57
|
+
*/
|
|
58
|
+
endedBy?: CallEndedBy | null | undefined;
|
|
59
|
+
messages?: Partial<VoiceCallMessages> | undefined;
|
|
60
|
+
/** The host's classes for the call's parts and the kit's (the orb's `sc-orb…`, the buttons'). */
|
|
61
|
+
classNames?: Partial<Record<VoiceCallPart | KitPart, string>> | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* The call is over, once: it ended (`answered`: the agent took it; `problem` null), or it
|
|
64
|
+
* couldn't begin (`problem`: why, which the call shows until the host takes it away).
|
|
65
|
+
*/
|
|
66
|
+
onEnd?: ((answered: boolean, problem: CallProblem | null) => void) | undefined;
|
|
67
|
+
/** The agent took the call: its time counts from now. Once. */
|
|
68
|
+
onAnswer?: (() => void) | undefined;
|
|
69
|
+
/** What the host offers once the call is over, in place of the controls: call again, write. */
|
|
70
|
+
after?: ReactNode;
|
|
71
|
+
/** What is being said, drawn by the host under the orb while the call is on (`sc-call__captions`). */
|
|
72
|
+
captions?: ReactNode;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A voice call with an agent, the one a customer has on the phone: the call starts when it
|
|
76
|
+
* mounts and ends when it unmounts. The orb, large in the middle, rests while the line is found,
|
|
77
|
+
* moves with whoever speaks (the agent's voice while it speaks, the person's while it listens),
|
|
78
|
+
* calms while the agent thinks, and fades once the call is over; under it what the call
|
|
79
|
+
* is doing in a word, its time, and the two controls a phone has, mute and hang up. A microphone
|
|
80
|
+
* that can't be used, or a call that can't be made (the API's refusal among them), says why in
|
|
81
|
+
* words and what to do; an end says who ended it (the room's own word, or the API's: `endedBy`)
|
|
82
|
+
* and how long it lasted.
|
|
83
|
+
*
|
|
84
|
+
* Space mutes and unmutes from anywhere that isn't a field or a control of the page's own.
|
|
85
|
+
* Escape never hangs up: it is the key that closes things, pressed by reflex, and a call ended
|
|
86
|
+
* by accident can't be taken back, so ending one is the red button's alone. The orb stands
|
|
87
|
+
* still under reduced motion, one frame per state: the words say the rest.
|
|
88
|
+
*/
|
|
89
|
+
export declare function VoiceCall(props: VoiceCallProps): import("react").JSX.Element;
|
|
90
|
+
//#endregion
|
|
91
|
+
//# sourceMappingURL=VoiceCall.d.ts.map
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { classes } from "./classes.js";
|
|
2
|
+
import { KitProvider } from "./kit/context.js";
|
|
3
|
+
import { Button } from "./kit/Button.js";
|
|
4
|
+
import { durationOf, keyBelongsElsewhere, lookOf, orbOf } from "./call.js";
|
|
5
|
+
import { useCall } from "./useCall.js";
|
|
6
|
+
import { Orb } from "./voice/Orb.js";
|
|
7
|
+
import { useEffect, useRef, useState } from "react";
|
|
8
|
+
import { MicrophoneIcon, MicrophoneSlashIcon, PhoneDisconnectIcon, SpeakerHighIcon } from "@phosphor-icons/react";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/VoiceCall.tsx
|
|
11
|
+
/** How big the orb is drawn: large, in the middle, with room for it to grow when the voice is loud. */
|
|
12
|
+
const ORB_SIZE = 280;
|
|
13
|
+
/** The orb's level where nobody it follows is speaking. */
|
|
14
|
+
const SILENT = () => 0;
|
|
15
|
+
const VOICE_CALL_MESSAGES = {
|
|
16
|
+
call: (name) => `Call with ${name}`,
|
|
17
|
+
states: {
|
|
18
|
+
connecting: "Connecting…",
|
|
19
|
+
listening: "Listening",
|
|
20
|
+
thinking: "Thinking",
|
|
21
|
+
speaking: "Speaking",
|
|
22
|
+
reconnecting: "Reconnecting…",
|
|
23
|
+
ended: "Call ended"
|
|
24
|
+
},
|
|
25
|
+
calling: (name) => `Calling ${name}`,
|
|
26
|
+
ended: {
|
|
27
|
+
person: () => "You hung up",
|
|
28
|
+
agent: (name) => `${name} hung up`,
|
|
29
|
+
limit: () => "It reached its longest time",
|
|
30
|
+
dropped: () => "The line dropped"
|
|
31
|
+
},
|
|
32
|
+
problems: {
|
|
33
|
+
denied: {
|
|
34
|
+
title: () => "The microphone isn't allowed",
|
|
35
|
+
help: "Allow the microphone for this page (the icon beside the address) and call again."
|
|
36
|
+
},
|
|
37
|
+
nomic: {
|
|
38
|
+
title: () => "No microphone",
|
|
39
|
+
help: "Plug one in, or pick another in your system's sound settings, and call again."
|
|
40
|
+
},
|
|
41
|
+
inuse: {
|
|
42
|
+
title: () => "The microphone is busy",
|
|
43
|
+
help: "Another app is using it. Close it and call again."
|
|
44
|
+
},
|
|
45
|
+
unsupported: {
|
|
46
|
+
title: () => "This browser can't call",
|
|
47
|
+
help: "Open this page over https in a recent Chrome, Edge, Safari or Firefox."
|
|
48
|
+
},
|
|
49
|
+
off: {
|
|
50
|
+
title: () => "Calls aren't set up",
|
|
51
|
+
help: "Calls are turned on where your agents work. Ask whoever set it up."
|
|
52
|
+
},
|
|
53
|
+
builder: {
|
|
54
|
+
title: (name) => `${name} doesn't take calls`,
|
|
55
|
+
help: "A squad's builder only writes. Call one of the squad's agents."
|
|
56
|
+
},
|
|
57
|
+
refused: {
|
|
58
|
+
title: (name) => `${name} can't take this call`,
|
|
59
|
+
help: "Try again in a moment."
|
|
60
|
+
},
|
|
61
|
+
failed: {
|
|
62
|
+
title: (name) => `Couldn't call ${name}`,
|
|
63
|
+
help: "Check your connection and try again."
|
|
64
|
+
},
|
|
65
|
+
unanswered: {
|
|
66
|
+
title: (name) => `${name} isn't answering`,
|
|
67
|
+
help: "Calls aren't being taken right now. Try again in a moment."
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
mute: "Mute",
|
|
71
|
+
hangUp: "Hang up",
|
|
72
|
+
keys: "Space mutes and unmutes",
|
|
73
|
+
muted: "Your microphone is off",
|
|
74
|
+
hear: (name) => `Hear ${name}`
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* A voice call with an agent, the one a customer has on the phone: the call starts when it
|
|
78
|
+
* mounts and ends when it unmounts. The orb, large in the middle, rests while the line is found,
|
|
79
|
+
* moves with whoever speaks (the agent's voice while it speaks, the person's while it listens),
|
|
80
|
+
* calms while the agent thinks, and fades once the call is over; under it what the call
|
|
81
|
+
* is doing in a word, its time, and the two controls a phone has, mute and hang up. A microphone
|
|
82
|
+
* that can't be used, or a call that can't be made (the API's refusal among them), says why in
|
|
83
|
+
* words and what to do; an end says who ended it (the room's own word, or the API's: `endedBy`)
|
|
84
|
+
* and how long it lasted.
|
|
85
|
+
*
|
|
86
|
+
* Space mutes and unmutes from anywhere that isn't a field or a control of the page's own.
|
|
87
|
+
* Escape never hangs up: it is the key that closes things, pressed by reflex, and a call ended
|
|
88
|
+
* by accident can't be taken back, so ending one is the red button's alone. The orb stands
|
|
89
|
+
* still under reduced motion, one frame per state: the words say the rest.
|
|
90
|
+
*/
|
|
91
|
+
function VoiceCall(props) {
|
|
92
|
+
return /* @__PURE__ */ jsx(KitProvider, {
|
|
93
|
+
classNames: props.classNames,
|
|
94
|
+
children: /* @__PURE__ */ jsx(Call, { ...props })
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function Call({ connect, name, tint = "sky", orb: style, orbSize = ORB_SIZE, endedBy, messages, classNames, onEnd, onAnswer, after, captions }) {
|
|
98
|
+
const words = {
|
|
99
|
+
...VOICE_CALL_MESSAGES,
|
|
100
|
+
...messages
|
|
101
|
+
};
|
|
102
|
+
const root = useRef(null);
|
|
103
|
+
const sink = useRef(null);
|
|
104
|
+
const call = useCall(connect, { sink });
|
|
105
|
+
const { state } = call;
|
|
106
|
+
const look = lookOf(state);
|
|
107
|
+
const orb = orbOf(look);
|
|
108
|
+
const over = state.stage === "over";
|
|
109
|
+
const seconds = useSeconds(state);
|
|
110
|
+
useSpace(root, !over, () => {
|
|
111
|
+
call.mute();
|
|
112
|
+
});
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
root.current?.focus({ preventScroll: true });
|
|
115
|
+
}, [over]);
|
|
116
|
+
const told = useRef({
|
|
117
|
+
onEnd,
|
|
118
|
+
onAnswer
|
|
119
|
+
});
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
told.current = {
|
|
122
|
+
onEnd,
|
|
123
|
+
onAnswer
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
const answered = state.answeredAt !== null;
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
if (answered) told.current.onAnswer?.();
|
|
129
|
+
}, [answered]);
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (over) told.current.onEnd?.(answered, state.problem);
|
|
132
|
+
}, [over]);
|
|
133
|
+
const { headline, line } = wordsOf(state, look, seconds, words, name, endedBy ?? null);
|
|
134
|
+
const modifiers = [`sc-call--${look}`, `sc-call--${tint}`];
|
|
135
|
+
if (!over) modifiers.push("sc-call--on");
|
|
136
|
+
if (state.muted && !over) modifiers.push("sc-call--muted");
|
|
137
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
138
|
+
ref: root,
|
|
139
|
+
tabIndex: -1,
|
|
140
|
+
"aria-label": words.call(name),
|
|
141
|
+
part: "call",
|
|
142
|
+
className: `sc ${classes(classNames, "sc-call", ...modifiers)}`,
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ jsxs("div", {
|
|
145
|
+
className: classes(classNames, "sc-call__stage"),
|
|
146
|
+
children: [
|
|
147
|
+
/* @__PURE__ */ jsx(Orb, {
|
|
148
|
+
state: orb.state,
|
|
149
|
+
level: orb.follows === null ? SILENT : call.meter[orb.follows],
|
|
150
|
+
size: orbSize,
|
|
151
|
+
style,
|
|
152
|
+
label: headline,
|
|
153
|
+
className: classes(classNames, "sc-call__orb")
|
|
154
|
+
}),
|
|
155
|
+
/* @__PURE__ */ jsx("p", {
|
|
156
|
+
role: "status",
|
|
157
|
+
part: "call-state",
|
|
158
|
+
className: classes(classNames, "sc-call__state"),
|
|
159
|
+
children: /* @__PURE__ */ jsx("span", { children: headline }, headline)
|
|
160
|
+
}),
|
|
161
|
+
/* @__PURE__ */ jsx("p", {
|
|
162
|
+
part: "call-line",
|
|
163
|
+
className: classes(classNames, "sc-call__line"),
|
|
164
|
+
children: line
|
|
165
|
+
})
|
|
166
|
+
]
|
|
167
|
+
}),
|
|
168
|
+
captions !== void 0 && !over && /* @__PURE__ */ jsx("div", {
|
|
169
|
+
part: "captions",
|
|
170
|
+
className: classes(classNames, "sc-call__captions"),
|
|
171
|
+
children: captions
|
|
172
|
+
}),
|
|
173
|
+
state.silenced && !over && /* @__PURE__ */ jsx(Button, {
|
|
174
|
+
size: "sm",
|
|
175
|
+
icon: SpeakerHighIcon,
|
|
176
|
+
onClick: call.hear,
|
|
177
|
+
className: classes(classNames, "sc-call__sound"),
|
|
178
|
+
children: words.hear(name)
|
|
179
|
+
}),
|
|
180
|
+
over ? after !== void 0 && /* @__PURE__ */ jsx("div", {
|
|
181
|
+
part: "call-after",
|
|
182
|
+
className: classes(classNames, "sc-call__after"),
|
|
183
|
+
children: after
|
|
184
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
|
|
185
|
+
part: "call-controls",
|
|
186
|
+
className: classes(classNames, "sc-call__controls"),
|
|
187
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
188
|
+
className: classes(classNames, "sc-call__control"),
|
|
189
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
190
|
+
icon: state.muted ? MicrophoneSlashIcon : MicrophoneIcon,
|
|
191
|
+
"aria-label": words.mute,
|
|
192
|
+
"aria-pressed": state.muted,
|
|
193
|
+
disabled: state.stage === "opening",
|
|
194
|
+
onClick: () => {
|
|
195
|
+
call.mute();
|
|
196
|
+
},
|
|
197
|
+
part: "mute",
|
|
198
|
+
className: classes(classNames, "sc-call__mute")
|
|
199
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
200
|
+
"aria-hidden": true,
|
|
201
|
+
children: words.mute
|
|
202
|
+
})]
|
|
203
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
204
|
+
className: classes(classNames, "sc-call__control"),
|
|
205
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
206
|
+
tone: "danger",
|
|
207
|
+
icon: PhoneDisconnectIcon,
|
|
208
|
+
"aria-label": words.hangUp,
|
|
209
|
+
onClick: call.hangUp,
|
|
210
|
+
part: "hang-up",
|
|
211
|
+
className: classes(classNames, "sc-call__hangup")
|
|
212
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
213
|
+
"aria-hidden": true,
|
|
214
|
+
children: words.hangUp
|
|
215
|
+
})]
|
|
216
|
+
})]
|
|
217
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
218
|
+
"data-keys": state.muted ? void 0 : "",
|
|
219
|
+
className: classes(classNames, "sc-call__hint"),
|
|
220
|
+
children: state.muted ? words.muted : words.keys
|
|
221
|
+
})] }),
|
|
222
|
+
/* @__PURE__ */ jsx("div", {
|
|
223
|
+
ref: sink,
|
|
224
|
+
hidden: true
|
|
225
|
+
})
|
|
226
|
+
]
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* What the call says: what it is doing (or why it couldn't begin), and under it who is being
|
|
231
|
+
* called, the time, how it ended (as the room knows it, else as the API said: `endedBy`) and how
|
|
232
|
+
* long it lasted, or what to do.
|
|
233
|
+
*/
|
|
234
|
+
function wordsOf(state, look, seconds, words, name, endedBy) {
|
|
235
|
+
if (look === "problem" && state.problem !== null) {
|
|
236
|
+
const problem = words.problems[state.problem];
|
|
237
|
+
return {
|
|
238
|
+
headline: problem.title(name),
|
|
239
|
+
line: problem.help
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
const headline = look === "problem" ? "" : words.states[look];
|
|
243
|
+
if (state.end !== null) {
|
|
244
|
+
const by = state.end.by ?? endedBy;
|
|
245
|
+
const lasted = durationOf(state.end.seconds);
|
|
246
|
+
return {
|
|
247
|
+
headline: by === null ? headline : words.ended[by](name),
|
|
248
|
+
line: lasted
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
return {
|
|
252
|
+
headline,
|
|
253
|
+
line: state.answeredAt === null ? words.calling(name) : durationOf(seconds)
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
/** The call's time in whole seconds: counting while it is on, held once it is over. */
|
|
257
|
+
function useSeconds(state) {
|
|
258
|
+
const [now, setNow] = useState(() => Date.now());
|
|
259
|
+
const counting = state.answeredAt !== null && state.stage !== "over";
|
|
260
|
+
useEffect(() => {
|
|
261
|
+
if (!counting) return void 0;
|
|
262
|
+
const tick = setInterval(() => {
|
|
263
|
+
setNow(Date.now());
|
|
264
|
+
}, 500);
|
|
265
|
+
return () => {
|
|
266
|
+
clearInterval(tick);
|
|
267
|
+
};
|
|
268
|
+
}, [counting]);
|
|
269
|
+
if (state.end !== null) return state.end.seconds;
|
|
270
|
+
if (state.answeredAt === null) return 0;
|
|
271
|
+
return Math.max(0, Math.floor((now - state.answeredAt) / 1e3));
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Space mutes and unmutes while `active`, wherever it doesn't belong to something else (a field,
|
|
275
|
+
* a control of the page's own). Taken whole, down and up: the page doesn't scroll, and a control
|
|
276
|
+
* of the call that has the focus is not pressed by it.
|
|
277
|
+
*/
|
|
278
|
+
function useSpace(root, active, toggle) {
|
|
279
|
+
const latest = useRef(toggle);
|
|
280
|
+
useEffect(() => {
|
|
281
|
+
latest.current = toggle;
|
|
282
|
+
});
|
|
283
|
+
useEffect(() => {
|
|
284
|
+
if (!active) return void 0;
|
|
285
|
+
const onKey = (event) => {
|
|
286
|
+
if (event.key !== " " || event.ctrlKey || event.metaKey || event.altKey) return;
|
|
287
|
+
if (event.defaultPrevented || keyBelongsElsewhere(event.target, root.current)) return;
|
|
288
|
+
event.preventDefault();
|
|
289
|
+
if (event.type === "keydown" && !event.repeat) latest.current();
|
|
290
|
+
};
|
|
291
|
+
window.addEventListener("keydown", onKey);
|
|
292
|
+
window.addEventListener("keyup", onKey);
|
|
293
|
+
return () => {
|
|
294
|
+
window.removeEventListener("keydown", onKey);
|
|
295
|
+
window.removeEventListener("keyup", onKey);
|
|
296
|
+
};
|
|
297
|
+
}, [active, root]);
|
|
298
|
+
}
|
|
299
|
+
//#endregion
|
|
300
|
+
export { VOICE_CALL_MESSAGES, VoiceCall };
|
|
301
|
+
|
|
302
|
+
//# sourceMappingURL=VoiceCall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VoiceCall.js","names":[],"sources":["../src/VoiceCall.tsx"],"sourcesContent":["import {\n MicrophoneIcon,\n MicrophoneSlashIcon,\n PhoneDisconnectIcon,\n SpeakerHighIcon,\n} from \"@phosphor-icons/react\";\nimport { useEffect, useRef, useState, type ReactNode, type RefObject } from \"react\";\n\nimport {\n durationOf,\n keyBelongsElsewhere,\n lookOf,\n orbOf,\n type CallEndedBy,\n type CallLook,\n type CallProblem,\n type CallState,\n} from \"./call\";\nimport { classes } from \"./classes\";\nimport { Button } from \"./kit/Button\";\nimport { KitProvider, type KitClassNames, type KitPart } from \"./kit/context\";\nimport type { AgentTint } from \"./tint\";\nimport { useCall, type CallJoin } from \"./useCall\";\nimport { Orb } from \"./voice/Orb\";\nimport type { OrbStyle } from \"./voice/orbs\";\n\n/** How big the orb is drawn: large, in the middle, with room for it to grow when the voice is loud. */\nconst ORB_SIZE = 280;\n\n/** The orb's level where nobody it follows is speaking. */\nconst SILENT = (): number => 0;\n\n/** The words a call says; a host gives its own, in its language. */\nexport interface VoiceCallMessages {\n /** The call's name, for those who can't see it. */\n call: (name: string) => string;\n /** What the call is doing, in a word or two. */\n states: Readonly<Record<Exclude<CallLook, \"problem\">, string>>;\n /** Under the state while the call connects. */\n calling: (name: string) => string;\n /** Why the call ended, before how long it lasted. */\n ended: Readonly<Record<CallEndedBy, (name: string) => string>>;\n /** Why the call never began, and what the person can do about it. */\n problems: Readonly<Record<CallProblem, { title: (name: string) => string; help: string }>>;\n mute: string;\n hangUp: string;\n /** Under the controls, where there is a keyboard. */\n keys: string;\n /** Under the controls while the microphone is off. */\n muted: string;\n /** The browser held the agent's voice until a press: the button that lets it play. */\n hear: (name: string) => string;\n}\n\nexport const VOICE_CALL_MESSAGES: VoiceCallMessages = {\n call: (name) => `Call with ${name}`,\n states: {\n connecting: \"Connecting…\",\n listening: \"Listening\",\n thinking: \"Thinking\",\n speaking: \"Speaking\",\n reconnecting: \"Reconnecting…\",\n ended: \"Call ended\",\n },\n calling: (name) => `Calling ${name}`,\n ended: {\n person: () => \"You hung up\",\n agent: (name) => `${name} hung up`,\n limit: () => \"It reached its longest time\",\n dropped: () => \"The line dropped\",\n },\n problems: {\n denied: {\n title: () => \"The microphone isn't allowed\",\n help: \"Allow the microphone for this page (the icon beside the address) and call again.\",\n },\n nomic: {\n title: () => \"No microphone\",\n help: \"Plug one in, or pick another in your system's sound settings, and call again.\",\n },\n inuse: {\n title: () => \"The microphone is busy\",\n help: \"Another app is using it. Close it and call again.\",\n },\n unsupported: {\n title: () => \"This browser can't call\",\n help: \"Open this page over https in a recent Chrome, Edge, Safari or Firefox.\",\n },\n off: {\n title: () => \"Calls aren't set up\",\n help: \"Calls are turned on where your agents work. Ask whoever set it up.\",\n },\n builder: {\n title: (name) => `${name} doesn't take calls`,\n help: \"A squad's builder only writes. Call one of the squad's agents.\",\n },\n refused: {\n title: (name) => `${name} can't take this call`,\n help: \"Try again in a moment.\",\n },\n failed: {\n title: (name) => `Couldn't call ${name}`,\n help: \"Check your connection and try again.\",\n },\n unanswered: {\n title: (name) => `${name} isn't answering`,\n help: \"Calls aren't being taken right now. Try again in a moment.\",\n },\n },\n mute: \"Mute\",\n hangUp: \"Hang up\",\n keys: \"Space mutes and unmutes\",\n muted: \"Your microphone is off\",\n hear: (name) => `Hear ${name}`,\n};\n\n/** The call's parts, by the class each carries; `classNames` adds a host's own under the same keys. */\nexport type VoiceCallPart =\n | \"sc-call\"\n | `sc-call--${CallLook}`\n | `sc-call--${AgentTint}`\n | \"sc-call--on\"\n | \"sc-call--muted\"\n | \"sc-call__stage\"\n | \"sc-call__orb\"\n | \"sc-call__state\"\n | \"sc-call__line\"\n | \"sc-call__sound\"\n | \"sc-call__controls\"\n | \"sc-call__control\"\n | \"sc-call__mute\"\n | \"sc-call__hangup\"\n | \"sc-call__hint\"\n | \"sc-call__captions\"\n | \"sc-call__after\";\n\nexport interface VoiceCallProps {\n /**\n * Where to join: LiveKit's address and a token for the call's room (our API's\n * `client.conversations.call(agentId)` answers both, `client.agents.call(id)` for the owner's\n * test). Called once, when the call starts, after the microphone is open.\n */\n connect: () => Promise<CallJoin>;\n /** The agent's name, for the words that say it. */\n name: string;\n /**\n * The agent's own tint (`agentTint(id)`), worn by the call's chrome: the orb's shader paints its\n * own colours, and the still orb that stands in where there is no WebGL wears it.\n */\n tint?: AgentTint | undefined;\n /** How the orb is drawn: `\"wave\"` (the default) or `\"fluid-dots\"`. */\n orb?: OrbStyle | undefined;\n /** The orb's diameter in pixels: 280 by default, less for a call in a small panel. */\n orbSize?: number | undefined;\n /**\n * Why the call ended as the API keeps it, once the host has read it (`endedByReason` of its\n * conversation's call): what the end says when the agent's side closed the room (its goodbye,\n * or its longest time), which the room doesn't tell. Until then the end says how long it was.\n */\n endedBy?: CallEndedBy | null | undefined;\n messages?: Partial<VoiceCallMessages> | undefined;\n /** The host's classes for the call's parts and the kit's (the orb's `sc-orb…`, the buttons'). */\n classNames?: Partial<Record<VoiceCallPart | KitPart, string>> | undefined;\n /**\n * The call is over, once: it ended (`answered`: the agent took it; `problem` null), or it\n * couldn't begin (`problem`: why, which the call shows until the host takes it away).\n */\n onEnd?: ((answered: boolean, problem: CallProblem | null) => void) | undefined;\n /** The agent took the call: its time counts from now. Once. */\n onAnswer?: (() => void) | undefined;\n /** What the host offers once the call is over, in place of the controls: call again, write. */\n after?: ReactNode;\n /** What is being said, drawn by the host under the orb while the call is on (`sc-call__captions`). */\n captions?: ReactNode;\n}\n\n/**\n * A voice call with an agent, the one a customer has on the phone: the call starts when it\n * mounts and ends when it unmounts. The orb, large in the middle, rests while the line is found,\n * moves with whoever speaks (the agent's voice while it speaks, the person's while it listens),\n * calms while the agent thinks, and fades once the call is over; under it what the call\n * is doing in a word, its time, and the two controls a phone has, mute and hang up. A microphone\n * that can't be used, or a call that can't be made (the API's refusal among them), says why in\n * words and what to do; an end says who ended it (the room's own word, or the API's: `endedBy`)\n * and how long it lasted.\n *\n * Space mutes and unmutes from anywhere that isn't a field or a control of the page's own.\n * Escape never hangs up: it is the key that closes things, pressed by reflex, and a call ended\n * by accident can't be taken back, so ending one is the red button's alone. The orb stands\n * still under reduced motion, one frame per state: the words say the rest.\n */\nexport function VoiceCall(props: VoiceCallProps) {\n return (\n <KitProvider classNames={props.classNames as KitClassNames}>\n <Call {...props} />\n </KitProvider>\n );\n}\n\nfunction Call({\n connect,\n name,\n tint = \"sky\",\n orb: style,\n orbSize = ORB_SIZE,\n endedBy,\n messages,\n classNames,\n onEnd,\n onAnswer,\n after,\n captions,\n}: VoiceCallProps) {\n const words = { ...VOICE_CALL_MESSAGES, ...messages };\n const root = useRef<HTMLElement>(null);\n const sink = useRef<HTMLDivElement>(null);\n const call = useCall(connect, { sink });\n const { state } = call;\n const look = lookOf(state);\n const orb = orbOf(look);\n const over = state.stage === \"over\";\n const seconds = useSeconds(state);\n\n useSpace(root, !over, () => {\n call.mute();\n });\n // The call takes the keyboard as it opens, so Space is its from the start; and again once over,\n // when the control that had it is gone, so the host's offers are the next stop.\n useEffect(() => {\n root.current?.focus({ preventScroll: true });\n }, [over]);\n // The host's ears as it last gave them.\n const told = useRef({ onEnd, onAnswer });\n useEffect(() => {\n told.current = { onEnd, onAnswer };\n });\n const answered = state.answeredAt !== null;\n useEffect(() => {\n if (answered) told.current.onAnswer?.();\n }, [answered]);\n useEffect(() => {\n if (over) told.current.onEnd?.(answered, state.problem);\n }, [over]);\n\n const { headline, line } = wordsOf(state, look, seconds, words, name, endedBy ?? null);\n const modifiers: VoiceCallPart[] = [`sc-call--${look}`, `sc-call--${tint}`];\n if (!over) modifiers.push(\"sc-call--on\");\n if (state.muted && !over) modifiers.push(\"sc-call--muted\");\n\n return (\n <section\n ref={root}\n tabIndex={-1}\n aria-label={words.call(name)}\n part=\"call\"\n className={`sc ${classes(classNames, \"sc-call\", ...modifiers)}`}\n >\n <div className={classes(classNames, \"sc-call__stage\")}>\n <Orb\n state={orb.state}\n level={orb.follows === null ? SILENT : call.meter[orb.follows]}\n size={orbSize}\n style={style}\n label={headline}\n className={classes(classNames, \"sc-call__orb\")}\n />\n <p role=\"status\" part=\"call-state\" className={classes(classNames, \"sc-call__state\")}>\n <span key={headline}>{headline}</span>\n </p>\n <p part=\"call-line\" className={classes(classNames, \"sc-call__line\")}>\n {line}\n </p>\n </div>\n {captions !== undefined && !over && (\n <div part=\"captions\" className={classes(classNames, \"sc-call__captions\")}>\n {captions}\n </div>\n )}\n {state.silenced && !over && (\n <Button\n size=\"sm\"\n icon={SpeakerHighIcon}\n onClick={call.hear}\n className={classes(classNames, \"sc-call__sound\")}\n >\n {words.hear(name)}\n </Button>\n )}\n {over ? (\n after !== undefined && (\n <div part=\"call-after\" className={classes(classNames, \"sc-call__after\")}>\n {after}\n </div>\n )\n ) : (\n <>\n <div part=\"call-controls\" className={classes(classNames, \"sc-call__controls\")}>\n <div className={classes(classNames, \"sc-call__control\")}>\n <Button\n icon={state.muted ? MicrophoneSlashIcon : MicrophoneIcon}\n aria-label={words.mute}\n aria-pressed={state.muted}\n disabled={state.stage === \"opening\"}\n onClick={() => {\n call.mute();\n }}\n part=\"mute\"\n className={classes(classNames, \"sc-call__mute\")}\n />\n <span aria-hidden>{words.mute}</span>\n </div>\n <div className={classes(classNames, \"sc-call__control\")}>\n <Button\n tone=\"danger\"\n icon={PhoneDisconnectIcon}\n aria-label={words.hangUp}\n onClick={call.hangUp}\n part=\"hang-up\"\n className={classes(classNames, \"sc-call__hangup\")}\n />\n <span aria-hidden>{words.hangUp}</span>\n </div>\n </div>\n <p\n data-keys={state.muted ? undefined : \"\"}\n className={classes(classNames, \"sc-call__hint\")}\n >\n {state.muted ? words.muted : words.keys}\n </p>\n </>\n )}\n {/* The agent's voice plays from here. */}\n <div ref={sink} hidden />\n </section>\n );\n}\n\n/**\n * What the call says: what it is doing (or why it couldn't begin), and under it who is being\n * called, the time, how it ended (as the room knows it, else as the API said: `endedBy`) and how\n * long it lasted, or what to do.\n */\nfunction wordsOf(\n state: CallState,\n look: CallLook,\n seconds: number,\n words: VoiceCallMessages,\n name: string,\n endedBy: CallEndedBy | null,\n): { headline: string; line: string } {\n if (look === \"problem\" && state.problem !== null) {\n const problem = words.problems[state.problem];\n return { headline: problem.title(name), line: problem.help };\n }\n const headline = look === \"problem\" ? \"\" : words.states[look];\n if (state.end !== null) {\n const by = state.end.by ?? endedBy;\n const lasted = durationOf(state.end.seconds);\n // Why it ended says it ended; how long it lasted, under it.\n return { headline: by === null ? headline : words.ended[by](name), line: lasted };\n }\n return {\n headline,\n line: state.answeredAt === null ? words.calling(name) : durationOf(seconds),\n };\n}\n\n/** The call's time in whole seconds: counting while it is on, held once it is over. */\nfunction useSeconds(state: CallState): number {\n const [now, setNow] = useState(() => Date.now());\n const counting = state.answeredAt !== null && state.stage !== \"over\";\n useEffect(() => {\n if (!counting) return undefined;\n const tick = setInterval(() => {\n setNow(Date.now());\n }, 500);\n return () => {\n clearInterval(tick);\n };\n }, [counting]);\n if (state.end !== null) return state.end.seconds;\n if (state.answeredAt === null) return 0;\n return Math.max(0, Math.floor((now - state.answeredAt) / 1000));\n}\n\n/**\n * Space mutes and unmutes while `active`, wherever it doesn't belong to something else (a field,\n * a control of the page's own). Taken whole, down and up: the page doesn't scroll, and a control\n * of the call that has the focus is not pressed by it.\n */\nfunction useSpace(root: RefObject<HTMLElement | null>, active: boolean, toggle: () => void) {\n const latest = useRef(toggle);\n useEffect(() => {\n latest.current = toggle;\n });\n useEffect(() => {\n if (!active) return undefined;\n const onKey = (event: KeyboardEvent) => {\n if (event.key !== \" \" || event.ctrlKey || event.metaKey || event.altKey) return;\n if (event.defaultPrevented || keyBelongsElsewhere(event.target, root.current)) return;\n event.preventDefault();\n if (event.type === \"keydown\" && !event.repeat) latest.current();\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"keyup\", onKey);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"keyup\", onKey);\n };\n }, [active, root]);\n}\n"],"mappings":";;;;;;;;;;;AA2BA,MAAM,WAAW;;AAGjB,MAAM,eAAuB;AAwB7B,MAAa,sBAAyC;CACpD,OAAO,SAAS,aAAa;CAC7B,QAAQ;EACN,YAAY;EACZ,WAAW;EACX,UAAU;EACV,UAAU;EACV,cAAc;EACd,OAAO;CACT;CACA,UAAU,SAAS,WAAW;CAC9B,OAAO;EACL,cAAc;EACd,QAAQ,SAAS,GAAG,KAAK;EACzB,aAAa;EACb,eAAe;CACjB;CACA,UAAU;EACR,QAAQ;GACN,aAAa;GACb,MAAM;EACR;EACA,OAAO;GACL,aAAa;GACb,MAAM;EACR;EACA,OAAO;GACL,aAAa;GACb,MAAM;EACR;EACA,aAAa;GACX,aAAa;GACb,MAAM;EACR;EACA,KAAK;GACH,aAAa;GACb,MAAM;EACR;EACA,SAAS;GACP,QAAQ,SAAS,GAAG,KAAK;GACzB,MAAM;EACR;EACA,SAAS;GACP,QAAQ,SAAS,GAAG,KAAK;GACzB,MAAM;EACR;EACA,QAAQ;GACN,QAAQ,SAAS,iBAAiB;GAClC,MAAM;EACR;EACA,YAAY;GACV,QAAQ,SAAS,GAAG,KAAK;GACzB,MAAM;EACR;CACF;CACA,MAAM;CACN,QAAQ;CACR,MAAM;CACN,OAAO;CACP,OAAO,SAAS,QAAQ;AAC1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,0 +1,212 @@
|
|
|
1
|
+
import { formatSize } from "./kit/numbers.js";
|
|
2
|
+
//#region src/about.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Qué puede: what an agent says about itself and the facts it rests on (`GET /agents/{id}/about`,
|
|
5
|
+
* `POST /agents/{id}/describe`). The words are the model's, written from the agent's folder and
|
|
6
|
+
* stale the moment it changes; the facts are the platform's, read each time.
|
|
7
|
+
*/
|
|
8
|
+
/** The marks the package draws (a topic's, an automation's kind, a note's tone). */
|
|
9
|
+
export declare const ICONS: readonly ["message", "phone", "mail", "calendar", "clock", "search", "file", "table", "bell", "hand", "user", "globe", "code", "lock", "cart", "card", "map", "check", "warning", "sparkle"];
|
|
10
|
+
export type Icon = (typeof ICONS)[number];
|
|
11
|
+
/** One automation as the agent tells it: what it does then, and when. */
|
|
12
|
+
export interface Does {
|
|
13
|
+
/** The automation's id. */
|
|
14
|
+
automation: string;
|
|
15
|
+
text: string;
|
|
16
|
+
/** When it runs, the way a person says it: "Cada día a las 8:00". */
|
|
17
|
+
when: string;
|
|
18
|
+
}
|
|
19
|
+
/** What the agent says about itself: a lead, what it does, what it asks leave for. */
|
|
20
|
+
export interface About {
|
|
21
|
+
/** Two or three sentences, first person, in the owner's language. */
|
|
22
|
+
summary: string;
|
|
23
|
+
does: Does[];
|
|
24
|
+
asks: string[];
|
|
25
|
+
}
|
|
26
|
+
export type ActionSource = "default" | "library" | "own";
|
|
27
|
+
export interface ActionFact {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
source: ActionSource;
|
|
31
|
+
on: boolean;
|
|
32
|
+
needs_approval: boolean;
|
|
33
|
+
destructive: boolean;
|
|
34
|
+
/** Its input as the model gets it (JSON Schema); left out by an API from before. */
|
|
35
|
+
input_schema?: Readonly<Record<string, unknown>> | undefined;
|
|
36
|
+
}
|
|
37
|
+
export type AutomationKind = "schedule" | "webhook" | "event";
|
|
38
|
+
/** Something the agent does on its own: at a time, when another system calls, on an event. */
|
|
39
|
+
export interface AutomationFact {
|
|
40
|
+
id: string;
|
|
41
|
+
/** Its file's name, `automations/<name>.py`: how its page is reached. */
|
|
42
|
+
name: string;
|
|
43
|
+
kind: AutomationKind;
|
|
44
|
+
title: string;
|
|
45
|
+
/** What it does, in the owner's words. */
|
|
46
|
+
summary: string;
|
|
47
|
+
/** The same words, for a reader of the older shape. */
|
|
48
|
+
say: string;
|
|
49
|
+
/** A cron line and its time zone, for one that runs at a time. */
|
|
50
|
+
schedule?: string | null | undefined;
|
|
51
|
+
timezone?: string | null | undefined;
|
|
52
|
+
/** Where another system calls it, for a webhook (a path on the API). */
|
|
53
|
+
url?: string | null | undefined;
|
|
54
|
+
/** For one on an app's event: the app (the connection's name), the event as its provider
|
|
55
|
+
* names it, and the app as its mark is drawn (`composio:gmail`, the provider's logo). */
|
|
56
|
+
app?: string | null | undefined;
|
|
57
|
+
/** The app as people write it (`Google Calendar`). */
|
|
58
|
+
app_title?: string | null | undefined;
|
|
59
|
+
event?: string | null | undefined;
|
|
60
|
+
provider?: string | undefined;
|
|
61
|
+
icon?: string | null | undefined;
|
|
62
|
+
/** Off: declared, but it doesn't run. */
|
|
63
|
+
on: boolean;
|
|
64
|
+
next_run_at?: string | null | undefined;
|
|
65
|
+
}
|
|
66
|
+
export type Provider = "arcade" | "composio" | "mcp" | "api";
|
|
67
|
+
export interface ConnectionFact {
|
|
68
|
+
provider: Provider;
|
|
69
|
+
name: string;
|
|
70
|
+
/** The app, as the provider names it (`gmail`). */
|
|
71
|
+
toolkit?: string | undefined;
|
|
72
|
+
/** The app as people write it (`Google Calendar`). */
|
|
73
|
+
title?: string | undefined;
|
|
74
|
+
/** pending · active · error · disconnected */
|
|
75
|
+
status?: string | undefined;
|
|
76
|
+
/** The provider's names of what the agent may do in it (`Gmail.SendEmail`). */
|
|
77
|
+
actions: string[];
|
|
78
|
+
/** What the provider calls each of them for people (`List Events`), when it says. */
|
|
79
|
+
titles?: Readonly<Record<string, string>> | undefined;
|
|
80
|
+
/** A URL to the app's own mark, when the provider gives one. */
|
|
81
|
+
icon?: string | null | undefined;
|
|
82
|
+
}
|
|
83
|
+
/** An app of the agent's as people write it: its provider's name, else its alias made words. */
|
|
84
|
+
export declare const appTitle: (connection: ConnectionFact) => string;
|
|
85
|
+
/** A tool of an app as people read it: its provider's name for it, else its own made words. */
|
|
86
|
+
export declare const toolTitle: (connection: ConnectionFact, action: string) => string;
|
|
87
|
+
/** A tool of an app as a person reads it: `Gmail.SendEmail` is "Send email". */
|
|
88
|
+
export declare function toolName(action: string): string;
|
|
89
|
+
/**
|
|
90
|
+
* An action's name made words, for one nobody named: `ver_hoja` is "Ver hoja"; an app's tool
|
|
91
|
+
* as the model calls it, `gmail__GMAIL_SEND_EMAIL`, is "Send email (Gmail)".
|
|
92
|
+
*/
|
|
93
|
+
export declare function actionWords(name: string): string;
|
|
94
|
+
/** `gmail` + `Gmail.SendEmail` → `gmail__Gmail_SendEmail`: the tool the model is given. */
|
|
95
|
+
export declare const generatedName: (alias: string, action: string) => string;
|
|
96
|
+
/**
|
|
97
|
+
* The tools the agent's apps give it, by the names the model calls them, in words: the
|
|
98
|
+
* provider's for the tool and the app's ("List Events (Google Calendar)"), as a chat's steps
|
|
99
|
+
* read them (`ChatMessages.steps`).
|
|
100
|
+
*/
|
|
101
|
+
export declare function appSteps(connections: readonly ConnectionFact[]): Record<string, string>;
|
|
102
|
+
export type ChannelKind = "whatsapp" | "instagram" | "email" | "sms" | "web" | "phone";
|
|
103
|
+
export interface ChannelFact {
|
|
104
|
+
kind: ChannelKind;
|
|
105
|
+
name: string;
|
|
106
|
+
status: string;
|
|
107
|
+
}
|
|
108
|
+
/** A file the agent can read: its own, or one of the organization's, shared with every agent. */
|
|
109
|
+
export interface FileFact {
|
|
110
|
+
path: string;
|
|
111
|
+
size: number;
|
|
112
|
+
/** Text, Markdown, JSON, YAML or PDF, read by `search_files`; anything else is only kept. */
|
|
113
|
+
searchable: boolean;
|
|
114
|
+
/** The organization's, not the agent's own. */
|
|
115
|
+
shared: boolean;
|
|
116
|
+
}
|
|
117
|
+
/** A line the agent kept with `remember`. */
|
|
118
|
+
export interface MemoryFact {
|
|
119
|
+
id: string;
|
|
120
|
+
/** The agent that keeps it; the contact it is about, when it is about one. */
|
|
121
|
+
agent_id?: string | undefined;
|
|
122
|
+
contact_id?: string | null | undefined;
|
|
123
|
+
text: string;
|
|
124
|
+
created_at: string;
|
|
125
|
+
}
|
|
126
|
+
/** A key the agent may use: its own, or one of the organization's, shared with every agent. */
|
|
127
|
+
export interface VaultFact {
|
|
128
|
+
name: string;
|
|
129
|
+
/** The hosts it may be sent to. */
|
|
130
|
+
hosts?: string[] | undefined;
|
|
131
|
+
/** The organization's, not the agent's own. */
|
|
132
|
+
shared?: boolean | undefined;
|
|
133
|
+
}
|
|
134
|
+
/** A table of the organization's the agent may read or write (an agenda, the clients). */
|
|
135
|
+
export interface DataFact {
|
|
136
|
+
table: string;
|
|
137
|
+
/** Its name for people, when it has one. */
|
|
138
|
+
title?: string | null | undefined;
|
|
139
|
+
can: string[];
|
|
140
|
+
}
|
|
141
|
+
export interface AskFact {
|
|
142
|
+
agent_id: string;
|
|
143
|
+
name: string;
|
|
144
|
+
}
|
|
145
|
+
export type DeviceKind = "extension" | "installer";
|
|
146
|
+
export interface DeviceFact {
|
|
147
|
+
kind: DeviceKind;
|
|
148
|
+
name: string;
|
|
149
|
+
status: string;
|
|
150
|
+
}
|
|
151
|
+
/** What the agent has, every list present from day one; one whose phase has not come is empty. */
|
|
152
|
+
export interface Facts {
|
|
153
|
+
actions: ActionFact[];
|
|
154
|
+
automations: AutomationFact[];
|
|
155
|
+
connections: ConnectionFact[];
|
|
156
|
+
channels: ChannelFact[];
|
|
157
|
+
/** Its own first, then the organization's shared. */
|
|
158
|
+
files: FileFact[];
|
|
159
|
+
/** Newest first. */
|
|
160
|
+
memories: MemoryFact[];
|
|
161
|
+
vault: VaultFact[];
|
|
162
|
+
data: DataFact[];
|
|
163
|
+
asks: AskFact[];
|
|
164
|
+
devices: DeviceFact[];
|
|
165
|
+
}
|
|
166
|
+
export interface AboutOut {
|
|
167
|
+
/** Null until the agent has written about itself once. */
|
|
168
|
+
about: About | null;
|
|
169
|
+
/** When the words were written; null when the folder changed since, so they are stale. */
|
|
170
|
+
about_at: string | null;
|
|
171
|
+
facts: Facts;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* What the panel lists of the facts beside what the agent does on its own, gathered into a few
|
|
175
|
+
* things an owner reads at a glance: the apps it uses, its tools, what it knows (files and
|
|
176
|
+
* tables), what it has learned, where it works (channels and devices), and its keys.
|
|
177
|
+
*/
|
|
178
|
+
export type Topic = "apps" | "tools" | "knowledge" | "learning" | "channels" | "keys";
|
|
179
|
+
/** The topics in the order the panel lists them. */
|
|
180
|
+
export declare const TOPICS: readonly Topic[];
|
|
181
|
+
/** An automation with what the agent said about it, when it said something. */
|
|
182
|
+
export interface Told {
|
|
183
|
+
automation: AutomationFact;
|
|
184
|
+
line: Does | undefined;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The agent's automations, in their order, each with the agent's line about it (matched by id):
|
|
188
|
+
* one added since the words were written has none yet, and a line for one since removed is
|
|
189
|
+
* dropped.
|
|
190
|
+
*/
|
|
191
|
+
export declare function automationsOf(about: About | null, facts: Facts): Told[];
|
|
192
|
+
/** How many things a topic holds: the tools that are on, the rest whole. */
|
|
193
|
+
export declare function countOf(topic: Topic, facts: Facts): number;
|
|
194
|
+
/**
|
|
195
|
+
* The names of what a topic holds, in order, as its row in the panel previews them: an app by its
|
|
196
|
+
* name, a tool by `label` (the host's words for the shipped ones), a file by its path and a table
|
|
197
|
+
* by its title, what it learned by the line itself.
|
|
198
|
+
*/
|
|
199
|
+
export declare function namesOf(topic: Topic, facts: Facts, label: (action: ActionFact) => string): string[];
|
|
200
|
+
export type AboutState = "writing" | "stale" | "fresh";
|
|
201
|
+
/**
|
|
202
|
+
* Which state the words are in: `writing` while there are none yet or the agent is writing them
|
|
203
|
+
* anew (`loading`), `stale` when the agent changed since it wrote them, `fresh` otherwise.
|
|
204
|
+
*/
|
|
205
|
+
export declare function aboutState(about: About | null, aboutAt: string | null, loading: boolean): AboutState;
|
|
206
|
+
/** How a status reads beside its words: working, broken, or neither. */
|
|
207
|
+
export type StatusTone = "on" | "off" | "quiet";
|
|
208
|
+
/** The tone of a channel's or a device's status, from the words the platform uses for it. */
|
|
209
|
+
export declare function toneOf(status: string): StatusTone;
|
|
210
|
+
//#endregion
|
|
211
|
+
export { formatSize };
|
|
212
|
+
//# sourceMappingURL=about.d.ts.map
|