@agentprojectcontext/apx 1.15.5 → 1.16.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.
Files changed (222) hide show
  1. package/package.json +40 -5
  2. package/src/cli/commands/log.js +113 -0
  3. package/src/cli/commands/overlay.js +253 -0
  4. package/src/cli/commands/sys.js +88 -16
  5. package/src/cli/index.js +23 -1
  6. package/src/cli/terminal-chat/renderer.js +71 -56
  7. package/src/cli-ts/commands/agent.ts +173 -0
  8. package/src/cli-ts/commands/chat.ts +119 -0
  9. package/src/cli-ts/commands/daemon.ts +112 -0
  10. package/src/cli-ts/commands/exec.ts +109 -0
  11. package/src/cli-ts/commands/mcp.ts +235 -0
  12. package/src/cli-ts/commands/session.ts +224 -0
  13. package/src/cli-ts/commands/status.ts +61 -0
  14. package/src/cli-ts/http.ts +36 -0
  15. package/src/cli-ts/index.ts +73 -0
  16. package/src/cli-ts/ui.ts +107 -0
  17. package/src/core/logging.js +81 -0
  18. package/src/daemon/api.js +58 -0
  19. package/src/daemon/engines/anthropic.js +60 -1
  20. package/src/daemon/engines/index.js +2 -1
  21. package/src/daemon/engines/ollama.js +70 -3
  22. package/src/daemon/index.js +58 -0
  23. package/src/daemon/overlay-ws.js +40 -0
  24. package/src/daemon/plugins/index.js +2 -1
  25. package/src/daemon/plugins/overlay.js +177 -0
  26. package/src/daemon/plugins/telegram.js +15 -3
  27. package/src/daemon/super-agent.js +102 -19
  28. package/src/daemon/transcription.js +262 -59
  29. package/src/daemon/wakeup.js +14 -19
  30. package/src/daemon/whisper-server.py +57 -6
  31. package/src/overlay/index.html +44 -0
  32. package/src/overlay/main.js +480 -0
  33. package/src/overlay/package.json +3 -0
  34. package/src/overlay/preload.js +34 -0
  35. package/src/overlay/renderer.js +371 -0
  36. package/src/overlay/style.css +250 -0
  37. package/src/tui/_shims/cli-error.ts +6 -0
  38. package/src/tui/_shims/cli-logo.ts +18 -0
  39. package/src/tui/_shims/cli-ui.ts +1 -0
  40. package/src/tui/_shims/config-console-state.ts +7 -0
  41. package/src/tui/_shims/core-any.ts +30 -0
  42. package/src/tui/_shims/core-binary.ts +13 -0
  43. package/src/tui/_shims/core-flag.ts +3 -0
  44. package/src/tui/_shims/core-log.ts +14 -0
  45. package/src/tui/_shims/lsp-language.ts +1 -0
  46. package/src/tui/_shims/opencode-any.ts +135 -0
  47. package/src/tui/_shims/opencode-sdk-v2.ts +48 -0
  48. package/src/tui/_shims/plugin-tui.ts +13 -0
  49. package/src/tui/_shims/provider-provider.ts +10 -0
  50. package/src/tui/_shims/session-retry.ts +1 -0
  51. package/src/tui/_shims/session-schema.ts +15 -0
  52. package/src/tui/_shims/session-session.ts +3 -0
  53. package/src/tui/_shims/snapshot.ts +4 -0
  54. package/src/tui/_shims/tool-any.ts +18 -0
  55. package/src/tui/_shims/util-error.ts +7 -0
  56. package/src/tui/_shims/util-filesystem.ts +79 -0
  57. package/src/tui/_shims/util-format.ts +7 -0
  58. package/src/tui/_shims/util-iife.ts +3 -0
  59. package/src/tui/_shims/util-locale.ts +10 -0
  60. package/src/tui/_shims/util-process.ts +38 -0
  61. package/src/tui/app.tsx +783 -0
  62. package/src/tui/asset/charge.wav +0 -0
  63. package/src/tui/asset/pulse-a.wav +0 -0
  64. package/src/tui/asset/pulse-b.wav +0 -0
  65. package/src/tui/asset/pulse-c.wav +0 -0
  66. package/src/tui/attach.ts +100 -0
  67. package/src/tui/component/bg-pulse-render.ts +436 -0
  68. package/src/tui/component/bg-pulse.tsx +99 -0
  69. package/src/tui/component/border.tsx +21 -0
  70. package/src/tui/component/dialog-agent.tsx +31 -0
  71. package/src/tui/component/dialog-console-org.tsx +103 -0
  72. package/src/tui/component/dialog-mcp.tsx +85 -0
  73. package/src/tui/component/dialog-model.tsx +175 -0
  74. package/src/tui/component/dialog-provider.tsx +456 -0
  75. package/src/tui/component/dialog-retry-action.tsx +160 -0
  76. package/src/tui/component/dialog-session-delete-failed.tsx +99 -0
  77. package/src/tui/component/dialog-session-list.tsx +323 -0
  78. package/src/tui/component/dialog-session-rename.tsx +31 -0
  79. package/src/tui/component/dialog-skill.tsx +36 -0
  80. package/src/tui/component/dialog-stash.tsx +87 -0
  81. package/src/tui/component/dialog-status.tsx +168 -0
  82. package/src/tui/component/dialog-tag.tsx +44 -0
  83. package/src/tui/component/dialog-theme-list.tsx +50 -0
  84. package/src/tui/component/dialog-variant.tsx +39 -0
  85. package/src/tui/component/dialog-workspace-create.tsx +302 -0
  86. package/src/tui/component/dialog-workspace-file-changes.tsx +138 -0
  87. package/src/tui/component/dialog-workspace-unavailable.tsx +69 -0
  88. package/src/tui/component/error-component.tsx +92 -0
  89. package/src/tui/component/logo.tsx +896 -0
  90. package/src/tui/component/plugin-route-missing.tsx +14 -0
  91. package/src/tui/component/prompt/autocomplete.tsx +869 -0
  92. package/src/tui/component/prompt/cwd.ts +0 -0
  93. package/src/tui/component/prompt/frecency.tsx +90 -0
  94. package/src/tui/component/prompt/history.tsx +108 -0
  95. package/src/tui/component/prompt/index.tsx +1809 -0
  96. package/src/tui/component/prompt/part.ts +16 -0
  97. package/src/tui/component/prompt/stash.tsx +101 -0
  98. package/src/tui/component/prompt/traits.ts +35 -0
  99. package/src/tui/component/spinner.tsx +24 -0
  100. package/src/tui/component/startup-loading.tsx +63 -0
  101. package/src/tui/component/todo-item.tsx +32 -0
  102. package/src/tui/component/use-connected.tsx +9 -0
  103. package/src/tui/component/workspace-label.tsx +19 -0
  104. package/src/tui/config/cwd.ts +5 -0
  105. package/src/tui/config/keybind.ts +432 -0
  106. package/src/tui/config/tui-migrate.ts +154 -0
  107. package/src/tui/config/tui-schema.ts +34 -0
  108. package/src/tui/config/tui.ts +46 -0
  109. package/src/tui/context/aggregate-failures.ts +34 -0
  110. package/src/tui/context/args.tsx +15 -0
  111. package/src/tui/context/command-palette.tsx +163 -0
  112. package/src/tui/context/directory.ts +15 -0
  113. package/src/tui/context/editor-zed.ts +283 -0
  114. package/src/tui/context/editor.ts +468 -0
  115. package/src/tui/context/event-apx.ts +22 -0
  116. package/src/tui/context/event.ts +6 -0
  117. package/src/tui/context/exit.tsx +60 -0
  118. package/src/tui/context/helper.tsx +25 -0
  119. package/src/tui/context/kv.tsx +81 -0
  120. package/src/tui/context/local.tsx +608 -0
  121. package/src/tui/context/path-format.tsx +39 -0
  122. package/src/tui/context/project-apx.tsx +48 -0
  123. package/src/tui/context/project.tsx +7 -0
  124. package/src/tui/context/prompt.tsx +18 -0
  125. package/src/tui/context/route.tsx +52 -0
  126. package/src/tui/context/sdk-apx.tsx +185 -0
  127. package/src/tui/context/sdk.tsx +6 -0
  128. package/src/tui/context/sync-apx.tsx +178 -0
  129. package/src/tui/context/sync-v2.tsx +16 -0
  130. package/src/tui/context/sync.tsx +118 -0
  131. package/src/tui/context/theme/aura.json +69 -0
  132. package/src/tui/context/theme/ayu.json +80 -0
  133. package/src/tui/context/theme/carbonfox.json +248 -0
  134. package/src/tui/context/theme/catppuccin-frappe.json +230 -0
  135. package/src/tui/context/theme/catppuccin-macchiato.json +230 -0
  136. package/src/tui/context/theme/catppuccin.json +112 -0
  137. package/src/tui/context/theme/cobalt2.json +225 -0
  138. package/src/tui/context/theme/cursor.json +249 -0
  139. package/src/tui/context/theme/dracula.json +219 -0
  140. package/src/tui/context/theme/everforest.json +241 -0
  141. package/src/tui/context/theme/flexoki.json +237 -0
  142. package/src/tui/context/theme/github.json +233 -0
  143. package/src/tui/context/theme/gruvbox.json +242 -0
  144. package/src/tui/context/theme/kanagawa.json +77 -0
  145. package/src/tui/context/theme/lucent-orng.json +234 -0
  146. package/src/tui/context/theme/material.json +235 -0
  147. package/src/tui/context/theme/matrix.json +77 -0
  148. package/src/tui/context/theme/mercury.json +252 -0
  149. package/src/tui/context/theme/monokai.json +221 -0
  150. package/src/tui/context/theme/nightowl.json +221 -0
  151. package/src/tui/context/theme/nord.json +223 -0
  152. package/src/tui/context/theme/one-dark.json +84 -0
  153. package/src/tui/context/theme/opencode.json +245 -0
  154. package/src/tui/context/theme/orng.json +249 -0
  155. package/src/tui/context/theme/osaka-jade.json +93 -0
  156. package/src/tui/context/theme/palenight.json +222 -0
  157. package/src/tui/context/theme/rosepine.json +234 -0
  158. package/src/tui/context/theme/solarized.json +223 -0
  159. package/src/tui/context/theme/synthwave84.json +226 -0
  160. package/src/tui/context/theme/tokyonight.json +243 -0
  161. package/src/tui/context/theme/vercel.json +245 -0
  162. package/src/tui/context/theme/vesper.json +218 -0
  163. package/src/tui/context/theme/zenburn.json +223 -0
  164. package/src/tui/context/theme.tsx +1247 -0
  165. package/src/tui/context/tui-config.tsx +9 -0
  166. package/src/tui/event.ts +16 -0
  167. package/src/tui/feature-plugins/home/footer.tsx +94 -0
  168. package/src/tui/feature-plugins/home/tips-view.tsx +166 -0
  169. package/src/tui/feature-plugins/home/tips.tsx +59 -0
  170. package/src/tui/feature-plugins/sidebar/context.tsx +65 -0
  171. package/src/tui/feature-plugins/sidebar/files.tsx +63 -0
  172. package/src/tui/feature-plugins/sidebar/footer.tsx +94 -0
  173. package/src/tui/feature-plugins/sidebar/lsp.tsx +65 -0
  174. package/src/tui/feature-plugins/sidebar/mcp.tsx +97 -0
  175. package/src/tui/feature-plugins/sidebar/todo.tsx +49 -0
  176. package/src/tui/feature-plugins/system/plugins.tsx +269 -0
  177. package/src/tui/feature-plugins/system/session-v2.tsx +1143 -0
  178. package/src/tui/feature-plugins/system/which-key.tsx +608 -0
  179. package/src/tui/keymap.tsx +166 -0
  180. package/src/tui/layer.ts +6 -0
  181. package/src/tui/plugin/api.tsx +381 -0
  182. package/src/tui/plugin/command-shim.ts +109 -0
  183. package/src/tui/plugin/internal.ts +33 -0
  184. package/src/tui/plugin/runtime.ts +1069 -0
  185. package/src/tui/plugin/slots.tsx +60 -0
  186. package/src/tui/routes/home.tsx +96 -0
  187. package/src/tui/routes/session/dialog-fork-from-timeline.tsx +76 -0
  188. package/src/tui/routes/session/dialog-message.tsx +108 -0
  189. package/src/tui/routes/session/dialog-subagent.tsx +26 -0
  190. package/src/tui/routes/session/dialog-timeline.tsx +47 -0
  191. package/src/tui/routes/session/footer.tsx +91 -0
  192. package/src/tui/routes/session/index.tsx +188 -0
  193. package/src/tui/routes/session/permission.tsx +722 -0
  194. package/src/tui/routes/session/question.tsx +490 -0
  195. package/src/tui/routes/session/sidebar.tsx +102 -0
  196. package/src/tui/routes/session/subagent-footer.tsx +133 -0
  197. package/src/tui/run.ts +84 -0
  198. package/src/tui/thread.ts +261 -0
  199. package/src/tui/tsconfig.json +40 -0
  200. package/src/tui/ui/dialog-alert.tsx +66 -0
  201. package/src/tui/ui/dialog-confirm.tsx +108 -0
  202. package/src/tui/ui/dialog-export-options.tsx +217 -0
  203. package/src/tui/ui/dialog-help.tsx +40 -0
  204. package/src/tui/ui/dialog-prompt.tsx +101 -0
  205. package/src/tui/ui/dialog-select.tsx +553 -0
  206. package/src/tui/ui/dialog.tsx +211 -0
  207. package/src/tui/ui/link.tsx +34 -0
  208. package/src/tui/ui/spinner.ts +368 -0
  209. package/src/tui/ui/toast.tsx +111 -0
  210. package/src/tui/util/clipboard.ts +217 -0
  211. package/src/tui/util/editor.ts +37 -0
  212. package/src/tui/util/model.ts +23 -0
  213. package/src/tui/util/provider-origin.ts +7 -0
  214. package/src/tui/util/revert-diff.ts +18 -0
  215. package/src/tui/util/scroll.ts +25 -0
  216. package/src/tui/util/selection.ts +65 -0
  217. package/src/tui/util/signal.ts +41 -0
  218. package/src/tui/util/sound.ts +156 -0
  219. package/src/tui/util/transcript.ts +112 -0
  220. package/src/tui/validate-session.ts +29 -0
  221. package/src/tui/win32.ts +130 -0
  222. package/src/tui/worker.ts +104 -0
@@ -0,0 +1,16 @@
1
+ import { PartID } from "@/session/schema"
2
+ import type { PromptInfo } from "./history"
3
+
4
+ type Item = PromptInfo["parts"][number]
5
+
6
+ export function strip(part: Item & { id: string; messageID: string; sessionID: string }): Item {
7
+ const { id: _id, messageID: _messageID, sessionID: _sessionID, ...rest } = part
8
+ return rest
9
+ }
10
+
11
+ export function assign(part: Item): Item & { id: PartID } {
12
+ return {
13
+ ...part,
14
+ id: PartID.ascending(),
15
+ }
16
+ }
@@ -0,0 +1,101 @@
1
+ import path from "path"
2
+ import { Global } from "@opencode-ai/core/global"
3
+ import { Filesystem } from "@/util/filesystem"
4
+ import { onMount } from "solid-js"
5
+ import { createStore, produce, unwrap } from "solid-js/store"
6
+ import { createSimpleContext } from "../../context/helper"
7
+ import { appendFile, writeFile } from "fs/promises"
8
+ import type { PromptInfo } from "./history"
9
+
10
+ export type StashEntry = {
11
+ input: string
12
+ parts: PromptInfo["parts"]
13
+ timestamp: number
14
+ }
15
+
16
+ const MAX_STASH_ENTRIES = 50
17
+
18
+ export const { use: usePromptStash, provider: PromptStashProvider } = createSimpleContext({
19
+ name: "PromptStash",
20
+ init: () => {
21
+ const stashPath = path.join(Global.Path.state, "prompt-stash.jsonl")
22
+ onMount(async () => {
23
+ const text = await Filesystem.readText(stashPath).catch(() => "")
24
+ const lines = text
25
+ .split("\n")
26
+ .filter(Boolean)
27
+ .map((line) => {
28
+ try {
29
+ return JSON.parse(line)
30
+ } catch {
31
+ return null
32
+ }
33
+ })
34
+ .filter((line): line is StashEntry => line !== null)
35
+ .slice(-MAX_STASH_ENTRIES)
36
+
37
+ setStore("entries", lines)
38
+
39
+ // Rewrite file with only valid entries to self-heal corruption
40
+ if (lines.length > 0) {
41
+ const content = lines.map((line) => JSON.stringify(line)).join("\n") + "\n"
42
+ writeFile(stashPath, content).catch(() => {})
43
+ }
44
+ })
45
+
46
+ const [store, setStore] = createStore({
47
+ entries: [] as StashEntry[],
48
+ })
49
+
50
+ return {
51
+ list() {
52
+ return store.entries
53
+ },
54
+ push(entry: Omit<StashEntry, "timestamp">) {
55
+ const stash = structuredClone(unwrap({ ...entry, timestamp: Date.now() }))
56
+ let trimmed = false
57
+ setStore(
58
+ produce((draft) => {
59
+ draft.entries.push(stash)
60
+ if (draft.entries.length > MAX_STASH_ENTRIES) {
61
+ draft.entries = draft.entries.slice(-MAX_STASH_ENTRIES)
62
+ trimmed = true
63
+ }
64
+ }),
65
+ )
66
+
67
+ if (trimmed) {
68
+ const content = store.entries.map((line) => JSON.stringify(line)).join("\n") + "\n"
69
+ writeFile(stashPath, content).catch(() => {})
70
+ return
71
+ }
72
+
73
+ appendFile(stashPath, JSON.stringify(stash) + "\n").catch(() => {})
74
+ },
75
+ pop() {
76
+ if (store.entries.length === 0) return undefined
77
+ const entry = store.entries[store.entries.length - 1]
78
+ setStore(
79
+ produce((draft) => {
80
+ draft.entries.pop()
81
+ }),
82
+ )
83
+ const content =
84
+ store.entries.length > 0 ? store.entries.map((line) => JSON.stringify(line)).join("\n") + "\n" : ""
85
+ writeFile(stashPath, content).catch(() => {})
86
+ return entry
87
+ },
88
+ remove(index: number) {
89
+ if (index < 0 || index >= store.entries.length) return
90
+ setStore(
91
+ produce((draft) => {
92
+ draft.entries.splice(index, 1)
93
+ }),
94
+ )
95
+ const content =
96
+ store.entries.length > 0 ? store.entries.map((line) => JSON.stringify(line)).join("\n") + "\n" : ""
97
+ writeFile(stashPath, content).catch(() => {})
98
+ },
99
+ }
100
+ },
101
+ })
@@ -0,0 +1,35 @@
1
+ import type { EditorTraits } from "@opentui/core"
2
+
3
+ export type PromptMode = "normal" | "shell"
4
+
5
+ export interface PromptTraitsInput {
6
+ mode: PromptMode
7
+ autocompleteVisible: boolean
8
+ }
9
+
10
+ export type PromptTraits = EditorTraits & {
11
+ owner: "opencode"
12
+ role: "prompt"
13
+ }
14
+
15
+ /**
16
+ * Compute the textarea editor traits for the prompt.
17
+ *
18
+ * The OpenTUI managed textarea keymap owns `traits.suspend`. Prompt traits
19
+ * only expose capture/status metadata so focus changes cannot unsuspend the
20
+ * keymap-managed editor mappings.
21
+ */
22
+ export function computePromptTraits(input: PromptTraitsInput): PromptTraits {
23
+ const capture =
24
+ input.mode === "normal"
25
+ ? input.autocompleteVisible
26
+ ? (["escape", "navigate", "submit", "tab"] as const)
27
+ : (["tab"] as const)
28
+ : undefined
29
+ return {
30
+ capture,
31
+ status: input.mode === "shell" ? "SHELL" : undefined,
32
+ owner: "opencode",
33
+ role: "prompt",
34
+ }
35
+ }
@@ -0,0 +1,24 @@
1
+ import { Show } from "solid-js"
2
+ import { useTheme } from "../context/theme"
3
+ import { useKV } from "../context/kv"
4
+ import type { JSX } from "@opentui/solid"
5
+ import type { RGBA } from "@opentui/core"
6
+ import "opentui-spinner/solid"
7
+
8
+ export const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
9
+
10
+ export function Spinner(props: { children?: JSX.Element; color?: RGBA }) {
11
+ const { theme } = useTheme()
12
+ const kv = useKV()
13
+ const color = () => props.color ?? theme.textMuted
14
+ return (
15
+ <Show when={kv.get("animations_enabled", true)} fallback={<text fg={color()}>⋯ {props.children}</text>}>
16
+ <box flexDirection="row" gap={1}>
17
+ <spinner frames={SPINNER_FRAMES} interval={80} color={color()} />
18
+ <Show when={props.children}>
19
+ <text fg={color()}>{props.children}</text>
20
+ </Show>
21
+ </box>
22
+ </Show>
23
+ )
24
+ }
@@ -0,0 +1,63 @@
1
+ import { createEffect, createMemo, createSignal, onCleanup, Show } from "solid-js"
2
+ import { useTheme } from "../context/theme"
3
+ import { Spinner } from "./spinner"
4
+
5
+ export function StartupLoading(props: { ready: () => boolean }) {
6
+ const theme = useTheme().theme
7
+ const [show, setShow] = createSignal(false)
8
+ const text = createMemo(() => (props.ready() ? "Finishing startup..." : "Loading plugins..."))
9
+ let wait: NodeJS.Timeout | undefined
10
+ let hold: NodeJS.Timeout | undefined
11
+ let stamp = 0
12
+
13
+ createEffect(() => {
14
+ if (props.ready()) {
15
+ if (wait) {
16
+ clearTimeout(wait)
17
+ wait = undefined
18
+ }
19
+ if (!show()) return
20
+ if (hold) return
21
+
22
+ const left = 3000 - (Date.now() - stamp)
23
+ if (left <= 0) {
24
+ setShow(false)
25
+ return
26
+ }
27
+
28
+ hold = setTimeout(() => {
29
+ hold = undefined
30
+ setShow(false)
31
+ }, left).unref()
32
+ return
33
+ }
34
+
35
+ if (hold) {
36
+ clearTimeout(hold)
37
+ hold = undefined
38
+ }
39
+ if (show()) return
40
+ if (wait) return
41
+
42
+ wait = setTimeout(() => {
43
+ wait = undefined
44
+ stamp = Date.now()
45
+ setShow(true)
46
+ }, 500).unref()
47
+ })
48
+
49
+ onCleanup(() => {
50
+ if (wait) clearTimeout(wait)
51
+ if (hold) clearTimeout(hold)
52
+ })
53
+
54
+ return (
55
+ <Show when={show()}>
56
+ <box position="absolute" zIndex={5000} left={0} right={0} bottom={1} justifyContent="center" alignItems="center">
57
+ <box backgroundColor={theme.backgroundPanel} paddingLeft={1} paddingRight={1}>
58
+ <Spinner color={theme.textMuted}>{text()}</Spinner>
59
+ </box>
60
+ </box>
61
+ </Show>
62
+ )
63
+ }
@@ -0,0 +1,32 @@
1
+ import { useTheme } from "../context/theme"
2
+
3
+ export interface TodoItemProps {
4
+ status: string
5
+ content: string
6
+ }
7
+
8
+ export function TodoItem(props: TodoItemProps) {
9
+ const { theme } = useTheme()
10
+
11
+ return (
12
+ <box flexDirection="row" gap={0}>
13
+ <text
14
+ flexShrink={0}
15
+ style={{
16
+ fg: props.status === "in_progress" ? theme.warning : theme.textMuted,
17
+ }}
18
+ >
19
+ [{props.status === "completed" ? "✓" : props.status === "in_progress" ? "•" : " "}]{" "}
20
+ </text>
21
+ <text
22
+ flexGrow={1}
23
+ wrapMode="word"
24
+ style={{
25
+ fg: props.status === "in_progress" ? theme.warning : theme.textMuted,
26
+ }}
27
+ >
28
+ {props.content}
29
+ </text>
30
+ </box>
31
+ )
32
+ }
@@ -0,0 +1,9 @@
1
+ import { createMemo } from "solid-js"
2
+ import { useSync } from "@tui/context/sync"
3
+
4
+ export function useConnected() {
5
+ const sync = useSync()
6
+ return createMemo(() =>
7
+ sync.data.provider.some((x) => x.id !== "opencode" || Object.values(x.models).some((y) => y.cost?.input !== 0)),
8
+ )
9
+ }
@@ -0,0 +1,19 @@
1
+ import { useTheme } from "@tui/context/theme"
2
+
3
+ export type WorkspaceStatus = "connected" | "connecting" | "disconnected" | "error"
4
+
5
+ export function WorkspaceLabel(props: { type: string; name: string; status?: WorkspaceStatus; icon?: boolean }) {
6
+ const { theme } = useTheme()
7
+ const color = () => {
8
+ if (props.status === "connected") return theme.success
9
+ if (props.status === "error") return theme.error
10
+ return theme.textMuted
11
+ }
12
+
13
+ return (
14
+ <>
15
+ {props.icon ? <span style={{ fg: color() }}>● </span> : undefined}
16
+ <span style={{ fg: theme.text }}>{props.name}</span> <span style={{ fg: theme.textMuted }}>({props.type})</span>
17
+ </>
18
+ )
19
+ }
@@ -0,0 +1,5 @@
1
+ import { Context } from "effect"
2
+
3
+ export const CurrentWorkingDirectory = Context.Reference<string>("CurrentWorkingDirectory", {
4
+ defaultValue: () => process.cwd(),
5
+ })