Commit Graph
215 Commits
Author SHA1 Message Date
Jinwoo Hong 4140d6a4c0 Revert "feat(mobile): pairing paste flow + Keychain-backed device tokens (#1452)" (#1474)
This reverts commit 55d3a42079.
2026-05-05 16:29:00 -07:00
Brennan BensonandOrca 8de43cd3b4 fix(sidebar): stamp lastActivityAt on first worktree discovery (#905)
Co-authored-by: Orca <help@stably.ai>
2026-05-05 16:17:51 -07:00
Jinwoo HongandOrca 55d3a42079 feat(mobile): pairing paste flow + Keychain-backed device tokens (#1452)
Co-authored-by: Orca <help@stably.ai>
2026-05-05 16:09:26 -07:00
JinjingandOrca ddb732cf34 Support spritesheet pet imports for Sidekick (#1472)
* WIP: Changes before auto-review fixes

Co-authored-by: Orca <help@stably.ai>

* auto-review-fix iteration 1

Co-authored-by: Orca <help@stably.ai>

* fix: plumb manifest.fps for detected-frame bundles

Co-authored-by: Orca <help@stably.ai>

* fix: address lint errors

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
2026-05-05 15:56:54 -07:00
Brennan BensonandOrca 148f33c470 fix(telemetry): refresh settings_changed whitelist; agent_kind runtime guard (#1450)
Co-authored-by: Orca <help@stably.ai>
2026-05-05 12:59:15 -07:00
Brennan BensonandOrca 6f2e31afad feat(telemetry): PR 4 — wire 7 core events to call sites (#1433)
Co-authored-by: Orca <help@stably.ai>
2026-05-05 11:57:51 -07:00
Jinwoo HongandOrca 705be9e312 feat(status-bar): consolidate memory + sessions into Resource Usage segment (#1415)
Co-authored-by: Orca <help@stably.ai>
2026-05-05 11:38:18 -07:00
JinjingandOrca 5ce9c3b481 feat(tasks): remember tasks page resume state across sessions (#1442)
Persist transient Tasks page position (GitHub mode, active preset/query,
Linear preset/query) in PersistedUIState so reopening Tasks restores the
user's working context instead of falling back to defaults. Source, repo
selection, team selection, and active project keep using their existing
settings paths.

Co-authored-by: Orca <help@stably.ai>
2026-05-05 11:19:50 -07:00
NeilandOrca 62e02a3b4c feat(new-workspace): unified source picker + non-submitted URL drafts for agents (#1426)
* Fix new workspace composer focus restore

* Unify new workspace source selection

* WIP: selected source pill in smart workspace name field

Co-authored-by: Orca <help@stably.ai>

* fix(new-workspace): truncate source pill so it doesn't expand the dialog

Co-authored-by: Orca <help@stably.ai>

* feat(new-workspace): add open-in-browser button to source pill, fix vertical alignment

Co-authored-by: Orca <help@stably.ai>

* refactor(new-workspace): drop redundant kind suffix, distinct PR/issue icons, tooltips on pill actions

Co-authored-by: Orca <help@stably.ai>

* fix(new-workspace): type linked URL into agent input without auto-submit

Co-authored-by: Orca <help@stably.ai>

* fix(new-workspace): use bracketed-paste for draft URL injection so it actually appears in the agent input

Co-authored-by: Orca <help@stably.ai>

* feat(agents): per-agent draft injection strategy (codex slow paste, pi/opencode type-chars)

Co-authored-by: Orca <help@stably.ai>

* fix(agents): smarter TUI-ready heuristic + bracketed paste for codex/pi/opencode

Replaces per-agent strategy guesswork with a measured readiness check:
title-idle / non-shell-foreground stable for 1.5s / 2.5s minimum floor.
Verified against codex, pi, opencode, claude in a node-pty + xterm-headless
test rig — bracketed paste lands in the input buffer for all four.

Co-authored-by: Orca <help@stably.ai>

* refactor(agents): drop unused per-agent draft strategy abstraction

The TUI-ready heuristic in agent-paste-draft.ts works for every tested
agent (claude/codex/pi/opencode), so the AgentDraftInjectionStrategy
field, type-chars + bracketed-paste-slow code paths, and per-agent
overrides are dead. Keep the `agent` arg on pasteDraftWhenAgentReady
for future per-agent escape hatches without touching every call site.

Co-authored-by: Orca <help@stably.ai>

* feat(agents): skip draft URL injection for copilot + cursor-agent

Both TUIs open with a 'Do you trust this folder?' menu on first launch
that consumes keystrokes as menu input — pasting a URL there either
selects an arbitrary option or quits the session. Mark them with
skipDraftUrlInjection so the workspace still opens cleanly; the user
types/pastes the URL themselves once past the trust menu.

Co-authored-by: Orca <help@stably.ai>

* feat(agents): native --prefill for claude, trust pre-write for cursor/copilot

Replaces the empirical TUI-ready waits with two deterministic mechanisms:

1) `claude --prefill <text>` flag — Claude launches with the URL already in
   its input box, no submit. Eliminates the readiness/paste race entirely
   for the most common agent.
2) DECSET 2004 (`\x1b[?2004h`) detection on the PTY data stream for every
   other agent. That escape is the protocol-level "input layer ready,
   accepting bracketed paste" handshake — emitted by claude/codex/pi/
   opencode/gemini/cursor-agent/copilot the moment the input box mounts.
   We tap it via a sidecar subscription on pty-dispatcher (no interference
   with the primary xterm handler) and paste as soon as it lands. The
   8s budget is now an upper bound, not a target.

Cursor-agent and Copilot's "Do you trust this folder?" menus are bypassed
by writing the same trust artifacts the CLIs themselves write after the
user accepts:
- Cursor: `~/.cursor/projects/<slug>/.workspace-trusted` (slug = abs path
  with leading `/` stripped, remaining `/` → `-`).
- Copilot: append cwd to `trustedFolders` in `~/.copilot/config.json`
  (the same array the bundled `addTrustedFolder` writes).

Verified against the cursor-agent CLI bundle (versions/2026.04.17-787b533/
index.js: `_=".workspace-trusted"`) and the @github/copilot 1.0.32 bundle
(`isFolderTrusted` / `addTrustedFolder` both read/write `trustedFolders`).
Both check via realpath() before string-comparing, so the trust preset
canonicalizes too.

skipDraftUrlInjection is dropped — both agents now get the draft URL
paste once the trust menu is pre-resolved.

Tests: 24 passing across tui-agent-startup, agent-trust-presets,
pty-dispatcher routing.

Co-authored-by: Orca <help@stably.ai>

* fix(agents): wait for post-?2004h render burst to settle before paste

OpenCode emits DECSET 2004 at ~500ms during alt-screen setup, then runs
a 1.3s splash render with NO bytes on the PTY, then paints the actual
input box at ~1.85s. Pasting on the bare ?2004h signal lands during the
silent gap and the bytes are dropped.

The fix: take ?2004h as the necessary precondition, then wait for the
TUI's render burst to finish — defined as 1500ms of stream silence
after the most recent post-?2004h byte. This captures both the fast
TUIs (claude/pi/codex emit setup escapes in one burst then go quiet)
and the slow ones (opencode emits, sleeps for the splash, emits again,
then goes quiet).

Verified against opencode/claude/pi in a node-pty rig: paste lands on
the first try with the new strategy. The hard 8s timeout still caps
the wait when an agent fails to launch.

Co-authored-by: Orca <help@stably.ai>

* fix(agents): guard agentTrust IPC so stale preload doesn't crash launch

If the preload bundle is older than the renderer (a real situation in
electron-vite dev because preload changes only apply on full restart,
not HMR), `window.api.agentTrust` is undefined and the launch crashes
with "Cannot read properties of undefined (reading 'markTrusted')"
before the worktree even opens.

Guard the call sites in launch-work-item-direct and useComposerState
to skip the trust pre-write when the IPC isn't exposed, and wrap the
invoke in try/catch so an IPC error never blocks the launch — the user
just sees the trust menu and accepts it manually, same as before this
feature shipped.

Co-authored-by: Orca <help@stably.ai>

* feat(tasks): route 'Use' through the New Workspace dialog instead of yolo-create

The Use CTA on the Tasks page used to create+activate a worktree
synchronously, which surprised users — the worktree appeared in the
sidebar before they had a chance to confirm name / agent / setup. The
unified New Workspace dialog landed in this branch already supports
opening with a linked work item pre-filled (see openComposerForItem /
openComposerForLinearItem), so just route Use through it.

The launchWorkItemDirect helper stays exported for ProjectViewWrapper,
which has its own UX where the immediate-create flow is the right call.

Co-authored-by: Orca <help@stably.ai>

* test(agents): include `agent` field in autohand startup-plan assertion

Merging main brought in the Autohand Code agent test (PR #1382), which
predated this branch's addition of `agent` to AgentStartupPlan.
Aligning the assertion fixes the lone CI test failure on this PR.

Co-authored-by: Orca <help@stably.ai>

* refactor(agents): drop unused expectedProcess arg + snapshot sidecar set

Two minor follow-ups from self-review:

1. `pasteDraftWhenAgentReady` no longer reads `expectedProcess` — readiness
   is gated on DECSET 2004 alone now, not on PTY foreground process. Drop
   it from the signature and from the two callers (launch-work-item-direct,
   new-workspace).

2. The pty-dispatcher's sidecar fan-out iterates the live Set, which is
   safe against deleting the current element but not against a watcher
   that synchronously subscribes a sibling. Snapshot via Array.from
   before the loop. Cheap (Set is tiny) and removes the latent footgun.

No behavior change.

Co-authored-by: Orca <help@stably.ai>

* test(e2e): match the unified smart-name input's new placeholder

The CreateFromTab refactor in this branch replaced the separate "Workspace
name" Input with a single SmartWorkspaceNameField whose default-mode
placeholder is "Type a name, #1234, branch, GitHub or Linear URL". The
worktree-create e2e test was still anchoring on the old "Workspace name"
text and could not find the input.

Update the placeholder regex to match the new copy. Free-form text typed
into smart mode is treated as a workspace name by submitQuick — same
contract the test used before.

Verified locally: targeted e2e passes in 2.2s.

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
2026-05-05 01:07:52 -07:00
f9120cb2f1 Add custom desktop notification sounds (#1430)
* Add support for custom desktop notification sounds

* perf(notifications): cache custom sound + restart-on-play

Avoids re-reading the configured audio file (up to 10MB) from disk and
re-transferring it over IPC on every notification. Adds a path-only
resolver so repeated dispatches with an unchanged sound skip the heavy
load entirely.

For burst handling, follows the VS Code AccessibilitySignalService /
GNOME canberra pattern: one shared HTMLAudioElement per sound, restarted
from t=0 on each play, with an in-flight guard that drops new plays
while the sound is still ringing. This self-dedupes by the sound's own
duration without any magic time constant — distinct sounds remain free
to overlap. The Test button passes force: true so an explicit user
action always plays through.

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com>
Co-authored-by: Orca <help@stably.ai>
2026-05-05 01:00:16 -07:00
Kaylee 4497b5fa3d feat: custom IDE Font (#1428)
* Add an Appearance setting for the app/workbench UI font family. It will be independent from terminal typography and will not change Monaco, diffs, markdown editor text, or terminal panes.

* Update IDE font copy
2026-05-05 00:29:41 -07:00
Igor Costa 38b77afb8d Add Autohand Code agent support (#1382) 2026-05-05 00:25:37 -07:00
e623372cdb feat(cli): add tab profile controls and automation primitives (#1396)
* feat(cli): add browser tab profile controls

* feat(cli): add tab profile automation primitives

* refactor(cli): narrow tab profile automation scope

* chore: retrigger PR checks

* review: harden tab profile automation CLI

- Wait for tab re-registration after browser.tabSetProfile so a follow-up tab list --show-profile reads the new sessionProfileId from BrowserManager instead of the stale one from the previous webview
- Wait for tab registration after browser.tabProfileClone, matching browser.tabCreate, so the cloned browserPageId is operable when the CLI returns
- Short-circuit browser.tabSetProfile when the tab is already on the requested profile so we do not tear down and remount the webview for a no-op switch
- Switch TabShow.worktree from OptionalPlainString to OptionalString to match every other tab schema; empty --worktree should fall back to the active worktree, not pass through as the empty string
- Add max-lines disable to browser.test.ts (file grew past 300 lines after adding the new tab-profile and tab-show tests)

* review: fix useIpcEvents test setup for tab profile API

CI failure: useIpcEvents.test.ts threw at module load with TypeError: window.addEventListener is not a function. The chain: the rebased useIpcEvents.ts imports destroyPersistentWebview from webview-registry, which calls window.addEventListener at module load. The test stubs window via vi.stubGlobal as a plain object without addEventListener, so the typeof window check passes but the call throws.

- webview-registry.ts: tighten the module-load guard to also check that window.addEventListener is callable, so importing this module from a non-DOM-ish test env (vitest node env with stubbed window) does not throw at module load
- useIpcEvents.test.ts: add the new onRequestTabSetProfile and replyTabSetProfile stubs to all 8 window.api.ui mocks so the new IPC subscription registered by useIpcEvents resolves

* review: restore profile CRUD lost during rebase onto 1397-merged main

The rebase brought commit 3242aa27 (refactor: narrow tab profile automation scope) onto a main that already had the lifecycle CRUD from 1397. The refactor commit removes BrowserProfileList/Create/Delete types, runtime methods, RPC registrations and schemas, plus the help/specs entries, because those were the precursor versions in commit 1 of this branch. Post-rebase those removals land on the hardened versions inherited from main, breaking 1397.

Restore:
- runtime-types.ts: BrowserSessionProfile import; ProfileList/Create/Delete result types
- orca-runtime.ts: ProfileList/Create/Delete result type imports; browserProfileList/Create/Delete methods
- browser-core.ts: ProfileCreate, ProfileDelete schema imports; browser.profileList/profileCreate/profileDelete RPC registrations
- browser-schemas.ts: ProfileCreate, ProfileDelete zod schemas
- help.ts: list/create/delete subcommand lines under Browser Automation
- specs/browser-basic.ts: list/create/delete spec entries

---------

Co-authored-by: Nikolatesla-lj <Nikolatesla-lj@users.noreply.github.com>
Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
2026-05-04 23:46:23 -07:00
JinjingandOrca 70ffa0a73d [feat] Add a full Github project view under "Tasks" (#1424)
* WIP: auto-review-fix iteration 1 (project-view.ts fixes applied)

Co-authored-by: Orca <help@stably.ai>

* refactor(github-project): split project-view and slug-dialog into modules

Co-authored-by: Orca <help@stably.ai>

* fix(lint): resolve oxlint errors in project-view modules

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
2026-05-04 23:24:52 -07:00
9bf339eeb9 feat(cli): add tab profile lifecycle commands (#1397)
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Nikolatesla-lj <Nikolatesla-lj@users.noreply.github.com>
Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
2026-05-04 23:01:15 -07:00
Brennan BensonandOrca 26a51a1d56 feat(telemetry): PR 3 — first-launch UX + Privacy pane; flip transport flag (#1385)
Co-authored-by: Orca <help@stably.ai>
2026-05-04 20:46:21 -07:00
JinjingandOrca 56686ea035 fix(worktrees): preserve SSH focus recency and route agent clicks through activation helper (#1410)
- Scope pruneLastVisitedTimestamps per-repo so not-yet-hydrated SSH repos retain persisted Cmd+J recency instead of being wiped at startup.
- Parse lastVisitedAtByWorktreeId leniently: drop only bad entries rather than failing the whole workspace session on one corrupted timestamp.
- Route sidebar agent-tab clicks through activateAndRevealWorktree so cross-repo activation and nav history are not silently skipped.

Co-authored-by: Orca <help@stably.ai>
2026-05-04 14:58:09 -07:00
82023dbe1b feat(worktrees): add experimental symlinks for shared paths on worktree creation (#1029)
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: federico-ntb <federico@notchatbot.com>
Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
2026-05-04 14:19:20 -07:00
Jinwoo HongandOrca fc578f5ea9 feat(mobile): Expo companion app [beta] (#1245)
Co-authored-by: Orca <help@stably.ai>
2026-05-04 13:08:27 -07:00
JinjingandOrca fd6abb5808 fix(cmd-j): rank empty-query worktrees by focus recency (#1383)
* fix(cmd-j): rank empty-query worktrees by focus recency

Persist a per-worktree focus-recency timestamp and use it as the primary
ordering signal for Cmd+J's empty-query Worktrees section, so SSH and
other quiet worktrees surface based on user focus rather than background
activity. See docs/cmd-j-empty-query-ordering.md.

Co-authored-by: Orca <help@stably.ai>

* fix(tests): guard lastVisitedAtByWorktreeId and mock markWorktreeVisited

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
2026-05-03 22:55:11 -07:00
Brennan BensonandOrca fd86e1869a feat(telemetry): PR 2 — transport (client, validator, burst cap, IPC, build gate) (#1374)
Co-authored-by: Orca <help@stably.ai>
2026-05-03 16:51:31 -07:00
7edcdca699 feat: hide default branch workspace (#1249)
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
2026-05-03 15:55:43 -07:00
Brennan BensonandOrca d0e3a64768 feat(telemetry): PR 1 — foundations (types, consent, migration, PRIVACY.md) (#1372)
Co-authored-by: Orca <help@stably.ai>
2026-05-03 13:13:26 -07:00
JinjingandOrca 46a26252bb feat(browser): viewport-size emulation via CDP (#1369)
* feat(browser): viewport-size emulation via CDP

Adds a Viewport Size submenu in the browser toolbar "…" menu.
Presets apply width/height/deviceScaleFactor/mobile/touch via
Emulation.setDeviceMetricsOverride + setTouchEmulationEnabled, and
swap the UA to a mobile iPhone CriOS string on mobile presets.
Responsive clears the override. Selection persists per-tab and
re-applies on dom-ready so it survives navigations.

Co-authored-by: Orca <help@stably.ai>

* chore(browser): rename 'Responsive' viewport option to 'Default'

Co-authored-by: Orca <help@stably.ai>

* fix(browser): harden viewport emulation — serialize, validate, client-hints

- Chain per-tab setViewportOverride calls to prevent rapid-toggle races
- Validate viewport metrics at IPC trust boundary (reject non-finite/out-of-range)
- Emit userAgentMetadata alongside mobile UA to avoid UA/CH mismatch
- Always reapply on dom-ready (incl. null) to clear stale emulation
- Persist viewportPresetId in session schema (optional+nullable for back-compat)
- Convert preset submenu to DropdownMenuRadioGroup for a11y
- Log debugger.attach failures and cover with a unit test

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
2026-05-02 20:22:40 -07:00
Neil b309f49ee3 Allow large text files to open in editor (#1367) 2026-05-02 18:12:08 -07:00
SSWSer 6f606114a0 feat: add PowerShell 7+ support for Windows terminals
Adds PowerShell 7+ support for Windows terminal selection, with Auto resolving to pwsh.exe when available and falling back to Windows PowerShell.
2026-05-02 16:06:11 -07:00
Leynier Gutiérrez GonzálezandClaude Opus 4.7 37b2996ee0 feat(editor): add toggle to show minimap in file editor (#1346)
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-02 00:40:53 -07:00
Neil 9f2ab5ed0d fix(terminal): mirror VS Code GPU rendering controls (#1344) 2026-05-02 00:04:14 -07:00
Brennan BensonandOrca 70befde774 feat(github): per-repo issue-source selector (#1317)
Co-authored-by: Orca <help@stably.ai>
2026-05-01 21:48:51 -07:00
JinjingandOrca 547448e15c refactor: rename pet → sidekick across codebase (#1334)
Renames the experimental pet overlay to "sidekick" with themed character
names (Claude the Mage, OpenCode the Rogue, Gremlin the Trickster).
Covers IPC channels, preload API, persisted UI state, settings flag,
on-disk userData path, components, and types.

Deletes the standalone pet-overlay design mock.

Co-authored-by: Orca <help@stably.ai>
2026-05-01 18:40:52 -07:00
JinjingandOrca d287342f99 feat: add experimental pet overlay (#1331)
* feat: add experimental pet overlay

Adds an opt-in 3D pet overlay pinned to the bottom-right. Gated behind
an experimental flag so three.js + GLB models stay out of the renderer
bundle for users who never enable the feature. Ships with four bundled
models plus user-uploaded custom GLBs via a pet:import IPC; a status-bar
segment provides model picker + hide toggle.

See docs/design/pet-overlay.md for the full design.

Co-authored-by: Orca <help@stably.ai>

* refactor(pet): replace 3D GLB models with 2D webp images

Co-authored-by: Orca <help@stably.ai>

* chore(pet): compress pet webp images and remove unused assets

Reduce resources/claude.webp, gremlin.webp, opencode.webp sizes; drop
the obsolete pet-overlay design doc and compress-pet-glb script now
that the GLB pipeline has been replaced by 2D webp images.

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
2026-05-01 16:18:21 -07:00
bbd77c2449 fix(worktree): restore sparse checkout without per-poll git subprocesses (#1316)
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Colin <colin.chambachan@gmail.com>
2026-05-01 13:25:22 -07:00
d4bbf473c1 Support wiki-style Markdown document links (#1282)
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
2026-05-01 13:15:08 -07:00
Brennan BensonandOrca 12858f37e3 feat(github): source-repo indicator + surface issue fetch errors (#1250)
Co-authored-by: Orca <help@stably.ai>
2026-04-30 22:53:37 -07:00
Brennan BensonandOrca 2e372779b6 fix(persistence): add 'inline-agents' to cardProps for existing experiment opt-ins (#1293)
Co-authored-by: Orca <help@stably.ai>
2026-04-30 18:49:09 -07:00
Jinwoo Hong 000d4dc08b Revert sparse checkout worktree creation (#1290) 2026-04-30 15:47:40 -07:00
Brennan BensonandOrca 0f3aaab9f8 feat: default sidebar sort to 'recent' instead of alphabetical (#1285)
Co-authored-by: Orca <help@stably.ai>
2026-04-30 11:07:54 -07:00
79faafcc98 Add sparse checkout worktree creation (#1131)
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
2026-04-30 00:43:00 -07:00
NeilandOrca a02987e604 feat(settings): replace task-icon toggle with Tasks-button toggle, expose in View menu (#1271)
Co-authored-by: Orca <help@stably.ai>
2026-04-29 21:13:13 -07:00
Neil 020780c4dd feat(hooks): restore always-trust repo option
Restores repo-level always-trust for orca.yaml hooks and surfaces CLI warnings when --run-hooks is omitted and a hook is skipped.
2026-04-29 20:47:04 -07:00
Jinwoo HongandOrca 7993fb5aaa feat(status-bar): show inline usage for inactive accounts in switcher (#1259)
Co-authored-by: Orca <help@stably.ai>
2026-04-29 19:29:11 -07:00
Brennan BensonandOrca c1620496cf feat(agent-cockpit): replace bottom-panel dashboard with inline per-card agents list (#1251)
Co-authored-by: Orca <help@stably.ai>
2026-04-29 18:51:24 -07:00
mcd77 89f41bfda2 feat(hooks): gate orca.yaml execution on trust
Audited and rebased PR 1138. Squashed to remove the original untrusted commit stack; hook execution now requires explicit UI trust or CLI --run-hooks opt-in.
2026-04-29 18:29:53 -07:00
Jinwoo HongandOrca 2329f56180 Exit beta: SSH badge removal + always-on daemon PTY (#1253)
Co-authored-by: Orca <help@stably.ai>
2026-04-29 17:48:24 -07:00
faf949835f feat(rate-limits): add Gemini and OpenCode Go usage tracking (#1023)
* feat(rate-limits): add Gemini and OpenCode Go usage tracking

- Extend provider union and RateLimitState with 'gemini' and 'opencode-go'
- Add opencodeSessionCookie to GlobalSettings (password input in GeneralPane)
- Add GeminiIcon and OpenCodeGoIcon to status bar icons
- Implement gemini-usage-fetcher: OAuth creds from ~/.gemini/oauth_creds.json,
  auto-refresh expired tokens (including server-side 401 retry), loadCodeAssist
  project resolution, retrieveUserQuota with pro/flash bucket mapping
- Implement opencode-go-usage-fetcher: cookie-based POST to opencode.ai/_server,
  two-step workspace+subscription fetch, regex parse of text/javascript response
- Wire both fetchers into RateLimitService via Promise.allSettled for isolation
- Add formatWindowLabel() replacing hardcoded '5h'/'wk' strings in StatusBar
- Render Gemini and OpenCode Go segments in StatusBar and tooltip
- 28 new tests across fetchers, service, and label formatter

Closes #1022

* fix(persistence): additive merge for statusBarItems on load

New providers (gemini, opencode-go) were invisible to users with existing
settings because the persisted statusBarItems array (without the new entries)
overwrote the defaults. Union saved items with current defaults so new
providers appear automatically after upgrade without user intervention.

* feat(rate-limits): add Gemini multi-bucket usage

Restore provider auth wiring, preserve Gemini model buckets in detailed views, and keep compact status rendering summary-only. Avoid embedding OAuth client secrets by failing closed for auth.json refreshes.

* fix(gemini-oauth): resolve symlinks and use known-path + bundle-dir extraction

Replace the recursive directory walker with two targeted strategies:
1. Known paths: checks explicit Homebrew/Nix/npm layouts without walking.
2. Bundle dir: walks up from the binary to find package.json, then scans
   the bundle dir for hash-named oauth2 chunks.

Also threads the refresh token as a plain string through
tryRefreshTokenFromBundle so both the oauth_creds.json and auth.json
paths share one refresh flow without coupling to either struct.

Windows: uses 'where gemini' and splits on newlines for multi-result output.

* fix(status-bar): fix Gemini bucket display — names, window size, model context

Three issues fixed:

1. windowMinutes was computed as time-remaining-until-reset instead of the
   fixed window size. Gemini buckets are always 1-hour windows; use the
   constant 60 so labels read "93% Pro 1h" instead of "93% 47m".

2. Unknown bucket names now humanize gracefully. Unknown model IDs get the
   "gemini-" prefix stripped and title-cased ("gemini-3.0-ultra" → "3.0 Ultra")
   instead of showing "Unknown (gemini-3.0-ultra)". Added more known model
   mappings (2.0 Flash, 2.0 Flash Lite, 1.5 Pro, 1.5 Flash, Flash Lite).

3. Status bar segment now shows the most-constrained bucket name next to the
   percentage so users know which model is the binding constraint.

Pure unit tests for getBucketName/deriveSessionSummary extracted to
gemini-bucket-helpers.test.ts to keep gemini-usage-fetcher.test.ts
under the 300-line lint limit.

* feat(status-bar): show all Gemini buckets individually in status bar

Instead of showing only the most-constrained bucket summary, render each
bucket by name with its remaining percentage (e.g. "Flash 93% · 3.1 Pro Preview 7%").
Falls back to the session/weekly window display for providers without buckets.

* fix(status-bar): show only Flash and 3.1 Pro Preview buckets in Gemini segment

Filter to the two most relevant buckets (Flash + 3.1 Pro Preview) to avoid
cluttering the bar. Falls back to session summary if neither bucket is present.

* fix(icons): replace GeminiIcon with official 2025 multicolor gradient

The previous icon used a simple linear gradient (blue→purple→red).
The official Google Gemini 2025 icon uses 11 blurred ellipses (feGaussianBlur)
stacked under an alpha mask to produce the characteristic multicolor glow effect.

Each instance gets unique filter/mask IDs via a module-level counter to prevent
ID collisions when the icon is rendered multiple times on the same page.

* feat(opencode): add monthly limits, workspace override, and improved cookie handling

* fix(opencode): show correct status when session cookie is missing

* fix(rate-limits): discard stale data on unavailable and show errors in tooltip

* fix(rate-limits): invalidate stale data when opencode config changes

* fix(security): resolve vulnerabilities and harden rate-limit fetchers

* fix: address critical security, performance and concurrency issues identified during code review

* fix(build): resolve claude rate-limit export and broken type definitions

* fix(build): remove unused code in claude-fetcher after rebase

* Fix claude fetcher

* fix: resolve synchronization, performance, and robustness issues in AI providers

- Convert synchronous file I/O to asynchronous to prevent main process blocking
- Implement concurrency limiting in recursive directory copying to avoid EMFILE errors
- Persist refreshed Gemini OAuth tokens to disk and improve project ID resolution
- Fix OpenCode Go fetcher to correctly handle workspace overrides and robustly resolve IDs
- Refine scraping regexes to handle nested objects and improve resilience
- Update status bar bucket names and fix Gemini model mapping typos
- Ensure proper handling of async operations in background services

* feat(gemini): deduplicate quota buckets and update model mappings

* fix(rate-limits): preserve stale data for Gemini and OpenCode Go on fetch errors

* fix: remove out-of-scope Linear changes and restore files to upstream/main

* fix(opencode-go): handle React Flight wire format and duplicate keys

The opencode.ai page uses React Server Components. Usage keys like
monthlyUsage appear twice: once as `key:$R[N]={...}` with real data
and once as `key:null` inside a billing component. Render order varies,
so on refresh the null could appear first, causing monthly to vanish or
show 100% from a sibling sub-object.

Replace flat regex extraction with extractUsageBlock, which:
- Iterates all occurrences of each key
- Skips null assignments (no { in 30-char window after colon)
- Handles the $R[N]= token between colon and opening brace
- Validates usagePercent + resetInSec as direct fields before accepting

Add regression tests using the real React Flight HTML format.

* fix(rate-limits): address PR review feedback from nwparker

Scope reverts (out-of-scope changes removed):
- Revert codex-accounts async refactor (fs-utils.ts, service.ts)
- Revert filesystem-auth.ts path-auth reordering
- Revert filesystem-mutations.ts bundled changes
- Revert repos.ts handler move; keep only -- separator fix
- Revert relay/fs-handler-git-fallback.ts RegExp try/catch
- Revert fs-handler.ts stat→lstat, useFileDeletion.ts !isRemote guard
- Revert persistence.ts statusBarItems additive merge

Feature fixes:
- Validate opencodeWorkspaceId override with ^(wrk|wk)_[A-Za-z0-9]+$ before URL interpolation
- Remove internal 5-min cache from fetchGeminiRateLimits (service polls already)
- Make saveGeminiCredentials atomic using tmp-file + rename pattern
- Add fetchGeneration counter to OpenCode to discard stale mid-flight results
- Add console.warn on safeStorage decrypt failure in persistence.ts
- Add geminiCliOAuthEnabled opt-in setting (default: false) with UI toggle and risk disclosure
- Use per-candidate AbortControllers in opencode-go fetcher
- Add fragility comments to brace-depth parsers in opencode-go fetcher

Refactor (keep under 300-line lint limit):
- Extract gemini-bucket-formatting.ts from gemini-usage-fetcher.ts
- Extract opencode-go-page-scraper.ts from opencode-go-usage-fetcher.ts

Co-authored-by: Orca <help@stably.ai>

* fix(rate-limits): restore OpenCode Go workspace ID regex + cleanup

- opencode-go-usage-fetcher: regex accidentally shipped as `\\s*` (matches
  literal backslash-s) instead of `\s*` during the review-feedback commit,
  breaking workspace ID extraction when no override is configured —
  parseWorkspaceIds always returned []. 10 tests were failing as a result.
- gemini-usage-fetcher: drop unused `_force` parameter left over from the
  removed 5-min internal cache; update service.ts call site.
- codex-accounts test fixtures: add missing `geminiCliOAuthEnabled` to
  createSettings() to fix pre-existing typecheck errors introduced when
  the new setting was added.

Co-authored-by: Orca <help@stably.ai>

* test(rate-limits): stabilize Gemini fetcher tests, silence max-lines

- Rewire Gemini fetcher tests to mock the CLI-credential extractor at the
  module boundary instead of stubbing every fs/child_process call. The
  extractor is a self-contained dependency with a simple async contract,
  and was previously being reached through sync-fs mocks that stopped
  matching after the extractor was refactored to node:fs/promises — three
  tests were silently failing as a result. With this change, all 17
  Gemini fetcher tests pass.
- Replace the "proceeds with empty projectId" test (which asserted that an
  empty projectId still hits the quota API — the current fetcher
  correctly short-circuits to an actionable error instead) with a test
  that documents the new behavior, plus an explicit test for the
  geminiCliOAuthEnabled=false unavailable path.
- Add a max-lines disable pragma to service.test.ts matching the one
  already on service.ts, so the rate-limit fetch-ordering contract and
  its tests remain reviewable as a single unit.

Co-authored-by: Orca <help@stably.ai>

* fix(codex-accounts): revert runtime-home-service async refactor

The review explicitly asked to drop the codex async refactor from this PR
(fires floating promises from the constructor via void, and the prepare*
helpers no longer block on sync completion — that is a behavior change
around account prep racing with launch that deserves its own design
discussion, not a drive-by).

Earlier reverts removed fs-utils.ts and service.ts but left
runtime-home-service.ts untouched, which was causing the matching
runtime-home-service.test.ts suite (11 tests) to fail in CI. This restores
the file to main so the suite is green and the PR stays scoped to the
Gemini / OpenCode Go feature.

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com>
2026-04-29 16:55:32 -07:00
Neil c25b61c558 fix(mac): request media permissions dynamically (#1233) 2026-04-28 16:18:22 -07:00
Brennan BensonandOrca ae994e7032 feat(settings): gate Agent Dashboard behind experimental setting (#1219)
Co-authored-by: Orca <help@stably.ai>
2026-04-28 14:41:37 -07:00
NeilandOrca 1559cd290f fix(agents): detect Kiro under its real binary name kiro-cli (#1223)
Co-authored-by: Orca <help@stably.ai>
2026-04-28 12:37:50 -07:00
Jinwoo HongandOrca c9391e203f feat(orchestration): add inter-agent orchestration system (#1188)
Co-authored-by: Orca <help@stably.ai>
2026-04-28 12:21:31 -07:00
Brennan BensonandOrca 2c494da361 feat(agents): Agent Dashboard v2 — hook endpoint discovery, dashboard UI, sidebar status overlay (#1147)
Co-authored-by: Orca <help@stably.ai>
2026-04-28 10:13:32 -07:00