deck-plugin-sdk 1.5.0 → 1.6.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.
@@ -1,50 +1,55 @@
1
- // GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
2
- export interface SessionTab {
3
- /** Older sessions can also hold "graph" and "pr" tabs, from before git moved to the Git
4
- * plugin. The Editor skips them on restore. */
5
- kind: "file" | "media" | "graph" | "pr";
6
- path: string;
7
- rel: string | null;
8
- dirty?: string;
9
- }
10
- export interface WorkspaceSession {
11
- tabs: SessionTab[];
12
- activeId: string | null;
13
- expanded: string[];
14
- /** A typed-but-uncommitted message. Per root, because a message belongs to the repo it
15
- * describes. Only the active module is mounted, so without this a half-written message is
16
- * destroyed by switching to a terminal to check something — which is exactly when you switch. */
17
- commitMsg?: string;
18
- /** Collapsed Source Control rows: the two section headers, and folders in tree view. Per root
19
- * because the keys are paths in this repo. A Set on the way in and out; an array here because
20
- * that is what survives JSON. */
21
- scmCollapsed?: string[];
22
- }
23
- /** A file to open, and optionally where in it to land. */
24
- export interface PendingFile {
25
- path: string;
26
- line?: number;
27
- }
28
- export declare function queueOpenFiles(files: (string | PendingFile)[], instance?: EditorInstance): void;
29
- /** Take everything queued for one editor, leaving its queue empty. */
30
- export declare function drainOpenFiles(instance?: EditorInstance): PendingFile[];
31
- /**
32
- * Which editor is asking.
33
- *
34
- * There are two: the Editor tab, which opens whatever folder you point it at, and the one inside
35
- * Terminals, which follows that workspace's cwd. They are separate windows onto different work,
36
- * so their open folder and their UI prefs are stored per instance. Open TABS already separate on
37
- * their own — loadSession is keyed by root, and the two rarely share one.
38
- */
39
- export type EditorInstance = "tab" | "terminals";
40
- export declare function loadEditorRoot(instance: EditorInstance): string;
41
- export declare function saveEditorRoot(instance: EditorInstance, root: string): void;
42
- export interface GlobalUi {
43
- mdMode: "edit" | "live" | "split" | "preview";
44
- panel: "explorer" | "search" | "debug" | "scm";
45
- sidebarW: number;
46
- }
47
- export declare function loadSession(root: string): WorkspaceSession | null;
48
- export declare function saveSession(root: string, s: WorkspaceSession): void;
49
- export declare function loadUi(instance: EditorInstance): Partial<GlobalUi>;
50
- export declare function saveUi(instance: EditorInstance, ui: GlobalUi): void;
1
+ // GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
2
+ export interface SessionTab {
3
+ /** Older sessions can also hold "graph" and "pr" tabs, from before git moved to the Git
4
+ * plugin. The Editor skips them on restore. */
5
+ /** "untitled" is a buffer never saved (Ctrl+N), path `untitled:Untitled-N`: restored from
6
+ * `content` alone, with no disk read. An older Deck skips the kind, as it skips "graph". */
7
+ kind: "file" | "media" | "graph" | "pr" | "untitled";
8
+ path: string;
9
+ rel: string | null;
10
+ dirty?: string;
11
+ /** untitled: its whole text, and the language picked by hand for it (none: detected). */
12
+ content?: string;
13
+ lang?: string;
14
+ }
15
+ export interface WorkspaceSession {
16
+ tabs: SessionTab[];
17
+ activeId: string | null;
18
+ expanded: string[];
19
+ /** A typed-but-uncommitted message. Per root, because a message belongs to the repo it
20
+ * describes. Only the active module is mounted, so without this a half-written message is
21
+ * destroyed by switching to a terminal to check something — which is exactly when you switch. */
22
+ commitMsg?: string;
23
+ /** Collapsed Source Control rows: the two section headers, and folders in tree view. Per root
24
+ * because the keys are paths in this repo. A Set on the way in and out; an array here because
25
+ * that is what survives JSON. */
26
+ scmCollapsed?: string[];
27
+ }
28
+ /** A file to open, and optionally where in it to land. */
29
+ export interface PendingFile {
30
+ path: string;
31
+ line?: number;
32
+ }
33
+ export declare function queueOpenFiles(files: (string | PendingFile)[], instance?: EditorInstance): void;
34
+ /** Take everything queued for one editor, leaving its queue empty. */
35
+ export declare function drainOpenFiles(instance?: EditorInstance): PendingFile[];
36
+ /**
37
+ * Which editor is asking.
38
+ *
39
+ * There are two: the Editor tab, which opens whatever folder you point it at, and the one inside
40
+ * Terminals, which follows that workspace's cwd. They are separate windows onto different work,
41
+ * so their open folder and their UI prefs are stored per instance. Open TABS already separate on
42
+ * their own — loadSession is keyed by root, and the two rarely share one.
43
+ */
44
+ export type EditorInstance = "tab" | "terminals";
45
+ export declare function loadEditorRoot(instance: EditorInstance, pane?: string): string;
46
+ export declare function saveEditorRoot(instance: EditorInstance, root: string, pane?: string): void;
47
+ export interface GlobalUi {
48
+ mdMode: "edit" | "live" | "split" | "preview";
49
+ panel: "explorer" | "search" | "debug" | "scm";
50
+ sidebarW: number;
51
+ }
52
+ export declare function loadSession(root: string): WorkspaceSession | null;
53
+ export declare function saveSession(root: string, s: WorkspaceSession): void;
54
+ export declare function loadUi(instance: EditorInstance): Partial<GlobalUi>;
55
+ export declare function saveUi(instance: EditorInstance, ui: GlobalUi): void;
@@ -80,6 +80,15 @@ export interface EditorSettings {
80
80
  agentNotifyFinished: boolean;
81
81
  agentNotifyNeedsInput: boolean;
82
82
  agentNotifyOsToast: boolean;
83
+ /** Layout: the file panel docked beside the code or a drawer over it (Ctrl+B either way), the
84
+ * status as a bar along the bottom or a pill floating over the code, and the file's path on its
85
+ * own row under the tabs or in the tab line. */
86
+ layoutFiles: "docked" | "drawer";
87
+ layoutStatus: "bar" | "pill";
88
+ layoutPath: "row" | "tabs";
89
+ /** With the files in a drawer: Search, Source Control and Debug as icons in the tab line, or
90
+ * along the top of the drawer. */
91
+ layoutViews: "tabs" | "drawer";
83
92
  theme: "deck-dark" | "vs-dark" | "hc-black";
84
93
  iconTheme: string;
85
94
  diffSideBySide: boolean;
@@ -29,7 +29,26 @@ export declare const fileOpeners: {
29
29
  /** The id of the plugin that opens `path` (by its extension), or undefined: the Editor's. */
30
30
  export declare function pluginForFile(path: string): string | undefined;
31
31
  /**
32
- * Open `path` in the plugin that claims its type, as a tab of its own. False when no plugin does,
33
- * so the caller opens it in the Editor as before. Every way Deck opens a file asks this first.
32
+ * The files Deck's browser opens: the types defaultbrowser.rs registers with Windows (FILE_TYPES
33
+ * there), so a choice offered here is one Windows can hand over too.
34
34
  */
35
- export declare function openWithPlugin(path: string): boolean;
35
+ export declare const BROWSER_TYPES: string[];
36
+ /** Where a file opens: the Editor, a browser tab, or a plugin's pane (`plugin:<id>`). */
37
+ export type Opener = "editor" | "browser" | `plugin:${string}`;
38
+ /** The user's choice per extension (Settings, `openWith`); a type with none is Automatic. */
39
+ export declare const openPrefs: {
40
+ current: Record<string, string>;
41
+ };
42
+ /**
43
+ * Where `path` opens. The user's choice for its type wins, where it still can (the plugin is
44
+ * loaded, the file is local for a browser tab); otherwise Automatic: `hint`, how it was opened
45
+ * (a page Windows handed Deck as the browser), then the plugin that claims the type, then the Editor.
46
+ */
47
+ export declare function openerFor(path: string, hint?: Opener, prefs?: Record<string, string>): Opener;
48
+ /** `C:\a b\x.html` as file:///C:/a%20b/x.html, for a browser tab. */
49
+ export declare const fileUrl: (path: string) => string;
50
+ /**
51
+ * Open `path` where its type opens (`openerFor`), as a tab of its own. False when that is the
52
+ * Editor, which the caller opens it in. Every way Deck opens a file asks this first.
53
+ */
54
+ export declare function openByType(path: string, hint?: Opener): boolean;
@@ -0,0 +1,84 @@
1
+ // GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
2
+ /**
3
+ * attention: needs you now (a meeting starting, someone asking to join a board, a timer about to
4
+ * fire). activity: something finished in the background (a download, a timer that ran).
5
+ */
6
+ export type NotifKind = "input" | "done" | "attention" | "activity" | "update" | "error" | "news" | "plugin";
7
+ /**
8
+ * A button on a card and on its bell row. `nav` (a deck-navigate target) and `act` (a handler
9
+ * registered with onNotifAction) survive a restart; `run`, a plugin's own function, does not, so
10
+ * after a restart that button is gone from the bell.
11
+ */
12
+ export interface NotifAction {
13
+ label: string;
14
+ primary?: boolean;
15
+ nav?: string;
16
+ act?: string;
17
+ run?: () => void;
18
+ }
19
+ export interface Notif {
20
+ id: string;
21
+ kind: NotifKind;
22
+ title: string;
23
+ body: string;
24
+ ts: number;
25
+ /** Replaces an earlier notification with the same key. */
26
+ key?: string;
27
+ /** The workspace an agent notification is about: a click goes there. */
28
+ wsId?: string;
29
+ /** Where a click on the card itself goes, when it is not about a workspace. */
30
+ nav?: string;
31
+ /** Who posted it, shown beside the time: a plugin's name. */
32
+ source?: string;
33
+ actions?: NotifAction[];
34
+ /** Seen: the bell has been opened since it came. Read: the bell was closed after that. */
35
+ seen?: boolean;
36
+ read?: boolean;
37
+ }
38
+ export type Card = Notif & {
39
+ sticky: boolean;
40
+ };
41
+ /** The kinds Settings lists. What's new counts as an update. */
42
+ export type PrefKind = "input" | "done" | "attention" | "activity" | "update" | "error" | "plugin";
43
+ export type Channel = "card" | "bell" | "sound" | "os";
44
+ export declare const PREF_KINDS: {
45
+ kind: PrefKind;
46
+ label: string;
47
+ desc: string;
48
+ }[];
49
+ /**
50
+ * Whether a kind shows on a channel. Until it is set in Settings › Notifications, the agent kinds
51
+ * follow the four switches that Settings › AI agents used to have (on at all, finished, needs input,
52
+ * Windows), so nobody's choice flips.
53
+ */
54
+ export declare function prefFor(kind: PrefKind, ch: Channel): boolean;
55
+ export declare const useNotifCards: () => Card[];
56
+ export declare function useNotifHistory(): Notif[];
57
+ /** Whether Deck is the window in front, for a caller that only speaks up when you are away. */
58
+ export declare const deckInFront: () => boolean;
59
+ /**
60
+ * Post a notification. Returns its id, or "" when the user has every channel for its kind off.
61
+ * `transient`: a card only, never kept in the bell, for something in progress that a result will
62
+ * replace or resolveKey will take down (a hot reload while it runs).
63
+ */
64
+ export declare function notify(n: Omit<Notif, "id" | "ts" | "seen" | "read"> & {
65
+ sticky?: boolean;
66
+ transient?: boolean;
67
+ }): string;
68
+ /** The card's ✕: it goes, and its key stays quiet (see notify) until resolved or acted on. */
69
+ export declare function closeCard(id: string): void;
70
+ /** The card goes; the bell keeps it. */
71
+ export declare function dismissCard(id: string): void;
72
+ /** Gone from the bell, and its card with it. */
73
+ export declare function removeNotif(id: string): void;
74
+ /** What a key was about is dealt with (an agent was answered): its card goes, its row is read. */
75
+ export declare function resolveKey(key: string): void;
76
+ export declare function clearNotifs(): void;
77
+ /** The bell was opened: the badge clears, the rows stay lifted until it closes. */
78
+ export declare function markSeen(): void;
79
+ export declare function markRead(): void;
80
+ /** What a persisted action's `act` runs. Registered by the module that posts it, at import. */
81
+ export declare function onNotifAction(name: string, run: () => unknown): void;
82
+ /** A click on the card or the row itself: where it is about, then the card goes. */
83
+ export declare function openNotif(n: Notif): void;
84
+ export declare function runAction(n: Notif, a: NotifAction): void;
@@ -0,0 +1,39 @@
1
+ // GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
2
+ export interface PluginNotification {
3
+ title: string;
4
+ /**
5
+ * Which of Settings › Notifications' rows it follows. "plugin" (the default) for a plugin's own
6
+ * news; "attention" for something that needs the user now (a meeting starting, a request to
7
+ * join), which also reaches Windows while Deck is behind; "activity" for something that finished
8
+ * in the background; "error" for a failure.
9
+ */
10
+ kind?: "plugin" | "attention" | "activity" | "error";
11
+ body?: string;
12
+ /** The plugin's name, shown beside the time. */
13
+ source: string;
14
+ /** Replaces this plugin's earlier notification with the same key, rather than adding another. */
15
+ key?: string;
16
+ /** Stays until dismissed instead of going after a few seconds. The bell keeps it either way. */
17
+ sticky?: boolean;
18
+ /**
19
+ * Something in progress: a card only, with no sound, never kept in the bell. Take it down with
20
+ * dismissNotification when it is done, or replace it (same key) with the result.
21
+ */
22
+ transient?: boolean;
23
+ /**
24
+ * Buttons on the card and on its bell row. `run` is the plugin's own function, so it lasts only
25
+ * as long as this session: after a restart the row is still in the bell, without its buttons.
26
+ */
27
+ actions?: {
28
+ label: string;
29
+ primary?: boolean;
30
+ run: () => void;
31
+ }[];
32
+ }
33
+ /**
34
+ * Post a notification: a card in the corner and a row in the bell, as Settings › Notifications
35
+ * says for plugins. For a passing word ("Copied") use toast() instead, which the bell does not keep.
36
+ */
37
+ export declare function notify(n: PluginNotification): void;
38
+ /** Take down this plugin's notification with that key: its card goes, its bell row is marked read. */
39
+ export declare function dismissNotification(source: string, key: string): void;
@@ -50,6 +50,8 @@ export interface LayoutWorkspace {
50
50
  cwd: string;
51
51
  tabs: LayoutTab[];
52
52
  activeTab: string;
53
+ /** Its colour on the sidebar's collapsed rail, by index (Terminals' TONES); none picks one from the name. */
54
+ color?: number;
53
55
  }
54
56
  export interface Layout {
55
57
  workspaces: LayoutWorkspace[];
@@ -0,0 +1,3 @@
1
+ // GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
2
+ /** A Monaco language id (only ones Monaco ships), "plaintext" when nothing stands out. */
3
+ export declare function detectLanguage(text: string): string;
@@ -10,6 +10,8 @@ export interface EditorStatus {
10
10
  author: string;
11
11
  summary: string;
12
12
  } | null;
13
+ /** The shown model's Monaco language id: an untitled buffer's changes as it is detected. */
14
+ lang?: string;
13
15
  }
14
16
  export declare let editorStatus: EditorStatus;
15
17
  export declare function setEditorStatus(patch: Partial<EditorStatus>): void;
@@ -1,7 +1,18 @@
1
1
  // GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
2
2
  import { monaco } from "../../core/monaco";
3
3
  export declare const viewStates: Map<string, monaco.editor.ICodeEditorViewState | null>;
4
+ /**
5
+ * An untitled buffer (Ctrl+N): `untitled:Untitled-N`. It has no file behind it, so its model gets
6
+ * an untitled: URI rather than a file:// one, it is never shown to a language server (which would
7
+ * answer for a file that does not exist), and its language comes from its text.
8
+ */
9
+ export declare const isUntitled: (path: string) => boolean;
4
10
  export declare function fileUri(path: string): monaco.Uri;
11
+ /** Pick an untitled buffer's language by hand, or null to go back to detecting it. Fine to call
12
+ * before its model exists (a restored tab): the model is then created with it. */
13
+ export declare function setUntitledLanguage(path: string, id: string | null): void;
14
+ /** Take `path` for `owner`; false when another editor's buffer has it. */
15
+ export declare function claimUntitled(path: string, owner: string): boolean;
5
16
  export declare function getFileModel(path: string, initial: string): monaco.editor.ITextModel;
6
17
  export declare function setModelValue(path: string, value: string): void;
7
18
  export declare function disposeModel(path: string | undefined): void;