skydive-cli 0.2.0-beta.742 → 0.3.0-beta.764

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 (34) hide show
  1. package/CHANGELOG.md +37 -3
  2. package/dist/js/bin.mjs +5 -5
  3. package/dist/js/{boot-DhorgAxS.mjs → boot-Bs-IF23f.mjs} +115 -16
  4. package/dist/js/chat/tui/chunks/grammars/assets/bash.highlights.scm +56 -0
  5. package/dist/js/chat/tui/chunks/grammars/assets/bash.wasm +0 -0
  6. package/dist/js/chat/tui/chunks/grammars/assets/c.highlights.scm +81 -0
  7. package/dist/js/chat/tui/chunks/grammars/assets/c.wasm +0 -0
  8. package/dist/js/chat/tui/chunks/grammars/assets/cpp.highlights.scm +70 -0
  9. package/dist/js/chat/tui/chunks/grammars/assets/cpp.wasm +0 -0
  10. package/dist/js/chat/tui/chunks/grammars/assets/css.highlights.scm +76 -0
  11. package/dist/js/chat/tui/chunks/grammars/assets/css.wasm +0 -0
  12. package/dist/js/chat/tui/chunks/grammars/assets/go.highlights.scm +123 -0
  13. package/dist/js/chat/tui/chunks/grammars/assets/go.wasm +0 -0
  14. package/dist/js/chat/tui/chunks/grammars/assets/html.highlights.scm +13 -0
  15. package/dist/js/chat/tui/chunks/grammars/assets/html.wasm +0 -0
  16. package/dist/js/chat/tui/chunks/grammars/assets/java.highlights.scm +149 -0
  17. package/dist/js/chat/tui/chunks/grammars/assets/java.wasm +0 -0
  18. package/dist/js/chat/tui/chunks/grammars/assets/json.highlights.scm +16 -0
  19. package/dist/js/chat/tui/chunks/grammars/assets/json.wasm +0 -0
  20. package/dist/js/chat/tui/chunks/grammars/assets/lua.highlights.scm +201 -0
  21. package/dist/js/chat/tui/chunks/grammars/assets/lua.wasm +0 -0
  22. package/dist/js/chat/tui/chunks/grammars/assets/python.highlights.scm +137 -0
  23. package/dist/js/chat/tui/chunks/grammars/assets/python.wasm +0 -0
  24. package/dist/js/chat/tui/chunks/grammars/assets/ruby.highlights.scm +154 -0
  25. package/dist/js/chat/tui/chunks/grammars/assets/ruby.wasm +0 -0
  26. package/dist/js/chat/tui/chunks/grammars/assets/rust.highlights.scm +161 -0
  27. package/dist/js/chat/tui/chunks/grammars/assets/rust.wasm +0 -0
  28. package/dist/js/chat/tui/chunks/grammars/assets/toml.highlights.scm +53 -0
  29. package/dist/js/chat/tui/chunks/grammars/assets/toml.wasm +0 -0
  30. package/dist/js/chat/tui/chunks/grammars/assets/yaml.highlights.scm +79 -0
  31. package/dist/js/chat/tui/chunks/grammars/assets/yaml.wasm +0 -0
  32. package/dist/js/chat/tui/chunks/grammars/grammars.ts +146 -0
  33. package/dist/js/{install-Cv3sBZxr.mjs → install-DEZmJLGH.mjs} +1 -1
  34. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,11 +7,45 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.0] - 2026-08-04
11
+
10
12
  ### Added
11
13
 
12
- - Chat TUI sets the terminal title (OSC) to the live conversation title, so a terminal multiplexer (cmux, tmux, zellij) or window names its tab after the conversation. Follows renames from autoname, web, and Slack, and resets to a neutral default on exit.
13
- - Every TUI screen (pickers included), not just chat, now drives the title, and inside cmux the workspace (sidebar entry) is renamed too via the cmux control socket. A workspace title you set by hand is left untouched. The tab and workspace title read title-first (title then agent name), while the in-app status bar stays agent-first.
14
- - Notification and sidebar previews use the last text block of the reply (the answer, not the opening preamble) and render as plain text, stripping inline markdown so markers like asterisks and backticks no longer leak into the preview.
14
+ **Chat TUI**
15
+
16
+ - `/fork` slash command to fork a conversation at any point and continue in a new thread.
17
+ - `/conversation` switches threads from inside a live session.
18
+ - `/compact` triggers manual conversation compaction.
19
+ - `/portal` and `/copy` slash commands.
20
+ - Archive the current conversation from the chat TUI.
21
+ - `--new` flag on `skydive chat` to start a fresh conversation.
22
+ - Debounced server-side conversation search in the picker, with title matches ranked first.
23
+ - File review pane orientation toggle, and review comments in the file pane.
24
+ - Pinned plan card controls and a jump-to-latest hint.
25
+ - Terminal title (OSC) follows the live conversation title on every screen; inside cmux the workspace is renamed too, and linked PRs are pushed to the cmux sidebar.
26
+ - Every participating agent shows in the conversation list; connect cards each have their own identity, and ctrl+r asks which connect card to act on.
27
+ - Colored Skydive splash art in `skydive --help` and the TUI pickers.
28
+ - New-agent name prefilled from the server's suggestion.
29
+
30
+ **CLI & platform**
31
+
32
+ - `skydive update` self-updater, with an update notice when a new version is available.
33
+ - Shell completions for bash, zsh, and fish via `completion install`.
34
+ - Portal daemon: one connection per host with per-conversation working directories.
35
+ - Agent-led coding-agent import (`skydive import`).
36
+ - Per-workspace scoping on the REST client, and cross-org `--agent <uuid>` auto-switches workspace.
37
+ - `skydive-beta` wrapper for the canary channel.
38
+
39
+ ### Fixed
40
+
41
+ - `skydive update` no longer claims an update is available on every npm install.
42
+ - Chat memory is bounded (payload clamps + windowed rows) with a memory watchdog and OOM diagnostic report; transcript rows are memoized so streaming stops re-rendering the whole chat.
43
+ - Chat-send failures map to real error messages.
44
+ - Notification and sidebar previews use the last text block of the reply and strip inline markdown.
45
+ - Picker rows no longer overlap when a conversation title contains a newline, tab, or control character.
46
+ - Sending to non-web channel conversations is blocked in the TUI.
47
+ - GitHub bot connect opens on the web front door, not api.skydive.com.
48
+ - TUI activity counter times from the run, not the screen.
15
49
 
16
50
  ## [0.2.0] - 2026-07-29
17
51
 
package/dist/js/bin.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { C as setActiveWorkspace, S as listWorkspaces, T as version, _ as themes, b as getActiveWorkspaceId, o as brandHelpArt, t as installCrashHandler, w as name, x as getSessionIdentity, y as ensureActiveOrganization } from "./install-Cv3sBZxr.mjs";
2
+ import { C as setActiveWorkspace, S as listWorkspaces, T as version, _ as themes, b as getActiveWorkspaceId, o as brandHelpArt, t as installCrashHandler, w as name, x as getSessionIdentity, y as ensureActiveOrganization } from "./install-DEZmJLGH.mjs";
3
3
  import { A as resolveAppUrl, C as getPromptHistoryPath, D as getStoredApiKeyId, E as getShareMachineDefault, F as saveConfig, I as saveSession, M as resolveManagementAuth, N as resolveSession, O as getStoredApiKeyWorkspaceName, R as setLastSeenVersion, S as getLastSeenVersion, _ as API_KEY_PREFIX, b as deleteConfig, g as API_KEY_FAMILY_PREFIX, h as API_KEYS_URL, i as resolveAgent, j as resolveConfig, k as getUpdateCheckDisabled, v as DEFAULT_API_URL, x as getConfigPath } from "./print-Cd-bVSEJ.mjs";
4
4
  import { n as printError, r as printTable, t as output } from "./output-DYzzdXYV.mjs";
5
5
  import { n as createRestClient, t as HttpError } from "./rest-BlN_uWmL.mjs";
@@ -1500,7 +1500,7 @@ const importCommand = {
1500
1500
  process.exit(1);
1501
1501
  }
1502
1502
  }
1503
- const { runChat } = await import("./boot-DhorgAxS.mjs");
1503
+ const { runChat } = await import("./boot-Bs-IF23f.mjs");
1504
1504
  await runChat({
1505
1505
  appUrl,
1506
1506
  sessionToken: session.value.sessionToken,
@@ -1912,7 +1912,7 @@ const chatCommand = {
1912
1912
  sessionToken: session.value.sessionToken,
1913
1913
  agentSelector: argv.agent ?? null
1914
1914
  });
1915
- const { runChat } = await import("./boot-DhorgAxS.mjs");
1915
+ const { runChat } = await import("./boot-Bs-IF23f.mjs");
1916
1916
  await runChat({
1917
1917
  appUrl,
1918
1918
  sessionToken: session.value.sessionToken,
@@ -2254,7 +2254,7 @@ const switchCommand = {
2254
2254
  printError("The workspace picker needs the Bun runtime and it could not be set up automatically. Pass a workspace slug instead, or install Bun and retry.");
2255
2255
  process.exit(1);
2256
2256
  }
2257
- const { runWorkspacePicker } = await import("./boot-DhorgAxS.mjs");
2257
+ const { runWorkspacePicker } = await import("./boot-Bs-IF23f.mjs");
2258
2258
  await runWorkspacePicker(session);
2259
2259
  return;
2260
2260
  }
@@ -3586,7 +3586,7 @@ function setupUpdateCheck(argv) {
3586
3586
 
3587
3587
  //#endregion
3588
3588
  //#region src/changelog.generated.ts
3589
- const CHANGELOG_MD = "# Changelog\n\nAll notable changes to the Skydive CLI are documented here.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## [Unreleased]\n\n### Added\n\n- Chat TUI sets the terminal title (OSC) to the live conversation title, so a terminal multiplexer (cmux, tmux, zellij) or window names its tab after the conversation. Follows renames from autoname, web, and Slack, and resets to a neutral default on exit.\n- Every TUI screen (pickers included), not just chat, now drives the title, and inside cmux the workspace (sidebar entry) is renamed too via the cmux control socket. A workspace title you set by hand is left untouched. The tab and workspace title read title-first (title then agent name), while the in-app status bar stays agent-first.\n- Notification and sidebar previews use the last text block of the reply (the answer, not the opening preamble) and render as plain text, stripping inline markdown so markers like asterisks and backticks no longer leak into the preview.\n\n## [0.2.0] - 2026-07-29\n\n### Added\n\n**Sandbox & machine access**\n\n- Standalone `skydive sandbox` command for direct access to an agent's sandbox.\n- `/sandbox` in the chat TUI — live PTY session and one-shot command execution.\n- Headless machine sharing via `skydive portal`, with self-registering portal grants.\n- `shareMachineDefault` config key for always-on portal sharing.\n\n**Chat TUI**\n\n- File pane (`ctrl+g`) with Changes and Files tabs: a shared file tree plus source viewer and a workspace browser, mouse-resizable and responsive to terminal size.\n- Agent todo list rendered in the chat TUI, above the composer, mirroring the web chat's todo card.\n- Fuzzy finder in the conversation and agent pickers.\n- Slash-command autocomplete menu.\n- Paste or drag-and-drop any file into the composer; paste clipboard images with Cmd+V.\n- Run local shell commands with `!` in the composer.\n- Conversation recaps, streamed live title updates, and per-agent attribution on assistant turns.\n- Working timer rolls up into minutes and hours.\n- Conversation picker paginates past 50 conversations and shows only your own conversations.\n- Esc leaves a live run; typing `exit` quits the chat.\n- Cursor Dark theme.\n- Picker rows no longer overlap when a conversation title contains a newline, tab, or control character.\n\n**Headless & scripting**\n\n- Resume a conversation by id.\n- `conversations list` and `conversations show` for transcript reads.\n- `messages get`, with run recovery keyed on message id.\n- Connect cards surface in headless `-p` mode so a driving agent never gets stuck.\n\n**Authentication**\n\n- `skydive auth login` via the browser now auto-mints an API key, so one login yields both a chat session and a usable management credential. Management commands announce the key's pinned workspace when it drives them, so a workspace mismatch is visible at use time.\n- Workspace picker on the device authorization page.\n- Account and workspace identity shown in `auth status`.\n\n**Platform**\n\n- Standalone binary builds compiling the CLI into a per-target executable.\n- Interactive workspace switcher; management commands follow the active workspace.\n- Terminal host integrations and agent notifications.\n\n### Fixed\n\n- Transcript errors collapse to one line, click to expand (REST and portal errors keep their full body).\n- Dragged/pasted image file paths attach the file instead of inserting path text, including macOS paths with literal parentheses.\n- Bare URLs in chat markdown are hyperlinked so they survive text wrap.\n- Composer draft is preserved across TUI overlays.\n- Relative connect links resolve before opening the browser.\n- Numbered markdown headings render colored in the TUI.\n- Chat transcript pages by 75% of a screen; picker rows stay on one line.\n- Run starts push to the TUI over the conversation stream.\n- Security: remediated high-severity dependency findings and cleared tar/shell-quote CVEs.\n\n## [0.1.0] - 2026-07-21\n\nInitial public release: `skydive chat` TUI, agent and conversation management,\ndevice authorization, and headless `-p` mode.\n";
3589
+ const CHANGELOG_MD = "# Changelog\n\nAll notable changes to the Skydive CLI are documented here.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## [Unreleased]\n\n## [0.3.0] - 2026-08-04\n\n### Added\n\n**Chat TUI**\n\n- `/fork` slash command to fork a conversation at any point and continue in a new thread.\n- `/conversation` switches threads from inside a live session.\n- `/compact` triggers manual conversation compaction.\n- `/portal` and `/copy` slash commands.\n- Archive the current conversation from the chat TUI.\n- `--new` flag on `skydive chat` to start a fresh conversation.\n- Debounced server-side conversation search in the picker, with title matches ranked first.\n- File review pane orientation toggle, and review comments in the file pane.\n- Pinned plan card controls and a jump-to-latest hint.\n- Terminal title (OSC) follows the live conversation title on every screen; inside cmux the workspace is renamed too, and linked PRs are pushed to the cmux sidebar.\n- Every participating agent shows in the conversation list; connect cards each have their own identity, and ctrl+r asks which connect card to act on.\n- Colored Skydive splash art in `skydive --help` and the TUI pickers.\n- New-agent name prefilled from the server's suggestion.\n\n**CLI & platform**\n\n- `skydive update` self-updater, with an update notice when a new version is available.\n- Shell completions for bash, zsh, and fish via `completion install`.\n- Portal daemon: one connection per host with per-conversation working directories.\n- Agent-led coding-agent import (`skydive import`).\n- Per-workspace scoping on the REST client, and cross-org `--agent <uuid>` auto-switches workspace.\n- `skydive-beta` wrapper for the canary channel.\n\n### Fixed\n\n- `skydive update` no longer claims an update is available on every npm install.\n- Chat memory is bounded (payload clamps + windowed rows) with a memory watchdog and OOM diagnostic report; transcript rows are memoized so streaming stops re-rendering the whole chat.\n- Chat-send failures map to real error messages.\n- Notification and sidebar previews use the last text block of the reply and strip inline markdown.\n- Picker rows no longer overlap when a conversation title contains a newline, tab, or control character.\n- Sending to non-web channel conversations is blocked in the TUI.\n- GitHub bot connect opens on the web front door, not api.skydive.com.\n- TUI activity counter times from the run, not the screen.\n\n## [0.2.0] - 2026-07-29\n\n### Added\n\n**Sandbox & machine access**\n\n- Standalone `skydive sandbox` command for direct access to an agent's sandbox.\n- `/sandbox` in the chat TUI — live PTY session and one-shot command execution.\n- Headless machine sharing via `skydive portal`, with self-registering portal grants.\n- `shareMachineDefault` config key for always-on portal sharing.\n\n**Chat TUI**\n\n- File pane (`ctrl+g`) with Changes and Files tabs: a shared file tree plus source viewer and a workspace browser, mouse-resizable and responsive to terminal size.\n- Agent todo list rendered in the chat TUI, above the composer, mirroring the web chat's todo card.\n- Fuzzy finder in the conversation and agent pickers.\n- Slash-command autocomplete menu.\n- Paste or drag-and-drop any file into the composer; paste clipboard images with Cmd+V.\n- Run local shell commands with `!` in the composer.\n- Conversation recaps, streamed live title updates, and per-agent attribution on assistant turns.\n- Working timer rolls up into minutes and hours.\n- Conversation picker paginates past 50 conversations and shows only your own conversations.\n- Esc leaves a live run; typing `exit` quits the chat.\n- Cursor Dark theme.\n- Picker rows no longer overlap when a conversation title contains a newline, tab, or control character.\n\n**Headless & scripting**\n\n- Resume a conversation by id.\n- `conversations list` and `conversations show` for transcript reads.\n- `messages get`, with run recovery keyed on message id.\n- Connect cards surface in headless `-p` mode so a driving agent never gets stuck.\n\n**Authentication**\n\n- `skydive auth login` via the browser now auto-mints an API key, so one login yields both a chat session and a usable management credential. Management commands announce the key's pinned workspace when it drives them, so a workspace mismatch is visible at use time.\n- Workspace picker on the device authorization page.\n- Account and workspace identity shown in `auth status`.\n\n**Platform**\n\n- Standalone binary builds compiling the CLI into a per-target executable.\n- Interactive workspace switcher; management commands follow the active workspace.\n- Terminal host integrations and agent notifications.\n\n### Fixed\n\n- Transcript errors collapse to one line, click to expand (REST and portal errors keep their full body).\n- Dragged/pasted image file paths attach the file instead of inserting path text, including macOS paths with literal parentheses.\n- Bare URLs in chat markdown are hyperlinked so they survive text wrap.\n- Composer draft is preserved across TUI overlays.\n- Relative connect links resolve before opening the browser.\n- Numbered markdown headings render colored in the TUI.\n- Chat transcript pages by 75% of a screen; picker rows stay on one line.\n- Run starts push to the TUI over the conversation stream.\n- Security: remediated high-severity dependency findings and cleared tar/shell-quote CVEs.\n\n## [0.1.0] - 2026-07-21\n\nInitial public release: `skydive chat` TUI, agent and conversation management,\ndevice authorization, and headless `-p` mode.\n";
3590
3590
 
3591
3591
  //#endregion
3592
3592
  //#region src/whats-new.ts
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { C as setActiveWorkspace, S as listWorkspaces, a as WORDMARK, b as getActiveWorkspaceId, c as applyTheme, d as noColorRequested, f as theme, g as themeVersion, h as themeModeFromColorFgBg, i as MARK_CELLS, l as findTheme, m as themeMode, n as buildCrashReport, p as themeForMode, r as writeCrashReport, s as DEFAULT_THEME_ID, t as installCrashHandler, u as monoTheme, v as themesForMode } from "./install-Cv3sBZxr.mjs";
2
+ import { C as setActiveWorkspace, S as listWorkspaces, a as WORDMARK, b as getActiveWorkspaceId, c as applyTheme, d as noColorRequested, f as theme, g as themeVersion, h as themeModeFromColorFgBg, i as MARK_CELLS, l as findTheme, m as themeMode, n as buildCrashReport, p as themeForMode, r as writeCrashReport, s as DEFAULT_THEME_ID, t as installCrashHandler, u as monoTheme, v as themesForMode } from "./install-DEZmJLGH.mjs";
3
3
  import { L as saveTheme, P as resolveWebUrl, T as getSavedTheme, c as cardActionErrorMessage, d as reconcileMaskedInput, f as resolveConnectUrl, i as resolveAgent, l as parseExternalOauthConnectParams, m as specKeyFor, p as parseConnectCard, s as MASK_CHAR, u as parseOauthConnectParams, v as DEFAULT_API_URL, w as getReviewStateDir, x as getConfigPath, y as DEFAULT_APP_URL } from "./print-Cd-bVSEJ.mjs";
4
4
  import { a as errorMessage, i as sendErrorMessage, n as createRestClient, o as isRecord, r as errorDetail, t as HttpError } from "./rest-BlN_uWmL.mjs";
5
5
  import { t as PortalClient } from "./client-Dc7GZ3PG.mjs";
@@ -16,7 +16,7 @@ import { execFile, spawn } from "node:child_process";
16
16
  import { createHash, randomUUID } from "node:crypto";
17
17
  import { connect, createConnection } from "node:net";
18
18
  import { access, appendFile, mkdir, mkdtemp, readFile, readdir, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
19
- import { MarkdownRenderable, RenderableEvents, StyledText, SyntaxStyle, createCliRenderer, decodePasteBytes, detectLinks, fg, link } from "@opentui/core";
19
+ import { MarkdownRenderable, RenderableEvents, StyledText, SyntaxStyle, addDefaultParsers, createCliRenderer, decodePasteBytes, detectLinks, fg, link } from "@opentui/core";
20
20
  import { createRoot, extend, useKeyboard, usePaste, useRenderer, useTerminalDimensions } from "@opentui/react";
21
21
  import { createContext, memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
22
22
  import { create } from "zustand";
@@ -3056,8 +3056,13 @@ function syntaxStyleTable() {
3056
3056
  "keyword.function": { fg: theme.syntaxMagenta },
3057
3057
  "keyword.return": { fg: theme.syntaxMagenta },
3058
3058
  "keyword.operator": { fg: theme.syntaxMagenta },
3059
+ conditional: { fg: theme.syntaxMagenta },
3060
+ repeat: { fg: theme.syntaxMagenta },
3061
+ preproc: { fg: theme.syntaxMagenta },
3059
3062
  string: { fg: theme.syntaxGreen },
3060
3063
  "string.special": { fg: theme.syntaxTeal },
3064
+ escape: { fg: theme.syntaxTeal },
3065
+ "string.escape": { fg: theme.syntaxTeal },
3061
3066
  character: { fg: theme.syntaxGreen },
3062
3067
  comment: {
3063
3068
  fg: theme.dim,
@@ -3066,10 +3071,13 @@ function syntaxStyleTable() {
3066
3071
  function: { fg: theme.syntaxBlue },
3067
3072
  "function.method": { fg: theme.syntaxBlue },
3068
3073
  "function.builtin": { fg: theme.syntaxCyan },
3074
+ method: { fg: theme.syntaxBlue },
3069
3075
  variable: { fg: theme.fg },
3070
3076
  "variable.builtin": { fg: theme.syntaxRed },
3071
3077
  "variable.parameter": { fg: theme.syntaxYellow },
3072
3078
  "variable.member": { fg: theme.syntaxTeal },
3079
+ parameter: { fg: theme.syntaxYellow },
3080
+ field: { fg: theme.syntaxTeal },
3073
3081
  type: { fg: theme.syntaxCyan },
3074
3082
  "type.builtin": { fg: theme.syntaxCyan },
3075
3083
  constant: { fg: theme.syntaxOrange },
@@ -3084,6 +3092,7 @@ function syntaxStyleTable() {
3084
3092
  "punctuation.bracket": { fg: theme.muted },
3085
3093
  "punctuation.delimiter": { fg: theme.muted },
3086
3094
  "punctuation.special": { fg: theme.syntaxCyan },
3095
+ delimiter: { fg: theme.muted },
3087
3096
  constructor: { fg: theme.syntaxBlue },
3088
3097
  module: { fg: theme.syntaxBlue },
3089
3098
  label: { fg: theme.syntaxCyan },
@@ -3480,10 +3489,16 @@ function trimCommonIndent(hunks) {
3480
3489
  for (const hunk of hunks) hunk.lines = hunk.lines.map((line) => isContentLine(line) ? line[0] + line.slice(1 + min) : line);
3481
3490
  }
3482
3491
  /**
3483
- * OpenTUI 0.2.15 bundles tree-sitter parsers for javascript(+react),
3484
- * typescript(+react), markdown, and zig only anything else renders
3485
- * unhighlighted (but still red/green). Returning undefined skips the
3486
- * highlight pass entirely instead of asking for a parser that isn't there.
3492
+ * Maps a file extension to the tree-sitter filetype used to highlight it in
3493
+ * diffs and the file/review pane. OpenTUI bundles parsers for
3494
+ * javascript(+react), typescript(+react), markdown, and zig; the rest are
3495
+ * registered by ./grammars. An extension absent here returns
3496
+ * undefined, which skips the highlight pass (the diff still renders red/green)
3497
+ * rather than asking the client for a parser it doesn't have.
3498
+ *
3499
+ * Keep the filetype values in sync with the canonical `filetype`/`aliases`
3500
+ * registered in ./grammars/grammars.ts — an extension mapping to a filetype no
3501
+ * parser is registered for just renders plain.
3487
3502
  */
3488
3503
  const FILETYPE_BY_EXT = {
3489
3504
  ts: "typescript",
@@ -3496,7 +3511,34 @@ const FILETYPE_BY_EXT = {
3496
3511
  jsx: "javascriptreact",
3497
3512
  md: "markdown",
3498
3513
  markdown: "markdown",
3499
- zig: "zig"
3514
+ zig: "zig",
3515
+ py: "python",
3516
+ pyi: "python",
3517
+ pyw: "python",
3518
+ sh: "bash",
3519
+ bash: "bash",
3520
+ zsh: "bash",
3521
+ go: "go",
3522
+ rs: "rust",
3523
+ c: "c",
3524
+ h: "c",
3525
+ cpp: "cpp",
3526
+ cxx: "cpp",
3527
+ cc: "cpp",
3528
+ hpp: "cpp",
3529
+ hxx: "cpp",
3530
+ hh: "cpp",
3531
+ java: "java",
3532
+ rb: "ruby",
3533
+ css: "css",
3534
+ html: "html",
3535
+ htm: "html",
3536
+ json: "json",
3537
+ jsonc: "json",
3538
+ yaml: "yaml",
3539
+ yml: "yaml",
3540
+ toml: "toml",
3541
+ lua: "lua"
3500
3542
  };
3501
3543
  function filetypeForPath(filePath) {
3502
3544
  const base = filePath.split("/").pop() ?? filePath;
@@ -11899,6 +11941,24 @@ var LinkifiedMarkdownRenderable = class extends MarkdownRenderable {
11899
11941
  }
11900
11942
  };
11901
11943
 
11944
+ //#endregion
11945
+ //#region src/chat/tui/chunks/grammars/index.ts
11946
+ /**
11947
+ * Register the extra tree-sitter grammars (python, go, rust, bash, …) before
11948
+ * the renderer boots its tree-sitter client, so fenced code blocks and diffs
11949
+ * in those languages highlight instead of rendering as plain text.
11950
+ *
11951
+ * `addDefaultParsers` merges by filetype into the set the client registers on
11952
+ * init, so this must run BEFORE `createCliRenderer`. The grammar definitions
11953
+ * live in ./grammars.ts, which is externalized from the tsdown bundle (it
11954
+ * imports `.wasm`/`.scm` assets rolldown can't parse) — so we reach it through
11955
+ * a dynamic import that both Bun-runtime (npm) and the compiled binary resolve.
11956
+ */
11957
+ async function registerGrammars() {
11958
+ const { EXTRA_GRAMMARS } = await import("./chat/tui/chunks/grammars/grammars.js");
11959
+ addDefaultParsers(EXTRA_GRAMMARS);
11960
+ }
11961
+
11902
11962
  //#endregion
11903
11963
  //#region src/chat/memory-watchdog.ts
11904
11964
  const MB = 1024 * 1024;
@@ -12019,6 +12079,45 @@ function startMemoryWatchdog(opts = {}) {
12019
12079
  };
12020
12080
  }
12021
12081
 
12082
+ //#endregion
12083
+ //#region src/chat/theme-boot.ts
12084
+ /**
12085
+ * How long the first paint waits for the terminal to report its background
12086
+ * colour via OSC 10/11.
12087
+ *
12088
+ * OpenTUI's own default is 1000ms, and `createCliRenderer` has already switched
12089
+ * to the alternate screen by the time we wait — so on a terminal that never
12090
+ * answers the query (no OSC theme support, or a passthrough that eats it) the
12091
+ * user watched a blank cleared screen for a flat second on every launch, which
12092
+ * measured as 68% of cold start. Bound it by our budget rather than the
12093
+ * dependency's: 20ms is a typical real answer, so 100ms is generous.
12094
+ */
12095
+ const THEME_QUERY_GRACE_MS = 100;
12096
+ /**
12097
+ * Settle the theme for the first paint, and keep following the terminal after
12098
+ * it.
12099
+ *
12100
+ * Order is the whole point and is load-bearing:
12101
+ *
12102
+ * 1. Subscribe to `theme_mode` FIRST. It carries both a late OSC answer and
12103
+ * every later system light/dark flip, so with the subscription in place,
12104
+ * giving up on the query early can only cost a briefly-wrong first paint —
12105
+ * never a permanently wrong theme.
12106
+ * 2. Apply the synchronous `COLORFGBG` sniff (iTerm2 and friends set it) so
12107
+ * there is something correct to paint at t=0.
12108
+ * 3. Only then wait, briefly, for the real answer.
12109
+ *
12110
+ * Inverting 2 and 3 is the bug this replaced: `COLORFGBG` was consulted only
12111
+ * after the 1000ms timeout expired, i.e. we blocked the launch waiting for
12112
+ * information we already had.
12113
+ */
12114
+ async function settleBootThemeMode({ source, applyThemeMode, graceMs = THEME_QUERY_GRACE_MS, env }) {
12115
+ source.on("theme_mode", applyThemeMode);
12116
+ applyThemeMode(themeModeFromColorFgBg(env) ?? "dark");
12117
+ const answered = await source.waitForThemeMode(graceMs);
12118
+ if (answered) applyThemeMode(answered);
12119
+ }
12120
+
12022
12121
  //#endregion
12023
12122
  //#region src/chat/boot.tsx
12024
12123
  /**
@@ -12028,6 +12127,7 @@ function startMemoryWatchdog(opts = {}) {
12028
12127
  * dynamically imported and never loaded on the Node management path.
12029
12128
  */
12030
12129
  async function runChat({ appUrl, sessionToken, shareMachine, promptHistoryPath, theme: themeOverride, notifications, agentSelector, conversationId, newConversation, seedPrompt }) {
12130
+ await registerGrammars();
12031
12131
  const watchdog = startMemoryWatchdog();
12032
12132
  installCrashHandler({ memoryProvider: () => watchdog.snapshot() });
12033
12133
  const renderer = await createCliRenderer({ exitOnCtrlC: false });
@@ -12045,13 +12145,10 @@ async function runChat({ appUrl, sessionToken, shareMachine, promptHistoryPath,
12045
12145
  themeId: monoTheme.id
12046
12146
  });
12047
12147
  } else if (themeOverride && findTheme(themeOverride)) store.lockTheme(themeOverride);
12048
- else {
12049
- const detected = await renderer.waitForThemeMode() ?? themeModeFromColorFgBg() ?? "dark";
12050
- store.setThemeMode(detected);
12051
- renderer.on("theme_mode", (mode) => {
12052
- useStore.getState().setThemeMode(mode);
12053
- });
12054
- }
12148
+ else await settleBootThemeMode({
12149
+ source: renderer,
12150
+ applyThemeMode: (mode) => useStore.getState().setThemeMode(mode)
12151
+ });
12055
12152
  createRoot(renderer).render(/* @__PURE__ */ jsx(App, {
12056
12153
  appUrl,
12057
12154
  sessionToken,
@@ -12066,8 +12163,10 @@ async function runChat({ appUrl, sessionToken, shareMachine, promptHistoryPath,
12066
12163
  /** Open the same workspace picker used by the initial agent screen. */
12067
12164
  async function runWorkspacePicker({ appUrl, sessionToken }) {
12068
12165
  const renderer = await createCliRenderer({ exitOnCtrlC: false });
12069
- const detected = await renderer.waitForThemeMode() ?? themeModeFromColorFgBg() ?? "dark";
12070
- useStore.getState().setThemeMode(detected);
12166
+ await settleBootThemeMode({
12167
+ source: renderer,
12168
+ applyThemeMode: (mode) => useStore.getState().setThemeMode(mode)
12169
+ });
12071
12170
  const close = () => renderer.destroy();
12072
12171
  createRoot(renderer).render(/* @__PURE__ */ jsx("box", {
12073
12172
  style: {
@@ -0,0 +1,56 @@
1
+ [
2
+ (string)
3
+ (raw_string)
4
+ (heredoc_body)
5
+ (heredoc_start)
6
+ ] @string
7
+
8
+ (command_name) @function
9
+
10
+ (variable_name) @property
11
+
12
+ [
13
+ "case"
14
+ "do"
15
+ "done"
16
+ "elif"
17
+ "else"
18
+ "esac"
19
+ "export"
20
+ "fi"
21
+ "for"
22
+ "function"
23
+ "if"
24
+ "in"
25
+ "select"
26
+ "then"
27
+ "unset"
28
+ "until"
29
+ "while"
30
+ ] @keyword
31
+
32
+ (comment) @comment
33
+
34
+ (function_definition name: (word) @function)
35
+
36
+ (file_descriptor) @number
37
+
38
+ [
39
+ (command_substitution)
40
+ (process_substitution)
41
+ (expansion)
42
+ ]@embedded
43
+
44
+ [
45
+ "$"
46
+ "&&"
47
+ ">"
48
+ ">>"
49
+ "<"
50
+ "|"
51
+ ] @operator
52
+
53
+ (
54
+ (command (_) @constant)
55
+ (#match? @constant "^-")
56
+ )
@@ -0,0 +1,81 @@
1
+ (identifier) @variable
2
+
3
+ ((identifier) @constant
4
+ (#match? @constant "^[A-Z][A-Z\\d_]*$"))
5
+
6
+ "break" @keyword
7
+ "case" @keyword
8
+ "const" @keyword
9
+ "continue" @keyword
10
+ "default" @keyword
11
+ "do" @keyword
12
+ "else" @keyword
13
+ "enum" @keyword
14
+ "extern" @keyword
15
+ "for" @keyword
16
+ "if" @keyword
17
+ "inline" @keyword
18
+ "return" @keyword
19
+ "sizeof" @keyword
20
+ "static" @keyword
21
+ "struct" @keyword
22
+ "switch" @keyword
23
+ "typedef" @keyword
24
+ "union" @keyword
25
+ "volatile" @keyword
26
+ "while" @keyword
27
+
28
+ "#define" @keyword
29
+ "#elif" @keyword
30
+ "#else" @keyword
31
+ "#endif" @keyword
32
+ "#if" @keyword
33
+ "#ifdef" @keyword
34
+ "#ifndef" @keyword
35
+ "#include" @keyword
36
+ (preproc_directive) @keyword
37
+
38
+ "--" @operator
39
+ "-" @operator
40
+ "-=" @operator
41
+ "->" @operator
42
+ "=" @operator
43
+ "!=" @operator
44
+ "*" @operator
45
+ "&" @operator
46
+ "&&" @operator
47
+ "+" @operator
48
+ "++" @operator
49
+ "+=" @operator
50
+ "<" @operator
51
+ "==" @operator
52
+ ">" @operator
53
+ "||" @operator
54
+
55
+ "." @delimiter
56
+ ";" @delimiter
57
+
58
+ (string_literal) @string
59
+ (system_lib_string) @string
60
+
61
+ (null) @constant
62
+ (number_literal) @number
63
+ (char_literal) @number
64
+
65
+ (field_identifier) @property
66
+ (statement_identifier) @label
67
+ (type_identifier) @type
68
+ (primitive_type) @type
69
+ (sized_type_specifier) @type
70
+
71
+ (call_expression
72
+ function: (identifier) @function)
73
+ (call_expression
74
+ function: (field_expression
75
+ field: (field_identifier) @function))
76
+ (function_declarator
77
+ declarator: (identifier) @function)
78
+ (preproc_function_def
79
+ name: (identifier) @function.special)
80
+
81
+ (comment) @comment
@@ -0,0 +1,70 @@
1
+ ; Functions
2
+
3
+ (call_expression
4
+ function: (qualified_identifier
5
+ name: (identifier) @function))
6
+
7
+ (template_function
8
+ name: (identifier) @function)
9
+
10
+ (template_method
11
+ name: (field_identifier) @function)
12
+
13
+ (template_function
14
+ name: (identifier) @function)
15
+
16
+ (function_declarator
17
+ declarator: (qualified_identifier
18
+ name: (identifier) @function))
19
+
20
+ (function_declarator
21
+ declarator: (field_identifier) @function)
22
+
23
+ ; Types
24
+
25
+ ((namespace_identifier) @type
26
+ (#match? @type "^[A-Z]"))
27
+
28
+ (auto) @type
29
+
30
+ ; Constants
31
+
32
+ (this) @variable.builtin
33
+ (null "nullptr" @constant)
34
+
35
+ ; Keywords
36
+
37
+ [
38
+ "catch"
39
+ "class"
40
+ "co_await"
41
+ "co_return"
42
+ "co_yield"
43
+ "constexpr"
44
+ "constinit"
45
+ "consteval"
46
+ "delete"
47
+ "explicit"
48
+ "final"
49
+ "friend"
50
+ "mutable"
51
+ "namespace"
52
+ "noexcept"
53
+ "new"
54
+ "override"
55
+ "private"
56
+ "protected"
57
+ "public"
58
+ "template"
59
+ "throw"
60
+ "try"
61
+ "typename"
62
+ "using"
63
+ "concept"
64
+ "requires"
65
+ "virtual"
66
+ ] @keyword
67
+
68
+ ; Strings
69
+
70
+ (raw_string_literal) @string
@@ -0,0 +1,76 @@
1
+ (comment) @comment
2
+
3
+ (tag_name) @tag
4
+ (nesting_selector) @tag
5
+ (universal_selector) @tag
6
+
7
+ "~" @operator
8
+ ">" @operator
9
+ "+" @operator
10
+ "-" @operator
11
+ "*" @operator
12
+ "/" @operator
13
+ "=" @operator
14
+ "^=" @operator
15
+ "|=" @operator
16
+ "~=" @operator
17
+ "$=" @operator
18
+ "*=" @operator
19
+
20
+ "and" @operator
21
+ "or" @operator
22
+ "not" @operator
23
+ "only" @operator
24
+
25
+ (attribute_selector (plain_value) @string)
26
+
27
+ ((property_name) @variable
28
+ (#match? @variable "^--"))
29
+ ((plain_value) @variable
30
+ (#match? @variable "^--"))
31
+
32
+ (class_name) @property
33
+ (id_name) @property
34
+ (namespace_name) @property
35
+ (property_name) @property
36
+ (feature_name) @property
37
+
38
+ (pseudo_element_selector (tag_name) @attribute)
39
+ (pseudo_class_selector (class_name) @attribute)
40
+ (attribute_name) @attribute
41
+
42
+ (function_name) @function
43
+
44
+ "@media" @keyword
45
+ "@import" @keyword
46
+ "@charset" @keyword
47
+ "@namespace" @keyword
48
+ "@supports" @keyword
49
+ "@keyframes" @keyword
50
+ (at_keyword) @keyword
51
+ (to) @keyword
52
+ (from) @keyword
53
+ (important) @keyword
54
+
55
+ (string_value) @string
56
+ (color_value) @string.special
57
+
58
+ (integer_value) @number
59
+ (float_value) @number
60
+ (unit) @type
61
+
62
+ [
63
+ "#"
64
+ ","
65
+ "."
66
+ ":"
67
+ "::"
68
+ ";"
69
+ ] @punctuation.delimiter
70
+
71
+ [
72
+ "{"
73
+ ")"
74
+ "("
75
+ "}"
76
+ ] @punctuation.bracket