@opencode/plugin 0.0.0-dev-197 → 0.0.0-dev-201

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.
@@ -127,6 +127,38 @@ export interface SessionRetry {
127
127
  readonly attempt: number;
128
128
  decision: SessionRetryDecision;
129
129
  }
130
+ /**
131
+ * Background work still running for the idle Session or one of its descendants. `sessionID` is
132
+ * the Session that owns the job: the idle Session itself, or a descendant such as a subagent child.
133
+ */
134
+ export type SessionIdleBackground = {
135
+ readonly kind: "shell";
136
+ readonly sessionID: Session.ID;
137
+ readonly shellID: string;
138
+ readonly command: string;
139
+ } | {
140
+ readonly kind: "subagent";
141
+ readonly sessionID: Session.ID;
142
+ readonly childSessionID: Session.ID;
143
+ readonly agent: string;
144
+ readonly description: string;
145
+ };
146
+ /**
147
+ * Runs when a Session finishes model work and has no pending input, just before it goes idle.
148
+ * It does not run after interruption, failure, or control-only work such as a manual compaction.
149
+ * Input admitted by the hook, such as a synthetic message, runs in the same execution instead
150
+ * of the Session going idle.
151
+ *
152
+ * `background` lists work that is still running. When the Session's own shell or subagent finishes,
153
+ * its notice wakes the Session and the hook runs again, so a plugin that waits for that work can
154
+ * simply return. Work a descendant owns, such as a shell a subagent left running, wakes that
155
+ * descendant instead, so it is listed for information only. Notices admitted with `resume: false`,
156
+ * such as those recovered after a restart, wait for the next wake. Experimental.
157
+ */
158
+ export interface SessionIdle {
159
+ readonly sessionID: Session.ID;
160
+ readonly background: ReadonlyArray<SessionIdleBackground>;
161
+ }
130
162
  export interface SessionHooks {
131
163
  readonly prompt: SessionPrompt;
132
164
  readonly context: SessionContext;
@@ -140,6 +172,7 @@ export interface SessionHooks {
140
172
  readonly "experimental.ws.send": SessionWebSocketSend;
141
173
  readonly "experimental.ws.receive": SessionWebSocketReceive;
142
174
  readonly retry: SessionRetry;
175
+ readonly "experimental.idle": SessionIdle;
143
176
  }
144
177
  export type SessionDomain = Pick<SessionApi<unknown>, "list" | "create" | "get" | "remove" | "switchAgent" | "switchModel" | "prompt" | "generate" | "command" | "compact" | "synthetic" | "interrupt" | "update" | "move" | "context"> & Pick<ExperimentalSessionApi<unknown>, "wait" | "instructions"> & {
145
178
  readonly hook: ModelHooks<SessionHooks>;
@@ -591,6 +591,11 @@ export interface ComposerPillRow {
591
591
  /** Runs when the user picks the row. Omit it for a row that only shows. */
592
592
  run?(): void;
593
593
  }
594
+ /** What a composer pill's `menu` receives: the pill's session and a way to close the popover. Do not destructure. */
595
+ export interface ComposerPillMenuProps extends ComposerPillProps {
596
+ /** Closes the popover, for example after the user picks an action in it. Does nothing once it is closed. */
597
+ close(): void;
598
+ }
594
599
  /** What a composer pill shows above one session's composer. */
595
600
  export interface ComposerPillView {
596
601
  /** The capsule's text; long text truncates. */
@@ -599,11 +604,14 @@ export interface ComposerPillView {
599
604
  readonly icon?: IconName;
600
605
  /** Colors the capsule's icon. */
601
606
  readonly tone?: ComposerPillTone;
602
- /** Accessible name, and the heading of the menu the pill opens, when it differs from `label`. */
607
+ /**
608
+ * Accessible name, and the heading of the menu or popover the pill opens, when it differs from `label`. The heading
609
+ * wraps to at most three lines, then truncates.
610
+ */
603
611
  readonly title?: string;
604
- /** The menu the pill opens. Omit it for a pill that runs `run` instead. */
612
+ /** The menu the pill opens. Omit it for a pill that runs `run` instead. Unused when the pill has a `menu`. */
605
613
  readonly rows?: readonly ComposerPillRow[];
606
- /** Runs when the user clicks a pill without `rows`. */
614
+ /** Runs when the user clicks a pill without `rows` or a `menu`. */
607
615
  run?(): void;
608
616
  }
609
617
  /**
@@ -623,6 +631,16 @@ export interface ComposerPill {
623
631
  * @param input - The session and its screen. Do not destructure.
624
632
  */
625
633
  show(input: ComposerPillProps): ComposerPillView | undefined;
634
+ /**
635
+ * Your content for the popover the pill opens, for a pill that needs more than `rows`, such as status text and
636
+ * buttons. The host owns the capsule and the popover around this content: its placement, focus, dismissal, and the
637
+ * heading (`title`, else `label`). When set, clicking the pill opens the popover, and the view's `rows` and `run` are
638
+ * unused. Renders each time the popover opens; its own reactivity updates it while open, also when another session is
639
+ * routed. A render that throws renders nothing and records the error.
640
+ *
641
+ * @param input - The session, its screen, and `close`. Do not destructure.
642
+ */
643
+ menu?(input: ComposerPillMenuProps): JSX.Element;
626
644
  }
627
645
  /** The places a `Slot` renders, with the input each passes to `render`. */
628
646
  export interface SlotMap {
@@ -127,6 +127,38 @@ export interface SessionRetry {
127
127
  readonly attempt: number;
128
128
  decision: SessionRetryDecision;
129
129
  }
130
+ /**
131
+ * Background work still running for the idle Session or one of its descendants. `sessionID` is
132
+ * the Session that owns the job: the idle Session itself, or a descendant such as a subagent child.
133
+ */
134
+ export type SessionIdleBackground = {
135
+ readonly kind: "shell";
136
+ readonly sessionID: Session.ID;
137
+ readonly shellID: string;
138
+ readonly command: string;
139
+ } | {
140
+ readonly kind: "subagent";
141
+ readonly sessionID: Session.ID;
142
+ readonly childSessionID: Session.ID;
143
+ readonly agent: string;
144
+ readonly description: string;
145
+ };
146
+ /**
147
+ * Runs when a Session finishes model work and has no pending input, just before it goes idle.
148
+ * It does not run after interruption, failure, or control-only work such as a manual compaction.
149
+ * Input admitted by the hook, such as a synthetic message, runs in the same execution instead
150
+ * of the Session going idle.
151
+ *
152
+ * `background` lists work that is still running. When the Session's own shell or subagent finishes,
153
+ * its notice wakes the Session and the hook runs again, so a plugin that waits for that work can
154
+ * simply return. Work a descendant owns, such as a shell a subagent left running, wakes that
155
+ * descendant instead, so it is listed for information only. Notices admitted with `resume: false`,
156
+ * such as those recovered after a restart, wait for the next wake. Experimental.
157
+ */
158
+ export interface SessionIdle {
159
+ readonly sessionID: Session.ID;
160
+ readonly background: ReadonlyArray<SessionIdleBackground>;
161
+ }
130
162
  export interface SessionHooks {
131
163
  readonly prompt: SessionPrompt;
132
164
  readonly context: SessionContext;
@@ -140,6 +172,7 @@ export interface SessionHooks {
140
172
  readonly "experimental.ws.send": SessionWebSocketSend;
141
173
  readonly "experimental.ws.receive": SessionWebSocketReceive;
142
174
  readonly retry: SessionRetry;
175
+ readonly "experimental.idle": SessionIdle;
143
176
  }
144
177
  export type SessionDomain = Pick<SessionApi, "list" | "create" | "get" | "remove" | "switchAgent" | "switchModel" | "prompt" | "generate" | "command" | "compact" | "synthetic" | "interrupt" | "update" | "move" | "context"> & Pick<ExperimentalSessionApi, "wait" | "instructions"> & {
145
178
  readonly hook: ModelHooks<SessionHooks>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/plugin",
4
- "version": "0.0.0-dev-197",
4
+ "version": "0.0.0-dev-201",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -78,15 +78,15 @@
78
78
  ],
79
79
  "dependencies": {
80
80
  "@ai-sdk/provider": "3.0.8",
81
- "@opencode/ai": "0.0.0-dev-197",
82
- "@opencode/client": "0.0.0-dev-197",
83
- "@opencode/protocol": "0.0.0-dev-197",
84
- "@opencode/schema": "0.0.0-dev-197",
85
- "@opencode/util": "0.0.0-dev-197",
81
+ "@opencode/ai": "0.0.0-dev-201",
82
+ "@opencode/client": "0.0.0-dev-201",
83
+ "@opencode/protocol": "0.0.0-dev-201",
84
+ "@opencode/schema": "0.0.0-dev-201",
85
+ "@opencode/util": "0.0.0-dev-201",
86
86
  "effect": "4.0.1"
87
87
  },
88
88
  "peerDependencies": {
89
- "@opencode/theme": "0.0.0-dev-197",
89
+ "@opencode/theme": "0.0.0-dev-201",
90
90
  "@opentui/core": "0.7.0",
91
91
  "@opentui/solid": "0.7.0",
92
92
  "electron": "*",
@@ -118,7 +118,7 @@
118
118
  }
119
119
  },
120
120
  "devDependencies": {
121
- "@opencode/theme": "0.0.0-dev-197",
121
+ "@opencode/theme": "0.0.0-dev-201",
122
122
  "@opentui/core": "0.7.0",
123
123
  "@opentui/solid": "0.7.0",
124
124
  "@tsconfig/bun": "1.0.9",