skydive-cli 0.5.0-beta.10 → 0.5.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -0
- package/dist/js/bin.mjs +8 -8
- package/dist/js/{boot-BuxaHgFi.mjs → boot-DNe3CikP.mjs} +450 -8
- package/dist/js/{daemon-Dk5LeS1S.mjs → daemon-BuAxg1_H.mjs} +1 -1
- package/dist/js/{daemon-CYYE2BTu.mjs → daemon-DLY2NmVU.mjs} +1 -1
- package/dist/js/{daemon-client-3A9afTFC.mjs → daemon-client-CG6KWbdI.mjs} +1 -1
- package/dist/js/daemon-client-DnhKkk1Y.mjs +7 -0
- package/dist/js/{profiler-Zs3BHURc.mjs → profiler-CZIaF_t9.mjs} +1 -1
- package/package.json +1 -1
- package/dist/js/daemon-client-Dh7G9RxC.mjs +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
+
- `/computer` (alias `/stats`) in the chat TUI — a snapshot of the agent's sandbox drawn as colored bar graphs: CPU load (scaled to core count), memory, swap (when present), and disk usage, plus uptime and process count. Bars turn amber past 75%% and red past 90%% so a glance tells you whether the box is under pressure. The card keeps itself current quietly (a slow background refresh, no flicker or "updating" chrome); only the most recent card refreshes, and it silently stops while you're scrolled up (no wasted polls on a card you're not looking at) and resumes at the bottom. Stats are read over the same relay `skydive sandbox` uses, so it's gated on EDIT access to the agent like the other sandbox commands.
|
|
12
13
|
- `skydive fs` — a namespace for working with the files on an agent's computer (its sandbox) from your own machine. Its first subcommand, `skydive fs edit <path>`, reads a remote file down over the same relay `skydive sandbox` uses, opens it in your local editor (`$VISUAL`/`$EDITOR`, override with `--editor`, defaults to `vi`), and writes your changes back atomically when you save and close — so you can edit a remote file as if it were local without opening the chat TUI. A path that doesn't exist yet is created on save; no changes means nothing is written. Access is gated on EDIT permission for the agent, exactly like `skydive sandbox`. (A first-class `fs` relay channel and `skydive fs mount` land in follow-ups.)
|
|
13
14
|
|
|
14
15
|
## [0.4.0] - 2026-08-07
|
package/dist/js/bin.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as ensureActiveOrganization, D as setActiveWorkspace, E as listWorkspaces, O as name, T as getSessionIdentity, a as installCrashHandler, k as version, t as maybeStartProfiling, u as brandHelpArt, w as getActiveWorkspaceId, x as themes } from "./profiler-
|
|
2
|
+
import { C as ensureActiveOrganization, D as setActiveWorkspace, E as listWorkspaces, O as name, T as getSessionIdentity, a as installCrashHandler, k as version, t as maybeStartProfiling, u as brandHelpArt, w as getActiveWorkspaceId, x as themes } from "./profiler-CZIaF_t9.mjs";
|
|
3
3
|
import { A as getStoredApiKeyId, B as saveConfig, C as getDefaultAgent, E as getPromptHistoryPath, F as resolveChatAuth, I as resolveConfig, L as resolveManagementAuth, M as getUpdateCheckDisabled, P as resolveAppUrl, R as resolveSession, S as getConfigPath, T as getPreference, U as setLastSeenVersion, V as saveSession, _ as API_KEY_PREFIX, b as PREFERENCES, g as API_KEY_FAMILY_PREFIX, h as API_KEYS_URL, i as resolveAgent, j as getStoredApiKeyWorkspaceName, k as getShareMachineDefault, v as DEFAULT_API_URL, w as getLastSeenVersion, x as deleteConfig } from "./print-ClPkgR9z.mjs";
|
|
4
4
|
import { n as printError, r as printTable, t as output } from "./output-DYzzdXYV.mjs";
|
|
5
5
|
import { t as HttpError } from "./http-error-DzyrsLAZ.mjs";
|
|
6
6
|
import { t as createRestClient } from "./rest-I3imNduB.mjs";
|
|
7
7
|
import "./billing-blocked-2wju4gC_.mjs";
|
|
8
8
|
import { r as resolveMachineIdentity } from "./client-DabRpc_T.mjs";
|
|
9
|
-
import { i as queryDaemonStatus, l as PORTAL_DAEMON_FLAG, n as ensureDaemonRunning, s as stopDaemon, u as daemonPaths } from "./daemon-
|
|
9
|
+
import { i as queryDaemonStatus, l as PORTAL_DAEMON_FLAG, n as ensureDaemonRunning, s as stopDaemon, u as daemonPaths } from "./daemon-DLY2NmVU.mjs";
|
|
10
10
|
import { i as grantPortalAccess, n as fetchPortalDevices, o as registerPortalDevice, r as findThisDevice, s as revokePortalAccess } from "./api-DG5W6iwx.mjs";
|
|
11
11
|
import { t as SandboxStream } from "./client-c4c5MmgN.mjs";
|
|
12
12
|
import { hideBin } from "yargs/helpers";
|
|
@@ -1517,7 +1517,7 @@ const importCommand = {
|
|
|
1517
1517
|
process.exit(1);
|
|
1518
1518
|
}
|
|
1519
1519
|
}
|
|
1520
|
-
const { runChat } = await import("./boot-
|
|
1520
|
+
const { runChat } = await import("./boot-DNe3CikP.mjs");
|
|
1521
1521
|
await runChat({
|
|
1522
1522
|
appUrl,
|
|
1523
1523
|
sessionToken: session.value.sessionToken,
|
|
@@ -1930,7 +1930,7 @@ const chatCommand = {
|
|
|
1930
1930
|
sessionToken: auth.value.token,
|
|
1931
1931
|
agentSelector: argv.agent ?? null
|
|
1932
1932
|
});
|
|
1933
|
-
const { runChat } = await import("./boot-
|
|
1933
|
+
const { runChat } = await import("./boot-DNe3CikP.mjs");
|
|
1934
1934
|
await runChat({
|
|
1935
1935
|
appUrl: auth.value.appUrl,
|
|
1936
1936
|
sessionToken: auth.value.token,
|
|
@@ -2290,7 +2290,7 @@ const switchCommand = {
|
|
|
2290
2290
|
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.");
|
|
2291
2291
|
process.exit(1);
|
|
2292
2292
|
}
|
|
2293
|
-
const { runWorkspacePicker } = await import("./boot-
|
|
2293
|
+
const { runWorkspacePicker } = await import("./boot-DNe3CikP.mjs");
|
|
2294
2294
|
await runWorkspacePicker(session);
|
|
2295
2295
|
return;
|
|
2296
2296
|
}
|
|
@@ -2369,7 +2369,7 @@ const openCommand = {
|
|
|
2369
2369
|
const agent = argv.agent ? resolveAgent((await fetchPortalDevices(session)).agents, argv.agent) : null;
|
|
2370
2370
|
const cwd = argv.cwd ? path.resolve(argv.cwd) : process.cwd();
|
|
2371
2371
|
const { machineName } = await resolveMachineIdentity();
|
|
2372
|
-
const { PortalDaemonClient } = await import("./daemon-client-
|
|
2372
|
+
const { PortalDaemonClient } = await import("./daemon-client-DnhKkk1Y.mjs");
|
|
2373
2373
|
let lastLine = "";
|
|
2374
2374
|
let signalConnected;
|
|
2375
2375
|
const connected = new Promise((resolve) => {
|
|
@@ -4072,7 +4072,7 @@ function setupUpdateCheck(argv) {
|
|
|
4072
4072
|
|
|
4073
4073
|
//#endregion
|
|
4074
4074
|
//#region src/changelog.generated.ts
|
|
4075
|
-
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- `skydive fs` — a namespace for working with the files on an agent's computer (its sandbox) from your own machine. Its first subcommand, `skydive fs edit <path>`, reads a remote file down over the same relay `skydive sandbox` uses, opens it in your local editor (`$VISUAL`/`$EDITOR`, override with `--editor`, defaults to `vi`), and writes your changes back atomically when you save and close — so you can edit a remote file as if it were local without opening the chat TUI. A path that doesn't exist yet is created on save; no changes means nothing is written. Access is gated on EDIT permission for the agent, exactly like `skydive sandbox`. (A first-class `fs` relay channel and `skydive fs mount` land in follow-ups.)\n\n## [0.4.0] - 2026-08-07\n\n### Added\n\n- `skydive chat` works with API key auth: an API key alone now opens the chat TUI (and headless `chat -p`) without a browser login, using the key's pinned workspace.\n- `skydive config` command to view and set the safe, hand-editable CLI preferences (`shareMachineDefault`, `updateCheck`) without opening `config.json`. `config`/`config list` shows each key, its effective value, and whether it comes from the file or the built-in default; `config get`/`set`/`unset` read and change one key; `config path` prints the config file location. It only ever touches those preference keys, never credentials or flow-managed state.\n- Billing-blocked sends and runs now surface the server-authored recovery\n guidance from the typed billing outcome. The chat TUI renders it as a\n warning-toned system-notice row — live when a send is refused or a run is\n stopped at the billing boundary, and again when reopening a conversation\n that holds a persisted billing notice — instead of a generic error.\n Headless `chat -p` and `messages get` print the guidance (state, recovery\n step, and manage-billing URL) on stderr, keep any partial output already\n streamed on stdout, and exit with code `5` (distinct from the generic `1`)\n so scripted callers can tell a billing pause from a failure.\n- Syntax highlighting for 14 more languages in the chat transcript and file/review panes (python, bash, go, rust, c, cpp, java, ruby, css, html, json, yaml, and more) — previously only JavaScript/TypeScript rendered colored.\n\n### Changed\n\n- `skydive agent list` lists the full agent roster by default instead of a truncated page.\n\n### Fixed\n\n- Long multi-line bash tool-call commands (e.g. heredocs) are clamped with a `+N more · click to expand` tail instead of dumping their whole body into the scrollback.\n- Tool error output is clipped the same way as ok output, so a failing command no longer floods the transcript.\n- The TUI toast overlay has an opaque background instead of letting the transcript bleed through.\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";
|
|
4075
|
+
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- `/computer` (alias `/stats`) in the chat TUI — a snapshot of the agent's sandbox drawn as colored bar graphs: CPU load (scaled to core count), memory, swap (when present), and disk usage, plus uptime and process count. Bars turn amber past 75%% and red past 90%% so a glance tells you whether the box is under pressure. The card keeps itself current quietly (a slow background refresh, no flicker or \"updating\" chrome); only the most recent card refreshes, and it silently stops while you're scrolled up (no wasted polls on a card you're not looking at) and resumes at the bottom. Stats are read over the same relay `skydive sandbox` uses, so it's gated on EDIT access to the agent like the other sandbox commands.\n- `skydive fs` — a namespace for working with the files on an agent's computer (its sandbox) from your own machine. Its first subcommand, `skydive fs edit <path>`, reads a remote file down over the same relay `skydive sandbox` uses, opens it in your local editor (`$VISUAL`/`$EDITOR`, override with `--editor`, defaults to `vi`), and writes your changes back atomically when you save and close — so you can edit a remote file as if it were local without opening the chat TUI. A path that doesn't exist yet is created on save; no changes means nothing is written. Access is gated on EDIT permission for the agent, exactly like `skydive sandbox`. (A first-class `fs` relay channel and `skydive fs mount` land in follow-ups.)\n\n## [0.4.0] - 2026-08-07\n\n### Added\n\n- `skydive chat` works with API key auth: an API key alone now opens the chat TUI (and headless `chat -p`) without a browser login, using the key's pinned workspace.\n- `skydive config` command to view and set the safe, hand-editable CLI preferences (`shareMachineDefault`, `updateCheck`) without opening `config.json`. `config`/`config list` shows each key, its effective value, and whether it comes from the file or the built-in default; `config get`/`set`/`unset` read and change one key; `config path` prints the config file location. It only ever touches those preference keys, never credentials or flow-managed state.\n- Billing-blocked sends and runs now surface the server-authored recovery\n guidance from the typed billing outcome. The chat TUI renders it as a\n warning-toned system-notice row — live when a send is refused or a run is\n stopped at the billing boundary, and again when reopening a conversation\n that holds a persisted billing notice — instead of a generic error.\n Headless `chat -p` and `messages get` print the guidance (state, recovery\n step, and manage-billing URL) on stderr, keep any partial output already\n streamed on stdout, and exit with code `5` (distinct from the generic `1`)\n so scripted callers can tell a billing pause from a failure.\n- Syntax highlighting for 14 more languages in the chat transcript and file/review panes (python, bash, go, rust, c, cpp, java, ruby, css, html, json, yaml, and more) — previously only JavaScript/TypeScript rendered colored.\n\n### Changed\n\n- `skydive agent list` lists the full agent roster by default instead of a truncated page.\n\n### Fixed\n\n- Long multi-line bash tool-call commands (e.g. heredocs) are clamped with a `+N more · click to expand` tail instead of dumping their whole body into the scrollback.\n- Tool error output is clipped the same way as ok output, so a failing command no longer floods the transcript.\n- The TUI toast overlay has an opaque background instead of letting the transcript bleed through.\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";
|
|
4076
4076
|
|
|
4077
4077
|
//#endregion
|
|
4078
4078
|
//#region src/whats-new.ts
|
|
@@ -4215,7 +4215,7 @@ if (process.argv.includes(UPDATE_WORKER_FLAG)) {
|
|
|
4215
4215
|
process.exit(0);
|
|
4216
4216
|
}
|
|
4217
4217
|
if (process.argv.includes(PORTAL_DAEMON_FLAG)) {
|
|
4218
|
-
const { runPortalDaemon } = await import("./daemon-
|
|
4218
|
+
const { runPortalDaemon } = await import("./daemon-BuAxg1_H.mjs");
|
|
4219
4219
|
runPortalDaemon(process.argv);
|
|
4220
4220
|
} else runCli();
|
|
4221
4221
|
function runCli() {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { D as setActiveWorkspace, E as listWorkspaces, S as themesForMode, _ as themeForMode, a as installCrashHandler, b as themeVersion, c as MARK_CELLS, d as DEFAULT_THEME_ID, f as applyTheme, g as theme, h as noColorRequested, i as writeArtifact, l as WORDMARK, m as monoTheme, n as profilingEnabled, o as buildCrashReport, p as findTheme, r as record, s as writeCrashReport, v as themeMode, w as getActiveWorkspaceId, y as themeModeFromColorFgBg } from "./profiler-
|
|
2
|
+
import { D as setActiveWorkspace, E as listWorkspaces, S as themesForMode, _ as themeForMode, a as installCrashHandler, b as themeVersion, c as MARK_CELLS, d as DEFAULT_THEME_ID, f as applyTheme, g as theme, h as noColorRequested, i as writeArtifact, l as WORDMARK, m as monoTheme, n as profilingEnabled, o as buildCrashReport, p as findTheme, r as record, s as writeCrashReport, v as themeMode, w as getActiveWorkspaceId, y as themeModeFromColorFgBg } from "./profiler-CZIaF_t9.mjs";
|
|
3
3
|
import { D as getReviewStateDir, H as saveTheme, N as recordDefaultAgent, O as getSavedTheme, S as getConfigPath, 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, y as DEFAULT_APP_URL, z as resolveWebUrl } from "./print-ClPkgR9z.mjs";
|
|
4
4
|
import { t as HttpError } from "./http-error-DzyrsLAZ.mjs";
|
|
5
5
|
import { a as isRecord, i as errorMessage, n as errorDetail, r as sendErrorMessage, t as createRestClient } from "./rest-I3imNduB.mjs";
|
|
6
6
|
import { i as billingBlockedOutcomeFromSendResponse } from "./billing-blocked-2wju4gC_.mjs";
|
|
7
7
|
import { t as PortalClient } from "./client-DabRpc_T.mjs";
|
|
8
|
-
import "./daemon-
|
|
8
|
+
import "./daemon-DLY2NmVU.mjs";
|
|
9
9
|
import "./api-DG5W6iwx.mjs";
|
|
10
10
|
import { t as SandboxStream } from "./client-c4c5MmgN.mjs";
|
|
11
|
-
import { t as PortalDaemonClient } from "./daemon-client-
|
|
11
|
+
import { t as PortalDaemonClient } from "./daemon-client-CG6KWbdI.mjs";
|
|
12
12
|
import { t as runRawPtyPassthrough } from "./raw-pty-DY4KelZW.mjs";
|
|
13
13
|
import * as os$1 from "node:os";
|
|
14
14
|
import { homedir, platform, release, tmpdir } from "node:os";
|
|
@@ -4235,7 +4235,10 @@ function parseMatches(output) {
|
|
|
4235
4235
|
//#region src/chat/tui/chat/conversation-context.tsx
|
|
4236
4236
|
const ConversationContext = createContext({
|
|
4237
4237
|
rest: null,
|
|
4238
|
-
conversationId: null
|
|
4238
|
+
conversationId: null,
|
|
4239
|
+
collectSandboxStats: null,
|
|
4240
|
+
latestComputerId: null,
|
|
4241
|
+
scrolledUp: false
|
|
4239
4242
|
});
|
|
4240
4243
|
function useConversationContext() {
|
|
4241
4244
|
return useContext(ConversationContext);
|
|
@@ -4555,6 +4558,329 @@ function ShellLocalItem({ item }) {
|
|
|
4555
4558
|
});
|
|
4556
4559
|
}
|
|
4557
4560
|
|
|
4561
|
+
//#endregion
|
|
4562
|
+
//#region src/chat/tui/chat/sandbox-stats.ts
|
|
4563
|
+
/**
|
|
4564
|
+
* `/computer`: a live snapshot of the agent's sandbox as a set of bar graphs.
|
|
4565
|
+
*
|
|
4566
|
+
* The CLI runs on the USER's machine, so it can't read the sandbox's `/proc`
|
|
4567
|
+
* directly — it runs one small, portable shell command over the sandbox-exec
|
|
4568
|
+
* stream (`SandboxStream`, mode `exec`) and parses the output here. Everything
|
|
4569
|
+
* in this module is pure so the parse + layout are unit-testable without a
|
|
4570
|
+
* sandbox or a renderer.
|
|
4571
|
+
*
|
|
4572
|
+
* The command reads `/proc` and `df` only (no tools that might be missing from
|
|
4573
|
+
* a minimal image), emitting a tagged, tab-separated block. The leading
|
|
4574
|
+
* `SKYDIVE_STATS_V1` sentinel lets the parser find the block even when a shell
|
|
4575
|
+
* rc file prints a banner first, and versions the wire shape.
|
|
4576
|
+
*/
|
|
4577
|
+
const SANDBOX_STATS_SENTINEL = "SKYDIVE_STATS_V1";
|
|
4578
|
+
/**
|
|
4579
|
+
* How often the live `/computer` card refreshes its snapshot, in ms.
|
|
4580
|
+
* Deliberately slow: the card is a background health readout, not a `top`, so
|
|
4581
|
+
* it refreshes quietly every 30s rather than flickering every second.
|
|
4582
|
+
*/
|
|
4583
|
+
const COMPUTER_POLL_INTERVAL_MS = 3e4;
|
|
4584
|
+
/**
|
|
4585
|
+
* Whether a `/computer` card should refresh right now. Pure so the gating is
|
|
4586
|
+
* unit-testable. A card refreshes only when it is the most recent `/computer`
|
|
4587
|
+
* in the transcript (`isLatest`), the session can reach the sandbox
|
|
4588
|
+
* (`canCollect`), and the transcript is at the bottom (`!scrolledUp`) — while
|
|
4589
|
+
* you're scrolled up reading something else it quietly stops (no wasted polls),
|
|
4590
|
+
* and resumes when you scroll back down. Older cards freeze regardless, so a
|
|
4591
|
+
* scrolled-up history of runs isn't a fleet of background pollers. The pause is
|
|
4592
|
+
* silent: nothing about it is rendered.
|
|
4593
|
+
*/
|
|
4594
|
+
function shouldPollComputer(opts) {
|
|
4595
|
+
return opts.isLatest && opts.canCollect && !opts.scrolledUp;
|
|
4596
|
+
}
|
|
4597
|
+
/**
|
|
4598
|
+
* The command run in the sandbox to collect the snapshot. `sh`-portable, reads
|
|
4599
|
+
* only `/proc` and `df`. Each metric is one `key<TAB>value` line so the parser
|
|
4600
|
+
* never has to positionally align anything.
|
|
4601
|
+
*/
|
|
4602
|
+
const SANDBOX_STATS_COMMAND = [
|
|
4603
|
+
`printf '${SANDBOX_STATS_SENTINEL}\\n'`,
|
|
4604
|
+
`printf 'nproc\\t%s\\n' "$(nproc 2>/dev/null || echo 1)"`,
|
|
4605
|
+
`printf 'loadavg\\t%s\\n' "$(cut -d' ' -f1-3 /proc/loadavg)"`,
|
|
4606
|
+
`printf 'uptime\\t%s\\n' "$(cut -d' ' -f1 /proc/uptime)"`,
|
|
4607
|
+
`awk '/^MemTotal:/{t=$2}/^MemAvailable:/{a=$2}END{printf "mem_total_kb\\t%d\\nmem_avail_kb\\t%d\\n",t,a}' /proc/meminfo`,
|
|
4608
|
+
`awk '/^SwapTotal:/{t=$2}/^SwapFree:/{f=$2}END{printf "swap_total_kb\\t%d\\nswap_free_kb\\t%d\\n",t,f}' /proc/meminfo`,
|
|
4609
|
+
`df -Pk / | awk 'NR==2{printf "disk_total_kb\\t%d\\ndisk_used_kb\\t%d\\n",$2,$3}'`,
|
|
4610
|
+
`printf 'procs\\t%s\\n' "$(ls -1 /proc 2>/dev/null | grep -c '^[0-9]\\+$')"`
|
|
4611
|
+
].join(" ; ");
|
|
4612
|
+
const KB = 1024;
|
|
4613
|
+
/**
|
|
4614
|
+
* Parse the collector's output into `SandboxStats`, or return null when the
|
|
4615
|
+
* block is absent or malformed (so the caller can show the raw output as an
|
|
4616
|
+
* error instead of a broken graph). Tolerant of extra lines before the
|
|
4617
|
+
* sentinel (shell banners) and of a missing swap section (swap totals default
|
|
4618
|
+
* to 0, which the renderer treats as "no swap").
|
|
4619
|
+
*/
|
|
4620
|
+
function parseSandboxStats(raw) {
|
|
4621
|
+
const start = raw.indexOf(SANDBOX_STATS_SENTINEL);
|
|
4622
|
+
if (start === -1) return null;
|
|
4623
|
+
const fields = /* @__PURE__ */ new Map();
|
|
4624
|
+
for (const line of raw.slice(start).split("\n")) {
|
|
4625
|
+
const tab = line.indexOf(" ");
|
|
4626
|
+
if (tab === -1) continue;
|
|
4627
|
+
fields.set(line.slice(0, tab).trim(), line.slice(tab + 1).trim());
|
|
4628
|
+
}
|
|
4629
|
+
const num = (key) => {
|
|
4630
|
+
const v = fields.get(key);
|
|
4631
|
+
if (v === void 0) return null;
|
|
4632
|
+
const n = Number(v);
|
|
4633
|
+
return Number.isFinite(n) ? n : null;
|
|
4634
|
+
};
|
|
4635
|
+
const load = (fields.get("loadavg") ?? "").split(/\s+/).map(Number).filter((n) => Number.isFinite(n));
|
|
4636
|
+
const nproc = num("nproc");
|
|
4637
|
+
const uptime = num("uptime");
|
|
4638
|
+
const memTotal = num("mem_total_kb");
|
|
4639
|
+
const memAvail = num("mem_avail_kb");
|
|
4640
|
+
const diskTotal = num("disk_total_kb");
|
|
4641
|
+
const diskUsed = num("disk_used_kb");
|
|
4642
|
+
const procs = num("procs");
|
|
4643
|
+
const [load1, load5, load15] = load;
|
|
4644
|
+
if (nproc === null || uptime === null || memTotal === null || memAvail === null || diskTotal === null || diskUsed === null || procs === null || load1 === void 0 || load5 === void 0 || load15 === void 0) return null;
|
|
4645
|
+
return {
|
|
4646
|
+
nproc: Math.max(1, Math.round(nproc)),
|
|
4647
|
+
loadavg: [
|
|
4648
|
+
load1,
|
|
4649
|
+
load5,
|
|
4650
|
+
load15
|
|
4651
|
+
],
|
|
4652
|
+
uptimeSeconds: uptime,
|
|
4653
|
+
memTotalBytes: memTotal * KB,
|
|
4654
|
+
memAvailBytes: memAvail * KB,
|
|
4655
|
+
swapTotalBytes: (num("swap_total_kb") ?? 0) * KB,
|
|
4656
|
+
swapFreeBytes: (num("swap_free_kb") ?? 0) * KB,
|
|
4657
|
+
diskTotalBytes: diskTotal * KB,
|
|
4658
|
+
diskUsedBytes: diskUsed * KB,
|
|
4659
|
+
procs: Math.round(procs)
|
|
4660
|
+
};
|
|
4661
|
+
}
|
|
4662
|
+
function severityFor(fraction) {
|
|
4663
|
+
if (fraction >= .9) return "crit";
|
|
4664
|
+
if (fraction >= .75) return "warn";
|
|
4665
|
+
return "ok";
|
|
4666
|
+
}
|
|
4667
|
+
const GiB = 1024 * 1024 * 1024;
|
|
4668
|
+
function gb(bytes) {
|
|
4669
|
+
return (bytes / GiB).toFixed(1);
|
|
4670
|
+
}
|
|
4671
|
+
/** `120050` seconds -> `1d 9h 20m`. Always at least `0m`. */
|
|
4672
|
+
function formatUptime(seconds) {
|
|
4673
|
+
const total = Math.max(0, Math.floor(seconds));
|
|
4674
|
+
const d = Math.floor(total / 86400);
|
|
4675
|
+
const h = Math.floor(total % 86400 / 3600);
|
|
4676
|
+
const m = Math.floor(total % 3600 / 60);
|
|
4677
|
+
const parts = [];
|
|
4678
|
+
if (d > 0) parts.push(`${d}d`);
|
|
4679
|
+
if (h > 0 || d > 0) parts.push(`${h}h`);
|
|
4680
|
+
parts.push(`${m}m`);
|
|
4681
|
+
return parts.join(" ");
|
|
4682
|
+
}
|
|
4683
|
+
/**
|
|
4684
|
+
* Reduce a snapshot to the ordered list of gauges the `/computer` card draws:
|
|
4685
|
+
* CPU load (normalized to core count), memory, swap (only when the box has
|
|
4686
|
+
* any), and disk. Load can exceed 1.0 (oversubscribed CPU) — the bar clamps
|
|
4687
|
+
* but the caption shows the true number so that's still legible.
|
|
4688
|
+
*/
|
|
4689
|
+
function toGauges(stats) {
|
|
4690
|
+
const gauges = [];
|
|
4691
|
+
const load1 = stats.loadavg[0];
|
|
4692
|
+
const loadFraction = load1 / stats.nproc;
|
|
4693
|
+
gauges.push({
|
|
4694
|
+
label: "cpu load",
|
|
4695
|
+
fraction: loadFraction,
|
|
4696
|
+
detail: `${load1.toFixed(2)} / ${stats.nproc} cores`,
|
|
4697
|
+
severity: severityFor(loadFraction)
|
|
4698
|
+
});
|
|
4699
|
+
const memUsed = Math.max(0, stats.memTotalBytes - stats.memAvailBytes);
|
|
4700
|
+
const memFraction = stats.memTotalBytes > 0 ? memUsed / stats.memTotalBytes : 0;
|
|
4701
|
+
gauges.push({
|
|
4702
|
+
label: "memory",
|
|
4703
|
+
fraction: memFraction,
|
|
4704
|
+
detail: `${gb(memUsed)} / ${gb(stats.memTotalBytes)} GB`,
|
|
4705
|
+
severity: severityFor(memFraction)
|
|
4706
|
+
});
|
|
4707
|
+
if (stats.swapTotalBytes > 0) {
|
|
4708
|
+
const swapUsed = Math.max(0, stats.swapTotalBytes - stats.swapFreeBytes);
|
|
4709
|
+
const swapFraction = swapUsed / stats.swapTotalBytes;
|
|
4710
|
+
gauges.push({
|
|
4711
|
+
label: "swap",
|
|
4712
|
+
fraction: swapFraction,
|
|
4713
|
+
detail: `${gb(swapUsed)} / ${gb(stats.swapTotalBytes)} GB`,
|
|
4714
|
+
severity: severityFor(swapFraction)
|
|
4715
|
+
});
|
|
4716
|
+
}
|
|
4717
|
+
const diskFraction = stats.diskTotalBytes > 0 ? stats.diskUsedBytes / stats.diskTotalBytes : 0;
|
|
4718
|
+
gauges.push({
|
|
4719
|
+
label: "disk",
|
|
4720
|
+
fraction: diskFraction,
|
|
4721
|
+
detail: `${gb(stats.diskUsedBytes)} / ${gb(stats.diskTotalBytes)} GB`,
|
|
4722
|
+
severity: severityFor(diskFraction)
|
|
4723
|
+
});
|
|
4724
|
+
return gauges;
|
|
4725
|
+
}
|
|
4726
|
+
/**
|
|
4727
|
+
* A single-line horizontal bar of `width` cells filled to `fraction`
|
|
4728
|
+
* (clamped 0..1), using block glyphs. The last partial cell uses one of the
|
|
4729
|
+
* eighth-block glyphs so a 37%% bar reads differently from a 40%% one even in a
|
|
4730
|
+
* narrow width. Pure string, so the renderer just colors it.
|
|
4731
|
+
*/
|
|
4732
|
+
function renderBar(fraction, width) {
|
|
4733
|
+
const cells = Math.max(1, width);
|
|
4734
|
+
const exact = Math.min(1, Math.max(0, fraction)) * cells;
|
|
4735
|
+
const full = Math.floor(exact);
|
|
4736
|
+
const remainder = exact - full;
|
|
4737
|
+
const eighths = [
|
|
4738
|
+
"",
|
|
4739
|
+
"▏",
|
|
4740
|
+
"▎",
|
|
4741
|
+
"▍",
|
|
4742
|
+
"▌",
|
|
4743
|
+
"▋",
|
|
4744
|
+
"▊",
|
|
4745
|
+
"▉"
|
|
4746
|
+
];
|
|
4747
|
+
const partialIndex = Math.round(remainder * 8);
|
|
4748
|
+
const partial = full < cells ? eighths[partialIndex] : "";
|
|
4749
|
+
const filled = "█".repeat(Math.min(full, cells)) + partial;
|
|
4750
|
+
return (filled + "░".repeat(Math.max(0, cells - filled.length))).slice(0, cells);
|
|
4751
|
+
}
|
|
4752
|
+
|
|
4753
|
+
//#endregion
|
|
4754
|
+
//#region src/chat/tui/chunks/computer.tsx
|
|
4755
|
+
/**
|
|
4756
|
+
* Renders the `/computer` card: a snapshot of the agent's sandbox as a stack of
|
|
4757
|
+
* colored bar graphs (cpu load, memory, swap, disk) plus a footer of scalar
|
|
4758
|
+
* facts (uptime, process count).
|
|
4759
|
+
*
|
|
4760
|
+
* The card keeps itself current in place rather than making the user re-run the
|
|
4761
|
+
* command — but quietly: it refreshes on a slow interval with no "updating"
|
|
4762
|
+
* chrome, so the numbers just stay fresh without any flicker. Only the most
|
|
4763
|
+
* recent `/computer` card refreshes (older ones freeze at their last snapshot),
|
|
4764
|
+
* and the latest one silently stops while the transcript is scrolled up (no
|
|
4765
|
+
* wasted polls on a card you're not looking at) and resumes at the bottom — the
|
|
4766
|
+
* pause is never rendered. The refresh uses the same sandbox-exec relay
|
|
4767
|
+
* `/sandbox` uses, injected via context; the parse/layout math lives in
|
|
4768
|
+
* `sandbox-stats.ts` and this component only draws.
|
|
4769
|
+
*/
|
|
4770
|
+
function ComputerItem({ item }) {
|
|
4771
|
+
const { collectSandboxStats, latestComputerId, scrolledUp } = useConversationContext();
|
|
4772
|
+
const live = shouldPollComputer({
|
|
4773
|
+
isLatest: latestComputerId === item.id,
|
|
4774
|
+
canCollect: collectSandboxStats !== null,
|
|
4775
|
+
scrolledUp
|
|
4776
|
+
});
|
|
4777
|
+
const [stats, setStats] = useState(item.stats);
|
|
4778
|
+
const [error, setError] = useState(item.error);
|
|
4779
|
+
const hasStats = useRef(item.stats !== null);
|
|
4780
|
+
useEffect(() => {
|
|
4781
|
+
if (!live || !collectSandboxStats) return;
|
|
4782
|
+
let cancelled = false;
|
|
4783
|
+
let timer = null;
|
|
4784
|
+
let inFlight = null;
|
|
4785
|
+
const tick = async () => {
|
|
4786
|
+
const collection = collectSandboxStats();
|
|
4787
|
+
inFlight = collection;
|
|
4788
|
+
const result = await collection.result;
|
|
4789
|
+
inFlight = null;
|
|
4790
|
+
if (cancelled) return;
|
|
4791
|
+
if (result.ok) {
|
|
4792
|
+
hasStats.current = true;
|
|
4793
|
+
setStats(result.stats);
|
|
4794
|
+
setError(null);
|
|
4795
|
+
} else if (!("aborted" in result)) {
|
|
4796
|
+
if (!hasStats.current) setError(result.error);
|
|
4797
|
+
}
|
|
4798
|
+
if (!cancelled) timer = setTimeout(tick, COMPUTER_POLL_INTERVAL_MS);
|
|
4799
|
+
};
|
|
4800
|
+
tick();
|
|
4801
|
+
return () => {
|
|
4802
|
+
cancelled = true;
|
|
4803
|
+
if (timer !== null) clearTimeout(timer);
|
|
4804
|
+
inFlight?.abort();
|
|
4805
|
+
};
|
|
4806
|
+
}, [live, collectSandboxStats]);
|
|
4807
|
+
if (stats === null && error === null) return /* @__PURE__ */ jsx(Shell, { children: /* @__PURE__ */ jsx("text", {
|
|
4808
|
+
fg: theme.dim,
|
|
4809
|
+
children: "reading sandbox stats…"
|
|
4810
|
+
}) });
|
|
4811
|
+
if (stats === null) return /* @__PURE__ */ jsx(Shell, { children: /* @__PURE__ */ jsxs("text", {
|
|
4812
|
+
fg: theme.error,
|
|
4813
|
+
children: ["couldn't read sandbox stats", error ? `: ${error}` : ""]
|
|
4814
|
+
}) });
|
|
4815
|
+
const gauges = toGauges(stats);
|
|
4816
|
+
const labelWidth = Math.max(...gauges.map((g) => g.label.length));
|
|
4817
|
+
const barWidth = 24;
|
|
4818
|
+
return /* @__PURE__ */ jsxs(Shell, { children: [gauges.map((g) => /* @__PURE__ */ jsx(GaugeRow, {
|
|
4819
|
+
gauge: g,
|
|
4820
|
+
labelWidth,
|
|
4821
|
+
barWidth
|
|
4822
|
+
}, g.label)), /* @__PURE__ */ jsxs("text", {
|
|
4823
|
+
fg: theme.dim,
|
|
4824
|
+
children: [
|
|
4825
|
+
`${"uptime".padEnd(labelWidth)} `,
|
|
4826
|
+
/* @__PURE__ */ jsx("span", {
|
|
4827
|
+
fg: theme.muted,
|
|
4828
|
+
children: formatUptime(stats.uptimeSeconds)
|
|
4829
|
+
}),
|
|
4830
|
+
/* @__PURE__ */ jsx("span", {
|
|
4831
|
+
fg: theme.dim,
|
|
4832
|
+
children: ` · ${stats.procs} processes`
|
|
4833
|
+
})
|
|
4834
|
+
]
|
|
4835
|
+
})] });
|
|
4836
|
+
}
|
|
4837
|
+
/** The card frame: a bold `computer` title over the graph rows. */
|
|
4838
|
+
function Shell({ children }) {
|
|
4839
|
+
return /* @__PURE__ */ jsxs("box", {
|
|
4840
|
+
style: { flexDirection: "column" },
|
|
4841
|
+
children: [/* @__PURE__ */ jsxs("text", {
|
|
4842
|
+
fg: theme.muted,
|
|
4843
|
+
children: [/* @__PURE__ */ jsx("b", { children: "computer" }), /* @__PURE__ */ jsx("span", {
|
|
4844
|
+
fg: theme.dim,
|
|
4845
|
+
children: " · agent sandbox"
|
|
4846
|
+
})]
|
|
4847
|
+
}), children]
|
|
4848
|
+
});
|
|
4849
|
+
}
|
|
4850
|
+
function severityColor(severity) {
|
|
4851
|
+
switch (severity) {
|
|
4852
|
+
case "ok": return theme.success;
|
|
4853
|
+
case "warn": return theme.warning;
|
|
4854
|
+
case "crit": return theme.error;
|
|
4855
|
+
default: {
|
|
4856
|
+
const exhaustive = severity;
|
|
4857
|
+
throw new Error(`unhandled severity: ${String(exhaustive)}`);
|
|
4858
|
+
}
|
|
4859
|
+
}
|
|
4860
|
+
}
|
|
4861
|
+
function GaugeRow({ gauge, labelWidth, barWidth }) {
|
|
4862
|
+
const color = severityColor(gauge.severity);
|
|
4863
|
+
const pct = `${Math.round(Math.min(1, Math.max(0, gauge.fraction)) * 100)}%`;
|
|
4864
|
+
return /* @__PURE__ */ jsxs("text", { children: [
|
|
4865
|
+
/* @__PURE__ */ jsx("span", {
|
|
4866
|
+
fg: theme.muted,
|
|
4867
|
+
children: `${gauge.label.padEnd(labelWidth)} `
|
|
4868
|
+
}),
|
|
4869
|
+
/* @__PURE__ */ jsx("span", {
|
|
4870
|
+
fg: color,
|
|
4871
|
+
children: renderBar(gauge.fraction, barWidth)
|
|
4872
|
+
}),
|
|
4873
|
+
/* @__PURE__ */ jsx("span", {
|
|
4874
|
+
fg: color,
|
|
4875
|
+
children: ` ${pct.padStart(4)}`
|
|
4876
|
+
}),
|
|
4877
|
+
/* @__PURE__ */ jsx("span", {
|
|
4878
|
+
fg: theme.dim,
|
|
4879
|
+
children: ` ${gauge.detail}`
|
|
4880
|
+
})
|
|
4881
|
+
] });
|
|
4882
|
+
}
|
|
4883
|
+
|
|
4558
4884
|
//#endregion
|
|
4559
4885
|
//#region src/chat/tui/chunks/index.tsx
|
|
4560
4886
|
/**
|
|
@@ -4653,6 +4979,10 @@ function RenderItem({ item }) {
|
|
|
4653
4979
|
})]
|
|
4654
4980
|
})
|
|
4655
4981
|
});
|
|
4982
|
+
case "computer": return /* @__PURE__ */ jsx(Row, {
|
|
4983
|
+
barColor: null,
|
|
4984
|
+
children: /* @__PURE__ */ jsx(ComputerItem, { item })
|
|
4985
|
+
});
|
|
4656
4986
|
case "recap": return /* @__PURE__ */ jsx(Row, {
|
|
4657
4987
|
barColor: null,
|
|
4658
4988
|
children: /* @__PURE__ */ jsxs("text", {
|
|
@@ -6035,6 +6365,65 @@ function formatShare(share) {
|
|
|
6035
6365
|
return share.grantedToAgent ? "shared (this agent can run commands here)" : "shared (this agent is not granted)";
|
|
6036
6366
|
}
|
|
6037
6367
|
|
|
6368
|
+
//#endregion
|
|
6369
|
+
//#region src/chat/sandbox/collect-stats.ts
|
|
6370
|
+
function collectSandboxStats(cfg) {
|
|
6371
|
+
const open = cfg.open ?? SandboxStream.open;
|
|
6372
|
+
const dec = new TextDecoder();
|
|
6373
|
+
let buffer = "";
|
|
6374
|
+
let settled = false;
|
|
6375
|
+
let stream = null;
|
|
6376
|
+
let resolveRef = null;
|
|
6377
|
+
return {
|
|
6378
|
+
result: new Promise((resolve) => {
|
|
6379
|
+
resolveRef = resolve;
|
|
6380
|
+
const settle = (r) => {
|
|
6381
|
+
if (settled) return;
|
|
6382
|
+
settled = true;
|
|
6383
|
+
resolve(r);
|
|
6384
|
+
};
|
|
6385
|
+
stream = open({
|
|
6386
|
+
mode: "exec",
|
|
6387
|
+
appUrl: cfg.appUrl,
|
|
6388
|
+
sessionToken: cfg.sessionToken,
|
|
6389
|
+
agentId: cfg.agentId,
|
|
6390
|
+
command: SANDBOX_STATS_COMMAND,
|
|
6391
|
+
onEvent: (e) => {
|
|
6392
|
+
if (e.type === "data") buffer += dec.decode(e.bytes);
|
|
6393
|
+
else if (e.type === "error") settle({
|
|
6394
|
+
ok: false,
|
|
6395
|
+
error: e.message
|
|
6396
|
+
});
|
|
6397
|
+
else if (e.type === "exit") {
|
|
6398
|
+
const stats = parseSandboxStats(buffer);
|
|
6399
|
+
if (stats) settle({
|
|
6400
|
+
ok: true,
|
|
6401
|
+
stats
|
|
6402
|
+
});
|
|
6403
|
+
else settle({
|
|
6404
|
+
ok: false,
|
|
6405
|
+
error: e.code === 0 ? "unexpected output from the sandbox" : `sandbox command exited ${e.code}`
|
|
6406
|
+
});
|
|
6407
|
+
} else if (e.type === "close") settle({
|
|
6408
|
+
ok: false,
|
|
6409
|
+
error: e.failure ?? "connection closed before the snapshot finished"
|
|
6410
|
+
});
|
|
6411
|
+
}
|
|
6412
|
+
});
|
|
6413
|
+
}),
|
|
6414
|
+
abort: () => {
|
|
6415
|
+
if (settled) return;
|
|
6416
|
+
settled = true;
|
|
6417
|
+
stream?.close();
|
|
6418
|
+
resolveRef?.({
|
|
6419
|
+
ok: false,
|
|
6420
|
+
aborted: true,
|
|
6421
|
+
error: "aborted"
|
|
6422
|
+
});
|
|
6423
|
+
}
|
|
6424
|
+
};
|
|
6425
|
+
}
|
|
6426
|
+
|
|
6038
6427
|
//#endregion
|
|
6039
6428
|
//#region src/chat/notification-preview.ts
|
|
6040
6429
|
const MAX_NOTIFICATION_PREVIEW_CHARS = 240;
|
|
@@ -6891,6 +7280,13 @@ const slashCommands = [
|
|
|
6891
7280
|
description: "show connection and session status",
|
|
6892
7281
|
action: { kind: "status" }
|
|
6893
7282
|
},
|
|
7283
|
+
{
|
|
7284
|
+
name: "computer",
|
|
7285
|
+
aliases: ["stats"],
|
|
7286
|
+
argsHint: null,
|
|
7287
|
+
description: "show the agent sandbox's cpu, memory, and disk",
|
|
7288
|
+
action: { kind: "computer" }
|
|
7289
|
+
},
|
|
6894
7290
|
{
|
|
6895
7291
|
name: "plan",
|
|
6896
7292
|
aliases: ["todos", "todo"],
|
|
@@ -10085,6 +10481,7 @@ function routeInput(raw) {
|
|
|
10085
10481
|
case "model-picker":
|
|
10086
10482
|
case "theme-picker":
|
|
10087
10483
|
case "status":
|
|
10484
|
+
case "computer":
|
|
10088
10485
|
case "share":
|
|
10089
10486
|
case "browser":
|
|
10090
10487
|
case "connect":
|
|
@@ -10390,13 +10787,16 @@ function ChatScreen({ agent, conversation }) {
|
|
|
10390
10787
|
});
|
|
10391
10788
|
setScrolledUp(false);
|
|
10392
10789
|
}, []);
|
|
10790
|
+
const scrolledUpRef = useRef(false);
|
|
10393
10791
|
useEffect(() => {
|
|
10394
10792
|
const id = setInterval(() => {
|
|
10395
10793
|
const box = scrollRef.current;
|
|
10396
10794
|
if (!box) return;
|
|
10397
10795
|
const viewport = box.viewport.height;
|
|
10398
|
-
const
|
|
10399
|
-
|
|
10796
|
+
const next = !(box.scrollTop + viewport >= box.scrollHeight - 1);
|
|
10797
|
+
if (scrolledUpRef.current === next) return;
|
|
10798
|
+
scrolledUpRef.current = next;
|
|
10799
|
+
setScrolledUp(next);
|
|
10400
10800
|
}, 150);
|
|
10401
10801
|
return () => clearInterval(id);
|
|
10402
10802
|
}, []);
|
|
@@ -11032,6 +11432,16 @@ function ChatScreen({ agent, conversation }) {
|
|
|
11032
11432
|
sessionToken,
|
|
11033
11433
|
agent.id
|
|
11034
11434
|
]);
|
|
11435
|
+
const runComputerStats = useCallback(() => {
|
|
11436
|
+
if (!appUrl || !sessionToken) return;
|
|
11437
|
+
setItems((prev) => [...prev, {
|
|
11438
|
+
kind: "computer",
|
|
11439
|
+
id: crypto.randomUUID(),
|
|
11440
|
+
state: "loading",
|
|
11441
|
+
stats: null,
|
|
11442
|
+
error: null
|
|
11443
|
+
}]);
|
|
11444
|
+
}, [appUrl, sessionToken]);
|
|
11035
11445
|
const runSandboxPty = useCallback(async () => {
|
|
11036
11446
|
if (!appUrl || !sessionToken) return;
|
|
11037
11447
|
const result = await runPtySession({
|
|
@@ -11572,6 +11982,9 @@ function ChatScreen({ agent, conversation }) {
|
|
|
11572
11982
|
})
|
|
11573
11983
|
}]);
|
|
11574
11984
|
break;
|
|
11985
|
+
case "computer":
|
|
11986
|
+
runComputerStats();
|
|
11987
|
+
break;
|
|
11575
11988
|
case "plan": {
|
|
11576
11989
|
if (!(!!todos && todos.length > 0)) {
|
|
11577
11990
|
useStore.getState().showToast({ message: "no plan to show yet" });
|
|
@@ -11624,6 +12037,7 @@ function ChatScreen({ agent, conversation }) {
|
|
|
11624
12037
|
history,
|
|
11625
12038
|
runLocalShell,
|
|
11626
12039
|
runSandboxExec,
|
|
12040
|
+
runComputerStats,
|
|
11627
12041
|
runSandboxPty,
|
|
11628
12042
|
archiveConversation,
|
|
11629
12043
|
renameConversation,
|
|
@@ -11890,10 +12304,38 @@ function ChatScreen({ agent, conversation }) {
|
|
|
11890
12304
|
}
|
|
11891
12305
|
});
|
|
11892
12306
|
const hasPendingSteer = items.some((m) => m.kind === "pending-steer");
|
|
12307
|
+
const latestComputerId = useMemo(() => {
|
|
12308
|
+
for (let i = items.length - 1; i >= 0; i--) {
|
|
12309
|
+
const item = items[i];
|
|
12310
|
+
if (item && item.kind === "computer") return item.id;
|
|
12311
|
+
}
|
|
12312
|
+
return null;
|
|
12313
|
+
}, [items]);
|
|
12314
|
+
const boundCollectSandboxStats = useMemo(() => {
|
|
12315
|
+
if (!appUrl || !sessionToken) return null;
|
|
12316
|
+
return () => collectSandboxStats({
|
|
12317
|
+
appUrl,
|
|
12318
|
+
sessionToken,
|
|
12319
|
+
agentId: agent.id
|
|
12320
|
+
});
|
|
12321
|
+
}, [
|
|
12322
|
+
appUrl,
|
|
12323
|
+
sessionToken,
|
|
12324
|
+
agent.id
|
|
12325
|
+
]);
|
|
11893
12326
|
const conversationContext = useMemo(() => ({
|
|
11894
12327
|
rest,
|
|
11895
|
-
conversationId
|
|
11896
|
-
|
|
12328
|
+
conversationId,
|
|
12329
|
+
collectSandboxStats: boundCollectSandboxStats,
|
|
12330
|
+
latestComputerId,
|
|
12331
|
+
scrolledUp
|
|
12332
|
+
}), [
|
|
12333
|
+
rest,
|
|
12334
|
+
conversationId,
|
|
12335
|
+
boundCollectSandboxStats,
|
|
12336
|
+
latestComputerId,
|
|
12337
|
+
scrolledUp
|
|
12338
|
+
]);
|
|
11897
12339
|
const actionableCards = useMemo(() => items.filter(isActionableCard), [items]);
|
|
11898
12340
|
const statusText = useMemo(() => formatChatFooterStatus({
|
|
11899
12341
|
runKind: run.kind,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "./client-DabRpc_T.mjs";
|
|
3
|
-
import { a as runPortalDaemon, i as queryDaemonStatus, n as ensureDaemonRunning, o as startPortalDaemon, r as isDaemonListening, s as stopDaemon, t as PortalDaemon } from "./daemon-
|
|
3
|
+
import { a as runPortalDaemon, i as queryDaemonStatus, n as ensureDaemonRunning, o as startPortalDaemon, r as isDaemonListening, s as stopDaemon, t as PortalDaemon } from "./daemon-DLY2NmVU.mjs";
|
|
4
4
|
import "./api-DG5W6iwx.mjs";
|
|
5
5
|
|
|
6
6
|
export { runPortalDaemon };
|
|
@@ -20,7 +20,7 @@ import { access, appendFile, mkdir, readFile, unlink, writeFile } from "node:fs/
|
|
|
20
20
|
* the commit time of the built tree is one monotonic clock they share.
|
|
21
21
|
*/
|
|
22
22
|
function portalDaemonBuild() {
|
|
23
|
-
return "
|
|
23
|
+
return "1786600530";
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Whether a client carrying `mine` should replace a running daemon carrying
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { c as LOCAL_PROTOCOL_VERSION, d as encodeLine, f as makeLineParser, n as ensureDaemonRunning, p as parseDaemonMessage, u as daemonPaths } from "./daemon-
|
|
2
|
+
import { c as LOCAL_PROTOCOL_VERSION, d as encodeLine, f as makeLineParser, n as ensureDaemonRunning, p as parseDaemonMessage, u as daemonPaths } from "./daemon-DLY2NmVU.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { connect } from "node:net";
|
|
5
5
|
|
package/package.json
CHANGED