@antelopejs/dms-ai 0.1.6 → 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 +48 -12
- 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 +0 -1
- package/dist/constants/sidecar.js +1 -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 +1 -0
- package/dist/lifecycle/sidecar-owner.js +13 -0
- package/dist/lifecycle/sidecar-owner.js.map +1 -1
- package/dist/lifecycle/spawn-sidecar.d.ts +1 -0
- package/dist/lifecycle/spawn-sidecar.js +10 -10
- package/dist/lifecycle/spawn-sidecar.js.map +1 -1
- 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 +4 -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.js +28 -2
- 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
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import ts from "typescript";
|
|
4
|
+
import * as vue from "vue";
|
|
4
5
|
import { nextTick, ref, type Ref } from "vue";
|
|
5
6
|
import { expect, it, vi } from "vitest";
|
|
7
|
+
import * as constants from "../app/runtime/constants";
|
|
6
8
|
import { runWhenLoggedIn } from "../app/runtime/session-gate";
|
|
7
9
|
|
|
8
10
|
interface PluginExports {
|
|
@@ -11,11 +13,13 @@ interface PluginExports {
|
|
|
11
13
|
|
|
12
14
|
interface PluginHarness {
|
|
13
15
|
useAuthFetch: ReturnType<typeof vi.fn>;
|
|
16
|
+
unregisterSidePanel: ReturnType<typeof vi.fn>;
|
|
14
17
|
run: () => void | Promise<void>;
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
const SESSION_GATE_MODULE = "../runtime/session-gate";
|
|
18
21
|
const SIDECAR_STATUS_MODULE = "../runtime/sidecar-status";
|
|
22
|
+
const CONSTANTS_MODULE = "../runtime/constants";
|
|
19
23
|
|
|
20
24
|
// A first probe reporting "no assistant here" stops the startup right after the
|
|
21
25
|
// authenticated fetch, which is all these tests need to observe.
|
|
@@ -36,10 +40,16 @@ function loadPlugin(loggedIn: Ref<boolean>): PluginHarness {
|
|
|
36
40
|
);
|
|
37
41
|
const exports = {} as PluginExports;
|
|
38
42
|
const useAuthFetch = vi.fn(() => ({ $authFetch: vi.fn() }));
|
|
43
|
+
const unregisterSidePanel = vi.fn();
|
|
39
44
|
const requireModule = (name: string) => {
|
|
40
45
|
if (name === "#dms/frontend-module") {
|
|
41
|
-
return {
|
|
46
|
+
return {
|
|
47
|
+
defineDmsPlugin: (plugin: unknown) => plugin,
|
|
48
|
+
useDmsRouter: () => ({ push: vi.fn() }),
|
|
49
|
+
};
|
|
42
50
|
}
|
|
51
|
+
if (name === "vue") return vue;
|
|
52
|
+
if (name === CONSTANTS_MODULE) return constants;
|
|
43
53
|
if (name === SESSION_GATE_MODULE) return { runWhenLoggedIn };
|
|
44
54
|
if (name === SIDECAR_STATUS_MODULE) return silentController;
|
|
45
55
|
return {};
|
|
@@ -49,13 +59,27 @@ function loadPlugin(loggedIn: Ref<boolean>): PluginHarness {
|
|
|
49
59
|
"exports",
|
|
50
60
|
"useUserSession",
|
|
51
61
|
"useAuthFetch",
|
|
62
|
+
"useToast",
|
|
63
|
+
"useDevReload",
|
|
64
|
+
"unregisterSidePanel",
|
|
52
65
|
compiled.outputText,
|
|
53
|
-
)(
|
|
66
|
+
)(
|
|
67
|
+
requireModule,
|
|
68
|
+
exports,
|
|
69
|
+
() => ({ loggedIn }),
|
|
70
|
+
useAuthFetch,
|
|
71
|
+
() => ({ add: vi.fn() }),
|
|
72
|
+
() => ({ awaitRoute: vi.fn() }),
|
|
73
|
+
unregisterSidePanel,
|
|
74
|
+
);
|
|
54
75
|
return {
|
|
55
76
|
useAuthFetch,
|
|
77
|
+
unregisterSidePanel,
|
|
56
78
|
run: () =>
|
|
57
79
|
exports.default({
|
|
58
|
-
vueApp: { onUnmount: vi.fn() },
|
|
80
|
+
vueApp: { onUnmount: vi.fn(), provide: vi.fn() },
|
|
81
|
+
$i18n: { t: (key: string) => key, locale: ref("en-GB") },
|
|
82
|
+
hook: vi.fn(),
|
|
59
83
|
runWithContext: (callback: () => unknown) => callback(),
|
|
60
84
|
}),
|
|
61
85
|
};
|
|
@@ -77,3 +101,11 @@ it("starts the assistant when a guest signs in without reloading the page", asyn
|
|
|
77
101
|
await nextTick();
|
|
78
102
|
expect(plugin.useAuthFetch).toHaveBeenCalledTimes(1);
|
|
79
103
|
});
|
|
104
|
+
|
|
105
|
+
it("withdraws the docked panel when the first probe finds no assistant", async () => {
|
|
106
|
+
const plugin = loadPlugin(ref(true));
|
|
107
|
+
await plugin.run();
|
|
108
|
+
await vi.waitFor(() =>
|
|
109
|
+
expect(plugin.unregisterSidePanel).toHaveBeenCalledWith("dms-ai:assistant"),
|
|
110
|
+
);
|
|
111
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import type {
|
|
3
|
+
ChatI18n,
|
|
4
|
+
TranslateParams,
|
|
5
|
+
} from "../../app/chat/composables/useChatI18n";
|
|
6
|
+
import en from "../../i18n/locales/dms-ai-panel-en-GB.json";
|
|
7
|
+
|
|
8
|
+
type Messages = Record<string, unknown>;
|
|
9
|
+
|
|
10
|
+
const PLURAL_SEPARATOR = " | ";
|
|
11
|
+
|
|
12
|
+
function lookup(messages: Messages, key: string): string | null {
|
|
13
|
+
const value = key
|
|
14
|
+
.split(".")
|
|
15
|
+
.reduce<unknown>(
|
|
16
|
+
(node, part) =>
|
|
17
|
+
node !== null && typeof node === "object"
|
|
18
|
+
? (node as Messages)[part]
|
|
19
|
+
: undefined,
|
|
20
|
+
messages,
|
|
21
|
+
);
|
|
22
|
+
return typeof value === "string" ? value : null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** vue-i18n's default choice: two forms are singular/plural, three add zero. */
|
|
26
|
+
function choose(forms: string[], count: number): string {
|
|
27
|
+
if (forms.length === 2) return forms[count === 1 ? 0 : 1];
|
|
28
|
+
return forms[Math.min(count, forms.length - 1)];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function interpolate(text: string, params: TranslateParams = {}): string {
|
|
32
|
+
return text.replace(/\{(\w+)\}/g, (match, name: string) =>
|
|
33
|
+
name in params ? String(params[name]) : match,
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** The panel's English strings behind the chat's translator, as in the dashboard. */
|
|
38
|
+
export function createTestI18n(messages: Messages = en): ChatI18n {
|
|
39
|
+
return {
|
|
40
|
+
t: (key, params, plural) => {
|
|
41
|
+
const text = lookup(messages, key);
|
|
42
|
+
if (text === null) return key;
|
|
43
|
+
const forms = text.split(PLURAL_SEPARATOR);
|
|
44
|
+
const form = plural === undefined ? forms[0] : choose(forms, plural);
|
|
45
|
+
return interpolate(form, params);
|
|
46
|
+
},
|
|
47
|
+
locale: ref("en-GB"),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { flushPromises, mount, type VueWrapper } from "@vue/test-utils";
|
|
2
|
+
import { vi } from "vitest";
|
|
3
|
+
import { defineComponent, h, nextTick, readonly, ref, shallowRef } from "vue";
|
|
4
|
+
import ChatPanel from "../../app/components/ChatPanel.vue";
|
|
5
|
+
import {
|
|
6
|
+
ASSISTANT_SESSION_KEY,
|
|
7
|
+
type AssistantSession,
|
|
8
|
+
type ChatPanelState,
|
|
9
|
+
} from "../../app/runtime/assistant-session";
|
|
10
|
+
import type { ChannelStatus } from "../../app/runtime/channel-client";
|
|
11
|
+
import {
|
|
12
|
+
type ChatTransportHub,
|
|
13
|
+
createChatTransport,
|
|
14
|
+
} from "../../app/runtime/chat-transport";
|
|
15
|
+
import { createPanelIntents } from "../../app/runtime/panel-intents";
|
|
16
|
+
import { CHAT_I18N_KEY } from "../../app/chat/composables/useChatI18n";
|
|
17
|
+
import { createTestI18n } from "./i18n";
|
|
18
|
+
import { PANEL_STUBS } from "./stubs";
|
|
19
|
+
import type { SidecarStatus } from "../../app/runtime/sidecar-status";
|
|
20
|
+
|
|
21
|
+
export const CONVERSATION_ID = "conv-native-1";
|
|
22
|
+
|
|
23
|
+
/** A panel mounted on a fake stream: what it sent, and handles to drive it. */
|
|
24
|
+
export interface Harness {
|
|
25
|
+
session: AssistantSession;
|
|
26
|
+
hub: ChatTransportHub;
|
|
27
|
+
sent: Array<Record<string, unknown>>;
|
|
28
|
+
reconnects: number;
|
|
29
|
+
sidecarStatus: ReturnType<typeof ref<SidecarStatus>>;
|
|
30
|
+
setChannelStatus: (status: ChannelStatus) => void;
|
|
31
|
+
navigate: ReturnType<typeof vi.fn>;
|
|
32
|
+
restart: ReturnType<typeof vi.fn>;
|
|
33
|
+
lastError: ReturnType<typeof ref<string | null>>;
|
|
34
|
+
api: AssistantSession["api"];
|
|
35
|
+
/** How many holds keep the tab's stream open. */
|
|
36
|
+
streamHolds: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* What the DMS's `useSidePanel` hands the plugin: the open state it keeps in
|
|
41
|
+
* its cookie, and the ways to change it.
|
|
42
|
+
*/
|
|
43
|
+
export function createSidePanel(): ChatPanelState {
|
|
44
|
+
const isOpen = ref(false);
|
|
45
|
+
return {
|
|
46
|
+
isOpen: readonly(isOpen),
|
|
47
|
+
open: () => {
|
|
48
|
+
isOpen.value = true;
|
|
49
|
+
},
|
|
50
|
+
close: () => {
|
|
51
|
+
isOpen.value = false;
|
|
52
|
+
},
|
|
53
|
+
toggle: () => {
|
|
54
|
+
isOpen.value = !isOpen.value;
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function createHarness(): Harness {
|
|
60
|
+
let channelStatus: ChannelStatus = "connected";
|
|
61
|
+
const harness = {
|
|
62
|
+
sent: [] as Array<Record<string, unknown>>,
|
|
63
|
+
reconnects: 0,
|
|
64
|
+
sidecarStatus: ref<SidecarStatus>("connected"),
|
|
65
|
+
navigate: vi.fn(),
|
|
66
|
+
restart: vi.fn(async () => undefined),
|
|
67
|
+
lastError: ref<string | null>(null),
|
|
68
|
+
api: { get: vi.fn(async () => ({ conflicts: [] })), post: vi.fn() },
|
|
69
|
+
} as unknown as Harness;
|
|
70
|
+
harness.hub = createChatTransport({
|
|
71
|
+
send: (msg) => {
|
|
72
|
+
if (channelStatus !== "connected") return false;
|
|
73
|
+
harness.sent.push(msg as Record<string, unknown>);
|
|
74
|
+
return true;
|
|
75
|
+
},
|
|
76
|
+
reconnect: () => {
|
|
77
|
+
harness.reconnects += 1;
|
|
78
|
+
},
|
|
79
|
+
getStatus: () => channelStatus,
|
|
80
|
+
});
|
|
81
|
+
harness.streamHolds = 0;
|
|
82
|
+
harness.setChannelStatus = (status) => {
|
|
83
|
+
channelStatus = status;
|
|
84
|
+
harness.hub.announceStatus(status);
|
|
85
|
+
};
|
|
86
|
+
const panel = createSidePanel();
|
|
87
|
+
const intents = createPanelIntents();
|
|
88
|
+
harness.session = {
|
|
89
|
+
status: harness.sidecarStatus,
|
|
90
|
+
chat: harness.hub.transport,
|
|
91
|
+
panel,
|
|
92
|
+
navigate: harness.navigate,
|
|
93
|
+
openConversation: (conversationId) => {
|
|
94
|
+
intents.push({ kind: "open", conversationId });
|
|
95
|
+
panel.open();
|
|
96
|
+
},
|
|
97
|
+
startConversation: (prompt) => {
|
|
98
|
+
intents.push({ kind: "start", prompt });
|
|
99
|
+
panel.open();
|
|
100
|
+
},
|
|
101
|
+
holdStream: () => {
|
|
102
|
+
harness.streamHolds += 1;
|
|
103
|
+
return () => {
|
|
104
|
+
harness.streamHolds -= 1;
|
|
105
|
+
};
|
|
106
|
+
},
|
|
107
|
+
pendingApprovals: ref(0),
|
|
108
|
+
intents,
|
|
109
|
+
currentPage: ref({
|
|
110
|
+
path: "/sales/overview",
|
|
111
|
+
title: "Sales overview · DMS",
|
|
112
|
+
}),
|
|
113
|
+
api: harness.api,
|
|
114
|
+
lastError: harness.lastError,
|
|
115
|
+
restart: harness.restart,
|
|
116
|
+
};
|
|
117
|
+
return harness;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
let wrapper: VueWrapper | null = null;
|
|
121
|
+
|
|
122
|
+
/** Unmounts what the last test mounted. */
|
|
123
|
+
export function unmountPanel(): void {
|
|
124
|
+
wrapper?.unmount();
|
|
125
|
+
wrapper = null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The DMS's side panel host: the panel's component is mounted while the panel
|
|
130
|
+
* is open, and unmounted when it closes.
|
|
131
|
+
*/
|
|
132
|
+
function sidePanelHost(panel: ChatPanelState) {
|
|
133
|
+
return defineComponent({
|
|
134
|
+
setup: () => () =>
|
|
135
|
+
h("aside", { "data-dms-side-panel": "" }, [
|
|
136
|
+
panel.isOpen.value ? h(ChatPanel) : null,
|
|
137
|
+
]),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** The providers the plugin installs, as a test mounts them. */
|
|
142
|
+
export function providedSession(session: AssistantSession | null) {
|
|
143
|
+
return {
|
|
144
|
+
[ASSISTANT_SESSION_KEY as symbol]: shallowRef(session),
|
|
145
|
+
[CHAT_I18N_KEY as symbol]: createTestI18n(),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function mountPanel(harness: Harness): VueWrapper {
|
|
150
|
+
wrapper = mount(sidePanelHost(harness.session.panel), {
|
|
151
|
+
attachTo: document.body,
|
|
152
|
+
global: {
|
|
153
|
+
provide: providedSession(harness.session),
|
|
154
|
+
stubs: PANEL_STUBS,
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
return wrapper;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export async function openPanel(harness: Harness): Promise<VueWrapper> {
|
|
161
|
+
const mounted = mountPanel(harness);
|
|
162
|
+
harness.session.panel.open();
|
|
163
|
+
await nextTick();
|
|
164
|
+
await flushPromises();
|
|
165
|
+
return mounted;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** A sidecar event for the panel's conversation. */
|
|
169
|
+
export function deliver(
|
|
170
|
+
harness: Harness,
|
|
171
|
+
event: Record<string, unknown>,
|
|
172
|
+
): void {
|
|
173
|
+
harness.hub.deliver({ conversationId: CONVERSATION_ID, ...event });
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function sentOfType(harness: Harness, type: string) {
|
|
177
|
+
return harness.sent.filter((msg) => msg.type === type);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export async function sendMessage(
|
|
181
|
+
panel: VueWrapper,
|
|
182
|
+
text: string,
|
|
183
|
+
): Promise<void> {
|
|
184
|
+
await panel.find("textarea").setValue(text);
|
|
185
|
+
await panel.find("form.composer").trigger("submit");
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** The first button whose text contains `label`. */
|
|
189
|
+
export function buttonWithText(
|
|
190
|
+
root: VueWrapper | ReturnType<VueWrapper["find"]>,
|
|
191
|
+
label: string,
|
|
192
|
+
) {
|
|
193
|
+
const button = root
|
|
194
|
+
.findAll("button")
|
|
195
|
+
.find((item) => item.text().includes(label));
|
|
196
|
+
if (button === undefined) throw new Error(`no button "${label}"`);
|
|
197
|
+
return button;
|
|
198
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { defineComponent, h, type PropType } from "vue";
|
|
2
|
+
|
|
3
|
+
interface SegmentItem {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Nuxt UI's button, drawn as a plain button with its label and slot. */
|
|
9
|
+
const UButton = defineComponent({
|
|
10
|
+
name: "UButton",
|
|
11
|
+
inheritAttrs: false,
|
|
12
|
+
props: {
|
|
13
|
+
label: { type: String, default: "" },
|
|
14
|
+
disabled: { type: Boolean, default: false },
|
|
15
|
+
loading: { type: Boolean, default: false },
|
|
16
|
+
type: { type: String, default: "button" },
|
|
17
|
+
},
|
|
18
|
+
emits: ["click"],
|
|
19
|
+
setup(props, { slots, attrs, emit }) {
|
|
20
|
+
return () =>
|
|
21
|
+
h(
|
|
22
|
+
"button",
|
|
23
|
+
{
|
|
24
|
+
...attrs,
|
|
25
|
+
type: props.type,
|
|
26
|
+
disabled: props.disabled,
|
|
27
|
+
onClick: (event: MouseEvent) => emit("click", event),
|
|
28
|
+
},
|
|
29
|
+
[props.label, slots.default?.()],
|
|
30
|
+
);
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const UKbd = defineComponent({
|
|
35
|
+
name: "UKbd",
|
|
36
|
+
props: { value: { type: String, default: "" } },
|
|
37
|
+
setup: (props) => () => h("kbd", props.value),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const UBadge = defineComponent({
|
|
41
|
+
name: "UBadge",
|
|
42
|
+
props: { label: { type: String, default: "" } },
|
|
43
|
+
setup: (props) => () => h("span", { class: "u-badge" }, props.label),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
/** A modal that draws its slots in place while open. */
|
|
47
|
+
const UModal = defineComponent({
|
|
48
|
+
name: "UModal",
|
|
49
|
+
props: {
|
|
50
|
+
open: { type: Boolean, default: false },
|
|
51
|
+
title: { type: String, default: "" },
|
|
52
|
+
},
|
|
53
|
+
setup(props, { slots }) {
|
|
54
|
+
return () =>
|
|
55
|
+
props.open
|
|
56
|
+
? h("div", { class: "u-modal", role: "dialog" }, [
|
|
57
|
+
h("h2", props.title),
|
|
58
|
+
slots.body?.(),
|
|
59
|
+
slots.footer?.(),
|
|
60
|
+
])
|
|
61
|
+
: null;
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
interface MenuItem {
|
|
66
|
+
label?: string;
|
|
67
|
+
onSelect?: () => void;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** A menu drawn open, each item a button, so tests can pick one. */
|
|
71
|
+
const UDropdownMenu = defineComponent({
|
|
72
|
+
name: "UDropdownMenu",
|
|
73
|
+
props: { items: { type: Array as PropType<unknown[]>, default: () => [] } },
|
|
74
|
+
setup(props, { slots }) {
|
|
75
|
+
const flat = (): MenuItem[] => props.items.flat(2) as MenuItem[];
|
|
76
|
+
return () =>
|
|
77
|
+
h("div", { class: "u-dropdown" }, [
|
|
78
|
+
slots.default?.(),
|
|
79
|
+
...flat()
|
|
80
|
+
.filter((item) => item.onSelect !== undefined)
|
|
81
|
+
.map((item) =>
|
|
82
|
+
h(
|
|
83
|
+
"button",
|
|
84
|
+
{
|
|
85
|
+
class: "u-dropdown-item",
|
|
86
|
+
type: "button",
|
|
87
|
+
onClick: item.onSelect,
|
|
88
|
+
},
|
|
89
|
+
item.label,
|
|
90
|
+
),
|
|
91
|
+
),
|
|
92
|
+
]);
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const UPopover = defineComponent({
|
|
97
|
+
name: "UPopover",
|
|
98
|
+
setup:
|
|
99
|
+
(_, { slots }) =>
|
|
100
|
+
() =>
|
|
101
|
+
h("div", { class: "u-popover" }, [slots.default?.(), slots.content?.()]),
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const UInput = defineComponent({
|
|
105
|
+
name: "UInput",
|
|
106
|
+
props: { modelValue: { type: String, default: "" } },
|
|
107
|
+
emits: ["update:modelValue"],
|
|
108
|
+
setup:
|
|
109
|
+
(props, { emit, attrs }) =>
|
|
110
|
+
() =>
|
|
111
|
+
h("input", {
|
|
112
|
+
...attrs,
|
|
113
|
+
value: props.modelValue,
|
|
114
|
+
onInput: (event: Event) =>
|
|
115
|
+
emit("update:modelValue", (event.target as HTMLInputElement).value),
|
|
116
|
+
}),
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const UTextarea = defineComponent({
|
|
120
|
+
name: "UTextarea",
|
|
121
|
+
props: { modelValue: { type: String, default: "" } },
|
|
122
|
+
emits: ["update:modelValue"],
|
|
123
|
+
setup:
|
|
124
|
+
(props, { emit }) =>
|
|
125
|
+
() =>
|
|
126
|
+
h("textarea", {
|
|
127
|
+
class: "u-textarea",
|
|
128
|
+
value: props.modelValue,
|
|
129
|
+
onInput: (event: Event) =>
|
|
130
|
+
emit(
|
|
131
|
+
"update:modelValue",
|
|
132
|
+
(event.target as HTMLTextAreaElement).value,
|
|
133
|
+
),
|
|
134
|
+
}),
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const DmsSegmented = defineComponent({
|
|
138
|
+
name: "DmsSegmented",
|
|
139
|
+
props: {
|
|
140
|
+
modelValue: { type: [String, Number], default: "" },
|
|
141
|
+
items: {
|
|
142
|
+
type: Array as PropType<SegmentItem[]>,
|
|
143
|
+
default: () => [],
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
emits: ["update:modelValue"],
|
|
147
|
+
setup:
|
|
148
|
+
(props, { emit }) =>
|
|
149
|
+
() =>
|
|
150
|
+
h(
|
|
151
|
+
"div",
|
|
152
|
+
{ class: "dms-segmented" },
|
|
153
|
+
props.items.map((item) =>
|
|
154
|
+
h(
|
|
155
|
+
"button",
|
|
156
|
+
{
|
|
157
|
+
type: "button",
|
|
158
|
+
onClick: () => emit("update:modelValue", item.value),
|
|
159
|
+
},
|
|
160
|
+
item.label,
|
|
161
|
+
),
|
|
162
|
+
),
|
|
163
|
+
),
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
const DmsEmptyState = defineComponent({
|
|
167
|
+
name: "DmsEmptyState",
|
|
168
|
+
props: {
|
|
169
|
+
title: { type: String, default: "" },
|
|
170
|
+
description: { type: String, default: "" },
|
|
171
|
+
},
|
|
172
|
+
setup:
|
|
173
|
+
(props, { slots }) =>
|
|
174
|
+
() =>
|
|
175
|
+
h("div", { class: "dms-empty" }, [
|
|
176
|
+
h("p", props.title),
|
|
177
|
+
h("p", props.description),
|
|
178
|
+
slots.actions?.(),
|
|
179
|
+
]),
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
/** Every Nuxt UI and DMS component the panel draws, as light stand-ins. */
|
|
183
|
+
export const PANEL_STUBS = {
|
|
184
|
+
UIcon: true,
|
|
185
|
+
UButton,
|
|
186
|
+
UKbd,
|
|
187
|
+
UBadge,
|
|
188
|
+
UModal,
|
|
189
|
+
UDropdownMenu,
|
|
190
|
+
UPopover,
|
|
191
|
+
UInput,
|
|
192
|
+
UTextarea,
|
|
193
|
+
DmsSegmented,
|
|
194
|
+
DmsEmptyState,
|
|
195
|
+
DmsStatusPill: defineComponent({
|
|
196
|
+
props: { label: { type: String, default: "" } },
|
|
197
|
+
setup: (props) => () =>
|
|
198
|
+
h("span", { class: "dms-status-pill" }, props.label),
|
|
199
|
+
}),
|
|
200
|
+
DmsIconWell: true,
|
|
201
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { mount } from "@vue/test-utils";
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
|
+
import DiffView from "../../app/views/DiffView.vue";
|
|
4
|
+
import type { DiffFile } from "../../app/views/types";
|
|
5
|
+
import {
|
|
6
|
+
countLines,
|
|
7
|
+
hunkHeader,
|
|
8
|
+
renderHunks,
|
|
9
|
+
} from "../../app/views/utils/diff";
|
|
10
|
+
|
|
11
|
+
const PAGE_FILE: DiffFile = {
|
|
12
|
+
path: "src/modules/sales/pages/overview.page.ts",
|
|
13
|
+
status: "modified",
|
|
14
|
+
added: 2,
|
|
15
|
+
removed: 1,
|
|
16
|
+
hunks: [
|
|
17
|
+
{
|
|
18
|
+
oldStart: 38,
|
|
19
|
+
newStart: 38,
|
|
20
|
+
lines: [
|
|
21
|
+
{
|
|
22
|
+
kind: "context",
|
|
23
|
+
text: " static revenue = ChartCard();",
|
|
24
|
+
oldLine: 38,
|
|
25
|
+
newLine: 38,
|
|
26
|
+
},
|
|
27
|
+
{ kind: "remove", text: " static latest = TableView();", oldLine: 39 },
|
|
28
|
+
{ kind: "add", text: " static top = TopListCard();", newLine: 39 },
|
|
29
|
+
{ kind: "add", text: " static latest = TableView();", newLine: 40 },
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const NEW_FILE: DiffFile = {
|
|
36
|
+
path: "src/modules/sales/queries/top-customers.ts",
|
|
37
|
+
status: "added",
|
|
38
|
+
hunks: [
|
|
39
|
+
{
|
|
40
|
+
oldStart: 0,
|
|
41
|
+
newStart: 1,
|
|
42
|
+
lines: [{ kind: "add", text: "export const top = 5;", newLine: 1 }],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const STUBS = {
|
|
48
|
+
UIcon: true,
|
|
49
|
+
UButton: {
|
|
50
|
+
props: ["ariaLabel", "icon"],
|
|
51
|
+
emits: ["click"],
|
|
52
|
+
template: `<button :aria-label="ariaLabel" @click="$emit('click')" />`,
|
|
53
|
+
},
|
|
54
|
+
DmsStatusPill: {
|
|
55
|
+
props: ["label"],
|
|
56
|
+
template: `<span data-pill>{{ label }}</span>`,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
function mountDiff(files: DiffFile[]) {
|
|
61
|
+
return mount(DiffView, { props: { files }, global: { stubs: STUBS } });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
beforeEach(() => {
|
|
65
|
+
vi.stubGlobal("useI18n", () => ({
|
|
66
|
+
t: (key: string, params?: Record<string, unknown>) =>
|
|
67
|
+
params?.path ? `${key}:${String(params.path)}` : key,
|
|
68
|
+
}));
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
afterEach(() => {
|
|
72
|
+
vi.unstubAllGlobals();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
describe("diff utils", () => {
|
|
76
|
+
it("writes a unified hunk header from the hunk's lines", () => {
|
|
77
|
+
expect(hunkHeader(PAGE_FILE.hunks[0]!)).toBe("@@ -38,2 +38,3 @@");
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("counts added and removed lines", () => {
|
|
81
|
+
expect(countLines(PAGE_FILE.hunks)).toEqual({ added: 2, removed: 1 });
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("numbers removed lines on the old side and the rest on the new side", () => {
|
|
85
|
+
const lines = renderHunks(PAGE_FILE.hunks);
|
|
86
|
+
expect(lines.map((line) => [line.kind, line.number, line.marker])).toEqual([
|
|
87
|
+
["hunk", "", ""],
|
|
88
|
+
["context", "38", ""],
|
|
89
|
+
["remove", "39", "−"],
|
|
90
|
+
["add", "39", "+"],
|
|
91
|
+
["add", "40", "+"],
|
|
92
|
+
]);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
describe("DiffView", () => {
|
|
97
|
+
it("draws each file with its directory, name and counts", () => {
|
|
98
|
+
const wrapper = mountDiff([PAGE_FILE]);
|
|
99
|
+
const header = wrapper.get("[data-diff-file] header");
|
|
100
|
+
expect(header.text()).toContain("src/modules/sales/pages/");
|
|
101
|
+
expect(header.get("b").text()).toBe("overview.page.ts");
|
|
102
|
+
expect(header.text()).toContain("+2");
|
|
103
|
+
expect(header.text()).toContain("−1");
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("colours lines by kind and keeps their text verbatim", () => {
|
|
107
|
+
const wrapper = mountDiff([PAGE_FILE]);
|
|
108
|
+
const kinds = wrapper
|
|
109
|
+
.findAll("[data-line-kind]")
|
|
110
|
+
.map((row) => row.attributes("data-line-kind"));
|
|
111
|
+
expect(kinds).toEqual(["hunk", "context", "remove", "add", "add"]);
|
|
112
|
+
const removed = wrapper.get('[data-line-kind="remove"]');
|
|
113
|
+
expect(removed.classes().join(" ")).toContain("error");
|
|
114
|
+
expect(removed.findAll("span").at(2)?.text()).toBe(
|
|
115
|
+
"static latest = TableView();",
|
|
116
|
+
);
|
|
117
|
+
expect(wrapper.get('[data-line-kind="add"]').classes().join(" ")).toContain(
|
|
118
|
+
"success",
|
|
119
|
+
);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it("marks a new file and derives its counts from the hunks", () => {
|
|
123
|
+
const wrapper = mountDiff([NEW_FILE]);
|
|
124
|
+
expect(wrapper.get("[data-pill]").text()).toBe("dms_ai.views.diff.new");
|
|
125
|
+
expect(wrapper.get("header").text()).toContain("+1");
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it("collapses and expands a file", async () => {
|
|
129
|
+
const wrapper = mountDiff([PAGE_FILE]);
|
|
130
|
+
expect(wrapper.findAll("[data-line-kind]")).toHaveLength(5);
|
|
131
|
+
await wrapper.get("header button").trigger("click");
|
|
132
|
+
expect(wrapper.findAll("[data-line-kind]")).toHaveLength(0);
|
|
133
|
+
await wrapper.get("header button").trigger("click");
|
|
134
|
+
expect(wrapper.findAll("[data-line-kind]")).toHaveLength(5);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it("says so for a binary file instead of drawing lines", () => {
|
|
138
|
+
const wrapper = mountDiff([
|
|
139
|
+
{
|
|
140
|
+
path: "public/logo.png",
|
|
141
|
+
status: "modified",
|
|
142
|
+
hunks: [],
|
|
143
|
+
isBinary: true,
|
|
144
|
+
},
|
|
145
|
+
]);
|
|
146
|
+
expect(wrapper.text()).toContain("dms_ai.views.diff.binary");
|
|
147
|
+
expect(wrapper.findAll("[data-line-kind]")).toHaveLength(0);
|
|
148
|
+
});
|
|
149
|
+
});
|