@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,113 @@
|
|
|
1
|
+
import { AutomationState, RunBy, RunStatus, Use } from "./types.js";
|
|
2
|
+
//#region src/automation/messages.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* A day as a person says it beside a time: today, yesterday, tomorrow, a weekday within the
|
|
5
|
+
* week (`name` as the locale names it, short or long), or a date further away.
|
|
6
|
+
*/
|
|
7
|
+
export type DayRef = {
|
|
8
|
+
kind: "today" | "yesterday" | "tomorrow";
|
|
9
|
+
} | {
|
|
10
|
+
kind: "weekday" | "date";
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
13
|
+
/** A tool's call by what it does, read from its name: what a run's record says it did. */
|
|
14
|
+
export type Verb = "search" | "send" | "create" | "update" | "remove" | "use";
|
|
15
|
+
/** What a run did, call by call, in words; `would` is a test's write, recorded and not done. */
|
|
16
|
+
export interface CallMessages {
|
|
17
|
+
/** An app's tool, by what its name says it does, with the app's name. */
|
|
18
|
+
tool: (verb: Verb, app: string, would: boolean) => string;
|
|
19
|
+
/** One model call: it reads and writes for real in a test too. */
|
|
20
|
+
ai: string;
|
|
21
|
+
/** A line in the owner's inbox. */
|
|
22
|
+
notify: (would: boolean) => string;
|
|
23
|
+
/**
|
|
24
|
+
* A message to a contact on one of the agent's channels: the channel's kind when the record
|
|
25
|
+
* says it (`whatsapp`, `instagram`, `sms`), and who to (a number; "" for a contact by its id).
|
|
26
|
+
*/
|
|
27
|
+
send: (channel: string | null, to: string, would: boolean) => string;
|
|
28
|
+
/** A conversation of the agent opened for what needs judgement or a person. */
|
|
29
|
+
start: (would: boolean) => string;
|
|
30
|
+
/** A table's rows looked up, added, changed, by the table's title. */
|
|
31
|
+
find: (table: string) => string;
|
|
32
|
+
add: (table: string, would: boolean) => string;
|
|
33
|
+
change: (table: string, would: boolean) => string;
|
|
34
|
+
/** A call to another system, by its host. */
|
|
35
|
+
http: (host: string, would: boolean) => string;
|
|
36
|
+
/** The organization's files searched. */
|
|
37
|
+
files: string;
|
|
38
|
+
/** One of its files read, kept, or its files listed, by the file's name. */
|
|
39
|
+
read: (file: string) => string;
|
|
40
|
+
wrote: (file: string, would: boolean) => string;
|
|
41
|
+
listed: string;
|
|
42
|
+
/** A line kept in, and one looked up from, what the agent learned. */
|
|
43
|
+
remember: (would: boolean) => string;
|
|
44
|
+
recall: string;
|
|
45
|
+
}
|
|
46
|
+
/** The words of an automation and its runs: the trigger in words, its state, its runs. */
|
|
47
|
+
export interface AutomationMessages {
|
|
48
|
+
/** When it runs, from its cron line (`whenOf`): the days, then the times. */
|
|
49
|
+
daily: string;
|
|
50
|
+
/** Monday to Friday. */
|
|
51
|
+
weekdays: string;
|
|
52
|
+
/** Saturday and Sunday. */
|
|
53
|
+
weekends: string;
|
|
54
|
+
/** Some days of the week, by their names. */
|
|
55
|
+
weekly: (days: string[]) => string;
|
|
56
|
+
/** Some days of the month. */
|
|
57
|
+
monthly: (days: number[]) => string;
|
|
58
|
+
/** The times it runs at, after the days ("9:00", as the locale writes it). */
|
|
59
|
+
at: (times: string[]) => string;
|
|
60
|
+
/** Every few minutes or hours, all day or `between` two times. */
|
|
61
|
+
every: (count: number, unit: "minute" | "hour") => string;
|
|
62
|
+
between: (from: string, to: string) => string;
|
|
63
|
+
/** A frequency on some days only: "every 15 minutes" and "on weekdays". */
|
|
64
|
+
on: (often: string, days: string) => string;
|
|
65
|
+
/** A schedule the sentence can't say. */
|
|
66
|
+
custom: string;
|
|
67
|
+
/** What another kind of trigger waits for. */
|
|
68
|
+
webhook: string;
|
|
69
|
+
event: (app: string | null, event: string | null) => string;
|
|
70
|
+
/** When it runs next, after when it runs: the day, and the time when the line doesn't say it. */
|
|
71
|
+
next: (day: DayRef, time: string | null) => string;
|
|
72
|
+
/** How it stands, on its pill. */
|
|
73
|
+
states: Readonly<Record<AutomationState, string>>;
|
|
74
|
+
/** Its switch, for screen readers. */
|
|
75
|
+
switchLabel: string;
|
|
76
|
+
/** Over its steps, the table it moves, its runs. */
|
|
77
|
+
steps: string;
|
|
78
|
+
runs: string;
|
|
79
|
+
/** In the place of its runs, when there are none yet. */
|
|
80
|
+
noRuns: string;
|
|
81
|
+
/** What a step uses, other than an app (which goes by its name). */
|
|
82
|
+
uses: Readonly<Record<Exclude<Use["kind"], "app">, string>>;
|
|
83
|
+
/** The values of the table past the ones shown: "+3". */
|
|
84
|
+
more: (count: number) => string;
|
|
85
|
+
/** An automation the agent named that is not there (removed, renamed). */
|
|
86
|
+
gone: string;
|
|
87
|
+
/** When a run started, beside what started it. */
|
|
88
|
+
moment: (day: DayRef, time: string) => string;
|
|
89
|
+
/** What started a run; an event's by its app's name, when known. */
|
|
90
|
+
by: (by: RunBy, app: string | null) => string;
|
|
91
|
+
/** How a run stands. */
|
|
92
|
+
statuses: Readonly<Record<RunStatus, string>>;
|
|
93
|
+
/** A test's line: what the run returned, though it changed nothing. */
|
|
94
|
+
dry: (summary: string) => string;
|
|
95
|
+
/** How long a run took. */
|
|
96
|
+
took: (ms: number) => string;
|
|
97
|
+
/** Over the conversations a run opened, and each one's link. */
|
|
98
|
+
opened: string;
|
|
99
|
+
conversation: (index: number) => string;
|
|
100
|
+
/** The conversation the agent was asked in, for a run it started. */
|
|
101
|
+
askedIn: string;
|
|
102
|
+
/** A run that called nothing. */
|
|
103
|
+
noCalls: string;
|
|
104
|
+
/** Over the calls made outside any step. */
|
|
105
|
+
outside: string;
|
|
106
|
+
/** A call made several times in a row: "×12". */
|
|
107
|
+
times: (count: number) => string;
|
|
108
|
+
calls: CallMessages;
|
|
109
|
+
}
|
|
110
|
+
/** English: what the package says until a host gives its own words. */
|
|
111
|
+
export declare const AUTOMATION_MESSAGES: AutomationMessages;
|
|
112
|
+
//#endregion
|
|
113
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
//#region src/automation/messages.ts
|
|
2
|
+
const plural = (count, one, many) => count === 1 ? one : `${count} ${many}`;
|
|
3
|
+
/** English: what the package says until a host gives its own words. */
|
|
4
|
+
const AUTOMATION_MESSAGES = {
|
|
5
|
+
daily: "Every day",
|
|
6
|
+
weekdays: "Every weekday",
|
|
7
|
+
weekends: "Every weekend",
|
|
8
|
+
weekly: (days) => days.length === 1 ? `Every ${days[0] ?? ""}` : `On ${new Intl.ListFormat("en").format(days)}`,
|
|
9
|
+
monthly: (days) => `On day ${new Intl.ListFormat("en").format(days.map(String))} of every month`,
|
|
10
|
+
at: (times) => `at ${new Intl.ListFormat("en").format(times)}`,
|
|
11
|
+
every: (count, unit) => `Every ${plural(count, unit, `${unit}s`)}`,
|
|
12
|
+
between: (from, to) => `from ${from} to ${to}`,
|
|
13
|
+
on: (often, days) => `${often}, ${days.charAt(0).toLowerCase()}${days.slice(1)}`,
|
|
14
|
+
custom: "On a schedule of its own",
|
|
15
|
+
webhook: "When another system calls it",
|
|
16
|
+
event: (app, event) => event ? `When ${event} in ${app ?? "an app"}` : `On an event in ${app ?? "an app"}`,
|
|
17
|
+
next: (day, time) => {
|
|
18
|
+
const at = time === null ? "" : ` at ${time}`;
|
|
19
|
+
switch (day.kind) {
|
|
20
|
+
case "today": return `next today${at}`;
|
|
21
|
+
case "tomorrow": return `next tomorrow${at}`;
|
|
22
|
+
case "yesterday": return `next${at}`;
|
|
23
|
+
default: return `next on ${day.name}${at}`;
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
states: {
|
|
27
|
+
active: "On",
|
|
28
|
+
paused: "Paused",
|
|
29
|
+
failing: "Last run failed"
|
|
30
|
+
},
|
|
31
|
+
switchLabel: "On",
|
|
32
|
+
steps: "Steps",
|
|
33
|
+
runs: "Runs",
|
|
34
|
+
noRuns: "It hasn't run yet.",
|
|
35
|
+
uses: {
|
|
36
|
+
ai: "AI",
|
|
37
|
+
agent: "Agent",
|
|
38
|
+
notify: "Inbox",
|
|
39
|
+
send: "Message",
|
|
40
|
+
data: "Table",
|
|
41
|
+
http: "Web"
|
|
42
|
+
},
|
|
43
|
+
more: (count) => `+${count}`,
|
|
44
|
+
gone: "This automation is no longer there.",
|
|
45
|
+
moment: (day, time) => {
|
|
46
|
+
switch (day.kind) {
|
|
47
|
+
case "today": return `Today ${time}`;
|
|
48
|
+
case "yesterday": return `Yesterday ${time}`;
|
|
49
|
+
case "tomorrow": return `Tomorrow ${time}`;
|
|
50
|
+
default: return `${day.name} ${time}`;
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
by: (by, app) => ({
|
|
54
|
+
schedule: "scheduled",
|
|
55
|
+
webhook: "webhook",
|
|
56
|
+
event: app ? `${app} event` : "event",
|
|
57
|
+
agent: "you asked in the chat",
|
|
58
|
+
test: "test"
|
|
59
|
+
})[by],
|
|
60
|
+
statuses: {
|
|
61
|
+
running: "Running",
|
|
62
|
+
waiting: "Waiting",
|
|
63
|
+
done: "Done",
|
|
64
|
+
failed: "Failed",
|
|
65
|
+
skipped: "Skipped"
|
|
66
|
+
},
|
|
67
|
+
dry: (summary) => `Test: ${summary}`,
|
|
68
|
+
took: (ms) => ms < 6e4 ? `${Math.max(1, Math.round(ms / 1e3))} s` : `${Math.round(ms / 6e4)} min`,
|
|
69
|
+
opened: "Conversations it opened",
|
|
70
|
+
conversation: (index) => `Conversation ${index}`,
|
|
71
|
+
askedIn: "The conversation you asked in",
|
|
72
|
+
noCalls: "It didn't call anything.",
|
|
73
|
+
outside: "Outside the steps",
|
|
74
|
+
times: (count) => `×${count}`,
|
|
75
|
+
calls: {
|
|
76
|
+
tool: (verb, app, would) => {
|
|
77
|
+
const done = {
|
|
78
|
+
search: `Searched ${app}`,
|
|
79
|
+
send: `Sent with ${app}`,
|
|
80
|
+
create: `Created in ${app}`,
|
|
81
|
+
update: `Changed in ${app}`,
|
|
82
|
+
remove: `Removed in ${app}`,
|
|
83
|
+
use: `Used ${app}`
|
|
84
|
+
}[verb];
|
|
85
|
+
return would && verb !== "search" ? `Would have ${done.charAt(0).toLowerCase()}${done.slice(1)}` : done;
|
|
86
|
+
},
|
|
87
|
+
ai: "Used AI",
|
|
88
|
+
notify: (would) => would ? "Would have told you in the inbox" : "Told you in the inbox",
|
|
89
|
+
send: (channel, to, would) => {
|
|
90
|
+
const sent = `${{
|
|
91
|
+
whatsapp: "a WhatsApp",
|
|
92
|
+
sms: "an SMS",
|
|
93
|
+
instagram: "an Instagram message"
|
|
94
|
+
}[channel ?? ""] ?? "a message"} to ${to || "a contact"}`;
|
|
95
|
+
return would ? `Would have sent ${sent}` : `Sent ${sent}`;
|
|
96
|
+
},
|
|
97
|
+
start: (would) => would ? "Would have opened a conversation" : "Opened a conversation",
|
|
98
|
+
find: (table) => `Looked up ${table}`,
|
|
99
|
+
add: (table, would) => would ? `Would have added a row to ${table}` : `Added a row to ${table}`,
|
|
100
|
+
change: (table, would) => would ? `Would have changed a row of ${table}` : `Changed a row of ${table}`,
|
|
101
|
+
http: (host, would) => would ? `Would have called ${host}` : `Called ${host}`,
|
|
102
|
+
files: "Searched the files",
|
|
103
|
+
read: (file) => `Read ${file}`,
|
|
104
|
+
wrote: (file, would) => would ? `Would have saved ${file}` : `Saved ${file}`,
|
|
105
|
+
listed: "Looked through its files",
|
|
106
|
+
remember: (would) => would ? "Would have kept a memory" : "Kept a memory",
|
|
107
|
+
recall: "Searched what it learned"
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
//#endregion
|
|
111
|
+
export { AUTOMATION_MESSAGES };
|
|
112
|
+
|
|
113
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","names":[],"sources":["../../src/automation/messages.ts"],"sourcesContent":["import type { AutomationState, RunBy, RunStatus, Use } from \"./types\";\n\n/**\n * A day as a person says it beside a time: today, yesterday, tomorrow, a weekday within the\n * week (`name` as the locale names it, short or long), or a date further away.\n */\nexport type DayRef =\n { kind: \"today\" | \"yesterday\" | \"tomorrow\" } | { kind: \"weekday\" | \"date\"; name: string };\n\n/** A tool's call by what it does, read from its name: what a run's record says it did. */\nexport type Verb = \"search\" | \"send\" | \"create\" | \"update\" | \"remove\" | \"use\";\n\n/** What a run did, call by call, in words; `would` is a test's write, recorded and not done. */\nexport interface CallMessages {\n /** An app's tool, by what its name says it does, with the app's name. */\n tool: (verb: Verb, app: string, would: boolean) => string;\n /** One model call: it reads and writes for real in a test too. */\n ai: string;\n /** A line in the owner's inbox. */\n notify: (would: boolean) => string;\n /**\n * A message to a contact on one of the agent's channels: the channel's kind when the record\n * says it (`whatsapp`, `instagram`, `sms`), and who to (a number; \"\" for a contact by its id).\n */\n send: (channel: string | null, to: string, would: boolean) => string;\n /** A conversation of the agent opened for what needs judgement or a person. */\n start: (would: boolean) => string;\n /** A table's rows looked up, added, changed, by the table's title. */\n find: (table: string) => string;\n add: (table: string, would: boolean) => string;\n change: (table: string, would: boolean) => string;\n /** A call to another system, by its host. */\n http: (host: string, would: boolean) => string;\n /** The organization's files searched. */\n files: string;\n /** One of its files read, kept, or its files listed, by the file's name. */\n read: (file: string) => string;\n wrote: (file: string, would: boolean) => string;\n listed: string;\n /** A line kept in, and one looked up from, what the agent learned. */\n remember: (would: boolean) => string;\n recall: string;\n}\n\n/** The words of an automation and its runs: the trigger in words, its state, its runs. */\nexport interface AutomationMessages {\n /** When it runs, from its cron line (`whenOf`): the days, then the times. */\n daily: string;\n /** Monday to Friday. */\n weekdays: string;\n /** Saturday and Sunday. */\n weekends: string;\n /** Some days of the week, by their names. */\n weekly: (days: string[]) => string;\n /** Some days of the month. */\n monthly: (days: number[]) => string;\n /** The times it runs at, after the days (\"9:00\", as the locale writes it). */\n at: (times: string[]) => string;\n /** Every few minutes or hours, all day or `between` two times. */\n every: (count: number, unit: \"minute\" | \"hour\") => string;\n between: (from: string, to: string) => string;\n /** A frequency on some days only: \"every 15 minutes\" and \"on weekdays\". */\n on: (often: string, days: string) => string;\n /** A schedule the sentence can't say. */\n custom: string;\n /** What another kind of trigger waits for. */\n webhook: string;\n event: (app: string | null, event: string | null) => string;\n /** When it runs next, after when it runs: the day, and the time when the line doesn't say it. */\n next: (day: DayRef, time: string | null) => string;\n /** How it stands, on its pill. */\n states: Readonly<Record<AutomationState, string>>;\n /** Its switch, for screen readers. */\n switchLabel: string;\n /** Over its steps, the table it moves, its runs. */\n steps: string;\n runs: string;\n /** In the place of its runs, when there are none yet. */\n noRuns: string;\n /** What a step uses, other than an app (which goes by its name). */\n uses: Readonly<Record<Exclude<Use[\"kind\"], \"app\">, string>>;\n /** The values of the table past the ones shown: \"+3\". */\n more: (count: number) => string;\n /** An automation the agent named that is not there (removed, renamed). */\n gone: string;\n /** When a run started, beside what started it. */\n moment: (day: DayRef, time: string) => string;\n /** What started a run; an event's by its app's name, when known. */\n by: (by: RunBy, app: string | null) => string;\n /** How a run stands. */\n statuses: Readonly<Record<RunStatus, string>>;\n /** A test's line: what the run returned, though it changed nothing. */\n dry: (summary: string) => string;\n /** How long a run took. */\n took: (ms: number) => string;\n /** Over the conversations a run opened, and each one's link. */\n opened: string;\n conversation: (index: number) => string;\n /** The conversation the agent was asked in, for a run it started. */\n askedIn: string;\n /** A run that called nothing. */\n noCalls: string;\n /** Over the calls made outside any step. */\n outside: string;\n /** A call made several times in a row: \"×12\". */\n times: (count: number) => string;\n calls: CallMessages;\n}\n\nconst plural = (count: number, one: string, many: string) =>\n count === 1 ? one : `${count} ${many}`;\n\n/** English: what the package says until a host gives its own words. */\nexport const AUTOMATION_MESSAGES: AutomationMessages = {\n daily: \"Every day\",\n weekdays: \"Every weekday\",\n weekends: \"Every weekend\",\n weekly: (days) =>\n days.length === 1 ? `Every ${days[0] ?? \"\"}` : `On ${new Intl.ListFormat(\"en\").format(days)}`,\n monthly: (days) => `On day ${new Intl.ListFormat(\"en\").format(days.map(String))} of every month`,\n at: (times) => `at ${new Intl.ListFormat(\"en\").format(times)}`,\n every: (count, unit) => `Every ${plural(count, unit, `${unit}s`)}`,\n between: (from, to) => `from ${from} to ${to}`,\n on: (often, days) => `${often}, ${days.charAt(0).toLowerCase()}${days.slice(1)}`,\n custom: \"On a schedule of its own\",\n webhook: \"When another system calls it\",\n event: (app, event) =>\n event ? `When ${event} in ${app ?? \"an app\"}` : `On an event in ${app ?? \"an app\"}`,\n next: (day, time) => {\n const at = time === null ? \"\" : ` at ${time}`;\n switch (day.kind) {\n case \"today\":\n return `next today${at}`;\n case \"tomorrow\":\n return `next tomorrow${at}`;\n case \"yesterday\":\n return `next${at}`;\n default:\n return `next on ${day.name}${at}`;\n }\n },\n states: { active: \"On\", paused: \"Paused\", failing: \"Last run failed\" },\n switchLabel: \"On\",\n steps: \"Steps\",\n runs: \"Runs\",\n noRuns: \"It hasn't run yet.\",\n uses: {\n ai: \"AI\",\n agent: \"Agent\",\n notify: \"Inbox\",\n send: \"Message\",\n data: \"Table\",\n http: \"Web\",\n },\n more: (count) => `+${count}`,\n gone: \"This automation is no longer there.\",\n moment: (day, time) => {\n switch (day.kind) {\n case \"today\":\n return `Today ${time}`;\n case \"yesterday\":\n return `Yesterday ${time}`;\n case \"tomorrow\":\n return `Tomorrow ${time}`;\n default:\n return `${day.name} ${time}`;\n }\n },\n by: (by, app) =>\n ({\n schedule: \"scheduled\",\n webhook: \"webhook\",\n event: app ? `${app} event` : \"event\",\n agent: \"you asked in the chat\",\n test: \"test\",\n })[by],\n statuses: {\n running: \"Running\",\n waiting: \"Waiting\",\n done: \"Done\",\n failed: \"Failed\",\n skipped: \"Skipped\",\n },\n dry: (summary) => `Test: ${summary}`,\n took: (ms) =>\n ms < 60_000 ? `${Math.max(1, Math.round(ms / 1000))} s` : `${Math.round(ms / 60_000)} min`,\n opened: \"Conversations it opened\",\n conversation: (index) => `Conversation ${index}`,\n askedIn: \"The conversation you asked in\",\n noCalls: \"It didn't call anything.\",\n outside: \"Outside the steps\",\n times: (count) => `×${count}`,\n calls: {\n tool: (verb, app, would) => {\n const done = {\n search: `Searched ${app}`,\n send: `Sent with ${app}`,\n create: `Created in ${app}`,\n update: `Changed in ${app}`,\n remove: `Removed in ${app}`,\n use: `Used ${app}`,\n }[verb];\n return would && verb !== \"search\"\n ? `Would have ${done.charAt(0).toLowerCase()}${done.slice(1)}`\n : done;\n },\n ai: \"Used AI\",\n notify: (would) => (would ? \"Would have told you in the inbox\" : \"Told you in the inbox\"),\n send: (channel, to, would) => {\n const what =\n { whatsapp: \"a WhatsApp\", sms: \"an SMS\", instagram: \"an Instagram message\" }[\n channel ?? \"\"\n ] ?? \"a message\";\n const sent = `${what} to ${to || \"a contact\"}`;\n return would ? `Would have sent ${sent}` : `Sent ${sent}`;\n },\n start: (would) => (would ? \"Would have opened a conversation\" : \"Opened a conversation\"),\n find: (table) => `Looked up ${table}`,\n add: (table, would) =>\n would ? `Would have added a row to ${table}` : `Added a row to ${table}`,\n change: (table, would) =>\n would ? `Would have changed a row of ${table}` : `Changed a row of ${table}`,\n http: (host, would) => (would ? `Would have called ${host}` : `Called ${host}`),\n files: \"Searched the files\",\n read: (file) => `Read ${file}`,\n wrote: (file, would) => (would ? `Would have saved ${file}` : `Saved ${file}`),\n listed: \"Looked through its files\",\n remember: (would) => (would ? \"Would have kept a memory\" : \"Kept a memory\"),\n recall: \"Searched what it learned\",\n },\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Automation, RunStep } from "./types.js";
|
|
2
|
+
import { CallMessages, Verb } from "./messages.js";
|
|
3
|
+
//#region src/automation/record.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* What a tool does, from its name (`GMAIL_SEND_EMAIL`, `Gmail.SendEmail`): the first of its
|
|
6
|
+
* words that says so; none, it only uses the app.
|
|
7
|
+
*/
|
|
8
|
+
export declare function verbOf(tool: string): Verb;
|
|
9
|
+
/** How a record names an app and a table: the app by its display name, the table by its title. */
|
|
10
|
+
export interface Names {
|
|
11
|
+
app: (alias: string) => string;
|
|
12
|
+
/** The app's logo, when the automation knows it. */
|
|
13
|
+
icon: (alias: string) => string | null;
|
|
14
|
+
table: (name: string) => string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The names an automation knows: its apps' (from its steps' uses and its event's trigger) and
|
|
18
|
+
* its board's table; anything else by its own name, in words.
|
|
19
|
+
*/
|
|
20
|
+
export declare function namingOf(automation: Pick<Automation, "steps" | "trigger" | "board"> | null): Names;
|
|
21
|
+
/** The app an app's tool call reached (`tool:gmail.GMAIL_SEND_EMAIL` is `gmail`); null for the rest. */
|
|
22
|
+
export declare function appOf(call: string): string | null;
|
|
23
|
+
/** One call of a run in words; a call the package doesn't know keeps its own name. */
|
|
24
|
+
export declare function callWords(step: RunStep, words: CallMessages, names: Names): string;
|
|
25
|
+
/** One line of a step: what was done, how many times in a row, and why it failed when it did. */
|
|
26
|
+
export interface CallLine {
|
|
27
|
+
/** The first call's place in the record. */
|
|
28
|
+
seq: number;
|
|
29
|
+
text: string;
|
|
30
|
+
count: number;
|
|
31
|
+
error: string | null;
|
|
32
|
+
would: boolean;
|
|
33
|
+
/** Every call the line stands for: their inputs and outputs, for whoever reads them. */
|
|
34
|
+
calls: RunStep[];
|
|
35
|
+
}
|
|
36
|
+
/** The calls made in one step, in their order; `step` null for those made outside any. */
|
|
37
|
+
export interface StepGroup {
|
|
38
|
+
step: string | null;
|
|
39
|
+
lines: CallLine[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A run's calls under the step each ran in, in the record's order: a new group each time the
|
|
43
|
+
* step changes, and in a group the same words in a row (none failed) as one line with a count.
|
|
44
|
+
*/
|
|
45
|
+
export declare function groupsOf(steps: readonly RunStep[], words: CallMessages, names: Names): StepGroup[];
|
|
46
|
+
//#endregion
|
|
47
|
+
//# sourceMappingURL=record.d.ts.map
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { toolName } from "../about.js";
|
|
2
|
+
//#region src/automation/record.ts
|
|
3
|
+
/**
|
|
4
|
+
* A run's record in words: each call as what it did ("Buscó en Gmail", "Añadió una fila a
|
|
5
|
+
* Citas"; a test's writes as what it would have done), gathered under the step it ran in, the same
|
|
6
|
+
* call made several times in a row said once with how many. Pure, so it is tested without a page.
|
|
7
|
+
*/
|
|
8
|
+
/** The words in a tool's name that say what it does, first match wins; the rest only use it. */
|
|
9
|
+
const VERBS = [
|
|
10
|
+
["send", /* @__PURE__ */ new Set([
|
|
11
|
+
"send",
|
|
12
|
+
"post",
|
|
13
|
+
"reply",
|
|
14
|
+
"forward",
|
|
15
|
+
"notify",
|
|
16
|
+
"publish"
|
|
17
|
+
])],
|
|
18
|
+
["remove", /* @__PURE__ */ new Set([
|
|
19
|
+
"delete",
|
|
20
|
+
"remove",
|
|
21
|
+
"trash",
|
|
22
|
+
"archive",
|
|
23
|
+
"cancel"
|
|
24
|
+
])],
|
|
25
|
+
["update", /* @__PURE__ */ new Set([
|
|
26
|
+
"update",
|
|
27
|
+
"edit",
|
|
28
|
+
"patch",
|
|
29
|
+
"modify",
|
|
30
|
+
"move",
|
|
31
|
+
"mark",
|
|
32
|
+
"set",
|
|
33
|
+
"rename"
|
|
34
|
+
])],
|
|
35
|
+
["create", /* @__PURE__ */ new Set([
|
|
36
|
+
"create",
|
|
37
|
+
"add",
|
|
38
|
+
"insert",
|
|
39
|
+
"new",
|
|
40
|
+
"upload",
|
|
41
|
+
"book",
|
|
42
|
+
"schedule",
|
|
43
|
+
"draft"
|
|
44
|
+
])],
|
|
45
|
+
["search", /* @__PURE__ */ new Set([
|
|
46
|
+
"search",
|
|
47
|
+
"fetch",
|
|
48
|
+
"list",
|
|
49
|
+
"get",
|
|
50
|
+
"find",
|
|
51
|
+
"read",
|
|
52
|
+
"query",
|
|
53
|
+
"retrieve",
|
|
54
|
+
"lookup"
|
|
55
|
+
])]
|
|
56
|
+
];
|
|
57
|
+
/**
|
|
58
|
+
* What a tool does, from its name (`GMAIL_SEND_EMAIL`, `Gmail.SendEmail`): the first of its
|
|
59
|
+
* words that says so; none, it only uses the app.
|
|
60
|
+
*/
|
|
61
|
+
function verbOf(tool) {
|
|
62
|
+
const words = tool.replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[^A-Za-z0-9]+/).map((word) => word.toLowerCase()).filter(Boolean);
|
|
63
|
+
for (const word of words) for (const [verb, names] of VERBS) if (names.has(word)) return verb;
|
|
64
|
+
return "use";
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The names an automation knows: its apps' (from its steps' uses and its event's trigger) and
|
|
68
|
+
* its board's table; anything else by its own name, in words.
|
|
69
|
+
*/
|
|
70
|
+
function namingOf(automation) {
|
|
71
|
+
const apps = /* @__PURE__ */ new Map();
|
|
72
|
+
const trigger = automation?.trigger;
|
|
73
|
+
if (trigger?.app && trigger.app_title) apps.set(trigger.app, {
|
|
74
|
+
title: trigger.app_title,
|
|
75
|
+
icon: trigger.icon
|
|
76
|
+
});
|
|
77
|
+
for (const step of automation?.steps ?? []) for (const use of step.uses) if (use.kind === "app" && use.app !== null && use.title !== null) apps.set(use.app, {
|
|
78
|
+
title: use.title,
|
|
79
|
+
icon: use.icon
|
|
80
|
+
});
|
|
81
|
+
const board = automation?.board ?? null;
|
|
82
|
+
return {
|
|
83
|
+
app: (alias) => apps.get(alias)?.title ?? toolName(alias),
|
|
84
|
+
icon: (alias) => apps.get(alias)?.icon ?? null,
|
|
85
|
+
table: (name) => board !== null && board.table === name ? board.title : toolName(name)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/** The app an app's tool call reached (`tool:gmail.GMAIL_SEND_EMAIL` is `gmail`); null for the rest. */
|
|
89
|
+
function appOf(call) {
|
|
90
|
+
if (!call.startsWith("tool:")) return null;
|
|
91
|
+
const target = call.slice(5);
|
|
92
|
+
const dot = target.indexOf(".");
|
|
93
|
+
return dot === -1 ? target : target.slice(0, dot);
|
|
94
|
+
}
|
|
95
|
+
const field = (value, name) => {
|
|
96
|
+
if (typeof value !== "object" || value === null || !(name in value)) return null;
|
|
97
|
+
const found = value[name];
|
|
98
|
+
return typeof found === "string" ? found : null;
|
|
99
|
+
};
|
|
100
|
+
function hostOf(url) {
|
|
101
|
+
if (url === null) return "";
|
|
102
|
+
try {
|
|
103
|
+
return new URL(url).host;
|
|
104
|
+
} catch {
|
|
105
|
+
return url;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The channel a `send` went out on: what the record says it reached (a test's stand-in names the
|
|
110
|
+
* one asked for), else the one asked for; null when neither says.
|
|
111
|
+
*/
|
|
112
|
+
function sentOn(step) {
|
|
113
|
+
return field(step.output, "channel") ?? field(step.input, "via");
|
|
114
|
+
}
|
|
115
|
+
/** Who a `send` went to, as words can say it: a number as it was given; a contact's id, "". */
|
|
116
|
+
const recipientOf = (contact) => contact === null || /^ctc_/.test(contact) ? "" : contact;
|
|
117
|
+
/** A file's name from its path, as a call names it; "" when the call didn't say. */
|
|
118
|
+
const nameOf = (path) => (path ?? "").slice((path ?? "").lastIndexOf("/") + 1);
|
|
119
|
+
/** One call of a run in words; a call the package doesn't know keeps its own name. */
|
|
120
|
+
function callWords(step, words, names) {
|
|
121
|
+
const { call, would } = step;
|
|
122
|
+
const app = appOf(call);
|
|
123
|
+
if (app !== null) return words.tool(verbOf(call.slice(5 + app.length + 1)), names.app(app), would);
|
|
124
|
+
const table = () => names.table(field(step.input, "table") ?? "");
|
|
125
|
+
switch (call) {
|
|
126
|
+
case "ai": return words.ai;
|
|
127
|
+
case "notify": return words.notify(would);
|
|
128
|
+
case "send": return words.send(sentOn(step), recipientOf(field(step.input, "contact")), would);
|
|
129
|
+
case "agent.start": return words.start(would);
|
|
130
|
+
case "data.find": return words.find(table());
|
|
131
|
+
case "data.add": return words.add(table(), would);
|
|
132
|
+
case "data.update": return words.change(table(), would);
|
|
133
|
+
case "http": return words.http(hostOf(field(step.input, "url")), would);
|
|
134
|
+
case "files.search": return words.files;
|
|
135
|
+
case "files.read": return words.read(nameOf(field(step.input, "path")));
|
|
136
|
+
case "files.write": return words.wrote(nameOf(field(step.input, "path")), would);
|
|
137
|
+
case "files.list": return words.listed;
|
|
138
|
+
case "memory.remember": return words.remember(would);
|
|
139
|
+
case "memory.recall": return words.recall;
|
|
140
|
+
default: return call;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A run's calls under the step each ran in, in the record's order: a new group each time the
|
|
145
|
+
* step changes, and in a group the same words in a row (none failed) as one line with a count.
|
|
146
|
+
*/
|
|
147
|
+
function groupsOf(steps, words, names) {
|
|
148
|
+
const groups = [];
|
|
149
|
+
for (const step of [...steps].sort((a, b) => a.seq - b.seq)) {
|
|
150
|
+
let group = groups[groups.length - 1];
|
|
151
|
+
if (group === void 0 || group.step !== step.step) {
|
|
152
|
+
group = {
|
|
153
|
+
step: step.step,
|
|
154
|
+
lines: []
|
|
155
|
+
};
|
|
156
|
+
groups.push(group);
|
|
157
|
+
}
|
|
158
|
+
const text = callWords(step, words, names);
|
|
159
|
+
const last = group.lines[group.lines.length - 1];
|
|
160
|
+
if (last !== void 0 && last.text === text && last.error === null && step.error === null) {
|
|
161
|
+
last.count += 1;
|
|
162
|
+
last.calls.push(step);
|
|
163
|
+
} else group.lines.push({
|
|
164
|
+
seq: step.seq,
|
|
165
|
+
text,
|
|
166
|
+
count: 1,
|
|
167
|
+
error: step.error,
|
|
168
|
+
would: step.would,
|
|
169
|
+
calls: [step]
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
return groups;
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
export { appOf, callWords, groupsOf, namingOf, sentOn, verbOf };
|
|
176
|
+
|
|
177
|
+
//# sourceMappingURL=record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record.js","names":[],"sources":["../../src/automation/record.ts"],"sourcesContent":["/**\n * A run's record in words: each call as what it did (\"Buscó en Gmail\", \"Añadió una fila a\n * Citas\"; a test's writes as what it would have done), gathered under the step it ran in, the same\n * call made several times in a row said once with how many. Pure, so it is tested without a page.\n */\n\nimport { toolName } from \"../about\";\nimport type { CallMessages, Verb } from \"./messages\";\nimport type { Automation, RunStep } from \"./types\";\n\n/** The words in a tool's name that say what it does, first match wins; the rest only use it. */\nconst VERBS: readonly (readonly [Verb, ReadonlySet<string>])[] = [\n [\"send\", new Set([\"send\", \"post\", \"reply\", \"forward\", \"notify\", \"publish\"])],\n [\"remove\", new Set([\"delete\", \"remove\", \"trash\", \"archive\", \"cancel\"])],\n [\"update\", new Set([\"update\", \"edit\", \"patch\", \"modify\", \"move\", \"mark\", \"set\", \"rename\"])],\n [\"create\", new Set([\"create\", \"add\", \"insert\", \"new\", \"upload\", \"book\", \"schedule\", \"draft\"])],\n [\n \"search\",\n new Set([\"search\", \"fetch\", \"list\", \"get\", \"find\", \"read\", \"query\", \"retrieve\", \"lookup\"]),\n ],\n];\n\n/**\n * What a tool does, from its name (`GMAIL_SEND_EMAIL`, `Gmail.SendEmail`): the first of its\n * words that says so; none, it only uses the app.\n */\nexport function verbOf(tool: string): Verb {\n const words = tool\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .split(/[^A-Za-z0-9]+/)\n .map((word) => word.toLowerCase())\n .filter(Boolean);\n for (const word of words) {\n for (const [verb, names] of VERBS) if (names.has(word)) return verb;\n }\n return \"use\";\n}\n\n/** How a record names an app and a table: the app by its display name, the table by its title. */\nexport interface Names {\n app: (alias: string) => string;\n /** The app's logo, when the automation knows it. */\n icon: (alias: string) => string | null;\n table: (name: string) => string;\n}\n\n/**\n * The names an automation knows: its apps' (from its steps' uses and its event's trigger) and\n * its board's table; anything else by its own name, in words.\n */\nexport function namingOf(\n automation: Pick<Automation, \"steps\" | \"trigger\" | \"board\"> | null,\n): Names {\n const apps = new Map<string, { title: string; icon: string | null }>();\n const trigger = automation?.trigger;\n if (trigger?.app && trigger.app_title) {\n apps.set(trigger.app, { title: trigger.app_title, icon: trigger.icon });\n }\n for (const step of automation?.steps ?? []) {\n for (const use of step.uses) {\n if (use.kind === \"app\" && use.app !== null && use.title !== null) {\n apps.set(use.app, { title: use.title, icon: use.icon });\n }\n }\n }\n const board = automation?.board ?? null;\n return {\n app: (alias) => apps.get(alias)?.title ?? toolName(alias),\n icon: (alias) => apps.get(alias)?.icon ?? null,\n table: (name) => (board !== null && board.table === name ? board.title : toolName(name)),\n };\n}\n\n/** The app an app's tool call reached (`tool:gmail.GMAIL_SEND_EMAIL` is `gmail`); null for the rest. */\nexport function appOf(call: string): string | null {\n if (!call.startsWith(\"tool:\")) return null;\n const target = call.slice(5);\n const dot = target.indexOf(\".\");\n return dot === -1 ? target : target.slice(0, dot);\n}\n\nconst field = (value: unknown, name: string): string | null => {\n if (typeof value !== \"object\" || value === null || !(name in value)) return null;\n const found: unknown = (value as Record<string, unknown>)[name];\n return typeof found === \"string\" ? found : null;\n};\n\nfunction hostOf(url: string | null): string {\n if (url === null) return \"\";\n try {\n return new URL(url).host;\n } catch {\n return url;\n }\n}\n\n/**\n * The channel a `send` went out on: what the record says it reached (a test's stand-in names the\n * one asked for), else the one asked for; null when neither says.\n */\nexport function sentOn(step: RunStep): string | null {\n return field(step.output, \"channel\") ?? field(step.input, \"via\");\n}\n\n/** Who a `send` went to, as words can say it: a number as it was given; a contact's id, \"\". */\nconst recipientOf = (contact: string | null): string =>\n contact === null || /^ctc_/.test(contact) ? \"\" : contact;\n\n/** A file's name from its path, as a call names it; \"\" when the call didn't say. */\nconst nameOf = (path: string | null): string =>\n (path ?? \"\").slice((path ?? \"\").lastIndexOf(\"/\") + 1);\n\n/** One call of a run in words; a call the package doesn't know keeps its own name. */\nexport function callWords(step: RunStep, words: CallMessages, names: Names): string {\n const { call, would } = step;\n const app = appOf(call);\n if (app !== null) {\n return words.tool(verbOf(call.slice(5 + app.length + 1)), names.app(app), would);\n }\n const table = () => names.table(field(step.input, \"table\") ?? \"\");\n switch (call) {\n case \"ai\":\n return words.ai;\n case \"notify\":\n return words.notify(would);\n case \"send\":\n return words.send(sentOn(step), recipientOf(field(step.input, \"contact\")), would);\n case \"agent.start\":\n return words.start(would);\n case \"data.find\":\n return words.find(table());\n case \"data.add\":\n return words.add(table(), would);\n case \"data.update\":\n return words.change(table(), would);\n case \"http\":\n return words.http(hostOf(field(step.input, \"url\")), would);\n case \"files.search\":\n return words.files;\n case \"files.read\":\n return words.read(nameOf(field(step.input, \"path\")));\n case \"files.write\":\n return words.wrote(nameOf(field(step.input, \"path\")), would);\n case \"files.list\":\n return words.listed;\n case \"memory.remember\":\n return words.remember(would);\n case \"memory.recall\":\n return words.recall;\n default:\n return call;\n }\n}\n\n/** One line of a step: what was done, how many times in a row, and why it failed when it did. */\nexport interface CallLine {\n /** The first call's place in the record. */\n seq: number;\n text: string;\n count: number;\n error: string | null;\n would: boolean;\n /** Every call the line stands for: their inputs and outputs, for whoever reads them. */\n calls: RunStep[];\n}\n\n/** The calls made in one step, in their order; `step` null for those made outside any. */\nexport interface StepGroup {\n step: string | null;\n lines: CallLine[];\n}\n\n/**\n * A run's calls under the step each ran in, in the record's order: a new group each time the\n * step changes, and in a group the same words in a row (none failed) as one line with a count.\n */\nexport function groupsOf(\n steps: readonly RunStep[],\n words: CallMessages,\n names: Names,\n): StepGroup[] {\n const groups: StepGroup[] = [];\n for (const step of [...steps].sort((a, b) => a.seq - b.seq)) {\n let group = groups[groups.length - 1];\n if (group === undefined || group.step !== step.step) {\n group = { step: step.step, lines: [] };\n groups.push(group);\n }\n const text = callWords(step, words, names);\n const last = group.lines[group.lines.length - 1];\n if (last !== undefined && last.text === text && last.error === null && step.error === null) {\n last.count += 1;\n last.calls.push(step);\n } else {\n group.lines.push({\n seq: step.seq,\n text,\n count: 1,\n error: step.error,\n would: step.would,\n calls: [step],\n });\n }\n }\n return groups;\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
//#region src/automation/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* An agent's automations and their runs, as the API gives them (v3/AUTOMATIONS.md): what starts
|
|
4
|
+
* each one, the steps its code names, the table it moves, and every run with its record. Written
|
|
5
|
+
* by hand, one to one with the API's answers; times are ISO 8601 in UTC.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* What a step uses, as the manifest reads it from the code before any run: an app, the model,
|
|
9
|
+
* the agent, the owner's inbox, a message to a contact on a channel (`sc.send`), a table, the web.
|
|
10
|
+
*/
|
|
11
|
+
export interface Use {
|
|
12
|
+
kind: "app" | "ai" | "agent" | "notify" | "send" | "data" | "http";
|
|
13
|
+
/** An app's: the connection's name (its alias). */
|
|
14
|
+
app: string | null;
|
|
15
|
+
/** An app's: its display name. */
|
|
16
|
+
title: string | null;
|
|
17
|
+
/** An app's: its logo (https), when known. */
|
|
18
|
+
icon: string | null;
|
|
19
|
+
}
|
|
20
|
+
/** A step of the code (`sc.step("…")`), in the code's order, with what it uses. */
|
|
21
|
+
export interface Step {
|
|
22
|
+
name: string;
|
|
23
|
+
uses: Use[];
|
|
24
|
+
}
|
|
25
|
+
/** What starts an automation: a time (cron, on a zone's clock), a call to its URL, an app's event. */
|
|
26
|
+
export interface Trigger {
|
|
27
|
+
kind: "schedule" | "webhook" | "event";
|
|
28
|
+
/** Five-field cron. */
|
|
29
|
+
schedule: string | null;
|
|
30
|
+
/** IANA zone. */
|
|
31
|
+
timezone: string | null;
|
|
32
|
+
/** The webhook's full URL. */
|
|
33
|
+
url: string | null;
|
|
34
|
+
/** An event's app: the connection's name, its display name, its logo. */
|
|
35
|
+
app: string | null;
|
|
36
|
+
app_title: string | null;
|
|
37
|
+
/** The provider's event slug, and the event in words when the provider gives them. */
|
|
38
|
+
event: string | null;
|
|
39
|
+
event_title: string | null;
|
|
40
|
+
icon: string | null;
|
|
41
|
+
}
|
|
42
|
+
/** The table an automation moves, as counts of its rows per value of one field. */
|
|
43
|
+
export interface Board {
|
|
44
|
+
table: string;
|
|
45
|
+
/** The table's title. */
|
|
46
|
+
title: string;
|
|
47
|
+
/** The field the rows are counted by. */
|
|
48
|
+
field: string;
|
|
49
|
+
/** Per value, biggest first, at most 8. */
|
|
50
|
+
counts: {
|
|
51
|
+
value: string;
|
|
52
|
+
count: number;
|
|
53
|
+
}[];
|
|
54
|
+
}
|
|
55
|
+
export type RunStatus = "running" | "waiting" | "done" | "failed" | "skipped";
|
|
56
|
+
/** What started a run: its time, a call, an app's event, the agent in a chat, a test. */
|
|
57
|
+
export type RunBy = "schedule" | "webhook" | "event" | "agent" | "test";
|
|
58
|
+
/** One start of an automation, whatever started it. */
|
|
59
|
+
export interface Run {
|
|
60
|
+
id: string;
|
|
61
|
+
agent_id: string;
|
|
62
|
+
/** The automation's name. */
|
|
63
|
+
automation: string;
|
|
64
|
+
/** The automation's title when it ran. */
|
|
65
|
+
title: string;
|
|
66
|
+
by: RunBy;
|
|
67
|
+
/** Started by the agent: the conversation it was asked in. */
|
|
68
|
+
conversation_id: string | null;
|
|
69
|
+
status: RunStatus;
|
|
70
|
+
/** What the code returned: the run's one line. */
|
|
71
|
+
summary: string | null;
|
|
72
|
+
/** Why it failed, in words, naming the step: "Paró en «…»: …". */
|
|
73
|
+
error: string | null;
|
|
74
|
+
/** A test: what would change the world was recorded, not done. */
|
|
75
|
+
dry: boolean;
|
|
76
|
+
started_at: string;
|
|
77
|
+
ended_at: string | null;
|
|
78
|
+
tokens_in: number;
|
|
79
|
+
tokens_out: number;
|
|
80
|
+
/** The conversations it opened. */
|
|
81
|
+
opened: string[];
|
|
82
|
+
}
|
|
83
|
+
/** One call of a run's record, in the order it was made. */
|
|
84
|
+
export interface RunStep {
|
|
85
|
+
seq: number;
|
|
86
|
+
/** The `sc.step` it ran in. */
|
|
87
|
+
step: string | null;
|
|
88
|
+
/**
|
|
89
|
+
* `tool:<app>.<TOOL>` · `ai` · `notify` · `send` · `agent.start` · `data.find` · `data.add` ·
|
|
90
|
+
* `data.update` · `http` · `files.search` · `memory.remember` · `memory.recall`.
|
|
91
|
+
*/
|
|
92
|
+
call: string;
|
|
93
|
+
/** Both trimmed. */
|
|
94
|
+
input: unknown;
|
|
95
|
+
output: unknown;
|
|
96
|
+
error: string | null;
|
|
97
|
+
ms: number;
|
|
98
|
+
at: string;
|
|
99
|
+
/** A test's write: recorded, not done. */
|
|
100
|
+
would: boolean;
|
|
101
|
+
}
|
|
102
|
+
/** A run with its record (`GET /runs/{id}`). */
|
|
103
|
+
export type RunRecord = Run & {
|
|
104
|
+
steps: RunStep[];
|
|
105
|
+
};
|
|
106
|
+
export type AutomationState = "active" | "paused" | "failing";
|
|
107
|
+
/** One automation: `automations/<name>.py` in the agent's folder, with its trigger and its state. */
|
|
108
|
+
export interface Automation {
|
|
109
|
+
/** Its trigger's id. */
|
|
110
|
+
id: string;
|
|
111
|
+
agent_id: string;
|
|
112
|
+
/** Its file's name; unique per agent. */
|
|
113
|
+
name: string;
|
|
114
|
+
title: string;
|
|
115
|
+
/** What it does, in the owner's words. */
|
|
116
|
+
summary: string;
|
|
117
|
+
trigger: Trigger;
|
|
118
|
+
on: boolean;
|
|
119
|
+
next_run_at: string | null;
|
|
120
|
+
steps: Step[];
|
|
121
|
+
board: Board | null;
|
|
122
|
+
/** `failing`: its last finished real run failed. */
|
|
123
|
+
state: AutomationState;
|
|
124
|
+
/** Its newest run, tests included. */
|
|
125
|
+
last_run: Run | null;
|
|
126
|
+
}
|
|
127
|
+
/** An automation with its newest runs (`GET /agents/{id}/automations/{name}`: 20; in a block: 5). */
|
|
128
|
+
export type AutomationView = Automation & {
|
|
129
|
+
runs: Run[];
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* A task the agent runs for one contact (`GET /agents/{id}/tasks`): set up in words in a
|
|
133
|
+
* conversation with them, read as an automation is (its instruction is its `summary`, its trigger
|
|
134
|
+
* a schedule: a cron line, or none for a task once at `next_run_at`), with its newest five runs.
|
|
135
|
+
*/
|
|
136
|
+
export type Task = AutomationView & {
|
|
137
|
+
contact_id: string;
|
|
138
|
+
/** The conversation it runs in: the one it was set up in. */
|
|
139
|
+
conversation_id: string | null;
|
|
140
|
+
created_at: string;
|
|
141
|
+
};
|
|
142
|
+
//#endregion
|
|
143
|
+
//# sourceMappingURL=types.d.ts.map
|