@codemieai/code 0.0.36 → 0.0.38
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 +33 -0
- package/dist/agents/codemie-code/tools/assistant-invocation.d.ts.map +1 -1
- package/dist/agents/codemie-code/tools/assistant-invocation.js +2 -2
- package/dist/agents/codemie-code/tools/assistant-invocation.js.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.js +23 -9
- package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
- package/dist/agents/core/extension/BaseExtensionInstaller.d.ts.map +1 -1
- package/dist/agents/core/extension/BaseExtensionInstaller.js +11 -4
- package/dist/agents/core/extension/BaseExtensionInstaller.js.map +1 -1
- package/dist/agents/core/session/BaseProcessor.d.ts +22 -1
- package/dist/agents/core/session/BaseProcessor.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude-acp.plugin.d.ts +5 -0
- package/dist/agents/plugins/claude/claude-acp.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude-acp.plugin.js +12 -2
- package/dist/agents/plugins/claude/claude-acp.plugin.js.map +1 -1
- package/dist/agents/plugins/claude/claude.plugin.d.ts +11 -0
- package/dist/agents/plugins/claude/claude.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude.plugin.js +59 -2
- package/dist/agents/plugins/claude/claude.plugin.js.map +1 -1
- package/dist/agents/plugins/claude/claude.session.d.ts +5 -0
- package/dist/agents/plugins/claude/claude.session.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude.session.js +101 -2
- package/dist/agents/plugins/claude/claude.session.js.map +1 -1
- package/dist/agents/plugins/claude/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/agents/plugins/claude/plugin/commands/README.md +103 -22
- package/dist/agents/plugins/claude/plugin/commands/memory-refresh.md +329 -18
- package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.d.ts +0 -1
- package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.d.ts.map +1 -1
- package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.js +13 -19
- package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.js.map +1 -1
- package/dist/agents/plugins/claude/session/processors/claude.metrics-processor.d.ts.map +1 -1
- package/dist/agents/plugins/claude/session/processors/claude.metrics-processor.js +29 -4
- package/dist/agents/plugins/claude/session/processors/claude.metrics-processor.js.map +1 -1
- package/dist/cli/commands/assistants/chat.js +9 -6
- package/dist/cli/commands/assistants/chat.js.map +1 -1
- package/dist/cli/commands/assistants/constants.d.ts +2 -6
- package/dist/cli/commands/assistants/constants.d.ts.map +1 -1
- package/dist/cli/commands/assistants/constants.js +2 -5
- package/dist/cli/commands/assistants/constants.js.map +1 -1
- package/dist/cli/commands/assistants/index.d.ts.map +1 -1
- package/dist/cli/commands/assistants/index.js +1 -11
- package/dist/cli/commands/assistants/index.js.map +1 -1
- package/dist/cli/commands/assistants/setup/configuration/actions.d.ts +30 -0
- package/dist/cli/commands/assistants/setup/configuration/actions.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/actions.js +63 -0
- package/dist/cli/commands/assistants/setup/configuration/actions.js.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/constants.d.ts +49 -0
- package/dist/cli/commands/assistants/setup/configuration/constants.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/constants.js +56 -0
- package/dist/cli/commands/assistants/setup/configuration/constants.js.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/index.d.ts +9 -0
- package/dist/cli/commands/assistants/setup/configuration/index.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/index.js +8 -0
- package/dist/cli/commands/assistants/setup/configuration/index.js.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/selection.d.ts +12 -0
- package/dist/cli/commands/assistants/setup/configuration/selection.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/selection.js +94 -0
- package/dist/cli/commands/assistants/setup/configuration/selection.js.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/types.d.ts +22 -0
- package/dist/cli/commands/assistants/setup/configuration/types.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/types.js +2 -0
- package/dist/cli/commands/assistants/setup/configuration/types.js.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/ui.d.ts +9 -0
- package/dist/cli/commands/assistants/setup/configuration/ui.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/ui.js +86 -0
- package/dist/cli/commands/assistants/setup/configuration/ui.js.map +1 -0
- package/dist/cli/commands/assistants/setup/constants.d.ts +26 -0
- package/dist/cli/commands/assistants/setup/constants.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/constants.js +21 -0
- package/dist/cli/commands/assistants/setup/constants.js.map +1 -0
- package/dist/cli/commands/assistants/setup/data.d.ts +30 -0
- package/dist/cli/commands/assistants/setup/data.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/data.js +125 -0
- package/dist/cli/commands/assistants/setup/data.js.map +1 -0
- package/dist/cli/commands/assistants/setup/generators/claude-agent-generator.d.ts.map +1 -0
- package/dist/cli/commands/assistants/{generators → setup/generators}/claude-agent-generator.js +6 -2
- package/dist/cli/commands/assistants/setup/generators/claude-agent-generator.js.map +1 -0
- package/dist/cli/commands/assistants/setup/generators/claude-skill-generator.d.ts +12 -0
- package/dist/cli/commands/assistants/setup/generators/claude-skill-generator.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/generators/claude-skill-generator.js +94 -0
- package/dist/cli/commands/assistants/setup/generators/claude-skill-generator.js.map +1 -0
- package/dist/cli/commands/assistants/setup/helpers.d.ts +27 -0
- package/dist/cli/commands/assistants/setup/helpers.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/helpers.js +94 -0
- package/dist/cli/commands/assistants/setup/helpers.js.map +1 -0
- package/dist/cli/commands/assistants/setup/index.d.ts +17 -0
- package/dist/cli/commands/assistants/setup/index.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/index.js +193 -0
- package/dist/cli/commands/assistants/setup/index.js.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/actions.d.ts +47 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/actions.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/actions.js +140 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/actions.js.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/constants.d.ts +56 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/constants.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/constants.js +61 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/constants.js.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/index.d.ts +12 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/index.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/index.js +48 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/index.js.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/interactive-prompt.d.ts +6 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/interactive-prompt.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/interactive-prompt.js +90 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/interactive-prompt.js.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/types.d.ts +37 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/types.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/types.js +2 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/types.js.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/ui.d.ts +6 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/ui.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/ui.js +103 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/ui.js.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/actions.d.ts +31 -0
- package/dist/cli/commands/assistants/setup/selection/actions.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/actions.js +321 -0
- package/dist/cli/commands/assistants/setup/selection/actions.js.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/constants.d.ts +79 -0
- package/dist/cli/commands/assistants/setup/selection/constants.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/constants.js +90 -0
- package/dist/cli/commands/assistants/setup/selection/constants.js.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/index.d.ts +25 -0
- package/dist/cli/commands/assistants/setup/selection/index.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/index.js +127 -0
- package/dist/cli/commands/assistants/setup/selection/index.js.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/interactive-prompt.d.ts +20 -0
- package/dist/cli/commands/assistants/setup/selection/interactive-prompt.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/interactive-prompt.js +328 -0
- package/dist/cli/commands/assistants/setup/selection/interactive-prompt.js.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/types.d.ts +27 -0
- package/dist/cli/commands/assistants/setup/selection/types.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/types.js +2 -0
- package/dist/cli/commands/assistants/setup/selection/types.js.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/ui.d.ts +11 -0
- package/dist/cli/commands/assistants/setup/selection/ui.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/ui.js +189 -0
- package/dist/cli/commands/assistants/setup/selection/ui.js.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/utils.d.ts +36 -0
- package/dist/cli/commands/assistants/setup/selection/utils.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/utils.js +55 -0
- package/dist/cli/commands/assistants/setup/selection/utils.js.map +1 -0
- package/dist/cli/commands/assistants/setup/summary/index.d.ts +16 -0
- package/dist/cli/commands/assistants/setup/summary/index.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/summary/index.js +48 -0
- package/dist/cli/commands/assistants/setup/summary/index.js.map +1 -0
- package/dist/cli/commands/hook.d.ts +72 -0
- package/dist/cli/commands/hook.d.ts.map +1 -1
- package/dist/cli/commands/hook.js +290 -110
- package/dist/cli/commands/hook.js.map +1 -1
- package/dist/cli/commands/log/cleaner.d.ts +37 -0
- package/dist/cli/commands/log/cleaner.d.ts.map +1 -0
- package/dist/cli/commands/log/cleaner.js +218 -0
- package/dist/cli/commands/log/cleaner.js.map +1 -0
- package/dist/cli/commands/log/filter.d.ts +55 -0
- package/dist/cli/commands/log/filter.d.ts.map +1 -0
- package/dist/cli/commands/log/filter.js +128 -0
- package/dist/cli/commands/log/filter.js.map +1 -0
- package/dist/cli/commands/log/follower.d.ts +36 -0
- package/dist/cli/commands/log/follower.d.ts.map +1 -0
- package/dist/cli/commands/log/follower.js +151 -0
- package/dist/cli/commands/log/follower.js.map +1 -0
- package/dist/cli/commands/log/formatter.d.ts +76 -0
- package/dist/cli/commands/log/formatter.d.ts.map +1 -0
- package/dist/cli/commands/log/formatter.js +261 -0
- package/dist/cli/commands/log/formatter.js.map +1 -0
- package/dist/cli/commands/log/index.d.ts +6 -0
- package/dist/cli/commands/log/index.d.ts.map +1 -0
- package/dist/cli/commands/log/index.js +400 -0
- package/dist/cli/commands/log/index.js.map +1 -0
- package/dist/cli/commands/log/parser.d.ts +20 -0
- package/dist/cli/commands/log/parser.d.ts.map +1 -0
- package/dist/cli/commands/log/parser.js +111 -0
- package/dist/cli/commands/log/parser.js.map +1 -0
- package/dist/cli/commands/log/reader.d.ts +66 -0
- package/dist/cli/commands/log/reader.d.ts.map +1 -0
- package/dist/cli/commands/log/reader.js +364 -0
- package/dist/cli/commands/log/reader.js.map +1 -0
- package/dist/cli/commands/log/types.d.ts +100 -0
- package/dist/cli/commands/log/types.d.ts.map +1 -0
- package/dist/cli/commands/log/types.js +5 -0
- package/dist/cli/commands/log/types.js.map +1 -0
- package/dist/cli/commands/profile/display.d.ts +1 -0
- package/dist/cli/commands/profile/display.d.ts.map +1 -1
- package/dist/cli/commands/profile/display.js +10 -2
- package/dist/cli/commands/profile/display.js.map +1 -1
- package/dist/cli/commands/profile/index.js +58 -22
- package/dist/cli/commands/profile/index.js.map +1 -1
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +143 -24
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/env/types.d.ts +10 -1
- package/dist/env/types.d.ts.map +1 -1
- package/dist/env/types.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/providers/plugins/sso/session/SessionSyncer.d.ts +5 -0
- package/dist/providers/plugins/sso/session/SessionSyncer.d.ts.map +1 -1
- package/dist/providers/plugins/sso/session/SessionSyncer.js +102 -3
- package/dist/providers/plugins/sso/session/SessionSyncer.js.map +1 -1
- package/dist/providers/plugins/sso/session/processors/conversations/conversation-sync-processor.d.ts +0 -1
- package/dist/providers/plugins/sso/session/processors/conversations/conversation-sync-processor.d.ts.map +1 -1
- package/dist/providers/plugins/sso/session/processors/conversations/conversation-sync-processor.js +25 -48
- package/dist/providers/plugins/sso/session/processors/conversations/conversation-sync-processor.js.map +1 -1
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-sync-processor.d.ts.map +1 -1
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-sync-processor.js +8 -34
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-sync-processor.js.map +1 -1
- package/dist/utils/config.d.ts +35 -8
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +243 -33
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/logger.d.ts +8 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +42 -0
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/native-installer.d.ts +1 -0
- package/dist/utils/native-installer.d.ts.map +1 -1
- package/dist/utils/native-installer.js +21 -7
- package/dist/utils/native-installer.js.map +1 -1
- package/package.json +2 -2
- package/dist/agents/plugins/claude/plugin/commands/memory-add.md +0 -325
- package/dist/agents/plugins/claude/plugin/commands/memory-init.md +0 -18
- package/dist/cli/commands/assistants/generators/claude-agent-generator.d.ts.map +0 -1
- package/dist/cli/commands/assistants/generators/claude-agent-generator.js.map +0 -1
- package/dist/cli/commands/assistants/list.d.ts +0 -11
- package/dist/cli/commands/assistants/list.d.ts.map +0 -1
- package/dist/cli/commands/assistants/list.js +0 -323
- package/dist/cli/commands/assistants/list.js.map +0 -1
- /package/dist/cli/commands/assistants/{generators → setup/generators}/claude-agent-generator.d.ts +0 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action Handlers
|
|
3
|
+
*
|
|
4
|
+
* All user interaction handlers for the selection UI
|
|
5
|
+
*/
|
|
6
|
+
import { PANEL_IDS, CONFIG, PAGINATION_CONTROL } from './constants.js';
|
|
7
|
+
import { logger } from '../../../../../utils/logger.js';
|
|
8
|
+
export function createActionHandlers(deps) {
|
|
9
|
+
/**
|
|
10
|
+
* Rotate panel index in the given direction
|
|
11
|
+
*/
|
|
12
|
+
function rotatePanelIndex(direction) {
|
|
13
|
+
const currentIndex = PANEL_IDS.indexOf(deps.state.activePanelId);
|
|
14
|
+
const offset = direction === 'next' ? 1 : -1;
|
|
15
|
+
const nextIndex = (currentIndex + offset + PANEL_IDS.length) % PANEL_IDS.length;
|
|
16
|
+
return PANEL_IDS[nextIndex];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Set active panel and update all panel states
|
|
20
|
+
*/
|
|
21
|
+
function setActivePanel(panelId) {
|
|
22
|
+
deps.state.activePanelId = panelId;
|
|
23
|
+
deps.state.panels.forEach(panel => {
|
|
24
|
+
panel.isActive = panel.id === deps.state.activePanelId;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Fetch data for active panel with current search query
|
|
29
|
+
*/
|
|
30
|
+
async function fetchActivePanelData() {
|
|
31
|
+
const activePanel = deps.state.panels.find(p => p.id === deps.state.activePanelId);
|
|
32
|
+
activePanel.isFetching = true;
|
|
33
|
+
activePanel.error = null;
|
|
34
|
+
let timeoutId = null;
|
|
35
|
+
try {
|
|
36
|
+
const fetchPromise = deps.fetcher.fetchAssistants({
|
|
37
|
+
scope: deps.state.activePanelId,
|
|
38
|
+
searchQuery: deps.state.searchQuery,
|
|
39
|
+
page: activePanel.currentPage
|
|
40
|
+
});
|
|
41
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
42
|
+
timeoutId = setTimeout(() => reject(new Error(`Fetch timeout after ${CONFIG.FETCH_TIMEOUT_MS / 1000} seconds`)), CONFIG.FETCH_TIMEOUT_MS);
|
|
43
|
+
});
|
|
44
|
+
const result = await Promise.race([fetchPromise, timeoutPromise]);
|
|
45
|
+
if (timeoutId) {
|
|
46
|
+
clearTimeout(timeoutId);
|
|
47
|
+
timeoutId = null;
|
|
48
|
+
}
|
|
49
|
+
activePanel.data = result.data;
|
|
50
|
+
activePanel.filteredData = result.data;
|
|
51
|
+
activePanel.totalItems = result.total;
|
|
52
|
+
activePanel.totalPages = result.pages;
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
if (timeoutId) {
|
|
56
|
+
clearTimeout(timeoutId);
|
|
57
|
+
timeoutId = null;
|
|
58
|
+
}
|
|
59
|
+
activePanel.error = error instanceof Error ? error.message : 'Unknown error';
|
|
60
|
+
activePanel.data = [];
|
|
61
|
+
activePanel.filteredData = [];
|
|
62
|
+
activePanel.totalItems = 0;
|
|
63
|
+
activePanel.totalPages = 0;
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
activePanel.isFetching = false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Fetch data in background without blocking
|
|
71
|
+
*/
|
|
72
|
+
function fetchActivePanelDataBackground() {
|
|
73
|
+
fetchActivePanelData()
|
|
74
|
+
.then(() => {
|
|
75
|
+
const prompt = deps.prompt();
|
|
76
|
+
if (prompt) {
|
|
77
|
+
prompt.render();
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
.catch((error) => {
|
|
81
|
+
console.error('Error fetching panel data:', error);
|
|
82
|
+
const prompt = deps.prompt();
|
|
83
|
+
if (prompt) {
|
|
84
|
+
prompt.render();
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Handle panel switch (Tab/Shift+Tab or arrow keys)
|
|
90
|
+
*/
|
|
91
|
+
function handlePanelSwitch(direction) {
|
|
92
|
+
const newPanelId = rotatePanelIndex(direction);
|
|
93
|
+
setActivePanel(newPanelId);
|
|
94
|
+
const activePanel = deps.state.panels.find(p => p.id === deps.state.activePanelId);
|
|
95
|
+
activePanel.currentPage = 0;
|
|
96
|
+
deps.state.isPaginationFocused = null;
|
|
97
|
+
setTimeout(() => fetchActivePanelDataBackground(), 0);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Handle search update (live typing)
|
|
101
|
+
*/
|
|
102
|
+
function handleSearchUpdate(query) {
|
|
103
|
+
deps.state.searchQuery = query;
|
|
104
|
+
const activePanel = deps.state.panels.find(p => p.id === deps.state.activePanelId);
|
|
105
|
+
activePanel.currentPage = 0;
|
|
106
|
+
deps.state.isPaginationFocused = null;
|
|
107
|
+
setTimeout(() => fetchActivePanelDataBackground(), 0);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Handle focus moving to search box
|
|
111
|
+
*/
|
|
112
|
+
function handleFocusSearch() {
|
|
113
|
+
deps.state.isSearchFocused = true;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Handle focus moving to list
|
|
117
|
+
*/
|
|
118
|
+
function handleFocusList() {
|
|
119
|
+
deps.state.isSearchFocused = false;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Handle cursor movement (Up/Down arrows)
|
|
123
|
+
*/
|
|
124
|
+
function handleCursorMove(direction) {
|
|
125
|
+
const prompt = deps.prompt();
|
|
126
|
+
if (!prompt)
|
|
127
|
+
return;
|
|
128
|
+
const activePanel = deps.state.panels.find(p => p.id === deps.state.activePanelId);
|
|
129
|
+
const totalPages = activePanel.totalPages;
|
|
130
|
+
const hasPaginationControls = totalPages > 1;
|
|
131
|
+
const maxIndex = activePanel.filteredData.length - 1;
|
|
132
|
+
const currentIndex = prompt.getCursorIndex();
|
|
133
|
+
if (direction === 'up') {
|
|
134
|
+
if (deps.state.areNavigationButtonsFocused) {
|
|
135
|
+
// Move from buttons to pagination (if exists) or last list item
|
|
136
|
+
deps.state.areNavigationButtonsFocused = false;
|
|
137
|
+
if (hasPaginationControls) {
|
|
138
|
+
deps.state.isPaginationFocused = PAGINATION_CONTROL.NEXT;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
prompt.setCursorIndex(maxIndex);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else if (deps.state.isPaginationFocused !== null) {
|
|
145
|
+
deps.state.isPaginationFocused = null;
|
|
146
|
+
prompt.setCursorIndex(maxIndex);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
const newIndex = Math.max(0, currentIndex - 1);
|
|
150
|
+
prompt.setCursorIndex(newIndex);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
if (deps.state.isPaginationFocused === PAGINATION_CONTROL.NEXT) {
|
|
155
|
+
// Move from pagination to buttons
|
|
156
|
+
deps.state.isPaginationFocused = null;
|
|
157
|
+
deps.state.areNavigationButtonsFocused = true;
|
|
158
|
+
deps.state.focusedButton = 'continue';
|
|
159
|
+
}
|
|
160
|
+
else if (currentIndex === maxIndex && hasPaginationControls && deps.state.isPaginationFocused === null) {
|
|
161
|
+
deps.state.isPaginationFocused = PAGINATION_CONTROL.PREV;
|
|
162
|
+
}
|
|
163
|
+
else if (deps.state.isPaginationFocused === PAGINATION_CONTROL.PREV) {
|
|
164
|
+
deps.state.isPaginationFocused = PAGINATION_CONTROL.NEXT;
|
|
165
|
+
}
|
|
166
|
+
else if (currentIndex === maxIndex && !hasPaginationControls && !deps.state.areNavigationButtonsFocused) {
|
|
167
|
+
// Move from last list item to buttons (no pagination)
|
|
168
|
+
deps.state.areNavigationButtonsFocused = true;
|
|
169
|
+
deps.state.focusedButton = 'continue';
|
|
170
|
+
}
|
|
171
|
+
else if (deps.state.isPaginationFocused === null && !deps.state.areNavigationButtonsFocused) {
|
|
172
|
+
const newIndex = Math.min(maxIndex, currentIndex + 1);
|
|
173
|
+
prompt.setCursorIndex(newIndex);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function handleToggleSelection() {
|
|
178
|
+
const prompt = deps.prompt();
|
|
179
|
+
if (!prompt)
|
|
180
|
+
return;
|
|
181
|
+
if (deps.state.isPaginationFocused === PAGINATION_CONTROL.PREV) {
|
|
182
|
+
handlePagePrev();
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
else if (deps.state.isPaginationFocused === PAGINATION_CONTROL.NEXT) {
|
|
186
|
+
handlePageNext();
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const activePanel = deps.state.panels.find(p => p.id === deps.state.activePanelId);
|
|
190
|
+
const cursorIndex = prompt.getCursorIndex();
|
|
191
|
+
if (cursorIndex >= 0 && cursorIndex < activePanel.filteredData.length) {
|
|
192
|
+
const assistant = activePanel.filteredData[cursorIndex];
|
|
193
|
+
if (deps.state.selectedIds.has(assistant.id)) {
|
|
194
|
+
deps.state.selectedIds.delete(assistant.id);
|
|
195
|
+
logger.debug('[AssistantSelection] Deselected assistant', {
|
|
196
|
+
id: assistant.id,
|
|
197
|
+
name: assistant.name,
|
|
198
|
+
panel: deps.state.activePanelId,
|
|
199
|
+
totalSelected: deps.state.selectedIds.size
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
deps.state.selectedIds.add(assistant.id);
|
|
204
|
+
logger.debug('[AssistantSelection] Selected assistant', {
|
|
205
|
+
id: assistant.id,
|
|
206
|
+
name: assistant.name,
|
|
207
|
+
panel: deps.state.activePanelId,
|
|
208
|
+
totalSelected: deps.state.selectedIds.size
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Handle confirm (Enter key)
|
|
215
|
+
*/
|
|
216
|
+
function handleConfirm() {
|
|
217
|
+
// Check if buttons are focused
|
|
218
|
+
if (deps.state.areNavigationButtonsFocused) {
|
|
219
|
+
if (deps.state.focusedButton === 'continue') {
|
|
220
|
+
logger.debug('[AssistantSelection] Confirming selection via Continue button', {
|
|
221
|
+
totalSelected: deps.state.selectedIds.size,
|
|
222
|
+
selectedIds: Array.from(deps.state.selectedIds)
|
|
223
|
+
});
|
|
224
|
+
deps.setCancelled(false);
|
|
225
|
+
const prompt = deps.prompt();
|
|
226
|
+
if (prompt) {
|
|
227
|
+
prompt.stop();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
// Cancel button
|
|
232
|
+
handleCancel();
|
|
233
|
+
}
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
// Default: confirm from list
|
|
237
|
+
logger.debug('[AssistantSelection] Confirming selection', {
|
|
238
|
+
totalSelected: deps.state.selectedIds.size,
|
|
239
|
+
selectedIds: Array.from(deps.state.selectedIds)
|
|
240
|
+
});
|
|
241
|
+
deps.setCancelled(false);
|
|
242
|
+
const prompt = deps.prompt();
|
|
243
|
+
if (prompt) {
|
|
244
|
+
prompt.stop();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Handle cancel (Esc key)
|
|
249
|
+
*/
|
|
250
|
+
function handleCancel() {
|
|
251
|
+
deps.setCancelled(true);
|
|
252
|
+
const prompt = deps.prompt();
|
|
253
|
+
if (prompt) {
|
|
254
|
+
prompt.stop();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Handle page next (PgDn or Next button)
|
|
259
|
+
*/
|
|
260
|
+
function handlePageNext() {
|
|
261
|
+
const activePanel = deps.state.panels.find(p => p.id === deps.state.activePanelId);
|
|
262
|
+
const totalPages = activePanel.totalPages;
|
|
263
|
+
if (activePanel.currentPage < totalPages - 1) {
|
|
264
|
+
activePanel.currentPage++;
|
|
265
|
+
setTimeout(() => fetchActivePanelDataBackground(), 0);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Handle page previous (PgUp or Prev button)
|
|
270
|
+
*/
|
|
271
|
+
function handlePagePrev() {
|
|
272
|
+
const activePanel = deps.state.panels.find(p => p.id === deps.state.activePanelId);
|
|
273
|
+
if (activePanel.currentPage > 0) {
|
|
274
|
+
activePanel.currentPage--;
|
|
275
|
+
setTimeout(() => fetchActivePanelDataBackground(), 0);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Handle toggling button focus (Tab)
|
|
280
|
+
*/
|
|
281
|
+
function handleButtonToggle() {
|
|
282
|
+
if (deps.state.areNavigationButtonsFocused) {
|
|
283
|
+
// Move back to list
|
|
284
|
+
deps.state.areNavigationButtonsFocused = false;
|
|
285
|
+
const prompt = deps.prompt();
|
|
286
|
+
if (prompt) {
|
|
287
|
+
prompt.setCursorIndex(0);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
// Move to buttons
|
|
292
|
+
deps.state.areNavigationButtonsFocused = true;
|
|
293
|
+
deps.state.isPaginationFocused = null;
|
|
294
|
+
deps.state.focusedButton = 'continue';
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Handle switching between buttons (left/right arrows when buttons focused)
|
|
299
|
+
*/
|
|
300
|
+
function handleButtonSwitch(_direction) {
|
|
301
|
+
if (deps.state.areNavigationButtonsFocused) {
|
|
302
|
+
// Toggle between Continue and Cancel buttons
|
|
303
|
+
deps.state.focusedButton = deps.state.focusedButton === 'continue' ? 'cancel' : 'continue';
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return {
|
|
307
|
+
handlePanelSwitch,
|
|
308
|
+
handleSearchUpdate,
|
|
309
|
+
handleFocusSearch,
|
|
310
|
+
handleFocusList,
|
|
311
|
+
handleCursorMove,
|
|
312
|
+
handleToggleSelection,
|
|
313
|
+
handleConfirm,
|
|
314
|
+
handleCancel,
|
|
315
|
+
handlePageNext,
|
|
316
|
+
handlePagePrev,
|
|
317
|
+
handleButtonToggle,
|
|
318
|
+
handleButtonSwitch
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/selection/actions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,kBAAkB,EAAgB,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAyB3C,MAAM,UAAU,oBAAoB,CAAC,IAA+B;IAClE;;OAEG;IACH,SAAS,gBAAgB,CAAC,SAA0B;QAClD,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACjE,MAAM,MAAM,GAAG,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7C,MAAM,SAAS,GAAG,CAAC,YAAY,GAAG,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC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
*/
|
|
6
|
+
export declare const ANSI: {
|
|
7
|
+
readonly CURSOR_HOME_CLEAR: "\u001B[H\u001B[J";
|
|
8
|
+
readonly CLEAR_LINE_ABOVE: "\u001B[1A\u001B[2K";
|
|
9
|
+
};
|
|
10
|
+
export declare const KEY: {
|
|
11
|
+
readonly CTRL_C: "\u0003";
|
|
12
|
+
readonly ESC: "\u001B";
|
|
13
|
+
readonly TAB: "\t";
|
|
14
|
+
readonly SHIFT_TAB: "\u001B[Z";
|
|
15
|
+
readonly ENTER: "\r";
|
|
16
|
+
readonly NEWLINE: "\n";
|
|
17
|
+
readonly ARROW_UP: "\u001B[A";
|
|
18
|
+
readonly ARROW_DOWN: "\u001B[B";
|
|
19
|
+
readonly ARROW_LEFT: "\u001B[D";
|
|
20
|
+
readonly ARROW_RIGHT: "\u001B[C";
|
|
21
|
+
readonly CTRL_BRACKET_LEFT: "\u001B";
|
|
22
|
+
readonly CTRL_BRACKET_RIGHT: "\u001D";
|
|
23
|
+
readonly SPACE: " ";
|
|
24
|
+
readonly BACKSPACE: "";
|
|
25
|
+
readonly BACKSPACE_ALT: "\b";
|
|
26
|
+
};
|
|
27
|
+
export declare const BOX: {
|
|
28
|
+
readonly TOP_LEFT: "╭";
|
|
29
|
+
readonly TOP_RIGHT: "╮";
|
|
30
|
+
readonly BOTTOM_LEFT: "╰";
|
|
31
|
+
readonly BOTTOM_RIGHT: "╯";
|
|
32
|
+
readonly HORIZONTAL: "─";
|
|
33
|
+
readonly VERTICAL: "│";
|
|
34
|
+
};
|
|
35
|
+
export declare const SYMBOL: {
|
|
36
|
+
readonly SEARCH_ICON: "⌕";
|
|
37
|
+
readonly CURSOR: "█";
|
|
38
|
+
readonly CIRCLE_FILLED: "◉";
|
|
39
|
+
readonly CIRCLE_EMPTY: "◯";
|
|
40
|
+
readonly CURSOR_INDICATOR: "› ";
|
|
41
|
+
readonly TRUNCATION: "...";
|
|
42
|
+
};
|
|
43
|
+
export declare const PAGINATION_CONTROL: {
|
|
44
|
+
readonly PREV: "prev";
|
|
45
|
+
readonly NEXT: "next";
|
|
46
|
+
};
|
|
47
|
+
export type PaginationControl = typeof PAGINATION_CONTROL[keyof typeof PAGINATION_CONTROL];
|
|
48
|
+
export declare const TEXT: {
|
|
49
|
+
readonly LABEL: "Assistants";
|
|
50
|
+
readonly TAB_HINT: "(←/→, tab/shift+tab to cycle)";
|
|
51
|
+
readonly SEARCH_PLACEHOLDER: "Search…";
|
|
52
|
+
readonly INSTRUCTIONS: "↑↓ to Navigate • Space to select item • Enter to Confirm";
|
|
53
|
+
readonly INSTRUCTIONS_WITH_PAGINATION: "↑↓ to Navigate • Ctrl+[/] to change page • Space to select item • Enter to Confirm";
|
|
54
|
+
readonly NO_ASSISTANTS: "No assistants found.";
|
|
55
|
+
readonly ERROR_PREFIX: "Error: ";
|
|
56
|
+
readonly CONTINUE_BUTTON: "Continue";
|
|
57
|
+
readonly CANCEL_BUTTON: "Cancel";
|
|
58
|
+
};
|
|
59
|
+
export declare const CONFIG: {
|
|
60
|
+
readonly ITEMS_PER_PAGE: 5;
|
|
61
|
+
readonly FETCH_TIMEOUT_MS: 10000;
|
|
62
|
+
readonly DESCRIPTION_MAX_LENGTH: 80;
|
|
63
|
+
readonly KEEP_ALIVE_INTERVAL_MS: 1000;
|
|
64
|
+
readonly SEARCH_DEBOUNCE_MS: 500;
|
|
65
|
+
readonly PRINTABLE_CHAR_MIN: 32;
|
|
66
|
+
readonly PRINTABLE_CHAR_MAX: 126;
|
|
67
|
+
};
|
|
68
|
+
export declare const PANEL_ID: {
|
|
69
|
+
readonly REGISTERED: "registered";
|
|
70
|
+
readonly PROJECT: "project";
|
|
71
|
+
readonly MARKETPLACE: "marketplace";
|
|
72
|
+
};
|
|
73
|
+
export declare const PANEL_IDS: readonly ["registered", "project", "marketplace"];
|
|
74
|
+
export type PanelId = typeof PANEL_IDS[number];
|
|
75
|
+
export declare const API_SCOPE: {
|
|
76
|
+
readonly VISIBLE_TO_USER: "visible_to_user";
|
|
77
|
+
readonly MARKETPLACE: "marketplace";
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/selection/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,eAAO,MAAM,IAAI;;;CAGP,CAAC;AAGX,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;CAgBN,CAAC;AAGX,eAAO,MAAM,GAAG;;;;;;;CAON,CAAC;AAGX,eAAO,MAAM,MAAM;;;;;;;CAOT,CAAC;AAGX,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,OAAO,kBAAkB,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAG3F,eAAO,MAAM,IAAI;;;;;;;;;;CAUP,CAAC;AAGX,eAAO,MAAM,MAAM;;;;;;;;CAQT,CAAC;AAGX,eAAO,MAAM,QAAQ;;;;CAIX,CAAC;AAEX,eAAO,MAAM,SAAS,mDAIZ,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;AAG/C,eAAO,MAAM,SAAS;;;CAGZ,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI Constants
|
|
3
|
+
*
|
|
4
|
+
* All magic strings, ANSI codes, and configuration values for the selection UI
|
|
5
|
+
*/
|
|
6
|
+
// ANSI Escape Codes
|
|
7
|
+
export const ANSI = {
|
|
8
|
+
CURSOR_HOME_CLEAR: '\x1b[H\x1b[J',
|
|
9
|
+
CLEAR_LINE_ABOVE: '\x1b[1A\x1b[2K',
|
|
10
|
+
};
|
|
11
|
+
// Key Codes
|
|
12
|
+
export const KEY = {
|
|
13
|
+
CTRL_C: '\u0003',
|
|
14
|
+
ESC: '\u001b',
|
|
15
|
+
TAB: '\t',
|
|
16
|
+
SHIFT_TAB: '\u001b[Z',
|
|
17
|
+
ENTER: '\r',
|
|
18
|
+
NEWLINE: '\n',
|
|
19
|
+
ARROW_UP: '\u001b[A',
|
|
20
|
+
ARROW_DOWN: '\u001b[B',
|
|
21
|
+
ARROW_LEFT: '\u001b[D',
|
|
22
|
+
ARROW_RIGHT: '\u001b[C',
|
|
23
|
+
CTRL_BRACKET_LEFT: '\u001b',
|
|
24
|
+
CTRL_BRACKET_RIGHT: '\u001d',
|
|
25
|
+
SPACE: ' ',
|
|
26
|
+
BACKSPACE: '\u007f',
|
|
27
|
+
BACKSPACE_ALT: '\b',
|
|
28
|
+
};
|
|
29
|
+
// Box Drawing Characters
|
|
30
|
+
export const BOX = {
|
|
31
|
+
TOP_LEFT: '╭',
|
|
32
|
+
TOP_RIGHT: '╮',
|
|
33
|
+
BOTTOM_LEFT: '╰',
|
|
34
|
+
BOTTOM_RIGHT: '╯',
|
|
35
|
+
HORIZONTAL: '─',
|
|
36
|
+
VERTICAL: '│',
|
|
37
|
+
};
|
|
38
|
+
// UI Symbols
|
|
39
|
+
export const SYMBOL = {
|
|
40
|
+
SEARCH_ICON: '⌕',
|
|
41
|
+
CURSOR: '█',
|
|
42
|
+
CIRCLE_FILLED: '◉',
|
|
43
|
+
CIRCLE_EMPTY: '◯',
|
|
44
|
+
CURSOR_INDICATOR: '› ',
|
|
45
|
+
TRUNCATION: '...',
|
|
46
|
+
};
|
|
47
|
+
// Pagination Controls
|
|
48
|
+
export const PAGINATION_CONTROL = {
|
|
49
|
+
PREV: 'prev',
|
|
50
|
+
NEXT: 'next',
|
|
51
|
+
};
|
|
52
|
+
// UI Text
|
|
53
|
+
export const TEXT = {
|
|
54
|
+
LABEL: 'Assistants',
|
|
55
|
+
TAB_HINT: '(←/→, tab/shift+tab to cycle)',
|
|
56
|
+
SEARCH_PLACEHOLDER: 'Search…',
|
|
57
|
+
INSTRUCTIONS: '↑↓ to Navigate • Space to select item • Enter to Confirm',
|
|
58
|
+
INSTRUCTIONS_WITH_PAGINATION: '↑↓ to Navigate • Ctrl+[/] to change page • Space to select item • Enter to Confirm',
|
|
59
|
+
NO_ASSISTANTS: 'No assistants found.',
|
|
60
|
+
ERROR_PREFIX: 'Error: ',
|
|
61
|
+
CONTINUE_BUTTON: 'Continue',
|
|
62
|
+
CANCEL_BUTTON: 'Cancel',
|
|
63
|
+
};
|
|
64
|
+
// Config Values
|
|
65
|
+
export const CONFIG = {
|
|
66
|
+
ITEMS_PER_PAGE: 5,
|
|
67
|
+
FETCH_TIMEOUT_MS: 10000,
|
|
68
|
+
DESCRIPTION_MAX_LENGTH: 80,
|
|
69
|
+
KEEP_ALIVE_INTERVAL_MS: 1000,
|
|
70
|
+
SEARCH_DEBOUNCE_MS: 500,
|
|
71
|
+
PRINTABLE_CHAR_MIN: 32,
|
|
72
|
+
PRINTABLE_CHAR_MAX: 126,
|
|
73
|
+
};
|
|
74
|
+
// Panel IDs
|
|
75
|
+
export const PANEL_ID = {
|
|
76
|
+
REGISTERED: 'registered',
|
|
77
|
+
PROJECT: 'project',
|
|
78
|
+
MARKETPLACE: 'marketplace'
|
|
79
|
+
};
|
|
80
|
+
export const PANEL_IDS = [
|
|
81
|
+
PANEL_ID.REGISTERED,
|
|
82
|
+
PANEL_ID.PROJECT,
|
|
83
|
+
PANEL_ID.MARKETPLACE
|
|
84
|
+
];
|
|
85
|
+
// API Scope values (from SDK)
|
|
86
|
+
export const API_SCOPE = {
|
|
87
|
+
VISIBLE_TO_USER: 'visible_to_user',
|
|
88
|
+
MARKETPLACE: 'marketplace'
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/selection/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,oBAAoB;AACpB,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,iBAAiB,EAAE,cAA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eAAe,EAAE,UAAU;IAC3B,aAAa,EAAE,QAAQ;CACf,CAAC;AAEX,gBAAgB;AAChB,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,cAAc,EAAE,CAAC;IACjB,gBAAgB,EAAE,KAAK;IACvB,sBAAsB,EAAE,EAAE;IAC1B,sBAAsB,EAAE,IAAI;IAC5B,kBAAkB,EAAE,GAAG;IACvB,kBAAkB,EAAE,EAAE;IACtB,kBAAkB,EAAE,GAAG;CACf,CAAC;AAEX,YAAY;AACZ,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,SAAS;IAClB,WAAW,EAAE,aAAa;CAClB,CAAC;AAEX,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,QAAQ,CAAC,UAAU;IACnB,QAAQ,CAAC,OAAO;IAChB,QAAQ,CAAC,WAAW;CACZ,CAAC;AAIX,8BAA8B;AAC9B,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,eAAe,EAAE,iBAAiB;IAClC,WAAW,EAAE,aAAa;CAClB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selection UI Module
|
|
3
|
+
*
|
|
4
|
+
* Main orchestration for assistant selection with panel interface
|
|
5
|
+
*/
|
|
6
|
+
import type { CodeMieClient } from 'codemie-sdk';
|
|
7
|
+
import { ACTIONS } from '../../../../../cli/commands/assistants/constants.js';
|
|
8
|
+
type ActionType = typeof ACTIONS.UPDATE | typeof ACTIONS.CANCEL;
|
|
9
|
+
import type { ProviderProfile } from '../../../../../env/types.js';
|
|
10
|
+
import type { SetupCommandOptions } from '../index.js';
|
|
11
|
+
export interface SelectionOptions {
|
|
12
|
+
registeredIds: Set<string>;
|
|
13
|
+
config: ProviderProfile;
|
|
14
|
+
options: SetupCommandOptions;
|
|
15
|
+
client: CodeMieClient;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Prompt user to select assistants with panel interface
|
|
19
|
+
*/
|
|
20
|
+
export declare function promptAssistantSelection(registeredIds: Set<string>, config: ProviderProfile, options: SetupCommandOptions, client: CodeMieClient): Promise<{
|
|
21
|
+
selectedIds: string[];
|
|
22
|
+
action: ActionType;
|
|
23
|
+
}>;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/selection/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;AAEjE,KAAK,UAAU,GAAG,OAAO,OAAO,CAAC,MAAM,GAAG,OAAO,OAAO,CAAC,MAAM,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AASvD,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,MAAM,EAAE,aAAa,CAAC;CACvB;AAqDD;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,EAC1B,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC,CAqExD"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selection UI Module
|
|
3
|
+
*
|
|
4
|
+
* Main orchestration for assistant selection with panel interface
|
|
5
|
+
*/
|
|
6
|
+
import { ACTIONS } from '../../../../../cli/commands/assistants/constants.js';
|
|
7
|
+
import { PANEL_ID, ANSI } from './constants.js';
|
|
8
|
+
import { createDataFetcher } from '../data.js';
|
|
9
|
+
import { createInteractivePrompt } from './interactive-prompt.js';
|
|
10
|
+
import { createActionHandlers } from './actions.js';
|
|
11
|
+
import { logger } from '../../../../../utils/logger.js';
|
|
12
|
+
import ora from 'ora';
|
|
13
|
+
const DEFAULT_PANEL_PARAMS = {
|
|
14
|
+
isActive: false,
|
|
15
|
+
data: null,
|
|
16
|
+
filteredData: [],
|
|
17
|
+
isFetching: false,
|
|
18
|
+
error: null,
|
|
19
|
+
currentPage: 0,
|
|
20
|
+
totalItems: 0,
|
|
21
|
+
totalPages: 0,
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Initialize state with 3 panels (Registered, Project, Marketplace)
|
|
25
|
+
* Smart default: Project tab if no registered assistants exist
|
|
26
|
+
*/
|
|
27
|
+
function initializeState(registeredIds) {
|
|
28
|
+
const hasRegisteredAssistants = registeredIds.size > 0;
|
|
29
|
+
const defaultPanelId = hasRegisteredAssistants
|
|
30
|
+
? PANEL_ID.REGISTERED
|
|
31
|
+
: PANEL_ID.PROJECT;
|
|
32
|
+
return {
|
|
33
|
+
panels: [
|
|
34
|
+
{
|
|
35
|
+
id: PANEL_ID.REGISTERED,
|
|
36
|
+
label: 'Registered',
|
|
37
|
+
...DEFAULT_PANEL_PARAMS,
|
|
38
|
+
isActive: defaultPanelId === PANEL_ID.REGISTERED,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: PANEL_ID.PROJECT,
|
|
42
|
+
label: 'Project',
|
|
43
|
+
...DEFAULT_PANEL_PARAMS,
|
|
44
|
+
isActive: defaultPanelId === PANEL_ID.PROJECT,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: PANEL_ID.MARKETPLACE,
|
|
48
|
+
label: 'Marketplace',
|
|
49
|
+
...DEFAULT_PANEL_PARAMS
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
activePanelId: defaultPanelId,
|
|
53
|
+
searchQuery: '',
|
|
54
|
+
selectedIds: new Set(registeredIds),
|
|
55
|
+
registeredIds: registeredIds,
|
|
56
|
+
isSearchFocused: false,
|
|
57
|
+
isPaginationFocused: null,
|
|
58
|
+
areNavigationButtonsFocused: false,
|
|
59
|
+
focusedButton: 'continue'
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Prompt user to select assistants with panel interface
|
|
64
|
+
*/
|
|
65
|
+
export async function promptAssistantSelection(registeredIds, config, options, client) {
|
|
66
|
+
const state = initializeState(registeredIds);
|
|
67
|
+
const fetcher = createDataFetcher({
|
|
68
|
+
config,
|
|
69
|
+
client,
|
|
70
|
+
options
|
|
71
|
+
});
|
|
72
|
+
let prompt = null;
|
|
73
|
+
let isCancelled = false;
|
|
74
|
+
const actionHandlers = createActionHandlers({
|
|
75
|
+
state,
|
|
76
|
+
fetcher,
|
|
77
|
+
prompt: () => prompt,
|
|
78
|
+
setPrompt: (p) => { prompt = p; },
|
|
79
|
+
setCancelled: (cancelled) => { isCancelled = cancelled; }
|
|
80
|
+
});
|
|
81
|
+
const spinner = ora('Loading assistants...').start();
|
|
82
|
+
const activePanel = state.panels.find(p => p.id === state.activePanelId);
|
|
83
|
+
try {
|
|
84
|
+
const result = await fetcher.fetchAssistants({
|
|
85
|
+
scope: state.activePanelId,
|
|
86
|
+
searchQuery: state.searchQuery,
|
|
87
|
+
page: 0
|
|
88
|
+
});
|
|
89
|
+
activePanel.data = result.data;
|
|
90
|
+
activePanel.filteredData = result.data;
|
|
91
|
+
activePanel.totalItems = result.total;
|
|
92
|
+
activePanel.totalPages = result.pages;
|
|
93
|
+
spinner.succeed('Assistants loaded');
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
spinner.fail('Failed to load assistants');
|
|
97
|
+
activePanel.error = error instanceof Error ? error.message : 'Unknown error';
|
|
98
|
+
activePanel.totalItems = 0;
|
|
99
|
+
activePanel.totalPages = 0;
|
|
100
|
+
}
|
|
101
|
+
// Clear spinner output before starting interactive mode
|
|
102
|
+
process.stdout.write(ANSI.CLEAR_LINE_ABOVE);
|
|
103
|
+
prompt = createInteractivePrompt({
|
|
104
|
+
state,
|
|
105
|
+
actions: actionHandlers
|
|
106
|
+
});
|
|
107
|
+
await prompt.start();
|
|
108
|
+
if (isCancelled) {
|
|
109
|
+
logger.debug('[AssistantSelection] Selection cancelled');
|
|
110
|
+
return {
|
|
111
|
+
selectedIds: [],
|
|
112
|
+
action: ACTIONS.CANCEL
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const selectedIdsArray = Array.from(state.selectedIds);
|
|
116
|
+
logger.debug('[AssistantSelection] Returning selection', {
|
|
117
|
+
totalSelected: selectedIdsArray.length,
|
|
118
|
+
selectedIds: selectedIdsArray,
|
|
119
|
+
registeredCount: state.registeredIds.size,
|
|
120
|
+
registeredIds: Array.from(state.registeredIds)
|
|
121
|
+
});
|
|
122
|
+
return {
|
|
123
|
+
selectedIds: selectedIdsArray,
|
|
124
|
+
action: ACTIONS.UPDATE
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=index.js.map
|