deck-plugin-sdk 0.15.1

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 (45) hide show
  1. package/README.md +77 -0
  2. package/bin/deck-plugin.mjs +117 -0
  3. package/build-plugin.mjs +143 -0
  4. package/package.json +42 -0
  5. package/shim/bridge.d.ts +5 -0
  6. package/shim/bridge.js +196 -0
  7. package/shim/event.d.ts +5 -0
  8. package/shim/event.js +5 -0
  9. package/shim/jsx-runtime.js +20 -0
  10. package/shim/mcp.d.ts +68 -0
  11. package/shim/monaco.d.ts +5 -0
  12. package/shim/monaco.js +15 -0
  13. package/shim/react.js +50 -0
  14. package/shim/settings.d.ts +5 -0
  15. package/shim/settings.js +13 -0
  16. package/shim/terminals.d.ts +4 -0
  17. package/shim/terminals.js +70 -0
  18. package/shim/ui.d.ts +14 -0
  19. package/shim/ui.js +37 -0
  20. package/template/README.md +17 -0
  21. package/template/gitignore +4 -0
  22. package/template/package.json +10 -0
  23. package/template/plugin.json +8 -0
  24. package/template/src/plugin.tsx +65 -0
  25. package/template/tsconfig.json +13 -0
  26. package/types/components/ConfirmDialog.d.ts +22 -0
  27. package/types/components/ContextMenu.d.ts +41 -0
  28. package/types/components/MarkdownToolbar.d.ts +48 -0
  29. package/types/components/NamePrompt.d.ts +16 -0
  30. package/types/components/TabStrip.d.ts +26 -0
  31. package/types/components/Toast.d.ts +48 -0
  32. package/types/components/TreeRow.d.ts +41 -0
  33. package/types/components/dragrow.d.ts +34 -0
  34. package/types/components/menuplace.d.ts +30 -0
  35. package/types/components/ui.d.ts +102 -0
  36. package/types/components/useResize.d.ts +24 -0
  37. package/types/core/bridge.d.ts +670 -0
  38. package/types/core/editorsettings.d.ts +60 -0
  39. package/types/core/langmap.d.ts +15 -0
  40. package/types/core/monaco.d.ts +36 -0
  41. package/types/core/settingsstore.d.ts +19 -0
  42. package/types/core/shellpath.d.ts +45 -0
  43. package/types/core/terminals.d.ts +322 -0
  44. package/types/core/theme.d.ts +68 -0
  45. package/types/modules/editor/MarkdownLive.d.ts +61 -0
@@ -0,0 +1,670 @@
1
+ // GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
2
+ import type { AccentColor, BgPreset, Density, TermTheme } from "./theme";
3
+ /** Open a URL in the default browser. */
4
+ export declare const openExternal: (url: string) => Promise<void>;
5
+ export interface AppProc {
6
+ name: string;
7
+ title: string;
8
+ path: string;
9
+ }
10
+ export declare const configRead: (name: string) => Promise<string>;
11
+ export declare const configWrite: (name: string, json: string) => Promise<void>;
12
+ export declare const getVaultRoot: () => Promise<string>;
13
+ export declare const setVaultRoot: (path: string) => Promise<void>;
14
+ /** The optional readouts in the footer status strip. */
15
+ /**
16
+ * A footer readout's id.
17
+ *
18
+ * `string` rather than a closed union because plugins contribute readouts too, and their ids are
19
+ * not known until a folder is read. The built-in ones are still listed in FOOTER_ITEMS below; a
20
+ * plugin's are merged in at run time by `footerItems()`.
21
+ */
22
+ export type FooterItem = string;
23
+ export declare const FOOTER_ITEMS: {
24
+ id: FooterItem;
25
+ label: string;
26
+ desc: string;
27
+ }[];
28
+ /**
29
+ * Stored order, with any item the stored list predates appended in its declared position.
30
+ *
31
+ * `known` is passed in rather than read from FOOTER_ITEMS so the caller can include the loaded
32
+ * plugins' readouts; without that a plugin's item would be filtered out as unrecognised.
33
+ */
34
+ export declare function footerOrder(stored: FooterItem[] | undefined, known?: string[]): FooterItem[];
35
+ export interface Settings {
36
+ warningMode: "toast" | "window" | "none";
37
+ warnLeadMin: number;
38
+ autostart: boolean;
39
+ closeToTray: boolean;
40
+ startMinimized: boolean;
41
+ reduceMotion: boolean;
42
+ soundOnFire: boolean;
43
+ playerPlacement: "fixed" | "floating";
44
+ accent: AccentColor;
45
+ bgPreset: BgPreset;
46
+ density: Density;
47
+ termTheme: TermTheme;
48
+ termFont: string;
49
+ termFontSize: number;
50
+ termScrollback: number;
51
+ wsSidebar: boolean;
52
+ termGpuRender: boolean;
53
+ wallpaper: string;
54
+ wallpaperDim: number;
55
+ wallpaperBlur: number;
56
+ wallpaperPanel: number;
57
+ /** Atlassian site host, for building a browse link when a cached ticket has no URL. */
58
+ jiraSite: string;
59
+ assistantVoice: string;
60
+ /** Silence spoken replies without losing the chosen voice. Toggled from the Ask console. */
61
+ assistantMuted: boolean;
62
+ userName: string;
63
+ footerItems: Record<FooterItem, boolean>;
64
+ footerOrder: FooterItem[];
65
+ footerVisible: boolean;
66
+ /**
67
+ * Drawer tabs the user has switched off, by id ("console", "plugin:flutter", a pinned pane's
68
+ * uuid). A DENY list, not an allow list: the tabs are discovered at run time — a plugin panel
69
+ * appears when its plugin loads, a pinned pane when you pin it — so anything unlisted is on,
70
+ * and a newly added tab shows up rather than being invisible until someone enables it.
71
+ *
72
+ * A plugin's own `panelWhen` still applies on top of this: switching a tab on returns it to the
73
+ * plugin's rule rather than overriding it, so enabling Flutter does not put an empty tab in
74
+ * every non-Flutter project.
75
+ */
76
+ drawerHidden: string[];
77
+ /** Drawer tabs left-to-right. Ids missing from it keep their discovery order, after the rest. */
78
+ drawerOrder: string[];
79
+ httpMcpRevealSecrets: boolean;
80
+ }
81
+ export declare const DEFAULT_SETTINGS: Settings;
82
+ /** Stop anything being spoken right now. */
83
+ export declare function stopSpeaking(): void;
84
+ export declare function speakWithVoice(text: string, opts?: {
85
+ rate?: number;
86
+ onend?: () => void;
87
+ onerror?: () => void;
88
+ }): SpeechSynthesisUtterance | null;
89
+ export declare const setAutostart: (on: boolean) => Promise<void>;
90
+ export declare const getAutostart: () => Promise<boolean>;
91
+ export declare const toggleFullscreen: () => Promise<boolean>;
92
+ export declare const isFullscreen: () => Promise<boolean>;
93
+ /** Watch these exact paths for external changes; emits "fs-changed" with the path. [] stops. */
94
+ export declare const watchFiles: (paths: string[]) => Promise<void>;
95
+ /** RAM in bytes: Deck and its WebView2 children, plus every claude.exe. */
96
+ export interface MemServer {
97
+ id: string;
98
+ label: string;
99
+ mem: number;
100
+ pid: number;
101
+ }
102
+ export interface MemUsage {
103
+ deck: number;
104
+ agents: number;
105
+ agent_count: number;
106
+ /** Percent of all cores. -1 on the first reading, before there is anything to difference. */
107
+ cpu: number;
108
+ cpu_agents: number;
109
+ /** Deck minus its language servers. Part of `deck`. */
110
+ core: number;
111
+ /** Running language servers, largest first. Also part of `deck`. */
112
+ servers: MemServer[];
113
+ /** Terminal panes. NOT part of `deck` — informational only. */
114
+ panes: number;
115
+ pane_count: number;
116
+ /** claude running inside a pane. Also not part of `deck`. */
117
+ pane_agents: number;
118
+ pane_agent_count: number;
119
+ }
120
+ export declare const memUsage: () => Promise<MemUsage>;
121
+ export declare const listApps: () => Promise<AppProc[]>;
122
+ export declare const listInstalled: () => Promise<AppProc[]>;
123
+ export declare const closeApp: (target: string) => Promise<string>;
124
+ export declare const openApp: (path: string) => Promise<void>;
125
+ export declare const powerAction: (action: string) => Promise<void>;
126
+ export declare const runScriptNow: (command: string, args: string[], id?: string, name?: string) => Promise<void>;
127
+ export declare const pickScript: () => Promise<string>;
128
+ export interface ExecOut {
129
+ stdout: string;
130
+ stderr: string;
131
+ code: number;
132
+ }
133
+ /**
134
+ * Run a command to completion and read its output. `runScriptNow` is fire-and-forget; this is
135
+ * for when the output IS the point — asking a tool what it knows rather than telling it to do
136
+ * something. A bare name goes through cmd.exe, so PATH and .bat shims (`flutter`, `npm`) work.
137
+ */
138
+ export declare const exec: (command: string, args?: string[], cwd?: string) => Promise<ExecOut>;
139
+ export declare const notesScope: (cwd: string) => Promise<string>;
140
+ export declare const notesList: (scope: string) => Promise<string[]>;
141
+ export declare const notesRead: (scope: string, name: string) => Promise<string>;
142
+ export declare const notesWrite: (scope: string, name: string, text: string) => Promise<void>;
143
+ export declare const notesDelete: (scope: string, name: string) => Promise<void>;
144
+ export declare const notesRename: (scope: string, from: string, to: string) => Promise<void>;
145
+ export interface SetupCheck {
146
+ id: string;
147
+ ok: boolean;
148
+ detail: string;
149
+ }
150
+ export declare const setupChecks: () => Promise<SetupCheck[]>;
151
+ /** One header, one value. A list rather than a map: order matters, and repeats are legal. */
152
+ export type HttpHeader = [string, string];
153
+ export interface HttpSendRequest {
154
+ method: string;
155
+ url: string;
156
+ headers?: HttpHeader[];
157
+ body?: string;
158
+ }
159
+ export interface HttpSendResult {
160
+ status: number;
161
+ status_text: string;
162
+ headers: HttpHeader[];
163
+ body: string;
164
+ /** Present only when the body is not valid UTF-8 — an image, a zip. `body` is lossy then. */
165
+ body_b64?: string;
166
+ size: number;
167
+ truncated: boolean;
168
+ elapsed_ms: number;
169
+ }
170
+ /**
171
+ * Send one HTTP request and read the whole response.
172
+ *
173
+ * The `id` http.rs wants for cancellation is generated here: it exists so the HTTP module can
174
+ * abort a send in flight, and a caller doing one GET should not have to invent one. A caller
175
+ * that does need to cancel should use core/httpclient.ts, which owns that id.
176
+ */
177
+ export declare const httpSend: (req: HttpSendRequest) => Promise<HttpSendResult>;
178
+ export interface DownloadItem {
179
+ id: string;
180
+ url: string;
181
+ title: string;
182
+ quality: string;
183
+ format?: string;
184
+ filePath?: string;
185
+ sizeBytes?: number;
186
+ status: "done" | "failed";
187
+ at: number;
188
+ }
189
+ export declare const readDownloads: () => Promise<string>;
190
+ export declare const writeDownloads: (json: string) => Promise<void>;
191
+ export declare const pickFolder: () => Promise<string>;
192
+ /** Native "save as" dialog. Returns "" when cancelled. */
193
+ export declare const pickSavePath: (defaultName: string, ext: string) => Promise<string>;
194
+ /** Native "open file" dialog. Returns "" when cancelled. */
195
+ export declare const pickFile: (ext: string) => Promise<string>;
196
+ /** Native "open file" dialog with no type filter, for choosing a file to upload: an endpoint may
197
+ * accept any extension, so a filter would only hide valid choices. "" when cancelled. */
198
+ export declare const pickAnyFile: () => Promise<string>;
199
+ /** Open dialog filtered to the image types a webview can display. */
200
+ export declare const pickImage: () => Promise<string>;
201
+ /** Copy a chosen image into the config dir; returns the path Deck will read it from. */
202
+ export declare const setWallpaper: (src: string) => Promise<string>;
203
+ export declare const clearWallpaper: () => Promise<void>;
204
+ export declare const revealInFolder: (path: string) => Promise<void>;
205
+ export declare const defaultDownloadDir: () => Promise<string>;
206
+ export declare const openFile: (path: string) => Promise<void>;
207
+ /** Files Deck was launched with — a double-click through Explorer's "Open with". */
208
+ export declare const launchFiles: () => Promise<string[]>;
209
+ export declare const mediaSetNowPlaying: (title: string, artist: string, artPath: string) => Promise<void>;
210
+ export declare const mediaSetPlayback: (playing: boolean) => Promise<void>;
211
+ export interface TrackMeta {
212
+ path: string;
213
+ title: string;
214
+ artist: string;
215
+ album: string;
216
+ duration: number;
217
+ art_path: string;
218
+ }
219
+ export declare const readTrackMeta: (paths: string[]) => Promise<TrackMeta[]>;
220
+ export interface MusicFolder {
221
+ id: string;
222
+ name: string;
223
+ path: string;
224
+ }
225
+ export interface MusicPlaylist {
226
+ id: string;
227
+ name: string;
228
+ tracks: string[];
229
+ }
230
+ export interface MusicLibrary {
231
+ folders: MusicFolder[];
232
+ favorites: string[];
233
+ playlists: MusicPlaylist[];
234
+ }
235
+ export declare const EMPTY_LIBRARY: MusicLibrary;
236
+ export declare const readLibrary: () => Promise<MusicLibrary>;
237
+ export declare const writeLibrary: (lib: MusicLibrary) => Promise<void>;
238
+ export { convertFileSrc } from "@tauri-apps/api/core";
239
+ export interface SongSuggestion {
240
+ id: string;
241
+ title: string;
242
+ artist: string;
243
+ why: string;
244
+ }
245
+ export interface MusicSuggestions {
246
+ generated_at: number;
247
+ songs: SongSuggestion[];
248
+ }
249
+ export declare const readMusicSuggestions: () => Promise<MusicSuggestions | null>;
250
+ export declare const readMusicTaste: () => Promise<string>;
251
+ export declare const writeMusicTaste: (text: string) => Promise<void>;
252
+ export interface JiraItem {
253
+ key: string;
254
+ status: string;
255
+ title: string;
256
+ url?: string;
257
+ /** One sentence on what the ticket asks for — what the rail shows and a drag carries. */
258
+ summary?: string;
259
+ /** The full description as markdown, for the detail drawer. */
260
+ description?: string;
261
+ assignee?: string;
262
+ priority?: string;
263
+ }
264
+ export interface TicketCache {
265
+ tickets: JiraItem[];
266
+ fetched: number;
267
+ }
268
+ export declare const jiraCached: () => Promise<TicketCache | null>;
269
+ export declare const jiraRefresh: () => Promise<TicketCache | null>;
270
+ export interface CalItem {
271
+ /** Start as 24-hour HH:MM, or "" for an all-day event. */
272
+ time: string;
273
+ end?: string;
274
+ title: string;
275
+ /** Video-call join URL, when the event has one. */
276
+ link?: string;
277
+ location?: string;
278
+ attendees?: number;
279
+ }
280
+ export interface CalendarCache {
281
+ events: CalItem[];
282
+ fetched: number;
283
+ }
284
+ export declare const calendarCached: () => Promise<CalendarCache | null>;
285
+ export declare const calendarRefresh: () => Promise<CalendarCache | null>;
286
+ /** Start a sign-in. Returns the consent URL to open in the browser. */
287
+ export declare const googleSignIn: () => Promise<string>;
288
+ /** A valid access token, refreshed if needed. Rejects when not connected. */
289
+ export declare const googleToken: () => Promise<string>;
290
+ /** The connected account, or null when not connected. */
291
+ export interface GoogleAccount {
292
+ email: string;
293
+ name: string;
294
+ picture: string;
295
+ }
296
+ export declare const googleAccount: () => Promise<GoogleAccount | null>;
297
+ export declare const googleSignOut: () => Promise<void>;
298
+ export interface FeedItem {
299
+ from: string;
300
+ /** Slack: the channel, or "DM". Mail has none. */
301
+ where?: string;
302
+ /** Slack's message body. */
303
+ text?: string;
304
+ /** Mail's subject and one-line gloss. */
305
+ subject?: string;
306
+ snippet?: string;
307
+ url?: string;
308
+ when?: string;
309
+ /** Slack only: "dm" or "mention". */
310
+ kind?: string;
311
+ }
312
+ export interface FeedCache {
313
+ items: FeedItem[];
314
+ fetched: number;
315
+ }
316
+ export declare const slackCached: () => Promise<FeedCache | null>;
317
+ export declare const slackRefresh: () => Promise<FeedCache | null>;
318
+ export declare const mailCached: () => Promise<FeedCache | null>;
319
+ export declare const mailRefresh: () => Promise<FeedCache | null>;
320
+ export interface UsageBucket {
321
+ tokens: number;
322
+ cost: number;
323
+ }
324
+ export interface UsageSession extends UsageBucket {
325
+ remainingMinutes?: number | null;
326
+ }
327
+ export interface ClaudeUsage {
328
+ today?: UsageBucket;
329
+ week?: UsageBucket;
330
+ month?: UsageBucket;
331
+ session?: UsageSession | null;
332
+ error?: string;
333
+ }
334
+ export declare const claudeUsage: () => Promise<ClaudeUsage>;
335
+ export interface PlanLimit {
336
+ kind: string;
337
+ group: string;
338
+ percent: number;
339
+ severity: string;
340
+ resets_at: string | null;
341
+ is_active: boolean;
342
+ scope?: {
343
+ model?: {
344
+ display_name?: string;
345
+ };
346
+ } | null;
347
+ }
348
+ export interface PlanLimits {
349
+ limits?: PlanLimit[];
350
+ error?: string;
351
+ }
352
+ export declare const claudePlanLimits: () => Promise<PlanLimits>;
353
+ /** An agent pane as the session surface sees it. Status: working | idle | blocked. */
354
+ export interface AgentSession {
355
+ pane_id: string;
356
+ agent: string;
357
+ status: string;
358
+ cwd: string;
359
+ title: string;
360
+ }
361
+ export declare const sessionList: () => Promise<AgentSession[]>;
362
+ export declare const askAssistant: (message: string, sessionId: string, resume: boolean, userName: string, jiraSite: string) => Promise<string>;
363
+ export interface ScriptJob {
364
+ id: string;
365
+ name: string;
366
+ command: string;
367
+ args: string[];
368
+ mode: "interval" | "atTime";
369
+ intervalMin: number;
370
+ days: string[];
371
+ timeOfDay: string;
372
+ everyWeeks: number;
373
+ startDate: string;
374
+ enabled: boolean;
375
+ lastRun: number;
376
+ target?: "local" | "vps";
377
+ }
378
+ export interface HistoryEntry {
379
+ module: string;
380
+ label: string;
381
+ payload: any;
382
+ firedAt: number;
383
+ mode?: "delay" | "atTime";
384
+ recurring?: boolean;
385
+ days?: string[];
386
+ timeOfDay?: string;
387
+ delayMin?: number;
388
+ }
389
+ export declare const historyDelete: (index: number) => Promise<void>;
390
+ export declare const historyClear: (module: string) => Promise<void>;
391
+ export interface StartupProgram {
392
+ Name: string;
393
+ Path: string;
394
+ Args: string[];
395
+ Days: string[];
396
+ Start: string;
397
+ End: string;
398
+ Enabled: boolean;
399
+ }
400
+ export declare const startupRead: () => Promise<string>;
401
+ export declare const startupWrite: (json: string) => Promise<void>;
402
+ export declare const pickExe: () => Promise<string>;
403
+ export declare const readTermLayout: <T>() => Promise<T | null>;
404
+ export declare const writeTermLayout: (layout: unknown) => Promise<void>;
405
+ /** `mtimeMs` is epoch ms, 0 if unreadable — lets a caller tell a settled file from one still being written. */
406
+ export interface FsEntry {
407
+ name: string;
408
+ path: string;
409
+ dir: boolean;
410
+ mtimeMs: number;
411
+ }
412
+ export interface GitStatusRow {
413
+ path: string;
414
+ rel: string;
415
+ letter: string;
416
+ staged: boolean;
417
+ }
418
+ export declare const fsList: (dir: string) => Promise<FsEntry[]>;
419
+ /** `%APPDATA%\Deck\plugins` (Deck-Dev in a debug build), created on first call. */
420
+ export declare const pluginsDir: () => Promise<string>;
421
+ /** `%APPDATA%\Deck\languages` (Deck-Dev in a debug build), created on first call. */
422
+ export declare const languagesDir: () => Promise<string>;
423
+ export declare const fsRead: (path: string) => Promise<string>;
424
+ /** Raw bytes, for a file that is not text — fsRead decodes as UTF-8 and would corrupt it. */
425
+ export declare const fsReadBytes: (path: string) => Promise<Uint8Array<ArrayBuffer>>;
426
+ export declare const fsSize: (path: string) => Promise<number>;
427
+ export declare const fsWrite: (path: string, content: string) => Promise<void>;
428
+ /** Raw bytes — saving a response that is an image or a PDF, which a string would corrupt. */
429
+ export declare const fsWriteBytes: (path: string, bytes: Uint8Array) => Promise<void>;
430
+ /** Write bytes without ever clobbering: dedupes the name on collision, returns the path used. */
431
+ export declare const fsSaveUnique: (saveTo: string, defaultName: string, bytes: Uint8Array) => Promise<string>;
432
+ export declare const fsHomeDir: () => Promise<string>;
433
+ /**
434
+ * Move into a directory, creating it if missing. Returns the new full path.
435
+ *
436
+ * `onConflict` "rename" deduplicates to "name (1).ext" instead of failing — for an unattended
437
+ * caller with nobody to answer an overwrite prompt. Omit it for the interactive case.
438
+ */
439
+ export declare const fsMove: (src: string, dstDir: string, onConflict?: "fail" | "rename") => Promise<string>;
440
+ export declare const fsCreateFile: (dir: string, name: string) => Promise<string>;
441
+ /** Open a path with its default application. */
442
+ export declare const fsOpen: (path: string) => Promise<void>;
443
+ /** The user's Downloads folder (home if there isn't one). */
444
+ export declare const dirsDownload: () => Promise<string>;
445
+ export declare const vaultResolve: (path: string) => Promise<string>;
446
+ export declare const vaultRelativize: (path: string) => Promise<string>;
447
+ export declare const vaultDataRead: (name: string) => Promise<string>;
448
+ export declare const vaultDataWrite: (name: string, text: string) => Promise<void>;
449
+ /** Relaunch Deck — the same binary, so a dev instance stays dev. Used by the plugin toggle. */
450
+ export declare const restartApp: () => Promise<void>;
451
+ /** Copy a plugin folder into the plugins directory. Returns its id. Validates before writing. */
452
+ export declare const installPlugin: (src: string) => Promise<string>;
453
+ /** One file of a plugin, as the registry describes it. */
454
+ export interface RemoteFile {
455
+ url: string;
456
+ sha256: string;
457
+ }
458
+ /**
459
+ * Install a plugin or a language definition from the registry.
460
+ *
461
+ * `kind` decides where it lands and what it is allowed to contain: a plugin's three files in
462
+ * `plugins/`, or a language.json and its snippets in `languages/`. Rust refuses anything else,
463
+ * because the file names become paths.
464
+ *
465
+ * Every file's SHA-256 is checked before anything is written. It matters most for a plugin —
466
+ * `plugin.js` runs with this bridge, so unverified bytes would be someone else's code running
467
+ * here — but a corrupted language definition is worth refusing too. Nothing is written unless
468
+ * every file checks out.
469
+ *
470
+ * Resolves to the installed id; both kinds load without a restart.
471
+ */
472
+ export declare const installFromRegistry: (kind: string, id: string, files: Record<string, RemoteFile>) => Promise<string>;
473
+ /** One line of output from a `procStream` run. `stream` is "stdout" or "stderr". */
474
+ export interface ProcLine {
475
+ id: string;
476
+ stream: string;
477
+ line: string;
478
+ }
479
+ /** How a `procStream` run ended. `cancelled` separates a `procKill` from a real failure. */
480
+ export interface ProcResult {
481
+ id: string;
482
+ code: number;
483
+ cancelled: boolean;
484
+ }
485
+ /**
486
+ * Run a program, emitting a `proc-line` event per output line, and resolve when it exits.
487
+ *
488
+ * `id` is the caller's handle — it tags every event and is what `procKill` takes, so concurrent
489
+ * runs can be told apart. Listen with `listen<ProcLine>("proc-line", …)` and filter on it.
490
+ *
491
+ * `stdin: true` opens the child's input for `procWrite`, which is what turns this from "run a
492
+ * command and read the output" into driving a long-lived tool that takes commands — a daemon
493
+ * speaking one JSON object per line, or a program reading single keypresses.
494
+ */
495
+ export declare const procStream: (id: string, program: string, args: string[], cwd?: string, stdin?: boolean) => Promise<ProcResult>;
496
+ /**
497
+ * Write to a running `procStream`'s stdin. Only works when it was started with `stdin: true`.
498
+ *
499
+ * Raw — no newline is appended, since whether one terminates a message belongs to the protocol.
500
+ */
501
+ export declare const procWrite: (id: string, data: string) => Promise<void>;
502
+ export declare const procKill: (id: string) => Promise<void>;
503
+ export declare const fsCreateDir: (dir: string, name: string) => Promise<string>;
504
+ export declare const fsRename: (path: string, newName: string) => Promise<string>;
505
+ export declare const fsDelete: (path: string) => Promise<void>;
506
+ export declare const fsCopy: (src: string, dstDir: string) => Promise<string>;
507
+ export declare const fsReveal: (path: string) => Promise<void>;
508
+ export declare const installClaudeHooks: () => Promise<void>;
509
+ export declare const removeClaudeHooks: () => Promise<void>;
510
+ export declare const notifyOs: (title: string, body: string) => Promise<void>;
511
+ export declare const gitStatus: (dir: string) => Promise<GitStatusRow[]>;
512
+ export interface BlameLine {
513
+ hash: string;
514
+ author: string;
515
+ time: number;
516
+ summary: string;
517
+ uncommitted: boolean;
518
+ }
519
+ export declare const gitBlameLine: (dir: string, rel: string, line: number, contents: string) => Promise<BlameLine | null>;
520
+ export declare const gitHeadFile: (dir: string, rel: string) => Promise<string>;
521
+ /** A blob's raw bytes. `rev` is "HEAD", or "" for the index. Empty = absent from that revision.
522
+ * For content the text commands would corrupt: an image, a font. */
523
+ export declare const gitFileBytes: (dir: string, rev: string, rel: string) => Promise<Uint8Array<ArrayBuffer>>;
524
+ export interface GitInfo {
525
+ branch: string;
526
+ has_remote: boolean;
527
+ ahead: number;
528
+ behind: number;
529
+ }
530
+ export declare const gitInfo: (dir: string) => Promise<GitInfo>;
531
+ export declare const gitCommit: (dir: string, message: string) => Promise<string>;
532
+ export declare const gitPush: (dir: string) => Promise<string>;
533
+ export declare const gitPull: (dir: string) => Promise<string>;
534
+ export declare const gitIndexFile: (dir: string, rel: string) => Promise<string>;
535
+ export declare const gitFileDiff: (dir: string, rel: string) => Promise<string>;
536
+ export interface ImportedPack {
537
+ id: string;
538
+ label: string;
539
+ theme_json: string;
540
+ }
541
+ export declare const importIconPack: (srcDir: string) => Promise<ImportedPack>;
542
+ export declare const deleteIconPack: (id: string) => Promise<void>;
543
+ export declare const readIconPackTheme: (path: string) => Promise<string>;
544
+ export declare const gitStage: (dir: string, paths: string[]) => Promise<void>;
545
+ export declare const gitStageContent: (dir: string, rel: string, content: string) => Promise<void>;
546
+ export declare const gitUnstage: (dir: string, paths: string[]) => Promise<void>;
547
+ export declare const gitDiscard: (dir: string, paths: string[]) => Promise<void>;
548
+ export interface GraphCommit {
549
+ hash: string;
550
+ parents: string[];
551
+ author: string;
552
+ email: string;
553
+ date: string;
554
+ subject: string;
555
+ body: string;
556
+ refs: string[];
557
+ }
558
+ export declare const gitLogGraph: (dir: string, skip: number, rel?: string, refs?: string[]) => Promise<GraphCommit[]>;
559
+ export interface CommitFile {
560
+ rel: string;
561
+ letter: string;
562
+ adds: number;
563
+ dels: number;
564
+ }
565
+ export declare const gitCommitFiles: (dir: string, hash: string) => Promise<CommitFile[]>;
566
+ export declare const gitShowFile: (dir: string, rev: string, rel: string) => Promise<string>;
567
+ export declare const gitPullRebase: (dir: string) => Promise<string>;
568
+ export declare const gitFetch: (dir: string) => Promise<string>;
569
+ export interface GitBranch {
570
+ name: string;
571
+ current: boolean;
572
+ }
573
+ export declare const gitBranches: (dir: string) => Promise<GitBranch[]>;
574
+ export interface GitRef {
575
+ kind: "local" | "remote" | "tag";
576
+ name: string;
577
+ current: boolean;
578
+ author: string;
579
+ hash: string;
580
+ summary: string;
581
+ time: number;
582
+ }
583
+ export declare const gitRefs: (dir: string) => Promise<GitRef[]>;
584
+ export declare const gitCheckout: (dir: string, name: string) => Promise<string>;
585
+ export declare const gitCheckoutNew: (dir: string, name: string) => Promise<string>;
586
+ export declare const gitCheckoutTrack: (dir: string, remote: string) => Promise<string>;
587
+ export declare const gitCheckoutDetach: (dir: string, rev: string) => Promise<string>;
588
+ export declare const gitAiCommitMsg: (dir: string, command: string, args: string, model: string) => Promise<string>;
589
+ export declare const gitCommitAmend: (dir: string, message: string) => Promise<string>;
590
+ export declare const gitUndoCommit: (dir: string) => Promise<string>;
591
+ export declare const gitBranchAt: (dir: string, name: string, rev: string) => Promise<string>;
592
+ export declare const gitRevert: (dir: string, rev: string) => Promise<string>;
593
+ export declare const gitCherryPick: (dir: string, rev: string) => Promise<string>;
594
+ export declare const gitResetTo: (dir: string, rev: string, mode: "soft" | "mixed" | "hard") => Promise<string>;
595
+ export declare const gitTag: (dir: string, name: string, rev: string, message?: string) => Promise<string>;
596
+ export declare const gitMerge: (dir: string, rev: string, noFf?: boolean) => Promise<string>;
597
+ export declare const gitPendingOp: (dir: string) => Promise<string>;
598
+ export declare const gitAbortOp: (dir: string, op: string) => Promise<string>;
599
+ export declare const gitBranchDelete: (dir: string, name: string, force?: boolean) => Promise<string>;
600
+ export declare const gitBranchDeleteRemote: (dir: string, remote: string, name: string) => Promise<string>;
601
+ export declare const gitTagDelete: (dir: string, name: string) => Promise<string>;
602
+ export declare const gitTagPush: (dir: string, remote: string, name: string) => Promise<string>;
603
+ export declare const gitTagDeleteRemote: (dir: string, remote: string, name: string) => Promise<string>;
604
+ export declare const gitPushBranch: (dir: string, remote: string, name: string) => Promise<string>;
605
+ export declare const gitRemotes: (dir: string) => Promise<string[]>;
606
+ export interface GitStash {
607
+ index: number;
608
+ message: string;
609
+ }
610
+ export declare const gitStash: (dir: string, kind?: "" | "untracked" | "staged", message?: string) => Promise<string>;
611
+ export declare const gitStashShow: (dir: string, index: number) => Promise<string>;
612
+ export declare const gitStashList: (dir: string) => Promise<GitStash[]>;
613
+ export declare const gitStashApply: (dir: string, index?: number) => Promise<string>;
614
+ export declare const gitStashPop: (dir: string, index?: number) => Promise<string>;
615
+ export declare const gitStashDrop: (dir: string, index?: number) => Promise<string>;
616
+ export declare const gitStashClear: (dir: string) => Promise<string>;
617
+ export interface SearchHit {
618
+ path: string;
619
+ rel: string;
620
+ line: number;
621
+ text: string;
622
+ }
623
+ export interface SearchOpts {
624
+ caseSensitive: boolean;
625
+ isRegex: boolean;
626
+ wholeWord: boolean;
627
+ includes: string;
628
+ excludes: string;
629
+ }
630
+ export declare const fsSearch: (dir: string, query: string, o: SearchOpts) => Promise<SearchHit[]>;
631
+ export declare const fsReplace: (dir: string, query: string, replacement: string, o: SearchOpts, files?: string[], line?: number) => Promise<number>;
632
+ export interface DbQueryResult {
633
+ columns: string[];
634
+ /** Cell values, already JSON: null, boolean, number, or a string for everything else. */
635
+ rows: unknown[][];
636
+ total: number;
637
+ truncated: boolean;
638
+ affected: number;
639
+ }
640
+ export interface DbColumn {
641
+ name: string;
642
+ type: string;
643
+ notNull: boolean;
644
+ pk: boolean;
645
+ }
646
+ export interface DbTable {
647
+ name: string;
648
+ kind: "table" | "view";
649
+ columns: DbColumn[];
650
+ }
651
+ export interface DbForeignKey {
652
+ table: string;
653
+ column: string;
654
+ refTable: string;
655
+ refColumn: string;
656
+ }
657
+ export interface DbSchema {
658
+ tables: DbTable[];
659
+ foreignKeys: DbForeignKey[];
660
+ }
661
+ /** Open a postgres:// or mysql:// connection. The handle outlives the calling component. */
662
+ export declare const dbConnect: (url: string) => Promise<number>;
663
+ export declare const dbDisconnect: (handle: number) => Promise<void>;
664
+ /** Run ONE statement. `readOnly` wraps it in a read-only transaction the server enforces. */
665
+ export declare const dbQuery: (handle: number, sql: string, readOnly: boolean) => Promise<DbQueryResult>;
666
+ export declare const dbSchema: (handle: number) => Promise<DbSchema>;
667
+ /** Open a tunnel. `remote` is host:port as seen FROM `host`. Returns [id, local port]. */
668
+ export declare const sshTunnelOpen: (host: string, remote: string) => Promise<[number, number]>;
669
+ export declare const sshTunnelClose: (id: number) => Promise<void>;
670
+ export declare const sshTunnelList: () => Promise<[number, number][]>;