@t3mode/plugin-sdk 1.4.0 → 1.5.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +44 -0
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -142,6 +142,48 @@ export interface PluginDefinition<O extends OptionsSpec = OptionsSpec> {
142
142
  }
143
143
  /** Returns the definition unchanged, typing `api.options` from `options`. */
144
144
  export declare const definePlugin: <const O extends OptionsSpec>(definition: PluginDefinition<O>) => PluginDefinition<O>;
145
+ /** What the desktop indicator shows. t3mode draws it from its own template: no plugin code runs in it. */
146
+ export interface IndicatorModel {
147
+ /** Such as "Claude · Book a flight". Capped at 160 characters, ellipsised. */
148
+ readonly label: string;
149
+ /** Such as "wait 500 ms". Capped at 160 characters. */
150
+ readonly detail: string | null;
151
+ }
152
+ /** A rectangle in physical desktop pixels, the space input coordinates use. */
153
+ export interface ScreenRect {
154
+ readonly x: number;
155
+ readonly y: number;
156
+ readonly width: number;
157
+ readonly height: number;
158
+ }
159
+ /** One shown indicator. t3mode keeps proving it is painted; the plugin only reads the result. */
160
+ export interface DrivingIndicator {
161
+ /**
162
+ * Aborts once. `reason.message` is "stop" when the user pressed its Stop button, and
163
+ * "unavailable" when it was lost or its proof expired. Never aborts on close().
164
+ */
165
+ readonly signal: AbortSignal;
166
+ /** True while not closed, not aborted, and painted in the last 3 seconds. */
167
+ readonly live: () => boolean;
168
+ /** The whole window, from the first proof. Fixed for the handle's life: a move revokes it. */
169
+ readonly rect: ScreenRect;
170
+ /** Changes the detail line. Does not renew presence. */
171
+ readonly setDetail: (detail: string | null) => void;
172
+ /**
173
+ * Idempotent. live() is false at once, then t3mode destroys the window. A pill stopped by the
174
+ * user shows "Stopping…" until this is called.
175
+ */
176
+ readonly close: () => void;
177
+ }
178
+ /** A pill with a Stop button above every app, for a backend that drives the desktop. */
179
+ export interface BackendIndicator {
180
+ /**
181
+ * Shows the pill. Resolves on its first paint proof. Rejects after 3000 ms without one, when
182
+ * the user stops it first, when no T3 Code window is open, or while a shown handle is not
183
+ * closed yet. A handle lost as "unavailable" closes itself.
184
+ */
185
+ readonly show: (model: IndicatorModel) => Promise<DrivingIndicator>;
186
+ }
145
187
  /** What a backend's `start` gets. Added in SDK 1.4.0. */
146
188
  export interface BackendApi {
147
189
  /** The id from the plugin's manifest.json. */
@@ -157,6 +199,8 @@ export interface BackendApi {
157
199
  readonly onMessage: (callback: (data: unknown) => void) => void;
158
200
  /** A line in `<home>/logs/plugins/<id>.log`, where the backend's stdout and stderr go too. */
159
201
  readonly log: (level: LogLevel, message: string) => void;
202
+ /** The desktop indicator. Added in SDK 1.5.0, so check for it before calling. */
203
+ readonly indicator?: BackendIndicator;
160
204
  }
161
205
  export interface BackendDefinition {
162
206
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t3mode/plugin-sdk",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "definePlugin and the plugin API types for t3mode, the plugin loader for T3 Code",
5
5
  "license": "MIT",
6
6
  "repository": {