@khalilgharbaoui/opencode-claude-code-plugin 0.15.1 → 0.15.3
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/README.md +25 -7
- package/dist/index.d.ts +13 -1
- package/dist/index.js +2929 -2563
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -514,20 +514,38 @@ If Claude nevertheless abandons the HTTP call, the plugin preserves narration em
|
|
|
514
514
|
|
|
515
515
|
## Side questions with /btw
|
|
516
516
|
|
|
517
|
-
After a normal Claude Code turn,
|
|
517
|
+
After a normal Claude Code turn, at any time, including while Claude is still working:
|
|
518
518
|
|
|
519
519
|
```text
|
|
520
520
|
/btw Why did you choose that approach?
|
|
521
521
|
```
|
|
522
522
|
|
|
523
|
-
The plugin registers the command without replacing an existing user-defined `btw` command.
|
|
523
|
+
The plugin registers the command without replacing an existing user-defined `btw` command. The question goes to Claude Code's native `side_question` control protocol on the conversation's live process, using the same model, account, and context. Claude Code answers it on a separate call, concurrently with whatever the main turn is doing. Claude never sees the aside afterwards: the question never enters Claude Code's own transcript, and the plugin keeps every `/btw` exchange out of the prompt it sends the model.
|
|
524
|
+
|
|
525
|
+
Where the answer appears, in the conversation either way:
|
|
526
|
+
|
|
527
|
+
- **A receipt, straight away**, when you asked while a turn was running, in the reply you are watching, so a `/btw` typed mid-turn is visibly taken rather than looking swallowed until the answer arrives:
|
|
528
|
+
|
|
529
|
+
```text
|
|
530
|
+
▌ **btw:** <your question, in full>
|
|
531
|
+
▌ *sent to Claude on the side*
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
It quotes the question back untruncated because the prompt box clears on submit and no `/btw` message is ever created, so this is the only place you can read back what you sent. If opencode is between two streams at that moment (it was running a tool), the receipt lands when the next one opens.
|
|
535
|
+
- **Inside the running turn's own reply**, as soon as the answer arrives, when you asked while Claude was working. It is written into the reply you are already watching as its own block, headed `▌ **btw:** <your question>`, so it stays there and is easy to pick out. Every line of the aside, answer included, carries that `▌` bar, so it reads as one block down its whole height. Nothing is queued and the `/btw` message itself is dropped, because the answer is already in the transcript. The turn goes on to deliver its own reply as usual.
|
|
536
|
+
- **As its own `/btw` message and answer** when the conversation is idle, or when the turn had no stream open to write into at that moment (opencode was running a tool between two of them). In the second case the pair lands when the turn ends; nothing is announced in the meantime, because the answer itself is what arrives.
|
|
537
|
+
- Follow-ups work: earlier asides in the conversation are sent along as the aside's history.
|
|
538
|
+
|
|
539
|
+
Notes:
|
|
524
540
|
|
|
525
541
|
- Requires Claude Code CLI **2.1.258 or newer**, the oldest verified version.
|
|
526
|
-
- Requires
|
|
527
|
-
-
|
|
528
|
-
-
|
|
529
|
-
- The control response has no
|
|
530
|
-
-
|
|
542
|
+
- Requires a live **headless** process for the conversation. Send a normal message with a Claude Code model first if the process has not started or was evicted; the answer in the transcript tells you when that is the case. Interactive transport is not supported.
|
|
543
|
+
- Asking immediately after starting a turn is fine. The conversation's process only exists once that turn reaches the model, so `/btw` waits for it (up to 30 seconds) instead of falling back to being queued. If no Claude Code process turns up in that window, because the running turn belongs to another provider, the question is answered when the turn ends.
|
|
544
|
+
- One aside per conversation at a time. A second `/btw` while one is in flight is asked once the turn ends.
|
|
545
|
+
- An aside costs nothing in opencode's counters: a `/btw` pair reports 0 tokens and $0, and a block written into a running turn adds nothing to that turn's usage. The control response has no usage fields, so aside usage is not counted anywhere; this does not mean the request is free.
|
|
546
|
+
- An aside written into a turn is marked, and the plugin strips it again if the conversation ever has to be replayed into a fresh Claude Code process. It was never Claude's own output.
|
|
547
|
+
- A request times out after two minutes. Abort and timeout cancel that side request without killing the main session. If the running turn is still not over after 30 minutes, the plugin gives up on that `/btw`; ask again once the turn ends.
|
|
548
|
+
- The answer is never delivered as a notification: it always lands in the conversation, where it stays. The only two toasts left are the cases where nothing reaches the conversation at all, a bare `/btw` (which shows the usage text) and a turn that ran past the 30 minute wait.
|
|
531
549
|
|
|
532
550
|
Fully restart opencode after upgrading to load the command and runtime changes. Other providers do not gain Claude's native side-question behavior from this command.
|
|
533
551
|
|
package/dist/index.d.ts
CHANGED
|
@@ -138,6 +138,13 @@ type OpenCodeHooks = {
|
|
|
138
138
|
event: OpenCodeEvent;
|
|
139
139
|
}) => Promise<void>;
|
|
140
140
|
"chat.params"?: (input: OpenCodeChatParamsInput, output: OpenCodeChatParamsOutput) => Promise<void>;
|
|
141
|
+
"command.execute.before"?: (input: {
|
|
142
|
+
command: string;
|
|
143
|
+
sessionID: string;
|
|
144
|
+
arguments: string;
|
|
145
|
+
}, output: {
|
|
146
|
+
parts: unknown[];
|
|
147
|
+
}) => Promise<void>;
|
|
141
148
|
};
|
|
142
149
|
type OpenCodePlugin = (input: unknown, options?: Record<string, unknown>) => Promise<OpenCodeHooks>;
|
|
143
150
|
|
|
@@ -720,7 +727,12 @@ interface ClaudeCodeProvider {
|
|
|
720
727
|
languageModel(modelId: string): LanguageModelV3;
|
|
721
728
|
}
|
|
722
729
|
declare const DEFAULT_PROXY_TOOL_NAMES: string[];
|
|
723
|
-
|
|
730
|
+
/**
|
|
731
|
+
* Registers `/btw` unless the user defined their own. Returns whether the
|
|
732
|
+
* registration is ours: the command hook only intercepts `btw` in that case,
|
|
733
|
+
* so a user-defined command keeps opencode's normal behaviour end to end.
|
|
734
|
+
*/
|
|
735
|
+
declare function registerSideQuestionCommand(config: OpenCodeConfig): boolean;
|
|
724
736
|
declare function createClaudeCode(settings?: ClaudeCodeProviderSettings): ClaudeCodeProvider;
|
|
725
737
|
/**
|
|
726
738
|
* Build models in OpenCode's config schema format (flat properties like
|