Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/ipc.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ explicit project overrides. See [customizations.md](customizations.md).
- **Linux desktop entry**: `desktop_integration_status` / `desktop_integration_add` / `desktop_integration_remove` (all async + `spawn_blocking`; add/remove shell out to `update-desktop-database`, `gtk-update-icon-cache` and `xdg-mime`). They write `~/.local/share/applications/termic.desktop` and a 256px icon under `~/.local/share/icons/hicolor/`, which is what gives an AppImage a launcher entry AND a `termic://` handler: macOS and Windows get the scheme from the bundle and the installer, an AppImage has no install step, so without this a deep link on Linux has nowhere to go. `available` is driven by `$APPIMAGE` (absolute and still on disk), NOT by `target_os`, so a `.deb`, a dev build and every other platform answer `available: false` through the same path rather than the command being absent; `src-tauri/src/linux_desktop.rs` compiles everywhere on purpose so its desktop-entry format tests run on the machine they are written on. `integrated` is re-read from the filesystem on every call and never cached: the user can delete the entry and Gear Lever or AppImageLauncher can write one. The entry carries `X-AppImage-Integrate=false` so those tools do not add a second one. It does NOT move the AppImage: `Exec=` points wherever the file already is, and moving someone's file (and then having to rewrite the entry to match) is AppImageLauncher's job, not ours.

- **Forge rate ledger** (`forge_rate.rs`, `forge::gh_api`): `forge_rate_status { probe }` (async + `spawn_blocking`) -> `RateStatus[]`, one per GitHub host: `buckets` (`graphql`, `core`), each with GitHub's `window` (`limit/remaining/used/reset_at`, account-wide, so it includes agents and the user's terminal; null when unknown or past its reset), termic's own `spent` / `estimated` / `cap` for the last hour and `by_feature`, plus `paused` (`{ until, kind: "limited" | "floor" | "budget" }`, worded by the webview) when background polling on that host is held. `probe: true` first seeds hosts with no current window from `GET /rate_limit`, which does not count against the primary limit. Every change also arrives as `termic://forge-rate-changed` with the same payload, throttled to one per 2s except when any host's pause starts, ends or moves, which always goes out. New GitHub reads go through `forge::gh_api` / `gh_graphql` (`gh api --hostname H --include`), which feed the ledger from the headers and the GraphQL `rateLimit` object, and refuse without spawning while GitHub's own refusal stands (plus termic's budget for `background` calls); the older `gh pr` / `gh issue` calls report no cost and are charged as 1-point estimates (not when `gh` failed on auth, since nothing was sent). A lookup GitHub refused answers status `rate-limited` (PR card, issue and PR pickers, Todos lists) with `retry_at` (epoch seconds, that host's), which the webview words itself (`lookupMessage` in `forgeRate.ts`) rather than showing Rust's English message; `retry_at` is null on every other status. A pulled `forge_rate_status` that resolves after a pushed event is dropped. Budget rules: [performance.md](performance.md#forge-budget-github-api).
- **Batched forge reads** (one GraphQL query per GitHub host instead of one `gh` subprocess per task or per project; budget in [performance.md](performance.md#forge-budget-github-api)): `task_pr_status_batch { ids }` (async + `spawn_blocking`) -> `(PrLookup & { id })[]`, always background work. A GitHub task whose record has a PR url joins one aliased `repository.pullRequest` query per host (`forge::PR_BATCH_MAX` = 50 per query); a closed PR, a task whose live branch is not the PR head (`forge::branch_matches_pr`, which also accepts the `pr-<n>` / `pr-<n>-<head>` fork checkouts), a PR the query cannot see, and every non-GitHub task take the per-task `pr_lookup_at`. A host whose gate closes (checked per chunk, inside `gh_api`) is skipped from there on and its tasks left OUT of the answer, so the caller keeps its entry. A missing CLI or signed-out `gh` answers each task with `cli-missing` / `cli-unauthed`; any other failure leaves the chunk out for a pass and, if it fails again, falls back per task within that budget. An open PR whose head is not the task's branch is looked up by branch at most every three minutes per task (else the batch's answer stands). The webview drops a batch answer that lands behind a refresh in flight or one that landed since, and keeps a good lookup over an `error` / `rate-limited` answer while still stamping the attempt (`batchLanding`). Every per-task lookup a pass starts shares one budget of eight, and each task gets one at most every three minutes, so a PR the query cannot see (deleted repo) does not cost a subprocess every pass; an answer whose url is not the PR asked is not trusted. `task_pr_status { id, background }`, `task_member_pr_status { id, background }` and `task_pr_comments { id, background }` take `background` as REQUIRED, so a new caller has to choose; with it set they answer `null` without calling anything while the task's (or any member's) GitHub host is paused (`forge::background_held`). The TS side has `taskPrStatusBackground` / `taskMemberPrStatusBackground` / `taskPrCommentsBackground` for the pollers; the plain wrappers send `background: false`. The identity is persisted exactly as `task_pr_status` does (`persist_pr_identity`). `project_forge_lists { queries: { projectId, kind: "issues" | "prs", scope, limit }[] }` (async + `spawn_blocking`) -> `(IssueLookup | PrPickList)[]` in `queries` order, each answer shaped for its own `kind`: GitHub lists on one host go out as queries of up to `forge::LISTS_BATCH_MAX` = 30 lists (`forge::github_lists`; repo-wide lists as `repository` aliases, personal ones as `search` aliases with `repo:` qualifiers chunked under GitHub's 256-character limit, split back out by `nameWithOwner` and capped at each list's limit), the rest (GitLab, Azure, no forge, a limit over 100, an owner or repo outside GitHub's `[A-Za-z0-9._-]` charset, or a failed GitHub query) take the per-project path on three threads, except a query GitHub refused on a limit, whose lists (and the host's later chunks) each answer `rate-limited`, and a query past the output cap, which is split in half and asked again (one list still too large answers `error`). `forge::tests::live_github_batch_queries_parse` is an ignored test that runs both queries against the signed-in `gh`.
- **Batched forge reads** (one GraphQL query per GitHub host instead of one `gh` subprocess per task or per project; budget in [performance.md](performance.md#forge-budget-github-api)): `task_pr_status_batch { ids }` (async + `spawn_blocking`) -> `(PrLookup & { id })[]`, always background work. A GitHub task whose record has a PR url joins one aliased `repository.pullRequest` query per host (`forge::PR_BATCH_MAX` = 50 per query); a `merged` or `closed` PR whose live branch is still that PR's head branch (`branch == pr.head`, leaving fork review aliases like `pr-<n>-<head>` pinned) scans newer candidates on that branch via a lightweight paginated GraphQL query (`forge::github_branch_pr_replacements_batch`, up to `forge::PR_REPLACEMENT_BATCH_MAX` = 15 per query, throttled by Rust's three-minute `RECHECK_SECS` gate alongside the frontend's three-minute `SETTLED_BATCH_STALE_MS` settled batch cadence while per-task forges wait hourly in `SETTLED_STALE_MS`), hydrates only selected replacements, keeps the old PR if none exists (or if the checkout moved/detached), and omits the entry on failure or rate refusal so the frontend keeps its existing display without advancing into the hourly backoff; an open PR whose live branch is not the PR head, a PR the query cannot see, and every non-GitHub task take the per-task `pr_lookup_at`. A host whose gate closes (checked per chunk, inside `gh_api`) is skipped from there on and its tasks left OUT of the answer, so the caller keeps its entry. A missing CLI or signed-out `gh` answers each task with `cli-missing` / `cli-unauthed`; any other failure leaves the chunk out for a pass and, if it fails again, falls back per task within that budget. An open PR whose head is not the task's branch is looked up by branch at most every three minutes per task (else the batch's answer stands). The webview drops a batch answer that lands behind a refresh in flight or one that landed since, and keeps a good lookup over an `error` / `rate-limited` answer while still stamping the attempt (`batchLanding`). Every per-task lookup a pass starts shares one budget of eight, and each task gets one at most every three minutes, so a PR the query cannot see (deleted repo) does not cost a subprocess every pass; an answer whose url is not the PR asked is not trusted. `task_pr_status { id, background }`, `task_member_pr_status { id, background }` and `task_pr_comments { id, background }` take `background` as REQUIRED, so a new caller has to choose; with it set they answer `null` without calling anything while the task's (or any member's) GitHub host is paused (`forge::background_held`). The TS side has `taskPrStatusBackground` / `taskMemberPrStatusBackground` / `taskPrCommentsBackground` for the pollers; the plain wrappers send `background: false`. The identity is persisted exactly as `task_pr_status` does (`persist_pr_identity`), under a lock that ignores stale snapshots whose PR was already replaced on disk. `project_forge_lists { queries: { projectId, kind: "issues" | "prs", scope, limit }[] }` (async + `spawn_blocking`) -> `(IssueLookup | PrPickList)[]` in `queries` order, each answer shaped for its own `kind`: GitHub lists on one host go out as queries of up to `forge::LISTS_BATCH_MAX` = 30 lists (`forge::github_lists`; repo-wide lists as `repository` aliases, personal ones as `search` aliases with `repo:` qualifiers chunked under GitHub's 256-character limit, split back out by `nameWithOwner` and capped at each list's limit), the rest (GitLab, Azure, no forge, a limit over 100, an owner or repo outside GitHub's `[A-Za-z0-9._-]` charset, or a failed GitHub query) take the per-project path on three threads, except a query GitHub refused on a limit, whose lists (and the host's later chunks) each answer `rate-limited`, and a query past the output cap, which is split in half and asked again (one list still too large answers `error`). `forge::tests::live_github_batch_queries_parse` is an ignored test that runs both queries against the signed-in `gh`.
- **Change summaries**: `task_diff` (async + `spawn_blocking`) returns the whole unified diff plus its counts, for the compare view. `task_diff_stat` returns the COUNTS ONLY and is what a list view must use: `task_diff` also ships the full diff text and spawns one `git diff --no-index` per untracked file, so a board polling every visible card would fork that many processes on a timer. The lean one runs exactly two git processes per repo (a `--numstat` against the merge-base, and one `ls-files --others`) and counts new files' lines by READING them, skipping binaries (a NUL in the first 8KB, git's own probe) and anything over 2MB. That line count is therefore an estimate and is documented as one at every layer: a file with no trailing newline is one short. The file counts are exact. Multi-repo tasks sum the host worktree and every WORKTREE member; a `repo_root` member is the project's live checkout, shared with every other task and with whatever the user is doing by hand, so counting it would attribute someone else's uncommitted edit to an agent. Consumed through `src/store/diffStat.ts`, which is demand-driven rather than a poller (see docs/ui.md).

- **Pasted images**: `clipboard_image_save` (async + `spawn_blocking`) takes the image bytes as the **raw request body** (`invoke(cmd, uint8array)` → `tauri::ipc::Request` / `InvokeBody::Raw`), not as a JSON array of numbers, which for a 3 MB screenshot is the difference between one copy and several million. It sniffs the format from the MAGIC BYTES (PNG/JPEG/GIF/WebP) rather than trusting a caller-supplied extension, writes `pasted-<unix>-<8 hex>.<ext>` into `$TMPDIR/termic-attachments/clipboard/` (`attachments_dir`, shared with dropped-file staging, and NOT the data dir, which Seatbelt denies outright), prunes anything there older than 7 days, and returns the absolute path. It exists because an image paste cannot reach an agent any other way: xterm.js sends only text down the PTY, and in Docker mode the agent is a Linux process whose clipboard reader shells out to xclip/wl-paste with no route to the Mac's pasteboard. `TerminalPane`'s capture-phase `paste` listener PASTES the returned path in the image's place (via `term.paste()`, so it arrives bracketed and claude reads the file into a real `[Image #N]` attachment instead of echoing a path), backslash-escaped by the same `shellEscapePath` a dragged-in file uses. It fires for DOCKER tasks only: everywhere else the agent reads the Mac clipboard itself and already gets the real image. Docker mounts that directory READ-ONLY at the identical absolute path, so the pasted string resolves inside the container.
Expand Down
1 change: 1 addition & 0 deletions e2e/specs/git.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2390,6 +2390,7 @@ describe("pr card (#21)", () => {
});
await waitForText("Merged");
await waitForTextGone("Changes requested");
await waitVisible("[data-testid='pr-create-new']");
await browser.waitUntil(
() =>
browser.execute(
Expand Down
Loading
Loading