Repository navigation
feat(pip): share prompt excerpts from local OpenCode sessions - #335
Merged
Merged
Conversation
With Share submitted prompts on, Pip could only quote local Claude and Codex prompts. OpenCode sessions were quip subjects with activity only. Local OpenCode sessions now contribute the same bounded excerpt, so all three first-class CLIs get the same outcome. The excerpt comes from OpenCode's own database, which native usage has already attributed to the session, opened read-only. It takes two bounded, indexed queries: the newest user message from the past five minutes, then that message's text parts. Synthetic parts (OpenCode's reminders and attachments) and non-text parts are skipped, and only typed scalars leave SQLite. The same 400-character limit and scrubbing apply, now shared as scrubPromptExcerpt. `opencode export` was considered and rejected: it serialises the whole session (1.5 MB for a 101-message session here) and runs CLI middleware first, just to read one prompt. SSH and Coder sessions, Copilot and Custom still share activity only. The prompt routing moves into readSessionPrompt, and readRecentPrompt loses its existing Sonar warnings along the way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st attempt Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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.



Pip plan PR 7, plus the Sonar follow-up for #334, which merged before its fix commit landed.
OpenCode prompt excerpts
With Share submitted prompts on, local OpenCode sessions now give Pip the same bounded excerpt as Claude and Codex.
usageService.getLocalOpenCodeDatabase).message_session_time_created_id_idx); the second reads that message's text parts (at most 50, 4000 characters each). Synthetic parts (OpenCode's reminders and attachments) and non-text parts are skipped, and only typed scalars leave SQLite.scrubPromptExcerpt.opencode export: it serialises the whole session (1.5 MB for a 101-message session here) and runs CLI middleware first.readSessionPromptinpip-handlers.ts.readRecentPromptloses its existing Sonar warnings (complexity, misleadingreverse, nested ternary, a duplicate character class under theiflag).Live check against the real DB on OpenCode 1.19.5: the newest prompt came back in 3 ms, and the same read with the real clock returned null because the prompt was stale.
#334 follow-up
<output>replacesrole="status"in two places (S6819), and the last attempt is read with.at(-1)(S7755).Docs
src/docs/settings.md(Share submitted prompts) anddocs/ARCHITECTURE.md. The panel help text now names OpenCode.Tests
New: OpenCode excerpt tests against a temporary SQLite DB, covering session isolation, synthetic and non-text parts, stale and malformed rows, bounds, and no writes. Also handler routing for OpenCode, remote, Copilot and Custom (these use
helloso the cooldown can't hide a call), and the usage-service accessor. Fullvitestpasses (2797) andtsc --noEmitis clean. Lint is clean on the changed Pip files.🤖 Generated with Claude Code