@khalilgharbaoui/opencode-claude-code-plugin 0.51.0 → 0.53.0

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/dist/index.d.ts CHANGED
@@ -399,6 +399,10 @@ interface ClaudeCodeConfig {
399
399
  * that has already been validated and warned about (h #g226).
400
400
  */
401
401
  accountGroups?: AccountGroups | null;
402
+ /** See `ClaudeCodeProviderSettings.subagentDispatch`. */
403
+ subagentDispatch?: SubagentDispatchMode;
404
+ /** See `ClaudeCodeProviderSettings.subagentDispatchCrossGroup`. */
405
+ subagentDispatchCrossGroup?: boolean;
402
406
  providerID?: string;
403
407
  skipPermissions?: boolean;
404
408
  /**
@@ -492,6 +496,8 @@ type WebSearchRouting = "claude" | "disabled" | (string & {});
492
496
  * behaviour, where the turn ends with the rate-limit error.
493
497
  */
494
498
  type AccountFailoverMode = "ask" | "off";
499
+ /** `subagentDispatch`. Unset behaves as `"off"`; see the option's own note. */
500
+ type SubagentDispatchMode = "ask" | "off";
495
501
  interface ClaudeCodeProviderSettings {
496
502
  cliPath?: string;
497
503
  /** Internal: set by the opencode 2 entrypoint. See `ClaudeCodeConfig.hostApi`. */
@@ -569,6 +575,35 @@ interface ClaudeCodeProviderSettings {
569
575
  * `/claude-code-doctor`, names only.
570
576
  */
571
577
  accountGroups?: Record<string, string>;
578
+ /**
579
+ * Ask, before a proxied `task` or `task_batch` dispatch reaches opencode,
580
+ * how the subagents it is about to start should run: which model, which
581
+ * reasoning effort, and which Claude account.
582
+ *
583
+ * `"off"` by default, and unset behaves as `"off"`: with it unset the
584
+ * dispatch is handed to opencode exactly as it is today, no form is raised
585
+ * and nothing is recorded.
586
+ *
587
+ * With `"ask"`, the dispatch is held, the operator gets one question (so the
588
+ * common answer is one click: `Default`, or `Same as last time`), and only
589
+ * then are the real `task` calls released, inside the same opencode turn.
590
+ * `Customise…` opens a second form with one row per agent type, and a row
591
+ * can ask for a third form with one row per task. Dismissing any of them
592
+ * dispatches with the defaults and says so; the dispatch is never lost.
593
+ *
594
+ * See `docs/configuration/subagents.md` and `src/subagent-dispatch.ts`.
595
+ */
596
+ subagentDispatch?: SubagentDispatchMode;
597
+ /**
598
+ * Let the dispatch form offer Claude accounts outside the dispatching
599
+ * account's own `accountGroups` group. **False by default, and never
600
+ * implied**: a subagent is handed the task text the main agent writes, which
601
+ * can quote the conversation, and it reads the repository, so offering
602
+ * another group is offering that group the conversation by another route.
603
+ * Does nothing when `accountGroups` is unset, where every account is already
604
+ * one group.
605
+ */
606
+ subagentDispatchCrossGroup?: boolean;
572
607
  /**
573
608
  * Model that subagents run on when their own definition pins nothing.
574
609
  * Unset means no implicit override at all, so an agent keeps inheriting the
@@ -1347,6 +1382,17 @@ declare class ClaudeCodeLanguageModel implements LanguageModelV3 {
1347
1382
  private skillBridgeSpawn;
1348
1383
  /** Share one lazy registry request within a turn without making it stale. */
1349
1384
  private createLiveToolInfoLoader;
1385
+ /**
1386
+ * What a subagent dispatch form chose for THIS session, or undefined.
1387
+ *
1388
+ * Two lookups, cheapest first. A session that already claimed a choice keeps
1389
+ * it for the rest of its life, because the model and effort are in its
1390
+ * session key and a choice that came and went mid-conversation would strand
1391
+ * the key behind it. Otherwise, and only when a released dispatch actually
1392
+ * recorded a claim this session could match, the parent is fetched and the
1393
+ * claim taken: a choice must never land on the wrong child (h #g227).
1394
+ */
1395
+ private resolveDispatchChoice;
1350
1396
  /**
1351
1397
  * Whether the ExitPlanMode approval bridge is live for this turn: the
1352
1398
  * operator opted in AND opencode's registry actually has the `question`
@@ -1354,6 +1400,26 @@ declare class ClaudeCodeLanguageModel implements LanguageModelV3 {
1354
1400
  * `⚙ invalid` and wedge the turn, so the plugin keeps the text path.
1355
1401
  */
1356
1402
  private resolvePlanModeQuestion;
1403
+ /**
1404
+ * A dispatch form, as a turn: one synthetic `question` tool call and a
1405
+ * `tool-calls` finish, which is how the operator's answer comes back on the
1406
+ * next `doStream` as a `tool-result` with the same id. The same mechanism
1407
+ * `finishWithQuestionCall` gives the plan-approval bridge and the
1408
+ * account-switch form, minus a Claude process, because there is nothing for
1409
+ * the CLI to do while the operator reads a form.
1410
+ */
1411
+ private subagentDispatchFormStream;
1412
+ /**
1413
+ * The release: the dispatch the form was holding, handed to opencode as the
1414
+ * `task` tool calls it would have been without the form, with every task's
1415
+ * answer recorded as a claim its child will take.
1416
+ *
1417
+ * A held call that is gone (its deadline, an abort, the child dying while
1418
+ * the form was up) is skipped rather than invented, and with every call gone
1419
+ * the turn finishes on `stop`: there is nothing left to dispatch and ending
1420
+ * on `tool-calls` with no tool calls is a protocol violation.
1421
+ */
1422
+ private subagentDispatchReleaseStream;
1357
1423
  /**
1358
1424
  * Create a proxy MCP server for a single active Claude process/session.
1359
1425
  * The process lifecycle owns the server lifecycle via session-manager.