@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,1020 @@
|
|
|
1
|
+
import { formatSize } from "./kit/numbers.js";
|
|
2
|
+
import { aboutState, appTitle, automationsOf, countOf, toneOf, toolName, toolTitle } from "./about.js";
|
|
3
|
+
import { classes } from "./classes.js";
|
|
4
|
+
import { KIT_MESSAGES } from "./kit/messages.js";
|
|
5
|
+
import { KitProvider, useKit } from "./kit/context.js";
|
|
6
|
+
import { List, Row } from "./kit/List.js";
|
|
7
|
+
import { Tag } from "./kit/Tag.js";
|
|
8
|
+
import { Mark } from "./kit/Mark.js";
|
|
9
|
+
import { Automation } from "./automation/Automation.js";
|
|
10
|
+
import { RunView } from "./automation/RunView.js";
|
|
11
|
+
import { agentGlyph } from "./agentIcons.js";
|
|
12
|
+
import { ApiError } from "./client.js";
|
|
13
|
+
import { baseName } from "./files.js";
|
|
14
|
+
import { GLYPHS } from "./icons.js";
|
|
15
|
+
import { FileMark } from "./kit/FileMark.js";
|
|
16
|
+
import { MarkStack } from "./kit/MarkStack.js";
|
|
17
|
+
import { actionMark, channelMark, deviceMark, providerMark } from "./marks.js";
|
|
18
|
+
import { agentTint } from "./tint.js";
|
|
19
|
+
import { usePolled } from "./usePolled.js";
|
|
20
|
+
import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
21
|
+
import { BooksIcon, BroadcastIcon, KeyIcon, LightbulbIcon, PuzzlePieceIcon, WrenchIcon } from "@phosphor-icons/react";
|
|
22
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
+
//#region src/AgentAbout.tsx
|
|
24
|
+
/** What each part of what it works with is, at a glance: bare, beside its name. */
|
|
25
|
+
const TOPIC_GLYPHS = {
|
|
26
|
+
apps: PuzzlePieceIcon,
|
|
27
|
+
tools: WrenchIcon,
|
|
28
|
+
knowledge: BooksIcon,
|
|
29
|
+
learning: LightbulbIcon,
|
|
30
|
+
channels: BroadcastIcon,
|
|
31
|
+
keys: KeyIcon
|
|
32
|
+
};
|
|
33
|
+
const ABOUT_MESSAGES = {
|
|
34
|
+
loading: "Loading…",
|
|
35
|
+
writing: (name) => `${name} is writing down what it does…`,
|
|
36
|
+
updating: "Updating…",
|
|
37
|
+
refresh: "Try again",
|
|
38
|
+
asks: "It asks you before",
|
|
39
|
+
builtIn: "Built in",
|
|
40
|
+
failed: "What it can do could not be read.",
|
|
41
|
+
does: "What it does on its own",
|
|
42
|
+
noAutomations: "Nothing on its own yet: it answers when someone writes to it.",
|
|
43
|
+
paused: "Paused",
|
|
44
|
+
kinds: {
|
|
45
|
+
schedule: "At a time",
|
|
46
|
+
webhook: "When called",
|
|
47
|
+
event: "On an event"
|
|
48
|
+
},
|
|
49
|
+
topics: {
|
|
50
|
+
apps: "Apps",
|
|
51
|
+
tools: "Tools",
|
|
52
|
+
knowledge: "Knowledge",
|
|
53
|
+
learning: "Learning",
|
|
54
|
+
channels: "Channels",
|
|
55
|
+
keys: "Keys"
|
|
56
|
+
},
|
|
57
|
+
empty: {
|
|
58
|
+
apps: "None yet",
|
|
59
|
+
tools: "None on",
|
|
60
|
+
knowledge: "Nothing yet",
|
|
61
|
+
learning: "Nothing yet",
|
|
62
|
+
channels: "None yet",
|
|
63
|
+
keys: "None"
|
|
64
|
+
},
|
|
65
|
+
hints: {
|
|
66
|
+
apps: "The business's apps it uses, and what it may do in each.",
|
|
67
|
+
tools: "What it can do while it talks with someone.",
|
|
68
|
+
knowledge: "The documents and tables it reads to answer.",
|
|
69
|
+
learning: "What it has learned from its conversations.",
|
|
70
|
+
channels: "Where it works: where people write to it, and the devices it uses.",
|
|
71
|
+
keys: "Passwords and keys it uses, kept sealed."
|
|
72
|
+
},
|
|
73
|
+
theirs: (name) => `${name}'s own`,
|
|
74
|
+
organization: "The organization's",
|
|
75
|
+
tables: "Tables",
|
|
76
|
+
kept: "Only kept",
|
|
77
|
+
off: "off",
|
|
78
|
+
can: {
|
|
79
|
+
find: "looks up",
|
|
80
|
+
add: "adds",
|
|
81
|
+
update: "changes"
|
|
82
|
+
},
|
|
83
|
+
title: (name) => `About ${name}`,
|
|
84
|
+
facts: "What it works with",
|
|
85
|
+
runGone: "This run is no longer there.",
|
|
86
|
+
kit: KIT_MESSAGES,
|
|
87
|
+
actions: {},
|
|
88
|
+
size: (bytes) => formatSize(bytes),
|
|
89
|
+
ago: (when) => when.toLocaleDateString(),
|
|
90
|
+
channelNames: {
|
|
91
|
+
whatsapp: "WhatsApp",
|
|
92
|
+
instagram: "Instagram",
|
|
93
|
+
sms: "SMS",
|
|
94
|
+
email: "Email",
|
|
95
|
+
web: "Web chat",
|
|
96
|
+
phone: "Phone"
|
|
97
|
+
},
|
|
98
|
+
channelStates: {
|
|
99
|
+
active: "Active",
|
|
100
|
+
pending: "Pending",
|
|
101
|
+
error: "Error",
|
|
102
|
+
disconnected: "Disconnected"
|
|
103
|
+
},
|
|
104
|
+
channelDetail: (detail) => detail
|
|
105
|
+
};
|
|
106
|
+
const ABOUT_HOME = { kind: "home" };
|
|
107
|
+
/** How far a view is from the home: what says whether a move goes in or back out. */
|
|
108
|
+
const depthOf = (view) => view.kind === "home" ? 0 : view.kind === "run" ? 2 : 1;
|
|
109
|
+
/** A view as one string: what tells two apart. */
|
|
110
|
+
const keyOf = (view) => view.kind === "home" ? "home" : view.kind === "topic" ? `topic:${view.topic}` : view.kind === "automation" ? `automation:${view.name}` : `run:${view.name}:${view.run}`;
|
|
111
|
+
/** The view a step back from `view` goes to. */
|
|
112
|
+
function aboutBack(view) {
|
|
113
|
+
return view.kind === "run" ? {
|
|
114
|
+
kind: "automation",
|
|
115
|
+
name: view.name
|
|
116
|
+
} : ABOUT_HOME;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Qué puede, made to sit beside the conversation: who it is about, in its own words (a line or
|
|
120
|
+
* two); what it does on its own, one row per automation (its kind's mark, or its app's logo),
|
|
121
|
+
* what it does and when, as the agent tells it; what it asks leave for; then what it works with,
|
|
122
|
+
* as a grid of tiles, one per topic (its apps, tools, what it knows and has learned, where it
|
|
123
|
+
* works, its keys), each with its count and a glimpse of what it holds, opening it in the same
|
|
124
|
+
* place. Every list is the kit's `List` and `Row`, and every tile its `Tile`, the ones an agent's
|
|
125
|
+
* screens use, so a host styles them once. The words are written by the agent the first time and
|
|
126
|
+
* again whenever it changed since, by themselves. The component only reads; a host draws its own
|
|
127
|
+
* controls through `controls` and calls `tools.refresh()` after a change, and opens a file
|
|
128
|
+
* through `onOpenFile`. An automation opens in the panel itself, one level in (what it does, its
|
|
129
|
+
* steps, its runs), and a run one more, each with its way back; `view` lets the host keep where
|
|
130
|
+
* it is. Another agent starts afresh.
|
|
131
|
+
*/
|
|
132
|
+
function AgentAbout(props) {
|
|
133
|
+
return /* @__PURE__ */ jsx(KitProvider, {
|
|
134
|
+
classNames: props.classNames,
|
|
135
|
+
messages: props.messages?.kit,
|
|
136
|
+
locale: props.locale,
|
|
137
|
+
children: /* @__PURE__ */ jsx(View, { ...props }, props.agentId)
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function View({ client, agentId, icon, name, messages, classNames, controls, apps, onOpenFile, view: given, onViewChange, onOpenConversation }) {
|
|
141
|
+
const words = {
|
|
142
|
+
...ABOUT_MESSAGES,
|
|
143
|
+
...messages
|
|
144
|
+
};
|
|
145
|
+
const [data, setData] = useState(null);
|
|
146
|
+
const [live, setLive] = useState(null);
|
|
147
|
+
const [writing, setWriting] = useState(false);
|
|
148
|
+
const [problem, setProblem] = useState(null);
|
|
149
|
+
const [version, setVersion] = useState(0);
|
|
150
|
+
const [own, setOwn] = useState(ABOUT_HOME);
|
|
151
|
+
const view = given ?? own;
|
|
152
|
+
const motion = useMotion(view);
|
|
153
|
+
const root = useRef(null);
|
|
154
|
+
const scrolled = useRef(/* @__PURE__ */ new Map());
|
|
155
|
+
const intro = useId();
|
|
156
|
+
/** Opens `next`, keeping where the panel was scrolled to on the way in, for the way back. */
|
|
157
|
+
const go = (next) => {
|
|
158
|
+
const scroller = scrollerOf(root.current);
|
|
159
|
+
if (scroller !== null && depthOf(next) > depthOf(view)) scrolled.current.set(keyOf(view), scroller.scrollTop);
|
|
160
|
+
(onViewChange ?? setOwn)(next);
|
|
161
|
+
};
|
|
162
|
+
const shown = keyOf(view);
|
|
163
|
+
useLayoutEffect(() => {
|
|
164
|
+
const scroller = scrollerOf(root.current);
|
|
165
|
+
if (scroller !== null) scroller.scrollTop = scrolled.current.get(shown) ?? 0;
|
|
166
|
+
}, [shown]);
|
|
167
|
+
/** Has the agent write about itself anew; what it answers is the words and the facts both. */
|
|
168
|
+
const write = useCallback(async (still) => {
|
|
169
|
+
setProblem(null);
|
|
170
|
+
setWriting(true);
|
|
171
|
+
try {
|
|
172
|
+
const written = await client.agents.describe(agentId);
|
|
173
|
+
if (still()) setData(written);
|
|
174
|
+
} catch (error) {
|
|
175
|
+
if (still()) setProblem(error);
|
|
176
|
+
} finally {
|
|
177
|
+
if (still()) setWriting(false);
|
|
178
|
+
}
|
|
179
|
+
}, [client, agentId]);
|
|
180
|
+
/**
|
|
181
|
+
* Reads the words and the facts, and how each automation stands (a server without them leaves
|
|
182
|
+
* the rows as they were told); when the words are missing or stale, has the agent write them.
|
|
183
|
+
*/
|
|
184
|
+
const read = useCallback(async (still) => {
|
|
185
|
+
setProblem(null);
|
|
186
|
+
try {
|
|
187
|
+
const [first, standing] = await Promise.all([client.agents.about(agentId), client.automations.list(agentId).catch(() => null)]);
|
|
188
|
+
if (!still()) return;
|
|
189
|
+
setData(first);
|
|
190
|
+
setLive(standing);
|
|
191
|
+
if (first.about === null || first.about_at === null) await write(still);
|
|
192
|
+
} catch (error) {
|
|
193
|
+
if (still()) setProblem(error);
|
|
194
|
+
}
|
|
195
|
+
}, [
|
|
196
|
+
client,
|
|
197
|
+
agentId,
|
|
198
|
+
write
|
|
199
|
+
]);
|
|
200
|
+
useEffect(() => {
|
|
201
|
+
let gone = false;
|
|
202
|
+
read(() => !gone);
|
|
203
|
+
return () => {
|
|
204
|
+
gone = true;
|
|
205
|
+
};
|
|
206
|
+
}, [read]);
|
|
207
|
+
const tools = useMemo(() => ({ refresh: async () => {
|
|
208
|
+
setVersion((count) => count + 1);
|
|
209
|
+
await read(() => true);
|
|
210
|
+
} }), [read]);
|
|
211
|
+
const retry = () => data === null ? read(() => true) : write(() => true);
|
|
212
|
+
const label = (action) => action.source === "own" ? toolName(action.name) : words.actions[action.name] ?? action.name;
|
|
213
|
+
const pane = (bar, children) => /* @__PURE__ */ jsx("div", {
|
|
214
|
+
ref: root,
|
|
215
|
+
className: `sc ${classes(classNames, "sc-about")}`,
|
|
216
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
217
|
+
"data-motion": motion,
|
|
218
|
+
className: classes(classNames, "sc-about__pane"),
|
|
219
|
+
children: [bar, children]
|
|
220
|
+
}, shown)
|
|
221
|
+
});
|
|
222
|
+
const home = words.title(name);
|
|
223
|
+
if (view.kind === "topic" && data !== null) return pane(/* @__PURE__ */ jsx(Bar, {
|
|
224
|
+
back: home,
|
|
225
|
+
onBack: () => go(ABOUT_HOME),
|
|
226
|
+
classNames
|
|
227
|
+
}), /* @__PURE__ */ jsx(TopicView, {
|
|
228
|
+
client,
|
|
229
|
+
agentId,
|
|
230
|
+
name,
|
|
231
|
+
version,
|
|
232
|
+
topic: view.topic,
|
|
233
|
+
facts: data.facts,
|
|
234
|
+
apps,
|
|
235
|
+
label,
|
|
236
|
+
words,
|
|
237
|
+
classNames,
|
|
238
|
+
tools,
|
|
239
|
+
controls,
|
|
240
|
+
onOpenFile
|
|
241
|
+
}));
|
|
242
|
+
if (view.kind === "automation") {
|
|
243
|
+
const fact = data?.facts.automations.find((each) => each.name === view.name);
|
|
244
|
+
return pane(/* @__PURE__ */ jsx(Bar, {
|
|
245
|
+
back: home,
|
|
246
|
+
onBack: () => go(ABOUT_HOME),
|
|
247
|
+
end: fact !== void 0 ? controls?.automation?.(fact, tools) : void 0,
|
|
248
|
+
classNames
|
|
249
|
+
}), /* @__PURE__ */ jsx(AutomationPane, {
|
|
250
|
+
client,
|
|
251
|
+
agentId,
|
|
252
|
+
name: view.name,
|
|
253
|
+
apps,
|
|
254
|
+
words,
|
|
255
|
+
classNames,
|
|
256
|
+
onOpenRun: (run) => go({
|
|
257
|
+
kind: "run",
|
|
258
|
+
name: view.name,
|
|
259
|
+
run: run.id
|
|
260
|
+
})
|
|
261
|
+
}, version));
|
|
262
|
+
}
|
|
263
|
+
if (view.kind === "run") return pane(/* @__PURE__ */ jsx(Bar, {
|
|
264
|
+
back: live?.find((each) => each.name === view.name)?.title ?? home,
|
|
265
|
+
onBack: () => go({
|
|
266
|
+
kind: "automation",
|
|
267
|
+
name: view.name
|
|
268
|
+
}),
|
|
269
|
+
classNames
|
|
270
|
+
}), /* @__PURE__ */ jsx(RunPane, {
|
|
271
|
+
client,
|
|
272
|
+
agentId,
|
|
273
|
+
name: view.name,
|
|
274
|
+
run: view.run,
|
|
275
|
+
apps,
|
|
276
|
+
words,
|
|
277
|
+
classNames,
|
|
278
|
+
onOpenConversation
|
|
279
|
+
}, version));
|
|
280
|
+
const state = data === null ? null : aboutState(data.about, data.about_at, writing);
|
|
281
|
+
return pane(null, /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("section", {
|
|
282
|
+
"aria-labelledby": intro,
|
|
283
|
+
className: classes(classNames, "sc-about__intro"),
|
|
284
|
+
children: [
|
|
285
|
+
/* @__PURE__ */ jsx(AgentName, {
|
|
286
|
+
id: intro,
|
|
287
|
+
agentId,
|
|
288
|
+
icon,
|
|
289
|
+
name,
|
|
290
|
+
label: home,
|
|
291
|
+
classNames
|
|
292
|
+
}),
|
|
293
|
+
problem !== null ? /* @__PURE__ */ jsxs(Problem, {
|
|
294
|
+
words,
|
|
295
|
+
classNames,
|
|
296
|
+
onRetry: retry,
|
|
297
|
+
children: [words.failed, problem instanceof ApiError && ` ${problem.detail}`]
|
|
298
|
+
}) : data === null || data.about === null ? /* @__PURE__ */ jsx(Writing, {
|
|
299
|
+
text: data === null ? words.loading : words.writing(name),
|
|
300
|
+
classNames
|
|
301
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
302
|
+
className: classes(classNames, "sc-about__lead"),
|
|
303
|
+
children: data.about.summary
|
|
304
|
+
}),
|
|
305
|
+
state === "writing" && data?.about != null && /* @__PURE__ */ jsx("p", {
|
|
306
|
+
role: "status",
|
|
307
|
+
className: classes(classNames, "sc-about__updating"),
|
|
308
|
+
children: words.updating
|
|
309
|
+
})
|
|
310
|
+
]
|
|
311
|
+
}), data !== null && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
312
|
+
/* @__PURE__ */ jsx(Automations, {
|
|
313
|
+
apps,
|
|
314
|
+
told: automationsOf(data.about, data.facts),
|
|
315
|
+
live,
|
|
316
|
+
words,
|
|
317
|
+
classNames,
|
|
318
|
+
tools,
|
|
319
|
+
controls,
|
|
320
|
+
onOpen: (automation) => go({
|
|
321
|
+
kind: "automation",
|
|
322
|
+
name: automation.name
|
|
323
|
+
})
|
|
324
|
+
}),
|
|
325
|
+
data.about !== null && data.about.asks.length > 0 && /* @__PURE__ */ jsx(Asks, {
|
|
326
|
+
asks: data.about.asks,
|
|
327
|
+
words,
|
|
328
|
+
classNames
|
|
329
|
+
}),
|
|
330
|
+
/* @__PURE__ */ jsxs("nav", {
|
|
331
|
+
"aria-label": words.facts,
|
|
332
|
+
className: classes(classNames, "sc-about__menu"),
|
|
333
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
334
|
+
className: classes(classNames, "sc-about__label"),
|
|
335
|
+
children: words.facts
|
|
336
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
337
|
+
className: classes(classNames, "sc-about__topics"),
|
|
338
|
+
children: HOME_TOPICS.map((topic) => /* @__PURE__ */ jsx(TopicRow, {
|
|
339
|
+
topic,
|
|
340
|
+
facts: data.facts,
|
|
341
|
+
apps,
|
|
342
|
+
words,
|
|
343
|
+
classNames,
|
|
344
|
+
onOpen: () => go({
|
|
345
|
+
kind: "topic",
|
|
346
|
+
topic
|
|
347
|
+
})
|
|
348
|
+
}, topic))
|
|
349
|
+
})]
|
|
350
|
+
})
|
|
351
|
+
] })] }));
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* What the panel's home shows the agent works with, in the order the owner looks for it: where
|
|
355
|
+
* people reach it, the apps it uses, what it knows, what it learned, its keys. Its tools are
|
|
356
|
+
* the platform's business: they show in the technical view, not here.
|
|
357
|
+
*/
|
|
358
|
+
const HOME_TOPICS = [
|
|
359
|
+
"channels",
|
|
360
|
+
"apps",
|
|
361
|
+
"knowledge",
|
|
362
|
+
"learning",
|
|
363
|
+
"keys"
|
|
364
|
+
];
|
|
365
|
+
/** How many icons a topic's row draws before "+N". */
|
|
366
|
+
const MOST_MARKS = 5;
|
|
367
|
+
/**
|
|
368
|
+
* A topic on the panel's home, as icons: its name, then what it holds as their logos or marks
|
|
369
|
+
* (the channels', the apps', the files') and how many; a topic with nothing says so, quietly.
|
|
370
|
+
* Pressing it opens the topic.
|
|
371
|
+
*/
|
|
372
|
+
function TopicRow({ topic, facts, apps, words, classNames, onOpen }) {
|
|
373
|
+
const count = countOf(topic, facts);
|
|
374
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
375
|
+
type: "button",
|
|
376
|
+
onClick: onOpen,
|
|
377
|
+
"data-empty": count === 0 || void 0,
|
|
378
|
+
className: classes(classNames, "sc-about__topic"),
|
|
379
|
+
children: [
|
|
380
|
+
/* @__PURE__ */ jsx("span", {
|
|
381
|
+
className: classes(classNames, "sc-about__topic-name"),
|
|
382
|
+
children: words.topics[topic]
|
|
383
|
+
}),
|
|
384
|
+
count === 0 ? /* @__PURE__ */ jsx("span", {
|
|
385
|
+
className: classes(classNames, "sc-about__topic-none"),
|
|
386
|
+
children: words.empty[topic]
|
|
387
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(TopicMarks, {
|
|
388
|
+
topic,
|
|
389
|
+
facts,
|
|
390
|
+
apps,
|
|
391
|
+
words,
|
|
392
|
+
count
|
|
393
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
394
|
+
className: classes(classNames, "sc-about__topic-count"),
|
|
395
|
+
children: count
|
|
396
|
+
})] }),
|
|
397
|
+
/* @__PURE__ */ jsx("svg", {
|
|
398
|
+
viewBox: "0 0 16 16",
|
|
399
|
+
fill: "none",
|
|
400
|
+
"aria-hidden": true,
|
|
401
|
+
className: classes(classNames, "sc-about__topic-go"),
|
|
402
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
403
|
+
d: "M6 3.5 10.5 8 6 12.5",
|
|
404
|
+
stroke: "currentColor",
|
|
405
|
+
strokeWidth: "1.5",
|
|
406
|
+
strokeLinecap: "round",
|
|
407
|
+
strokeLinejoin: "round"
|
|
408
|
+
})
|
|
409
|
+
})
|
|
410
|
+
]
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
/** What a topic holds, as icons: each channel's and app's logo, each file's mark; else its glyph. */
|
|
414
|
+
function TopicMarks({ topic, facts, apps, words, count }) {
|
|
415
|
+
const shown = (topic === "channels" ? facts.channels.map((channel) => /* @__PURE__ */ jsx("span", { children: channelLogo(channel.kind, apps, words, 20) }, `${channel.kind}:${channel.name}`)) : topic === "apps" ? facts.connections.map((connection) => /* @__PURE__ */ jsx("span", { children: appMark(connectionApp(connection), apps, 20) }, connection.name)) : topic === "knowledge" ? facts.files.map((file) => /* @__PURE__ */ jsx(FileMark, {
|
|
416
|
+
name: file.path,
|
|
417
|
+
size: 20
|
|
418
|
+
}, file.path)) : [/* @__PURE__ */ jsx(Mark, {
|
|
419
|
+
icon: TOPIC_GLYPHS[topic],
|
|
420
|
+
size: 20
|
|
421
|
+
}, topic)]).slice(0, MOST_MARKS);
|
|
422
|
+
return /* @__PURE__ */ jsx(MarkStack, {
|
|
423
|
+
more: Math.max(0, (topic === "learning" || topic === "keys" ? 0 : count) - shown.length),
|
|
424
|
+
children: shown
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Who the panel is about, at its top: the agent's mark in its tint, bare, beside its name; the
|
|
429
|
+
* panel's title ("About Ana") stays for screen readers.
|
|
430
|
+
*/
|
|
431
|
+
function AgentName({ id, agentId, icon, name, label, classNames }) {
|
|
432
|
+
const Glyph = agentGlyph(icon);
|
|
433
|
+
return /* @__PURE__ */ jsxs("h2", {
|
|
434
|
+
id,
|
|
435
|
+
"aria-label": label,
|
|
436
|
+
"data-tint": agentTint(agentId),
|
|
437
|
+
className: classes(classNames, "sc-about__name"),
|
|
438
|
+
children: [/* @__PURE__ */ jsx(Glyph, {
|
|
439
|
+
"aria-hidden": true,
|
|
440
|
+
weight: "duotone"
|
|
441
|
+
}), /* @__PURE__ */ jsx("span", { children: name })]
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Which way the panel moved to show `view`: in (one level deeper), back out, or nowhere (the first
|
|
446
|
+
* view). Kept per view, so a view's own updates never replay it.
|
|
447
|
+
*/
|
|
448
|
+
function useMotion(view) {
|
|
449
|
+
const key = keyOf(view);
|
|
450
|
+
const depth = depthOf(view);
|
|
451
|
+
const [moved, setMoved] = useState({
|
|
452
|
+
key,
|
|
453
|
+
depth,
|
|
454
|
+
motion: void 0
|
|
455
|
+
});
|
|
456
|
+
if (moved.key !== key) setMoved({
|
|
457
|
+
key,
|
|
458
|
+
depth,
|
|
459
|
+
motion: depth >= moved.depth ? "in" : "out"
|
|
460
|
+
});
|
|
461
|
+
return moved.motion;
|
|
462
|
+
}
|
|
463
|
+
/** The nearest box around `element` that scrolls: where the panel's place is kept. */
|
|
464
|
+
function scrollerOf(element) {
|
|
465
|
+
for (let at = element?.parentElement ?? null; at !== null; at = at.parentElement) {
|
|
466
|
+
const overflow = getComputedStyle(at).overflowY;
|
|
467
|
+
if (overflow === "auto" || overflow === "scroll") return at;
|
|
468
|
+
}
|
|
469
|
+
return null;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* The bar over a view opened from another: the way back to it, named, at its start; the host's
|
|
473
|
+
* controls at its end. It stays at the top as the view scrolls.
|
|
474
|
+
*/
|
|
475
|
+
function Bar({ back, onBack, end, classNames }) {
|
|
476
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
477
|
+
className: classes(classNames, "sc-about__bar"),
|
|
478
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
479
|
+
type: "button",
|
|
480
|
+
onClick: onBack,
|
|
481
|
+
className: classes(classNames, "sc-about__back"),
|
|
482
|
+
children: [/* @__PURE__ */ jsx("svg", {
|
|
483
|
+
viewBox: "0 0 16 16",
|
|
484
|
+
fill: "none",
|
|
485
|
+
"aria-hidden": true,
|
|
486
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
487
|
+
d: "M10 3.5 5.5 8l4.5 4.5",
|
|
488
|
+
stroke: "currentColor",
|
|
489
|
+
strokeWidth: "1.5",
|
|
490
|
+
strokeLinecap: "round",
|
|
491
|
+
strokeLinejoin: "round"
|
|
492
|
+
})
|
|
493
|
+
}), /* @__PURE__ */ jsx("span", { children: back })]
|
|
494
|
+
}), end != null && /* @__PURE__ */ jsx("span", {
|
|
495
|
+
className: classes(classNames, "sc-about__bar-end"),
|
|
496
|
+
children: end
|
|
497
|
+
})]
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* An automation, open in the panel: what starts it and when it runs next, the owner's sentence,
|
|
502
|
+
* its steps, the table it moves, its runs (each opening its record). Read again every few
|
|
503
|
+
* seconds while a run of it is under way.
|
|
504
|
+
*/
|
|
505
|
+
function AutomationPane({ client, agentId, name, apps, words, classNames, onOpenRun }) {
|
|
506
|
+
const { messages } = useKit();
|
|
507
|
+
const read = usePolled(() => client.automations.get(agentId, name), `${agentId}:${name}`, (automation) => automation.runs.some((run) => run.status === "running"));
|
|
508
|
+
if (read.gone) return /* @__PURE__ */ jsx(Gone, {
|
|
509
|
+
classNames,
|
|
510
|
+
children: messages.automation.gone
|
|
511
|
+
});
|
|
512
|
+
if (read.value === null) return read.problem === null ? /* @__PURE__ */ jsx(Loading, {
|
|
513
|
+
words,
|
|
514
|
+
classNames
|
|
515
|
+
}) : /* @__PURE__ */ jsx(Gone, {
|
|
516
|
+
classNames,
|
|
517
|
+
children: words.failed
|
|
518
|
+
});
|
|
519
|
+
return /* @__PURE__ */ jsx(Automation, {
|
|
520
|
+
className: classes(classNames, "sc-about__automation"),
|
|
521
|
+
automation: read.value,
|
|
522
|
+
runs: read.value.runs,
|
|
523
|
+
apps,
|
|
524
|
+
onOpenRun
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* A run, open in the panel: how it went, step by step in words, what it opened. Read with its
|
|
529
|
+
* automation (its steps' order and its apps' names), again while it is under way.
|
|
530
|
+
*/
|
|
531
|
+
function RunPane({ client, agentId, name, run, apps, words, classNames, onOpenConversation }) {
|
|
532
|
+
const read = usePolled(async () => {
|
|
533
|
+
const [record, automation] = await Promise.all([client.runs.get(run), client.automations.get(agentId, name).catch(() => null)]);
|
|
534
|
+
return {
|
|
535
|
+
record,
|
|
536
|
+
automation
|
|
537
|
+
};
|
|
538
|
+
}, run, ({ record }) => record.status === "running");
|
|
539
|
+
if (read.gone) return /* @__PURE__ */ jsx(Gone, {
|
|
540
|
+
classNames,
|
|
541
|
+
children: words.runGone
|
|
542
|
+
});
|
|
543
|
+
if (read.value === null) return read.problem === null ? /* @__PURE__ */ jsx(Loading, {
|
|
544
|
+
words,
|
|
545
|
+
classNames
|
|
546
|
+
}) : /* @__PURE__ */ jsx(Gone, {
|
|
547
|
+
classNames,
|
|
548
|
+
children: words.failed
|
|
549
|
+
});
|
|
550
|
+
return /* @__PURE__ */ jsx(RunView, {
|
|
551
|
+
className: classes(classNames, "sc-about__run"),
|
|
552
|
+
run: read.value.record,
|
|
553
|
+
automation: read.value.automation,
|
|
554
|
+
apps,
|
|
555
|
+
onOpenConversation
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
/** A view whose thing is being read: lines with a light sweeping them. */
|
|
559
|
+
function Loading({ words, classNames }) {
|
|
560
|
+
return /* @__PURE__ */ jsx(Writing, {
|
|
561
|
+
text: words.loading,
|
|
562
|
+
classNames
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
/** In place of what is no longer there, or could not be read. */
|
|
566
|
+
function Gone({ classNames, children }) {
|
|
567
|
+
return /* @__PURE__ */ jsx("p", {
|
|
568
|
+
className: classes(classNames, "sc-about__empty"),
|
|
569
|
+
children
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
/** An automation's mark says its kind: a time, a call from another system, an event. */
|
|
573
|
+
const KIND_ICONS = {
|
|
574
|
+
schedule: "clock",
|
|
575
|
+
webhook: "code",
|
|
576
|
+
event: "bell"
|
|
577
|
+
};
|
|
578
|
+
/** An app's mark: the host's logo when it draws one, else the provider's, bare. */
|
|
579
|
+
function appMark(app, apps, size) {
|
|
580
|
+
if (apps !== void 0) return apps.logo({
|
|
581
|
+
...app,
|
|
582
|
+
size
|
|
583
|
+
});
|
|
584
|
+
return /* @__PURE__ */ jsx(Mark, {
|
|
585
|
+
logo: true,
|
|
586
|
+
size,
|
|
587
|
+
children: providerMark(app.provider.split(":")[0], app.icon ?? void 0)
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
const connectionApp = (connection) => ({
|
|
591
|
+
provider: `${connection.provider}:${connection.toolkit ?? connection.name}`,
|
|
592
|
+
name: appTitle(connection),
|
|
593
|
+
icon: connection.icon
|
|
594
|
+
});
|
|
595
|
+
/**
|
|
596
|
+
* A channel's mark: the host's logo for its brand when it draws apps (WhatsApp, Instagram, the
|
|
597
|
+
* plain mark of a text message), else the package's glyph, bare.
|
|
598
|
+
*/
|
|
599
|
+
function channelLogo(kind, apps, words, size) {
|
|
600
|
+
if (apps !== void 0) return apps.logo({
|
|
601
|
+
provider: kind,
|
|
602
|
+
name: words.channelNames[kind],
|
|
603
|
+
size
|
|
604
|
+
});
|
|
605
|
+
return /* @__PURE__ */ jsx(Mark, {
|
|
606
|
+
size,
|
|
607
|
+
children: channelMark(kind)
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
/** What could not be read or written, in the warning tone, and the button to try again. */
|
|
611
|
+
function Problem({ words, classNames, onRetry, children }) {
|
|
612
|
+
return /* @__PURE__ */ jsxs("p", {
|
|
613
|
+
role: "alert",
|
|
614
|
+
className: classes(classNames, "sc-about__updated"),
|
|
615
|
+
children: [/* @__PURE__ */ jsx("span", { children }), /* @__PURE__ */ jsx("button", {
|
|
616
|
+
type: "button",
|
|
617
|
+
onClick: () => void onRetry(),
|
|
618
|
+
children: words.refresh
|
|
619
|
+
})]
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
/** The agent writing: the lead's lines with a light sweeping them, and the sentence saying so. */
|
|
623
|
+
function Writing({ text, classNames }) {
|
|
624
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
625
|
+
role: "status",
|
|
626
|
+
className: classes(classNames, "sc-about__writing"),
|
|
627
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
628
|
+
"aria-hidden": true,
|
|
629
|
+
children: [/* @__PURE__ */ jsx("i", {}), /* @__PURE__ */ jsx("i", {})]
|
|
630
|
+
}), /* @__PURE__ */ jsx("p", { children: text })]
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
/** What it asks leave for: its label, then the things, a short list. */
|
|
634
|
+
function Asks({ asks, words, classNames }) {
|
|
635
|
+
const id = useId();
|
|
636
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
637
|
+
"aria-labelledby": id,
|
|
638
|
+
className: classes(classNames, "sc-about__section", "sc-about__asks"),
|
|
639
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
640
|
+
className: classes(classNames, "sc-about__label"),
|
|
641
|
+
children: /* @__PURE__ */ jsx("h3", {
|
|
642
|
+
id,
|
|
643
|
+
children: words.asks
|
|
644
|
+
})
|
|
645
|
+
}), /* @__PURE__ */ jsx("ul", { children: asks.map((ask, index) => /* @__PURE__ */ jsx("li", { children: ask }, index)) })]
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* What it does on its own: one row per automation, its kind's mark (or, on an app's event, the
|
|
650
|
+
* app's logo), what it does then over when, as the agent tells it (its title and its kind until
|
|
651
|
+
* it has), a paused one quieter; how it stands now when that needs a look (a run under way, the
|
|
652
|
+
* last one failed); the host's control at each row's end, and over them the way to a new one. A
|
|
653
|
+
* row opens its automation.
|
|
654
|
+
*/
|
|
655
|
+
function Automations({ told, live, words, classNames, tools, controls, apps, onOpen }) {
|
|
656
|
+
const id = useId();
|
|
657
|
+
const { messages } = useKit();
|
|
658
|
+
const standing = new Map(live?.map((automation) => [automation.name, automation]));
|
|
659
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
660
|
+
"aria-labelledby": id,
|
|
661
|
+
className: classes(classNames, "sc-about__section"),
|
|
662
|
+
children: [
|
|
663
|
+
/* @__PURE__ */ jsxs("div", {
|
|
664
|
+
className: classes(classNames, "sc-about__label"),
|
|
665
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
666
|
+
id,
|
|
667
|
+
children: words.does
|
|
668
|
+
}), controls?.newAutomation !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
669
|
+
className: classes(classNames, "sc-about__tools"),
|
|
670
|
+
children: controls.newAutomation(tools)
|
|
671
|
+
})]
|
|
672
|
+
}),
|
|
673
|
+
told.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
674
|
+
className: classes(classNames, "sc-about__empty"),
|
|
675
|
+
children: words.noAutomations
|
|
676
|
+
}) : /* @__PURE__ */ jsx(List, { children: told.map(({ automation, line }) => {
|
|
677
|
+
const when = line?.when ?? words.kinds[automation.kind];
|
|
678
|
+
const now = standing.get(automation.name);
|
|
679
|
+
const going = now?.last_run?.status === "running";
|
|
680
|
+
return /* @__PURE__ */ jsx(Row, {
|
|
681
|
+
mark: automation.provider === void 0 ? /* @__PURE__ */ jsx(Mark, { icon: GLYPHS[KIND_ICONS[automation.kind]] }) : appMark({
|
|
682
|
+
provider: automation.provider,
|
|
683
|
+
name: automation.app_title ?? toolName(automation.app ?? automation.provider),
|
|
684
|
+
icon: automation.icon
|
|
685
|
+
}, apps, 28),
|
|
686
|
+
title: line?.text ?? automation.title,
|
|
687
|
+
subtitle: when,
|
|
688
|
+
error: now?.state === "failing" ? messages.automation.states.failing : void 0,
|
|
689
|
+
meta: going ? /* @__PURE__ */ jsxs(Tag, {
|
|
690
|
+
tone: "info",
|
|
691
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
692
|
+
"aria-hidden": true,
|
|
693
|
+
className: classes(classNames, "sc-run__live")
|
|
694
|
+
}), messages.automation.statuses.running]
|
|
695
|
+
}) : automation.on ? void 0 : /* @__PURE__ */ jsx(Tag, { children: words.paused }),
|
|
696
|
+
quiet: !automation.on,
|
|
697
|
+
onPress: () => onOpen(automation),
|
|
698
|
+
trailing: controls?.automation?.(automation, tools)
|
|
699
|
+
}, automation.id);
|
|
700
|
+
}) }),
|
|
701
|
+
controls?.automationsNote?.(tools)
|
|
702
|
+
]
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* One topic, open: its name with its count and the host's control, a line saying what it is, then
|
|
707
|
+
* its rows (what it knows as its files and its tables; what it learned; the rest with a mark and
|
|
708
|
+
* a note), or its one line when it holds nothing.
|
|
709
|
+
*/
|
|
710
|
+
function TopicView({ client, agentId, name, version, topic, facts, apps, label, words, classNames, tools, controls, onOpenFile }) {
|
|
711
|
+
const id = useId();
|
|
712
|
+
const tool = controls?.topic?.[topic];
|
|
713
|
+
const count = countOf(topic, facts);
|
|
714
|
+
const shown = topic === "tools" ? facts.actions.length : count;
|
|
715
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
716
|
+
"aria-labelledby": id,
|
|
717
|
+
className: classes(classNames, "sc-about__group"),
|
|
718
|
+
children: [
|
|
719
|
+
/* @__PURE__ */ jsxs("h3", {
|
|
720
|
+
id,
|
|
721
|
+
className: classes(classNames, "sc-about__title"),
|
|
722
|
+
children: [
|
|
723
|
+
/* @__PURE__ */ jsx("span", { children: words.topics[topic] }),
|
|
724
|
+
count > 0 && /* @__PURE__ */ jsx("b", {
|
|
725
|
+
className: classes(classNames, "sc-about__count"),
|
|
726
|
+
children: count
|
|
727
|
+
}),
|
|
728
|
+
tool !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
729
|
+
className: classes(classNames, "sc-about__tools"),
|
|
730
|
+
children: tool(tools)
|
|
731
|
+
})
|
|
732
|
+
]
|
|
733
|
+
}),
|
|
734
|
+
/* @__PURE__ */ jsx("p", {
|
|
735
|
+
className: classes(classNames, "sc-about__hint"),
|
|
736
|
+
children: words.hints[topic]
|
|
737
|
+
}),
|
|
738
|
+
topic === "channels" ? /* @__PURE__ */ jsx(Channels, {
|
|
739
|
+
client,
|
|
740
|
+
agentId,
|
|
741
|
+
version,
|
|
742
|
+
facts,
|
|
743
|
+
apps,
|
|
744
|
+
words,
|
|
745
|
+
classNames,
|
|
746
|
+
tools,
|
|
747
|
+
controls
|
|
748
|
+
}) : shown === 0 ? /* @__PURE__ */ jsx("p", {
|
|
749
|
+
className: classes(classNames, "sc-about__empty"),
|
|
750
|
+
children: words.empty[topic]
|
|
751
|
+
}) : topic === "knowledge" ? /* @__PURE__ */ jsx(Knowledge, {
|
|
752
|
+
name,
|
|
753
|
+
facts,
|
|
754
|
+
words,
|
|
755
|
+
classNames,
|
|
756
|
+
tools,
|
|
757
|
+
controls,
|
|
758
|
+
onOpenFile
|
|
759
|
+
}) : topic === "tools" ? /* @__PURE__ */ jsx(Tools, {
|
|
760
|
+
name,
|
|
761
|
+
facts,
|
|
762
|
+
label,
|
|
763
|
+
words,
|
|
764
|
+
classNames,
|
|
765
|
+
tools,
|
|
766
|
+
controls
|
|
767
|
+
}) : topic === "keys" ? /* @__PURE__ */ jsx(Keys, {
|
|
768
|
+
name,
|
|
769
|
+
facts,
|
|
770
|
+
words,
|
|
771
|
+
classNames,
|
|
772
|
+
tools,
|
|
773
|
+
controls
|
|
774
|
+
}) : topic === "learning" ? /* @__PURE__ */ jsx(List, { children: facts.memories.map((memory) => /* @__PURE__ */ jsx(Row, {
|
|
775
|
+
className: classes(classNames, "sc-about__memory"),
|
|
776
|
+
title: memory.text,
|
|
777
|
+
subtitle: words.ago(new Date(memory.created_at)),
|
|
778
|
+
trailing: controls?.memory?.(memory, tools)
|
|
779
|
+
}, memory.id)) }) : /* @__PURE__ */ jsx(Rows, {
|
|
780
|
+
items: appItems(facts, tools, controls, apps),
|
|
781
|
+
classNames
|
|
782
|
+
})
|
|
783
|
+
]
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
/** How each state of a channel reads beside its dot: working, waiting, broken, or off. */
|
|
787
|
+
const CHANNEL_TONES = {
|
|
788
|
+
active: "on",
|
|
789
|
+
pending: "wait",
|
|
790
|
+
error: "off",
|
|
791
|
+
disconnected: "quiet"
|
|
792
|
+
};
|
|
793
|
+
const isStatus = (status) => status in CHANNEL_TONES;
|
|
794
|
+
/** The order channels are listed in: by kind, as people reach a business most; disconnected last. */
|
|
795
|
+
const KIND_ORDER = [
|
|
796
|
+
"whatsapp",
|
|
797
|
+
"instagram",
|
|
798
|
+
"sms",
|
|
799
|
+
"email",
|
|
800
|
+
"web",
|
|
801
|
+
"phone"
|
|
802
|
+
];
|
|
803
|
+
const inOrder = (channels) => [...channels].sort((a, b) => Number(a.status === "disconnected") - Number(b.status === "disconnected") || KIND_ORDER.indexOf(a.kind) - KIND_ORDER.indexOf(b.kind));
|
|
804
|
+
/**
|
|
805
|
+
* Where it works: each channel it answers, as the API lists them (WhatsApp, Instagram, SMS; the
|
|
806
|
+
* disconnected ones last, quieter), by its brand's mark and name, its number or handle, how it stands with the
|
|
807
|
+
* provider's word on it, and the host's control at its end; then the devices it uses. Read
|
|
808
|
+
* when the topic opens and after each change the host makes; until then, or on a server without
|
|
809
|
+
* the list, the facts' rows.
|
|
810
|
+
*/
|
|
811
|
+
function Channels({ client, agentId, version, facts, apps, words, classNames, tools, controls }) {
|
|
812
|
+
const [listed, setListed] = useState(null);
|
|
813
|
+
useEffect(() => {
|
|
814
|
+
let gone = false;
|
|
815
|
+
client.channels.list(agentId).then((channels) => {
|
|
816
|
+
if (!gone) setListed(channels);
|
|
817
|
+
}, () => void 0);
|
|
818
|
+
return () => {
|
|
819
|
+
gone = true;
|
|
820
|
+
};
|
|
821
|
+
}, [
|
|
822
|
+
client,
|
|
823
|
+
agentId,
|
|
824
|
+
version
|
|
825
|
+
]);
|
|
826
|
+
const state = (status) => {
|
|
827
|
+
const known = isStatus(status);
|
|
828
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
829
|
+
"data-tone": known ? CHANNEL_TONES[status] : toneOf(status),
|
|
830
|
+
className: classes(classNames, "sc-about__state"),
|
|
831
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
832
|
+
"aria-hidden": true,
|
|
833
|
+
className: classes(classNames, "sc-about__dot")
|
|
834
|
+
}), known ? words.channelStates[status] : status]
|
|
835
|
+
});
|
|
836
|
+
};
|
|
837
|
+
const told = (channel) => {
|
|
838
|
+
const detail = channel.detail === null ? null : words.channelDetail(channel.detail);
|
|
839
|
+
const error = channel.status === "error";
|
|
840
|
+
return {
|
|
841
|
+
subtitle: /* @__PURE__ */ jsxs(Fragment$1, { children: [channel.name, !error && detail !== null && detail !== "" && /* @__PURE__ */ jsx("span", {
|
|
842
|
+
className: classes(classNames, "sc-about__detail"),
|
|
843
|
+
children: detail
|
|
844
|
+
})] }),
|
|
845
|
+
error: error ? detail ?? void 0 : void 0
|
|
846
|
+
};
|
|
847
|
+
};
|
|
848
|
+
const rows = listed === null ? facts.channels.map((channel) => /* @__PURE__ */ jsx(Row, {
|
|
849
|
+
mark: channelLogo(channel.kind, apps, words, 28),
|
|
850
|
+
title: words.channelNames[channel.kind],
|
|
851
|
+
subtitle: channel.name,
|
|
852
|
+
meta: state(channel.status)
|
|
853
|
+
}, `${channel.kind}:${channel.name}`)) : inOrder(listed).map((channel) => /* @__PURE__ */ jsx(Row, {
|
|
854
|
+
mark: channelLogo(channel.kind, apps, words, 28),
|
|
855
|
+
title: words.channelNames[channel.kind],
|
|
856
|
+
...told(channel),
|
|
857
|
+
meta: state(channel.status),
|
|
858
|
+
quiet: channel.status === "disconnected",
|
|
859
|
+
trailing: controls?.channel?.(channel, tools) ?? void 0
|
|
860
|
+
}, channel.id));
|
|
861
|
+
const devices = facts.devices.map((device) => /* @__PURE__ */ jsx(Row, {
|
|
862
|
+
mark: /* @__PURE__ */ jsx(Mark, { children: deviceMark(device.kind) }),
|
|
863
|
+
title: device.name,
|
|
864
|
+
meta: /* @__PURE__ */ jsx("i", {
|
|
865
|
+
"aria-hidden": true,
|
|
866
|
+
"data-tone": toneOf(device.status),
|
|
867
|
+
className: classes(classNames, "sc-about__dot")
|
|
868
|
+
})
|
|
869
|
+
}, `device:${device.kind}:${device.name}`));
|
|
870
|
+
if (rows.length + devices.length === 0) return /* @__PURE__ */ jsx("p", {
|
|
871
|
+
className: classes(classNames, "sc-about__empty"),
|
|
872
|
+
children: words.empty.channels
|
|
873
|
+
});
|
|
874
|
+
return /* @__PURE__ */ jsxs(List, { children: [rows, devices] });
|
|
875
|
+
}
|
|
876
|
+
/** Its apps: each by its logo and name, what it may do there under it, how it stands at its end. */
|
|
877
|
+
function appItems(facts, tools, controls, apps) {
|
|
878
|
+
return facts.connections.map((connection) => ({
|
|
879
|
+
key: `${connection.provider}:${connection.name}`,
|
|
880
|
+
mark: appMark(connectionApp(connection), apps, 28),
|
|
881
|
+
label: appTitle(connection),
|
|
882
|
+
note: connection.actions.map((action) => toolTitle(connection, action)).join(", "),
|
|
883
|
+
status: connection.status === void 0 ? void 0 : toneOf(connection.status),
|
|
884
|
+
control: controls?.app?.(connection, tools)
|
|
885
|
+
}));
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* What it can do while it talks: its own code's actions, then the ones every agent comes with
|
|
889
|
+
* (each under its heading when it has both); in each, the ones it has first, then the ones the
|
|
890
|
+
* owner can turn on, quieter, saying so.
|
|
891
|
+
*/
|
|
892
|
+
function Tools({ name, facts, label, words, classNames, tools, controls }) {
|
|
893
|
+
const groups = [{
|
|
894
|
+
key: "own",
|
|
895
|
+
title: words.theirs(name),
|
|
896
|
+
actions: facts.actions.filter(isOwn)
|
|
897
|
+
}, {
|
|
898
|
+
key: "built",
|
|
899
|
+
title: words.builtIn,
|
|
900
|
+
actions: facts.actions.filter((a) => !isOwn(a))
|
|
901
|
+
}].filter((group) => group.actions.length > 0);
|
|
902
|
+
const rows = (actions) => /* @__PURE__ */ jsx(Rows, {
|
|
903
|
+
items: [...actions.filter((a) => a.on), ...actions.filter((a) => !a.on)].map((action) => ({
|
|
904
|
+
key: `${action.source}:${action.name}`,
|
|
905
|
+
mark: /* @__PURE__ */ jsx(Mark, { children: actionMark(action.name, action.source) }),
|
|
906
|
+
label: label(action),
|
|
907
|
+
note: action.on ? void 0 : words.off,
|
|
908
|
+
off: !action.on,
|
|
909
|
+
control: controls?.tool?.(action, tools)
|
|
910
|
+
})),
|
|
911
|
+
classNames
|
|
912
|
+
});
|
|
913
|
+
if (groups.length === 1) return rows(groups[0]?.actions ?? []);
|
|
914
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: groups.map((group) => /* @__PURE__ */ jsx(Group, {
|
|
915
|
+
title: group.title,
|
|
916
|
+
classNames,
|
|
917
|
+
children: rows(group.actions)
|
|
918
|
+
}, group.key)) });
|
|
919
|
+
}
|
|
920
|
+
const isOwn = (action) => action.source === "own";
|
|
921
|
+
/** A part of a topic under its small heading: whose things they are, or what kind. */
|
|
922
|
+
function Group({ title, classNames, children }) {
|
|
923
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("h4", {
|
|
924
|
+
className: classes(classNames, "sc-about__subtitle"),
|
|
925
|
+
children: title
|
|
926
|
+
}), children] });
|
|
927
|
+
}
|
|
928
|
+
/** What is the agent's own, then the organization's: the heading says whose, once. */
|
|
929
|
+
function byOwner(things, name, words) {
|
|
930
|
+
return [{
|
|
931
|
+
key: "own",
|
|
932
|
+
title: words.theirs(name),
|
|
933
|
+
things: things.filter((thing) => !thing.shared)
|
|
934
|
+
}, {
|
|
935
|
+
key: "shared",
|
|
936
|
+
title: words.organization,
|
|
937
|
+
things: things.filter((thing) => thing.shared === true)
|
|
938
|
+
}].filter((group) => group.things.length > 0);
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* What it knows, by whose it is: its own files, then the organization's (shared with every
|
|
942
|
+
* agent: the heading says so, once), then the tables it reads or writes. A file is its kind's
|
|
943
|
+
* mark, its name on one line, its folder under it (and that it is only kept, when `search_files`
|
|
944
|
+
* does not read it), its size at the right; pressed, the host opens it; the host's controls at
|
|
945
|
+
* its end.
|
|
946
|
+
*/
|
|
947
|
+
function Knowledge({ name, facts, words, classNames, tools, controls, onOpenFile }) {
|
|
948
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [byOwner(facts.files, name, words).map((group) => /* @__PURE__ */ jsx(Group, {
|
|
949
|
+
title: group.title,
|
|
950
|
+
classNames,
|
|
951
|
+
children: /* @__PURE__ */ jsx(List, { children: group.things.map((file) => /* @__PURE__ */ jsx(Row, {
|
|
952
|
+
className: classes(classNames, "sc-about__file"),
|
|
953
|
+
mark: /* @__PURE__ */ jsx(FileMark, { name: file.path }),
|
|
954
|
+
title: /* @__PURE__ */ jsx("span", {
|
|
955
|
+
title: file.path,
|
|
956
|
+
children: baseName(file.path)
|
|
957
|
+
}),
|
|
958
|
+
subtitle: fileLine(file, words),
|
|
959
|
+
meta: words.size(file.size),
|
|
960
|
+
onPress: onOpenFile && (() => onOpenFile(file)),
|
|
961
|
+
trailing: controls?.file?.(file, tools) ?? void 0
|
|
962
|
+
}, file.path)) })
|
|
963
|
+
}, group.key)), facts.data.length > 0 && /* @__PURE__ */ jsx(Group, {
|
|
964
|
+
title: words.tables,
|
|
965
|
+
classNames,
|
|
966
|
+
children: /* @__PURE__ */ jsx(Rows, {
|
|
967
|
+
items: facts.data.map((table) => ({
|
|
968
|
+
key: table.table,
|
|
969
|
+
mark: /* @__PURE__ */ jsx(Mark, { icon: GLYPHS.table }),
|
|
970
|
+
label: table.title ?? table.table,
|
|
971
|
+
note: table.can.map((can) => words.can[can] ?? can).join(", "),
|
|
972
|
+
control: controls?.table?.(table, tools)
|
|
973
|
+
})),
|
|
974
|
+
classNames
|
|
975
|
+
})
|
|
976
|
+
})] });
|
|
977
|
+
}
|
|
978
|
+
/** Under a file's name: its folder, and that it is only kept when nothing reads it at a search. */
|
|
979
|
+
function fileLine(file, words) {
|
|
980
|
+
const folder = folderOf(file.path);
|
|
981
|
+
if (file.searchable) return folder === "" ? void 0 : folder;
|
|
982
|
+
return folder === "" ? words.kept : `${folder} · ${words.kept}`;
|
|
983
|
+
}
|
|
984
|
+
/** Its keys, its own then the organization's, each with where it may be sent. */
|
|
985
|
+
function Keys({ name, facts, words, classNames, tools, controls }) {
|
|
986
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: byOwner(facts.vault, name, words).map((group) => /* @__PURE__ */ jsx(Group, {
|
|
987
|
+
title: group.title,
|
|
988
|
+
classNames,
|
|
989
|
+
children: /* @__PURE__ */ jsx(Rows, {
|
|
990
|
+
items: group.things.map((secret) => ({
|
|
991
|
+
key: `${group.key}:${secret.name}`,
|
|
992
|
+
mark: /* @__PURE__ */ jsx(Mark, { icon: GLYPHS.lock }),
|
|
993
|
+
label: secret.name,
|
|
994
|
+
note: secret.hosts?.join(", "),
|
|
995
|
+
control: controls?.key?.(secret, tools)
|
|
996
|
+
})),
|
|
997
|
+
classNames
|
|
998
|
+
})
|
|
999
|
+
}, group.key)) });
|
|
1000
|
+
}
|
|
1001
|
+
/** The folders a file sits in: "" for one at the top. */
|
|
1002
|
+
const folderOf = (path) => path.slice(0, Math.max(0, path.lastIndexOf("/")));
|
|
1003
|
+
function Rows({ items, classNames }) {
|
|
1004
|
+
return /* @__PURE__ */ jsx(List, { children: items.map((item) => /* @__PURE__ */ jsx(Row, {
|
|
1005
|
+
mark: item.mark,
|
|
1006
|
+
title: item.label,
|
|
1007
|
+
subtitle: item.note === void 0 || item.note === "" ? void 0 : item.note,
|
|
1008
|
+
meta: item.status === void 0 ? void 0 : /* @__PURE__ */ jsx("i", {
|
|
1009
|
+
"aria-hidden": true,
|
|
1010
|
+
"data-tone": item.status,
|
|
1011
|
+
className: classes(classNames, "sc-about__dot")
|
|
1012
|
+
}),
|
|
1013
|
+
quiet: item.off,
|
|
1014
|
+
trailing: item.control ?? void 0
|
|
1015
|
+
}, item.key)) });
|
|
1016
|
+
}
|
|
1017
|
+
//#endregion
|
|
1018
|
+
export { ABOUT_HOME, ABOUT_MESSAGES, AgentAbout, aboutBack };
|
|
1019
|
+
|
|
1020
|
+
//# sourceMappingURL=AgentAbout.js.map
|