@agentprojectcontext/apx 1.15.6 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +46 -5
- package/src/cli/commands/log.js +113 -0
- package/src/cli/commands/overlay.js +253 -0
- package/src/cli/commands/sys.js +88 -16
- package/src/cli/index.js +23 -1
- package/src/cli/terminal-chat/renderer.js +71 -56
- package/src/cli-ts/commands/agent.ts +173 -0
- package/src/cli-ts/commands/chat.ts +119 -0
- package/src/cli-ts/commands/daemon.ts +112 -0
- package/src/cli-ts/commands/exec.ts +109 -0
- package/src/cli-ts/commands/mcp.ts +235 -0
- package/src/cli-ts/commands/session.ts +224 -0
- package/src/cli-ts/commands/status.ts +61 -0
- package/src/cli-ts/http.ts +36 -0
- package/src/cli-ts/index.ts +73 -0
- package/src/cli-ts/ui.ts +107 -0
- package/src/core/logging.js +81 -0
- package/src/daemon/api.js +58 -0
- package/src/daemon/engines/anthropic.js +60 -1
- package/src/daemon/engines/index.js +2 -1
- package/src/daemon/engines/ollama.js +70 -3
- package/src/daemon/index.js +58 -0
- package/src/daemon/overlay-ws.js +40 -0
- package/src/daemon/plugins/index.js +2 -1
- package/src/daemon/plugins/overlay.js +177 -0
- package/src/daemon/plugins/telegram.js +15 -3
- package/src/daemon/super-agent-langchain.js +296 -0
- package/src/daemon/super-agent.js +115 -19
- package/src/daemon/transcription.js +262 -59
- package/src/daemon/whisper-server.py +57 -6
- package/src/overlay/index.html +44 -0
- package/src/overlay/main.js +480 -0
- package/src/overlay/package.json +3 -0
- package/src/overlay/preload.js +34 -0
- package/src/overlay/renderer.js +371 -0
- package/src/overlay/style.css +250 -0
- package/src/tui/_shims/cli-error.ts +6 -0
- package/src/tui/_shims/cli-logo.ts +18 -0
- package/src/tui/_shims/cli-ui.ts +1 -0
- package/src/tui/_shims/config-console-state.ts +7 -0
- package/src/tui/_shims/core-any.ts +30 -0
- package/src/tui/_shims/core-binary.ts +13 -0
- package/src/tui/_shims/core-flag.ts +3 -0
- package/src/tui/_shims/core-log.ts +14 -0
- package/src/tui/_shims/lsp-language.ts +1 -0
- package/src/tui/_shims/opencode-any.ts +135 -0
- package/src/tui/_shims/opencode-sdk-v2.ts +48 -0
- package/src/tui/_shims/plugin-tui.ts +13 -0
- package/src/tui/_shims/provider-provider.ts +10 -0
- package/src/tui/_shims/session-retry.ts +1 -0
- package/src/tui/_shims/session-schema.ts +15 -0
- package/src/tui/_shims/session-session.ts +3 -0
- package/src/tui/_shims/snapshot.ts +4 -0
- package/src/tui/_shims/tool-any.ts +18 -0
- package/src/tui/_shims/util-error.ts +7 -0
- package/src/tui/_shims/util-filesystem.ts +79 -0
- package/src/tui/_shims/util-format.ts +7 -0
- package/src/tui/_shims/util-iife.ts +3 -0
- package/src/tui/_shims/util-locale.ts +10 -0
- package/src/tui/_shims/util-process.ts +38 -0
- package/src/tui/app.tsx +783 -0
- package/src/tui/asset/charge.wav +0 -0
- package/src/tui/asset/pulse-a.wav +0 -0
- package/src/tui/asset/pulse-b.wav +0 -0
- package/src/tui/asset/pulse-c.wav +0 -0
- package/src/tui/attach.ts +100 -0
- package/src/tui/component/bg-pulse-render.ts +436 -0
- package/src/tui/component/bg-pulse.tsx +99 -0
- package/src/tui/component/border.tsx +21 -0
- package/src/tui/component/dialog-agent.tsx +31 -0
- package/src/tui/component/dialog-console-org.tsx +103 -0
- package/src/tui/component/dialog-mcp.tsx +85 -0
- package/src/tui/component/dialog-model.tsx +175 -0
- package/src/tui/component/dialog-provider.tsx +456 -0
- package/src/tui/component/dialog-retry-action.tsx +160 -0
- package/src/tui/component/dialog-session-delete-failed.tsx +99 -0
- package/src/tui/component/dialog-session-list.tsx +323 -0
- package/src/tui/component/dialog-session-rename.tsx +31 -0
- package/src/tui/component/dialog-skill.tsx +36 -0
- package/src/tui/component/dialog-stash.tsx +87 -0
- package/src/tui/component/dialog-status.tsx +168 -0
- package/src/tui/component/dialog-tag.tsx +44 -0
- package/src/tui/component/dialog-theme-list.tsx +50 -0
- package/src/tui/component/dialog-variant.tsx +39 -0
- package/src/tui/component/dialog-workspace-create.tsx +302 -0
- package/src/tui/component/dialog-workspace-file-changes.tsx +138 -0
- package/src/tui/component/dialog-workspace-unavailable.tsx +69 -0
- package/src/tui/component/error-component.tsx +92 -0
- package/src/tui/component/logo.tsx +896 -0
- package/src/tui/component/plugin-route-missing.tsx +14 -0
- package/src/tui/component/prompt/autocomplete.tsx +869 -0
- package/src/tui/component/prompt/cwd.ts +0 -0
- package/src/tui/component/prompt/frecency.tsx +90 -0
- package/src/tui/component/prompt/history.tsx +108 -0
- package/src/tui/component/prompt/index.tsx +1809 -0
- package/src/tui/component/prompt/part.ts +16 -0
- package/src/tui/component/prompt/stash.tsx +101 -0
- package/src/tui/component/prompt/traits.ts +35 -0
- package/src/tui/component/spinner.tsx +24 -0
- package/src/tui/component/startup-loading.tsx +63 -0
- package/src/tui/component/todo-item.tsx +32 -0
- package/src/tui/component/use-connected.tsx +9 -0
- package/src/tui/component/workspace-label.tsx +19 -0
- package/src/tui/config/cwd.ts +5 -0
- package/src/tui/config/keybind.ts +432 -0
- package/src/tui/config/tui-migrate.ts +154 -0
- package/src/tui/config/tui-schema.ts +34 -0
- package/src/tui/config/tui.ts +46 -0
- package/src/tui/context/aggregate-failures.ts +34 -0
- package/src/tui/context/args.tsx +15 -0
- package/src/tui/context/command-palette.tsx +163 -0
- package/src/tui/context/directory.ts +15 -0
- package/src/tui/context/editor-zed.ts +283 -0
- package/src/tui/context/editor.ts +468 -0
- package/src/tui/context/event-apx.ts +22 -0
- package/src/tui/context/event.ts +6 -0
- package/src/tui/context/exit.tsx +60 -0
- package/src/tui/context/helper.tsx +25 -0
- package/src/tui/context/kv.tsx +81 -0
- package/src/tui/context/local.tsx +608 -0
- package/src/tui/context/path-format.tsx +39 -0
- package/src/tui/context/project-apx.tsx +48 -0
- package/src/tui/context/project.tsx +7 -0
- package/src/tui/context/prompt.tsx +18 -0
- package/src/tui/context/route.tsx +52 -0
- package/src/tui/context/sdk-apx.tsx +185 -0
- package/src/tui/context/sdk.tsx +6 -0
- package/src/tui/context/sync-apx.tsx +178 -0
- package/src/tui/context/sync-v2.tsx +16 -0
- package/src/tui/context/sync.tsx +118 -0
- package/src/tui/context/theme/aura.json +69 -0
- package/src/tui/context/theme/ayu.json +80 -0
- package/src/tui/context/theme/carbonfox.json +248 -0
- package/src/tui/context/theme/catppuccin-frappe.json +230 -0
- package/src/tui/context/theme/catppuccin-macchiato.json +230 -0
- package/src/tui/context/theme/catppuccin.json +112 -0
- package/src/tui/context/theme/cobalt2.json +225 -0
- package/src/tui/context/theme/cursor.json +249 -0
- package/src/tui/context/theme/dracula.json +219 -0
- package/src/tui/context/theme/everforest.json +241 -0
- package/src/tui/context/theme/flexoki.json +237 -0
- package/src/tui/context/theme/github.json +233 -0
- package/src/tui/context/theme/gruvbox.json +242 -0
- package/src/tui/context/theme/kanagawa.json +77 -0
- package/src/tui/context/theme/lucent-orng.json +234 -0
- package/src/tui/context/theme/material.json +235 -0
- package/src/tui/context/theme/matrix.json +77 -0
- package/src/tui/context/theme/mercury.json +252 -0
- package/src/tui/context/theme/monokai.json +221 -0
- package/src/tui/context/theme/nightowl.json +221 -0
- package/src/tui/context/theme/nord.json +223 -0
- package/src/tui/context/theme/one-dark.json +84 -0
- package/src/tui/context/theme/opencode.json +245 -0
- package/src/tui/context/theme/orng.json +249 -0
- package/src/tui/context/theme/osaka-jade.json +93 -0
- package/src/tui/context/theme/palenight.json +222 -0
- package/src/tui/context/theme/rosepine.json +234 -0
- package/src/tui/context/theme/solarized.json +223 -0
- package/src/tui/context/theme/synthwave84.json +226 -0
- package/src/tui/context/theme/tokyonight.json +243 -0
- package/src/tui/context/theme/vercel.json +245 -0
- package/src/tui/context/theme/vesper.json +218 -0
- package/src/tui/context/theme/zenburn.json +223 -0
- package/src/tui/context/theme.tsx +1247 -0
- package/src/tui/context/tui-config.tsx +9 -0
- package/src/tui/event.ts +16 -0
- package/src/tui/feature-plugins/home/footer.tsx +94 -0
- package/src/tui/feature-plugins/home/tips-view.tsx +166 -0
- package/src/tui/feature-plugins/home/tips.tsx +59 -0
- package/src/tui/feature-plugins/sidebar/context.tsx +65 -0
- package/src/tui/feature-plugins/sidebar/files.tsx +63 -0
- package/src/tui/feature-plugins/sidebar/footer.tsx +94 -0
- package/src/tui/feature-plugins/sidebar/lsp.tsx +65 -0
- package/src/tui/feature-plugins/sidebar/mcp.tsx +97 -0
- package/src/tui/feature-plugins/sidebar/todo.tsx +49 -0
- package/src/tui/feature-plugins/system/plugins.tsx +269 -0
- package/src/tui/feature-plugins/system/session-v2.tsx +1143 -0
- package/src/tui/feature-plugins/system/which-key.tsx +608 -0
- package/src/tui/keymap.tsx +166 -0
- package/src/tui/layer.ts +6 -0
- package/src/tui/plugin/api.tsx +381 -0
- package/src/tui/plugin/command-shim.ts +109 -0
- package/src/tui/plugin/internal.ts +33 -0
- package/src/tui/plugin/runtime.ts +1069 -0
- package/src/tui/plugin/slots.tsx +60 -0
- package/src/tui/routes/home.tsx +96 -0
- package/src/tui/routes/session/dialog-fork-from-timeline.tsx +76 -0
- package/src/tui/routes/session/dialog-message.tsx +108 -0
- package/src/tui/routes/session/dialog-subagent.tsx +26 -0
- package/src/tui/routes/session/dialog-timeline.tsx +47 -0
- package/src/tui/routes/session/footer.tsx +91 -0
- package/src/tui/routes/session/index.tsx +188 -0
- package/src/tui/routes/session/permission.tsx +722 -0
- package/src/tui/routes/session/question.tsx +490 -0
- package/src/tui/routes/session/sidebar.tsx +102 -0
- package/src/tui/routes/session/subagent-footer.tsx +133 -0
- package/src/tui/run.ts +84 -0
- package/src/tui/thread.ts +261 -0
- package/src/tui/tsconfig.json +40 -0
- package/src/tui/ui/dialog-alert.tsx +66 -0
- package/src/tui/ui/dialog-confirm.tsx +108 -0
- package/src/tui/ui/dialog-export-options.tsx +217 -0
- package/src/tui/ui/dialog-help.tsx +40 -0
- package/src/tui/ui/dialog-prompt.tsx +101 -0
- package/src/tui/ui/dialog-select.tsx +553 -0
- package/src/tui/ui/dialog.tsx +211 -0
- package/src/tui/ui/link.tsx +34 -0
- package/src/tui/ui/spinner.ts +368 -0
- package/src/tui/ui/toast.tsx +111 -0
- package/src/tui/util/clipboard.ts +217 -0
- package/src/tui/util/editor.ts +37 -0
- package/src/tui/util/model.ts +23 -0
- package/src/tui/util/provider-origin.ts +7 -0
- package/src/tui/util/revert-diff.ts +18 -0
- package/src/tui/util/scroll.ts +25 -0
- package/src/tui/util/selection.ts +65 -0
- package/src/tui/util/signal.ts +41 -0
- package/src/tui/util/sound.ts +156 -0
- package/src/tui/util/transcript.ts +112 -0
- package/src/tui/validate-session.ts +29 -0
- package/src/tui/win32.ts +130 -0
- package/src/tui/worker.ts +104 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { TextareaRenderable, TextAttributes } from "@opentui/core"
|
|
2
|
+
import { useTheme } from "../context/theme"
|
|
3
|
+
import { useDialog, type DialogContext } from "./dialog"
|
|
4
|
+
import { createStore } from "solid-js/store"
|
|
5
|
+
import { onMount, Show } from "solid-js"
|
|
6
|
+
import { useBindings } from "../keymap"
|
|
7
|
+
|
|
8
|
+
export type DialogExportOptionsProps = {
|
|
9
|
+
defaultFilename: string
|
|
10
|
+
defaultThinking: boolean
|
|
11
|
+
defaultToolDetails: boolean
|
|
12
|
+
defaultAssistantMetadata: boolean
|
|
13
|
+
defaultOpenWithoutSaving: boolean
|
|
14
|
+
onConfirm?: (options: {
|
|
15
|
+
filename: string
|
|
16
|
+
thinking: boolean
|
|
17
|
+
toolDetails: boolean
|
|
18
|
+
assistantMetadata: boolean
|
|
19
|
+
openWithoutSaving: boolean
|
|
20
|
+
}) => void
|
|
21
|
+
onCancel?: () => void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function DialogExportOptions(props: DialogExportOptionsProps) {
|
|
25
|
+
const dialog = useDialog()
|
|
26
|
+
const { theme } = useTheme()
|
|
27
|
+
let textarea: TextareaRenderable
|
|
28
|
+
const [store, setStore] = createStore({
|
|
29
|
+
thinking: props.defaultThinking,
|
|
30
|
+
toolDetails: props.defaultToolDetails,
|
|
31
|
+
assistantMetadata: props.defaultAssistantMetadata,
|
|
32
|
+
openWithoutSaving: props.defaultOpenWithoutSaving,
|
|
33
|
+
active: "filename" as "filename" | "thinking" | "toolDetails" | "assistantMetadata" | "openWithoutSaving",
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
useBindings(() => ({
|
|
37
|
+
bindings: [
|
|
38
|
+
{
|
|
39
|
+
key: "tab",
|
|
40
|
+
desc: "Next export option",
|
|
41
|
+
group: "Dialog",
|
|
42
|
+
cmd: () => {
|
|
43
|
+
const order: Array<"filename" | "thinking" | "toolDetails" | "assistantMetadata" | "openWithoutSaving"> = [
|
|
44
|
+
"filename",
|
|
45
|
+
"thinking",
|
|
46
|
+
"toolDetails",
|
|
47
|
+
"assistantMetadata",
|
|
48
|
+
"openWithoutSaving",
|
|
49
|
+
]
|
|
50
|
+
const currentIndex = order.indexOf(store.active)
|
|
51
|
+
const nextIndex = (currentIndex + 1) % order.length
|
|
52
|
+
setStore("active", order[nextIndex])
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
}))
|
|
57
|
+
|
|
58
|
+
useBindings(() => ({
|
|
59
|
+
enabled: store.active !== "filename",
|
|
60
|
+
bindings: [
|
|
61
|
+
{
|
|
62
|
+
key: "space",
|
|
63
|
+
desc: "Toggle export option",
|
|
64
|
+
group: "Dialog",
|
|
65
|
+
cmd: () => {
|
|
66
|
+
if (store.active === "thinking") setStore("thinking", !store.thinking)
|
|
67
|
+
if (store.active === "toolDetails") setStore("toolDetails", !store.toolDetails)
|
|
68
|
+
if (store.active === "assistantMetadata") setStore("assistantMetadata", !store.assistantMetadata)
|
|
69
|
+
if (store.active === "openWithoutSaving") setStore("openWithoutSaving", !store.openWithoutSaving)
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
}))
|
|
74
|
+
|
|
75
|
+
onMount(() => {
|
|
76
|
+
dialog.setSize("medium")
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
if (!textarea || textarea.isDestroyed) return
|
|
79
|
+
textarea.focus()
|
|
80
|
+
}, 1)
|
|
81
|
+
textarea.gotoLineEnd()
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<box paddingLeft={2} paddingRight={2} gap={1}>
|
|
86
|
+
<box flexDirection="row" justifyContent="space-between">
|
|
87
|
+
<text attributes={TextAttributes.BOLD} fg={theme.text}>
|
|
88
|
+
Export Options
|
|
89
|
+
</text>
|
|
90
|
+
<text fg={theme.textMuted} onMouseUp={() => dialog.clear()}>
|
|
91
|
+
esc
|
|
92
|
+
</text>
|
|
93
|
+
</box>
|
|
94
|
+
<box gap={1}>
|
|
95
|
+
<box>
|
|
96
|
+
<text fg={theme.text}>Filename:</text>
|
|
97
|
+
</box>
|
|
98
|
+
<textarea
|
|
99
|
+
onSubmit={() => {
|
|
100
|
+
props.onConfirm?.({
|
|
101
|
+
filename: textarea.plainText,
|
|
102
|
+
thinking: store.thinking,
|
|
103
|
+
toolDetails: store.toolDetails,
|
|
104
|
+
assistantMetadata: store.assistantMetadata,
|
|
105
|
+
openWithoutSaving: store.openWithoutSaving,
|
|
106
|
+
})
|
|
107
|
+
}}
|
|
108
|
+
height={3}
|
|
109
|
+
ref={(val: TextareaRenderable) => {
|
|
110
|
+
textarea = val
|
|
111
|
+
val.traits = { status: "FILENAME" }
|
|
112
|
+
}}
|
|
113
|
+
initialValue={props.defaultFilename}
|
|
114
|
+
placeholder="Enter filename"
|
|
115
|
+
placeholderColor={theme.textMuted}
|
|
116
|
+
textColor={theme.text}
|
|
117
|
+
focusedTextColor={theme.text}
|
|
118
|
+
cursorColor={theme.text}
|
|
119
|
+
/>
|
|
120
|
+
</box>
|
|
121
|
+
<box flexDirection="column">
|
|
122
|
+
<box
|
|
123
|
+
flexDirection="row"
|
|
124
|
+
gap={2}
|
|
125
|
+
paddingLeft={1}
|
|
126
|
+
backgroundColor={store.active === "thinking" ? theme.backgroundElement : undefined}
|
|
127
|
+
onMouseUp={() => setStore("active", "thinking")}
|
|
128
|
+
>
|
|
129
|
+
<text fg={store.active === "thinking" ? theme.primary : theme.textMuted}>
|
|
130
|
+
{store.thinking ? "[x]" : "[ ]"}
|
|
131
|
+
</text>
|
|
132
|
+
<text fg={store.active === "thinking" ? theme.primary : theme.text}>Include thinking</text>
|
|
133
|
+
</box>
|
|
134
|
+
<box
|
|
135
|
+
flexDirection="row"
|
|
136
|
+
gap={2}
|
|
137
|
+
paddingLeft={1}
|
|
138
|
+
backgroundColor={store.active === "toolDetails" ? theme.backgroundElement : undefined}
|
|
139
|
+
onMouseUp={() => setStore("active", "toolDetails")}
|
|
140
|
+
>
|
|
141
|
+
<text fg={store.active === "toolDetails" ? theme.primary : theme.textMuted}>
|
|
142
|
+
{store.toolDetails ? "[x]" : "[ ]"}
|
|
143
|
+
</text>
|
|
144
|
+
<text fg={store.active === "toolDetails" ? theme.primary : theme.text}>Include tool details</text>
|
|
145
|
+
</box>
|
|
146
|
+
<box
|
|
147
|
+
flexDirection="row"
|
|
148
|
+
gap={2}
|
|
149
|
+
paddingLeft={1}
|
|
150
|
+
backgroundColor={store.active === "assistantMetadata" ? theme.backgroundElement : undefined}
|
|
151
|
+
onMouseUp={() => setStore("active", "assistantMetadata")}
|
|
152
|
+
>
|
|
153
|
+
<text fg={store.active === "assistantMetadata" ? theme.primary : theme.textMuted}>
|
|
154
|
+
{store.assistantMetadata ? "[x]" : "[ ]"}
|
|
155
|
+
</text>
|
|
156
|
+
<text fg={store.active === "assistantMetadata" ? theme.primary : theme.text}>Include assistant metadata</text>
|
|
157
|
+
</box>
|
|
158
|
+
<box
|
|
159
|
+
flexDirection="row"
|
|
160
|
+
gap={2}
|
|
161
|
+
paddingLeft={1}
|
|
162
|
+
backgroundColor={store.active === "openWithoutSaving" ? theme.backgroundElement : undefined}
|
|
163
|
+
onMouseUp={() => setStore("active", "openWithoutSaving")}
|
|
164
|
+
>
|
|
165
|
+
<text fg={store.active === "openWithoutSaving" ? theme.primary : theme.textMuted}>
|
|
166
|
+
{store.openWithoutSaving ? "[x]" : "[ ]"}
|
|
167
|
+
</text>
|
|
168
|
+
<text fg={store.active === "openWithoutSaving" ? theme.primary : theme.text}>Open without saving</text>
|
|
169
|
+
</box>
|
|
170
|
+
</box>
|
|
171
|
+
<Show when={store.active !== "filename"}>
|
|
172
|
+
<text fg={theme.textMuted} paddingBottom={1}>
|
|
173
|
+
Press <span style={{ fg: theme.text }}>space</span> to toggle, <span style={{ fg: theme.text }}>return</span>{" "}
|
|
174
|
+
to confirm
|
|
175
|
+
</text>
|
|
176
|
+
</Show>
|
|
177
|
+
<Show when={store.active === "filename"}>
|
|
178
|
+
<text fg={theme.textMuted} paddingBottom={1}>
|
|
179
|
+
Press <span style={{ fg: theme.text }}>return</span> to confirm, <span style={{ fg: theme.text }}>tab</span>{" "}
|
|
180
|
+
for options
|
|
181
|
+
</text>
|
|
182
|
+
</Show>
|
|
183
|
+
</box>
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
DialogExportOptions.show = (
|
|
188
|
+
dialog: DialogContext,
|
|
189
|
+
defaultFilename: string,
|
|
190
|
+
defaultThinking: boolean,
|
|
191
|
+
defaultToolDetails: boolean,
|
|
192
|
+
defaultAssistantMetadata: boolean,
|
|
193
|
+
defaultOpenWithoutSaving: boolean,
|
|
194
|
+
) => {
|
|
195
|
+
return new Promise<{
|
|
196
|
+
filename: string
|
|
197
|
+
thinking: boolean
|
|
198
|
+
toolDetails: boolean
|
|
199
|
+
assistantMetadata: boolean
|
|
200
|
+
openWithoutSaving: boolean
|
|
201
|
+
} | null>((resolve) => {
|
|
202
|
+
dialog.replace(
|
|
203
|
+
() => (
|
|
204
|
+
<DialogExportOptions
|
|
205
|
+
defaultFilename={defaultFilename}
|
|
206
|
+
defaultThinking={defaultThinking}
|
|
207
|
+
defaultToolDetails={defaultToolDetails}
|
|
208
|
+
defaultAssistantMetadata={defaultAssistantMetadata}
|
|
209
|
+
defaultOpenWithoutSaving={defaultOpenWithoutSaving}
|
|
210
|
+
onConfirm={(options) => resolve(options)}
|
|
211
|
+
onCancel={() => resolve(null)}
|
|
212
|
+
/>
|
|
213
|
+
),
|
|
214
|
+
() => resolve(null),
|
|
215
|
+
)
|
|
216
|
+
})
|
|
217
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { TextAttributes } from "@opentui/core"
|
|
2
|
+
import { useTheme } from "@tui/context/theme"
|
|
3
|
+
import { useDialog } from "./dialog"
|
|
4
|
+
import { useBindings, useCommandShortcut } from "../keymap"
|
|
5
|
+
|
|
6
|
+
export function DialogHelp() {
|
|
7
|
+
const dialog = useDialog()
|
|
8
|
+
const { theme } = useTheme()
|
|
9
|
+
const commandShortcut = useCommandShortcut("command.palette.show")
|
|
10
|
+
|
|
11
|
+
useBindings(() => ({
|
|
12
|
+
bindings: [
|
|
13
|
+
{ key: "return", desc: "Close help", group: "Dialog", cmd: () => dialog.clear() },
|
|
14
|
+
{ key: "escape", desc: "Close help", group: "Dialog", cmd: () => dialog.clear() },
|
|
15
|
+
],
|
|
16
|
+
}))
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<box paddingLeft={2} paddingRight={2} gap={1}>
|
|
20
|
+
<box flexDirection="row" justifyContent="space-between">
|
|
21
|
+
<text attributes={TextAttributes.BOLD} fg={theme.text}>
|
|
22
|
+
Help
|
|
23
|
+
</text>
|
|
24
|
+
<text fg={theme.textMuted} onMouseUp={() => dialog.clear()}>
|
|
25
|
+
esc/enter
|
|
26
|
+
</text>
|
|
27
|
+
</box>
|
|
28
|
+
<box paddingBottom={1}>
|
|
29
|
+
<text fg={theme.textMuted}>
|
|
30
|
+
Press {commandShortcut()} to see all available actions and commands in any context.
|
|
31
|
+
</text>
|
|
32
|
+
</box>
|
|
33
|
+
<box flexDirection="row" justifyContent="flex-end" paddingBottom={1}>
|
|
34
|
+
<box paddingLeft={3} paddingRight={3} backgroundColor={theme.primary} onMouseUp={() => dialog.clear()}>
|
|
35
|
+
<text fg={theme.selectedListItemText}>ok</text>
|
|
36
|
+
</box>
|
|
37
|
+
</box>
|
|
38
|
+
</box>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { TextareaRenderable, TextAttributes } from "@opentui/core"
|
|
2
|
+
import { useTheme } from "../context/theme"
|
|
3
|
+
import { useDialog, type DialogContext } from "./dialog"
|
|
4
|
+
import { Show, createEffect, onMount, type JSX } from "solid-js"
|
|
5
|
+
import { Spinner } from "../component/spinner"
|
|
6
|
+
|
|
7
|
+
export type DialogPromptProps = {
|
|
8
|
+
title: string
|
|
9
|
+
description?: () => JSX.Element
|
|
10
|
+
placeholder?: string
|
|
11
|
+
value?: string
|
|
12
|
+
busy?: boolean
|
|
13
|
+
busyText?: string
|
|
14
|
+
onConfirm?: (value: string) => void
|
|
15
|
+
onCancel?: () => void
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function DialogPrompt(props: DialogPromptProps) {
|
|
19
|
+
const dialog = useDialog()
|
|
20
|
+
const { theme } = useTheme()
|
|
21
|
+
let textarea: TextareaRenderable
|
|
22
|
+
|
|
23
|
+
onMount(() => {
|
|
24
|
+
dialog.setSize("medium")
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
if (!textarea || textarea.isDestroyed) return
|
|
27
|
+
if (props.busy) return
|
|
28
|
+
textarea.focus()
|
|
29
|
+
}, 1)
|
|
30
|
+
textarea.gotoLineEnd()
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
createEffect(() => {
|
|
34
|
+
if (!textarea || textarea.isDestroyed) return
|
|
35
|
+
const traits = props.busy
|
|
36
|
+
? {
|
|
37
|
+
suspend: true,
|
|
38
|
+
status: "BUSY",
|
|
39
|
+
}
|
|
40
|
+
: {}
|
|
41
|
+
textarea.traits = traits
|
|
42
|
+
if (props.busy) {
|
|
43
|
+
textarea.blur()
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
textarea.focus()
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<box paddingLeft={2} paddingRight={2} gap={1}>
|
|
51
|
+
<box flexDirection="row" justifyContent="space-between">
|
|
52
|
+
<text attributes={TextAttributes.BOLD} fg={theme.text}>
|
|
53
|
+
{props.title}
|
|
54
|
+
</text>
|
|
55
|
+
<text fg={theme.textMuted} onMouseUp={() => dialog.clear()}>
|
|
56
|
+
esc
|
|
57
|
+
</text>
|
|
58
|
+
</box>
|
|
59
|
+
<box gap={1}>
|
|
60
|
+
{props.description}
|
|
61
|
+
<textarea
|
|
62
|
+
onSubmit={() => {
|
|
63
|
+
if (props.busy) return
|
|
64
|
+
props.onConfirm?.(textarea.plainText)
|
|
65
|
+
}}
|
|
66
|
+
height={3}
|
|
67
|
+
ref={(val: TextareaRenderable) => {
|
|
68
|
+
textarea = val
|
|
69
|
+
}}
|
|
70
|
+
initialValue={props.value}
|
|
71
|
+
placeholder={props.placeholder ?? "Enter text"}
|
|
72
|
+
placeholderColor={theme.textMuted}
|
|
73
|
+
textColor={props.busy ? theme.textMuted : theme.text}
|
|
74
|
+
focusedTextColor={props.busy ? theme.textMuted : theme.text}
|
|
75
|
+
cursorColor={props.busy ? theme.backgroundElement : theme.text}
|
|
76
|
+
/>
|
|
77
|
+
<Show when={props.busy}>
|
|
78
|
+
<Spinner color={theme.textMuted}>{props.busyText ?? "Working..."}</Spinner>
|
|
79
|
+
</Show>
|
|
80
|
+
</box>
|
|
81
|
+
<box paddingBottom={1} gap={1} flexDirection="row">
|
|
82
|
+
<Show when={!props.busy} fallback={<text fg={theme.textMuted}>processing...</text>}>
|
|
83
|
+
<text fg={theme.text}>
|
|
84
|
+
enter <span style={{ fg: theme.textMuted }}>submit</span>
|
|
85
|
+
</text>
|
|
86
|
+
</Show>
|
|
87
|
+
</box>
|
|
88
|
+
</box>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
DialogPrompt.show = (dialog: DialogContext, title: string, options?: Omit<DialogPromptProps, "title">) => {
|
|
93
|
+
return new Promise<string | null>((resolve) => {
|
|
94
|
+
dialog.replace(
|
|
95
|
+
() => (
|
|
96
|
+
<DialogPrompt title={title} {...options} onConfirm={(value) => resolve(value)} onCancel={() => resolve(null)} />
|
|
97
|
+
),
|
|
98
|
+
() => resolve(null),
|
|
99
|
+
)
|
|
100
|
+
})
|
|
101
|
+
}
|