Conversation
Split openFile into two exports: openFile (local paths, unchanged) and openUrl (external URLs, http(s)-only, spawned with no shell). openUrl parses via new URL() and rejects anything non-http(s) so a model-emitted file:///, data:, or javascript: URL can never reach a local handler. URLs are forwarded via child_process.spawn with an argv array, so shell metacharacters (; & ` $ | < >) in query strings cannot be interpreted as commands. Platform openers: open on darwin, explorer.exe on win32 (not cmd /c start), xdg-open on Linux/BSDs, no-op everywhere else. A no-op 'error' listener is attached before unref() so ENOENT from a missing xdg-open doesn't crash the TUI as an unhandled EventEmitter event.
A /background task today produces one 'started' toast and then nothing until completion — no way to confirm it is alive or see how many are in flight. - src/app/background.tsx: BackgroundProvider holding a ReadonlySet of in-flight task ids, register/unregister with identity-preserving no-ops, useBackground() exposing count + ids. - slash.tsx registers the id when prompt.background resolves with a task_id; useStream unregisters on background.complete. Toast and transcript marker behavior unchanged. - Composer renders a '▶ N' fragment between the queue-flush hint and the model label when count > 0, hidden at zero. - Tests: provider semantics, composer fragment presence/absence, and the full register → complete lifecycle through MockGateway.
Harden open-file: protocol allowlist + safe spawn for URLs
Composer: show ▶ N indicator while background tasks run
Add src/app/parts.ts — thin PartsBuffer adapter over @opentui/core
extmarks. Mirrors opencode's shape (file/agent/text kinds with
asymmetric source fields) so snapshots round-trip and serialize as
parts[] for future wire migration.
Composer.tsx wires:
- syntaxStyle + registered extmark.file/agent/paste style ids
- PartsBuffer constructed on textarea ref bind, torn down on unmount
- @-ref accept: complete refs (trailing space) land as styled chips,
prefix keywords (trailing : or /) keep the classic write path
- submit emits onSend(text, parts) after expanding text parts inline
- history stores { input, parts } snapshots; legacy raw-string lines
still load via the tolerant parser
useInputHistory.ts now takes HistEntry | string, persists JSONL.
No wire change: onSend accepts (text, parts?) but today's callers
only consume text. The parts[] side-channel unblocks a follow-up
gateway task without blocking this ship.
- test/parts.test.tsx: PartsBuffer unit coverage — insertText/insertPart ordering, listParts, atomic-chip backspace, plain-text backspace, deleteRange across a chip, snapshot round-trip, chip-at-start/end, adjacent chips, insert-before/after chip doesn't extend its range, expand() text-part inlining, sync() after mark deletion. - test/composer-parts.test.tsx: Composer integration — submit emits Part[] matching the buffer, atomic backspace via the key handler, history restore rebuilds chips from a parts[] entry. - Composer.tsx: the textarea ref callback was inline, so its identity changed every render → React called it with null+r again, and the null-call clobbered PartsBuffer.current mid-edit. useCallback it and route sids through a ref so theme swaps still rebuild through the genuine unmount path. Without this, the composer-level tests (and the real parts[] emission) can't keep a chip alive past one render.
atAccept rebuilt the whole textarea with setText() which clears every extmark — so a second @-ref chip wiped the first chip's mark and submit emitted only one FilePart. Splice the @word out via deleteRange instead; the extmarks controller shifts remaining marks to absorb the deletion. New test "two chips in a row → two FileParts" fails against the old setText path and passes after.
Composer: extmark-backed parts model
- add voice state management hook (useVoice) + key parsing (platform.ts)
- register voice.record_key from config as global keybinding (ctrl+b)
- handle voice.status / voice.transcript gateway events
- show recording indicator (recording/transcribing/ready) in composer bar
- extend /voice command to return record_key, support on/off/tts/status
- auto-send transcribed text on capture (CLI parity with upstream)
new files: src/voice/{types,platform,useVoice,Indicator}.tsx
modified: app.tsx, gatewayEvents.ts, useAppKeys.ts, gateway-types.ts
status.update/kind=process events fire per terminal(background=true)
completion. when many finish in quick succession (builds, parallel
tests), each dispatches a {kind:system} action that triggers a full
Chat re-render -- causing visible TUI lag.
route process events through a 500ms debounced accumulator. rapid
completions coalesce into one combined system message.
events.ts: add onProcessNotification to Side callback type
useStream.ts: procs ref accumulates texts, flushProcs batches + dispatches
fix: debounce process notification events in TUI
Contributor
|
🎉 This PR is included in version 1.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Chat & composer
prompt.submitpayload is unchanged. (Composer: extmark-backed parts model #73)▶ Nindicator in the composer status bar while/backgroundtasks are running; clears as each task completes. (Composer: show ▶ N indicator while background tasks run #74)/voicereports the record key. (fix: debounce process notification events in TUI #71)Security
openUrlopener: http(s)-only protocol allowlist, argv spawn with no shell, per-platform handlers, and crash-safe error handling for missing openers. Groundwork for clickable URLs in chat. (Harden open-file: protocol allowlist + safe spawn for URLs #72)Tests
bunx tsc --noEmitclean ·bun run buildclean