@strands-agents/cli 0.1.3 → 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 +11 -5
- package/dist/src/cli/arguments.js +40 -1
- package/dist/src/cli/arguments.js.map +1 -1
- package/dist/src/cli/run.js +7 -2
- package/dist/src/cli/run.js.map +1 -1
- package/dist/src/cli/update.js +67 -0
- package/dist/src/cli/update.js.map +1 -0
- package/dist/src/tui/chat/commands.js +8 -4
- package/dist/src/tui/chat/commands.js.map +1 -1
- package/dist/src/tui/chat/controller.js +12 -12
- package/dist/src/tui/chat/controller.js.map +1 -1
- package/dist/src/tui/chat/panels.js +18 -31
- package/dist/src/tui/chat/panels.js.map +1 -1
- package/dist/src/tui/npm.js +32 -0
- package/dist/src/tui/npm.js.map +1 -0
- package/dist/src/tui/permissions/policy.js +7 -0
- package/dist/src/tui/permissions/policy.js.map +1 -1
- package/dist/src/tui/project/python.js +3 -2
- package/dist/src/tui/project/python.js.map +1 -1
- package/dist/src/tui/project/typescript.js +4 -3
- package/dist/src/tui/project/typescript.js.map +1 -1
- package/dist/src/tui/project/worker.py +93 -7
- package/dist/src/tui/run.js +50 -66
- package/dist/src/tui/run.js.map +1 -1
- package/dist/src/tui/runtime.js +6 -1
- package/dist/src/tui/runtime.js.map +1 -1
- package/dist/src/tui/session/context.js +23 -13
- package/dist/src/tui/session/context.js.map +1 -1
- package/dist/src/tui/session/conversations.js +19 -1
- package/dist/src/tui/session/conversations.js.map +1 -1
- package/dist/src/tui/settings.js +0 -15
- package/dist/src/tui/settings.js.map +1 -1
- package/dist/src/tui/skills.js +2 -2
- package/dist/src/tui/skills.js.map +1 -1
- package/dist/src/tui/strands-backend.js +49 -9
- package/dist/src/tui/strands-backend.js.map +1 -1
- package/dist/src/tui/terminal/composer.js +6 -5
- package/dist/src/tui/terminal/composer.js.map +1 -1
- package/dist/src/tui/terminal/ink.js +87 -3
- package/dist/src/tui/terminal/ink.js.map +1 -1
- package/dist/src/tui/terminal/size.js +26 -0
- package/dist/src/tui/terminal/size.js.map +1 -0
- package/dist/src/tui/terminal/terminal.js +81 -11
- package/dist/src/tui/terminal/terminal.js.map +1 -1
- package/dist/src/tui/update-check.js +37 -0
- package/dist/src/tui/update-check.js.map +1 -0
- package/dist/src/tui/view/app.js +72 -50
- package/dist/src/tui/view/app.js.map +1 -1
- package/dist/src/tui/view/chat-root.js +10 -58
- package/dist/src/tui/view/chat-root.js.map +1 -1
- package/dist/src/tui/view/chat-view.js +24 -29
- package/dist/src/tui/view/chat-view.js.map +1 -1
- package/dist/src/tui/view/command-palette.js +7 -10
- package/dist/src/tui/view/command-palette.js.map +1 -1
- package/dist/src/tui/view/effort-panel.js +15 -0
- package/dist/src/tui/view/effort-panel.js.map +1 -0
- package/dist/src/tui/view/fade-in.js +25 -4
- package/dist/src/tui/view/fade-in.js.map +1 -1
- package/dist/src/tui/view/frog-intro-renderer.js +7 -8
- package/dist/src/tui/view/frog-intro-renderer.js.map +1 -1
- package/dist/src/tui/view/help-footer.js +32 -24
- package/dist/src/tui/view/help-footer.js.map +1 -1
- package/dist/src/tui/view/interaction.js +4 -1
- package/dist/src/tui/view/interaction.js.map +1 -1
- package/dist/src/tui/view/model-panel.js +15 -2
- package/dist/src/tui/view/model-panel.js.map +1 -1
- package/dist/src/tui/view/panel-components.js +2 -3
- package/dist/src/tui/view/panel-components.js.map +1 -1
- package/dist/src/tui/view/panels.js +17 -15
- package/dist/src/tui/view/panels.js.map +1 -1
- package/dist/src/tui/view/presentation.js +75 -38
- package/dist/src/tui/view/presentation.js.map +1 -1
- package/dist/src/tui/view/prompt-editor.js +19 -11
- package/dist/src/tui/view/prompt-editor.js.map +1 -1
- package/dist/src/tui/view/rename-panel.js +11 -0
- package/dist/src/tui/view/rename-panel.js.map +1 -0
- package/dist/src/tui/view/setup-wizard/brand.js +5 -2
- package/dist/src/tui/view/setup-wizard/brand.js.map +1 -1
- package/dist/src/tui/view/setup-wizard/index.js +78 -95
- package/dist/src/tui/view/setup-wizard/index.js.map +1 -1
- package/dist/src/tui/view/setup-wizard/opening-menu.js +2 -2
- package/dist/src/tui/view/setup-wizard/opening-menu.js.map +1 -1
- package/dist/src/tui/view/setup-wizard/progress.js +4 -2
- package/dist/src/tui/view/setup-wizard/progress.js.map +1 -1
- package/dist/src/tui/view/setup-wizard/steps.js +2 -30
- package/dist/src/tui/view/setup-wizard/steps.js.map +1 -1
- package/dist/src/tui/view/startup-view.js +40 -5
- package/dist/src/tui/view/startup-view.js.map +1 -1
- package/dist/src/tui/view/theme.js +5 -2
- package/dist/src/tui/view/theme.js.map +1 -1
- package/dist/src/tui/view/transcript.js +4 -13
- package/dist/src/tui/view/transcript.js.map +1 -1
- package/package.json +4 -4
- package/src/tui/voice/sidecar.py +1 -1
- package/dist/src/tui/view/intro.js +0 -59
- package/dist/src/tui/view/intro.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
3
|
-
import { Box, useInput, useStdout
|
|
3
|
+
import { Box, useInput, useStdout } from 'ink';
|
|
4
|
+
import { useTerminalSize } from '../../terminal/size.js';
|
|
4
5
|
import stringWidth from 'string-width';
|
|
5
6
|
import { PROVIDER_CREDENTIAL_KEYS, PROVIDER_ENVIRONMENT_KEYS, PROVIDER_LABELS, PROVIDER_IDS, } from '../../config.js';
|
|
6
7
|
import { importAgentProject } from '../../project/import.js';
|
|
7
|
-
import { exportFileName, exportSavedAgent } from '../../project/export.js';
|
|
8
8
|
import { configurationFromStore } from '../../agent-configuration.js';
|
|
9
9
|
import { DEFAULT_SETTINGS_CATEGORY, SETTINGS_CATEGORIES } from '../../settings.js';
|
|
10
10
|
import { parseMouseInput } from '../../terminal/mouse-input.js';
|
|
11
11
|
import { emptyEditor, graphemes, reduceInputSequence } from '../../terminal/composer.js';
|
|
12
12
|
import { errorMessage, sanitizeTerminalText } from '../../terminal/sanitize.js';
|
|
13
|
-
import { canChooseDirectory, chooseAgentProject, chooseDirectory
|
|
13
|
+
import { canChooseDirectory, chooseAgentProject, chooseDirectory } from '../../terminal/directory-picker.js';
|
|
14
14
|
import { setTerminalMouseMotion } from '../../terminal/terminal.js';
|
|
15
15
|
import { elementAtMouse, elementContainsMouse, registerElement, mouseScrollDirection, scrollPanelViewport, revealPanelSelection, sliderOptionAtMouse, } from '../interaction.js';
|
|
16
16
|
import { wrapLines } from '../presentation.js';
|
|
@@ -21,23 +21,24 @@ import { Fade, mixHexColors, useFadeTransition } from '../fade-in.js';
|
|
|
21
21
|
import { PROVIDERS, compatibleProfile, exaWebSearchActive, providerSupportsWebSearch, providerAssessment, providerFromModel, quickstartDraft, } from './providers.js';
|
|
22
22
|
import { EXA_WEB_SEARCH_WARNING } from '../../builtin-tools.js';
|
|
23
23
|
import { memoryForDir } from './profile-fields.js';
|
|
24
|
-
import { APPEARANCE_STEP, appearanceSettings, CUSTOMIZE_STEPS,
|
|
25
|
-
import { useBrandAnimation } from '../startup-view.js';
|
|
24
|
+
import { APPEARANCE_STEP, appearanceSettings, CUSTOMIZE_STEPS, OPENING_CHOICES, rowsForStep, setupStepProgress, wizardSettingsRows, } from './steps.js';
|
|
25
|
+
import { useBrandAnimation, useBrandAnimationFrame } from '../startup-view.js';
|
|
26
26
|
import { SetupBrand, setupBrandFrame } from './brand.js';
|
|
27
|
-
import { OpeningMenu } from './opening-menu.js';
|
|
27
|
+
import { OpeningMenu, openingGridLayout } from './opening-menu.js';
|
|
28
28
|
import { SetupSettingsPanel } from './settings-panel.js';
|
|
29
29
|
import { EffortSlider } from '../model-panel.js';
|
|
30
30
|
import { ProviderList } from '../provider-list.js';
|
|
31
31
|
import { useProviderDiscovery, useProviderDiscoveryEffects } from './use-provider-discovery.js';
|
|
32
32
|
import { importPathCompletions } from './path-completion.js';
|
|
33
33
|
import { SetupProgress } from './progress.js';
|
|
34
|
+
import { availableCliUpdate } from '../../update-check.js';
|
|
34
35
|
export function SetupWizard(props) {
|
|
35
36
|
const [appearance, setAppearance] = useState(() => appearanceSettings({ ...props.config.snapshot().settings, ...props.initialSettings }));
|
|
36
37
|
return (_jsx(ThemeProvider, { settings: appearance, children: _jsx(SetupWizardContent, { ...props, appearance: appearance, setAppearance: setAppearance }) }));
|
|
37
38
|
}
|
|
38
|
-
function SetupWizardContent({ appearance, setAppearance, config, deferred = false, appearanceOnly = false, onComplete, onCancel, initialSettings, }) {
|
|
39
|
+
function SetupWizardContent({ appearance, setAppearance, config, deferred = false, appearanceOnly = false, onComplete, onCancel, initialSettings, checkForUpdate = availableCliUpdate, }) {
|
|
39
40
|
const { stdout } = useStdout();
|
|
40
|
-
const { columns, rows: terminalRows } =
|
|
41
|
+
const { columns, rows: terminalRows } = useTerminalSize();
|
|
41
42
|
const [flow, setFlow] = useState();
|
|
42
43
|
const [step, setStep] = useState(appearanceOnly ? APPEARANCE_STEP : 0);
|
|
43
44
|
const [settingsReturn, setSettingsReturn] = useState();
|
|
@@ -81,12 +82,10 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
81
82
|
});
|
|
82
83
|
const [profileBaseDir] = useState(() => config.snapshot().profileBaseDir);
|
|
83
84
|
const [importPath, setImportPath] = useState('');
|
|
84
|
-
const [exportLanguage, setExportLanguage] = useState('typescript');
|
|
85
|
-
const [exportPath, setExportPath] = useState('');
|
|
86
|
-
const [exportedPath, setExportedPath] = useState();
|
|
87
85
|
const [editing, setEditing] = useState();
|
|
88
86
|
const [pathCompletionIndex, setPathCompletionIndex] = useState(-1);
|
|
89
87
|
const [error, setError] = useState();
|
|
88
|
+
const [availableUpdate, setAvailableUpdate] = useState();
|
|
90
89
|
const [saving, setSaving] = useState(false);
|
|
91
90
|
const [choosingDirectory, setChoosingDirectory] = useState(false);
|
|
92
91
|
const choosingDirectoryRef = useRef(false);
|
|
@@ -114,6 +113,7 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
114
113
|
const settingsElement = useRef(undefined);
|
|
115
114
|
const frogElement = useRef(undefined);
|
|
116
115
|
const frogPress = useRef(undefined);
|
|
116
|
+
const hoverPointer = useRef(undefined);
|
|
117
117
|
const pressedElement = useRef(undefined);
|
|
118
118
|
const width = Math.max(1, columns);
|
|
119
119
|
const height = Math.max(1, terminalRows);
|
|
@@ -131,6 +131,20 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
131
131
|
useEffect(() => {
|
|
132
132
|
setPathCompletionIndex(-1);
|
|
133
133
|
}, [pathEditing?.value]);
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
if (appearanceOnly) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
let active = true;
|
|
139
|
+
void checkForUpdate().then((version) => {
|
|
140
|
+
if (active) {
|
|
141
|
+
setAvailableUpdate(version);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
return () => {
|
|
145
|
+
active = false;
|
|
146
|
+
};
|
|
147
|
+
}, [appearanceOnly, checkForUpdate]);
|
|
134
148
|
const isAppearance = step === APPEARANCE_STEP;
|
|
135
149
|
const isSettings = isAppearance && settingsReturn !== undefined;
|
|
136
150
|
const progress = appearanceOnly || isSettings ? undefined : setupStepProgress(flow, step);
|
|
@@ -181,18 +195,16 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
181
195
|
const isCapabilities = isTools || isPlugins;
|
|
182
196
|
const isPermissions = flow === 'customize' && step === 6;
|
|
183
197
|
const isImport = flow === 'import' && step === 1;
|
|
184
|
-
const
|
|
185
|
-
const hasExternalActions = !isSettings && (isProviderSetup || isImport || isExport || isCapabilities || isAppearance || flow === 'customize');
|
|
198
|
+
const hasExternalActions = !isSettings && (isProviderSetup || isImport || isCapabilities || isAppearance || flow === 'customize');
|
|
186
199
|
const bubbleWidth = Math.max(1, Math.min(isProviderSetup ? 144 : 112, width - 2));
|
|
187
200
|
const lockupWidth = Math.max(1, width - 2);
|
|
188
201
|
const brandFrame = setupBrandFrame(lockupWidth, height);
|
|
189
202
|
const lockupHeight = brandFrame.height;
|
|
190
203
|
const showBrand = lockupHeight > 1;
|
|
191
204
|
const brandHeight = showBrand ? lockupHeight + 2 : 0;
|
|
192
|
-
const
|
|
205
|
+
const { columns: openingColumns, rowGap: openingRowGap } = openingGridLayout(lockupWidth);
|
|
193
206
|
const openingRows = Math.ceil(OPENING_CHOICES.length / openingColumns);
|
|
194
|
-
const
|
|
195
|
-
const openingContentHeight = height - brandHeight - navigationHeight - Number(error !== undefined);
|
|
207
|
+
const openingContentHeight = height - brandHeight - navigationHeight - (error ? 2 : 0);
|
|
196
208
|
const openingTopGap = openingContentHeight >= openingRows * (openingColumns === 2 ? 9 : 5) + (openingRows - 1) * openingRowGap + 3
|
|
197
209
|
? 3
|
|
198
210
|
: openingContentHeight >= openingRows * (openingColumns === 2 ? 8 : 5) + (openingRows - 1) * openingRowGap + 2
|
|
@@ -242,18 +254,10 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
242
254
|
const setupReadyProviders = useMemo(() => unavailableCredentialProvider
|
|
243
255
|
? readyProviders.filter((provider) => provider !== unavailableCredentialProvider)
|
|
244
256
|
: readyProviders, [readyProviders, unavailableCredentialProvider]);
|
|
245
|
-
const agentName = draft.profile.name;
|
|
246
|
-
const changeExportLanguage = useCallback((language) => {
|
|
247
|
-
setExportLanguage(language);
|
|
248
|
-
setExportedPath(undefined);
|
|
249
|
-
setExportPath((path) => path === exportFileName(agentName, exportLanguage) ? exportFileName(agentName, language) : path);
|
|
250
|
-
}, [agentName, exportLanguage]);
|
|
251
257
|
const rows = useMemo(() => {
|
|
252
258
|
const stepRows = isAppearance
|
|
253
259
|
? wizardSettingsRows({ ...panelSettings, ...draft.settings, ...appearance }, isSettings ? updateSettings : updateSetupSettings, openAppearance, 'all').filter(({ section }) => section === settingsCategory)
|
|
254
|
-
:
|
|
255
|
-
? exportRows(exportLanguage, exportPath, exportedPath, changeExportLanguage, setEditing)
|
|
256
|
-
: rowsForStep(step, flow, draft, importPath, providerEnvironment, detectedEnvironment, quickstartProvider, setupReadyProviders, awsDiscovery, ollamaDiscovery, setDraft, updateProfile, setEditing, liteLlmDiscovery, credentialRejectedProvider, credentialValidationProvider, providerModels.error);
|
|
260
|
+
: rowsForStep(step, flow, draft, importPath, providerEnvironment, detectedEnvironment, quickstartProvider, setupReadyProviders, awsDiscovery, ollamaDiscovery, setDraft, updateProfile, setEditing, liteLlmDiscovery, credentialRejectedProvider, credentialValidationProvider, providerModels.error);
|
|
257
261
|
return isProviderSetup
|
|
258
262
|
? [
|
|
259
263
|
...stepRows,
|
|
@@ -288,11 +292,6 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
288
292
|
draft,
|
|
289
293
|
flow,
|
|
290
294
|
importPath,
|
|
291
|
-
isExport,
|
|
292
|
-
exportLanguage,
|
|
293
|
-
exportPath,
|
|
294
|
-
exportedPath,
|
|
295
|
-
changeExportLanguage,
|
|
296
295
|
ollamaDiscovery,
|
|
297
296
|
liteLlmDiscovery,
|
|
298
297
|
providerEnvironment,
|
|
@@ -308,8 +307,8 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
308
307
|
const selectedModelProvider = providerFromModel(draft.profile.model);
|
|
309
308
|
const hasSelectedModel = deselectedModel !== draft.profile.model;
|
|
310
309
|
const canContinue = step !== 1 ||
|
|
311
|
-
(flow === 'import'
|
|
312
|
-
?
|
|
310
|
+
(flow === 'import'
|
|
311
|
+
? importPath.trim().length > 0
|
|
313
312
|
: isProviderSetup
|
|
314
313
|
? hasSelectedModel &&
|
|
315
314
|
selectedModelProvider === quickstartProvider &&
|
|
@@ -360,10 +359,10 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
360
359
|
? Math.min(9 + Math.max(0, rows.length - 3) * rowHeight + extraRows, availableBubbleHeight)
|
|
361
360
|
: isAppearance
|
|
362
361
|
? availableBubbleHeight
|
|
363
|
-
:
|
|
362
|
+
: flow === 'customize' && !isProviderSetup
|
|
364
363
|
? Math.min(rows.length * rowHeight + 3 + extraRows, availableBubbleHeight)
|
|
365
364
|
: availableBubbleHeight;
|
|
366
|
-
const panelChromeHeight = isProviderSetup || isCapabilities ? 0 : isAppearance ||
|
|
365
|
+
const panelChromeHeight = isProviderSetup || isCapabilities ? 0 : isAppearance || flow === 'customize' ? 2 : 4;
|
|
367
366
|
const rowCapacity = isAppearance
|
|
368
367
|
? settingsCategory === 'Appearance' && bubbleHeight < 18
|
|
369
368
|
? 1
|
|
@@ -416,9 +415,7 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
416
415
|
const showReasoningPanel = showModelOptionsPanel && reasoningSlider !== undefined;
|
|
417
416
|
const readyProviderControlRows = providerConfigurationRows.filter((row) => (row.id !== 'thinking' || (reasoningRow !== undefined && !showReasoningPanel)) &&
|
|
418
417
|
(row.id !== 'quickstart-web-search' || !showModelOptionsPanel));
|
|
419
|
-
const directoryRows = new Map(rows.flatMap((row, index) => canChooseDirectory() &&
|
|
420
|
-
!row.disabled &&
|
|
421
|
-
(row.field === 'memoryDir' || row.field === 'skills' || row.field === 'exportPath')
|
|
418
|
+
const directoryRows = new Map(rows.flatMap((row, index) => canChooseDirectory() && !row.disabled && (row.field === 'memoryDir' || row.field === 'skills')
|
|
422
419
|
? [[index, row.field]]
|
|
423
420
|
: []));
|
|
424
421
|
const quickstartBodyHeight = bubbleHeight - panelChromeHeight - extraRows;
|
|
@@ -598,11 +595,7 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
598
595
|
setError(undefined);
|
|
599
596
|
const selection = field === 'importPath'
|
|
600
597
|
? chooseAgentProject()
|
|
601
|
-
: field === '
|
|
602
|
-
? chooseSaveFile('Export harness project', exportFileName(draft.profile.name, exportLanguage))
|
|
603
|
-
: chooseDirectory(field === 'memoryDir'
|
|
604
|
-
? 'Choose a directory for agent memory'
|
|
605
|
-
: 'Choose a directory containing agent skills');
|
|
598
|
+
: chooseDirectory(field === 'memoryDir' ? 'Choose a directory for agent memory' : 'Choose a directory containing agent skills');
|
|
606
599
|
void selection
|
|
607
600
|
.then((path) => {
|
|
608
601
|
if (!path)
|
|
@@ -611,10 +604,6 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
611
604
|
setImportPath(path);
|
|
612
605
|
setSelection(0);
|
|
613
606
|
}
|
|
614
|
-
else if (field === 'exportPath') {
|
|
615
|
-
setExportPath(path);
|
|
616
|
-
setExportedPath(undefined);
|
|
617
|
-
}
|
|
618
607
|
else {
|
|
619
608
|
updateProfile(field === 'skills' ? { skills: [path] } : { memory: memoryForDir(path) });
|
|
620
609
|
}
|
|
@@ -636,12 +625,7 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
636
625
|
setFlow(nextFlow);
|
|
637
626
|
setStep(1);
|
|
638
627
|
setError(undefined);
|
|
639
|
-
if (nextFlow
|
|
640
|
-
setSelection(0);
|
|
641
|
-
setExportedPath(undefined);
|
|
642
|
-
setExportPath(exportFileName(draft.profile.name, exportLanguage));
|
|
643
|
-
}
|
|
644
|
-
else if (nextFlow !== 'import') {
|
|
628
|
+
if (nextFlow !== 'import') {
|
|
645
629
|
const provider = providerFromModel(draft.profile.model) ?? 'bedrock';
|
|
646
630
|
if (nextFlow === 'quickstart') {
|
|
647
631
|
setDraft(quickstartDraft(provider, effectiveEnvironment));
|
|
@@ -655,6 +639,17 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
655
639
|
}
|
|
656
640
|
});
|
|
657
641
|
}
|
|
642
|
+
function chooseOpeningChoice(choice) {
|
|
643
|
+
if (choice !== 'resume') {
|
|
644
|
+
chooseFlow(choice);
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
if (config.needsSetup()) {
|
|
648
|
+
setError('No harness is ready to resume yet. Choose Quickstart or Customize to create one, or Import your own.');
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
onCancel?.(0);
|
|
652
|
+
}
|
|
658
653
|
function completeSetup(completedDraft = draft, agentProject) {
|
|
659
654
|
let saved;
|
|
660
655
|
setSaving(true);
|
|
@@ -703,30 +698,18 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
703
698
|
setError(cause instanceof Error ? cause.message : String(cause));
|
|
704
699
|
});
|
|
705
700
|
}
|
|
706
|
-
function runExport() {
|
|
707
|
-
setSaving(true);
|
|
708
|
-
setError(undefined);
|
|
709
|
-
void exportSavedAgent(config.snapshot(), exportLanguage, exportPath)
|
|
710
|
-
.then(setExportedPath)
|
|
711
|
-
.catch((cause) => setError(errorMessage(cause)))
|
|
712
|
-
.finally(() => setSaving(false));
|
|
713
|
-
}
|
|
714
701
|
function continueFlow() {
|
|
715
702
|
if (editing || selecting || saving) {
|
|
716
703
|
return;
|
|
717
704
|
}
|
|
718
705
|
if (step === 0) {
|
|
719
|
-
|
|
706
|
+
chooseOpeningChoice(OPENING_CHOICES[selection].id);
|
|
720
707
|
return;
|
|
721
708
|
}
|
|
722
709
|
if (isAppearance) {
|
|
723
710
|
completeSetup();
|
|
724
711
|
return;
|
|
725
712
|
}
|
|
726
|
-
if (flow === 'export') {
|
|
727
|
-
runExport();
|
|
728
|
-
return;
|
|
729
|
-
}
|
|
730
713
|
if (flow === 'import') {
|
|
731
714
|
try {
|
|
732
715
|
const imported = importAgentProject(importPath);
|
|
@@ -867,10 +850,6 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
867
850
|
if (editing.field === 'importPath') {
|
|
868
851
|
setImportPath(value);
|
|
869
852
|
}
|
|
870
|
-
else if (editing.field === 'exportPath') {
|
|
871
|
-
setExportPath(value);
|
|
872
|
-
setExportedPath(undefined);
|
|
873
|
-
}
|
|
874
853
|
else if (editing.field === 'memoryDir') {
|
|
875
854
|
updateProfile({ memory: memoryForDir(value) });
|
|
876
855
|
}
|
|
@@ -907,7 +886,7 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
907
886
|
}
|
|
908
887
|
function activateRow(index) {
|
|
909
888
|
if (step === 0) {
|
|
910
|
-
|
|
889
|
+
chooseOpeningChoice(OPENING_CHOICES[index].id);
|
|
911
890
|
return;
|
|
912
891
|
}
|
|
913
892
|
if (isImport && index === 1) {
|
|
@@ -984,9 +963,22 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
984
963
|
return () => setTerminalMouseMotion(false, stdout);
|
|
985
964
|
}, [stdout]);
|
|
986
965
|
useEffect(() => {
|
|
966
|
+
hoverPointer.current = undefined;
|
|
987
967
|
setHoveredControl(undefined);
|
|
988
968
|
pressedElement.current = undefined;
|
|
989
|
-
}, [step, flow, quickstartProvider, selecting?.field, modelViewportStart
|
|
969
|
+
}, [step, flow, quickstartProvider, selecting?.field, modelViewportStart]);
|
|
970
|
+
useEffect(() => {
|
|
971
|
+
pressedElement.current = undefined;
|
|
972
|
+
frogPress.current = undefined;
|
|
973
|
+
const mouse = hoverPointer.current;
|
|
974
|
+
if (step !== 0 || !mouse) {
|
|
975
|
+
setHoveredControl(undefined);
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
const row = elementAtMouse(rowElements.current, mouse);
|
|
979
|
+
const settings = settingsElement.current && elementContainsMouse(settingsElement.current, mouse);
|
|
980
|
+
setHoveredControl(row ?? (settings ? 'settings' : undefined));
|
|
981
|
+
}, [width, height]);
|
|
990
982
|
useEffect(() => {
|
|
991
983
|
if (isProviderSetup && !modelPanelVisible && (modelSearchFocused || selection >= quickstartModelOffset)) {
|
|
992
984
|
selectWizardRow(PROVIDER_IDS.indexOf(quickstartProvider));
|
|
@@ -1030,14 +1022,17 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
1030
1022
|
return { ...current, providers, profile };
|
|
1031
1023
|
});
|
|
1032
1024
|
}, [awsDiscovery.credentialStatus, config, effectiveEnvironment, isProviderSetup, ollamaDiscovery, readyProviders]);
|
|
1033
|
-
const
|
|
1025
|
+
const frogClockMs = useBrandAnimation(frogAnimationId);
|
|
1026
|
+
const frogElapsedMs = useBrandAnimationFrame(frogClockMs, brandFrame.width, brandFrame.height);
|
|
1034
1027
|
useInput((input, key) => {
|
|
1035
1028
|
if (appearanceOpen || panelTransition.transitioning)
|
|
1036
1029
|
return;
|
|
1037
1030
|
const mouse = parseMouseInput(input);
|
|
1038
1031
|
if (mouse) {
|
|
1032
|
+
hoverPointer.current = mouse;
|
|
1039
1033
|
const scroll = mouseScrollDirection(mouse);
|
|
1040
1034
|
if (scroll !== undefined) {
|
|
1035
|
+
hoverPointer.current = undefined;
|
|
1041
1036
|
setHoveredControl(undefined);
|
|
1042
1037
|
if (isProviderSetup && modelListElement.current && elementContainsMouse(modelListElement.current, mouse)) {
|
|
1043
1038
|
setModelViewportStart((start) => scrollPanelViewport(start, scroll, filteredProviderModels.length, quickstartModelCapacity));
|
|
@@ -1203,6 +1198,7 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
1203
1198
|
}
|
|
1204
1199
|
return;
|
|
1205
1200
|
}
|
|
1201
|
+
hoverPointer.current = undefined;
|
|
1206
1202
|
if (key.ctrl && input === 'c') {
|
|
1207
1203
|
onCancel?.(130);
|
|
1208
1204
|
return;
|
|
@@ -1504,16 +1500,12 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
1504
1500
|
(flow === 'customize' && step === CUSTOMIZE_STEPS.length) ||
|
|
1505
1501
|
(flow === 'import' && step === 1);
|
|
1506
1502
|
const primaryLabel = saving
|
|
1507
|
-
?
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
:
|
|
1513
|
-
? deferred || !config.needsSetup()
|
|
1514
|
-
? 'Save and Launch'
|
|
1515
|
-
: 'Launch Strands harness'
|
|
1516
|
-
: 'Continue';
|
|
1503
|
+
? 'Saving...'
|
|
1504
|
+
: isSetupCompletion
|
|
1505
|
+
? deferred || !config.needsSetup()
|
|
1506
|
+
? 'Save and Launch'
|
|
1507
|
+
: 'Launch Strands harness'
|
|
1508
|
+
: 'Continue';
|
|
1517
1509
|
const escapeAction = editing || selecting ? 'cancel' : step === 0 ? 'exit' : 'back';
|
|
1518
1510
|
const navigationHints = editing
|
|
1519
1511
|
? [
|
|
@@ -1539,21 +1531,12 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
1539
1531
|
: `Tab / Shift+Tab to move focus · Esc to ${escapeAction}`,
|
|
1540
1532
|
];
|
|
1541
1533
|
const settingsHovered = hoveredControl === 'settings';
|
|
1542
|
-
const settingsBackHovered = isSettings && settingsHovered;
|
|
1543
1534
|
const settingsButton = !appearanceOnly ? (_jsx(Box, { ref: (element) => {
|
|
1544
1535
|
settingsElement.current = element ?? undefined;
|
|
1545
|
-
},
|
|
1546
|
-
|
|
1547
|
-
: (controlBackground('settings', focusedAction === 'settings') ?? COMMAND_DECK_BACKGROUND), children: _jsx(Text, { color: settingsBackHovered ? palette.muted : focusedAction === 'settings' ? accent : palette.muted, children: isSettings ? 'Back' : 'Settings' }) })) : null;
|
|
1548
|
-
return (_jsxs(Box, { width: width, height: height, paddingX: 1, flexDirection: "column", overflow: "hidden", backgroundColor: palette.background, children: [showBrand ? (_jsx(SetupBrand, { frame: brandFrame, appearance: appearance, animationId: frogAnimationId, elapsedMs: frogElapsedMs, onFrogElement: (element) => {
|
|
1536
|
+
}, height: 1, flexShrink: 0, children: _jsx(Text, { color: settingsHovered || focusedAction === 'settings' ? accent : palette.foreground, children: isSettings ? 'Back' : '/settings' }) })) : null;
|
|
1537
|
+
return (_jsxs(Box, { width: width, height: height, paddingX: 1, flexDirection: "column", overflow: "hidden", backgroundColor: palette.canvas, children: [showBrand ? (_jsx(SetupBrand, { frame: brandFrame, appearance: appearance, animationId: frogAnimationId, elapsedMs: frogElapsedMs, onFrogElement: (element) => {
|
|
1549
1538
|
frogElement.current = element ?? undefined;
|
|
1550
|
-
} })) : null, step === 0 ? (_jsx(Fade, { background: palette.background, progress: panelTransition.progress, children: _jsx(OpeningMenu, { width: lockupWidth, buttonHeight: openingButtonHeight, selection: selection, showSelection: openingSelectionVisible, ...(typeof hoveredControl === 'number' ? { hovered: hoveredControl } : {}), topGap: openingTopGap, animate: appearance.animations, ...(error ? { error } : {}), onRowElement: (index, element) => registerElement(rowElements.current, index, element) }) })) : null, step === 0 ? null : (_jsx(Fade, { background: palette.background, progress: panelTransition.progress, children: _jsxs(Box, { flexGrow: 1, alignItems: "center", justifyContent: "center", flexDirection: "column", overflow: "hidden", children: [progress ? (_jsxs(Box, { width: bubbleWidth, marginBottom: 1, alignItems: "center", flexDirection: "column", flexShrink: 0, children: [_jsx(Text, { bold: true, color: accent, wrap: "truncate-end", children: progress.instruction }), _jsx(SetupProgress, { current: progress.current, total: progress.total, ...(progress.label ? { label: progress.label } : {}), width: Math.min(bubbleWidth, 48), animate: appearance.animations })] })) : null, _jsxs(Box, { width: bubbleWidth, height: bubbleHeight, flexDirection: "column", overflow: "hidden", backgroundColor: PANEL_BACKGROUND, children: [!isAppearance &&
|
|
1551
|
-
? 'Settings'
|
|
1552
|
-
: isAppearance
|
|
1553
|
-
? 'Appearance'
|
|
1554
|
-
: isExport
|
|
1555
|
-
? 'Export your agent'
|
|
1556
|
-
: CUSTOMIZE_STEPS[step - 1] }), customizeOverflowLabel ? _jsx(Text, { dimColor: true, children: customizeOverflowLabel }) : null] })) : null, isCapabilities ? (_jsxs(_Fragment, { children: [_jsxs(Box, { paddingX: 1, marginBottom: 1, justifyContent: "space-between", flexShrink: 0, children: [_jsx(Text, { bold: true, color: accent, children: isTools ? 'Tools' : 'Plugins & features' }), _jsx(Box, { ref: (element) => registerElement(rowElements.current, 0, element), paddingX: 1, backgroundColor: rowBackground(0) ?? COMMAND_DECK_BACKGROUND, children: _jsx(Text, { bold: true, children: rows[0].label }) })] }), renderCapabilityRows(visibleCapabilityRows)] })) : isImport ? (_jsxs(Box, { flexGrow: 1, paddingX: 2, paddingY: 1, flexDirection: "column", overflow: "hidden", children: [_jsx(Text, { bold: true, wrap: "truncate-end", children: "Import an agent" }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { bold: true, ...(selection === 0 ? { color: accent } : {}), wrap: "truncate-end", children: "Path to ZIP, file, or folder" }) }), _jsxs(Box, { height: 3, flexDirection: "row", children: [_jsx(Box, { ref: (element) => registerElement(rowElements.current, 0, element), flexGrow: 1, paddingX: 1, flexDirection: "column", justifyContent: "center", backgroundColor: rowBackground(0) ?? COMMAND_DECK_BACKGROUND, children: _jsx(EditableText, { value: editing?.field === 'importPath' ? editing.value : importPath, cursor: editing?.field === 'importPath'
|
|
1539
|
+
} })) : null, step === 0 ? (_jsx(Fade, { background: palette.background, progress: panelTransition.progress, children: _jsx(OpeningMenu, { width: lockupWidth, buttonHeight: openingButtonHeight, selection: selection, showSelection: openingSelectionVisible, ...(typeof hoveredControl === 'number' ? { hovered: hoveredControl } : {}), topGap: openingTopGap, animate: appearance.animations, ...(error ? { error } : {}), ...(availableUpdate ? { availableUpdate } : {}), onRowElement: (index, element) => registerElement(rowElements.current, index, element) }) })) : null, step === 0 ? null : (_jsx(Fade, { background: palette.background, progress: panelTransition.progress, children: _jsxs(Box, { flexGrow: 1, alignItems: "center", justifyContent: "center", flexDirection: "column", overflow: "hidden", children: [progress ? (_jsxs(Box, { width: bubbleWidth, marginBottom: 1, alignItems: "center", flexDirection: "column", flexShrink: 0, children: [_jsx(Text, { bold: true, color: accent, wrap: "truncate-end", children: progress.instruction }), _jsx(SetupProgress, { current: progress.current, total: progress.total, ...(progress.label ? { label: progress.label } : {}), width: Math.min(bubbleWidth, 48), animate: appearance.animations })] })) : null, _jsxs(Box, { width: bubbleWidth, height: bubbleHeight, flexDirection: "column", overflow: "hidden", backgroundColor: PANEL_BACKGROUND, children: [!isAppearance && flow === 'customize' && !isProviderSetup && !isCapabilities ? (_jsxs(Box, { paddingX: 1, marginBottom: 1, justifyContent: "space-between", flexShrink: 0, children: [_jsx(Text, { bold: true, color: accent, children: isSettings ? 'Settings' : isAppearance ? 'Appearance' : CUSTOMIZE_STEPS[step - 1] }), customizeOverflowLabel ? _jsx(Text, { dimColor: true, children: customizeOverflowLabel }) : null] })) : null, isCapabilities ? (_jsxs(_Fragment, { children: [_jsxs(Box, { paddingX: 1, marginBottom: 1, justifyContent: "space-between", flexShrink: 0, children: [_jsx(Text, { bold: true, color: accent, children: isTools ? 'Tools' : 'Plugins & features' }), _jsx(Box, { ref: (element) => registerElement(rowElements.current, 0, element), paddingX: 1, backgroundColor: rowBackground(0) ?? COMMAND_DECK_BACKGROUND, children: _jsx(Text, { bold: true, children: rows[0].label }) })] }), renderCapabilityRows(visibleCapabilityRows)] })) : isImport ? (_jsxs(Box, { flexGrow: 1, paddingX: 2, paddingY: 1, flexDirection: "column", overflow: "hidden", children: [_jsx(Text, { bold: true, wrap: "truncate-end", children: "Import an agent" }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { bold: true, ...(selection === 0 ? { color: accent } : {}), wrap: "truncate-end", children: "Path to ZIP, file, or folder" }) }), _jsxs(Box, { height: 3, flexDirection: "row", children: [_jsx(Box, { ref: (element) => registerElement(rowElements.current, 0, element), flexGrow: 1, paddingX: 1, flexDirection: "column", justifyContent: "center", backgroundColor: rowBackground(0) ?? COMMAND_DECK_BACKGROUND, children: _jsx(EditableText, { value: editing?.field === 'importPath' ? editing.value : importPath, cursor: editing?.field === 'importPath'
|
|
1557
1540
|
? (editing.cursor ?? graphemes(editing.value).length)
|
|
1558
1541
|
: graphemes(importPath).length, width: Math.max(1, bubbleWidth - (canChooseDirectory() ? 17 : 6)), active: editing?.field === 'importPath', animate: appearance.animations }) }), canChooseDirectory() ? (_jsx(Box, { ref: (element) => registerElement(rowElements.current, 1, element), width: 12, marginLeft: 1, alignItems: "center", justifyContent: "center", backgroundColor: controlBackground(1, focusedAction === undefined && selection === 1, choosingDirectory) ??
|
|
1559
1542
|
COMMAND_DECK_BACKGROUND, children: _jsx(Text, { bold: true, ...(selection === 1 && !choosingDirectory ? { color: accent } : {}), dimColor: choosingDirectory, children: choosingDirectory ? 'Opening...' : 'Browse' }) })) : null] }), pathEditing && importCompletionCapacity > 0 ? (_jsxs(Box, { flexDirection: "column", flexShrink: 0, children: [_jsx(Box, { paddingX: 1, height: 1, flexShrink: 0, children: _jsx(Text, { dimColor: true, wrap: "truncate-end", children: "Suggestions \u00B7 \u2191\u2193 choose \u00B7 Tab complete" }) }), pathCompletions.slice(0, importCompletionCapacity).map((completion, index) => (_jsx(Box, { ref: (element) => registerElement(pathCompletionElements.current, index, element), height: 1, paddingX: 1, flexShrink: 0, backgroundColor: pathCompletionIndex === index || hoveredControl === `completion:${index}`
|
|
@@ -1644,7 +1627,7 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
1644
1627
|
: active
|
|
1645
1628
|
? PANEL_SELECTION
|
|
1646
1629
|
: (controlBackground(action, active, primary && !canContinue) ?? COMMAND_DECK_BACKGROUND), children: _jsx(Text, { bold: true, ...(interactiveHover ? { color: palette.foreground } : active ? { color: accent } : {}), dimColor: primary ? !enabled : saving, children: label }) }, action));
|
|
1647
|
-
}) })) : null] }) })), width < 32 ? (_jsxs(Box, { height: navigationHeight, flexShrink: 0, flexDirection: "column", children: [_jsx(Box, { justifyContent: "center", children: _jsx(Text, { dimColor: true, wrap: "truncate-end", children: navigationHints[0] }) }), _jsxs(Box, { height: 1, alignItems: "center", children: [
|
|
1630
|
+
}) })) : null] }) })), width < 32 ? (_jsxs(Box, { height: navigationHeight, flexShrink: 0, flexDirection: "column", paddingX: 1, children: [_jsx(Box, { justifyContent: "center", children: _jsx(Text, { dimColor: true, wrap: "truncate-end", children: navigationHints[0] }) }), _jsxs(Box, { height: 1, alignItems: "center", children: [_jsx(Box, { flexGrow: 1, justifyContent: "center", overflow: "hidden", children: _jsx(Text, { dimColor: true, wrap: "truncate-end", children: navigationHints[1] }) }), settingsButton] })] })) : (_jsxs(Box, { height: navigationHeight, flexShrink: 0, alignItems: "flex-end", paddingX: 1, children: [_jsx(Box, { flexGrow: 1, flexDirection: "column", alignItems: "center", overflow: "hidden", children: navigationHints.map((hint) => (_jsx(Text, { dimColor: true, wrap: "truncate-end", children: hint }, hint))) }), settingsButton] })), appearanceOpen ? (_jsx(CustomThemeEditor, { settings: priorAppearance.current, animate: appearance.animations, width: width, height: height, onPreview: previewAppearance, onClose: closeAppearance, onApply: (next) => {
|
|
1648
1631
|
priorAppearance.current = { ...appearance, ...next };
|
|
1649
1632
|
updateAppearance(priorAppearance.current);
|
|
1650
1633
|
} })) : null] }));
|