@strands-agents/cli 0.1.0 → 0.1.2
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 +20 -7
- package/bin/strands.js +8 -14
- package/dist/src/tui/agent-setup.js +1 -1
- package/dist/src/tui/agent-setup.js.map +1 -1
- package/dist/src/tui/chat/controller.js +22 -53
- package/dist/src/tui/chat/controller.js.map +1 -1
- package/dist/src/tui/chat/help.js +1 -1
- package/dist/src/tui/chat/help.js.map +1 -1
- package/dist/src/tui/chat/panels.js +1 -9
- package/dist/src/tui/chat/panels.js.map +1 -1
- package/dist/src/tui/config.js +4 -61
- package/dist/src/tui/config.js.map +1 -1
- package/dist/src/tui/model/context.js +10 -2
- package/dist/src/tui/model/context.js.map +1 -1
- package/dist/src/tui/project/run.js +0 -2
- package/dist/src/tui/project/run.js.map +1 -1
- package/dist/src/tui/project/worker.py +6 -0
- package/dist/src/tui/provider/discovery.js +20 -3
- package/dist/src/tui/provider/discovery.js.map +1 -1
- package/dist/src/tui/provider/packages.js +3 -5
- package/dist/src/tui/provider/packages.js.map +1 -1
- package/dist/src/tui/run.js +2 -0
- package/dist/src/tui/run.js.map +1 -1
- package/dist/src/tui/runtime.js +0 -2
- package/dist/src/tui/runtime.js.map +1 -1
- package/dist/src/tui/session/conversations.js +0 -3
- package/dist/src/tui/session/conversations.js.map +1 -1
- package/dist/src/tui/terminal/composer.js +1 -1
- package/dist/src/tui/terminal/composer.js.map +1 -1
- package/dist/src/tui/view/app.js +34 -45
- package/dist/src/tui/view/app.js.map +1 -1
- package/dist/src/tui/view/chat-root.js +1 -1
- package/dist/src/tui/view/chat-root.js.map +1 -1
- package/dist/src/tui/view/chat-view.js +2 -2
- package/dist/src/tui/view/chat-view.js.map +1 -1
- package/dist/src/tui/view/frog-intro-renderer.js +58 -35
- package/dist/src/tui/view/frog-intro-renderer.js.map +1 -1
- package/dist/src/tui/view/help-footer.js +14 -12
- package/dist/src/tui/view/help-footer.js.map +1 -1
- package/dist/src/tui/view/intro.js +29 -5
- package/dist/src/tui/view/intro.js.map +1 -1
- package/dist/src/tui/view/model-panel.js +5 -6
- package/dist/src/tui/view/model-panel.js.map +1 -1
- package/dist/src/tui/view/panel-components.js +3 -2
- package/dist/src/tui/view/panel-components.js.map +1 -1
- package/dist/src/tui/view/panels.js +9 -5
- package/dist/src/tui/view/panels.js.map +1 -1
- package/dist/src/tui/view/presentation.js +3 -2
- package/dist/src/tui/view/presentation.js.map +1 -1
- package/dist/src/tui/view/setup-wizard/brand.js +16 -3
- package/dist/src/tui/view/setup-wizard/brand.js.map +1 -1
- package/dist/src/tui/view/setup-wizard/index.js +230 -131
- package/dist/src/tui/view/setup-wizard/index.js.map +1 -1
- package/dist/src/tui/view/setup-wizard/opening-menu.js +16 -5
- package/dist/src/tui/view/setup-wizard/opening-menu.js.map +1 -1
- package/dist/src/tui/view/setup-wizard/providers.js +11 -7
- package/dist/src/tui/view/setup-wizard/providers.js.map +1 -1
- package/dist/src/tui/view/setup-wizard/steps.js +32 -26
- package/dist/src/tui/view/setup-wizard/steps.js.map +1 -1
- package/dist/src/tui/view/setup-wizard/use-provider-discovery.js +1 -3
- package/dist/src/tui/view/setup-wizard/use-provider-discovery.js.map +1 -1
- package/dist/src/tui/view/startup-view.js +1 -1
- package/dist/src/tui/view/startup-view.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,6 +1,7 @@
|
|
|
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
3
|
import { Box, useInput, useStdout, useWindowSize } from 'ink';
|
|
4
|
+
import stringWidth from 'string-width';
|
|
4
5
|
import { PROVIDER_CREDENTIAL_KEYS, PROVIDER_ENVIRONMENT_KEYS, PROVIDER_LABELS, PROVIDER_IDS, } from '../../config.js';
|
|
5
6
|
import { importAgentProject } from '../../project/import.js';
|
|
6
7
|
import { configurationFromStore } from '../../agent-configuration.js';
|
|
@@ -10,19 +11,19 @@ import { emptyEditor, graphemes, reduceInputSequence } from '../../terminal/comp
|
|
|
10
11
|
import { errorMessage, sanitizeTerminalText } from '../../terminal/sanitize.js';
|
|
11
12
|
import { canChooseDirectory, chooseAgentProject, chooseDirectory } from '../../terminal/directory-picker.js';
|
|
12
13
|
import { setTerminalMouseMotion } from '../../terminal/terminal.js';
|
|
13
|
-
import {
|
|
14
|
+
import { renderSetupGuideTransitionFrame, SETUP_GUIDE_TRANSITION_DURATION_MS, setupGuideLayout, } from '../frog-intro-renderer.js';
|
|
14
15
|
import { elementAtMouse, elementContainsMouse, registerElement, mouseScrollDirection, scrollPanelViewport, revealPanelSelection, sliderOptionAtMouse, } from '../interaction.js';
|
|
15
16
|
import { wrapLines } from '../presentation.js';
|
|
16
17
|
import { Text, ThemeProvider, useTheme } from '../theme.js';
|
|
17
18
|
import { BlinkingCursor, EditableText } from '../text-input.js';
|
|
18
19
|
import { CustomThemeEditor } from '../custom-theme-editor.js';
|
|
19
20
|
import { Fade, mixHexColors, useFadeTransition } from '../fade-in.js';
|
|
20
|
-
import { PROVIDERS, compatibleProfile, exaWebSearchActive, providerAssessment, providerFromModel, quickstartDraft, } from './providers.js';
|
|
21
|
+
import { PROVIDERS, compatibleProfile, exaWebSearchActive, providerSupportsWebSearch, providerAssessment, providerFromModel, quickstartDraft, } from './providers.js';
|
|
21
22
|
import { EXA_WEB_SEARCH_WARNING } from '../../builtin-tools.js';
|
|
22
23
|
import { memoryForDir } from './profile-fields.js';
|
|
23
24
|
import { APPEARANCE_STEP, appearanceSettings, MANUAL_STEPS, OPENING_CHOICES, rowsForStep, setupStepProgress, wizardSettingsRows, } from './steps.js';
|
|
24
25
|
import { useBrandAnimation } from '../startup-view.js';
|
|
25
|
-
import { SetupBrand } from './brand.js';
|
|
26
|
+
import { SetupBrand, setupBrandFrame } from './brand.js';
|
|
26
27
|
import { OpeningMenu } from './opening-menu.js';
|
|
27
28
|
import { SetupSettingsPanel } from './settings-panel.js';
|
|
28
29
|
import { EffortSlider } from '../model-panel.js';
|
|
@@ -81,7 +82,6 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
81
82
|
const [setupTarget, setSetupTarget] = useState();
|
|
82
83
|
const [profileBaseDir] = useState(() => config.snapshot().profileBaseDir);
|
|
83
84
|
const [importPath, setImportPath] = useState('');
|
|
84
|
-
const [importedEntrypoint, setImportedEntrypoint] = useState();
|
|
85
85
|
const [editing, setEditing] = useState();
|
|
86
86
|
const [pathCompletionIndex, setPathCompletionIndex] = useState(-1);
|
|
87
87
|
const [error, setError] = useState();
|
|
@@ -93,8 +93,11 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
93
93
|
const [modelViewportStart, setModelViewportStart] = useState(0);
|
|
94
94
|
const [modelQuery, setModelQuery] = useState('');
|
|
95
95
|
const [modelSearchFocused, setModelSearchFocused] = useState(false);
|
|
96
|
+
const [deselectedModel, setDeselectedModel] = useState();
|
|
96
97
|
const modelListElement = useRef(null);
|
|
97
98
|
const modelSearchElement = useRef(null);
|
|
99
|
+
const modelPreviousElement = useRef(null);
|
|
100
|
+
const modelNextElement = useRef(null);
|
|
98
101
|
const setupEffortSliderElement = useRef(null);
|
|
99
102
|
const [quickstartProvider, setQuickstartProvider] = useState('bedrock');
|
|
100
103
|
const [selecting, setSelecting] = useState();
|
|
@@ -207,14 +210,10 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
207
210
|
const isPermissions = flow === 'manual' && step === 6;
|
|
208
211
|
const isImport = flow === 'import' && step === 1;
|
|
209
212
|
const hasExternalActions = !isSettings && (isProviderSetup || isImport || isCapabilities || isAppearance || flow === 'manual');
|
|
210
|
-
const bubbleWidth = Math.max(1, Math.min(isProviderSetup ?
|
|
213
|
+
const bubbleWidth = Math.max(1, Math.min(isProviderSetup ? 144 : 112, width - 2));
|
|
211
214
|
const lockupWidth = Math.max(1, width - 2);
|
|
212
|
-
const
|
|
213
|
-
const
|
|
214
|
-
const fullLockupHeight = frogStartupHeight(lockupWidth, Number.POSITIVE_INFINITY);
|
|
215
|
-
const lockupHeight = lockupWidth >= 74 && brandAvailableHeight >= fullLockupHeight + 2
|
|
216
|
-
? fullLockupHeight
|
|
217
|
-
: frogStartupHeight(lockupWidth, brandAvailableHeight);
|
|
215
|
+
const brandFrame = setupBrandFrame(lockupWidth, height);
|
|
216
|
+
const lockupHeight = brandFrame.height;
|
|
218
217
|
const showBrand = lockupHeight > 1;
|
|
219
218
|
const brandHeight = showBrand ? lockupHeight + 2 : 0;
|
|
220
219
|
const openingColumns = lockupWidth >= 64 ? 2 : 1;
|
|
@@ -241,21 +240,39 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
241
240
|
: isProviderSetup
|
|
242
241
|
? 4
|
|
243
242
|
: isCapabilities
|
|
244
|
-
?
|
|
243
|
+
? 1
|
|
245
244
|
: isPermissions
|
|
246
245
|
? 2
|
|
247
246
|
: flow === 'manual'
|
|
248
247
|
? step === 2
|
|
249
248
|
? 5
|
|
250
|
-
:
|
|
249
|
+
: step === 5
|
|
250
|
+
? 2
|
|
251
|
+
: 3
|
|
251
252
|
: 2;
|
|
252
253
|
const updateProfile = useCallback((update) => {
|
|
253
254
|
setDraft((current) => ({ ...current, profile: { ...current.profile, ...update } }));
|
|
254
255
|
}, []);
|
|
256
|
+
const credentialRejectedProvider = providerModels.provider === quickstartProvider &&
|
|
257
|
+
!providerModels.loading &&
|
|
258
|
+
providerModels.credentialRejected === true
|
|
259
|
+
? quickstartProvider
|
|
260
|
+
: undefined;
|
|
261
|
+
const keyCredentialProvider = ['anthropic', 'openai', 'google'].includes(quickstartProvider);
|
|
262
|
+
const credentialValidationProvider = isProviderSetup &&
|
|
263
|
+
keyCredentialProvider &&
|
|
264
|
+
readyProviders.includes(quickstartProvider) &&
|
|
265
|
+
(providerModels.provider !== quickstartProvider || providerModels.loading)
|
|
266
|
+
? quickstartProvider
|
|
267
|
+
: undefined;
|
|
268
|
+
const unavailableCredentialProvider = credentialRejectedProvider ?? credentialValidationProvider;
|
|
269
|
+
const setupReadyProviders = useMemo(() => unavailableCredentialProvider
|
|
270
|
+
? readyProviders.filter((provider) => provider !== unavailableCredentialProvider)
|
|
271
|
+
: readyProviders, [readyProviders, unavailableCredentialProvider]);
|
|
255
272
|
const rows = useMemo(() => {
|
|
256
273
|
const stepRows = isAppearance
|
|
257
274
|
? wizardSettingsRows({ ...panelSettings, ...draft.settings, ...appearance }, isSettings ? updateSettings : updateSetupSettings, openAppearance, 'all').filter(({ section }) => section === settingsCategory)
|
|
258
|
-
: rowsForStep(step, flow, draft, importPath, providerEnvironment, detectedEnvironment, quickstartProvider,
|
|
275
|
+
: rowsForStep(step, flow, draft, importPath, providerEnvironment, detectedEnvironment, quickstartProvider, setupReadyProviders, awsDiscovery, ollamaDiscovery, setDraft, updateProfile, setEditing, liteLlmDiscovery, credentialRejectedProvider, credentialValidationProvider, providerModels.error);
|
|
259
276
|
return isProviderSetup
|
|
260
277
|
? [
|
|
261
278
|
...stepRows,
|
|
@@ -294,23 +311,29 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
294
311
|
liteLlmDiscovery,
|
|
295
312
|
providerEnvironment,
|
|
296
313
|
quickstartProvider,
|
|
297
|
-
|
|
314
|
+
setupReadyProviders,
|
|
315
|
+
credentialRejectedProvider,
|
|
316
|
+
credentialValidationProvider,
|
|
317
|
+
providerModels.error,
|
|
298
318
|
recheck,
|
|
299
319
|
step,
|
|
300
320
|
updateProfile,
|
|
301
321
|
]);
|
|
302
322
|
const selectedModelProvider = providerFromModel(draft.profile.model);
|
|
323
|
+
const hasSelectedModel = deselectedModel !== draft.profile.model;
|
|
303
324
|
const canContinue = step !== 1 ||
|
|
304
325
|
(flow === 'import'
|
|
305
326
|
? importPath.trim().length > 0
|
|
306
327
|
: isProviderSetup
|
|
307
|
-
?
|
|
328
|
+
? hasSelectedModel &&
|
|
329
|
+
selectedModelProvider === quickstartProvider &&
|
|
330
|
+
setupReadyProviders.includes(quickstartProvider)
|
|
308
331
|
: draft.providers.some((provider) => readyProviders.includes(provider)));
|
|
309
332
|
const inspectedProvider = isProviderSetup ? quickstartProvider : undefined;
|
|
310
333
|
const inspectedAssessment = inspectedProvider
|
|
311
334
|
? providerAssessment(inspectedProvider, effectiveEnvironment, awsDiscovery, ollamaDiscovery, liteLlmDiscovery)
|
|
312
335
|
: undefined;
|
|
313
|
-
const warning = inspectedAssessment?.warning;
|
|
336
|
+
const warning = keyCredentialProvider ? undefined : inspectedAssessment?.warning;
|
|
314
337
|
const assessmentFacts = inspectedAssessment?.facts ?? [];
|
|
315
338
|
const bannerWarning = warning
|
|
316
339
|
? assessmentFacts.length > 0
|
|
@@ -325,14 +348,18 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
325
348
|
? EXA_WEB_SEARCH_WARNING
|
|
326
349
|
: undefined;
|
|
327
350
|
const bannerWarningStatus = warning ? inspectedAssessment.status : 'warning';
|
|
328
|
-
const providerReady = isProviderSetup &&
|
|
351
|
+
const providerReady = isProviderSetup && setupReadyProviders.includes(quickstartProvider);
|
|
329
352
|
const showProviderConfiguration = isProviderSetup && !providerReady;
|
|
330
353
|
const modelPanelVisible = splitQuickstart && providerReady;
|
|
331
354
|
const availableBubbleHeight = Math.max(1, height - brandHeight - progressHeight - (hasExternalActions ? actionHeight + actionGap : 0) - navigationHeight);
|
|
332
|
-
const
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
const
|
|
355
|
+
const bannerLines = (text) => wrapLines(`⚠ ${text}`, Math.max(1, bubbleWidth - 4)).slice(0, Math.max(0, availableBubbleHeight - rowHeight - 1 - Number(error !== undefined)));
|
|
356
|
+
const warningLines = bannerWarning && !splitQuickstart ? bannerLines(bannerWarning) : [];
|
|
357
|
+
// Reserve the Exa banner's space whether or not web_search is on, so toggling it doesn't resize the panel.
|
|
358
|
+
const warningHeight = isTools && !warning && !providerSupportsWebSearch(draft.profile.model)
|
|
359
|
+
? bannerLines(EXA_WEB_SEARCH_WARNING).length
|
|
360
|
+
: warningLines.length;
|
|
361
|
+
const warningGap = isCapabilities && warningHeight > 0 ? 1 : 0;
|
|
362
|
+
const extraRows = Number(error !== undefined) + warningGap + warningHeight;
|
|
336
363
|
const capabilityContentHeight = Math.max(0, rows.length - 1) * rowHeight + 2;
|
|
337
364
|
const bubbleHeight = isImport
|
|
338
365
|
? Math.min(9 + extraRows + importCompletionCapacity, availableBubbleHeight)
|
|
@@ -354,6 +381,14 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
354
381
|
const firstListRow = isCapabilities ? 1 : 0;
|
|
355
382
|
const viewportStart = Math.max(firstListRow, Math.min(selection - rowCapacity + 1, rows.length - rowCapacity));
|
|
356
383
|
const visibleRows = rows.slice(viewportStart, viewportStart + rowCapacity);
|
|
384
|
+
const hiddenRowsBefore = viewportStart;
|
|
385
|
+
const hiddenRowsAfter = Math.max(0, rows.length - viewportStart - visibleRows.length);
|
|
386
|
+
const manualOverflowLabel = [
|
|
387
|
+
hiddenRowsBefore > 0 ? `↑ ${hiddenRowsBefore} previous` : '',
|
|
388
|
+
hiddenRowsAfter > 0 ? `↓ ${hiddenRowsAfter} more` : '',
|
|
389
|
+
]
|
|
390
|
+
.filter(Boolean)
|
|
391
|
+
.join(' · ');
|
|
357
392
|
const visibleCapabilityRows = isCapabilities ? visibleRows.filter((row) => row.id !== 'select-all') : [];
|
|
358
393
|
const permissionToolCapacity = Math.max(1, Math.floor((bubbleHeight - 9 - extraRows) / rowHeight));
|
|
359
394
|
const permissionViewportStart = Math.max(3, Math.min(selection - permissionToolCapacity + 1, rows.length - permissionToolCapacity));
|
|
@@ -366,7 +401,8 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
366
401
|
? 'error'
|
|
367
402
|
: bannerWarningStatus;
|
|
368
403
|
const availableReasoningRow = providerConfigurationRows.find((row) => row.id === 'thinking');
|
|
369
|
-
const selectedModelAvailable =
|
|
404
|
+
const selectedModelAvailable = hasSelectedModel &&
|
|
405
|
+
providerModels.provider === quickstartProvider &&
|
|
370
406
|
providerModels.available &&
|
|
371
407
|
!providerModels.loading &&
|
|
372
408
|
providerModels.models.some((model) => `${quickstartProvider}/${model.id}` === draft.profile.model);
|
|
@@ -420,10 +456,16 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
420
456
|
const defaultModel = quickstartProvider === 'ollama' ? undefined : PROVIDERS[quickstartProvider].model(effectiveEnvironment);
|
|
421
457
|
const quickstartDefaultModel = defaultModel?.slice(defaultModel.indexOf('/') + 1);
|
|
422
458
|
const readyProviderControlsHeight = readyProviderControlRows.length * quickstartFieldRowHeight;
|
|
423
|
-
const quickstartModelRowHeight =
|
|
459
|
+
const quickstartModelRowHeight = 1;
|
|
424
460
|
const quickstartModelCapacity = Math.max(1, Math.floor((quickstartBodyHeight - 5 - readyProviderControlsHeight) / quickstartModelRowHeight));
|
|
425
461
|
const quickstartModelViewportStart = Math.max(0, Math.min(modelViewportStart, filteredProviderModels.length - quickstartModelCapacity));
|
|
426
462
|
const visibleProviderModels = filteredProviderModels.slice(quickstartModelViewportStart, quickstartModelViewportStart + quickstartModelCapacity);
|
|
463
|
+
const previousModelCount = quickstartModelViewportStart;
|
|
464
|
+
const nextModelCount = Math.max(0, filteredProviderModels.length - quickstartModelViewportStart - visibleProviderModels.length);
|
|
465
|
+
const showModelPagination = providerModels.provider === quickstartProvider && providerModels.available && visibleProviderModels.length > 0;
|
|
466
|
+
const quickstartModelContentWidth = Math.max(1, quickstartDetailColumnWidth - 4);
|
|
467
|
+
const quickstartModelNameWidth = Math.min(Math.max(1, ...filteredProviderModels.map((model) => stringWidth(model.name) + (model.id === quickstartDefaultModel ? 2 : 0))), Math.max(1, quickstartModelContentWidth - 15));
|
|
468
|
+
const quickstartModelIdWidth = Math.max(1, quickstartModelContentWidth - quickstartModelNameWidth - 3);
|
|
427
469
|
const quickstartSelectableRows = rows.length + (modelPanelVisible && providerModels.available ? filteredProviderModels.length : 0);
|
|
428
470
|
const controlBackground = (control, focused, disabled = false) => {
|
|
429
471
|
if (disabled || saving) {
|
|
@@ -436,9 +478,11 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
436
478
|
};
|
|
437
479
|
const backHoverBackground = mixHexColors(COMMAND_DECK_BACKGROUND, palette.error, palette.mode === 'dark' ? 0.22 : 0.16);
|
|
438
480
|
const nextHoverBackground = mixHexColors(COMMAND_DECK_BACKGROUND, palette.accent, palette.mode === 'dark' ? 0.22 : 0.16);
|
|
481
|
+
// Sized from every row, not just the visible ones, so descriptions stay aligned while scrolling.
|
|
482
|
+
const capabilityLabelWidth = Math.max(0, ...rows.filter((row) => row.id !== 'select-all').map((row) => graphemes(row.label).length));
|
|
439
483
|
const renderCapabilityRows = (capabilityRows) => (_jsx(Box, { flexGrow: 1, paddingX: 1, flexDirection: "column", overflow: "hidden", children: capabilityRows.map((row) => {
|
|
440
484
|
const index = rows.indexOf(row);
|
|
441
|
-
return (_jsxs(Box, { ref: (element) => registerElement(rowElements.current, index, element), height:
|
|
485
|
+
return (_jsxs(Box, { ref: (element) => registerElement(rowElements.current, index, element), height: 1, paddingX: 1, flexShrink: 0, backgroundColor: rowBackground(index), children: [_jsx(Box, { width: capabilityLabelWidth + 4, flexShrink: 0, children: _jsxs(Text, { color: row.active ? accent : palette.foreground, bold: index === selection, wrap: "truncate-end", children: [row.active ? '☑' : '☐', " ", row.label] }) }), _jsx(Text, { ...(row.descriptionColor ? { color: row.descriptionColor } : { dimColor: true }), wrap: "truncate-end", children: row.description })] }, row.id));
|
|
442
486
|
}) }));
|
|
443
487
|
const renderChoices = (choices, index) => (_jsx(Box, { flexWrap: "wrap", children: choices.map((choice, choiceIndex) => {
|
|
444
488
|
const target = `choice:${index}:${choiceIndex}`;
|
|
@@ -454,12 +498,12 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
454
498
|
const activeEditing = editing?.field === row.field ? editing : undefined;
|
|
455
499
|
const credential = PROVIDER_CREDENTIAL_KEYS.includes(row.field);
|
|
456
500
|
const editable = row.input === true;
|
|
457
|
-
return (_jsxs(Box, { ref: (element) => registerElement(rowElements.current, index, element), height: quickstartFieldRowHeight, flexShrink: 0, flexDirection: "column", backgroundColor: credential && editable ? undefined : rowBackground(index), children: [_jsx(Text, { bold: true, ...(index === selection ? { color: accent } : {}), wrap: "truncate-end", children: row.label }), editable ? (_jsxs(_Fragment, { children: [_jsx(Box, { width: fieldWidth, height: 3, paddingX: 1, alignItems: "center", backgroundColor: rowBackground(index) ?? COMMAND_DECK_BACKGROUND, children: _jsx(EditableText, { value: activeEditing?.value ?? '', cursor: activeEditing?.cursor ?? graphemes(activeEditing?.value ?? '').length, width: Math.max(1, fieldWidth - 4), active: Boolean(activeEditing), animate: appearance.animations, masked: credential }) }), credential ? (_jsx(Text, { dimColor: true, wrap: "truncate-end", children: row.description })) : null] })) : row.choices?.length ? (renderChoices(row.choices, index)) : activeEditing ? (_jsx(EditableText, { value: activeEditing.value, cursor: activeEditing.cursor ?? graphemes(activeEditing.value).length, width: Math.max(1, fieldWidth - 4), active: true, animate: appearance.animations })) : (_jsx(Text, { dimColor: true, children: row.description || ' ' }))] }, row.id));
|
|
501
|
+
return (_jsxs(Box, { ref: (element) => registerElement(rowElements.current, index, element), height: quickstartFieldRowHeight, flexShrink: 0, flexDirection: "column", backgroundColor: credential && editable ? undefined : rowBackground(index), children: [_jsx(Text, { bold: true, ...(index === selection ? { color: accent } : {}), wrap: "truncate-end", children: row.label }), editable ? (_jsxs(_Fragment, { children: [_jsx(Box, { width: fieldWidth, height: 3, paddingX: 1, alignItems: "center", backgroundColor: rowBackground(index) ?? COMMAND_DECK_BACKGROUND, children: _jsx(EditableText, { value: activeEditing?.value ?? (row.selectOptions ? row.description : ''), cursor: activeEditing?.cursor ?? graphemes(activeEditing?.value ?? '').length, width: Math.max(1, fieldWidth - 4), active: Boolean(activeEditing), animate: appearance.animations, masked: credential }) }), credential ? (_jsx(Text, { dimColor: true, wrap: "truncate-end", children: row.description })) : null] })) : row.choices?.length ? (renderChoices(row.choices, index)) : activeEditing ? (_jsx(EditableText, { value: activeEditing.value, cursor: activeEditing.cursor ?? graphemes(activeEditing.value).length, width: Math.max(1, fieldWidth - 4), active: true, animate: appearance.animations })) : (_jsx(Text, { dimColor: true, children: row.description || ' ' }))] }, row.id));
|
|
458
502
|
};
|
|
459
503
|
const renderProviderSelect = (state) => {
|
|
460
504
|
const capacity = Math.max(1, quickstartBodyHeight - middleDetailHeight - 3);
|
|
461
505
|
const start = Math.max(0, Math.min(state.selection - capacity + 1, state.options.length - capacity));
|
|
462
|
-
return (_jsxs(Box, { backgroundColor: PANEL_BACKGROUND, paddingX: 1, flexDirection: "column", overflow: "hidden", children: [_jsx(Text, { bold: true, wrap: "truncate-end", children: providerFieldRows.find((row) => row.field === state.field)?.label ?? 'Choose' }), state.options.slice(start, start + capacity).map((option, index) => {
|
|
506
|
+
return (_jsxs(Box, { width: "100%", flexGrow: 1, backgroundColor: PANEL_BACKGROUND, paddingX: 1, flexDirection: "column", overflow: "hidden", children: [_jsx(Text, { bold: true, wrap: "truncate-end", children: providerFieldRows.find((row) => row.field === state.field)?.label ?? 'Choose' }), state.options.slice(start, start + capacity).map((option, index) => {
|
|
463
507
|
const optionIndex = start + index;
|
|
464
508
|
return (_jsx(Box, { ref: (element) => registerElement(selectOptionElements.current, optionIndex, element), flexShrink: 0, backgroundColor: controlBackground(`option:${optionIndex}`, optionIndex === state.selection), children: _jsxs(Text, { ...(optionIndex === state.selection ? { color: accent } : {}), wrap: "truncate-end", children: [optionIndex === state.selection ? '› ' : ' ', option.label] }) }, `${option.label}:${option.value ?? 'custom'}`));
|
|
465
509
|
})] }));
|
|
@@ -478,6 +522,14 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
478
522
|
});
|
|
479
523
|
setError(undefined);
|
|
480
524
|
}
|
|
525
|
+
function focusNextProviderField(field) {
|
|
526
|
+
const current = rows.findIndex((row) => row.field === field);
|
|
527
|
+
const next = rows.findIndex((row, index) => index > current && !row.disabled);
|
|
528
|
+
if (next >= 0) {
|
|
529
|
+
setSelection(next);
|
|
530
|
+
setFocusedAction(undefined);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
481
533
|
function chooseSelectOption(option) {
|
|
482
534
|
if (!selecting) {
|
|
483
535
|
return;
|
|
@@ -488,6 +540,7 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
488
540
|
}
|
|
489
541
|
else {
|
|
490
542
|
setProviderValue(selecting.field, option.value ?? '');
|
|
543
|
+
focusNextProviderField(selecting.field);
|
|
491
544
|
}
|
|
492
545
|
setSelecting(undefined);
|
|
493
546
|
}
|
|
@@ -502,6 +555,7 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
502
555
|
if (PROVIDER_IDS[index] !== quickstartProvider) {
|
|
503
556
|
setModelQuery('');
|
|
504
557
|
setModelViewportStart(0);
|
|
558
|
+
setDeselectedModel(undefined);
|
|
505
559
|
}
|
|
506
560
|
setQuickstartProvider(PROVIDER_IDS[index]);
|
|
507
561
|
setSelecting(undefined);
|
|
@@ -516,6 +570,14 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
516
570
|
setSelection(quickstartModelOffset);
|
|
517
571
|
setHoveredControl(undefined);
|
|
518
572
|
};
|
|
573
|
+
function paginateModels(direction) {
|
|
574
|
+
const lastPageStart = Math.max(0, filteredProviderModels.length - quickstartModelCapacity);
|
|
575
|
+
const nextStart = Math.max(0, Math.min(lastPageStart, quickstartModelViewportStart + direction * quickstartModelCapacity));
|
|
576
|
+
setModelViewportStart(nextStart);
|
|
577
|
+
setSelection(quickstartModelOffset + nextStart);
|
|
578
|
+
setModelSearchFocused(false);
|
|
579
|
+
setFocusedAction(undefined);
|
|
580
|
+
}
|
|
519
581
|
function browseForDirectory(field) {
|
|
520
582
|
if (choosingDirectoryRef.current) {
|
|
521
583
|
return;
|
|
@@ -569,6 +631,54 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
569
631
|
}
|
|
570
632
|
});
|
|
571
633
|
}
|
|
634
|
+
function completeSetup(completedDraft = draft, agentProject) {
|
|
635
|
+
let saved;
|
|
636
|
+
setSaving(true);
|
|
637
|
+
if (appearanceOnly || agentProject) {
|
|
638
|
+
if (deferred) {
|
|
639
|
+
onComplete({
|
|
640
|
+
configuration: {
|
|
641
|
+
...configurationFromStore(config),
|
|
642
|
+
settings: { ...panelSettings, ...completedDraft.settings, ...appearance },
|
|
643
|
+
},
|
|
644
|
+
...(agentProject ? { agentProject } : {}),
|
|
645
|
+
});
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
saved = appearanceOnly
|
|
649
|
+
? config.setSettings({ ...panelSettings, ...appearance })
|
|
650
|
+
: config.useAgentProject(agentProject, {
|
|
651
|
+
...panelSettings,
|
|
652
|
+
...completedDraft.settings,
|
|
653
|
+
...appearance,
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
else {
|
|
657
|
+
setError(undefined);
|
|
658
|
+
const configuration = {
|
|
659
|
+
providers: completedDraft.providers,
|
|
660
|
+
profile: compatibleProfile(completedDraft.profile),
|
|
661
|
+
...(profileBaseDir !== undefined ? { profileBaseDir } : {}),
|
|
662
|
+
permissionMode: completedDraft.permissionMode,
|
|
663
|
+
allowedTools: completedDraft.customPermissions || completedDraft.permissionMode === 'bypassPermissions'
|
|
664
|
+
? completedDraft.allowedTools
|
|
665
|
+
: [],
|
|
666
|
+
providerEnvironment,
|
|
667
|
+
settings: { ...panelSettings, ...completedDraft.settings, ...appearance },
|
|
668
|
+
};
|
|
669
|
+
if (deferred) {
|
|
670
|
+
onComplete({ configuration });
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
saved = config.saveSetup(configuration);
|
|
674
|
+
}
|
|
675
|
+
void saved
|
|
676
|
+
.then(() => onComplete())
|
|
677
|
+
.catch((cause) => {
|
|
678
|
+
setSaving(false);
|
|
679
|
+
setError(cause instanceof Error ? cause.message : String(cause));
|
|
680
|
+
});
|
|
681
|
+
}
|
|
572
682
|
function continueFlow() {
|
|
573
683
|
if (editing || selecting || saving) {
|
|
574
684
|
return;
|
|
@@ -578,58 +688,13 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
578
688
|
return;
|
|
579
689
|
}
|
|
580
690
|
if (isAppearance) {
|
|
581
|
-
|
|
582
|
-
setSaving(true);
|
|
583
|
-
if (appearanceOnly || (flow === 'import' && importedEntrypoint)) {
|
|
584
|
-
if (deferred) {
|
|
585
|
-
onComplete({
|
|
586
|
-
configuration: {
|
|
587
|
-
...configurationFromStore(config),
|
|
588
|
-
settings: { ...panelSettings, ...draft.settings, ...appearance },
|
|
589
|
-
},
|
|
590
|
-
...(!appearanceOnly ? { agentProject: importedEntrypoint } : {}),
|
|
591
|
-
});
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
saved = appearanceOnly
|
|
595
|
-
? config.setSettings({ ...panelSettings, ...appearance })
|
|
596
|
-
: config.useAgentProject(importedEntrypoint, { ...panelSettings, ...draft.settings, ...appearance });
|
|
597
|
-
}
|
|
598
|
-
else {
|
|
599
|
-
setError(undefined);
|
|
600
|
-
const configuration = {
|
|
601
|
-
providers: draft.providers,
|
|
602
|
-
profile: compatibleProfile(draft.profile),
|
|
603
|
-
...(profileBaseDir !== undefined ? { profileBaseDir } : {}),
|
|
604
|
-
permissionMode: draft.permissionMode,
|
|
605
|
-
allowedTools: draft.customPermissions || draft.permissionMode === 'bypassPermissions' ? draft.allowedTools : [],
|
|
606
|
-
providerEnvironment,
|
|
607
|
-
settings: { ...panelSettings, ...draft.settings, ...appearance },
|
|
608
|
-
};
|
|
609
|
-
if (deferred) {
|
|
610
|
-
onComplete({ configuration });
|
|
611
|
-
return;
|
|
612
|
-
}
|
|
613
|
-
saved = config.saveSetup(configuration);
|
|
614
|
-
}
|
|
615
|
-
void saved
|
|
616
|
-
.then(() => onComplete())
|
|
617
|
-
.catch((cause) => {
|
|
618
|
-
setSaving(false);
|
|
619
|
-
setError(cause instanceof Error ? cause.message : String(cause));
|
|
620
|
-
});
|
|
691
|
+
completeSetup();
|
|
621
692
|
return;
|
|
622
693
|
}
|
|
623
694
|
if (flow === 'import') {
|
|
624
695
|
try {
|
|
625
696
|
const imported = importAgentProject(importPath);
|
|
626
|
-
|
|
627
|
-
setImportedEntrypoint(imported.entrypoint);
|
|
628
|
-
setSettingsCategory(DEFAULT_SETTINGS_CATEGORY);
|
|
629
|
-
setStep(APPEARANCE_STEP);
|
|
630
|
-
setSelection(0);
|
|
631
|
-
setFocusedAction(undefined);
|
|
632
|
-
});
|
|
697
|
+
completeSetup(draft, imported.entrypoint);
|
|
633
698
|
}
|
|
634
699
|
catch (cause) {
|
|
635
700
|
setError(cause instanceof Error ? cause.message : String(cause));
|
|
@@ -649,7 +714,7 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
649
714
|
setAgentHandoffElapsedMs(0);
|
|
650
715
|
setAgentHandoff({
|
|
651
716
|
model: draft.profile.model,
|
|
652
|
-
effort: draft.profile.effort,
|
|
717
|
+
effort: compatibleProfile(draft.profile).effort,
|
|
653
718
|
configuration: {
|
|
654
719
|
profile: setupTarget.profile,
|
|
655
720
|
permissionMode: setupTarget.permissionMode,
|
|
@@ -671,15 +736,17 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
671
736
|
panelTransition.transition(() => setStep(1));
|
|
672
737
|
return;
|
|
673
738
|
}
|
|
674
|
-
|
|
739
|
+
const completedDraft = {
|
|
675
740
|
...draft,
|
|
676
741
|
providers: [provider, ...draft.providers.filter((candidate) => candidate !== provider)],
|
|
677
|
-
}
|
|
742
|
+
};
|
|
743
|
+
setDraft(completedDraft);
|
|
744
|
+
if (step >= 3) {
|
|
745
|
+
completeSetup(completedDraft);
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
678
748
|
panelTransition.transition(() => {
|
|
679
|
-
|
|
680
|
-
setSettingsCategory(DEFAULT_SETTINGS_CATEGORY);
|
|
681
|
-
}
|
|
682
|
-
setStep(step < 3 ? step + 1 : APPEARANCE_STEP);
|
|
749
|
+
setStep(step + 1);
|
|
683
750
|
setSelection(0);
|
|
684
751
|
setFocusedAction(undefined);
|
|
685
752
|
if (step === 1) {
|
|
@@ -707,12 +774,7 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
707
774
|
});
|
|
708
775
|
return;
|
|
709
776
|
}
|
|
710
|
-
|
|
711
|
-
setSettingsCategory(DEFAULT_SETTINGS_CATEGORY);
|
|
712
|
-
setStep(APPEARANCE_STEP);
|
|
713
|
-
setSelection(0);
|
|
714
|
-
setFocusedAction(undefined);
|
|
715
|
-
});
|
|
777
|
+
completeSetup();
|
|
716
778
|
}
|
|
717
779
|
function moveBack() {
|
|
718
780
|
if (editing || selecting || saving) {
|
|
@@ -734,12 +796,6 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
734
796
|
if (appearanceOnly) {
|
|
735
797
|
onCancel?.(0);
|
|
736
798
|
}
|
|
737
|
-
else {
|
|
738
|
-
panelTransition.transition(() => {
|
|
739
|
-
setStep(flow === 'manual' ? MANUAL_STEPS.length : flow === 'quickstart' ? 3 : 1);
|
|
740
|
-
setSelection(0);
|
|
741
|
-
});
|
|
742
|
-
}
|
|
743
799
|
return;
|
|
744
800
|
}
|
|
745
801
|
if (step <= 1) {
|
|
@@ -799,6 +855,7 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
799
855
|
}
|
|
800
856
|
else {
|
|
801
857
|
setProviderValue(editing.field, value);
|
|
858
|
+
focusNextProviderField(editing.field);
|
|
802
859
|
}
|
|
803
860
|
setEditing(undefined);
|
|
804
861
|
setError(undefined);
|
|
@@ -811,6 +868,9 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
811
868
|
if (editing.field === 'importPath') {
|
|
812
869
|
setImportPath(value);
|
|
813
870
|
}
|
|
871
|
+
else if (editing.field === 'memoryDir') {
|
|
872
|
+
updateProfile({ memory: memoryForDir(value) });
|
|
873
|
+
}
|
|
814
874
|
else if (editing.field === 'skills') {
|
|
815
875
|
const paths = value
|
|
816
876
|
.split(',')
|
|
@@ -858,6 +918,12 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
858
918
|
}
|
|
859
919
|
const profile = quickstartDraft(quickstartProvider, effectiveEnvironment).profile;
|
|
860
920
|
const modelSpecifier = `${quickstartProvider}/${model.id}`;
|
|
921
|
+
if (draft.profile.model === modelSpecifier && deselectedModel !== modelSpecifier) {
|
|
922
|
+
setDeselectedModel(modelSpecifier);
|
|
923
|
+
setError(undefined);
|
|
924
|
+
return;
|
|
925
|
+
}
|
|
926
|
+
setDeselectedModel(undefined);
|
|
861
927
|
setDraft((current) => ({
|
|
862
928
|
...current,
|
|
863
929
|
providers: [quickstartProvider, ...current.providers.filter((provider) => provider !== quickstartProvider)],
|
|
@@ -931,7 +997,7 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
931
997
|
quickstartProvider,
|
|
932
998
|
selectWizardRow,
|
|
933
999
|
]);
|
|
934
|
-
useProviderDiscoveryEffects(discovery, isProviderSetup, quickstartProvider
|
|
1000
|
+
useProviderDiscoveryEffects(discovery, isProviderSetup, quickstartProvider);
|
|
935
1001
|
useEffect(() => {
|
|
936
1002
|
if (!isProviderSetup || awsDiscovery.credentialStatus === undefined || !ollamaDiscovery) {
|
|
937
1003
|
return;
|
|
@@ -989,25 +1055,33 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
989
1055
|
const settings = settingsElement.current ? elementContainsMouse(settingsElement.current, mouse) : false;
|
|
990
1056
|
const frog = frogElement.current ? elementContainsMouse(frogElement.current, mouse) : false;
|
|
991
1057
|
const search = modelSearchElement.current ? elementContainsMouse(modelSearchElement.current, mouse) : false;
|
|
1058
|
+
const modelsPrevious = previousModelCount > 0 && modelPreviousElement.current
|
|
1059
|
+
? elementContainsMouse(modelPreviousElement.current, mouse)
|
|
1060
|
+
: false;
|
|
1061
|
+
const modelsNext = nextModelCount > 0 && modelNextElement.current ? elementContainsMouse(modelNextElement.current, mouse) : false;
|
|
992
1062
|
const effortSliderHit = setupEffortSliderElement.current
|
|
993
1063
|
? elementContainsMouse(setupEffortSliderElement.current, mouse)
|
|
994
1064
|
: false;
|
|
995
|
-
const target =
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1065
|
+
const target = modelsPrevious || modelsNext
|
|
1066
|
+
? modelsPrevious
|
|
1067
|
+
? 'models-previous'
|
|
1068
|
+
: 'models-next'
|
|
1069
|
+
: ((pathCompletion !== undefined ? `completion:${pathCompletion}` : undefined) ??
|
|
1070
|
+
(directory !== undefined ? `browse:${directory}` : undefined) ??
|
|
1071
|
+
choice ??
|
|
1072
|
+
(selectOption !== undefined
|
|
1073
|
+
? `option:${selectOption}`
|
|
1074
|
+
: row !== undefined && !rows[row]?.disabled && !(isImport && row === 1 && choosingDirectory)
|
|
1075
|
+
? row
|
|
1076
|
+
: back
|
|
1077
|
+
? 'back'
|
|
1078
|
+
: next && canContinue
|
|
1079
|
+
? 'next'
|
|
1080
|
+
: settings
|
|
1081
|
+
? 'settings'
|
|
1082
|
+
: search
|
|
1083
|
+
? 'search'
|
|
1084
|
+
: undefined));
|
|
1011
1085
|
if (saving || choosingDirectory) {
|
|
1012
1086
|
return;
|
|
1013
1087
|
}
|
|
@@ -1055,6 +1129,11 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
1055
1129
|
setFocusedAction(undefined);
|
|
1056
1130
|
setEditing(undefined);
|
|
1057
1131
|
}
|
|
1132
|
+
else if (target === 'models-previous' || target === 'models-next') {
|
|
1133
|
+
pressedElement.current = undefined;
|
|
1134
|
+
paginateModels(target === 'models-previous' ? -1 : 1);
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1058
1137
|
else if (choice?.startsWith('choice:')) {
|
|
1059
1138
|
selectWizardRow(Number(choice.split(':')[1]));
|
|
1060
1139
|
}
|
|
@@ -1109,6 +1188,12 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
1109
1188
|
else
|
|
1110
1189
|
openSettings();
|
|
1111
1190
|
}
|
|
1191
|
+
else if (pressed === 'models-previous' && modelsPrevious) {
|
|
1192
|
+
paginateModels(-1);
|
|
1193
|
+
}
|
|
1194
|
+
else if (pressed === 'models-next' && modelsNext) {
|
|
1195
|
+
paginateModels(1);
|
|
1196
|
+
}
|
|
1112
1197
|
}
|
|
1113
1198
|
else if (mouse.action === 'move') {
|
|
1114
1199
|
setHoveredControl(isCapabilities && row !== undefined ? row : target);
|
|
@@ -1185,13 +1270,13 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
1185
1270
|
if (key.tab) {
|
|
1186
1271
|
leaveEdit();
|
|
1187
1272
|
}
|
|
1188
|
-
else if (key.return
|
|
1273
|
+
else if (key.return) {
|
|
1189
1274
|
commitEdit();
|
|
1190
1275
|
return;
|
|
1191
1276
|
}
|
|
1192
1277
|
else {
|
|
1193
1278
|
const multiline = editing.field === 'instructions';
|
|
1194
|
-
const result = reduceInputSequence({ ...emptyEditor(), input: editing.value, cursor: editing.cursor ?? graphemes(editing.value).length }, multiline ? input : input.replace(/[\r\n]/g, ''),
|
|
1279
|
+
const result = reduceInputSequence({ ...emptyEditor(), input: editing.value, cursor: editing.cursor ?? graphemes(editing.value).length }, multiline ? input : input.replace(/[\r\n]/g, ''), key, 'idle');
|
|
1195
1280
|
setEditing({ ...editing, value: result.state.input, cursor: result.state.cursor });
|
|
1196
1281
|
setError(undefined);
|
|
1197
1282
|
return;
|
|
@@ -1411,9 +1496,13 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
1411
1496
|
});
|
|
1412
1497
|
}
|
|
1413
1498
|
});
|
|
1499
|
+
const isSetupCompletion = isAppearance ||
|
|
1500
|
+
(flow === 'quickstart' && step === 3) ||
|
|
1501
|
+
(flow === 'manual' && step === MANUAL_STEPS.length) ||
|
|
1502
|
+
(flow === 'import' && step === 1);
|
|
1414
1503
|
const primaryLabel = saving
|
|
1415
1504
|
? 'Saving...'
|
|
1416
|
-
:
|
|
1505
|
+
: isSetupCompletion
|
|
1417
1506
|
? deferred || !config.needsSetup()
|
|
1418
1507
|
? 'Save and Launch'
|
|
1419
1508
|
: 'Launch Strands harness'
|
|
@@ -1425,7 +1514,7 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
1425
1514
|
? [
|
|
1426
1515
|
width < 32 ? 'Enter save · Tab move' : 'Enter save · Tab/Shift+Tab move',
|
|
1427
1516
|
editing.field === 'instructions'
|
|
1428
|
-
? '
|
|
1517
|
+
? 'Ctrl+J newline · Esc cancel'
|
|
1429
1518
|
: width < 60
|
|
1430
1519
|
? 'Click focus · Esc cancel'
|
|
1431
1520
|
: 'Mouse click: switch controls · Ctrl+U: clear · Esc: cancel',
|
|
@@ -1465,9 +1554,9 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
1465
1554
|
...(appearance.frogTheme === 'custom' ? { frogColor: palette.frog } : {}),
|
|
1466
1555
|
}, landingY) }) }));
|
|
1467
1556
|
}
|
|
1468
|
-
return (_jsxs(Box, { width: width, height: height, paddingX: 1, flexDirection: "column", overflow: "hidden", backgroundColor: palette.background, children: [showBrand ? (_jsx(SetupBrand, {
|
|
1557
|
+
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) => {
|
|
1469
1558
|
frogElement.current = element ?? undefined;
|
|
1470
|
-
} })) : 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, 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 === 'manual' && !isProviderSetup && !isCapabilities ? (
|
|
1559
|
+
} })) : 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, 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 === 'manual' && !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' : MANUAL_STEPS[step - 1] }), manualOverflowLabel ? _jsx(Text, { dimColor: true, children: manualOverflowLabel }) : 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'
|
|
1471
1560
|
? (editing.cursor ?? graphemes(editing.value).length)
|
|
1472
1561
|
: 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) ??
|
|
1473
1562
|
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}`
|
|
@@ -1483,20 +1572,30 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
1483
1572
|
? { hovered: PROVIDER_IDS[hoveredControl] }
|
|
1484
1573
|
: {}), onElement: (id, element) => registerElement(rowElements.current, PROVIDER_IDS.indexOf(id), element) }) }), _jsx(Box, { flexGrow: 1 }), refreshRow ? renderRefreshButton(refreshRow, quickstartProviderColumnWidth - 2, true) : null] }), _jsx(Box, { width: quickstartDetailColumnWidth, flexGrow: 1, flexShrink: 0, paddingX: 1, flexDirection: "column", overflow: "hidden", children: showProviderConfiguration ? (_jsxs(_Fragment, { children: [middleFacts.length > 0 || middleWarningLines.length > 0 ? (_jsxs(Box, { paddingX: 1, marginBottom: middleFieldGap, flexShrink: 0, flexDirection: "column", children: [middleFacts.map((fact) => (_jsxs(Box, { children: [_jsxs(Text, { dimColor: true, children: [fact.label, ": "] }), _jsx(Text, { bold: true, color: palette[fact.status], children: fact.value })] }, fact.label))), middleWarningLines.length > 0 ? (_jsx(Box, { marginTop: middleFacts.length > 0 ? 1 : 0, children: _jsx(Text, { color: palette[providerWarningStatus], children: middleWarningLines.join('\n') }) })) : null] })) : null, selecting
|
|
1485
1574
|
? renderProviderSelect(selecting)
|
|
1486
|
-
: visibleProviderFieldRows.map((row) => renderProviderField(row, quickstartDetailColumnWidth - 3))] })) : (_jsxs(Box, { flexGrow: 1, flexDirection: showReasoningPanel ? 'row' : 'column', overflow: "hidden", children: [_jsxs(Box, { ref: modelListElement, flexGrow: 1, flexDirection: "column", overflow: "hidden", children: [_jsx(Box, { flexShrink: 0, children: _jsx(Text, { bold: true, color: accent, children: "Models" }) }), _jsx(Box, { ref: modelSearchElement, marginBottom: 1, flexShrink: 0, backgroundColor: controlBackground('search', modelSearchFocused), children: _jsx(Text, { wrap: "truncate-end", children: modelSearchFocused ? (_jsxs(_Fragment, { children: [modelQuery, _jsx(BlinkingCursor, { animate: appearance.animations })] })) : (_jsxs(Text, { dimColor: true, children: ["/ ", modelQuery || 'Search models'] })) }) }),
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1575
|
+
: visibleProviderFieldRows.map((row) => renderProviderField(row, quickstartDetailColumnWidth - 3))] })) : (_jsxs(Box, { flexGrow: 1, flexDirection: showReasoningPanel ? 'row' : 'column', overflow: "hidden", children: [_jsxs(Box, { ref: modelListElement, flexGrow: 1, flexDirection: "column", overflow: "hidden", children: [_jsx(Box, { flexShrink: 0, children: _jsx(Text, { bold: true, color: accent, children: "Models" }) }), _jsx(Box, { ref: modelSearchElement, marginBottom: 1, flexShrink: 0, backgroundColor: controlBackground('search', modelSearchFocused), children: _jsx(Text, { wrap: "truncate-end", children: modelSearchFocused ? (_jsxs(_Fragment, { children: [modelQuery, _jsx(BlinkingCursor, { animate: appearance.animations })] })) : (_jsxs(Text, { dimColor: true, children: ["/ ", modelQuery || 'Search models'] })) }) }), showModelPagination ? (_jsx(Box, { ref: modelPreviousElement, width: "100%", height: 1, paddingX: 1, flexShrink: 0, backgroundColor: controlBackground('models-previous', false) ?? COMMAND_DECK_BACKGROUND, children: _jsxs(Text, { ...(previousModelCount > 0
|
|
1576
|
+
? {
|
|
1577
|
+
color: hoveredControl === 'models-previous' ? accent : palette.muted,
|
|
1578
|
+
bold: hoveredControl === 'models-previous',
|
|
1579
|
+
}
|
|
1580
|
+
: { dimColor: true }), children: ["\u2191 Previous", previousModelCount > 0 ? ` · ${previousModelCount}` : ''] }) })) : null, _jsx(Box, { flexShrink: 0, flexDirection: "column", overflow: "hidden", children: providerModels.provider !== quickstartProvider || providerModels.loading ? (_jsx(Text, { dimColor: true, children: "Loading model catalog..." })) : !providerModels.available ? (_jsxs(Text, { color: palette.warning, children: ["Model catalog unavailable", providerModels.error ? ` · ${providerModels.error}` : ''] })) : visibleProviderModels.length === 0 ? (_jsx(Text, { dimColor: true, children: modelQuery.trim() ? 'No matching models' : 'No models reported' })) : (_jsx(_Fragment, { children: visibleProviderModels.map((model, visibleIndex) => {
|
|
1581
|
+
const modelIndex = quickstartModelViewportStart + visibleIndex;
|
|
1582
|
+
const index = quickstartModelOffset + modelIndex;
|
|
1583
|
+
const active = `${quickstartProvider}/${model.id}` === draft.profile.model &&
|
|
1584
|
+
deselectedModel !== draft.profile.model;
|
|
1585
|
+
const focused = focusedAction === undefined && !modelSearchFocused && index === selection;
|
|
1586
|
+
const hovered = hoveredControl === index;
|
|
1587
|
+
const highlighted = focused || hovered;
|
|
1588
|
+
const harnessDefault = model.id === quickstartDefaultModel;
|
|
1589
|
+
const modelSpecifier = `${quickstartProvider}/${model.id}`;
|
|
1590
|
+
return (_jsxs(Box, { ref: (element) => registerElement(rowElements.current, index, element), width: "100%", height: quickstartModelRowHeight, paddingX: 1, flexShrink: 0, overflow: "hidden", backgroundColor: rowBackground(index) ?? (active ? COMMAND_DECK_BACKGROUND : undefined), children: [_jsx(Box, { width: 2, flexShrink: 0, children: _jsx(Text, { ...(active || highlighted ? { color: accent, bold: true } : {}), children: active ? '✓ ' : highlighted ? '› ' : ' ' }) }), _jsx(Box, { ...(showReasoningPanel
|
|
1591
|
+
? { flexGrow: 1 }
|
|
1592
|
+
: { width: quickstartModelNameWidth, flexShrink: 0 }), overflow: "hidden", children: _jsxs(Text, { ...(active || highlighted ? { color: accent, bold: true } : {}), wrap: "truncate-end", children: [model.name, harnessDefault ? _jsx(Text, { color: accent, children: " \u2605" }) : null] }) }), !showReasoningPanel ? (_jsxs(_Fragment, { children: [_jsx(Box, { width: 1, flexShrink: 0 }), _jsx(Box, { width: quickstartModelIdWidth, flexShrink: 0, overflow: "hidden", children: _jsx(Text, { dimColor: true, wrap: "truncate-end", children: modelSpecifier }) })] })) : null] }, model.id));
|
|
1593
|
+
}) })) }), showModelPagination ? (_jsx(Box, { ref: modelNextElement, width: "100%", height: 1, paddingX: 1, flexShrink: 0, backgroundColor: controlBackground('models-next', false) ?? COMMAND_DECK_BACKGROUND, children: _jsxs(Text, { ...(nextModelCount > 0
|
|
1594
|
+
? {
|
|
1595
|
+
color: hoveredControl === 'models-next' ? accent : palette.muted,
|
|
1596
|
+
bold: hoveredControl === 'models-next',
|
|
1597
|
+
}
|
|
1598
|
+
: { dimColor: true }), children: ["\u2193 Next", nextModelCount > 0 ? ` · ${nextModelCount} more` : ''] }) })) : null, readyProviderControlRows.length > 0 ? (_jsx(Box, { flexShrink: 0, flexDirection: "column", children: readyProviderControlRows.map((row) => renderProviderField(row, quickstartDetailColumnWidth - (showReasoningPanel ? 36 : 3))) })) : null] }), showReasoningPanel ? (_jsxs(Box, { width: 32, marginLeft: 1, paddingLeft: 1, flexDirection: "column", flexShrink: 0, children: [_jsx(Text, { bold: true, color: accent, children: "Reasoning" }), _jsx(EffortSlider, { slider: reasoningSlider, width: 26, compact: false, pressed: false, focused: reasoningRowIndex === selection, onElement: (element) => {
|
|
1500
1599
|
setupEffortSliderElement.current = element;
|
|
1501
1600
|
registerElement(rowElements.current, reasoningRowIndex, element);
|
|
1502
1601
|
} })] })) : null] })) })] })) : isAppearance ? (_jsx(SetupSettingsPanel, { rows: visibleRows, category: settingsCategory, settings: { ...panelSettings, ...draft.settings, ...appearance }, start: viewportStart, selected: selection, width: bubbleWidth, height: bubbleHeight, ...(typeof hoveredControl === 'string' ? { hoveredControl } : {}), onRowElement: (index, element) => registerElement(rowElements.current, index, element), onChoiceElement: (target, element) => registerElement(choiceElements.current, target, element) })) : isPermissions ? (_jsxs(Box, { flexGrow: 1, paddingX: 1, flexDirection: "column", overflow: "hidden", children: [_jsx(Box, { height: 7, flexShrink: 0, children: rows.slice(0, 3).map((row, index) => (_jsxs(Box, { ref: (element) => registerElement(rowElements.current, index, element), flexGrow: 1, flexBasis: 0, height: 7, marginRight: index < 2 ? 1 : 0, paddingX: 1, borderStyle: "single", borderColor: index === selection ? accent : row.active ? palette.success : palette.muted, flexDirection: "column", justifyContent: "center", backgroundColor: rowBackground(index), children: [_jsxs(Text, { bold: true, color: row.active || index === selection ? accent : palette.foreground, children: [row.active ? '◆ ' : '', row.label] }), _jsx(Text, { dimColor: true, wrap: "wrap", children: row.description })] }, row.id))) }), draft.customPermissions ? (_jsxs(Box, { marginTop: 1, flexGrow: 1, flexDirection: "column", overflow: "hidden", children: [_jsxs(Box, { justifyContent: "space-between", flexShrink: 0, children: [_jsx(Text, { bold: true, children: "Per-tool behavior" }), _jsxs(Text, { dimColor: true, children: [permissionViewportStart > 3 ? `↑ ${permissionViewportStart - 3} ` : '', permissionViewportStart + visiblePermissionTools.length < rows.length
|
|
@@ -1528,7 +1627,7 @@ function SetupWizardContent({ appearance, setAppearance, config, deferred = fals
|
|
|
1528
1627
|
: row.status
|
|
1529
1628
|
? { color: palette[row.status] }
|
|
1530
1629
|
: { dimColor: true }), wrap: "truncate-end", children: row.description }))] }, row.id));
|
|
1531
|
-
}) })),
|
|
1630
|
+
}) })), warningHeight > 0 ? (_jsx(Box, { paddingX: 1, marginTop: warningGap, height: warningHeight, flexShrink: 0, children: _jsx(Text, { color: palette[providerWarningStatus], children: warningLines.join('\n') }) })) : null, error ? (_jsx(Box, { paddingX: 1, height: 1, children: _jsx(Text, { color: "red", wrap: "truncate-end", children: error }) })) : null] }), hasExternalActions ? (_jsx(Box, { width: bubbleWidth, height: actionHeight, marginTop: actionGap, columnGap: actionColumnGap, justifyContent: "space-between", children: [
|
|
1532
1631
|
['back', 'Back', backElement],
|
|
1533
1632
|
['next', primaryLabel, nextElement],
|
|
1534
1633
|
].map(([action, label, elementRef]) => {
|