@antelopejs/dms-ai 0.1.5 → 0.2.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 +54 -11
- package/dist/channels/bridge.d.ts +6 -1
- package/dist/channels/bridge.js +29 -1
- package/dist/channels/bridge.js.map +1 -1
- package/dist/channels/channel-service.d.ts +2 -1
- package/dist/channels/channel-service.js +3 -2
- package/dist/channels/channel-service.js.map +1 -1
- package/dist/channels/sse-stream.d.ts +3 -2
- package/dist/config.d.ts +0 -2
- package/dist/config.js +0 -7
- package/dist/config.js.map +1 -1
- package/dist/constants/http.d.ts +9 -0
- package/dist/constants/http.js +14 -0
- package/dist/constants/http.js.map +1 -0
- package/dist/constants/i18n.d.ts +11 -0
- package/dist/constants/i18n.js +15 -0
- package/dist/constants/i18n.js.map +1 -0
- package/dist/constants/pages.d.ts +50 -0
- package/dist/constants/pages.js +58 -0
- package/dist/constants/pages.js.map +1 -0
- package/dist/constants/sidecar.d.ts +3 -1
- package/dist/constants/sidecar.js +4 -2
- package/dist/constants/sidecar.js.map +1 -1
- package/dist/index.js +0 -8
- package/dist/index.js.map +1 -1
- package/dist/lifecycle/sidecar-owner.d.ts +14 -0
- package/dist/lifecycle/sidecar-owner.js +102 -0
- package/dist/lifecycle/sidecar-owner.js.map +1 -0
- package/dist/lifecycle/spawn-sidecar.d.ts +1 -0
- package/dist/lifecycle/spawn-sidecar.js +59 -145
- package/dist/lifecycle/spawn-sidecar.js.map +1 -1
- package/dist/lifecycle/terminate-process.d.ts +1 -0
- package/dist/lifecycle/terminate-process.js +34 -0
- package/dist/lifecycle/terminate-process.js.map +1 -0
- package/dist/logging/log-buffer.d.ts +0 -6
- package/dist/logging/log-buffer.js +0 -1
- package/dist/logging/log-buffer.js.map +1 -1
- package/dist/pages/activity/columns.d.ts +2 -0
- package/dist/pages/activity/columns.js +103 -0
- package/dist/pages/activity/columns.js.map +1 -0
- package/dist/pages/activity/page.d.ts +1 -2
- package/dist/pages/activity/page.js +79 -44
- package/dist/pages/activity/page.js.map +1 -1
- package/dist/pages/all.d.ts +1 -0
- package/dist/pages/all.js +1 -0
- package/dist/pages/all.js.map +1 -1
- package/dist/pages/changes/page.d.ts +9 -0
- package/dist/pages/changes/page.js +22 -0
- package/dist/pages/changes/page.js.map +1 -0
- package/dist/pages/meta.d.ts +9 -0
- package/dist/pages/meta.js +31 -0
- package/dist/pages/meta.js.map +1 -0
- package/dist/pages/module.js +9 -5
- package/dist/pages/module.js.map +1 -1
- package/dist/pages/overview/insights.d.ts +3 -0
- package/dist/pages/overview/insights.js +77 -0
- package/dist/pages/overview/insights.js.map +1 -0
- package/dist/pages/overview/kpis.d.ts +2 -0
- package/dist/pages/overview/kpis.js +39 -0
- package/dist/pages/overview/kpis.js.map +1 -0
- package/dist/pages/overview/page.d.ts +6 -3
- package/dist/pages/overview/page.js +19 -62
- package/dist/pages/overview/page.js.map +1 -1
- package/dist/pages/overview/recent-changes.d.ts +2 -0
- package/dist/pages/overview/recent-changes.js +144 -0
- package/dist/pages/overview/recent-changes.js.map +1 -0
- package/dist/pages/overview/status.d.ts +3 -0
- package/dist/pages/overview/status.js +36 -0
- package/dist/pages/overview/status.js.map +1 -0
- package/dist/pages/settings/availability.d.ts +2 -0
- package/dist/pages/settings/availability.js +46 -0
- package/dist/pages/settings/availability.js.map +1 -0
- package/dist/pages/settings/options.d.ts +10 -0
- package/dist/pages/settings/options.js +58 -0
- package/dist/pages/settings/options.js.map +1 -0
- package/dist/pages/settings/page.d.ts +2 -1
- package/dist/pages/settings/page.js +39 -13
- package/dist/pages/settings/page.js.map +1 -1
- package/dist/pages/settings/sections.d.ts +2 -0
- package/dist/pages/settings/sections.js +164 -0
- package/dist/pages/settings/sections.js.map +1 -0
- package/dist/pages/skills/page.d.ts +2 -1
- package/dist/pages/skills/page.js +122 -12
- package/dist/pages/skills/page.js.map +1 -1
- package/dist/routes/activity-csv.d.ts +2 -0
- package/dist/routes/activity-csv.js +42 -0
- package/dist/routes/activity-csv.js.map +1 -0
- package/dist/routes/activity.d.ts +8 -0
- package/dist/routes/activity.js +105 -0
- package/dist/routes/activity.js.map +1 -0
- package/dist/routes/actor.d.ts +2 -0
- package/dist/routes/actor.js +8 -0
- package/dist/routes/actor.js.map +1 -0
- package/dist/routes/banner.d.ts +3 -0
- package/dist/routes/banner.js +9 -0
- package/dist/routes/banner.js.map +1 -0
- package/dist/routes/builder.js +1 -5
- package/dist/routes/builder.js.map +1 -1
- package/dist/routes/changes.d.ts +17 -0
- package/dist/routes/changes.js +152 -0
- package/dist/routes/changes.js.map +1 -0
- package/dist/routes/channels.js +2 -1
- package/dist/routes/channels.js.map +1 -1
- package/dist/routes/index.d.ts +3 -0
- package/dist/routes/index.js +3 -0
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/list-query.d.ts +9 -0
- package/dist/routes/list-query.js +34 -0
- package/dist/routes/list-query.js.map +1 -0
- package/dist/routes/metric-shapes.d.ts +8 -0
- package/dist/routes/metric-shapes.js +107 -0
- package/dist/routes/metric-shapes.js.map +1 -0
- package/dist/routes/metrics.d.ts +5 -48
- package/dist/routes/metrics.js +52 -42
- package/dist/routes/metrics.js.map +1 -1
- package/dist/routes/settings.d.ts +3 -16
- package/dist/routes/settings.js +40 -14
- package/dist/routes/settings.js.map +1 -1
- package/dist/routes/sidecar-results.d.ts +6 -0
- package/dist/routes/sidecar-results.js +44 -0
- package/dist/routes/sidecar-results.js.map +1 -0
- package/dist/routes/skills.d.ts +4 -14
- package/dist/routes/skills.js +91 -6
- package/dist/routes/skills.js.map +1 -1
- package/dist/routes/status-shapes.d.ts +5 -0
- package/dist/routes/status-shapes.js +176 -0
- package/dist/routes/status-shapes.js.map +1 -0
- package/dist/routes/status.d.ts +9 -0
- package/dist/routes/status.js +92 -0
- package/dist/routes/status.js.map +1 -0
- package/dist/routes/undo-confirm.d.ts +3 -0
- package/dist/routes/undo-confirm.js +51 -0
- package/dist/routes/undo-confirm.js.map +1 -0
- package/dist/sidecar/http-client.d.ts +11 -0
- package/dist/sidecar/http-client.js +59 -0
- package/dist/sidecar/http-client.js.map +1 -0
- package/dist/sidecar/index.d.ts +2 -0
- package/dist/sidecar/index.js +19 -0
- package/dist/sidecar/index.js.map +1 -0
- package/dist/sidecar/query.d.ts +3 -0
- package/dist/sidecar/query.js +25 -0
- package/dist/sidecar/query.js.map +1 -0
- package/dist/types/activity.d.ts +31 -0
- package/dist/types/activity.js +3 -0
- package/dist/types/activity.js.map +1 -0
- package/dist/types/changes.d.ts +45 -0
- package/dist/types/changes.js +3 -0
- package/dist/types/changes.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/metrics.d.ts +76 -0
- package/dist/types/metrics.js +3 -0
- package/dist/types/metrics.js.map +1 -0
- package/dist/types/skills.d.ts +51 -0
- package/dist/types/skills.js +3 -0
- package/dist/types/skills.js.map +1 -0
- package/dist/types/status.d.ts +16 -0
- package/dist/types/status.js +3 -0
- package/dist/types/status.js.map +1 -0
- package/dist/vocabulary/enumerations.d.ts +9 -0
- package/dist/vocabulary/enumerations.js +52 -0
- package/dist/vocabulary/enumerations.js.map +1 -0
- package/dist/vocabulary/index.d.ts +5 -0
- package/dist/vocabulary/index.js +22 -0
- package/dist/vocabulary/index.js.map +1 -0
- package/dist/vocabulary/keys.d.ts +1 -0
- package/dist/vocabulary/keys.js +8 -0
- package/dist/vocabulary/keys.js.map +1 -0
- package/dist/vocabulary/options.d.ts +7 -0
- package/dist/vocabulary/options.js +33 -0
- package/dist/vocabulary/options.js.map +1 -0
- package/dist/vocabulary/tools.d.ts +7 -0
- package/dist/vocabulary/tools.js +99 -0
- package/dist/vocabulary/tools.js.map +1 -0
- package/dist/vocabulary/types.d.ts +20 -0
- package/dist/vocabulary/types.js +3 -0
- package/dist/vocabulary/types.js.map +1 -0
- package/frontend-vue/app/chat/components/AnswerRecord.vue +95 -0
- package/frontend-vue/app/chat/components/ApprovalDock.vue +371 -0
- package/frontend-vue/app/chat/components/ChangeSetCard.vue +297 -0
- package/frontend-vue/app/chat/components/ChatEmpty.vue +142 -0
- package/frontend-vue/app/chat/components/ChatView.vue +664 -406
- package/frontend-vue/app/chat/components/Composer.vue +589 -0
- package/frontend-vue/app/chat/components/ConnectionBanner.vue +41 -65
- package/frontend-vue/app/chat/components/ConversationDrawer.vue +387 -177
- package/frontend-vue/app/chat/components/DiffView.vue +131 -0
- package/frontend-vue/app/chat/components/FullAutoBanner.vue +76 -0
- package/frontend-vue/app/chat/components/FullAutoDialog.vue +103 -0
- package/frontend-vue/app/chat/components/MarkdownContent.vue +15 -15
- package/frontend-vue/app/chat/components/MessageList.vue +389 -295
- package/frontend-vue/app/chat/components/NoticeCard.vue +193 -0
- package/frontend-vue/app/chat/components/PanelHeader.vue +242 -0
- package/frontend-vue/app/chat/components/PermissionCard.vue +470 -0
- package/frontend-vue/app/chat/components/PlanCard.vue +115 -0
- package/frontend-vue/app/chat/components/QuestionDock.vue +407 -0
- package/frontend-vue/app/chat/components/QueueDock.vue +310 -0
- package/frontend-vue/app/chat/components/RulesList.vue +97 -0
- package/frontend-vue/app/chat/components/StepsDock.vue +181 -0
- package/frontend-vue/app/chat/components/ToolCluster.vue +186 -178
- package/frontend-vue/app/chat/components/ToolRow.vue +251 -0
- package/frontend-vue/app/chat/components/TurnErrorCard.vue +135 -0
- package/frontend-vue/app/chat/composables/conversation-events.ts +404 -0
- package/frontend-vue/app/chat/composables/useChangeSetActions.ts +135 -0
- package/frontend-vue/app/chat/composables/useChatChannel.ts +11 -3
- package/frontend-vue/app/chat/composables/useChatI18n.ts +35 -0
- package/frontend-vue/app/chat/composables/useComposerAttachments.ts +111 -0
- package/frontend-vue/app/chat/composables/useConversation.ts +149 -651
- package/frontend-vue/app/chat/composables/useConversationId.ts +2 -10
- package/frontend-vue/app/chat/composables/useConversationList.ts +77 -21
- package/frontend-vue/app/chat/composables/useConversationMode.ts +73 -0
- package/frontend-vue/app/chat/composables/usePaletteTurn.ts +124 -0
- package/frontend-vue/app/chat/composables/usePermissionQueue.ts +211 -34
- package/frontend-vue/app/chat/composables/useQuestionQueue.ts +103 -21
- package/frontend-vue/app/chat/composables/useQueueActions.ts +55 -0
- package/frontend-vue/app/chat/composables/useSettings.ts +17 -34
- package/frontend-vue/app/chat/constants/attachments.ts +2 -1
- package/frontend-vue/app/chat/constants/conversation.ts +18 -32
- package/frontend-vue/app/chat/constants/protocol.ts +25 -2
- package/frontend-vue/app/chat/constants/run-status.ts +8 -14
- package/frontend-vue/app/chat/constants/settings.ts +5 -47
- package/frontend-vue/app/chat/types/conversation.ts +72 -2
- package/frontend-vue/app/chat/types/permission.ts +31 -0
- package/frontend-vue/app/chat/types/protocol.ts +226 -0
- package/frontend-vue/app/chat/types/question.ts +10 -1
- package/frontend-vue/app/chat/types/settings.ts +9 -5
- package/frontend-vue/app/chat/utils/approval-keyboard.ts +49 -0
- package/frontend-vue/app/chat/utils/arrays.ts +10 -0
- package/frontend-vue/app/chat/utils/conversation-groups.ts +96 -0
- package/frontend-vue/app/chat/utils/conversation-messages.ts +251 -0
- package/frontend-vue/app/chat/utils/diff.ts +78 -0
- package/frontend-vue/app/chat/utils/format.ts +43 -0
- package/frontend-vue/app/chat/utils/markdown.ts +1 -1
- package/frontend-vue/app/chat/utils/permission-view.ts +159 -0
- package/frontend-vue/app/chat/utils/platform.ts +34 -0
- package/frontend-vue/app/chat/utils/queue.ts +18 -0
- package/frontend-vue/app/chat/utils/render-items.ts +164 -0
- package/frontend-vue/app/chat/utils/run-status.ts +19 -23
- package/frontend-vue/app/chat/utils/suggestions.ts +101 -0
- package/frontend-vue/app/chat/utils/todos.ts +2 -2
- package/frontend-vue/app/chat/utils/tool-lexicon.ts +540 -0
- package/frontend-vue/app/chat/utils/tool-state.ts +60 -0
- package/frontend-vue/app/components/ActivityDetail.vue +235 -0
- package/frontend-vue/app/components/ChangesView.vue +249 -0
- package/frontend-vue/app/components/ChatPanel.vue +141 -196
- package/frontend-vue/app/components/PaletteAnswer.vue +185 -0
- package/frontend-vue/app/components/SkillCard.vue +77 -0
- package/frontend-vue/app/components/SkillDetail.vue +188 -0
- package/frontend-vue/app/plugins/ai.client.ts +349 -57
- package/frontend-vue/app/plugins/side-panel.ts +13 -0
- package/frontend-vue/app/runtime/assistant-activity.ts +105 -0
- package/frontend-vue/app/runtime/assistant-commands.ts +210 -0
- package/frontend-vue/app/runtime/assistant-notifications.ts +181 -0
- package/frontend-vue/app/runtime/assistant-session.ts +49 -6
- package/frontend-vue/app/runtime/channel-client.ts +3 -6
- package/frontend-vue/app/runtime/constants.ts +29 -35
- package/frontend-vue/app/runtime/host-commands.ts +4 -4
- package/frontend-vue/app/runtime/listeners.ts +1 -1
- package/frontend-vue/app/runtime/navigation-complete.ts +1 -1
- package/frontend-vue/app/runtime/panel-intents.ts +55 -0
- package/frontend-vue/app/runtime/shortcuts.ts +3 -1
- package/frontend-vue/app/runtime/sidecar-status.ts +9 -1
- package/frontend-vue/app/runtime/stream-holds.ts +24 -0
- package/frontend-vue/app/views/ChangeSetPanel.vue +222 -0
- package/frontend-vue/app/views/DecisionLabel.vue +30 -0
- package/frontend-vue/app/views/DiffView.vue +215 -0
- package/frontend-vue/app/views/ResultPill.vue +32 -0
- package/frontend-vue/app/views/RowStepper.vue +48 -0
- package/frontend-vue/app/views/UnavailableState.vue +66 -0
- package/frontend-vue/app/views/composables/useAiRequest.ts +89 -0
- package/frontend-vue/app/views/composables/useAssistant.ts +33 -0
- package/frontend-vue/app/views/composables/useChangeSetActions.ts +102 -0
- package/frontend-vue/app/views/composables/useViewFormat.ts +55 -0
- package/frontend-vue/app/views/constants.ts +43 -0
- package/frontend-vue/app/views/types.ts +189 -0
- package/frontend-vue/app/views/utils/activity.ts +77 -0
- package/frontend-vue/app/views/utils/change-sets.ts +44 -0
- package/frontend-vue/app/views/utils/diff.ts +98 -0
- package/frontend-vue/app/views/utils/moment.ts +92 -0
- package/frontend-vue/app/views/utils/skills.ts +27 -0
- package/frontend-vue/app/views/utils/tools.ts +73 -0
- package/frontend-vue/dms.frontend.ts +17 -5
- package/frontend-vue/i18n/locales/dms-ai-pages-en-GB.json +607 -0
- package/frontend-vue/i18n/locales/dms-ai-pages-fr-FR.json +607 -0
- package/frontend-vue/i18n/locales/dms-ai-panel-en-GB.json +425 -0
- package/frontend-vue/i18n/locales/dms-ai-panel-fr-FR.json +425 -0
- package/frontend-vue/i18n/locales/dms-ai-views-en-GB.json +142 -0
- package/frontend-vue/i18n/locales/dms-ai-views-fr-FR.json +142 -0
- package/frontend-vue/package.json +1 -1
- package/frontend-vue/tests/chat/conversation-events.test.ts +590 -0
- package/frontend-vue/tests/chat/diff-and-keys.test.ts +178 -0
- package/frontend-vue/tests/chat/tool-lexicon.test.ts +188 -0
- package/frontend-vue/tests/chat/useConversation.test.ts +36 -33
- package/frontend-vue/tests/chat-panel.test.ts +78 -131
- package/frontend-vue/tests/i18n-panel.test.ts +118 -0
- package/frontend-vue/tests/palette-assistant.test.ts +220 -0
- package/frontend-vue/tests/panel-states.test.ts +806 -0
- package/frontend-vue/tests/sidecar-guest.test.ts +35 -3
- package/frontend-vue/tests/support/i18n.ts +49 -0
- package/frontend-vue/tests/support/panel-harness.ts +198 -0
- package/frontend-vue/tests/support/stubs.ts +201 -0
- package/frontend-vue/tests/views/diff-view.test.ts +149 -0
- package/frontend-vue/tests/views/view-format.test.ts +59 -0
- package/package.json +5 -3
- package/sidecar/dist/agent/attachment-files.d.ts +0 -1
- package/sidecar/dist/agent/attachment-files.js +1 -1
- package/sidecar/dist/agent/attachment-files.js.map +1 -1
- package/sidecar/dist/agent/call-ledger.d.ts +6 -0
- package/sidecar/dist/agent/call-ledger.js +41 -0
- package/sidecar/dist/agent/call-ledger.js.map +1 -0
- package/sidecar/dist/agent/command-analysis.d.ts +9 -0
- package/sidecar/dist/agent/command-analysis.js +104 -0
- package/sidecar/dist/agent/command-analysis.js.map +1 -0
- package/sidecar/dist/agent/conversation-modes.d.ts +32 -0
- package/sidecar/dist/agent/conversation-modes.js +122 -0
- package/sidecar/dist/agent/conversation-modes.js.map +1 -0
- package/sidecar/dist/agent/edit-targets.d.ts +5 -0
- package/sidecar/dist/agent/edit-targets.js +41 -0
- package/sidecar/dist/agent/edit-targets.js.map +1 -0
- package/sidecar/dist/agent/effective-mode.d.ts +9 -2
- package/sidecar/dist/agent/effective-mode.js +14 -16
- package/sidecar/dist/agent/effective-mode.js.map +1 -1
- package/sidecar/dist/agent/host-context.js +2 -2
- package/sidecar/dist/agent/host-context.js.map +1 -1
- package/sidecar/dist/agent/line-diff.d.ts +8 -0
- package/sidecar/dist/agent/line-diff.js +204 -0
- package/sidecar/dist/agent/line-diff.js.map +1 -0
- package/sidecar/dist/agent/permission-bus.d.ts +55 -10
- package/sidecar/dist/agent/permission-bus.js +130 -100
- package/sidecar/dist/agent/permission-bus.js.map +1 -1
- package/sidecar/dist/agent/permission-preview.d.ts +20 -0
- package/sidecar/dist/agent/permission-preview.js +203 -0
- package/sidecar/dist/agent/permission-preview.js.map +1 -0
- package/sidecar/dist/agent/permission-rules.d.ts +17 -0
- package/sidecar/dist/agent/permission-rules.js +95 -0
- package/sidecar/dist/agent/permission-rules.js.map +1 -0
- package/sidecar/dist/agent/provider.d.ts +12 -4
- package/sidecar/dist/agent/question-bus.d.ts +14 -2
- package/sidecar/dist/agent/question-bus.js +30 -11
- package/sidecar/dist/agent/question-bus.js.map +1 -1
- package/sidecar/dist/agent/runner-events.d.ts +3 -1
- package/sidecar/dist/agent/runner.d.ts +6 -4
- package/sidecar/dist/agent/runner.js +24 -7
- package/sidecar/dist/agent/runner.js.map +1 -1
- package/sidecar/dist/agent/switching-runner.js +1 -0
- package/sidecar/dist/agent/switching-runner.js.map +1 -1
- package/sidecar/dist/agent/tool-kinds.d.ts +12 -0
- package/sidecar/dist/agent/tool-kinds.js +50 -0
- package/sidecar/dist/agent/tool-kinds.js.map +1 -0
- package/sidecar/dist/agent/typecheck.d.ts +2 -6
- package/sidecar/dist/audit/activity-query.d.ts +37 -0
- package/sidecar/dist/audit/activity-query.js +111 -0
- package/sidecar/dist/audit/activity-query.js.map +1 -0
- package/sidecar/dist/audit/activity-target.d.ts +2 -0
- package/sidecar/dist/audit/activity-target.js +46 -0
- package/sidecar/dist/audit/activity-target.js.map +1 -0
- package/sidecar/dist/audit/activity.d.ts +45 -0
- package/sidecar/dist/audit/activity.js +255 -0
- package/sidecar/dist/audit/activity.js.map +1 -0
- package/sidecar/dist/audit/call-audit.d.ts +11 -0
- package/sidecar/dist/audit/call-audit.js +23 -0
- package/sidecar/dist/audit/call-audit.js.map +1 -0
- package/sidecar/dist/checkpoints/checkpoints.d.ts +69 -0
- package/sidecar/dist/checkpoints/checkpoints.js +244 -0
- package/sidecar/dist/checkpoints/checkpoints.js.map +1 -0
- package/sidecar/dist/checkpoints/shadow-git.d.ts +23 -0
- package/sidecar/dist/checkpoints/shadow-git.js +173 -0
- package/sidecar/dist/checkpoints/shadow-git.js.map +1 -0
- package/sidecar/dist/constants/agent.d.ts +2 -0
- package/sidecar/dist/constants/agent.js +4 -0
- package/sidecar/dist/constants/agent.js.map +1 -1
- package/sidecar/dist/constants/audit.d.ts +22 -0
- package/sidecar/dist/constants/audit.js +49 -0
- package/sidecar/dist/constants/audit.js.map +1 -0
- package/sidecar/dist/constants/builder.d.ts +3 -0
- package/sidecar/dist/constants/builder.js +2 -0
- package/sidecar/dist/constants/builder.js.map +1 -1
- package/sidecar/dist/constants/checkpoints.d.ts +15 -0
- package/sidecar/dist/constants/checkpoints.js +26 -0
- package/sidecar/dist/constants/checkpoints.js.map +1 -0
- package/sidecar/dist/constants/claude.d.ts +1 -0
- package/sidecar/dist/constants/claude.js +1 -0
- package/sidecar/dist/constants/claude.js.map +1 -1
- package/sidecar/dist/constants/codex.d.ts +2 -4
- package/sidecar/dist/constants/codex.js +2 -4
- package/sidecar/dist/constants/codex.js.map +1 -1
- package/sidecar/dist/constants/http.d.ts +1 -0
- package/sidecar/dist/constants/http.js +1 -0
- package/sidecar/dist/constants/http.js.map +1 -1
- package/sidecar/dist/constants/mcp.d.ts +3 -0
- package/sidecar/dist/constants/mcp.js +9 -0
- package/sidecar/dist/constants/mcp.js.map +1 -1
- package/sidecar/dist/constants/permissions.d.ts +9 -3
- package/sidecar/dist/constants/permissions.js +9 -2
- package/sidecar/dist/constants/permissions.js.map +1 -1
- package/sidecar/dist/constants/settings.d.ts +2 -1
- package/sidecar/dist/constants/settings.js +7 -1
- package/sidecar/dist/constants/settings.js.map +1 -1
- package/sidecar/dist/constants/tool-kinds.d.ts +14 -0
- package/sidecar/dist/constants/tool-kinds.js +65 -0
- package/sidecar/dist/constants/tool-kinds.js.map +1 -0
- package/sidecar/dist/index.d.ts +4 -0
- package/sidecar/dist/index.js +35 -5
- package/sidecar/dist/index.js.map +1 -1
- package/sidecar/dist/mcp/define-tool.d.ts +3 -2
- package/sidecar/dist/mcp/tool-definitions.js +4 -1
- package/sidecar/dist/mcp/tool-definitions.js.map +1 -1
- package/sidecar/dist/mcp/tools/ask-user.d.ts +2 -2
- package/sidecar/dist/mcp/tools/ask-user.js +7 -4
- package/sidecar/dist/mcp/tools/ask-user.js.map +1 -1
- package/sidecar/dist/mcp/tools/builder-catalog.d.ts +3 -0
- package/sidecar/dist/mcp/tools/builder-catalog.js +86 -0
- package/sidecar/dist/mcp/tools/builder-catalog.js.map +1 -0
- package/sidecar/dist/mcp/tools/builder-gate.d.ts +8 -0
- package/sidecar/dist/mcp/tools/builder-gate.js +22 -0
- package/sidecar/dist/mcp/tools/builder-gate.js.map +1 -0
- package/sidecar/dist/mcp/tools/builder.d.ts +7 -2
- package/sidecar/dist/mcp/tools/builder.js +48 -7
- package/sidecar/dist/mcp/tools/builder.js.map +1 -1
- package/sidecar/dist/mcp/types.d.ts +2 -0
- package/sidecar/dist/metrics/aggregate.d.ts +13 -10
- package/sidecar/dist/metrics/aggregate.js +140 -143
- package/sidecar/dist/metrics/aggregate.js.map +1 -1
- package/sidecar/dist/metrics/types.d.ts +36 -23
- package/sidecar/dist/metrics/types.js +3 -1
- package/sidecar/dist/metrics/types.js.map +1 -1
- package/sidecar/dist/pages/imports-scanner.d.ts +1 -1
- package/sidecar/dist/pages/imports-scanner.js +2 -5
- package/sidecar/dist/pages/imports-scanner.js.map +1 -1
- package/sidecar/dist/prompts/agent.d.ts +1 -3
- package/sidecar/dist/prompts/agent.js +4 -4
- package/sidecar/dist/prompts/agent.js.map +1 -1
- package/sidecar/dist/prompts/builder.d.ts +2 -2
- package/sidecar/dist/prompts/builder.js +2 -2
- package/sidecar/dist/protocol/events.d.ts +1084 -18
- package/sidecar/dist/protocol/events.js +239 -5
- package/sidecar/dist/protocol/events.js.map +1 -1
- package/sidecar/dist/protocol/messages.d.ts +273 -19
- package/sidecar/dist/protocol/messages.js +107 -7
- package/sidecar/dist/protocol/messages.js.map +1 -1
- package/sidecar/dist/providers/claude/config.d.ts +3 -2
- package/sidecar/dist/providers/claude/config.js +10 -4
- package/sidecar/dist/providers/claude/config.js.map +1 -1
- package/sidecar/dist/providers/claude/provider.d.ts +2 -8
- package/sidecar/dist/providers/claude/provider.js +37 -35
- package/sidecar/dist/providers/claude/provider.js.map +1 -1
- package/sidecar/dist/providers/claude/safe-mode.d.ts +6 -1
- package/sidecar/dist/providers/claude/safe-mode.js +13 -5
- package/sidecar/dist/providers/claude/safe-mode.js.map +1 -1
- package/sidecar/dist/providers/codex/adapter.d.ts +6 -0
- package/sidecar/dist/providers/codex/adapter.js +14 -4
- package/sidecar/dist/providers/codex/adapter.js.map +1 -1
- package/sidecar/dist/providers/codex/client.d.ts +0 -11
- package/sidecar/dist/providers/codex/config.d.ts +1 -3
- package/sidecar/dist/providers/codex/config.js +5 -11
- package/sidecar/dist/providers/codex/config.js.map +1 -1
- package/sidecar/dist/providers/codex/permissions.d.ts +7 -4
- package/sidecar/dist/providers/codex/permissions.js +32 -16
- package/sidecar/dist/providers/codex/permissions.js.map +1 -1
- package/sidecar/dist/providers/codex/process.js +1 -5
- package/sidecar/dist/providers/codex/process.js.map +1 -1
- package/sidecar/dist/providers/codex/provider.js +14 -3
- package/sidecar/dist/providers/codex/provider.js.map +1 -1
- package/sidecar/dist/providers/codex/skills.d.ts +0 -1
- package/sidecar/dist/providers/codex/skills.js +1 -1
- package/sidecar/dist/providers/codex/skills.js.map +1 -1
- package/sidecar/dist/providers/codex/stop.js +1 -10
- package/sidecar/dist/providers/codex/stop.js.map +1 -1
- package/sidecar/dist/server/change-set-actions.d.ts +10 -0
- package/sidecar/dist/server/change-set-actions.js +14 -0
- package/sidecar/dist/server/change-set-actions.js.map +1 -0
- package/sidecar/dist/server/chat-events.d.ts +15 -0
- package/sidecar/dist/server/chat-events.js +115 -0
- package/sidecar/dist/server/chat-events.js.map +1 -0
- package/sidecar/dist/server/chat-socket-registry.d.ts +2 -0
- package/sidecar/dist/server/chat-socket-registry.js +48 -37
- package/sidecar/dist/server/chat-socket-registry.js.map +1 -1
- package/sidecar/dist/server/conversation-runs.d.ts +13 -0
- package/sidecar/dist/server/conversation-runs.js +114 -0
- package/sidecar/dist/server/conversation-runs.js.map +1 -0
- package/sidecar/dist/server/http-io.d.ts +4 -0
- package/sidecar/dist/server/http-io.js +31 -0
- package/sidecar/dist/server/http-io.js.map +1 -0
- package/sidecar/dist/server/http-params.d.ts +9 -0
- package/sidecar/dist/server/http-params.js +79 -0
- package/sidecar/dist/server/http-params.js.map +1 -0
- package/sidecar/dist/server/http-routes.d.ts +27 -0
- package/sidecar/dist/server/http-routes.js +281 -0
- package/sidecar/dist/server/http-routes.js.map +1 -0
- package/sidecar/dist/server/http.d.ts +6 -1
- package/sidecar/dist/server/http.js +76 -164
- package/sidecar/dist/server/http.js.map +1 -1
- package/sidecar/dist/server/pending-queue.d.ts +2 -0
- package/sidecar/dist/server/pending-queue.js +16 -0
- package/sidecar/dist/server/pending-queue.js.map +1 -1
- package/sidecar/dist/server/permission-events.d.ts +15 -0
- package/sidecar/dist/server/permission-events.js +163 -0
- package/sidecar/dist/server/permission-events.js.map +1 -0
- package/sidecar/dist/server/routing.d.ts +4 -52
- package/sidecar/dist/server/routing.js +190 -501
- package/sidecar/dist/server/routing.js.map +1 -1
- package/sidecar/dist/server/safety-net.d.ts +7 -0
- package/sidecar/dist/server/safety-net.js +34 -6
- package/sidecar/dist/server/safety-net.js.map +1 -1
- package/sidecar/dist/server/services.d.ts +55 -0
- package/sidecar/dist/server/services.js +2 -0
- package/sidecar/dist/server/services.js.map +1 -0
- package/sidecar/dist/server/tool-calls.d.ts +6 -0
- package/sidecar/dist/server/tool-calls.js +134 -0
- package/sidecar/dist/server/tool-calls.js.map +1 -0
- package/sidecar/dist/server/turn-registry.d.ts +44 -0
- package/sidecar/dist/server/turn-registry.js +40 -0
- package/sidecar/dist/server/turn-registry.js.map +1 -0
- package/sidecar/dist/server/turns.d.ts +17 -0
- package/sidecar/dist/server/turns.js +335 -0
- package/sidecar/dist/server/turns.js.map +1 -0
- package/sidecar/dist/server/ws.d.ts +4 -1
- package/sidecar/dist/server/ws.js +102 -62
- package/sidecar/dist/server/ws.js.map +1 -1
- package/sidecar/dist/skills/build-catalog.d.ts +1 -0
- package/sidecar/dist/skills/build-catalog.js +14 -1
- package/sidecar/dist/skills/build-catalog.js.map +1 -1
- package/sidecar/dist/skills/skill-usage.d.ts +22 -0
- package/sidecar/dist/skills/skill-usage.js +97 -0
- package/sidecar/dist/skills/skill-usage.js.map +1 -0
- package/sidecar/dist/state/change-sets.d.ts +12 -0
- package/sidecar/dist/state/change-sets.js +77 -0
- package/sidecar/dist/state/change-sets.js.map +1 -0
- package/sidecar/dist/state/conversations.d.ts +19 -7
- package/sidecar/dist/state/conversations.js +61 -20
- package/sidecar/dist/state/conversations.js.map +1 -1
- package/sidecar/dist/state/host-state.d.ts +2 -1
- package/sidecar/dist/state/settings-store.d.ts +1 -0
- package/sidecar/dist/state/settings-store.js +27 -26
- package/sidecar/dist/state/settings-store.js.map +1 -1
- package/sidecar/dist/state/settings-types.d.ts +11 -1
- package/sidecar/dist/state/settings-types.js +3 -1
- package/sidecar/dist/state/settings-types.js.map +1 -1
- package/sidecar/dist/state/types.d.ts +114 -8
- package/sidecar/dist/state/types.js +6 -3
- package/sidecar/dist/state/types.js.map +1 -1
- package/skills/dms-builder-safe/REFERENCE.md +1 -1
- package/skills/dms-builder-safe/SKILL.md +12 -7
- package/dist/routes/proxy.d.ts +0 -4
- package/dist/routes/proxy.js +0 -55
- package/dist/routes/proxy.js.map +0 -1
- package/frontend-vue/app/chat/components/ComposerInput.vue +0 -742
- package/frontend-vue/app/chat/components/PermissionRequests.vue +0 -323
- package/frontend-vue/app/chat/components/QuestionPrompt.vue +0 -275
- package/frontend-vue/app/chat/components/QueuedMessages.vue +0 -109
- package/frontend-vue/app/chat/components/TodoList.vue +0 -291
- package/frontend-vue/app/chat/components/ToolCallEntry.vue +0 -218
- package/frontend-vue/app/chat/constants/connection-banner.ts +0 -7
- package/frontend-vue/app/chat/constants/conversation-drawer.ts +0 -13
- package/frontend-vue/app/chat/constants/permissions.ts +0 -50
- package/frontend-vue/app/chat/utils/tool-summary.ts +0 -53
- package/frontend-vue/app/components/ActivityView.vue +0 -94
- package/frontend-vue/app/components/SettingsView.vue +0 -387
- package/frontend-vue/app/components/SkillsView.vue +0 -230
- package/frontend-vue/app/runtime/header-action.ts +0 -64
- package/frontend-vue/app/runtime/overlay-prefs.ts +0 -89
- package/frontend-vue/app/runtime/panel-state.ts +0 -88
- package/frontend-vue/tests/overlay-prefs.test.ts +0 -91
- package/frontend-vue/tests/panel-state.test.ts +0 -58
|
@@ -9,7 +9,7 @@ function readPersisted(): string | null {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
function
|
|
12
|
+
export function persistConversationId(id: string): void {
|
|
13
13
|
try {
|
|
14
14
|
window.localStorage.setItem(STORAGE_CONVERSATION_ID_KEY, id);
|
|
15
15
|
} catch {
|
|
@@ -21,14 +21,6 @@ export function resolveConversationId(): string {
|
|
|
21
21
|
const existing = readPersisted();
|
|
22
22
|
if (existing !== null && existing.length > 0) return existing;
|
|
23
23
|
const next = newUuid();
|
|
24
|
-
|
|
24
|
+
persistConversationId(next);
|
|
25
25
|
return next;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
export function persistConversationId(id: string): void {
|
|
29
|
-
persist(id);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function newConversationId(): string {
|
|
33
|
-
return newUuid();
|
|
34
|
-
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
type ComputedRef,
|
|
4
|
+
onBeforeUnmount,
|
|
5
|
+
type Ref,
|
|
6
|
+
ref,
|
|
7
|
+
} from "vue";
|
|
8
|
+
import { DELETE_UNDO_MS } from "../constants/conversation";
|
|
2
9
|
import {
|
|
3
10
|
CLIENT_MESSAGE_TYPES,
|
|
4
11
|
SERVER_EVENT_TYPES,
|
|
@@ -6,51 +13,100 @@ import {
|
|
|
6
13
|
import type { ConversationSummary } from "../types/conversation";
|
|
7
14
|
|
|
8
15
|
export interface UseConversationListOptions {
|
|
9
|
-
send: (msg: object) =>
|
|
16
|
+
send: (msg: object) => boolean;
|
|
10
17
|
onMessage: (handler: (msg: unknown) => void) => () => void;
|
|
11
18
|
}
|
|
12
19
|
|
|
20
|
+
/** A deletion still within its undo window. */
|
|
21
|
+
interface PendingDelete {
|
|
22
|
+
id: string;
|
|
23
|
+
title: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
13
26
|
export interface UseConversationListResult {
|
|
14
|
-
|
|
27
|
+
/** The sidecar's list, without the chats being deleted. */
|
|
28
|
+
conversations: ComputedRef<ConversationSummary[]>;
|
|
15
29
|
refresh: () => void;
|
|
16
|
-
|
|
30
|
+
/** Hides the chat now and deletes it once the undo window is over. */
|
|
31
|
+
remove: (conversation: ConversationSummary) => void;
|
|
32
|
+
undoRemove: (id: string) => void;
|
|
33
|
+
/** The latest deletion that can still be undone. */
|
|
34
|
+
pendingDelete: Ref<PendingDelete | null>;
|
|
17
35
|
}
|
|
18
36
|
|
|
19
37
|
interface ConversationListEvent {
|
|
20
38
|
type: typeof SERVER_EVENT_TYPES.CONVERSATION_LIST;
|
|
21
|
-
conversations
|
|
39
|
+
conversations?: ConversationSummary[];
|
|
22
40
|
}
|
|
23
41
|
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
function getEventType(msg: unknown): string | null {
|
|
29
|
-
if (!isObject(msg)) return null;
|
|
30
|
-
const t = msg.type;
|
|
31
|
-
return typeof t === "string" ? t : null;
|
|
42
|
+
function isListEvent(msg: unknown): msg is ConversationListEvent {
|
|
43
|
+
if (msg === null || typeof msg !== "object") return false;
|
|
44
|
+
return Reflect.get(msg, "type") === SERVER_EVENT_TYPES.CONVERSATION_LIST;
|
|
32
45
|
}
|
|
33
46
|
|
|
47
|
+
/**
|
|
48
|
+
* The conversation history. A deletion waits out its undo window on this side:
|
|
49
|
+
* the sidecar only hears of it once the window is over, or at once when the
|
|
50
|
+
* chat goes away.
|
|
51
|
+
*/
|
|
34
52
|
export function useConversationList(
|
|
35
53
|
options: UseConversationListOptions,
|
|
36
54
|
): UseConversationListResult {
|
|
37
|
-
const
|
|
55
|
+
const all = ref<ConversationSummary[]>([]);
|
|
56
|
+
const timers = new Map<string, ReturnType<typeof setTimeout>>();
|
|
57
|
+
const hidden = ref<ReadonlySet<string>>(new Set());
|
|
58
|
+
const pendingDelete = ref<PendingDelete | null>(null);
|
|
38
59
|
|
|
39
|
-
options.onMessage((msg
|
|
40
|
-
if (
|
|
41
|
-
conversations.value = (msg as ConversationListEvent).conversations;
|
|
60
|
+
options.onMessage((msg) => {
|
|
61
|
+
if (isListEvent(msg)) all.value = msg.conversations ?? [];
|
|
42
62
|
});
|
|
43
63
|
|
|
44
|
-
const
|
|
45
|
-
|
|
64
|
+
const setHidden = (id: string, isHidden: boolean): void => {
|
|
65
|
+
const next = new Set(hidden.value);
|
|
66
|
+
if (isHidden) next.add(id);
|
|
67
|
+
else next.delete(id);
|
|
68
|
+
hidden.value = next;
|
|
46
69
|
};
|
|
47
70
|
|
|
48
|
-
const
|
|
71
|
+
const commit = (id: string): void => {
|
|
72
|
+
const timer = timers.get(id);
|
|
73
|
+
if (timer !== undefined) clearTimeout(timer);
|
|
74
|
+
timers.delete(id);
|
|
49
75
|
options.send({
|
|
50
76
|
type: CLIENT_MESSAGE_TYPES.DELETE_CONVERSATION,
|
|
51
77
|
conversationId: id,
|
|
52
78
|
});
|
|
79
|
+
if (pendingDelete.value?.id === id) pendingDelete.value = null;
|
|
53
80
|
};
|
|
54
81
|
|
|
55
|
-
|
|
82
|
+
const remove = (conversation: ConversationSummary): void => {
|
|
83
|
+
setHidden(conversation.id, true);
|
|
84
|
+
pendingDelete.value = { id: conversation.id, title: conversation.title };
|
|
85
|
+
timers.set(
|
|
86
|
+
conversation.id,
|
|
87
|
+
setTimeout(() => commit(conversation.id), DELETE_UNDO_MS),
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const undoRemove = (id: string): void => {
|
|
92
|
+
const timer = timers.get(id);
|
|
93
|
+
if (timer !== undefined) clearTimeout(timer);
|
|
94
|
+
timers.delete(id);
|
|
95
|
+
setHidden(id, false);
|
|
96
|
+
if (pendingDelete.value?.id === id) pendingDelete.value = null;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
onBeforeUnmount(() => [...timers.keys()].forEach(commit));
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
conversations: computed(() =>
|
|
103
|
+
all.value.filter((item) => !hidden.value.has(item.id)),
|
|
104
|
+
),
|
|
105
|
+
refresh: () => {
|
|
106
|
+
options.send({ type: CLIENT_MESSAGE_TYPES.LIST_CONVERSATIONS });
|
|
107
|
+
},
|
|
108
|
+
remove,
|
|
109
|
+
undoRemove,
|
|
110
|
+
pendingDelete,
|
|
111
|
+
};
|
|
56
112
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { computed, type ComputedRef, type Ref } from "vue";
|
|
2
|
+
import { CLIENT_MESSAGE_TYPES } from "../constants/protocol";
|
|
3
|
+
import type {
|
|
4
|
+
ApprovalMode,
|
|
5
|
+
ConversationModeState,
|
|
6
|
+
FullAutoDuration,
|
|
7
|
+
Scope,
|
|
8
|
+
} from "../types/protocol";
|
|
9
|
+
import type { AppSettings } from "../types/settings";
|
|
10
|
+
|
|
11
|
+
export interface UseConversationModeOptions {
|
|
12
|
+
activeId: Ref<string>;
|
|
13
|
+
/** What the sidecar last said of this chat's mode; null before it did. */
|
|
14
|
+
mode: Ref<ConversationModeState | null>;
|
|
15
|
+
settings: Ref<AppSettings>;
|
|
16
|
+
send: (msg: object) => boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface UseConversationModeResult {
|
|
20
|
+
/** The chat's mode, its scope and Full auto, defaults until the sidecar says. */
|
|
21
|
+
current: ComputedRef<ConversationModeState>;
|
|
22
|
+
setMode: (mode: ApprovalMode) => void;
|
|
23
|
+
setScope: (scope: Scope) => void;
|
|
24
|
+
startFullAuto: (duration: FullAutoDuration) => void;
|
|
25
|
+
stopFullAuto: () => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function effectiveScope(scope: Scope, builderAvailable: boolean): Scope {
|
|
29
|
+
return builderAvailable ? scope : "vibe";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The active chat's approval mode, scope and Full auto: what the sidecar says,
|
|
34
|
+
* or the defaults for new chats from the settings until it has. Changes apply
|
|
35
|
+
* at once here and are sent for the sidecar to confirm.
|
|
36
|
+
*/
|
|
37
|
+
export function useConversationMode(
|
|
38
|
+
options: UseConversationModeOptions,
|
|
39
|
+
): UseConversationModeResult {
|
|
40
|
+
const current = computed<ConversationModeState>(() => {
|
|
41
|
+
const { settings, mode } = options;
|
|
42
|
+
const base: ConversationModeState = mode.value ?? {
|
|
43
|
+
mode: settings.value.mode,
|
|
44
|
+
generationMode: settings.value.generationMode,
|
|
45
|
+
fullAuto: null,
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
...base,
|
|
49
|
+
generationMode: effectiveScope(
|
|
50
|
+
base.generationMode,
|
|
51
|
+
settings.value.builderAvailable,
|
|
52
|
+
),
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const change = (patch: Partial<ConversationModeState>): void => {
|
|
57
|
+
const isSent = options.send({
|
|
58
|
+
type: CLIENT_MESSAGE_TYPES.SET_CONVERSATION_MODE,
|
|
59
|
+
conversationId: options.activeId.value,
|
|
60
|
+
...patch,
|
|
61
|
+
});
|
|
62
|
+
if (!isSent) return;
|
|
63
|
+
options.mode.value = { ...current.value, ...patch };
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
current,
|
|
68
|
+
setMode: (mode) => change({ mode }),
|
|
69
|
+
setScope: (generationMode) => change({ generationMode }),
|
|
70
|
+
startFullAuto: (duration) => change({ fullAuto: { duration } }),
|
|
71
|
+
stopFullAuto: () => change({ fullAuto: null }),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { computed, type ComputedRef, ref } from "vue";
|
|
2
|
+
import type { ChatTransport } from "../../runtime/chat-transport";
|
|
3
|
+
import {
|
|
4
|
+
CLIENT_MESSAGE_TYPES,
|
|
5
|
+
CONNECTION_STATUSES,
|
|
6
|
+
} from "../constants/protocol";
|
|
7
|
+
import { PALETTE_TURN_MODE } from "../constants/conversation";
|
|
8
|
+
import { createChatChannel, type UseChatChannelResult } from "./useChatChannel";
|
|
9
|
+
import { useConversation, type UseConversationResult } from "./useConversation";
|
|
10
|
+
import { newUuid } from "../utils/ids";
|
|
11
|
+
import {
|
|
12
|
+
usePermissionQueue,
|
|
13
|
+
type UsePermissionQueueResult,
|
|
14
|
+
} from "./usePermissionQueue";
|
|
15
|
+
import {
|
|
16
|
+
useQuestionQueue,
|
|
17
|
+
type UseQuestionQueueResult,
|
|
18
|
+
} from "./useQuestionQueue";
|
|
19
|
+
|
|
20
|
+
export interface UsePaletteTurnOptions {
|
|
21
|
+
transport: ChatTransport;
|
|
22
|
+
prompt: string;
|
|
23
|
+
/** The page the question is asked on. */
|
|
24
|
+
getPagePath: () => string | undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* One question asked from the command palette: a read-only turn (Plan only,
|
|
29
|
+
* Safe mode) in a conversation of its own, followed over the tab's stream
|
|
30
|
+
* next to the panel's chat, and folded by the panel's own conversation logic.
|
|
31
|
+
*/
|
|
32
|
+
export interface PaletteTurn {
|
|
33
|
+
conversationId: string;
|
|
34
|
+
channel: UseChatChannelResult;
|
|
35
|
+
conversation: UseConversationResult;
|
|
36
|
+
permissions: UsePermissionQueueResult;
|
|
37
|
+
questions: UseQuestionQueueResult;
|
|
38
|
+
/** The agent asks something only the full assistant can answer. */
|
|
39
|
+
isWaitingForUser: ComputedRef<boolean>;
|
|
40
|
+
/** Attaches to the stream; the question leaves once it is connected. */
|
|
41
|
+
start: () => void;
|
|
42
|
+
/**
|
|
43
|
+
* Lets the conversation go on elsewhere: stopping the palette's view of it
|
|
44
|
+
* no longer stops its turn.
|
|
45
|
+
*/
|
|
46
|
+
handOff: () => void;
|
|
47
|
+
/** Detaches, stopping the turn unless it was handed off. */
|
|
48
|
+
stop: () => void;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface TurnState {
|
|
52
|
+
isAsked: boolean;
|
|
53
|
+
isHandedOff: boolean;
|
|
54
|
+
stopListening: () => void;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function ask(
|
|
58
|
+
options: UsePaletteTurnOptions,
|
|
59
|
+
turn: PaletteTurn,
|
|
60
|
+
state: TurnState,
|
|
61
|
+
): void {
|
|
62
|
+
if (state.isAsked) return;
|
|
63
|
+
state.isAsked = true;
|
|
64
|
+
turn.channel.send({
|
|
65
|
+
type: CLIENT_MESSAGE_TYPES.SET_CONVERSATION_MODE,
|
|
66
|
+
conversationId: turn.conversationId,
|
|
67
|
+
...PALETTE_TURN_MODE,
|
|
68
|
+
});
|
|
69
|
+
turn.conversation.sendUserMessage(options.prompt);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function usePaletteTurn(options: UsePaletteTurnOptions): PaletteTurn {
|
|
73
|
+
const conversationId = newUuid();
|
|
74
|
+
const activeId = ref(conversationId);
|
|
75
|
+
const channel = createChatChannel({
|
|
76
|
+
transport: options.transport,
|
|
77
|
+
getConversationId: () => conversationId,
|
|
78
|
+
isFollowing: true,
|
|
79
|
+
});
|
|
80
|
+
const queueOptions = {
|
|
81
|
+
activeId,
|
|
82
|
+
send: channel.result.send,
|
|
83
|
+
onMessage: channel.result.onMessage,
|
|
84
|
+
};
|
|
85
|
+
const permissions = usePermissionQueue(queueOptions);
|
|
86
|
+
const questions = useQuestionQueue(queueOptions);
|
|
87
|
+
const conversation = useConversation({
|
|
88
|
+
...queueOptions,
|
|
89
|
+
getPagePath: options.getPagePath,
|
|
90
|
+
});
|
|
91
|
+
const state: TurnState = {
|
|
92
|
+
isAsked: false,
|
|
93
|
+
isHandedOff: false,
|
|
94
|
+
stopListening: () => undefined,
|
|
95
|
+
};
|
|
96
|
+
const turn: PaletteTurn = {
|
|
97
|
+
conversationId,
|
|
98
|
+
channel: channel.result,
|
|
99
|
+
conversation,
|
|
100
|
+
permissions,
|
|
101
|
+
questions,
|
|
102
|
+
isWaitingForUser: computed(
|
|
103
|
+
() =>
|
|
104
|
+
permissions.queue.value.length > 0 || questions.queue.value.length > 0,
|
|
105
|
+
),
|
|
106
|
+
start: () => {
|
|
107
|
+
channel.start();
|
|
108
|
+
state.stopListening = options.transport.onReady(() =>
|
|
109
|
+
ask(options, turn, state),
|
|
110
|
+
);
|
|
111
|
+
if (options.transport.getStatus() === CONNECTION_STATUSES.CONNECTED)
|
|
112
|
+
ask(options, turn, state);
|
|
113
|
+
},
|
|
114
|
+
handOff: () => {
|
|
115
|
+
state.isHandedOff = true;
|
|
116
|
+
},
|
|
117
|
+
stop: () => {
|
|
118
|
+
if (!state.isHandedOff) conversation.interrupt();
|
|
119
|
+
state.stopListening();
|
|
120
|
+
channel.stop();
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
return turn;
|
|
124
|
+
}
|
|
@@ -1,59 +1,236 @@
|
|
|
1
1
|
import { type Ref, ref } from "vue";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import {
|
|
3
|
+
CLIENT_MESSAGE_TYPES,
|
|
4
|
+
FEEDBACK_MAX_CHARS,
|
|
5
|
+
SERVER_EVENT_TYPES,
|
|
6
|
+
} from "../constants/protocol";
|
|
7
|
+
import type {
|
|
8
|
+
ExpiredRequest,
|
|
9
|
+
PermissionAnswer,
|
|
10
|
+
PermissionRequestData,
|
|
11
|
+
} from "../types/permission";
|
|
12
|
+
import type {
|
|
13
|
+
ActiveRule,
|
|
14
|
+
PermissionKind,
|
|
15
|
+
PermissionPreview,
|
|
16
|
+
PermissionRule,
|
|
17
|
+
} from "../types/protocol";
|
|
5
18
|
|
|
6
19
|
export interface UsePermissionQueueOptions {
|
|
7
|
-
|
|
20
|
+
activeId: Ref<string>;
|
|
21
|
+
send: (msg: object) => boolean;
|
|
22
|
+
onMessage: (handler: (msg: unknown) => void) => () => void;
|
|
8
23
|
}
|
|
9
24
|
|
|
10
25
|
export interface UsePermissionQueueResult {
|
|
26
|
+
/** The active chat's pending requests, oldest first. */
|
|
11
27
|
queue: Ref<PermissionRequestData[]>;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
28
|
+
/** Requests that went unanswered, until dismissed or asked again. */
|
|
29
|
+
expired: Ref<ExpiredRequest[]>;
|
|
30
|
+
/** What the user allowed for the rest of this chat. */
|
|
31
|
+
rules: Ref<ActiveRule[]>;
|
|
32
|
+
respond: (requestId: string, answer: PermissionAnswer) => void;
|
|
33
|
+
/** Denies every pending request of the chat and stops its turn. */
|
|
34
|
+
denyAll: () => void;
|
|
35
|
+
revokeRule: (ruleId: string) => void;
|
|
36
|
+
dismissExpired: (requestId: string) => void;
|
|
15
37
|
clear: () => void;
|
|
16
38
|
}
|
|
17
39
|
|
|
18
|
-
|
|
40
|
+
interface PermissionRequestWire {
|
|
41
|
+
conversationId: string;
|
|
42
|
+
requestId: string;
|
|
43
|
+
callId?: string;
|
|
44
|
+
toolName: string;
|
|
45
|
+
args: unknown;
|
|
46
|
+
summary: string;
|
|
47
|
+
kind: PermissionKind;
|
|
48
|
+
alwaysAsk: boolean;
|
|
49
|
+
preview: PermissionPreview;
|
|
50
|
+
ruleOptions: PermissionRule[];
|
|
51
|
+
createdAtMs: number;
|
|
52
|
+
expiresAtMs: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface PermissionExpiredWire {
|
|
56
|
+
conversationId: string;
|
|
57
|
+
requestId: string;
|
|
58
|
+
toolName?: string;
|
|
59
|
+
summary?: string;
|
|
60
|
+
expiredAtMs?: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface RequestIdWire {
|
|
64
|
+
requestId: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interface RulesStateWire {
|
|
68
|
+
rules?: ActiveRule[];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface QueueState {
|
|
72
|
+
options: UsePermissionQueueOptions;
|
|
73
|
+
queue: Ref<PermissionRequestData[]>;
|
|
74
|
+
expired: Ref<ExpiredRequest[]>;
|
|
75
|
+
rules: Ref<ActiveRule[]>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
type QueueHandler = (state: QueueState, event: never) => void;
|
|
79
|
+
|
|
80
|
+
/** A request as the dock reads it: an always-ask one never offers a rule. */
|
|
81
|
+
function toPermissionRequest(
|
|
82
|
+
wire: PermissionRequestWire,
|
|
83
|
+
): PermissionRequestData {
|
|
84
|
+
return {
|
|
85
|
+
requestId: wire.requestId,
|
|
86
|
+
conversationId: wire.conversationId,
|
|
87
|
+
callId: wire.callId,
|
|
88
|
+
toolName: wire.toolName,
|
|
89
|
+
args: wire.args,
|
|
90
|
+
summary: wire.summary,
|
|
91
|
+
kind: wire.kind,
|
|
92
|
+
alwaysAsk: wire.alwaysAsk,
|
|
93
|
+
preview: wire.preview,
|
|
94
|
+
ruleOptions: wire.alwaysAsk ? [] : wire.ruleOptions,
|
|
95
|
+
createdAtMs: wire.createdAtMs,
|
|
96
|
+
expiresAtMs: wire.expiresAtMs,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function without(state: QueueState, requestId: string): void {
|
|
101
|
+
state.queue.value = state.queue.value.filter(
|
|
102
|
+
(req) => req.requestId !== requestId,
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function enqueue(state: QueueState, wire: PermissionRequestWire): void {
|
|
107
|
+
if (state.queue.value.some((req) => req.requestId === wire.requestId)) return;
|
|
108
|
+
state.queue.value = [...state.queue.value, toPermissionRequest(wire)];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function expire(state: QueueState, wire: PermissionExpiredWire): void {
|
|
112
|
+
const pending = state.queue.value.find(
|
|
113
|
+
(req) => req.requestId === wire.requestId,
|
|
114
|
+
);
|
|
115
|
+
without(state, wire.requestId);
|
|
116
|
+
if (state.expired.value.some((req) => req.requestId === wire.requestId))
|
|
117
|
+
return;
|
|
118
|
+
state.expired.value = [
|
|
119
|
+
...state.expired.value,
|
|
120
|
+
{
|
|
121
|
+
requestId: wire.requestId,
|
|
122
|
+
conversationId: wire.conversationId,
|
|
123
|
+
toolName: wire.toolName ?? pending?.toolName ?? "",
|
|
124
|
+
summary: wire.summary ?? pending?.summary ?? "",
|
|
125
|
+
expiredAtMs: wire.expiredAtMs ?? Date.now(),
|
|
126
|
+
},
|
|
127
|
+
];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const HANDLERS: Record<string, QueueHandler> = {
|
|
131
|
+
[SERVER_EVENT_TYPES.PERMISSION_REQUEST]: enqueue,
|
|
132
|
+
[SERVER_EVENT_TYPES.PERMISSION_EXPIRED]: expire,
|
|
133
|
+
[SERVER_EVENT_TYPES.PERMISSION_RESOLVED]: (state, event: RequestIdWire) =>
|
|
134
|
+
without(state, event.requestId),
|
|
135
|
+
[SERVER_EVENT_TYPES.RULES_STATE]: (state, event: RulesStateWire) => {
|
|
136
|
+
state.rules.value = event.rules ?? [];
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
function dispatch(state: QueueState, msg: unknown): void {
|
|
141
|
+
if (msg === null || typeof msg !== "object") return;
|
|
142
|
+
const event = msg as Record<string, unknown>;
|
|
143
|
+
const handler = HANDLERS[String(event.type)];
|
|
144
|
+
if (handler === undefined) return;
|
|
145
|
+
const conversationId = event.conversationId;
|
|
146
|
+
if (
|
|
147
|
+
typeof conversationId === "string" &&
|
|
148
|
+
conversationId !== state.options.activeId.value
|
|
149
|
+
)
|
|
150
|
+
return;
|
|
151
|
+
handler(state, msg as never);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function answerMessage(
|
|
19
155
|
req: PermissionRequestData,
|
|
20
|
-
|
|
156
|
+
answer: PermissionAnswer,
|
|
21
157
|
): object {
|
|
158
|
+
const feedback = answer.feedback?.trim().slice(0, FEEDBACK_MAX_CHARS);
|
|
22
159
|
return {
|
|
23
160
|
type: CLIENT_MESSAGE_TYPES.PERMISSION_RESPONSE,
|
|
24
161
|
conversationId: req.conversationId,
|
|
25
162
|
requestId: req.requestId,
|
|
26
|
-
decision,
|
|
163
|
+
decision: answer.decision,
|
|
164
|
+
...(answer.rule === undefined ? {} : { rule: answer.rule }),
|
|
165
|
+
...(feedback ? { feedback } : {}),
|
|
166
|
+
...(answer.keepData === true ? { keepData: true } : {}),
|
|
27
167
|
};
|
|
28
168
|
}
|
|
29
169
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
170
|
+
function respond(
|
|
171
|
+
state: QueueState,
|
|
172
|
+
requestId: string,
|
|
173
|
+
answer: PermissionAnswer,
|
|
174
|
+
): void {
|
|
175
|
+
const target = state.queue.value.find((req) => req.requestId === requestId);
|
|
176
|
+
if (target === undefined) return;
|
|
177
|
+
if (!state.options.send(answerMessage(target, answer))) return;
|
|
178
|
+
without(state, requestId);
|
|
179
|
+
}
|
|
34
180
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
181
|
+
function denyAll(state: QueueState): void {
|
|
182
|
+
const first = state.queue.value[0];
|
|
183
|
+
if (first === undefined) return;
|
|
184
|
+
const isSent = state.options.send({
|
|
185
|
+
type: CLIENT_MESSAGE_TYPES.PERMISSION_RESPONSE,
|
|
186
|
+
conversationId: first.conversationId,
|
|
187
|
+
requestId: first.requestId,
|
|
188
|
+
decision: "deny_all",
|
|
189
|
+
});
|
|
190
|
+
if (isSent) state.queue.value = [];
|
|
191
|
+
}
|
|
39
192
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
options.
|
|
44
|
-
|
|
45
|
-
};
|
|
193
|
+
function revokeRule(state: QueueState, ruleId: string): void {
|
|
194
|
+
const isSent = state.options.send({
|
|
195
|
+
type: CLIENT_MESSAGE_TYPES.REVOKE_RULE,
|
|
196
|
+
conversationId: state.options.activeId.value,
|
|
197
|
+
ruleId,
|
|
198
|
+
});
|
|
199
|
+
if (!isSent) return;
|
|
200
|
+
state.rules.value = state.rules.value.filter((rule) => rule.id !== ruleId);
|
|
201
|
+
}
|
|
46
202
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
203
|
+
/**
|
|
204
|
+
* The approvals of the active chat: pending requests with their previews,
|
|
205
|
+
* those that expired, and the rules the user granted. Requests another tab
|
|
206
|
+
* answered leave as soon as the sidecar says so.
|
|
207
|
+
*/
|
|
208
|
+
export function usePermissionQueue(
|
|
209
|
+
options: UsePermissionQueueOptions,
|
|
210
|
+
): UsePermissionQueueResult {
|
|
211
|
+
const state: QueueState = {
|
|
212
|
+
options,
|
|
213
|
+
queue: ref<PermissionRequestData[]>([]),
|
|
214
|
+
expired: ref<ExpiredRequest[]>([]),
|
|
215
|
+
rules: ref<ActiveRule[]>([]),
|
|
52
216
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
queue.
|
|
217
|
+
options.onMessage((msg) => dispatch(state, msg));
|
|
218
|
+
return {
|
|
219
|
+
queue: state.queue,
|
|
220
|
+
expired: state.expired,
|
|
221
|
+
rules: state.rules,
|
|
222
|
+
respond: (requestId, answer) => respond(state, requestId, answer),
|
|
223
|
+
denyAll: () => denyAll(state),
|
|
224
|
+
revokeRule: (ruleId) => revokeRule(state, ruleId),
|
|
225
|
+
dismissExpired: (requestId) => {
|
|
226
|
+
state.expired.value = state.expired.value.filter(
|
|
227
|
+
(req) => req.requestId !== requestId,
|
|
228
|
+
);
|
|
229
|
+
},
|
|
230
|
+
clear: () => {
|
|
231
|
+
state.queue.value = [];
|
|
232
|
+
state.expired.value = [];
|
|
233
|
+
state.rules.value = [];
|
|
234
|
+
},
|
|
56
235
|
};
|
|
57
|
-
|
|
58
|
-
return { queue, enqueue, respond, respondAll, clear };
|
|
59
236
|
}
|