wings-plugin-sdk 0.9.0 → 0.11.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/package.json +1 -1
  2. package/wings.d.ts +36 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wings-plugin-sdk",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "The wings API types, the page frame, React hooks and the build command for Wings plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/wings.d.ts CHANGED
@@ -41,6 +41,14 @@ interface WingsBadge {
41
41
  actions?: { id: string; label: string; primary?: boolean }[];
42
42
  }
43
43
 
44
+ /** Where the diff viewer scrolls to and highlights once the patch is shown. A path or line the patch doesn't have just opens the diff. */
45
+ interface WingsDiffFocus {
46
+ path: string;
47
+ line?: number;
48
+ /** `new` (the default) counts lines after the change, `old` before it. */
49
+ side?: "old" | "new";
50
+ }
51
+
44
52
  interface WingsComment {
45
53
  id: number;
46
54
  replyTo: number | null;
@@ -128,7 +136,8 @@ interface Wings {
128
136
  onPanes(listener: (panes: WingsPane[]) => void): () => void;
129
137
  /**
130
138
  * Whether the user is in Wings: true while any Wings window (the main one or a view window) is in front, false
131
- * while another app is. Called once with the current state, then on each change. Needs no permission. Pause timers
139
+ * while another app is. In a block on a Project page it is also false while the block is out of view or its tab is hidden.
140
+ * Called once with the current state, then on each change. Needs no permission. Pause timers
132
141
  * while it is false and check once when it turns true, or use `pollWhileFocused` from `wings-plugin-sdk/poll`.
133
142
  */
134
143
  onFocus(listener: (event: { focused: boolean }) => void): () => void;
@@ -144,7 +153,7 @@ interface Wings {
144
153
  * is sent back as a failed call. `paneId` is the Wings pane Claude runs in, or `null`. Register it in `main`.
145
154
  */
146
155
  onTool(name: string, handler: (input: Record<string, unknown>, context: { paneId: string | null }) => unknown): void;
147
- /** Runs a command from `permissions.exec`, like `git branch --show-current`. */
156
+ /** Runs a command from `permissions.exec`, like `git branch --show-current`. Rejects with `Output is larger than 8 MB` (and kills the program) when stdout or stderr passes 8 MB. */
148
157
  exec(program: string, args?: string[], options?: WingsExecOptions): Promise<{ code: number | null; stdout: string; stderr: string }>;
149
158
  /**
150
159
  * Needs `permissions.statusline`. What Claude Code last told its status line, once `wings statusline` is your
@@ -186,9 +195,9 @@ interface Wings {
186
195
  /** Needs `permissions.notify`. A desktop notification, up to 3 a minute. The title is cut at 64 characters, the body at 256. */
187
196
  notify(notification: { title: string; body?: string }): Promise<void>;
188
197
  /** Needs `"diff"` in `contributes.ui`. Leave out `patch` to open it loading, then call `updateDiff`. */
189
- openDiff(diff: { title: string; subtitle?: string; /** The repo or folder the diff is of, so Send to agent offers the agent working there first. */ cwd?: string; patch?: string; comments?: WingsComment[] }): Promise<{ id: string }>;
198
+ openDiff(diff: { title: string; subtitle?: string; /** The repo or folder the diff is of, so Send to agent offers the agent working there first. */ cwd?: string; patch?: string; comments?: WingsComment[]; focus?: WingsDiffFocus }): Promise<{ id: string }>;
190
199
  /** Updates a viewer opened with `openDiff`; ignored once it's closed. `{ comments }` alone keeps the patch, like after a reply. */
191
- updateDiff(id: string, update: { patch: string; comments?: WingsComment[] } | { comments: WingsComment[] } | { error: string }): Promise<void>;
200
+ updateDiff(id: string, update: { patch: string; comments?: WingsComment[]; focus?: WingsDiffFocus } | { comments: WingsComment[]; focus?: WingsDiffFocus } | { error: string }): Promise<void>;
192
201
  /**
193
202
  * Needs `"diff"` in `contributes.ui`. A reply typed under a comment with `canReply` in the diff viewer. Post it,
194
203
  * then add it with `updateDiff`. The reply box waits for the returned promise, and a thrown error shows under it
@@ -197,7 +206,8 @@ interface Wings {
197
206
  onReply(handler: (reply: WingsReply) => unknown): void;
198
207
  /**
199
208
  * POSTs `fields` (string or whole-number values, up to 64 KB) as JSON to a `permissions.post` path, as you:
200
- * `gh api`, `glab api` against `host`, or `az rest` for Azure DevOps. Wings builds the command itself.
209
+ * `gh api` (against `host` for a GitHub Enterprise Server), `glab api` against `host`, or `az rest` for Azure
210
+ * DevOps. Wings builds the command itself. A manifest entry may pin a field, like `{event=APPROVE}`.
201
211
  */
202
212
  post(
203
213
  program: "gh" | "glab" | "az",
@@ -206,7 +216,8 @@ interface Wings {
206
216
  options?: { host?: string },
207
217
  ): Promise<{ code: number | null; stdout: string; stderr: string }>;
208
218
  /**
209
- * An HTTP request to a URL under `permissions.fetch`, made by Wings. `bearer` names a secret that Wings sends
219
+ * An HTTP request to a URL under `permissions.fetch`, made by Wings. An entry may be `GET <prefix>`, or
220
+ * `POST <url with * segments>` (optionally `{field=value}`) for one write with a JSON `body`. `bearer` names a secret that Wings sends
210
221
  * as `Authorization: Bearer <secret>`. Resolves for any status; redirects aren't followed.
211
222
  */
212
223
  fetch(
@@ -246,11 +257,11 @@ interface Wings {
246
257
  */
247
258
  openView(id: string, options?: { as?: "sidebar" | "modal" | "window" | "tab"; args?: unknown }): Promise<void>;
248
259
  /** Where this page shows. `null` in the plugin's main script. Needs Wings 0.1.22. */
249
- placement(): "sidebar" | "tab" | "modal" | "window" | null;
260
+ placement(): "sidebar" | "tab" | "modal" | "window" | "block" | null;
250
261
  /** What `openView` passed as `args` when it opened this tab, or `null`. Available at once. Needs Wings 0.1.22. */
251
262
  viewArgs<T = unknown>(): T | null;
252
263
  /**
253
- * The project this page is about, or `null` when none is open. A tab page's project is the one the tab belongs to
264
+ * The project this page is about, or `null` when none is open. A tab page's or block's project is the one it belongs to
254
265
  * and never changes; any other page gets the project on screen. Needs Wings 0.1.22.
255
266
  */
256
267
  project(): Promise<WingsProject | null>;
@@ -280,6 +291,23 @@ interface Wings {
280
291
  * unloaded. Rejects outside a tab or when the state is too big. Needs Wings 0.1.22.
281
292
  */
282
293
  setTabState(state: unknown): Promise<void>;
294
+ /**
295
+ * In a block on a Project page, `contributes.blocks`: the state it last saved with `setBlockState`, or `null`. Outside a
296
+ * block it is `null`. Needs Wings 0.1.24.
297
+ */
298
+ blockState<T = unknown>(): Promise<T | null>;
299
+ /**
300
+ * In a block: saves JSON state, up to 16 KB, on the block, like which board or filter it shows. Wings keeps it with the
301
+ * Project page across restarts and while the block is unloaded. Rejects outside a block or when the state is too big.
302
+ * Needs Wings 0.1.24.
303
+ */
304
+ setBlockState(state: unknown): Promise<void>;
305
+ /**
306
+ * In a block: asks for a height in CSS pixels. Wings rounds it and clamps it to the block's `minHeight` (default 160)
307
+ * up to 1200, and applies it without reloading the page. Call it when the content's height changes: asking for the
308
+ * height already asked for does nothing, and calls in the same tick send only the last. Throws outside a block. Needs Wings 0.1.24.
309
+ */
310
+ setHeight(px: number): void;
283
311
  /** Closes a sidebar or view wherever it's open. */
284
312
  closeView(id: string): Promise<void>;
285
313
  /** Opens Wings Settings at the plugin's settings page, `contributes.settings`. Wings 0.1.15 and newer. */