wings-plugin-sdk 0.7.0 → 0.8.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 +5 -5
  2. package/wings.d.ts +36 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wings-plugin-sdk",
3
- "version": "0.7.0",
3
+ "version": "0.8.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",
@@ -26,9 +26,6 @@
26
26
  "default": "./build.mjs"
27
27
  }
28
28
  },
29
- "scripts": {
30
- "test": "node --test"
31
- },
32
29
  "bin": {
33
30
  "wings-plugin": "bin.mjs"
34
31
  },
@@ -72,5 +69,8 @@
72
69
  "react": "^19.1.0",
73
70
  "react-dom": "^19.1.0",
74
71
  "typescript": "~6.0.3"
72
+ },
73
+ "scripts": {
74
+ "test": "node --test"
75
75
  }
76
- }
76
+ }
package/wings.d.ts CHANGED
@@ -11,6 +11,8 @@ interface WingsPane {
11
11
  /** What runs in the pane right now, like `zsh` or `claude`. */
12
12
  command: string;
13
13
  project: string;
14
+ /** The id of that project, the same as `project().id`. Needs Wings 0.1.22. */
15
+ projectId: string;
14
16
  /** Set while Claude Code runs in the pane. `startedAt` is when that `claude` started, in ms; a resumed session's transcript also has what came before. */
15
17
  session: { sessionId: string; name: string | null; state: string; startedAt: number } | null;
16
18
  /** The focused pane of the tab on screen. At most one pane has it, and none while no tab is open. */
@@ -98,6 +100,14 @@ interface WingsExecOptions {
98
100
  onOutput?: (line: string) => void;
99
101
  }
100
102
 
103
+ /** A project (space) as pages see it. */
104
+ interface WingsProject {
105
+ id: string;
106
+ name: string;
107
+ path: string;
108
+ branch: string | null;
109
+ }
110
+
101
111
  interface Wings {
102
112
  // Every `on*` call returns a function that removes the listener, for cleaning up in a React effect.
103
113
  /** Every terminal pane, on every change. */
@@ -215,8 +225,33 @@ interface Wings {
215
225
  * in a window of its own or as a tab in the project on screen (`tab` needs Wings 0.1.15). `as` must be in the
216
226
  * view's `opens`, and defaults to the first. A window or tab that's already open comes to the front. The page
217
227
  * gets the same `wings` object wherever it opens.
228
+ *
229
+ * `args` (JSON, up to 16 KB, only with `as: "tab"`) is what the tab's page reads with `viewArgs`. A tab that's
230
+ * already open with other args takes the new ones, drops its saved tab state and reloads; a view with `"multiple": true` always opens a
231
+ * new tab. Needs Wings 0.1.22.
232
+ */
233
+ openView(id: string, options?: { as?: "sidebar" | "modal" | "window" | "tab"; args?: unknown }): Promise<void>;
234
+ /** Where this page shows. `null` in the plugin's main script. Needs Wings 0.1.22. */
235
+ placement(): "sidebar" | "tab" | "modal" | "window" | null;
236
+ /** What `openView` passed as `args` when it opened this tab, or `null`. Available at once. Needs Wings 0.1.22. */
237
+ viewArgs<T = unknown>(): T | null;
238
+ /**
239
+ * The project this page is about, or `null` when none is open. A tab page's project is the one the tab belongs to
240
+ * and never changes; any other page gets the project on screen. Needs Wings 0.1.22.
241
+ */
242
+ project(): Promise<WingsProject | null>;
243
+ /**
244
+ * Calls the listener with the current project, then each time it changes: the project on screen switched (not for a
245
+ * tab page), or its branch or name changed. Needs Wings 0.1.22.
246
+ */
247
+ onProject(listener: (project: WingsProject | null) => void): () => void;
248
+ /** In a tab page: the state it last saved with `setTabState`, or `null`. Outside a tab it is `null`. Opening the tab with new `args` clears it. Needs Wings 0.1.22. */
249
+ tabState<T = unknown>(): Promise<T | null>;
250
+ /**
251
+ * In a tab page: saves JSON state, up to 64 KB, on the tab. Wings keeps it across restarts and while the page is
252
+ * unloaded. Rejects outside a tab or when the state is too big. Needs Wings 0.1.22.
218
253
  */
219
- openView(id: string, options?: { as?: "sidebar" | "modal" | "window" | "tab" }): Promise<void>;
254
+ setTabState(state: unknown): Promise<void>;
220
255
  /** Closes a sidebar or view wherever it's open. */
221
256
  closeView(id: string): Promise<void>;
222
257
  /** Opens Wings Settings at the plugin's settings page, `contributes.settings`. Wings 0.1.15 and newer. */