zidane-ui 9.2.2 → 9.2.3
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/dist/adapters/browser-keybindings-host.js +3 -1
- package/dist/adapters/server-settings-host.js +30 -3
- package/dist/adapters/server-settings-sections.js +23 -1
- package/dist/adapters/server-sidebar-host.d.ts +3 -1
- package/dist/adapters/server-sidebar-host.js +10 -1
- package/dist/app/ModalProvider.js +1 -1
- package/dist/approvals/ApprovalShell.js +1 -1
- package/dist/chat/DaemonOrb.d.ts +29 -1
- package/dist/chat/DaemonOrb.js +25 -12
- package/dist/chat/StatusDot.js +8 -2
- package/dist/chat/Transcript.js +11 -4
- package/dist/chat/headless/index.d.ts +3 -2
- package/dist/chat/headless/index.js +11 -10
- package/dist/chat/headless/labels.d.ts +13 -0
- package/dist/chat/headless/labels.js +12 -0
- package/dist/chat/headless/session-list.d.ts +10 -0
- package/dist/chat/headless/sidebar/directory.d.ts +8 -1
- package/dist/chat/headless/sidebar/directory.js +40 -4
- package/dist/chat/headless/sidebar/environment.d.ts +5 -2
- package/dist/chat/headless/sidebar/environment.js +11 -2
- package/dist/chat/headless/sidebar/host.d.ts +15 -0
- package/dist/chat/headless/sidebar/inbox.d.ts +12 -3
- package/dist/chat/headless/sidebar/inbox.js +18 -9
- package/dist/chat/headless/sidebar/index.d.ts +2 -2
- package/dist/chat/headless/sidebar/index.js +2 -2
- package/dist/chat/headless/sidebar/labels.d.ts +28 -2
- package/dist/chat/headless/sidebar/labels.js +16 -0
- package/dist/chat/headless/transcript/fold-actions.d.ts +8 -3
- package/dist/chat/headless/transcript/fold-actions.js +16 -0
- package/dist/chat/headless/transcript/fold.d.ts +2 -1
- package/dist/chat/headless/transcript/fold.js +22 -2
- package/dist/chat/headless/transcript/index.d.ts +2 -1
- package/dist/chat/headless/transcript/index.js +2 -1
- package/dist/chat/headless/transcript/rail.d.ts +93 -0
- package/dist/chat/headless/transcript/rail.js +148 -0
- package/dist/chat/headless/transcript/rows.d.ts +6 -0
- package/dist/chat/headless/transcript/run-failures.d.ts +4 -0
- package/dist/chat/headless/transcript/run-failures.js +29 -1
- package/dist/chat/headless/transcript-labels.d.ts +1 -0
- package/dist/chat/headless/turn-labels.d.ts +1 -0
- package/dist/chat/headless/turn-labels.js +2 -1
- package/dist/chat/index.d.ts +4 -3
- package/dist/chat/index.js +14 -13
- package/dist/chat/interactions/ElicitationCard.js +1 -1
- package/dist/chat/interactions/InteractionCard.js +1 -1
- package/dist/chat/interactions/PlanCard.js +3 -3
- package/dist/chat/interactions/QuestionField.js +4 -4
- package/dist/chat/interactions/QuestionForm.js +3 -3
- package/dist/chat/interactions/SecretInput.js +1 -1
- package/dist/chat/sidebar/ProjectIcon.d.ts +1 -1
- package/dist/chat/sidebar/ProjectIcon.js +1 -1
- package/dist/chat/sidebar/RowChips.d.ts +3 -2
- package/dist/chat/sidebar/RowChips.js +6 -3
- package/dist/chat/sidebar/SessionSidebar.js +13 -14
- package/dist/chat/sidebar/SidebarFrame.d.ts +2 -0
- package/dist/chat/sidebar/SidebarFrame.js +5 -2
- package/dist/chat/sidebar/SidebarSessionRow.d.ts +3 -1
- package/dist/chat/sidebar/SidebarSessionRow.js +3 -1
- package/dist/chat/sidebar/SpacesSection.d.ts +20 -1
- package/dist/chat/sidebar/SpacesSection.js +34 -13
- package/dist/chat/sidebar/index.d.ts +2 -2
- package/dist/chat/sidebar/session-menu.d.ts +11 -2
- package/dist/chat/sidebar/session-menu.js +50 -5
- package/dist/chat/sidebar/sidebar-live.js +1 -1
- package/dist/chat/sidebar/useInboxRows.js +43 -2
- package/dist/chat/sidebar/useInboxTriage.js +19 -14
- package/dist/chat/testing/fixture-sidebar-host.d.ts +7 -1
- package/dist/chat/testing/fixture-sidebar-host.js +12 -0
- package/dist/chat/testing/sidebar.contract.d.ts +6 -0
- package/dist/chat/testing/sidebar.contract.js +24 -0
- package/dist/chat/transcript/InteractionToolBody.js +1 -1
- package/dist/chat/transcript/SelectCursor.d.ts +11 -1
- package/dist/chat/transcript/SelectCursor.js +10 -5
- package/dist/chat/transcript/TranscriptRail.d.ts +86 -0
- package/dist/chat/transcript/TranscriptRail.js +421 -0
- package/dist/chat/transcript/TranscriptRow.js +5 -2
- package/dist/chat/transcript/actions.d.ts +6 -2
- package/dist/chat/transcript/fold.js +19 -1
- package/dist/chat/transcript/index.d.ts +3 -2
- package/dist/chat/transcript/index.js +3 -2
- package/dist/chat/transcript/notices.d.ts +23 -1
- package/dist/chat/transcript/notices.js +108 -27
- package/dist/chat/transcript/prose.js +1 -0
- package/dist/chat/transcript/receipt-parts.d.ts +22 -0
- package/dist/chat/transcript/receipt-parts.js +87 -0
- package/dist/chat/transcript/run-rows.js +3 -76
- package/dist/chat/transcript/script-input.d.ts +1 -1
- package/dist/chat/transcript/scroll-clamp.js +1 -1
- package/dist/chat/transcript/useSettledReveal.js +15 -3
- package/dist/chat/transcript/useStickToBottom.js +2 -1
- package/dist/components/ChoiceCards.js +1 -1
- package/dist/components/ConfirmDialog.js +1 -1
- package/dist/components/CopyValue.d.ts +33 -0
- package/dist/components/CopyValue.js +54 -0
- package/dist/components/Form.js +1 -1
- package/dist/components/HowItWorks.js +1 -1
- package/dist/components/Menu.js +1 -1
- package/dist/components/StepFrame.js +2 -2
- package/dist/components/SwatchPicker.js +1 -1
- package/dist/components/ToggleCard.js +1 -1
- package/dist/components/floating/HoverCard.js +2 -3
- package/dist/components/floating/hover-delay.d.ts +4 -0
- package/dist/components/floating/hover-delay.js +6 -0
- package/dist/core.css +14 -12
- package/dist/dist/index-De9AbmxS.d.ts +1 -0
- package/dist/dist/{index-Betz0OWq.d.ts → index-E1Z0aPmi.d.ts} +20 -2
- package/dist/dist/index.d.ts +5 -5
- package/dist/dist/sandbox-CSUihARm.d.ts +2 -0
- package/dist/dist/{timeout-CyU7HLyz.d.ts → timeout-CmTx6V9y.d.ts} +1 -0
- package/dist/extensions/ExtensionDialogHost.js +1 -1
- package/dist/files/TreeColumn.js +3 -1
- package/dist/files/headless/host.d.ts +2 -2
- package/dist/git/ImportRepoDialog.js +1 -1
- package/dist/git/MoveSessionDialog.js +2 -2
- package/dist/git/SandboxManager.d.ts +42 -0
- package/dist/git/SandboxManager.js +297 -0
- package/dist/git/SyncChip.js +1 -1
- package/dist/git/headless/index.d.ts +2 -1
- package/dist/git/headless/index.js +2 -1
- package/dist/git/headless/labels.d.ts +29 -0
- package/dist/git/headless/labels.js +34 -1
- package/dist/git/headless/sandboxes.d.ts +43 -0
- package/dist/git/headless/sandboxes.js +52 -0
- package/dist/git/index.d.ts +2 -1
- package/dist/git/index.js +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/keybindings/headless/catalog.d.ts +1 -1
- package/dist/keybindings/headless/catalog.js +12 -0
- package/dist/machines/HostsSection.d.ts +1 -1
- package/dist/machines/headless/labels.js +2 -2
- package/dist/motion/flip-list.js +3 -10
- package/dist/motion/presence.d.ts +10 -0
- package/dist/motion/presence.js +20 -1
- package/dist/motion/swap.d.ts +8 -2
- package/dist/motion/swap.js +5 -2
- package/dist/onboarding/conversation.js +27 -15
- package/dist/onboarding/demos/how-it-works.js +1 -1
- package/dist/onboarding/skills/parts.js +4 -4
- package/dist/onboarding/sources/SourceBrowser.js +1 -1
- package/dist/onboarding/steps/ReadyStep.js +1 -1
- package/dist/onboarding/steps/connect/KeyForm.js +1 -1
- package/dist/palette/headless/app-sources.js +20 -0
- package/dist/palette/headless/labels.js +2 -0
- package/dist/session/PlanTracker.js +3 -3
- package/dist/session/SecretsPanel.js +1 -1
- package/dist/session/SessionHeader.d.ts +18 -6
- package/dist/session/SessionHeader.js +67 -12
- package/dist/session/SessionPlaceMenu.d.ts +35 -0
- package/dist/session/SessionPlaceMenu.js +299 -0
- package/dist/session/SessionShell.js +1 -1
- package/dist/session/TurnDetailsDialog.js +1 -1
- package/dist/session/headless/index.d.ts +2 -1
- package/dist/session/headless/index.js +2 -1
- package/dist/session/headless/labels.d.ts +73 -0
- package/dist/session/headless/labels.js +73 -0
- package/dist/session/headless/place.d.ts +49 -0
- package/dist/session/headless/place.js +57 -0
- package/dist/session/index.d.ts +2 -1
- package/dist/session/index.js +2 -1
- package/dist/settings/ConversationPresetsCard.js +1 -1
- package/dist/settings/SettingCard.js +2 -2
- package/dist/settings/SettingsRowsPage.js +1 -1
- package/dist/settings/headless/fixture-sections.js +7 -0
- package/dist/settings/headless/labels.d.ts +1 -1
- package/dist/settings/headless/labels.js +1 -1
- package/dist/settings/headless/layout.d.ts +4 -4
- package/dist/settings/headless/layout.js +1 -1
- package/dist/settings/headless/search.d.ts +2 -2
- package/dist/settings/headless/sections-host.d.ts +20 -2
- package/dist/settings/sections/claude-import/ClaudeImportDialog.js +1 -1
- package/dist/settings/sections/enabled-list/EnabledListSection.js +2 -2
- package/dist/settings/sections/environments/EnvironmentsSection.d.ts +9 -3
- package/dist/settings/sections/environments/EnvironmentsSection.js +292 -52
- package/dist/settings/sections/environments/labels.d.ts +15 -0
- package/dist/settings/sections/environments/labels.js +18 -3
- package/dist/settings/sections/extensions/ChangeOriginDialog.js +1 -1
- package/dist/settings/sections/extensions/ExtensionSourceBrowser.js +1 -1
- package/dist/settings/sections/extensions/ExtensionsSection.d.ts +3 -2
- package/dist/settings/sections/extensions/ExtensionsSection.js +9 -3
- package/dist/settings/sections/host-catalog/HostCatalogSection.js +15 -5
- package/dist/settings/sections/keybindings/labels.d.ts +2 -0
- package/dist/settings/sections/keybindings/labels.js +2 -0
- package/dist/settings/sections/keybindings/rows.js +8 -0
- package/dist/settings/sections/models/SpacesDefaultsSection.d.ts +7 -3
- package/dist/settings/sections/models/SpacesDefaultsSection.js +11 -5
- package/dist/settings/sections/skills/SkillGroups.js +1 -1
- package/dist/settings/server-app.d.ts +4 -2
- package/dist/settings/server-app.js +7 -3
- package/dist/settings/testing/sections.contract.d.ts +7 -1
- package/dist/settings/testing/sections.contract.js +37 -0
- package/dist/styles.css +212 -19
- package/dist/terminal/TerminalDrawer.js +3 -1
- package/dist/workspace/SidePanel.js +3 -1
- package/package.json +2 -2
- package/src/styles/base.css +13 -0
- package/src/styles/chat.css +30 -0
- package/src/styles/components.css +0 -10
- package/src/styles/files.css +5 -0
- package/src/styles/sidebar.css +29 -7
- package/src/styles/terminal.css +6 -0
- package/src/styles/tokens.css +5 -0
- package/src/styles/transcript.css +107 -0
- package/src/styles/workspace.css +6 -0
- package/dist/dist/index-QcFzZlao.d.ts +0 -1
- package/dist/dist/sandbox-D0zsW8I1.d.ts +0 -2
- /package/dist/dist/{types-_Dtoq_No.d.ts → execution-failure-SREfl-EZ.d.ts} +0 -0
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { constant, useReadable } from "../../../chat/headless/store.js";
|
|
2
2
|
import { HostBadge } from "../../../chat/HostBadge.js";
|
|
3
|
-
import "../../../components/button.js";
|
|
3
|
+
import { buttonClass } from "../../../components/button.js";
|
|
4
|
+
import { Popover } from "../../../components/floating/Popover.js";
|
|
4
5
|
import { ErrorNote, FormCard, FormSection, INPUT_CLASS as INPUT_CLASS$1, MetaChip, RowText, Switch } from "../../../components/Form.js";
|
|
6
|
+
import { Menu, MenuRow, MenuSection } from "../../../components/Menu.js";
|
|
5
7
|
import { Notice } from "../../../components/Notice.js";
|
|
6
|
-
import { errorMessage } from "../../../components/report-error.js";
|
|
7
8
|
import { Segmented } from "../../../components/Segmented.js";
|
|
9
|
+
import { Tabs } from "../../../components/Tabs.js";
|
|
8
10
|
import { environmentKindIcon } from "../../../git/headless/environment.js";
|
|
11
|
+
import { SandboxManager } from "../../../git/SandboxManager.js";
|
|
9
12
|
import { hostSettingsFocus } from "../../../machines/headless/settings-focus.js";
|
|
10
13
|
import { useMachinesHost } from "../../../machines/MachinesProvider.js";
|
|
11
14
|
import { toSettingsError } from "../../headless/host.js";
|
|
15
|
+
import { ValueChip } from "../../rows.js";
|
|
12
16
|
import { SettingsPanel, SettingsPanelBody, useSettingsSection } from "../../section.js";
|
|
13
17
|
import { useSettingsHost } from "../../SettingsProvider.js";
|
|
14
18
|
import { SettingsRestricted } from "../../SettingsRestricted.js";
|
|
@@ -16,7 +20,7 @@ import { SettingsTutorial } from "../../SettingsTutorial.js";
|
|
|
16
20
|
import { useCatalogSharedLabels, useSettingsValues } from "../shared/catalog.js";
|
|
17
21
|
import { useSectionLabels } from "../use-section-labels.js";
|
|
18
22
|
import { DEFAULT_ENVIRONMENTS_SECTION_LABELS } from "./labels.js";
|
|
19
|
-
import { useCallback, useEffect, useState } from "react";
|
|
23
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
20
24
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
21
25
|
import { parseMachineKind } from "zidane/chat/pure";
|
|
22
26
|
// src/settings/sections/environments/EnvironmentsSection.tsx
|
|
@@ -31,7 +35,7 @@ const INPUT_CLASS = `${INPUT_CLASS$1} !w-64 max-w-full`;
|
|
|
31
35
|
*
|
|
32
36
|
* @param props - The folder, `className` and `style`.
|
|
33
37
|
*/
|
|
34
|
-
function EnvironmentsSection({ cwd, className, style }) {
|
|
38
|
+
function EnvironmentsSection({ cwd, onOpenSession, className, style }) {
|
|
35
39
|
const host = useSettingsHost().environments;
|
|
36
40
|
const l = useEnvironmentsSectionLabels();
|
|
37
41
|
const shared = useCatalogSharedLabels();
|
|
@@ -77,59 +81,120 @@ function EnvironmentsSection({ cwd, className, style }) {
|
|
|
77
81
|
});
|
|
78
82
|
const enabled = descriptors.filter((d) => d.enabled);
|
|
79
83
|
const defaultKind = descriptors.find((d) => d.isDefault)?.kind ?? "local";
|
|
84
|
+
const cloud = descriptors.filter((d) => d.canListSandboxes);
|
|
85
|
+
const machines = descriptors.filter((d) => !d.canListSandboxes);
|
|
86
|
+
const card = (descriptor) => /* @__PURE__ */ jsx(EnvironmentCard, {
|
|
87
|
+
descriptor,
|
|
88
|
+
baseLabel: descriptors.find((d) => d.kind === parseMachineKind(descriptor.kind)?.base)?.label,
|
|
89
|
+
onUpdate
|
|
90
|
+
}, descriptor.kind);
|
|
91
|
+
const managed = cloud.filter((d) => d.enabled);
|
|
92
|
+
const setup = /* @__PURE__ */ jsxs("div", {
|
|
93
|
+
className: "space-y-5",
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ jsx(SettingsTutorial, { topic: "environments" }),
|
|
96
|
+
error && /* @__PURE__ */ jsx(ErrorNote, { children: /* @__PURE__ */ jsxs("span", {
|
|
97
|
+
className: "flex items-start gap-2",
|
|
98
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
99
|
+
"aria-hidden": true,
|
|
100
|
+
className: "i-ph-warning-circle text-sm shrink-0 mt-px"
|
|
101
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
102
|
+
className: "min-w-0",
|
|
103
|
+
children: shared.catalogError(error)
|
|
104
|
+
})]
|
|
105
|
+
}) }),
|
|
106
|
+
/* @__PURE__ */ jsx(SettingsRestricted, { children: /* @__PURE__ */ jsx(FormSection, { children: /* @__PURE__ */ jsxs("div", {
|
|
107
|
+
className: "flex flex-col items-start gap-3 px-3 py-3",
|
|
108
|
+
children: [/* @__PURE__ */ jsx(RowText, {
|
|
109
|
+
label: l.environmentsSectionDefault,
|
|
110
|
+
description: l.environmentsSectionDefaultHint,
|
|
111
|
+
truncate: false
|
|
112
|
+
}), /* @__PURE__ */ jsx(Segmented, {
|
|
113
|
+
value: defaultKind,
|
|
114
|
+
onChange: (kind) => void update({
|
|
115
|
+
kind,
|
|
116
|
+
makeDefault: true
|
|
117
|
+
}),
|
|
118
|
+
options: enabled.map((d) => ({
|
|
119
|
+
value: d.kind,
|
|
120
|
+
label: d.label,
|
|
121
|
+
icon: environmentKindIcon(d.kind),
|
|
122
|
+
...onUpdate ? {} : { disabled: true }
|
|
123
|
+
})),
|
|
124
|
+
ariaLabel: l.environmentsSectionDefault,
|
|
125
|
+
className: "max-w-full overflow-x-auto"
|
|
126
|
+
})]
|
|
127
|
+
}) }) }),
|
|
128
|
+
machines.length > 0 && /* @__PURE__ */ jsx(FormSection, {
|
|
129
|
+
layout: "cards",
|
|
130
|
+
title: cloud.length > 0 ? l.environmentsSectionLocalGroup : void 0,
|
|
131
|
+
children: machines.map(card)
|
|
132
|
+
}),
|
|
133
|
+
cloud.length > 0 && /* @__PURE__ */ jsx(FormSection, {
|
|
134
|
+
layout: "cards",
|
|
135
|
+
title: l.environmentsSectionCloudGroup,
|
|
136
|
+
children: cloud.map(card)
|
|
137
|
+
})
|
|
138
|
+
]
|
|
139
|
+
});
|
|
80
140
|
return /* @__PURE__ */ jsx(SettingsPanel, {
|
|
81
141
|
className,
|
|
82
142
|
style,
|
|
83
|
-
children: /* @__PURE__ */ jsx(SettingsPanelBody, { children: /* @__PURE__ */
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
}) }),
|
|
97
|
-
/* @__PURE__ */ jsx(SettingsRestricted, { children: /* @__PURE__ */ jsx(FormSection, { children: /* @__PURE__ */ jsxs("div", {
|
|
98
|
-
className: "flex flex-col items-start gap-3 px-3 py-3",
|
|
99
|
-
children: [/* @__PURE__ */ jsx(RowText, {
|
|
100
|
-
label: l.environmentsSectionDefault,
|
|
101
|
-
description: l.environmentsSectionDefaultHint,
|
|
102
|
-
truncate: false
|
|
103
|
-
}), /* @__PURE__ */ jsx(Segmented, {
|
|
104
|
-
value: defaultKind,
|
|
105
|
-
onChange: (kind) => void update({
|
|
106
|
-
kind,
|
|
107
|
-
makeDefault: true
|
|
108
|
-
}),
|
|
109
|
-
options: enabled.map((d) => ({
|
|
110
|
-
value: d.kind,
|
|
111
|
-
label: d.label,
|
|
112
|
-
icon: environmentKindIcon(d.kind),
|
|
113
|
-
...onUpdate ? {} : { disabled: true }
|
|
114
|
-
})),
|
|
115
|
-
ariaLabel: l.environmentsSectionDefault,
|
|
116
|
-
className: "max-w-full overflow-x-auto"
|
|
117
|
-
})]
|
|
118
|
-
}) }) }),
|
|
119
|
-
/* @__PURE__ */ jsx(FormSection, {
|
|
120
|
-
layout: "cards",
|
|
121
|
-
children: descriptors.map((descriptor) => /* @__PURE__ */ jsx(EnvironmentCard, {
|
|
122
|
-
descriptor,
|
|
123
|
-
baseLabel: descriptors.find((d) => d.kind === parseMachineKind(descriptor.kind)?.base)?.label,
|
|
124
|
-
onUpdate
|
|
125
|
-
}, descriptor.kind))
|
|
143
|
+
children: /* @__PURE__ */ jsx(SettingsPanelBody, { children: host?.sandboxes && managed.length > 0 ? /* @__PURE__ */ jsx(Tabs, {
|
|
144
|
+
size: "md",
|
|
145
|
+
ariaLabel: l.environmentsSectionTabs,
|
|
146
|
+
items: [{
|
|
147
|
+
id: "setup",
|
|
148
|
+
label: l.environmentsSectionSetupTab,
|
|
149
|
+
content: setup
|
|
150
|
+
}, {
|
|
151
|
+
id: "manage",
|
|
152
|
+
label: l.environmentsSectionManageTab,
|
|
153
|
+
content: /* @__PURE__ */ jsx(ManageSandboxes, {
|
|
154
|
+
kinds: managed,
|
|
155
|
+
...onOpenSession ? { onOpenSession } : {}
|
|
126
156
|
})
|
|
127
|
-
]
|
|
128
|
-
}) })
|
|
157
|
+
}]
|
|
158
|
+
}) : setup })
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
/** Manage: the turned-on kinds' sandboxes, through the settings host. */
|
|
162
|
+
function ManageSandboxes({ kinds, onOpenSession }) {
|
|
163
|
+
const host = useSettingsHost().environments;
|
|
164
|
+
const shared = useCatalogSharedLabels();
|
|
165
|
+
const list = host?.sandboxes;
|
|
166
|
+
const pause = host?.pauseSandbox;
|
|
167
|
+
const remove = host?.deleteSandbox;
|
|
168
|
+
const source = useMemo(() => {
|
|
169
|
+
const worded = (call) => (...args) => call(...args).catch((err) => {
|
|
170
|
+
throw new Error(shared.catalogError(toSettingsError(err)));
|
|
171
|
+
});
|
|
172
|
+
return {
|
|
173
|
+
list: list ? worded(list) : async () => [],
|
|
174
|
+
...pause ? { pause: worded(pause) } : {},
|
|
175
|
+
...remove ? { remove: worded(remove) } : {}
|
|
176
|
+
};
|
|
177
|
+
}, [
|
|
178
|
+
list,
|
|
179
|
+
pause,
|
|
180
|
+
remove,
|
|
181
|
+
shared
|
|
182
|
+
]);
|
|
183
|
+
const shown = useMemo(() => kinds.map((d) => ({
|
|
184
|
+
kind: d.kind,
|
|
185
|
+
label: d.label,
|
|
186
|
+
icon: environmentKindIcon(d.kind),
|
|
187
|
+
...!d.available && d.reason ? { unavailable: d.reason } : {}
|
|
188
|
+
})), [kinds]);
|
|
189
|
+
return /* @__PURE__ */ jsx(SandboxManager, {
|
|
190
|
+
kinds: shown,
|
|
191
|
+
source,
|
|
192
|
+
...onOpenSession ? { onOpenSession } : {}
|
|
129
193
|
});
|
|
130
194
|
}
|
|
131
195
|
function EnvironmentCard({ descriptor, baseLabel, onUpdate }) {
|
|
132
196
|
const l = useEnvironmentsSectionLabels();
|
|
197
|
+
const shared = useCatalogSharedLabels();
|
|
133
198
|
const verify = useSettingsHost().environments?.verify;
|
|
134
199
|
const { kind } = descriptor;
|
|
135
200
|
const isLocal = kind === "local";
|
|
@@ -144,7 +209,7 @@ function EnvironmentCard({ descriptor, baseLabel, onUpdate }) {
|
|
|
144
209
|
})).catch((err) => setTest({
|
|
145
210
|
state: "done",
|
|
146
211
|
ok: false,
|
|
147
|
-
text:
|
|
212
|
+
text: shared.catalogError(toSettingsError(err))
|
|
148
213
|
}));
|
|
149
214
|
};
|
|
150
215
|
const fields = descriptor.enabled ? descriptor.fields.filter((field) => field.visible) : [];
|
|
@@ -235,13 +300,15 @@ function EnvironmentCard({ descriptor, baseLabel, onUpdate }) {
|
|
|
235
300
|
kind,
|
|
236
301
|
enabled: !descriptor.enabled
|
|
237
302
|
}),
|
|
238
|
-
className: "shrink-0 self-center bg-transparent border-0 p-0 cursor-pointer rounded-full zg-focus-ring",
|
|
303
|
+
className: "shrink-0 self-center inline-flex items-center bg-transparent border-0 p-0 cursor-pointer rounded-full zg-focus-ring",
|
|
239
304
|
children: /* @__PURE__ */ jsx(Switch, { on: descriptor.enabled })
|
|
240
305
|
})
|
|
241
306
|
]
|
|
242
307
|
}), fields.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
243
308
|
className: "border-t border-[var(--zg-hairline)] p-1",
|
|
244
309
|
children: fields.map((field) => /* @__PURE__ */ jsx(FieldRow, {
|
|
310
|
+
kind,
|
|
311
|
+
provider: descriptor.label,
|
|
245
312
|
field,
|
|
246
313
|
readOnly: !onUpdate,
|
|
247
314
|
onChange: (value) => setValue(field.key, value)
|
|
@@ -272,7 +339,15 @@ function MachineBadge({ machine }) {
|
|
|
272
339
|
...hostId ? { onOpen: () => select("hosts", hostSettingsFocus(hostId)) } : {}
|
|
273
340
|
});
|
|
274
341
|
}
|
|
275
|
-
function FieldRow({ field, readOnly, onChange }) {
|
|
342
|
+
function FieldRow({ field, readOnly, onChange, kind, provider }) {
|
|
343
|
+
const fieldChoices = useSettingsHost().environments?.fieldChoices;
|
|
344
|
+
if (field.listed && fieldChoices && kind) return /* @__PURE__ */ jsx(ListedRow, {
|
|
345
|
+
field,
|
|
346
|
+
readOnly,
|
|
347
|
+
onChange,
|
|
348
|
+
kind,
|
|
349
|
+
provider: provider ?? kind
|
|
350
|
+
});
|
|
276
351
|
if (field.type === "boolean") {
|
|
277
352
|
const on = field.value === true;
|
|
278
353
|
return /* @__PURE__ */ jsxs("button", {
|
|
@@ -376,6 +451,171 @@ function ChoiceField({ field, readOnly, onChange }) {
|
|
|
376
451
|
})]
|
|
377
452
|
});
|
|
378
453
|
}
|
|
454
|
+
/**
|
|
455
|
+
* An option whose values the provider lists (a sandbox's template or snapshot): the value chip opens them,
|
|
456
|
+
* read when it first opens. The provider's own and the platform's sit in two groups, each with its facts as
|
|
457
|
+
* badges, under Default. A value the provider no longer lists shows as not found. "Enter a name" swaps to the
|
|
458
|
+
* text field (an image the list can't show), and the list can come back.
|
|
459
|
+
*/
|
|
460
|
+
function ListedRow({ field, readOnly, onChange, kind, provider }) {
|
|
461
|
+
const l = useEnvironmentsSectionLabels();
|
|
462
|
+
const shared = useCatalogSharedLabels();
|
|
463
|
+
const fieldChoices = useSettingsHost().environments?.fieldChoices;
|
|
464
|
+
const [listed, setListed] = useState(null);
|
|
465
|
+
const [typing, setTyping] = useState(false);
|
|
466
|
+
const current = typeof field.value === "string" ? field.value : "";
|
|
467
|
+
const fallback = field.placeholder ?? (typeof field.default === "string" && field.default ? field.default : void 0);
|
|
468
|
+
const read = useCallback(() => {
|
|
469
|
+
if (!fieldChoices) return;
|
|
470
|
+
setListed({ state: "loading" });
|
|
471
|
+
fieldChoices(kind, field.key).then((choices) => setListed({
|
|
472
|
+
state: "ready",
|
|
473
|
+
choices
|
|
474
|
+
})).catch((err) => setListed({
|
|
475
|
+
state: "failed",
|
|
476
|
+
message: shared.catalogError(toSettingsError(err))
|
|
477
|
+
}));
|
|
478
|
+
}, [
|
|
479
|
+
fieldChoices,
|
|
480
|
+
kind,
|
|
481
|
+
field.key,
|
|
482
|
+
shared
|
|
483
|
+
]);
|
|
484
|
+
if (typing) return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(TextRow, {
|
|
485
|
+
field,
|
|
486
|
+
readOnly,
|
|
487
|
+
onChange
|
|
488
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
489
|
+
className: "px-3 pb-2 -mt-1 flex justify-end",
|
|
490
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
491
|
+
type: "button",
|
|
492
|
+
className: buttonClass({
|
|
493
|
+
variant: "ghost",
|
|
494
|
+
size: "xs",
|
|
495
|
+
flush: "end"
|
|
496
|
+
}),
|
|
497
|
+
onClick: () => setTyping(false),
|
|
498
|
+
children: l.environmentsSectionChoiceList
|
|
499
|
+
})
|
|
500
|
+
})] });
|
|
501
|
+
const choices = listed?.state === "ready" ? listed.choices : [];
|
|
502
|
+
const known = choices.find((choice) => choice.value === current);
|
|
503
|
+
const groups = [{
|
|
504
|
+
id: "account",
|
|
505
|
+
label: l.environmentsSectionChoicesAccount,
|
|
506
|
+
items: choices.filter((c) => c.origin !== "platform")
|
|
507
|
+
}, {
|
|
508
|
+
id: "platform",
|
|
509
|
+
label: l.environmentsSectionChoicesPlatform(provider),
|
|
510
|
+
items: choices.filter((c) => c.origin === "platform")
|
|
511
|
+
}].filter((group) => group.items.length > 0);
|
|
512
|
+
const pick = (close, value) => {
|
|
513
|
+
close();
|
|
514
|
+
if ((value ?? "") !== current) onChange(value);
|
|
515
|
+
};
|
|
516
|
+
const facts = (choice) => choice.facts?.length ? /* @__PURE__ */ jsx("span", {
|
|
517
|
+
className: "flex flex-wrap gap-1 mt-1",
|
|
518
|
+
children: choice.facts.map((fact) => /* @__PURE__ */ jsx("span", {
|
|
519
|
+
className: "zg-row-badge inline-flex items-center h-[18px] px-1.5 rounded-zg-sm text-zg-meta leading-zg-meta whitespace-nowrap font-mono",
|
|
520
|
+
children: fact
|
|
521
|
+
}, fact))
|
|
522
|
+
}) : void 0;
|
|
523
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
524
|
+
className: "flex items-center gap-4 px-3 py-2.5",
|
|
525
|
+
children: [/* @__PURE__ */ jsx(FieldLabel, {
|
|
526
|
+
field,
|
|
527
|
+
note: field.fromEnv ? l.environmentsSectionFromEnv(field.fromEnv) : void 0
|
|
528
|
+
}), /* @__PURE__ */ jsx(Popover, {
|
|
529
|
+
role: "menu",
|
|
530
|
+
ariaLabel: field.label,
|
|
531
|
+
side: "bottom",
|
|
532
|
+
align: "end",
|
|
533
|
+
width: 320,
|
|
534
|
+
onOpenChange: (open) => open && !listed && read(),
|
|
535
|
+
trigger: (props) => /* @__PURE__ */ jsx("button", {
|
|
536
|
+
type: "button",
|
|
537
|
+
...props,
|
|
538
|
+
disabled: readOnly || void 0,
|
|
539
|
+
"aria-label": field.label,
|
|
540
|
+
className: "shrink-0 bg-transparent border-0 p-0 cursor-pointer rounded-zg-md zg-focus-ring disabled:cursor-default",
|
|
541
|
+
children: /* @__PURE__ */ jsx(ValueChip, {
|
|
542
|
+
muted: !current,
|
|
543
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
544
|
+
className: current ? "font-mono" : void 0,
|
|
545
|
+
children: current || (fallback ? l.environmentsSectionChoiceDefaultNamed(fallback) : l.environmentsSectionChoiceDefault)
|
|
546
|
+
})
|
|
547
|
+
})
|
|
548
|
+
}),
|
|
549
|
+
children: (close) => /* @__PURE__ */ jsxs(Menu, {
|
|
550
|
+
role: "group",
|
|
551
|
+
className: "max-h-[360px] overflow-y-auto",
|
|
552
|
+
children: [
|
|
553
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
554
|
+
role: "menuitemradio",
|
|
555
|
+
checked: !current,
|
|
556
|
+
title: l.environmentsSectionChoiceDefault,
|
|
557
|
+
...fallback ? { description: /* @__PURE__ */ jsx("span", {
|
|
558
|
+
className: "font-mono",
|
|
559
|
+
children: fallback
|
|
560
|
+
}) } : {},
|
|
561
|
+
onClick: () => pick(close, null)
|
|
562
|
+
}),
|
|
563
|
+
current && listed?.state === "ready" && !known && /* @__PURE__ */ jsx(MenuRow, {
|
|
564
|
+
role: "menuitemradio",
|
|
565
|
+
checked: true,
|
|
566
|
+
title: /* @__PURE__ */ jsx("span", {
|
|
567
|
+
className: "font-mono",
|
|
568
|
+
children: current
|
|
569
|
+
}),
|
|
570
|
+
description: l.environmentsSectionChoiceMissing,
|
|
571
|
+
size: "lg",
|
|
572
|
+
onClick: close
|
|
573
|
+
}),
|
|
574
|
+
listed?.state === "loading" && /* @__PURE__ */ jsx("p", {
|
|
575
|
+
className: "m-0 px-3 py-2 text-xs text-[var(--zg-text-muted)]",
|
|
576
|
+
children: l.environmentsSectionChoicesLoading
|
|
577
|
+
}),
|
|
578
|
+
listed?.state === "failed" && /* @__PURE__ */ jsx(Notice, {
|
|
579
|
+
tone: "error",
|
|
580
|
+
compact: true,
|
|
581
|
+
detail: listed.message,
|
|
582
|
+
className: "m-1",
|
|
583
|
+
children: l.environmentsSectionChoicesFailed
|
|
584
|
+
}),
|
|
585
|
+
listed?.state === "ready" && choices.length === 0 && /* @__PURE__ */ jsx("p", {
|
|
586
|
+
className: "m-0 px-3 py-2 text-xs text-[var(--zg-text-muted)]",
|
|
587
|
+
children: l.environmentsSectionChoicesEmpty
|
|
588
|
+
}),
|
|
589
|
+
groups.map((group) => /* @__PURE__ */ jsx(MenuSection, {
|
|
590
|
+
label: group.label,
|
|
591
|
+
children: group.items.map((choice) => /* @__PURE__ */ jsx(MenuRow, {
|
|
592
|
+
role: "menuitemradio",
|
|
593
|
+
size: "lg",
|
|
594
|
+
checked: choice.value === current,
|
|
595
|
+
title: /* @__PURE__ */ jsx("span", {
|
|
596
|
+
className: "font-mono",
|
|
597
|
+
children: choice.label
|
|
598
|
+
}),
|
|
599
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [choice.description && /* @__PURE__ */ jsx("span", {
|
|
600
|
+
className: "block zg-meta truncate",
|
|
601
|
+
children: choice.description
|
|
602
|
+
}), facts(choice)] }),
|
|
603
|
+
onClick: () => pick(close, choice.value)
|
|
604
|
+
}, choice.value))
|
|
605
|
+
}, group.id)),
|
|
606
|
+
/* @__PURE__ */ jsx(MenuSection, { children: /* @__PURE__ */ jsx(MenuRow, {
|
|
607
|
+
role: "menuitem",
|
|
608
|
+
title: l.environmentsSectionChoiceCustom,
|
|
609
|
+
onClick: () => {
|
|
610
|
+
close();
|
|
611
|
+
setTyping(true);
|
|
612
|
+
}
|
|
613
|
+
}) })
|
|
614
|
+
]
|
|
615
|
+
})
|
|
616
|
+
})]
|
|
617
|
+
});
|
|
618
|
+
}
|
|
379
619
|
/** String / path / number: free input, committed on blur or Enter; empty resets to the default. */
|
|
380
620
|
function TextRow({ field, readOnly, onChange }) {
|
|
381
621
|
const l = useEnvironmentsSectionLabels();
|
|
@@ -25,6 +25,21 @@ export declare const DEFAULT_ENVIRONMENTS_SECTION_LABELS: {
|
|
|
25
25
|
environmentsSectionSecretReplace: string;
|
|
26
26
|
environmentsSectionSecretPlaceholder: string;
|
|
27
27
|
environmentsSectionClear: string;
|
|
28
|
+
environmentsSectionTabs: string;
|
|
29
|
+
environmentsSectionSetupTab: string;
|
|
30
|
+
environmentsSectionManageTab: string;
|
|
31
|
+
environmentsSectionLocalGroup: string;
|
|
32
|
+
environmentsSectionCloudGroup: string;
|
|
33
|
+
environmentsSectionChoiceDefault: string;
|
|
34
|
+
environmentsSectionChoiceDefaultNamed: (name: string) => string;
|
|
35
|
+
environmentsSectionChoicesLoading: string;
|
|
36
|
+
environmentsSectionChoicesFailed: string;
|
|
37
|
+
environmentsSectionChoicesAccount: string;
|
|
38
|
+
environmentsSectionChoicesPlatform: (provider: string) => string;
|
|
39
|
+
environmentsSectionChoicesEmpty: string;
|
|
40
|
+
environmentsSectionChoiceMissing: string;
|
|
41
|
+
environmentsSectionChoiceCustom: string;
|
|
42
|
+
environmentsSectionChoiceList: string;
|
|
28
43
|
};
|
|
29
44
|
/** The shape of the Environments section's label dictionary. */
|
|
30
45
|
export type EnvironmentsSectionLabels = typeof DEFAULT_ENVIRONMENTS_SECTION_LABELS;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
const DEFAULT_ENVIRONMENTS_SECTION_LABELS = {
|
|
7
7
|
environmentsSectionLoading: "Loading environments…",
|
|
8
8
|
environmentsSectionDefault: "Default for new sessions",
|
|
9
|
-
environmentsSectionDefaultHint: "
|
|
9
|
+
environmentsSectionDefaultHint: "Change it per session in the composer.",
|
|
10
10
|
environmentsSectionDefaultChip: "Default",
|
|
11
11
|
environmentsSectionNotReady: "Not ready",
|
|
12
12
|
environmentsSectionNotAvailable: "Not available.",
|
|
@@ -21,10 +21,25 @@ const DEFAULT_ENVIRONMENTS_SECTION_LABELS = {
|
|
|
21
21
|
environmentsSectionHidden: "Hidden from new sessions",
|
|
22
22
|
environmentsSectionFromEnv: (name) => `From $${name}`,
|
|
23
23
|
environmentsSectionUsingEnv: (name) => `Using $${name}`,
|
|
24
|
-
environmentsSectionSecretSaved: "
|
|
24
|
+
environmentsSectionSecretSaved: "Stored in a private file, not in settings",
|
|
25
25
|
environmentsSectionSecretUnset: "Not set",
|
|
26
26
|
environmentsSectionSecretReplace: "Replace…",
|
|
27
27
|
environmentsSectionSecretPlaceholder: "Paste a key",
|
|
28
|
-
environmentsSectionClear: "Clear"
|
|
28
|
+
environmentsSectionClear: "Clear",
|
|
29
|
+
environmentsSectionTabs: "Environments",
|
|
30
|
+
environmentsSectionSetupTab: "Setup",
|
|
31
|
+
environmentsSectionManageTab: "Manage",
|
|
32
|
+
environmentsSectionLocalGroup: "On your machines",
|
|
33
|
+
environmentsSectionCloudGroup: "Cloud sandboxes",
|
|
34
|
+
environmentsSectionChoiceDefault: "Default",
|
|
35
|
+
environmentsSectionChoiceDefaultNamed: (name) => `Default (${name})`,
|
|
36
|
+
environmentsSectionChoicesLoading: "Reading the list…",
|
|
37
|
+
environmentsSectionChoicesFailed: "Couldn't read the list",
|
|
38
|
+
environmentsSectionChoicesAccount: "Yours",
|
|
39
|
+
environmentsSectionChoicesPlatform: (provider) => `From ${provider}`,
|
|
40
|
+
environmentsSectionChoicesEmpty: "None to pick",
|
|
41
|
+
environmentsSectionChoiceMissing: "Not found at the provider",
|
|
42
|
+
environmentsSectionChoiceCustom: "Enter a name",
|
|
43
|
+
environmentsSectionChoiceList: "Pick from the list"
|
|
29
44
|
};
|
|
30
45
|
export { DEFAULT_ENVIRONMENTS_SECTION_LABELS };
|
|
@@ -111,7 +111,7 @@ function ChangeOriginDialog({ name, extensionName, initial, labels: l, onSubmit,
|
|
|
111
111
|
children: l.extensionsSectionChangeOriginTitle(name)
|
|
112
112
|
}),
|
|
113
113
|
/* @__PURE__ */ jsx("p", {
|
|
114
|
-
className: "m-0 text-zg-ui leading-relaxed text-[var(--zg-text-muted)]
|
|
114
|
+
className: "m-0 text-zg-ui leading-relaxed text-[var(--zg-text-muted)]",
|
|
115
115
|
children: l.extensionsSectionChangeOriginHint
|
|
116
116
|
}),
|
|
117
117
|
/* @__PURE__ */ jsxs("label", {
|
|
@@ -148,7 +148,7 @@ function ExtensionSourceRow({ entry, picked, installed, onToggle }) {
|
|
|
148
148
|
})
|
|
149
149
|
]
|
|
150
150
|
}), entry.description && /* @__PURE__ */ jsx("span", {
|
|
151
|
-
className: "text-zg-label text-[var(--zg-text-muted)]
|
|
151
|
+
className: "text-zg-label text-[var(--zg-text-muted)] line-clamp-2",
|
|
152
152
|
children: entry.description
|
|
153
153
|
})]
|
|
154
154
|
})]
|
|
@@ -22,8 +22,9 @@
|
|
|
22
22
|
* click or the arrow beside it opens "Update from <origin>" and "Change
|
|
23
23
|
* origin…", which installs it again from another source through
|
|
24
24
|
* `changeOrigin`), Remove (asks first; `remove`, then it leaves the
|
|
25
|
-
* allowlist) and its folder (`paths.reveal`). The list
|
|
26
|
-
* each toggle
|
|
25
|
+
* allowlist; its row goes at once) and its folder (`paths.reveal`). The list
|
|
26
|
+
* is read again after each toggle (an extension's state follows the
|
|
27
|
+
* allowlist), and whenever the host says it changed (`subscribe`).
|
|
27
28
|
*/
|
|
28
29
|
import { SettingsExtension } from "../../headless/sections-host.js";
|
|
29
30
|
import { ExtensionsSectionLabels } from "./labels.js";
|
|
@@ -77,6 +77,11 @@ function ExtensionsSection({ cwd, onEdit, onCreateExtension, children, className
|
|
|
77
77
|
extensionKey,
|
|
78
78
|
refreshNonce
|
|
79
79
|
]);
|
|
80
|
+
const subscribe = host?.subscribe;
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (!cwd || !subscribe) return void 0;
|
|
83
|
+
return subscribe(cwd, () => setRefreshNonce((n) => n + 1));
|
|
84
|
+
}, [cwd, subscribe]);
|
|
80
85
|
const installed = useMemo(() => catalog.map((ext) => ext.name), [catalog]);
|
|
81
86
|
const [picks, setPicks, togglePicks] = useExtensionPicks();
|
|
82
87
|
const [scope, setScope] = useState("user");
|
|
@@ -225,6 +230,7 @@ function ExtensionsSection({ cwd, onEdit, onCreateExtension, children, className
|
|
|
225
230
|
});
|
|
226
231
|
try {
|
|
227
232
|
await host.remove(cwd, ext);
|
|
233
|
+
setCatalog((list) => list.filter((other) => other.dir !== ext.dir));
|
|
228
234
|
if (enabledExtensions?.includes(ext.name)) write("enabledExtensions", enabledExtensions.filter((n) => n !== ext.name));
|
|
229
235
|
setOpLine(null);
|
|
230
236
|
setRefreshNonce((n) => n + 1);
|
|
@@ -305,7 +311,7 @@ function ExtensionsSection({ cwd, onEdit, onCreateExtension, children, className
|
|
|
305
311
|
children: shared.catalogError(opLine.error)
|
|
306
312
|
}),
|
|
307
313
|
opLine?.kind === "error" && needsAccess && /* @__PURE__ */ jsx("p", {
|
|
308
|
-
className: "m-0 text-zg-label text-[var(--zg-text-muted)]
|
|
314
|
+
className: "m-0 text-zg-label text-[var(--zg-text-muted)]",
|
|
309
315
|
children: l.extensionsSectionAccessHint
|
|
310
316
|
}),
|
|
311
317
|
loadError && /* @__PURE__ */ jsx(ErrorNote, { children: shared.catalogError(loadError) }),
|
|
@@ -359,9 +365,9 @@ function ExtensionList({ catalog, actionOf, preamble, emptyMessage }) {
|
|
|
359
365
|
emptyMessage
|
|
360
366
|
});
|
|
361
367
|
}
|
|
362
|
-
/** Its description, else its folder (home folder as `~`)
|
|
368
|
+
/** Its description, else its folder (home folder as `~`): the same whether it is on or off. */
|
|
363
369
|
function detailOf(ext, display) {
|
|
364
|
-
return
|
|
370
|
+
return ext.description ?? (ext.dir ? display.path(ext.dir) : "");
|
|
365
371
|
}
|
|
366
372
|
function leadOf(ext) {
|
|
367
373
|
return /* @__PURE__ */ jsx(ExtensionMark, {
|
|
@@ -17,7 +17,7 @@ import { useSkillGroupsPage } from "../skills/SkillGroups.js";
|
|
|
17
17
|
import { SkillActions, SkillList } from "../skills/SkillList.js";
|
|
18
18
|
import { useSectionLabels } from "../use-section-labels.js";
|
|
19
19
|
import { DEFAULT_HOST_CATALOG_LABELS } from "./labels.js";
|
|
20
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
20
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
21
21
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
22
22
|
// src/settings/sections/host-catalog/HostCatalogSection.tsx
|
|
23
23
|
/** The host catalog section's strings, overridable through `LabelsProvider`. */
|
|
@@ -86,6 +86,10 @@ function HostCatalogSection({ kind, hostName, cwd, children, className, style })
|
|
|
86
86
|
const [picks, setPicks, togglePicks] = useExtensionPicks();
|
|
87
87
|
const [installing, setInstalling] = useState(false);
|
|
88
88
|
const restricted = useSettingsRestricted();
|
|
89
|
+
const mounted = useRef(true);
|
|
90
|
+
useEffect(() => () => {
|
|
91
|
+
mounted.current = false;
|
|
92
|
+
}, []);
|
|
89
93
|
useEffect(() => {
|
|
90
94
|
if (!catalog) return void 0;
|
|
91
95
|
let cancelled = false;
|
|
@@ -189,6 +193,12 @@ function HostCatalogSection({ kind, hostName, cwd, children, className, style })
|
|
|
189
193
|
const canInstall = installs && installKind !== null && catalog.install !== void 0;
|
|
190
194
|
const canRemove = installs && installKind !== null && catalog.remove !== void 0;
|
|
191
195
|
const canUpdate = installs && catalog.update !== void 0;
|
|
196
|
+
const remove = (removeKind, name, dir) => void act(async () => {
|
|
197
|
+
await catalog.remove(removeKind, name);
|
|
198
|
+
if (!mounted.current) return;
|
|
199
|
+
const gone = (entry) => dir !== void 0 && "dir" in entry ? entry.dir === dir : entry.name === name;
|
|
200
|
+
setEntries((current) => Array.isArray(current) ? current.filter((entry) => !gone(entry)) : current);
|
|
201
|
+
});
|
|
192
202
|
const install = async (spec) => {
|
|
193
203
|
const done = await act(() => catalog.install(installKind, spec));
|
|
194
204
|
if (done) setFormOpen(false);
|
|
@@ -196,7 +206,7 @@ function HostCatalogSection({ kind, hostName, cwd, children, className, style })
|
|
|
196
206
|
};
|
|
197
207
|
const notes = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
198
208
|
!installs && installKind && !restricted && /* @__PURE__ */ jsx("p", {
|
|
199
|
-
className: "text-xs text-[var(--zg-text-muted)] px-1 m-0
|
|
209
|
+
className: "text-xs text-[var(--zg-text-muted)] px-1 m-0",
|
|
200
210
|
children: l.hostCatalogNoInstalls(hostName)
|
|
201
211
|
}),
|
|
202
212
|
failure && /* @__PURE__ */ jsx(OpLine, {
|
|
@@ -204,7 +214,7 @@ function HostCatalogSection({ kind, hostName, cwd, children, className, style })
|
|
|
204
214
|
children: shared.catalogError(failure)
|
|
205
215
|
}),
|
|
206
216
|
failure && kind === "extensions" && needsAccessHint(shared.catalogError(failure)) && /* @__PURE__ */ jsx("p", {
|
|
207
|
-
className: "m-0 text-zg-label text-[var(--zg-text-muted)]
|
|
217
|
+
className: "m-0 text-zg-label text-[var(--zg-text-muted)]",
|
|
208
218
|
children: extensionLabels.extensionsSectionAccessHint
|
|
209
219
|
})
|
|
210
220
|
] });
|
|
@@ -236,7 +246,7 @@ function HostCatalogSection({ kind, hostName, cwd, children, className, style })
|
|
|
236
246
|
name: entry.name,
|
|
237
247
|
armed: armed === entry.name,
|
|
238
248
|
onArm: (on) => setArmed(on ? entry.name : null),
|
|
239
|
-
onDelete: () =>
|
|
249
|
+
onDelete: () => remove("skill", entry.name)
|
|
240
250
|
}) : null,
|
|
241
251
|
emptyMessage: l.hostCatalogEmpty(hostName, kind),
|
|
242
252
|
...groupsPage.list
|
|
@@ -280,7 +290,7 @@ function HostCatalogSection({ kind, hostName, cwd, children, className, style })
|
|
|
280
290
|
onArm: (on) => setArmed(on ? ext.name : null),
|
|
281
291
|
...updatable ? { onUpdate: () => void update(ext.name) } : {},
|
|
282
292
|
...updatable && openChangeOrigin ? { onChangeOrigin: () => openChangeOrigin(ext) } : {},
|
|
283
|
-
...canRemove ? { onRemove: () =>
|
|
293
|
+
...canRemove ? { onRemove: () => remove("extension", ext.name, ext.dir) } : {}
|
|
284
294
|
}) : null;
|
|
285
295
|
},
|
|
286
296
|
emptyMessage: l.hostCatalogEmpty(hostName, kind)
|
|
@@ -20,6 +20,8 @@ export declare const DEFAULT_KEYBINDINGS_SECTION_LABELS: {
|
|
|
20
20
|
keybindingsSectionNewSession: string;
|
|
21
21
|
keybindingsSectionMainSession: string;
|
|
22
22
|
keybindingsSectionBrowse: string;
|
|
23
|
+
keybindingsSectionPreviousPrompt: string;
|
|
24
|
+
keybindingsSectionNextPrompt: string;
|
|
23
25
|
keybindingsSectionDetails: string;
|
|
24
26
|
keybindingsSectionCycleAgent: string;
|
|
25
27
|
keybindingsSectionModel: string;
|
|
@@ -21,6 +21,8 @@ const DEFAULT_KEYBINDINGS_SECTION_LABELS = {
|
|
|
21
21
|
keybindingsSectionNewSession: "New session",
|
|
22
22
|
keybindingsSectionMainSession: "Back to the main session",
|
|
23
23
|
keybindingsSectionBrowse: "Browse messages",
|
|
24
|
+
keybindingsSectionPreviousPrompt: "Previous message",
|
|
25
|
+
keybindingsSectionNextPrompt: "Next message",
|
|
24
26
|
keybindingsSectionDetails: "Session details",
|
|
25
27
|
keybindingsSectionCycleAgent: "Switch agent",
|
|
26
28
|
keybindingsSectionModel: "Switch model",
|
|
@@ -45,6 +45,14 @@ const KEYBINDING_SECTIONS = [
|
|
|
45
45
|
action: "enterSelectTurnMode",
|
|
46
46
|
label: "keybindingsSectionBrowse"
|
|
47
47
|
},
|
|
48
|
+
{
|
|
49
|
+
action: "previousPrompt",
|
|
50
|
+
label: "keybindingsSectionPreviousPrompt"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
action: "nextPrompt",
|
|
54
|
+
label: "keybindingsSectionNextPrompt"
|
|
55
|
+
},
|
|
48
56
|
{
|
|
49
57
|
action: "openSessionDetails",
|
|
50
58
|
label: "keybindingsSectionDetails"
|