@neuralnomads/codenomad 0.14.0 → 0.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 (148) hide show
  1. package/dist/cli-upgrade.js +53 -0
  2. package/dist/cli-upgrade.test.js +31 -0
  3. package/dist/filesystem/__tests__/browser.test.js +65 -0
  4. package/dist/filesystem/__tests__/search-cache.test.js +2 -2
  5. package/dist/filesystem/browser.js +40 -5
  6. package/dist/index.js +27 -6
  7. package/dist/opencode-plugin/codenomad-opencode-plugin.tgz +0 -0
  8. package/dist/opencode-plugin.js +146 -0
  9. package/dist/opencode-plugin.test.js +28 -0
  10. package/dist/previews/manager.js +63 -0
  11. package/dist/server/__tests__/remote-proxy.test.js +204 -0
  12. package/dist/server/http-server.js +380 -46
  13. package/dist/server/remote-proxy.js +466 -0
  14. package/dist/server/routes/filesystem.js +13 -0
  15. package/dist/server/routes/previews.js +25 -0
  16. package/dist/server/routes/remote-proxy.js +42 -0
  17. package/dist/server/routes/settings.js +1 -1
  18. package/dist/server/routes/workspaces.js +141 -1
  19. package/dist/workspaces/__tests__/git-clone.test.js +141 -0
  20. package/dist/workspaces/__tests__/git-worktrees.test.js +43 -0
  21. package/dist/workspaces/__tests__/spawn.test.js +158 -0
  22. package/dist/workspaces/git-clone.js +148 -0
  23. package/dist/workspaces/git-mutations.js +98 -0
  24. package/dist/workspaces/git-status.js +323 -0
  25. package/dist/workspaces/git-worktrees.js +18 -1
  26. package/dist/workspaces/manager.js +17 -9
  27. package/dist/workspaces/opencode-auth.js +18 -0
  28. package/dist/workspaces/opencode-auth.test.js +34 -0
  29. package/dist/workspaces/runtime.js +54 -77
  30. package/dist/workspaces/spawn.js +245 -0
  31. package/dist/workspaces/worktree-directory.js +74 -0
  32. package/package.json +3 -3
  33. package/public/assets/ChangesTab-CxrJwz2Z.js +2 -0
  34. package/public/assets/DiffToolbar-CqJttTgx.js +1 -0
  35. package/public/assets/FilesTab-tBrdrLID.js +2 -0
  36. package/public/assets/GitChangesTab-DUUJn4Va.js +2 -0
  37. package/public/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  38. package/public/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  39. package/public/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  40. package/public/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  41. package/public/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  42. package/public/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  43. package/public/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  44. package/public/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  45. package/public/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  46. package/public/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  47. package/public/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  48. package/public/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  49. package/public/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  50. package/public/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  51. package/public/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  52. package/public/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  53. package/public/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  54. package/public/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  55. package/public/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  56. package/public/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  57. package/public/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  58. package/public/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  59. package/public/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  60. package/public/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  61. package/public/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  62. package/public/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  63. package/public/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  64. package/public/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  65. package/public/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  66. package/public/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  67. package/public/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  68. package/public/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  69. package/public/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  70. package/public/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  71. package/public/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  72. package/public/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  73. package/public/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  74. package/public/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  75. package/public/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  76. package/public/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  77. package/public/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  78. package/public/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  79. package/public/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  80. package/public/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  81. package/public/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  82. package/public/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  83. package/public/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  84. package/public/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  85. package/public/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  86. package/public/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  87. package/public/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  88. package/public/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  89. package/public/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  90. package/public/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  91. package/public/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  92. package/public/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  93. package/public/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  94. package/public/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  95. package/public/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  96. package/public/assets/{SplitFilePanel-CupweEA5.js → SplitFilePanel-CiZrHI3o.js} +1 -1
  97. package/public/assets/StatusTab-DN31GijL.js +1 -0
  98. package/public/assets/align-justify-CKbOni6U.js +1 -0
  99. package/public/assets/{bundle-full-B-5u6Iv3.js → bundle-full-B_MbXXHv.js} +1 -1
  100. package/public/assets/{diff-viewer-_ehhYA-Z.js → diff-viewer-CersJruo.js} +1 -1
  101. package/public/assets/index-BTenW4sL.js +1 -0
  102. package/public/assets/index-BsYORY4z.js +1 -0
  103. package/public/assets/index-BvfQjuig.js +1 -0
  104. package/public/assets/{index-BqiNjV6R.js → index-CK51N0B7.js} +1 -1
  105. package/public/assets/index-Chghci_R.js +1 -0
  106. package/public/assets/{index-CxQr-wOF.js → index-DYa3o0_M.js} +1 -1
  107. package/public/assets/index-DskBWxXS.js +2 -0
  108. package/public/assets/index-DslkXxdb.js +1 -0
  109. package/public/assets/index-UCZ7MxNK.js +1 -0
  110. package/public/assets/index-i5UooSrU.css +1 -0
  111. package/public/assets/{loading-Dck2H3XH.js → loading-hkCubi3k.js} +1 -1
  112. package/public/assets/main-CXJTHRp1.js +62 -0
  113. package/public/assets/markdown-Cy9tCAXp.js +315 -0
  114. package/public/assets/monaco-viewer-B3iAKbO0.js +26 -0
  115. package/public/assets/tool-call-DhWimeRu.js +59 -0
  116. package/public/assets/{unified-picker-Dw0kTXoT.js → unified-picker-C47f5lFi.js} +1 -1
  117. package/public/assets/wrap-text-hwXbREuU.js +1 -0
  118. package/public/index.html +4 -4
  119. package/public/loading.html +4 -4
  120. package/public/sw.js +1 -1
  121. package/public/ui-version.json +1 -1
  122. package/dist/opencode-config/README.md +0 -32
  123. package/dist/opencode-config/opencode.jsonc +0 -3
  124. package/dist/opencode-config/package.json +0 -9
  125. package/dist/opencode-config/plugin/codenomad.ts +0 -62
  126. package/dist/opencode-config/plugin/lib/background-process.ts +0 -265
  127. package/dist/opencode-config/plugin/lib/client.ts +0 -133
  128. package/dist/opencode-config/plugin/lib/request.ts +0 -214
  129. package/dist/opencode-config.js +0 -26
  130. package/public/assets/ChangesTab-CFkk3tAp.js +0 -2
  131. package/public/assets/DiffToolbar-CQQLR1mp.js +0 -1
  132. package/public/assets/FilesTab-CXgucPtN.js +0 -2
  133. package/public/assets/GitChangesTab-BidSb28_.js +0 -2
  134. package/public/assets/StatusTab-C2Pl_Vce.js +0 -1
  135. package/public/assets/index-BnfDkr8C.js +0 -1
  136. package/public/assets/index-BntAaLZs.js +0 -1
  137. package/public/assets/index-BwCEJ4BE.css +0 -1
  138. package/public/assets/index-DXaitXVC.js +0 -1
  139. package/public/assets/index-DzRzoTK8.js +0 -2
  140. package/public/assets/index-ShHad48G.js +0 -1
  141. package/public/assets/index-_EaXFUIj.js +0 -1
  142. package/public/assets/index-mMh5TJvW.js +0 -1
  143. package/public/assets/main-BsIf5lOY.js +0 -50
  144. package/public/assets/markdown-CFV9kR80.js +0 -58
  145. package/public/assets/monaco-viewer-CMM6n0T3.js +0 -25
  146. package/public/assets/todo-Ghwirj-b.js +0 -1
  147. package/public/assets/tool-call-BC2Pv3uG.js +0 -60
  148. package/public/assets/wrap-text-D2MJk2ad.js +0 -1
@@ -1,133 +0,0 @@
1
- import { createCodeNomadRequester, type CodeNomadConfig, type PluginEvent } from "./request"
2
-
3
- export { getCodeNomadConfig, type CodeNomadConfig, type PluginEvent } from "./request"
4
-
5
- export function createCodeNomadClient(config: CodeNomadConfig) {
6
- const requester = createCodeNomadRequester(config)
7
-
8
- return {
9
- postEvent: (event: PluginEvent) =>
10
- requester.requestVoid("/event", {
11
- method: "POST",
12
- body: JSON.stringify(event),
13
- }),
14
- startEvents: (onEvent: (event: PluginEvent) => void) => startPluginEvents(requester, onEvent),
15
- }
16
- }
17
-
18
- function delay(ms: number) {
19
- return new Promise<void>((resolve) => setTimeout(resolve, ms))
20
- }
21
-
22
- async function startPluginEvents(
23
- requester: ReturnType<typeof createCodeNomadRequester>,
24
- onEvent: (event: PluginEvent) => void,
25
- ) {
26
- // Fail plugin startup if we cannot establish the initial connection.
27
- const initialBody = await connectWithRetries(requester, 3)
28
-
29
- // After startup, keep reconnecting; throw after 3 consecutive failures.
30
- void consumeWithReconnect(requester, onEvent, initialBody)
31
- }
32
-
33
- async function connectWithRetries(requester: ReturnType<typeof createCodeNomadRequester>, maxAttempts: number) {
34
- let lastError: unknown
35
-
36
- for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
37
- try {
38
- return await requester.requestSseBody("/events")
39
- } catch (error) {
40
- lastError = error
41
- await delay(500 * attempt)
42
- }
43
- }
44
-
45
- const reason = lastError instanceof Error ? lastError.message : String(lastError)
46
- const url = requester.buildUrl("/events")
47
- throw new Error(`[CodeNomadPlugin] Failed to connect to CodeNomad at ${url} after ${maxAttempts} retries: ${reason}`)
48
- }
49
-
50
- async function consumeWithReconnect(
51
- requester: ReturnType<typeof createCodeNomadRequester>,
52
- onEvent: (event: PluginEvent) => void,
53
- initialBody: ReadableStream<Uint8Array>,
54
- ) {
55
- let consecutiveFailures = 0
56
- let body: ReadableStream<Uint8Array> | null = initialBody
57
-
58
- while (true) {
59
- try {
60
- if (!body) {
61
- body = await connectWithRetries(requester, 3)
62
- }
63
-
64
- await consumeSseBody(body, onEvent)
65
- body = null
66
- consecutiveFailures = 0
67
- } catch (error) {
68
- body = null
69
- consecutiveFailures += 1
70
- if (consecutiveFailures >= 3) {
71
- const reason = error instanceof Error ? error.message : String(error)
72
- throw new Error(`[CodeNomadPlugin] Plugin event stream failed after 3 retries: ${reason}`)
73
- }
74
- await delay(500 * consecutiveFailures)
75
- }
76
- }
77
- }
78
-
79
- async function consumeSseBody(body: ReadableStream<Uint8Array>, onEvent: (event: PluginEvent) => void) {
80
- const reader = body.getReader()
81
- const decoder = new TextDecoder()
82
- let buffer = ""
83
-
84
- while (true) {
85
- const { done, value } = await reader.read()
86
- if (done || !value) {
87
- break
88
- }
89
-
90
- buffer += decoder.decode(value, { stream: true })
91
-
92
- let separatorIndex = buffer.indexOf("\n\n")
93
- while (separatorIndex >= 0) {
94
- const chunk = buffer.slice(0, separatorIndex)
95
- buffer = buffer.slice(separatorIndex + 2)
96
- separatorIndex = buffer.indexOf("\n\n")
97
-
98
- const event = parseSseChunk(chunk)
99
- if (event) {
100
- onEvent(event)
101
- }
102
- }
103
- }
104
-
105
- throw new Error("SSE stream ended")
106
- }
107
-
108
- function parseSseChunk(chunk: string): PluginEvent | null {
109
- const lines = chunk.split(/\r?\n/)
110
- const dataLines: string[] = []
111
-
112
- for (const line of lines) {
113
- if (line.startsWith(":")) continue
114
- if (line.startsWith("data:")) {
115
- dataLines.push(line.slice(5).trimStart())
116
- }
117
- }
118
-
119
- if (dataLines.length === 0) return null
120
-
121
- const payload = dataLines.join("\n").trim()
122
- if (!payload) return null
123
-
124
- try {
125
- const parsed = JSON.parse(payload)
126
- if (!parsed || typeof parsed !== "object" || typeof (parsed as any).type !== "string") {
127
- return null
128
- }
129
- return parsed as PluginEvent
130
- } catch {
131
- return null
132
- }
133
- }
@@ -1,214 +0,0 @@
1
- import http from "http"
2
- import https from "https"
3
- import { Readable } from "stream"
4
-
5
- export type PluginEvent = {
6
- type: string
7
- properties?: Record<string, unknown>
8
- }
9
-
10
- export type CodeNomadConfig = {
11
- instanceId: string
12
- baseUrl: string
13
- }
14
-
15
- export function getCodeNomadConfig(): CodeNomadConfig {
16
- return {
17
- instanceId: requireEnv("CODENOMAD_INSTANCE_ID"),
18
- baseUrl: requireEnv("CODENOMAD_BASE_URL"),
19
- }
20
- }
21
-
22
- export function createCodeNomadRequester(config: CodeNomadConfig) {
23
- const rawBaseUrl = (config.baseUrl ?? "").trim()
24
- const baseUrl = rawBaseUrl.replace(/\/+$/, "")
25
- const pluginBase = `${baseUrl}/workspaces/${encodeURIComponent(config.instanceId)}/plugin`
26
- const authorization = buildInstanceAuthorizationHeader()
27
-
28
- const buildUrl = (path: string) => {
29
- if (path.startsWith("http://") || path.startsWith("https://")) {
30
- return path
31
- }
32
- const normalized = path.startsWith("/") ? path : `/${path}`
33
- return `${pluginBase}${normalized}`
34
- }
35
-
36
- const buildHeaders = (headers: HeadersInit | undefined, hasBody: boolean): Record<string, string> => {
37
- const output: Record<string, string> = normalizeHeaders(headers)
38
- output.Authorization = authorization
39
- if (hasBody) {
40
- output["Content-Type"] = output["Content-Type"] ?? "application/json"
41
- }
42
- return output
43
- }
44
-
45
- const fetchWithAuth = async (path: string, init?: RequestInit): Promise<Response> => {
46
- const url = buildUrl(path)
47
- const hasBody = init?.body !== undefined
48
- const headers = buildHeaders(init?.headers, hasBody)
49
-
50
- // The CodeNomad plugin only talks to the local CodeNomad server.
51
- // Use a single request implementation that tolerates custom/self-signed certs
52
- // without disabling TLS verification for the whole Node process.
53
- return nodeFetch(url, { ...init, headers }, { rejectUnauthorized: false })
54
- }
55
-
56
- const requestJson = async <T>(path: string, init?: RequestInit): Promise<T> => {
57
- const response = await fetchWithAuth(path, init)
58
- if (!response.ok) {
59
- const message = await response.text().catch(() => "")
60
- throw new Error(message || `Request failed with ${response.status}`)
61
- }
62
-
63
- if (response.status === 204) {
64
- return undefined as T
65
- }
66
-
67
- return (await response.json()) as T
68
- }
69
-
70
- const requestVoid = async (path: string, init?: RequestInit): Promise<void> => {
71
- const response = await fetchWithAuth(path, init)
72
- if (!response.ok) {
73
- const message = await response.text().catch(() => "")
74
- throw new Error(message || `Request failed with ${response.status}`)
75
- }
76
- }
77
-
78
- const requestSseBody = async (path: string): Promise<ReadableStream<Uint8Array>> => {
79
- const response = await fetchWithAuth(path, { headers: { Accept: "text/event-stream" } })
80
- if (!response.ok || !response.body) {
81
- throw new Error(`SSE unavailable (${response.status})`)
82
- }
83
- return response.body as ReadableStream<Uint8Array>
84
- }
85
-
86
- return {
87
- buildUrl,
88
- fetch: fetchWithAuth,
89
- requestJson,
90
- requestVoid,
91
- requestSseBody,
92
- }
93
- }
94
-
95
- async function nodeFetch(
96
- url: string,
97
- init: RequestInit & { headers?: Record<string, string> },
98
- tls: { rejectUnauthorized: boolean },
99
- ): Promise<Response> {
100
- const parsed = new URL(url)
101
- const isHttps = parsed.protocol === "https:"
102
- const requestFn = isHttps ? https.request : http.request
103
-
104
- const method = (init.method ?? "GET").toUpperCase()
105
- const headers = init.headers ?? {}
106
- const body = init.body
107
-
108
- return await new Promise<Response>((resolve, reject) => {
109
- const req = requestFn(
110
- {
111
- protocol: parsed.protocol,
112
- hostname: parsed.hostname,
113
- port: parsed.port ? Number(parsed.port) : undefined,
114
- path: `${parsed.pathname}${parsed.search}`,
115
- method,
116
- headers,
117
- ...(isHttps ? { rejectUnauthorized: tls.rejectUnauthorized } : {}),
118
- },
119
- (res) => {
120
- const responseHeaders = new Headers()
121
- for (const [key, value] of Object.entries(res.headers)) {
122
- if (value === undefined) continue
123
- if (Array.isArray(value)) {
124
- responseHeaders.set(key, value.join(", "))
125
- } else {
126
- responseHeaders.set(key, String(value))
127
- }
128
- }
129
-
130
- // Convert Node stream -> Web ReadableStream for Response.
131
- const webBody = Readable.toWeb(res) as unknown as ReadableStream<Uint8Array>
132
- resolve(new Response(webBody, { status: res.statusCode ?? 0, headers: responseHeaders }))
133
- },
134
- )
135
-
136
- const signal = init.signal
137
- const abort = () => {
138
- const err = new Error("Request aborted")
139
- ;(err as any).name = "AbortError"
140
- req.destroy(err)
141
- reject(err)
142
- }
143
-
144
- if (signal) {
145
- if (signal.aborted) {
146
- abort()
147
- return
148
- }
149
- signal.addEventListener("abort", abort, { once: true })
150
- req.once("close", () => signal.removeEventListener("abort", abort))
151
- }
152
-
153
- req.once("error", reject)
154
-
155
- if (body === undefined || body === null) {
156
- req.end()
157
- return
158
- }
159
-
160
- if (typeof body === "string") {
161
- req.end(body)
162
- return
163
- }
164
-
165
- if (body instanceof Uint8Array) {
166
- req.end(Buffer.from(body))
167
- return
168
- }
169
-
170
- if (body instanceof ArrayBuffer) {
171
- req.end(Buffer.from(new Uint8Array(body)))
172
- return
173
- }
174
-
175
- // Fallback for less common BodyInit types.
176
- req.end(String(body))
177
- })
178
- }
179
-
180
- function requireEnv(key: string): string {
181
- const value = process.env[key]
182
- if (!value || !value.trim()) {
183
- throw new Error(`[CodeNomadPlugin] Missing required env var ${key}`)
184
- }
185
- return value
186
- }
187
-
188
- function buildInstanceAuthorizationHeader(): string {
189
- const username = requireEnv("OPENCODE_SERVER_USERNAME")
190
- const password = requireEnv("OPENCODE_SERVER_PASSWORD")
191
- const token = Buffer.from(`${username}:${password}`, "utf8").toString("base64")
192
- return `Basic ${token}`
193
- }
194
-
195
- function normalizeHeaders(headers: HeadersInit | undefined): Record<string, string> {
196
- const output: Record<string, string> = {}
197
- if (!headers) return output
198
-
199
- if (headers instanceof Headers) {
200
- headers.forEach((value, key) => {
201
- output[key] = value
202
- })
203
- return output
204
- }
205
-
206
- if (Array.isArray(headers)) {
207
- for (const [key, value] of headers) {
208
- output[key] = value
209
- }
210
- return output
211
- }
212
-
213
- return { ...headers }
214
- }
@@ -1,26 +0,0 @@
1
- import { existsSync } from "fs";
2
- import path from "path";
3
- import { fileURLToPath } from "url";
4
- import { createLogger } from "./logger";
5
- const log = createLogger({ component: "opencode-config" });
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = path.dirname(__filename);
8
- const devTemplateDir = path.resolve(__dirname, "../../opencode-config");
9
- const resourcesPath = process.resourcesPath;
10
- const prodTemplateDirs = [
11
- resourcesPath ? path.resolve(resourcesPath, "opencode-config") : undefined,
12
- path.resolve(__dirname, "opencode-config"),
13
- ].filter((dir) => Boolean(dir));
14
- const isDevBuild = Boolean(process.env.CODENOMAD_DEV ?? process.env.CLI_UI_DEV_SERVER) || existsSync(devTemplateDir);
15
- const templateDir = isDevBuild
16
- ? devTemplateDir
17
- : prodTemplateDirs.find((dir) => existsSync(dir)) ?? prodTemplateDirs[0];
18
- export function getOpencodeConfigDir() {
19
- if (!existsSync(templateDir)) {
20
- throw new Error(`CodeNomad Opencode config template missing at ${templateDir}`);
21
- }
22
- if (isDevBuild) {
23
- log.debug({ templateDir }, "Using Opencode config template directly (dev mode)");
24
- }
25
- return templateDir;
26
- }
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-viewer-CMM6n0T3.js","assets/git-diff-vendor-CSgooKT_.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css"])))=>i.map(i=>d[i]);
2
- import{_ as K}from"./index-DzRzoTK8.js";import{m as B,t as g,i as a,d as w,a as F,f as N}from"./monaco-viewer-CMM6n0T3.js";import{c as f,n as c,a as L,F as T,S as W,z as j,A as q}from"./git-diff-vendor-CSgooKT_.js";import{D as G}from"./DiffToolbar-CQQLR1mp.js";import{S as H}from"./SplitFilePanel-CupweEA5.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";import"./main-BsIf5lOY.js";import"./wrap-text-D2MJk2ad.js";var J=g('<div class="file-viewer-panel flex-1"><div class="file-viewer-content file-viewer-content--monaco">'),p=g("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),Q=g('<div class="p-3 text-xs text-secondary">'),E=g("<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class=file-list-item-stats><span class=file-list-item-additions>+</span><span class=file-list-item-deletions>-"),U=g("<span class=files-tab-selected-path><span class=file-path-text>"),X=g('<div class=files-tab-stats style="flex:0 0 auto"><span class="files-tab-stat files-tab-stat-additions"><span class=files-tab-stat-value>+</span></span><span class="files-tab-stat files-tab-stat-deletions"><span class=files-tab-stat-value>-'),Y=g("<div style=margin-left:auto>");const Z=q(()=>K(()=>import("./monaco-viewer-CMM6n0T3.js").then(e=>e.ad),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoDiffViewer}))),fe=e=>{const M=f(()=>e.activeSessionId()),S=f(()=>!!(M()&&M()!=="info")),D=f(()=>S()?e.activeSessionDiffs():null),m=f(()=>{const n=D();return Array.isArray(n)?[...n].sort((i,l)=>String(i.file||"").localeCompare(String(l.file||""))):[]}),R=f(()=>m().reduce((n,i)=>(n.additions+=typeof i.additions=="number"?i.additions:0,n.deletions+=typeof i.deletions=="number"?i.deletions:0,n),{additions:0,deletions:0})),I=f(()=>{const n=m();return n.length===0?null:n.reduce((i,l)=>{const v=typeof(i==null?void 0:i.additions)=="number"?i.additions:0,y=typeof(i==null?void 0:i.deletions)=="number"?i.deletions:0,x=v+y,k=typeof(l==null?void 0:l.additions)=="number"?l.additions:0,t=typeof(l==null?void 0:l.deletions)=="number"?l.deletions:0,r=k+t;return r>x?l:r<x?i:String(l.file||"").localeCompare(String((i==null?void 0:i.file)||""))<0?l:i},n[0])}),P=f(()=>{const n=e.selectedFile(),i=m();if(n){const l=i.find(v=>v.file===n);if(l)return l}return I()}),O=f(()=>`${e.instanceId}:${S()?M():"no-session"}`),V=f(()=>{if(!S())return e.t("instanceShell.sessionChanges.noSessionSelected");const n=D();return n===void 0?e.t("instanceShell.sessionChanges.loading"):!Array.isArray(n)||n.length===0?e.t("instanceShell.sessionChanges.empty"):e.t("instanceShell.filesShell.viewerEmpty")}),A=f(()=>{const n=P();return n!=null&&n.file?String(n.file):e.t("instanceShell.rightPanel.tabs.changes")});return B(()=>{const n=m(),i=R(),l=P(),v=()=>(()=>{var t=J(),r=t.firstChild;return a(r,c(W,{get when(){return l&&S()&&n.length>0?l:null},get fallback(){return(()=>{var d=p(),s=d.firstChild;return a(s,V),d})()},children:d=>c(j,{get fallback(){return(()=>{var s=p(),u=s.firstChild;return a(u,()=>e.t("instanceInfo.loading")),s})()},get children(){return c(Z,{get scopeKey(){return O()},get path(){return String(d().file||"")},get patch(){return String(d().patch||"")},get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrap(){return e.diffWordWrapMode()}})}})})),t})(),y=()=>(()=>{var t=Q();return a(t,V),t})();return c(H,{get header(){return[(()=>{var t=U(),r=t.firstChild;return a(r,A),L(()=>w(t,"title",A())),t})(),(()=>{var t=X(),r=t.firstChild,d=r.firstChild;d.firstChild;var s=r.nextSibling,u=s.firstChild;return u.firstChild,a(d,()=>i.additions,null),a(u,()=>i.deletions,null),t})(),(()=>{var t=Y();return a(t,c(G,{get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrapMode(){return e.diffWordWrapMode()},get onViewModeChange(){return e.onViewModeChange},get onContextModeChange(){return e.onContextModeChange},get onWordWrapModeChange(){return e.onWordWrapModeChange}})),t})()]},list:{panel:()=>c(W,{get when(){return n.length>0},get fallback(){return y()},get children(){return c(T,{each:n,children:t=>(()=>{var r=E(),d=r.firstChild,s=d.firstChild,u=s.firstChild,b=s.nextSibling,h=b.firstChild;h.firstChild;var C=h.nextSibling;return C.firstChild,r.$$click=()=>{e.onSelectFile(t.file,e.isPhoneLayout())},a(u,()=>t.file),a(h,()=>t.additions,null),a(C,()=>t.deletions,null),L(o=>{var _=`file-list-item ${(l==null?void 0:l.file)===t.file?"file-list-item-active":""}`,$=t.file;return _!==o.e&&F(r,o.e=_),$!==o.t&&w(s,"title",o.t=$),o},{e:void 0,t:void 0}),r})()})}}),overlay:()=>c(W,{get when(){return n.length>0},get fallback(){return y()},get children(){return c(T,{each:n,children:t=>(()=>{var r=E(),d=r.firstChild,s=d.firstChild,u=s.firstChild,b=s.nextSibling,h=b.firstChild;h.firstChild;var C=h.nextSibling;return C.firstChild,r.$$click=()=>{e.onSelectFile(t.file,!0)},a(u,()=>t.file),a(h,()=>t.additions,null),a(C,()=>t.deletions,null),L(o=>{var _=`file-list-item ${(l==null?void 0:l.file)===t.file?"file-list-item-active":""}`,$=t.file,z=t.file;return _!==o.e&&F(r,o.e=_),$!==o.t&&w(r,"title",o.t=$),z!==o.a&&w(s,"title",o.a=z),o},{e:void 0,t:void 0,a:void 0}),r})()})}})},get viewer(){return v()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.changes")}})})};N(["click"]);export{fe as default};
@@ -1 +0,0 @@
1
- import{t as g,i as c,m as W,d as i,a as S,f as C}from"./monaco-viewer-CMM6n0T3.js";import{u as T}from"./index-DzRzoTK8.js";import{n as o,m as $,a as V}from"./git-diff-vendor-CSgooKT_.js";import{I as U,S as A,O as I}from"./main-BsIf5lOY.js";import{A as D,W as E}from"./wrap-text-D2MJk2ad.js";const F=[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m15 5-3-3-3 3",key:"itvq4r"}]],H=t=>o(U,$(t,{name:"UnfoldVertical",iconNode:F}));var N=g("<div class=file-viewer-toolbar><button type=button class=file-viewer-toolbar-icon-button></button><button type=button class=file-viewer-toolbar-icon-button></button><button type=button>");const R=t=>{const{t:a}=T(),r=()=>t.viewMode==="split"?"unified":"split",s=()=>t.contextMode==="collapsed"?"expanded":"collapsed",h=()=>t.wordWrapMode==="on"?"off":"on",f=()=>r()==="split"?a("instanceShell.diff.switchToSplit"):a("instanceShell.diff.switchToUnified"),v=()=>s()==="collapsed"?a("instanceShell.diff.hideUnchanged"):a("instanceShell.diff.showFull"),u=()=>h()==="on"?a("instanceShell.diff.enableWordWrap"):a("instanceShell.diff.disableWordWrap");return(()=>{var b=N(),n=b.firstChild,l=n.nextSibling,d=l.nextSibling;return n.$$click=()=>t.onViewModeChange(r()),c(n,(()=>{var e=W(()=>r()==="split");return()=>e()?o(A,{class:"h-4 w-4","aria-hidden":"true"}):o(D,{class:"h-4 w-4","aria-hidden":"true"})})()),l.$$click=()=>t.onContextModeChange(s()),c(l,(()=>{var e=W(()=>s()==="collapsed");return()=>e()?o(I,{class:"h-4 w-4","aria-hidden":"true"}):o(H,{class:"h-4 w-4","aria-hidden":"true"})})()),d.$$click=()=>t.onWordWrapModeChange(h()),c(d,o(E,{class:"h-4 w-4","aria-hidden":"true"})),V(e=>{var m=f(),w=f(),M=v(),p=v(),x=`file-viewer-toolbar-icon-button${t.wordWrapMode==="on"?" active":""}`,k=u(),y=u();return m!==e.e&&i(n,"aria-label",e.e=m),w!==e.t&&i(n,"title",e.t=w),M!==e.a&&i(l,"aria-label",e.a=M),p!==e.o&&i(l,"title",e.o=p),x!==e.i&&S(d,e.i=x),k!==e.n&&i(d,"aria-label",e.n=k),y!==e.s&&i(d,"title",e.s=y),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),b})()};C(["click"]);export{R as D};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-viewer-CMM6n0T3.js","assets/git-diff-vendor-CSgooKT_.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css"])))=>i.map(i=>d[i]);
2
- import{_ as R}from"./index-DzRzoTK8.js";import{m as _,t as o,i as s,d as c,a as z,f as I}from"./monaco-viewer-CMM6n0T3.js";import{n as i,m as D,S as d,a as v,F,z as V,A as M}from"./git-diff-vendor-CSgooKT_.js";import{S as T}from"./SplitFilePanel-CupweEA5.js";import{I as A,R as y}from"./main-BsIf5lOY.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";const O=[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]],q=e=>i(A,D(e,{name:"Save",iconNode:O}));var g=o("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),K=o('<div class="file-viewer-panel flex-1"><div class="file-viewer-content file-viewer-content--monaco">'),N=o('<div class="p-3 text-xs text-secondary">'),W=o("<div class=file-list-item><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text>.."),H=o('<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class=file-list-item-stats><span class="text-[10px] text-secondary">'),j=o("<span>"),B=o("<div class=files-tab-stats><span class=files-tab-stat><span class=files-tab-selected-path><span class=file-path-text>"),G=o("<button type=button class=files-header-icon-button style=margin-inline-start:auto>"),J=o("<button type=button class=files-header-icon-button>"),Q=o("<span class=text-error>");const U=M(()=>R(()=>import("./monaco-viewer-CMM6n0T3.js").then(e=>e.ae),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoFileViewer}))),ae=e=>{const C=()=>{const h=e.browserSelectedContent();h!=null&&e.onSave(h)};return _(()=>{const h=e.browserEntries(),P=[...h||[]].sort((t,n)=>{const r=t.type==="directory"?0:1,l=n.type==="directory"?0:1;return r!==l?r-l:String(t.name||"").localeCompare(String(n.name||""))}),L=e.parentPath(),w=()=>e.browserSelectedPath()||e.browserPath(),x=()=>e.browserLoading()&&h===null?e.t("instanceInfo.loading"):e.t("instanceShell.filesShell.viewerEmpty"),k=()=>(()=>{var t=K(),n=t.firstChild;return s(n,i(d,{get when(){return e.browserSelectedLoading()},get fallback(){return i(d,{get when(){return e.browserSelectedError()},get fallback(){return i(d,{get when(){return _(()=>!!(e.browserSelectedPath()&&e.browserSelectedContent()!==null))()?{path:e.browserSelectedPath(),content:e.browserSelectedContent()}:null},get fallback(){return(()=>{var r=g(),l=r.firstChild;return s(l,x),r})()},children:r=>i(V,{get fallback(){return(()=>{var l=g(),a=l.firstChild;return s(a,()=>e.t("instanceInfo.loading")),l})()},get children(){return i(U,{get scopeKey(){return e.scopeKey()},get path(){return r().path},get content(){return r().content},get onSave(){return e.onSave},get onContentChange(){return e.onContentChange}})}})})},children:r=>(()=>{var l=g(),a=l.firstChild;return s(a,r),l})()})},get children(){var r=g(),l=r.firstChild;return s(l,()=>e.t("instanceInfo.loading")),r}})),t})(),m=()=>[i(d,{when:L,children:t=>(()=>{var n=W(),r=n.firstChild,l=r.firstChild;return n.$$click=()=>e.onLoadEntries(t()),v(()=>c(l,"title",t())),n})()}),i(d,{get when(){return e.browserLoading()&&h===null},get children(){var t=N();return s(t,()=>e.t("instanceInfo.loading")),t}}),i(F,{each:P,children:t=>(()=>{var n=H(),r=n.firstChild,l=r.firstChild,a=l.firstChild,f=l.nextSibling,E=f.firstChild;return n.$$click=()=>{if(t.type==="directory"){e.onLoadEntries(t.path);return}e.onRequestOpenFile(t.path)},s(a,()=>t.name),s(E,()=>t.type),v(u=>{var b=`file-list-item ${e.browserSelectedPath()===t.path?"file-list-item-active":""}`,S=t.path,$=t.path;return b!==u.e&&z(n,u.e=b),S!==u.t&&c(n,"title",u.t=S),$!==u.a&&c(l,"title",u.a=$),u},{e:void 0,t:void 0,a:void 0}),n})()})];return i(T,{get header(){return[(()=>{var t=B(),n=t.firstChild,r=n.firstChild,l=r.firstChild;return s(l,w),s(t,i(d,{get when(){return e.browserLoading()},get children(){var a=j();return s(a,()=>e.t("instanceInfo.loading")),a}}),null),s(t,i(d,{get when(){return e.browserError()},children:a=>(()=>{var f=Q();return s(f,a),f})()}),null),v(()=>c(r,"title",w())),t})(),(()=>{var t=G();return t.$$click=C,s(t,i(d,{get when(){return e.browserSelectedSaving()},get fallback(){return i(q,{class:"h-4 w-4"})},get children(){return i(y,{class:"h-4 w-4 animate-spin"})}})),v(n=>{var r=e.t("instanceShell.rightPanel.actions.save")||"Save (Ctrl+S)",l=e.t("instanceShell.rightPanel.actions.save")||"Save",a=e.browserSelectedSaving()||!e.browserSelectedDirty();return r!==n.e&&c(t,"title",n.e=r),l!==n.t&&c(t,"aria-label",n.t=l),a!==n.a&&(t.disabled=n.a=a),n},{e:void 0,t:void 0,a:void 0}),t})(),(()=>{var t=J();return t.$$click=()=>e.onRefresh(),s(t,i(y,{get class(){return`h-4 w-4${e.browserLoading()?" animate-spin":""}`}})),v(n=>{var r=e.t("instanceShell.rightPanel.actions.refresh"),l=e.t("instanceShell.rightPanel.actions.refresh"),a=e.browserLoading();return r!==n.e&&c(t,"title",n.e=r),l!==n.t&&c(t,"aria-label",n.t=l),a!==n.a&&(t.disabled=n.a=a),n},{e:void 0,t:void 0,a:void 0}),t})()]},list:{panel:m,overlay:m},get viewer(){return k()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.files")}})})};I(["click"]);export{ae as default};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-viewer-CMM6n0T3.js","assets/git-diff-vendor-CSgooKT_.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css"])))=>i.map(i=>d[i]);
2
- import{_ as B}from"./index-DzRzoTK8.js";import{m as V,t as h,i as r,d as $,a as D,f as K}from"./monaco-viewer-CMM6n0T3.js";import{c as f,n as d,a as w,S as c,F as R,z as G,A as N}from"./git-diff-vendor-CSgooKT_.js";import{D as j}from"./DiffToolbar-CQQLR1mp.js";import{S as q}from"./SplitFilePanel-CupweEA5.js";import{R as H}from"./main-BsIf5lOY.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";import"./wrap-text-D2MJk2ad.js";var S=h("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),J=h('<div class="file-viewer-panel flex-1"><div class="file-viewer-content file-viewer-content--monaco">'),Q=h('<div class="p-3 text-xs text-secondary">'),A=h('<span class="text-[10px] text-secondary">'),z=h("<span class=file-list-item-additions>+"),O=h("<span class=file-list-item-deletions>-"),T=h("<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class=file-list-item-stats>"),U=h("<span class=files-tab-selected-path><span class=file-path-text>"),X=h('<div class=files-tab-stats style="flex:0 0 auto"><span class="files-tab-stat files-tab-stat-additions"><span class=files-tab-stat-value>+</span></span><span class="files-tab-stat files-tab-stat-deletions"><span class=files-tab-stat-value>-'),Y=h("<button type=button class=files-header-icon-button style=margin-left:auto>"),Z=h("<span class=text-error>");const p=N(()=>B(()=>import("./monaco-viewer-CMM6n0T3.js").then(e=>e.ad),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoDiffViewer}))),ce=e=>{const P=f(()=>e.activeSessionId()),y=f(()=>!!(P()&&P()!=="info")),M=f(()=>y()?e.entries():null),b=f(()=>{const o=M();return Array.isArray(o)?[...o].sort((s,g)=>String(s.path||"").localeCompare(String(g.path||""))):[]}),F=f(()=>b().reduce((o,s)=>(o.additions+=typeof s.added=="number"?s.added:0,o.deletions+=typeof s.removed=="number"?s.removed:0,o),{additions:0,deletions:0})),L=f(()=>b().filter(o=>o&&o.status!=="deleted")),I=f(()=>{const o=b(),s=e.selectedPath(),g=e.mostChangedPath();return(o.find(_=>_.path===s)||(g?o.find(_=>_.path===g):void 0))??null}),W=f(()=>y()?M()===null?e.t("instanceShell.gitChanges.loading"):L().length===0?e.t("instanceShell.gitChanges.empty"):e.t("instanceShell.filesShell.viewerEmpty"):e.t("instanceShell.gitChanges.noSessionSelected"));return V(()=>{const o=F(),s=I(),g=b(),x=L(),_=()=>(()=>{var t=J(),l=t.firstChild;return r(l,d(c,{get when(){return e.selectedLoading()},get fallback(){return d(c,{get when(){return e.selectedError()},get fallback(){return d(c,{get when(){return V(()=>!!(s&&e.selectedBefore()!==null&&e.selectedAfter()!==null&&s.status!=="deleted"))()?{path:s.path,before:e.selectedBefore(),after:e.selectedAfter()}:null},get fallback(){return(()=>{var i=S(),a=i.firstChild;return r(a,W),i})()},children:i=>d(G,{get fallback(){return(()=>{var a=S(),u=a.firstChild;return r(u,()=>e.t("instanceInfo.loading")),a})()},get children(){return d(p,{get scopeKey(){return e.scopeKey()},get path(){return String(i().path||"")},get before(){return String(i().before||"")},get after(){return String(i().after||"")},get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrap(){return e.diffWordWrapMode()}})}})})},children:i=>(()=>{var a=S(),u=a.firstChild;return r(u,i),a})()})},get children(){var i=S(),a=i.firstChild;return r(a,()=>e.t("instanceInfo.loading")),i}})),t})(),k=()=>(()=>{var t=Q();return r(t,W),t})();return d(q,{get header(){return[(()=>{var t=U(),l=t.firstChild;return r(l,()=>(s==null?void 0:s.path)||e.t("instanceShell.rightPanel.tabs.gitChanges")),w(()=>$(t,"title",(s==null?void 0:s.path)||e.t("instanceShell.rightPanel.tabs.gitChanges"))),t})(),(()=>{var t=X(),l=t.firstChild,i=l.firstChild;i.firstChild;var a=l.nextSibling,u=a.firstChild;return u.firstChild,r(i,()=>o.additions,null),r(u,()=>o.deletions,null),r(t,d(c,{get when(){return e.statusError()},children:v=>(()=>{var n=Z();return r(n,v),n})()}),null),t})(),(()=>{var t=Y();return t.$$click=()=>e.onRefresh(),r(t,d(H,{get class(){return`h-4 w-4${e.statusLoading()?" animate-spin":""}`}})),w(l=>{var i=e.t("instanceShell.rightPanel.actions.refresh"),a=e.t("instanceShell.rightPanel.actions.refresh"),u=!y()||e.statusLoading()||M()===null;return i!==l.e&&$(t,"title",l.e=i),a!==l.t&&$(t,"aria-label",l.t=a),u!==l.a&&(t.disabled=l.a=u),l},{e:void 0,t:void 0,a:void 0}),t})(),d(j,{get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrapMode(){return e.diffWordWrapMode()},get onViewModeChange(){return e.onViewModeChange},get onContextModeChange(){return e.onContextModeChange},get onWordWrapModeChange(){return e.onWordWrapModeChange}})]},list:{panel:()=>d(c,{get when(){return x.length>0},get fallback(){return k()},get children(){return d(R,{each:g,children:t=>(()=>{var l=T(),i=l.firstChild,a=i.firstChild,u=a.firstChild,v=a.nextSibling;return l.$$click=()=>{e.onOpenFile(t.path)},r(u,()=>t.path),r(v,d(c,{get when(){return t.status==="deleted"},get children(){var n=A();return r(n,()=>e.t("instanceShell.gitChanges.deleted")),n}}),null),r(v,d(c,{get when(){return t.status!=="deleted"},get children(){return[(()=>{var n=z();return n.firstChild,r(n,()=>t.added,null),n})(),(()=>{var n=O();return n.firstChild,r(n,()=>t.removed,null),n})()]}}),null),w(n=>{var C=`file-list-item ${e.selectedPath()===t.path?"file-list-item-active":""}`,m=t.path;return C!==n.e&&D(l,n.e=C),m!==n.t&&$(a,"title",n.t=m),n},{e:void 0,t:void 0}),l})()})}}),overlay:()=>d(c,{get when(){return x.length>0},get fallback(){return k()},get children(){return d(R,{each:g,children:t=>(()=>{var l=T(),i=l.firstChild,a=i.firstChild,u=a.firstChild,v=a.nextSibling;return l.$$click=()=>e.onOpenFile(t.path),r(u,()=>t.path),r(v,d(c,{get when(){return t.status==="deleted"},get children(){var n=A();return r(n,()=>e.t("instanceShell.gitChanges.deleted")),n}}),null),r(v,d(c,{get when(){return t.status!=="deleted"},get children(){return[(()=>{var n=z();return n.firstChild,r(n,()=>t.added,null),n})(),(()=>{var n=O();return n.firstChild,r(n,()=>t.removed,null),n})()]}}),null),w(n=>{var C=`file-list-item ${e.selectedPath()===t.path?"file-list-item-active":""}`,m=t.path,E=t.path;return C!==n.e&&D(l,n.e=C),m!==n.t&&$(l,"title",n.t=m),E!==n.a&&$(a,"title",n.a=E),n},{e:void 0,t:void 0,a:void 0}),l})()})}})},get viewer(){return _()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.gitChanges")}})})};K(["click"]);export{ce as default};
@@ -1 +0,0 @@
1
- import{m as Pe,P as Xe,t as _,i as h,a as Ye,d as O,f as Ge}from"./monaco-viewer-CMM6n0T3.js";import{n as d,m as S,b as T,o as k,k as ee,l as te,q as ae,s as M,d as I,c as W,S as J,t as Qe,w as we,a as he,F as ge}from"./git-diff-vendor-CSgooKT_.js";import{I as ce,P as Ze,Q as F,T as re,U as Je,V as et,W as ke,X as Ie,Y as Te,Z as tt,_ as fe,$ as le,a0 as de,a1 as $e,a2 as ne,a3 as oe,a4 as nt,a5 as me,a6 as ot,a7 as st,a8 as A,a9 as be,aa as it,ab as rt,ac as lt,ad as R,ae as at,af as ct,ag as Se,ah as dt,ai as pe,aj as ut,ak as gt,al as ft,am as pt}from"./main-BsIf5lOY.js";import{u as ht}from"./index-DzRzoTK8.js";import{T as mt}from"./todo-Ghwirj-b.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";const bt=[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]],vt=e=>d(ce,S(e,{name:"BellRing",iconNode:bt})),yt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],xt=e=>d(ce,S(e,{name:"Info",iconNode:yt})),Ct=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],wt=e=>d(ce,S(e,{name:"TerminalSquare",iconNode:Ct})),St=[["polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2",key:"h1p8hx"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Pt=e=>d(ce,S(e,{name:"XOctagon",iconNode:St}));var De=ee();function kt(){return te(De)}function It(){const e=kt();if(e===void 0)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}function Oe(e,o){return!!(o.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function Tt(e,o){var t;const l=o.ref();if(!l)return-1;let r=e.length;if(!r)return-1;for(;r--;){const n=(t=e[r])==null?void 0:t.ref();if(n&&Oe(n,l))return r+1}return 0}function $t(e){const o=e.map((r,t)=>[t,r]);let l=!1;return o.sort(([r,t],[n,s])=>{const i=t.ref(),c=s.ref();return i===c||!i||!c?0:Oe(i,c)?(r>n&&(l=!0),-1):(r<n&&(l=!0),1)}),l?o.map(([r,t])=>t):e}function _e(e,o){const l=$t(e);e!==l&&o(l)}function Dt(e){var t,n;const o=e[0],l=(t=e[e.length-1])==null?void 0:t.ref();let r=(n=o==null?void 0:o.ref())==null?void 0:n.parentElement;for(;r;){if(l&&r.contains(l))return r;r=r.parentElement}return re(r).body}function Ot(e,o){T(()=>{const l=setTimeout(()=>{_e(e(),o)});k(()=>clearTimeout(l))})}function _t(e,o){if(typeof IntersectionObserver!="function"){Ot(e,o);return}let l=[];T(()=>{const r=()=>{const s=!!l.length;l=e(),s&&_e(e(),o)},t=Dt(e()),n=new IntersectionObserver(r,{root:t});for(const s of e()){const i=s.ref();i&&n.observe(i)}k(()=>n.disconnect())})}function Mt(e={}){const[o,l]=Ze({value:()=>et(e.items),onChange:n=>{var s;return(s=e.onItemsChange)==null?void 0:s.call(e,n)}});_t(o,l);const r=n=>(l(s=>{const i=Tt(s,n);return Je(s,n,i)}),()=>{l(s=>{const i=s.filter(c=>c.ref()!==n.ref());return s.length===i.length?s:i})});return{DomCollectionProvider:n=>d(De.Provider,{value:{registerItem:r},get children(){return n.children}})}}function Et(e){const o=It(),l=F({shouldRegisterItem:!0},e);T(()=>{if(!l.shouldRegisterItem)return;const r=o.registerItem(l.getItem());k(r)})}var At={};be(At,{Arrow:()=>ke,Content:()=>Ee,Portal:()=>Ae,Root:()=>Re,Tooltip:()=>Z,Trigger:()=>Fe,useTooltipContext:()=>ue});var Me=ee();function ue(){const e=te(Me);if(e===void 0)throw new Error("[kobalte]: `useTooltipContext` must be used within a `Tooltip` component");return e}function Ee(e){const o=ue(),l=F({id:o.generateId("content")},e),[r,t]=M(l,["ref","style"]);return T(()=>k(o.registerContentId(t.id))),d(J,{get when(){return o.contentPresent()},get children(){return d($e.Positioner,{get children(){return d(nt,S({ref(n){var s=ne(i=>{o.setContentRef(i)},r.ref);typeof s=="function"&&s(n)},role:"tooltip",disableOutsidePointerEvents:!1,get style(){return me({"--kb-tooltip-content-transform-origin":"var(--kb-popper-content-transform-origin)",position:"relative"},r.style)},onFocusOutside:n=>n.preventDefault(),onDismiss:()=>o.hideTooltip(!0)},()=>o.dataset(),t))}})}})}function Ae(e){const o=ue();return d(J,{get when(){return o.contentPresent()},get children(){return d(Xe,e)}})}function Rt(e,o,l){const r=e.split("-")[0],t=o.getBoundingClientRect(),n=l.getBoundingClientRect(),s=[],i=t.left+t.width/2,c=t.top+t.height/2;switch(r){case"top":s.push([t.left,c]),s.push([n.left,n.bottom]),s.push([n.left,n.top]),s.push([n.right,n.top]),s.push([n.right,n.bottom]),s.push([t.right,c]);break;case"right":s.push([i,t.top]),s.push([n.left,n.top]),s.push([n.right,n.top]),s.push([n.right,n.bottom]),s.push([n.left,n.bottom]),s.push([i,t.bottom]);break;case"bottom":s.push([t.left,c]),s.push([n.left,n.top]),s.push([n.left,n.bottom]),s.push([n.right,n.bottom]),s.push([n.right,n.top]),s.push([t.right,c]);break;case"left":s.push([i,t.top]),s.push([n.right,n.top]),s.push([n.left,n.top]),s.push([n.left,n.bottom]),s.push([n.right,n.bottom]),s.push([i,t.bottom]);break}return s}var H={},Ft=0,X=!1,E,Q,Y;function Re(e){const o=`tooltip-${ae()}`,l=`${++Ft}`,r=F({id:o,openDelay:700,closeDelay:300,skipDelayDuration:300},e),[t,n]=M(r,["id","open","defaultOpen","onOpenChange","disabled","triggerOnFocusOnly","openDelay","closeDelay","skipDelayDuration","ignoreSafeArea","forceMount"]);let s;const[i,c]=I(),[a,f]=I(),[u,g]=I(),[y,v]=I(n.placement),x=Ie({open:()=>t.open,defaultOpen:()=>t.defaultOpen,onOpenChange:b=>{var P;return(P=t.onOpenChange)==null?void 0:P.call(t,b)}}),{present:$}=Te({show:()=>t.forceMount||x.isOpen(),element:()=>u()??null}),m=()=>{H[l]=C},w=()=>{for(const b in H)b!==l&&(H[b](!0),delete H[b])},C=(b=!1)=>{b||t.closeDelay&&t.closeDelay<=0?(window.clearTimeout(s),s=void 0,x.close()):s||(s=window.setTimeout(()=>{s=void 0,x.close()},t.closeDelay)),window.clearTimeout(E),E=void 0,t.skipDelayDuration&&t.skipDelayDuration>=0&&(Y=window.setTimeout(()=>{window.clearTimeout(Y),Y=void 0},t.skipDelayDuration)),X&&(window.clearTimeout(Q),Q=window.setTimeout(()=>{delete H[l],Q=void 0,X=!1},t.closeDelay))},p=()=>{clearTimeout(s),s=void 0,w(),m(),X=!0,x.open(),window.clearTimeout(E),E=void 0,window.clearTimeout(Q),Q=void 0,window.clearTimeout(Y),Y=void 0},q=()=>{w(),m(),!x.isOpen()&&!E&&!X?E=window.setTimeout(()=>{E=void 0,X=!0,p()},t.openDelay):x.isOpen()||p()},K=(b=!1)=>{!b&&t.openDelay&&t.openDelay>0&&!s&&!Y?q():p()},z=()=>{window.clearTimeout(E),E=void 0,X=!1},B=()=>{window.clearTimeout(s),s=void 0},U=b=>fe(a(),b)||fe(u(),b),D=b=>{const P=a(),N=u();if(!(!P||!N))return Rt(b,P,N)},L=b=>{const P=b.target;if(U(P)){B();return}if(!t.ignoreSafeArea){const N=D(y());if(N&&ot(st(b),N)){B();return}}s||C()};T(()=>{if(!x.isOpen())return;const b=re();b.addEventListener("pointermove",L,!0),k(()=>{b.removeEventListener("pointermove",L,!0)})}),T(()=>{const b=a();if(!b||!x.isOpen())return;const P=ze=>{const Ve=ze.target;fe(Ve,b)&&C(!0)},N=tt();N.addEventListener("scroll",P,{capture:!0}),k(()=>{N.removeEventListener("scroll",P,{capture:!0})})}),k(()=>{clearTimeout(s),H[l]&&delete H[l]});const ie={dataset:W(()=>({"data-expanded":x.isOpen()?"":void 0,"data-closed":x.isOpen()?void 0:""})),isOpen:x.isOpen,isDisabled:()=>t.disabled??!1,triggerOnFocusOnly:()=>t.triggerOnFocusOnly??!1,contentId:i,contentPresent:$,openTooltip:K,hideTooltip:C,cancelOpening:z,generateId:de(()=>r.id),registerContentId:le(c),isTargetOnTooltip:U,setTriggerRef:f,setContentRef:g};return d(Me.Provider,{value:ie,get children(){return d($e,S({anchorRef:a,contentRef:u,onCurrentPlacementChange:v},n))}})}function Fe(e){let o;const l=ue(),[r,t]=M(e,["ref","onPointerEnter","onPointerLeave","onPointerDown","onClick","onFocus","onBlur"]);let n=!1,s=!1,i=!1;const c=()=>{n=!1},a=()=>{!l.isOpen()&&(s||i)&&l.openTooltip(i)},f=m=>{l.isOpen()&&!s&&!i&&l.hideTooltip(m)},u=m=>{A(m,r.onPointerEnter),!(m.pointerType==="touch"||l.triggerOnFocusOnly()||l.isDisabled()||m.defaultPrevented)&&(s=!0,a())},g=m=>{A(m,r.onPointerLeave),m.pointerType!=="touch"&&(s=!1,i=!1,l.isOpen()?f():l.cancelOpening())},y=m=>{A(m,r.onPointerDown),n=!0,re(o).addEventListener("pointerup",c,{once:!0})},v=m=>{A(m,r.onClick),s=!1,i=!1,f(!0)},x=m=>{A(m,r.onFocus),!(l.isDisabled()||m.defaultPrevented||n)&&(i=!0,a())},$=m=>{A(m,r.onBlur);const w=m.relatedTarget;l.isTargetOnTooltip(w)||(s=!1,i=!1,f(!0))};return k(()=>{re(o).removeEventListener("pointerup",c)}),d(oe,S({as:"button",ref(m){var w=ne(C=>{l.setTriggerRef(C),o=C},r.ref);typeof w=="function"&&w(m)},get"aria-describedby"(){return Pe(()=>!!l.isOpen())()?l.contentId():void 0},onPointerEnter:u,onPointerLeave:g,onPointerDown:y,onClick:v,onFocus:x,onBlur:$},()=>l.dataset(),t))}var Z=Object.assign(Re,{Arrow:ke,Content:Ee,Portal:Ae,Trigger:Fe}),Kt={};be(Kt,{Collapsible:()=>Bt,Content:()=>ve,Root:()=>ye,Trigger:()=>xe,useCollapsibleContext:()=>se});var Ke=ee();function se(){const e=te(Ke);if(e===void 0)throw new Error("[kobalte]: `useCollapsibleContext` must be used within a `Collapsible.Root` component");return e}function ve(e){const[o,l]=I(),r=se(),t=F({id:r.generateId("content")},e),[n,s]=M(t,["ref","id","style"]),{present:i}=Te({show:r.shouldMount,element:()=>o()??null}),[c,a]=I(0),[f,u]=I(0);let y=r.isOpen()||i();return Qe(()=>{const v=requestAnimationFrame(()=>{y=!1});k(()=>{cancelAnimationFrame(v)})}),T(we(i,()=>{if(!o())return;o().style.transitionDuration="0s",o().style.animationName="none";const v=o().getBoundingClientRect();a(v.height),u(v.width),y||(o().style.transitionDuration="",o().style.animationName="")})),T(we(r.isOpen,v=>{!v&&o()&&(o().style.transitionDuration="",o().style.animationName="")},{defer:!0})),T(()=>k(r.registerContentId(n.id))),d(J,{get when(){return i()},get children(){return d(oe,S({as:"div",ref(v){var x=ne(l,n.ref);typeof x=="function"&&x(v)},get id(){return n.id},get style(){return me({"--kb-collapsible-content-height":c()?`${c()}px`:void 0,"--kb-collapsible-content-width":f()?`${f()}px`:void 0},n.style)}},()=>r.dataset(),s))}})}function ye(e){const o=`collapsible-${ae()}`,l=F({id:o},e),[r,t]=M(l,["open","defaultOpen","onOpenChange","disabled","forceMount"]),[n,s]=I(),i=Ie({open:()=>r.open,defaultOpen:()=>r.defaultOpen,onOpenChange:f=>{var u;return(u=r.onOpenChange)==null?void 0:u.call(r,f)}}),c=W(()=>({"data-expanded":i.isOpen()?"":void 0,"data-closed":i.isOpen()?void 0:"","data-disabled":r.disabled?"":void 0})),a={dataset:c,isOpen:i.isOpen,disabled:()=>r.disabled??!1,shouldMount:()=>r.forceMount||i.isOpen(),contentId:n,toggle:i.toggle,generateId:de(()=>t.id),registerContentId:le(s)};return d(Ke.Provider,{value:a,get children(){return d(oe,S({as:"div"},c,t))}})}function xe(e){const o=se(),[l,r]=M(e,["onClick"]);return d(it,S({get"aria-expanded"(){return o.isOpen()},get"aria-controls"(){return Pe(()=>!!o.isOpen())()?o.contentId():void 0},get disabled(){return o.disabled()},onClick:n=>{A(n,l.onClick),o.toggle()}},()=>o.dataset(),r))}var Bt=Object.assign(ye,{Content:ve,Trigger:xe}),G={};be(G,{Accordion:()=>Lt,Content:()=>Ne,Header:()=>Ue,Item:()=>je,Root:()=>We,Trigger:()=>qe,useAccordionContext:()=>Ce});var Be=ee();function Le(){const e=te(Be);if(e===void 0)throw new Error("[kobalte]: `useAccordionItemContext` must be used within a `Accordion.Item` component");return e}function Ne(e){const o=Le(),l=o.generateId("content"),r=F({id:l},e),[t,n]=M(r,["id","style"]);return T(()=>k(o.registerContentId(t.id))),d(ve,S({role:"region",get"aria-labelledby"(){return o.triggerId()},get style(){return me({"--kb-accordion-content-height":"var(--kb-collapsible-content-height)","--kb-accordion-content-width":"var(--kb-collapsible-content-width)"},t.style)}},n))}function Ue(e){const o=se();return d(oe,S({as:"h3"},()=>o.dataset(),e))}var He=ee();function Ce(){const e=te(He);if(e===void 0)throw new Error("[kobalte]: `useAccordionContext` must be used within a `Accordion.Root` component");return e}function je(e){const o=Ce(),l=`${o.generateId("item")}-${ae()}`,r=F({id:l},e),[t,n]=M(r,["value","disabled"]),[s,i]=I(),[c,a]=I(),f=()=>o.listState().selectionManager(),u=()=>f().isSelected(t.value),g={value:()=>t.value,triggerId:s,contentId:c,generateId:de(()=>n.id),registerTriggerId:le(i),registerContentId:le(a)};return d(Be.Provider,{value:g,get children(){return d(ye,S({get open(){return u()},get disabled(){return t.disabled}},n))}})}function We(e){let o;const l=`accordion-${ae()}`,r=F({id:l,multiple:!1,collapsible:!1,shouldFocusWrap:!0},e),[t,n]=M(r,["id","ref","value","defaultValue","onChange","multiple","collapsible","shouldFocusWrap","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]),[s,i]=I([]),{DomCollectionProvider:c}=Mt({items:s,onItemsChange:i}),a=rt({selectedKeys:()=>t.value,defaultSelectedKeys:()=>t.defaultValue,onSelectionChange:g=>{var y;return(y=t.onChange)==null?void 0:y.call(t,Array.from(g))},disallowEmptySelection:()=>!t.multiple&&!t.collapsible,selectionMode:()=>t.multiple?"multiple":"single",dataSource:s});a.selectionManager().setFocusedKey("item-1");const f=lt({selectionManager:()=>a.selectionManager(),collection:()=>a.collection(),disallowEmptySelection:()=>a.selectionManager().disallowEmptySelection(),shouldFocusWrap:()=>t.shouldFocusWrap,disallowTypeAhead:!0,allowsTabNavigation:!0},()=>o),u={listState:()=>a,generateId:de(()=>t.id)};return d(c,{get children(){return d(He.Provider,{value:u,get children(){return d(oe,S({as:"div",get id(){return t.id},ref(g){var y=ne(v=>o=v,t.ref);typeof y=="function"&&y(g)},get onKeyDown(){return R([t.onKeyDown,f.onKeyDown])},get onMouseDown(){return R([t.onMouseDown,f.onMouseDown])},get onFocusIn(){return R([t.onFocusIn])},get onFocusOut(){return R([t.onFocusOut,f.onFocusOut])}},n))}})}})}function qe(e){let o;const l=Ce(),r=Le(),t=se(),n=r.generateId("trigger"),s=F({id:n},e),[i,c]=M(s,["ref","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]);Et({getItem:()=>({ref:()=>o,type:"item",key:r.value(),textValue:"",disabled:t.disabled()})});const a=at({key:()=>r.value(),selectionManager:()=>l.listState().selectionManager(),disabled:()=>t.disabled(),shouldSelectOnPressUp:!0},()=>o),f=u=>{["Enter"," "].includes(u.key)&&u.preventDefault(),A(u,i.onKeyDown),A(u,a.onKeyDown)};return T(()=>k(r.registerTriggerId(c.id))),d(xe,S({ref(u){var g=ne(y=>o=y,i.ref);typeof g=="function"&&g(u)},get"data-key"(){return a.dataKey()},get onPointerDown(){return R([i.onPointerDown,a.onPointerDown])},get onPointerUp(){return R([i.onPointerUp,a.onPointerUp])},get onClick(){return R([i.onClick,a.onClick])},onKeyDown:f,get onMouseDown(){return R([i.onMouseDown,a.onMouseDown])},get onFocus(){return R([i.onFocus,a.onFocus])}},c))}var Lt=Object.assign(We,{Content:Ne,Header:Ue,Item:je,Trigger:qe}),Nt=_('<div><div class="flex flex-wrap items-center gap-2 text-xs text-primary"><div class="inline-flex items-center gap-1 rounded-full border border-base px-2 py-0.5 text-xs text-primary"><span class="uppercase text-[10px] tracking-wide text-muted"></span><span class="font-semibold text-primary"></span></div><div class="inline-flex items-center gap-1 rounded-full border border-base px-2 py-0.5 text-xs text-primary"><span class="uppercase text-[10px] tracking-wide text-muted"></span><span class="font-semibold text-primary"></span></div><div class="inline-flex items-center gap-1 rounded-full border border-base px-2 py-0.5 text-xs text-primary"><span class="uppercase text-[10px] tracking-wide text-muted"></span><span class="font-semibold text-primary">');const Ut=e=>{const{t:o}=ht(),l=W(()=>ct(e.instanceId,e.sessionId)??{cost:0,contextWindow:0,isSubscriptionModel:!1,inputTokens:0,outputTokens:0,reasoningTokens:0,actualUsageTokens:0,modelOutputLimit:0,contextAvailableTokens:null}),r=W(()=>l().inputTokens??0),t=W(()=>l().outputTokens??0),n=W(()=>{const i=l().isSubscriptionModel?0:l().cost;return i>0?i:0}),s=W(()=>`$${n().toFixed(2)}`);return(()=>{var i=Nt(),c=i.firstChild,a=c.firstChild,f=a.firstChild,u=f.nextSibling,g=a.nextSibling,y=g.firstChild,v=y.nextSibling,x=g.nextSibling,$=x.firstChild,m=$.nextSibling;return h(f,()=>o("contextUsagePanel.labels.input")),h(u,()=>Se(r())),h(y,()=>o("contextUsagePanel.labels.output")),h(v,()=>Se(t())),h($,()=>o("contextUsagePanel.labels.cost")),h(m,s),he(()=>Ye(i,`session-context-panel px-4 py-2 ${e.class??""}`)),i})()};var j=_('<div class="right-panel-empty right-panel-empty--left"><span class=text-xs>'),Ht=_('<div class="rounded-md border border-base bg-surface-secondary px-3 py-2"><div class="flex items-start justify-between gap-3"><div class=min-w-0><div class="text-sm font-medium text-primary"></div><p class="mt-1 text-xs text-secondary">'),jt=_('<div class="flex flex-col gap-3 min-h-0"><div class="flex items-center justify-between gap-2 text-[11px] text-secondary"><span></span><span class="flex items-center gap-2"><span style=color:var(--session-status-idle-fg)></span><span style=color:var(--session-status-working-fg)></span></span></div><div class="rounded-md border border-base bg-surface-secondary p-2 max-h-[40vh] overflow-y-auto"><div class="flex flex-col">'),Wt=_('<button type=button class="border-b border-base last:border-b-0 text-left hover:bg-surface-muted rounded-sm"><div class="flex items-center justify-between gap-3"><div class="text-xs font-mono text-primary min-w-0 flex-1 overflow-hidden whitespace-nowrap"style=text-overflow:ellipsis;direction:rtl;text-align:left;unicode-bidi:plaintext></div><div class="flex items-center gap-2 text-[11px] flex-shrink-0"><span style=color:var(--session-status-idle-fg)></span><span style=color:var(--session-status-working-fg)>'),qt=_('<div class="flex flex-col gap-2">'),zt=_("<span>"),Vt=_('<div class=status-process-card><div class=status-process-header><span class=status-process-title></span><div class=status-process-meta><span></span><span></span></div></div><div class=status-process-actions><button type=button class="button-tertiary w-full p-1 inline-flex items-center justify-center"></button><button type=button class="button-tertiary w-full p-1 inline-flex items-center justify-center"></button><button type=button class="button-tertiary w-full p-1 inline-flex items-center justify-center">'),Xt=_("<div class=status-tab-container>"),Yt=_("<span class=section-left><span class=section-label>");const on=e=>{const o=i=>e.expandedItems().includes(i),s=[{id:"yolo-mode",labelKey:"instanceShell.rightPanel.sections.yoloMode",tooltipKey:"instanceShell.rightPanel.sections.yoloMode.tooltip",render:()=>{const i=e.activeSession();return i?(()=>{var c=Ht(),a=c.firstChild,f=a.firstChild,u=f.firstChild,g=u.nextSibling;return h(u,()=>e.t("instanceShell.yoloMode.title")),h(g,()=>e.t("instanceShell.yoloMode.description")),h(a,d(ft,{get checked(){return gt(e.instanceId,i.id)},color:"warning",size:"small",get inputProps(){return{"aria-label":e.t("instanceShell.yoloMode.title")}},onChange:()=>ut(e.instanceId,i.id)}),null),c})():(()=>{var c=j(),a=c.firstChild;return h(a,()=>e.t("instanceShell.yoloMode.noSessionSelected")),c})()}},{id:"session-changes",labelKey:"instanceShell.rightPanel.sections.sessionChanges",tooltipKey:"instanceShell.rightPanel.sections.sessionChanges.tooltip",render:()=>{const i=e.activeSessionId();if(!i||i==="info")return(()=>{var u=j(),g=u.firstChild;return h(g,()=>e.t("instanceShell.sessionChanges.noSessionSelected")),u})();const c=e.activeSessionDiffs();if(c===void 0)return(()=>{var u=j(),g=u.firstChild;return h(g,()=>e.t("instanceShell.sessionChanges.loading")),u})();if(!Array.isArray(c)||c.length===0)return(()=>{var u=j(),g=u.firstChild;return h(g,()=>e.t("instanceShell.sessionChanges.empty")),u})();const a=[...c].sort((u,g)=>String(u.file||"").localeCompare(String(g.file||""))),f=a.reduce((u,g)=>(u.additions+=typeof g.additions=="number"?g.additions:0,u.deletions+=typeof g.deletions=="number"?g.deletions:0,u),{additions:0,deletions:0});return(()=>{var u=jt(),g=u.firstChild,y=g.firstChild,v=y.nextSibling,x=v.firstChild,$=x.nextSibling,m=g.nextSibling,w=m.firstChild;return h(y,()=>e.t("instanceShell.sessionChanges.filesChanged",{count:a.length})),h(x,()=>`+${f.additions}`),h($,()=>`-${f.deletions}`),h(w,d(ge,{each:a,children:C=>(()=>{var p=Wt(),q=p.firstChild,K=q.firstChild,z=K.nextSibling,B=z.firstChild,U=B.nextSibling;return p.$$click=()=>e.onOpenChangesTab(C.file),h(K,()=>C.file),h(B,()=>`+${C.additions}`),h(U,()=>`-${C.deletions}`),he(D=>{var L=e.t("instanceShell.sessionChanges.actions.show"),V=C.file;return L!==D.e&&O(p,"title",D.e=L),V!==D.t&&O(K,"title",D.t=V),D},{e:void 0,t:void 0}),p})()})),u})()}},{id:"plan",labelKey:"instanceShell.rightPanel.sections.plan",tooltipKey:"instanceShell.rightPanel.sections.plan.tooltip",render:()=>{const i=e.activeSessionId();if(!i||i==="info")return(()=>{var a=j(),f=a.firstChild;return h(f,()=>e.t("instanceShell.plan.noSessionSelected")),a})();const c=e.latestTodoState();return c?d(mt,{state:c,get emptyLabel(){return e.t("instanceShell.plan.empty")},showStatusLabel:!1}):(()=>{var a=j(),f=a.firstChild;return h(f,()=>e.t("instanceShell.plan.empty")),a})()}},{id:"background-processes",labelKey:"instanceShell.rightPanel.sections.backgroundProcesses",tooltipKey:"instanceShell.rightPanel.sections.backgroundProcesses.tooltip",render:()=>{const i=e.backgroundProcessList();return i.length===0?(()=>{var c=j(),a=c.firstChild;return h(a,()=>e.t("instanceShell.backgroundProcesses.empty")),c})():(()=>{var c=qt();return h(c,d(ge,{each:i,children:a=>(()=>{var f=Vt(),u=f.firstChild,g=u.firstChild,y=g.nextSibling,v=y.firstChild,x=v.nextSibling,$=u.nextSibling,m=$.firstChild,w=m.nextSibling,C=w.nextSibling;return h(g,()=>a.title),h(v,d(vt,{class:"h-3.5 w-3.5"})),h(x,()=>e.t("instanceShell.backgroundProcesses.status",{status:a.status})),h(y,d(J,{get when(){return typeof a.outputSizeBytes=="number"},get children(){var p=zt();return h(p,()=>e.t("instanceShell.backgroundProcesses.output",{sizeKb:Math.round((a.outputSizeBytes??0)/1024)})),p}}),null),m.$$click=()=>e.onOpenBackgroundOutput(a),h(m,d(wt,{class:"h-4 w-4"})),w.$$click=()=>e.onStopBackgroundProcess(a.id),h(w,d(Pt,{class:"h-4 w-4"})),C.$$click=()=>e.onTerminateBackgroundProcess(a.id),h(C,d(pt,{class:"h-4 w-4"})),he(p=>{var q=!!a.notifyEnabled,K=!a.notifyEnabled,z=e.t(a.notifyEnabled?"instanceShell.backgroundProcesses.notify.enabled":"instanceShell.backgroundProcesses.notify.disabled"),B=e.t(a.notifyEnabled?"instanceShell.backgroundProcesses.notify.enabled":"instanceShell.backgroundProcesses.notify.disabled"),U=e.t("instanceShell.backgroundProcesses.actions.output"),D=e.t("instanceShell.backgroundProcesses.actions.output"),L=a.status!=="running",V=e.t("instanceShell.backgroundProcesses.actions.stop"),ie=e.t("instanceShell.backgroundProcesses.actions.stop"),b=e.t("instanceShell.backgroundProcesses.actions.terminate"),P=e.t("instanceShell.backgroundProcesses.actions.terminate");return q!==p.e&&v.classList.toggle("text-success",p.e=q),K!==p.t&&v.classList.toggle("text-tertiary",p.t=K),z!==p.a&&O(v,"aria-label",p.a=z),B!==p.o&&O(v,"title",p.o=B),U!==p.i&&O(m,"aria-label",p.i=U),D!==p.n&&O(m,"title",p.n=D),L!==p.s&&(w.disabled=p.s=L),V!==p.h&&O(w,"aria-label",p.h=V),ie!==p.r&&O(w,"title",p.r=ie),b!==p.d&&O(C,"aria-label",p.d=b),P!==p.l&&O(C,"title",p.l=P),p},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0}),f})()})),c})()}},{id:"mcp",labelKey:"instanceShell.rightPanel.sections.mcp",tooltipKey:"instanceShell.rightPanel.sections.mcp.tooltip",render:()=>d(pe,{get initialInstance(){return e.instance},sections:["mcp"],showSectionHeadings:!1,class:"space-y-2"})},{id:"lsp",labelKey:"instanceShell.rightPanel.sections.lsp",tooltipKey:"instanceShell.rightPanel.sections.lsp.tooltip",render:()=>d(pe,{get initialInstance(){return e.instance},sections:["lsp"],showSectionHeadings:!1,class:"space-y-2"})},{id:"plugins",labelKey:"instanceShell.rightPanel.sections.plugins",tooltipKey:"instanceShell.rightPanel.sections.plugins.tooltip",render:()=>d(pe,{get initialInstance(){return e.instance},sections:["plugins"],showSectionHeadings:!1,class:"space-y-2"})}];return(()=>{var i=Xt();return h(i,d(J,{get when(){return e.activeSession()},children:c=>d(Ut,{get instanceId(){return e.instanceId},get sessionId(){return c().id},class:"status-tab-context-panel"})}),null),h(i,d(G.Root,{class:"right-panel-accordion",collapsible:!0,multiple:!0,get value(){return e.expandedItems()},get onChange(){return e.onExpandedItemsChange},get children(){return d(ge,{each:s,children:c=>d(G.Item,{get value(){return c.id},class:"right-panel-accordion-item",get children(){return[d(G.Header,{class:"right-panel-accordion-header-row",get children(){return[d(G.Trigger,{class:"right-panel-accordion-trigger",get children(){return[(()=>{var a=Yt(),f=a.firstChild;return h(f,()=>e.t(c.labelKey)),a})(),d(dt,{get class(){return`right-panel-accordion-chevron ${o(c.id)?"right-panel-accordion-chevron-expanded":""}`}})]}}),d(Z,{openDelay:200,gutter:4,placement:"top",get children(){return[d(Z.Trigger,{as:"button",type:"button",class:"section-info-trigger",get"aria-label"(){return e.t(c.tooltipKey)},get children(){return d(xt,{class:"section-info-icon"})}}),d(Z.Portal,{get children(){return d(Z.Content,{class:"section-info-tooltip",get children(){return e.t(c.tooltipKey)}})}})]}})]}}),d(G.Content,{class:"right-panel-accordion-content",get children(){return c.render()}})]}})})}}),null),i})()};Ge(["click"]);export{on as default};