deck-plugin-sdk 1.8.0 → 1.10.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.
- package/package.json +60 -60
- package/permissions.json +231 -230
- package/shim/bridge.js +232 -231
- package/shim/settings.js +17 -17
- package/shim/terminals.js +106 -97
- package/template/plugin.json +10 -10
- package/types/components/ConfirmDialog.d.ts +3 -1
- package/types/components/ContextMenu.d.ts +1 -1
- package/types/components/NamePrompt.d.ts +1 -1
- package/types/components/dragrow.d.ts +2 -2
- package/types/components/ui.d.ts +4 -1
- package/types/core/bridge.d.ts +65 -5
- package/types/core/browser.d.ts +14 -0
- package/types/core/fileview.d.ts +6 -2
- package/types/core/notifications.d.ts +2 -0
- package/types/core/p2p.d.ts +117 -117
- package/types/core/portal.d.ts +3 -0
- package/types/core/settingsstore.d.ts +26 -26
- package/types/core/shellpath.d.ts +43 -3
- package/types/core/terminals.d.ts +91 -2
- package/types/core/windows.d.ts +52 -0
- package/types/modules/editor/models.d.ts +6 -0
package/types/core/p2p.d.ts
CHANGED
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
-
/** What can travel: anything JSON can carry. */
|
|
3
|
-
export type Json = string | number | boolean | null | Json[] | {
|
|
4
|
-
[k: string]: Json;
|
|
5
|
-
};
|
|
6
|
-
/** Whether someone may change what is shared, or only watch. */
|
|
7
|
-
export type Mode = "edit" | "view";
|
|
8
|
-
/** Who may change things: a default for everyone, and a choice per person that wins over it. */
|
|
9
|
-
export interface Roles {
|
|
10
|
-
def: Mode;
|
|
11
|
-
per: Record<string, Mode>;
|
|
12
|
-
}
|
|
13
|
-
/** Why a share ended for a joiner: the host stopped, vanished, removed this Deck, turned it away,
|
|
14
|
-
* or speaks another version. */
|
|
15
|
-
export type Gone = "ended" | "lost" | "removed" | "denied" | "version";
|
|
16
|
-
export interface Person {
|
|
17
|
-
id: string;
|
|
18
|
-
name: string; /** Round trip in ms, once measured. */
|
|
19
|
-
ms?: number;
|
|
20
|
-
}
|
|
21
|
-
/** What a share's bar and dialogs show. Replaced, never mutated, so React sees a change. */
|
|
22
|
-
export interface ShareView {
|
|
23
|
-
/** Who is in and connected: on the host, everyone let in; on a joiner, the host and the others. */
|
|
24
|
-
peers: Person[];
|
|
25
|
-
/** On the host: who is asking to be let in. */
|
|
26
|
-
knocking: Person[];
|
|
27
|
-
/** On a joiner: the host is there but has not let this Deck in yet. */
|
|
28
|
-
waiting: boolean;
|
|
29
|
-
/** On a joiner: no host heard from for a while (wrong code, or a network that blocks it). */
|
|
30
|
-
stuck: boolean;
|
|
31
|
-
gone: Gone | null;
|
|
32
|
-
hostName: string;
|
|
33
|
-
/** A passing line: someone on another version, or whatever the plugin `say`s. */
|
|
34
|
-
note: string;
|
|
35
|
-
roles: Roles;
|
|
36
|
-
/** Whether this Deck may change things. */
|
|
37
|
-
canEdit: boolean;
|
|
38
|
-
}
|
|
39
|
-
export interface ShareOptions {
|
|
40
|
-
/** What the share is for, e.g. "canvas-share". Decks only meet others using the same one. */
|
|
41
|
-
app: string;
|
|
42
|
-
/** The share code, which names the room (see newCode). */
|
|
43
|
-
code: string;
|
|
44
|
-
/** Optional extra secret, needed with the code to connect at all. Sharing works without one. */
|
|
45
|
-
password?: string;
|
|
46
|
-
/** The plugin's message channel, at most 12 bytes (Trystero's cap). Defaults to "msg". */
|
|
47
|
-
channel?: string;
|
|
48
|
-
/** Whether this Deck is the one sharing. */
|
|
49
|
-
host: boolean;
|
|
50
|
-
/** Shown to the others: in the host's knock, on cursors, in the list of who is here. */
|
|
51
|
-
name: string;
|
|
52
|
-
/** The plugin's own protocol version. Decks on different versions do not share. */
|
|
53
|
-
version: number;
|
|
54
|
-
/** The host's default for who may change things. Joiners may until the host says otherwise. */
|
|
55
|
-
mode?: Mode;
|
|
56
|
-
}
|
|
57
|
-
export interface ShareHandlers<T> {
|
|
58
|
-
/** A plugin message, only ever from someone let in (and the host). Check `mayEdit(peer)` before
|
|
59
|
-
* applying a change: a view-only person's edits are to be dropped by every Deck. */
|
|
60
|
-
message: (msg: T, peer: string) => void;
|
|
61
|
-
/** On the host: someone was just let in. Send them what they need to start, e.g. the board. */
|
|
62
|
-
welcome?: (peer: string) => void;
|
|
63
|
-
/** Someone left or was removed: forget what was kept for them (a cursor). */
|
|
64
|
-
left?: (peer: string) => void;
|
|
65
|
-
}
|
|
66
|
-
export interface P2pShare<T> {
|
|
67
|
-
readonly host: boolean;
|
|
68
|
-
/** Send a plugin message to everyone let in, or to one of them. Sends nothing before this Deck is
|
|
69
|
-
* let in. Settles once handed to the connection, so awaiting it paces the sender. */
|
|
70
|
-
send(msg: T, to?: string): Promise<void>;
|
|
71
|
-
/** Whether a peer may change things: the host always, anyone else by the roles. */
|
|
72
|
-
mayEdit(peer: string): boolean;
|
|
73
|
-
/** The host: let someone in, or turn them away. */
|
|
74
|
-
allow(peer: string): void;
|
|
75
|
-
deny(peer: string): void;
|
|
76
|
-
/** The host: remove someone who was let in. They cannot come back with the same Deck. */
|
|
77
|
-
kick(peer: string): void;
|
|
78
|
-
/** The host: everyone's default, and one person's own choice (`null` follows the default). */
|
|
79
|
-
setDefault(mode: Mode): void;
|
|
80
|
-
setPerson(peer: string, mode: Mode | null): void;
|
|
81
|
-
/** Show a passing line in the view for a few seconds. */
|
|
82
|
-
say(note: string): void;
|
|
83
|
-
/** Leave. With `announce` (the host ending on purpose) everyone is told first, so they end at
|
|
84
|
-
* once rather than when the connection times out. Safe to call twice. */
|
|
85
|
-
close(announce?: boolean): Promise<void>;
|
|
86
|
-
/** For useSyncExternalStore. */
|
|
87
|
-
subscribe(fn: () => void): () => void;
|
|
88
|
-
getView(): ShareView;
|
|
89
|
-
}
|
|
90
|
-
/** The part of a Trystero room a share uses: a seam, so the check can run a share without a network. */
|
|
91
|
-
export interface RoomLike {
|
|
92
|
-
/** This Deck's id in the room; Trystero's own is `selfId()`. */
|
|
93
|
-
selfId?: string;
|
|
94
|
-
makeAction(name: string, config: {
|
|
95
|
-
onMessage: (data: any, ctx: {
|
|
96
|
-
peerId: string;
|
|
97
|
-
}) => void;
|
|
98
|
-
}): {
|
|
99
|
-
send(data: any, options?: {
|
|
100
|
-
target?: string | string[];
|
|
101
|
-
}): Promise<void>;
|
|
102
|
-
};
|
|
103
|
-
ping(peer: string): Promise<number>;
|
|
104
|
-
leave(): Promise<void>;
|
|
105
|
-
getPeers(): Record<string, unknown>;
|
|
106
|
-
onPeerJoin: ((peer: string) => void) | null;
|
|
107
|
-
onPeerLeave: ((peer: string) => void) | null;
|
|
108
|
-
}
|
|
109
|
-
/** This Deck's id in every share: the one the others know it by. The same for the whole session,
|
|
110
|
-
* so someone let in who rejoins after a dropped connection is let straight back in. */
|
|
111
|
-
export declare function selfId(): string;
|
|
112
|
-
/** Start sharing (`host`), or ask to join someone's share. */
|
|
113
|
-
export declare function share<T extends Json>(opts: ShareOptions, on: ShareHandlers<T>, room?: RoomLike): P2pShare<T>;
|
|
114
|
-
/** A share code: 16 random characters in four groups, easy to read out or paste. */
|
|
115
|
-
export declare function newCode(random?: (n: number) => Uint8Array): string;
|
|
116
|
-
/** A pasted code, tidied: spaces dropped, case folded. Empty when it is not a code. */
|
|
117
|
-
export declare function cleanCode(text: string): string;
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
/** What can travel: anything JSON can carry. */
|
|
3
|
+
export type Json = string | number | boolean | null | Json[] | {
|
|
4
|
+
[k: string]: Json;
|
|
5
|
+
};
|
|
6
|
+
/** Whether someone may change what is shared, or only watch. */
|
|
7
|
+
export type Mode = "edit" | "view";
|
|
8
|
+
/** Who may change things: a default for everyone, and a choice per person that wins over it. */
|
|
9
|
+
export interface Roles {
|
|
10
|
+
def: Mode;
|
|
11
|
+
per: Record<string, Mode>;
|
|
12
|
+
}
|
|
13
|
+
/** Why a share ended for a joiner: the host stopped, vanished, removed this Deck, turned it away,
|
|
14
|
+
* or speaks another version. */
|
|
15
|
+
export type Gone = "ended" | "lost" | "removed" | "denied" | "version";
|
|
16
|
+
export interface Person {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string; /** Round trip in ms, once measured. */
|
|
19
|
+
ms?: number;
|
|
20
|
+
}
|
|
21
|
+
/** What a share's bar and dialogs show. Replaced, never mutated, so React sees a change. */
|
|
22
|
+
export interface ShareView {
|
|
23
|
+
/** Who is in and connected: on the host, everyone let in; on a joiner, the host and the others. */
|
|
24
|
+
peers: Person[];
|
|
25
|
+
/** On the host: who is asking to be let in. */
|
|
26
|
+
knocking: Person[];
|
|
27
|
+
/** On a joiner: the host is there but has not let this Deck in yet. */
|
|
28
|
+
waiting: boolean;
|
|
29
|
+
/** On a joiner: no host heard from for a while (wrong code, or a network that blocks it). */
|
|
30
|
+
stuck: boolean;
|
|
31
|
+
gone: Gone | null;
|
|
32
|
+
hostName: string;
|
|
33
|
+
/** A passing line: someone on another version, or whatever the plugin `say`s. */
|
|
34
|
+
note: string;
|
|
35
|
+
roles: Roles;
|
|
36
|
+
/** Whether this Deck may change things. */
|
|
37
|
+
canEdit: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface ShareOptions {
|
|
40
|
+
/** What the share is for, e.g. "canvas-share". Decks only meet others using the same one. */
|
|
41
|
+
app: string;
|
|
42
|
+
/** The share code, which names the room (see newCode). */
|
|
43
|
+
code: string;
|
|
44
|
+
/** Optional extra secret, needed with the code to connect at all. Sharing works without one. */
|
|
45
|
+
password?: string;
|
|
46
|
+
/** The plugin's message channel, at most 12 bytes (Trystero's cap). Defaults to "msg". */
|
|
47
|
+
channel?: string;
|
|
48
|
+
/** Whether this Deck is the one sharing. */
|
|
49
|
+
host: boolean;
|
|
50
|
+
/** Shown to the others: in the host's knock, on cursors, in the list of who is here. */
|
|
51
|
+
name: string;
|
|
52
|
+
/** The plugin's own protocol version. Decks on different versions do not share. */
|
|
53
|
+
version: number;
|
|
54
|
+
/** The host's default for who may change things. Joiners may until the host says otherwise. */
|
|
55
|
+
mode?: Mode;
|
|
56
|
+
}
|
|
57
|
+
export interface ShareHandlers<T> {
|
|
58
|
+
/** A plugin message, only ever from someone let in (and the host). Check `mayEdit(peer)` before
|
|
59
|
+
* applying a change: a view-only person's edits are to be dropped by every Deck. */
|
|
60
|
+
message: (msg: T, peer: string) => void;
|
|
61
|
+
/** On the host: someone was just let in. Send them what they need to start, e.g. the board. */
|
|
62
|
+
welcome?: (peer: string) => void;
|
|
63
|
+
/** Someone left or was removed: forget what was kept for them (a cursor). */
|
|
64
|
+
left?: (peer: string) => void;
|
|
65
|
+
}
|
|
66
|
+
export interface P2pShare<T> {
|
|
67
|
+
readonly host: boolean;
|
|
68
|
+
/** Send a plugin message to everyone let in, or to one of them. Sends nothing before this Deck is
|
|
69
|
+
* let in. Settles once handed to the connection, so awaiting it paces the sender. */
|
|
70
|
+
send(msg: T, to?: string): Promise<void>;
|
|
71
|
+
/** Whether a peer may change things: the host always, anyone else by the roles. */
|
|
72
|
+
mayEdit(peer: string): boolean;
|
|
73
|
+
/** The host: let someone in, or turn them away. */
|
|
74
|
+
allow(peer: string): void;
|
|
75
|
+
deny(peer: string): void;
|
|
76
|
+
/** The host: remove someone who was let in. They cannot come back with the same Deck. */
|
|
77
|
+
kick(peer: string): void;
|
|
78
|
+
/** The host: everyone's default, and one person's own choice (`null` follows the default). */
|
|
79
|
+
setDefault(mode: Mode): void;
|
|
80
|
+
setPerson(peer: string, mode: Mode | null): void;
|
|
81
|
+
/** Show a passing line in the view for a few seconds. */
|
|
82
|
+
say(note: string): void;
|
|
83
|
+
/** Leave. With `announce` (the host ending on purpose) everyone is told first, so they end at
|
|
84
|
+
* once rather than when the connection times out. Safe to call twice. */
|
|
85
|
+
close(announce?: boolean): Promise<void>;
|
|
86
|
+
/** For useSyncExternalStore. */
|
|
87
|
+
subscribe(fn: () => void): () => void;
|
|
88
|
+
getView(): ShareView;
|
|
89
|
+
}
|
|
90
|
+
/** The part of a Trystero room a share uses: a seam, so the check can run a share without a network. */
|
|
91
|
+
export interface RoomLike {
|
|
92
|
+
/** This Deck's id in the room; Trystero's own is `selfId()`. */
|
|
93
|
+
selfId?: string;
|
|
94
|
+
makeAction(name: string, config: {
|
|
95
|
+
onMessage: (data: any, ctx: {
|
|
96
|
+
peerId: string;
|
|
97
|
+
}) => void;
|
|
98
|
+
}): {
|
|
99
|
+
send(data: any, options?: {
|
|
100
|
+
target?: string | string[];
|
|
101
|
+
}): Promise<void>;
|
|
102
|
+
};
|
|
103
|
+
ping(peer: string): Promise<number>;
|
|
104
|
+
leave(): Promise<void>;
|
|
105
|
+
getPeers(): Record<string, unknown>;
|
|
106
|
+
onPeerJoin: ((peer: string) => void) | null;
|
|
107
|
+
onPeerLeave: ((peer: string) => void) | null;
|
|
108
|
+
}
|
|
109
|
+
/** This Deck's id in every share: the one the others know it by. The same for the whole session,
|
|
110
|
+
* so someone let in who rejoins after a dropped connection is let straight back in. */
|
|
111
|
+
export declare function selfId(): string;
|
|
112
|
+
/** Start sharing (`host`), or ask to join someone's share. */
|
|
113
|
+
export declare function share<T extends Json>(opts: ShareOptions, on: ShareHandlers<T>, room?: RoomLike): P2pShare<T>;
|
|
114
|
+
/** A share code: 16 random characters in four groups, easy to read out or paste. */
|
|
115
|
+
export declare function newCode(random?: (n: number) => Uint8Array): string;
|
|
116
|
+
/** A pasted code, tidied: spaces dropped, case folded. Empty when it is not a code. */
|
|
117
|
+
export declare function cleanCode(text: string): string;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
-
import { type Settings } from "./bridge";
|
|
3
|
-
/** Called by Settings after every write, so readers update without a reload. */
|
|
4
|
-
export declare function publishSettings(s: Settings): void;
|
|
5
|
-
/**
|
|
6
|
-
* Write settings and apply everything that has to happen alongside the write.
|
|
7
|
-
*
|
|
8
|
-
* Settings' own persist() used to be the only path, so anything outside that module (the
|
|
9
|
-
* command palette toggling relay, say) would have had to repeat five steps and would break
|
|
10
|
-
* quietly when one of them changed. Settings still owns its local form state and calls this
|
|
11
|
-
* for the shared half.
|
|
12
|
-
*/
|
|
13
|
-
export declare function saveSettings(next: Settings): void;
|
|
14
|
-
/** The zoom steps Ctrl+= and Ctrl+- move through, in percent, as a browser's do. */
|
|
15
|
-
export declare const ZOOM_STEPS: number[];
|
|
16
|
-
/**
|
|
17
|
-
* Zoom the whole window: the webview's own zoom, the same as a browser's Ctrl+=, rather than CSS
|
|
18
|
-
* `zoom`, which leaves xterm and Monaco measuring the mouse in unzoomed pixels.
|
|
19
|
-
*/
|
|
20
|
-
export declare function applyZoom(pct: number | undefined): void;
|
|
21
|
-
/** One step in or out from the current zoom, or back to 100% with dir 0. Saved like any setting. */
|
|
22
|
-
export declare function stepZoom(dir: -1 | 0 | 1): void;
|
|
23
|
-
/** Current settings for non-React callers (the palette's providers). */
|
|
24
|
-
export declare const getSettings: () => Settings;
|
|
25
|
-
export declare function userName(): Promise<string>;
|
|
26
|
-
export declare function useSettings(): Settings;
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
import { type Settings } from "./bridge";
|
|
3
|
+
/** Called by Settings after every write, so readers update without a reload. */
|
|
4
|
+
export declare function publishSettings(s: Settings): void;
|
|
5
|
+
/**
|
|
6
|
+
* Write settings and apply everything that has to happen alongside the write.
|
|
7
|
+
*
|
|
8
|
+
* Settings' own persist() used to be the only path, so anything outside that module (the
|
|
9
|
+
* command palette toggling relay, say) would have had to repeat five steps and would break
|
|
10
|
+
* quietly when one of them changed. Settings still owns its local form state and calls this
|
|
11
|
+
* for the shared half.
|
|
12
|
+
*/
|
|
13
|
+
export declare function saveSettings(next: Settings): void;
|
|
14
|
+
/** The zoom steps Ctrl+= and Ctrl+- move through, in percent, as a browser's do. */
|
|
15
|
+
export declare const ZOOM_STEPS: number[];
|
|
16
|
+
/**
|
|
17
|
+
* Zoom the whole window: the webview's own zoom, the same as a browser's Ctrl+=, rather than CSS
|
|
18
|
+
* `zoom`, which leaves xterm and Monaco measuring the mouse in unzoomed pixels.
|
|
19
|
+
*/
|
|
20
|
+
export declare function applyZoom(pct: number | undefined): void;
|
|
21
|
+
/** One step in or out from the current zoom, or back to 100% with dir 0. Saved like any setting. */
|
|
22
|
+
export declare function stepZoom(dir: -1 | 0 | 1): void;
|
|
23
|
+
/** Current settings for non-React callers (the palette's providers). */
|
|
24
|
+
export declare const getSettings: () => Settings;
|
|
25
|
+
export declare function userName(): Promise<string>;
|
|
26
|
+
export declare function useSettings(): Settings;
|
|
@@ -20,9 +20,11 @@ export interface TermPath {
|
|
|
20
20
|
* The shortest extent comes first, so a caller that only wants the unambiguous reading can take
|
|
21
21
|
* the first candidate per `start` and never consult the filesystem.
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* One line of text: a path wrapped over several rows is found once `joinRows` has put them back
|
|
24
|
+
* together.
|
|
25
|
+
*
|
|
26
|
+
* ponytail: a relative path resolves against the cwd the pane SPAWNED with, so it is wrong after a
|
|
27
|
+
* `cd`. Absolute paths — what Claude Code and most tools print — are unaffected.
|
|
26
28
|
*
|
|
27
29
|
* ponytail: only the END of a path can be recovered this way. A RELATIVE path whose first segment
|
|
28
30
|
* contains a space ("My Docs\a.txt") is anchored at "Docs\a.txt", because the match can only
|
|
@@ -43,3 +45,41 @@ export declare function findPaths(row: string, cwd: string): TermPath[];
|
|
|
43
45
|
* land on either.
|
|
44
46
|
*/
|
|
45
47
|
export declare function chooseLinks(candidates: readonly TermPath[], exists: readonly boolean[]): TermPath[];
|
|
48
|
+
/**
|
|
49
|
+
* A Windows path not found as printed, with a backslash put back that Markdown took out. Claude
|
|
50
|
+
* Code renders its output as Markdown, where `\.` and `\_` mean a plain dot and underscore, so
|
|
51
|
+
* "review-repo\.gitattributes" is shown as "review-repo.gitattributes". One reading per dot or
|
|
52
|
+
* underscore that follows a name character, each to be tried on disk.
|
|
53
|
+
*/
|
|
54
|
+
export declare function unescapedReadings(path: string): string[];
|
|
55
|
+
/** A row of the screen: its text (trailing blanks kept), and whether xterm wrapped it onto the row before. */
|
|
56
|
+
export interface Row {
|
|
57
|
+
text: string;
|
|
58
|
+
wrapped: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The line row `at` is part of, read back as one: rows xterm wrapped itself (a shell's long line),
|
|
62
|
+
* and rows a program broke where a path ran out of room. Claude Code wraps its own output, a hard
|
|
63
|
+
* line break with the rest indented under it, so xterm knows nothing of that wrap: a row and the
|
|
64
|
+
* next are taken as a path broken in two when the words either side of the break look like one
|
|
65
|
+
* (see `broken`), and they join without the break or the indent. `cells[i]` is where character `i`
|
|
66
|
+
* of the text is on screen: its row (an index into `rows`) and column. At most `reach` rows each way.
|
|
67
|
+
*
|
|
68
|
+
* A list of paths, one a row, joins too: only the filesystem can tell it from one path broken in
|
|
69
|
+
* two, which is why the terminal also offers the row on its own.
|
|
70
|
+
*/
|
|
71
|
+
export declare function joinRows(rows: readonly Row[], at: number, reach?: number): {
|
|
72
|
+
text: string;
|
|
73
|
+
cells: [number, number][];
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Every path candidate on row `at`, also one wrapped over the rows around it. A join xterm made is
|
|
77
|
+
* certain, but one at a break (`broken`) is a guess: a path can end a row with the next row's words
|
|
78
|
+
* glued on, so the joined line (`joinRows`) is read cut at each such break as well, every span of
|
|
79
|
+
* it that holds row `at`. Starts are indices into `text`, ascending, ready for `chooseLinks`;
|
|
80
|
+
* `cells` says where each is on screen.
|
|
81
|
+
*/
|
|
82
|
+
export declare function rowPaths(rows: readonly Row[], at: number, cwd: string): {
|
|
83
|
+
cands: TermPath[];
|
|
84
|
+
cells: [number, number][];
|
|
85
|
+
};
|
|
@@ -45,6 +45,18 @@ export interface LayoutTab {
|
|
|
45
45
|
hidden?: boolean;
|
|
46
46
|
/** The tab group it is in (LayoutWorkspace.groups); a group's tabs sit together in one zone. */
|
|
47
47
|
group?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Torn off into a window of its own (core/floatwin.ts): the window's id. Such a tab is in no
|
|
50
|
+
* zone, though it keeps its x/y to go back to. A restart reopens the window (Layout.floats has
|
|
51
|
+
* where it was).
|
|
52
|
+
*/
|
|
53
|
+
window?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Opened straight into a floating window by Deck (openInFloat: a link, a page an agent opened, a
|
|
56
|
+
* file Ctrl+clicked in a terminal), so closing that window closes it rather than docking it into
|
|
57
|
+
* the main window. Dropped the moment the tab is moved by hand: then it is one of yours.
|
|
58
|
+
*/
|
|
59
|
+
transient?: true;
|
|
48
60
|
}
|
|
49
61
|
export interface LayoutWorkspace {
|
|
50
62
|
id: string;
|
|
@@ -57,9 +69,21 @@ export interface LayoutWorkspace {
|
|
|
57
69
|
/** Its colour on the sidebar's collapsed rail, by index (Terminals' TONES); none picks one from the name. */
|
|
58
70
|
color?: number;
|
|
59
71
|
}
|
|
72
|
+
/** Where a floating window was, in physical screen pixels (its size and place before any maximise), to reopen it there. */
|
|
73
|
+
export interface FloatBounds {
|
|
74
|
+
id: string;
|
|
75
|
+
x: number;
|
|
76
|
+
y: number;
|
|
77
|
+
w: number;
|
|
78
|
+
h: number;
|
|
79
|
+
max?: boolean;
|
|
80
|
+
/** A window things are sent to by name (core/floatwin.ts openInFloat): "links", "agent". */
|
|
81
|
+
name?: string;
|
|
82
|
+
}
|
|
60
83
|
export interface Layout {
|
|
61
84
|
workspaces: LayoutWorkspace[];
|
|
62
85
|
activeWs: string;
|
|
86
|
+
floats?: FloatBounds[];
|
|
63
87
|
}
|
|
64
88
|
export declare function publishLayout(l: Layout): void;
|
|
65
89
|
export declare function getLayout(): Layout | null;
|
|
@@ -187,6 +211,15 @@ export declare function moveTabToZone(tabs: readonly LayoutTab[], tabId: string,
|
|
|
187
211
|
* result is right even for a zone that is not the active one.
|
|
188
212
|
*/
|
|
189
213
|
export declare function addTabToZone(tabs: readonly LayoutTab[], besideId: string, tab: LayoutTab): LayoutTab[];
|
|
214
|
+
/**
|
|
215
|
+
* A closed tab put back in workspace `w` (core/closedtabs.ts): in front in the zone you are in,
|
|
216
|
+
* with new ids for the tab and its panes, since the old panes' shells and state are gone. Out of
|
|
217
|
+
* any group and any window it was in. Returns the workspace and each old pane's new id.
|
|
218
|
+
*/
|
|
219
|
+
export declare function reopenTab(w: LayoutWorkspace, tab: LayoutTab, fresh?: () => string): {
|
|
220
|
+
w: LayoutWorkspace;
|
|
221
|
+
ids: Record<string, string>;
|
|
222
|
+
};
|
|
190
223
|
/**
|
|
191
224
|
* Make a workspace's active tab the one its zone shows.
|
|
192
225
|
*
|
|
@@ -202,6 +235,27 @@ export declare function showActiveTab(w: LayoutWorkspace): LayoutWorkspace;
|
|
|
202
235
|
* the zone nor back to its first tab; otherwise the first zone left.
|
|
203
236
|
*/
|
|
204
237
|
export declare function nextActiveAfterClose(tabs: readonly LayoutTab[], closing: string): string | undefined;
|
|
238
|
+
/**
|
|
239
|
+
* Tear a tab off into window `win`, or (`win` undefined) dock it back. A workspace always keeps
|
|
240
|
+
* one docked tab: floating its last one leaves a fresh terminal behind, as the main window has
|
|
241
|
+
* to show something. Tearing off the active tab makes its neighbour active.
|
|
242
|
+
*/
|
|
243
|
+
export declare function setTabWindow(w: LayoutWorkspace, tabId: string, win: string | undefined, keepGroup?: boolean): LayoutWorkspace;
|
|
244
|
+
/**
|
|
245
|
+
* Merge floating window `from`'s tabs into another window: floating window `into`, or (`into`
|
|
246
|
+
* null) the main window, into the active zone of the project it shows. They go in behind the tab
|
|
247
|
+
* that window shows, which stays shown: a tab dropped somewhere does not take you away from the one
|
|
248
|
+
* you were on. The tabs move between projects when the window they land in shows another one's,
|
|
249
|
+
* since a window holds one project's tabs.
|
|
250
|
+
*/
|
|
251
|
+
export declare function mergeWindow(l: Layout, from: string, into: string | null): Layout;
|
|
252
|
+
/**
|
|
253
|
+
* Close floating window `id` into the main window: its tabs go back to their zones, each behind the
|
|
254
|
+
* tab its zone shows, so closing a window does not take you away from the tab you are on. With
|
|
255
|
+
* `discard` (its X, Alt+F4), the tabs Deck opened into it (`transient`) close instead; the caller
|
|
256
|
+
* destroys their panes.
|
|
257
|
+
*/
|
|
258
|
+
export declare function dockWindow(l: Layout, id: string, discard?: boolean): Layout;
|
|
205
259
|
/** The first free spot on the top row, for a zone created without a position of its own. */
|
|
206
260
|
export declare function nextZoneSpot(tabs: readonly LayoutTab[], cols?: number, rows?: number): {
|
|
207
261
|
x: number;
|
|
@@ -286,7 +340,15 @@ export declare function moveLeaf(root: LayoutNode, srcId: string, targetId: stri
|
|
|
286
340
|
export declare function openTabInWorkspace(wsId: string, title: string, opts?: {
|
|
287
341
|
besideActive?: boolean;
|
|
288
342
|
}): string | null;
|
|
289
|
-
|
|
343
|
+
/**
|
|
344
|
+
* `agent`: asked for over the control API (an agent), not from Deck's own palette. Then a new
|
|
345
|
+
* terminal tab or project is added without switching to it (Settings → Where things open,
|
|
346
|
+
* agentTerminals), its shell started at once (spawnUnseen): a pane starts its shell when it is
|
|
347
|
+
* first drawn, and the agent's next command goes to that shell.
|
|
348
|
+
*/
|
|
349
|
+
export declare function applyDtCommand(op: string, args: Record<string, unknown>, agent?: boolean): string | void;
|
|
350
|
+
/** Close the pane `pane`: its whole tab when it is the tab's only pane, as an agent's page is. */
|
|
351
|
+
export declare function closePaneTab(pane: string): void;
|
|
290
352
|
interface Instance {
|
|
291
353
|
term: Terminal;
|
|
292
354
|
fit: FitAddon;
|
|
@@ -331,7 +393,7 @@ export declare function moveWorkspace(id: string, toIndex: number): void;
|
|
|
331
393
|
* Registered per attach because resolving a relative path needs the pane's cwd, which is what
|
|
332
394
|
* attach is given. The instance outlives its DOM, so the previous provider is disposed first
|
|
333
395
|
* rather than stacking a second one on every re-attach. The matching itself lives in shellpath
|
|
334
|
-
* (no xterm import), where it is exercised by shellpath.check.
|
|
396
|
+
* (no xterm import), where it is exercised by shellpath.check.mjs.
|
|
335
397
|
*
|
|
336
398
|
* Only a path that actually exists is offered as a link. Matching the shape of a path is not the
|
|
337
399
|
* same as having one: output wraps mid-path at the edge of a narrow pane, a relative path resolves
|
|
@@ -419,6 +481,27 @@ export declare function queueInput(paneId: string, text: string): void;
|
|
|
419
481
|
* the user picked (the agent launcher) has to handle both.
|
|
420
482
|
*/
|
|
421
483
|
export declare function sendInput(paneId: string, text: string): void;
|
|
484
|
+
/** The command that resumes an agent's session, or undefined for a kind Deck cannot resume. */
|
|
485
|
+
export declare const resumeCommand: (kind: string, session: string) => string;
|
|
486
|
+
/**
|
|
487
|
+
* The agent session each of these panes holds, read fresh from the sweep's file (the map cached at
|
|
488
|
+
* startup misses an agent started since): for a closed tab to resume it when reopened. Read before
|
|
489
|
+
* the next sweep, which drops a pane gone from the layout.
|
|
490
|
+
*/
|
|
491
|
+
export declare function agentSessions(ids: string[]): Promise<Record<string, {
|
|
492
|
+
kind: string;
|
|
493
|
+
session: string;
|
|
494
|
+
}>>;
|
|
495
|
+
/**
|
|
496
|
+
* What is running in these panes besides their shells, for a close to ask about: the programs the
|
|
497
|
+
* sweep saw in each (state/term-procs), or "an agent" for one it has not listed yet. Only panes
|
|
498
|
+
* with a shell count; a view pane loses nothing by closing.
|
|
499
|
+
*
|
|
500
|
+
* ponytail: term-procs is up to 10s old (the sweep's interval), so a program started just before
|
|
501
|
+
* the close is missed. A term_busy command taking its own snapshot (pane_pids + sweep_procs) would
|
|
502
|
+
* not be.
|
|
503
|
+
*/
|
|
504
|
+
export declare function runningIn(ids: string[]): Promise<string[]>;
|
|
422
505
|
/**
|
|
423
506
|
* Size a pane's PTY, and every view of it, to the SMALLER of those views.
|
|
424
507
|
*
|
|
@@ -431,6 +514,12 @@ export declare function sendInput(paneId: string, text: string): void;
|
|
|
431
514
|
* layout and re-fires the observer that called us. Measuring first and resizing once — only when
|
|
432
515
|
* the size actually differs — means the observer's next pass finds nothing to do and it settles.
|
|
433
516
|
*/
|
|
517
|
+
/**
|
|
518
|
+
* The terminals drawn in `doc` take its window's scale again: its window moved onto a monitor of
|
|
519
|
+
* other scaling (a floating window reopened where it was, or dragged there). The same hand-over
|
|
520
|
+
* as a move between windows (see attach).
|
|
521
|
+
*/
|
|
522
|
+
export declare function rebindTerminals(doc: Document): void;
|
|
434
523
|
export declare function refit(id: string): void;
|
|
435
524
|
/**
|
|
436
525
|
* Clear the screen, the way the shell expects.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
type Cleanup = void | (() => void);
|
|
3
|
+
type Hook = (win: Window) => Cleanup;
|
|
4
|
+
/** Every Deck window: the main one, then each floating one. */
|
|
5
|
+
export declare const allWindows: () => Window[];
|
|
6
|
+
/**
|
|
7
|
+
* A Deck window's Tauri label: "main", or a floating window's (floatwin.rs). A floating window is
|
|
8
|
+
* only registered here once its label exists, so every hook can rely on it.
|
|
9
|
+
*/
|
|
10
|
+
export declare function windowLabel(w: Window): string;
|
|
11
|
+
/**
|
|
12
|
+
* Whether `x` is an element, in any Deck window. Not `instanceof Element`: an element in a
|
|
13
|
+
* floating window is an instance of THAT window's Element, so the main window's check is false.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isElement(x: unknown): x is Element;
|
|
16
|
+
/**
|
|
17
|
+
* A ResizeObserver from the window `el` is drawn in. One made by the main window watches an element
|
|
18
|
+
* in a floating window only when the main window next draws, so a terminal opened in a float that
|
|
19
|
+
* waited for its size could sit blank for seconds.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resizeObserverFor(el: Element, cb: ResizeObserverCallback): ResizeObserver;
|
|
22
|
+
/** The window an element is drawn in: the main one, or a floating window's. */
|
|
23
|
+
export declare function winOf(el: Element | null | undefined): Window;
|
|
24
|
+
/**
|
|
25
|
+
* The Deck window the user is in: the one they last clicked, typed or moved focus in. Not
|
|
26
|
+
* document.hasFocus() alone: with a floating window in front, the main window's document still
|
|
27
|
+
* says it has focus too (WebView2, for a popup it opened), so the first match was always main.
|
|
28
|
+
*/
|
|
29
|
+
export declare function activeWindow(): Window;
|
|
30
|
+
/** What has focus in the window the user is in: what `document.activeElement` means in one window. */
|
|
31
|
+
export declare function activeElement(): Element | null;
|
|
32
|
+
/** Run `fn` for every Deck window, now and as floats open; what it returns runs when that window goes, or on the returned unsubscribe. */
|
|
33
|
+
export declare function onEachWindow(fn: Hook): () => void;
|
|
34
|
+
/** A floating window opened (floatwin.ts), its label known: every hook runs for it. */
|
|
35
|
+
export declare function addWindow(win: Window): void;
|
|
36
|
+
/** A floating window is going: what each hook installed in it is undone. */
|
|
37
|
+
export declare function removeWindow(win: Window): void;
|
|
38
|
+
/**
|
|
39
|
+
* Listen on every Deck window (or every window's document), now and as floats open; returns the
|
|
40
|
+
* unsubscribe. For what closes a menu or a dialog wherever the user is: Escape, a click outside.
|
|
41
|
+
*/
|
|
42
|
+
export declare function onAll<K extends keyof WindowEventMap>(type: K, fn: (e: WindowEventMap[K]) => void, opts?: boolean | AddEventListenerOptions, on?: "window" | "document"): () => void;
|
|
43
|
+
/**
|
|
44
|
+
* Make the main realm's `navigator.clipboard` work from every Deck window. The browser refuses a
|
|
45
|
+
* clipboard call from a document that does not have focus ("Document is not focused"), and the
|
|
46
|
+
* realm's clipboard is the MAIN window's: while the user works in a floating window, every copy and
|
|
47
|
+
* paste failed, a terminal's Ctrl+C clearing the selection with nothing copied. Each call now goes
|
|
48
|
+
* to the clipboard of the window the user is in, which is main's own when that is where they are.
|
|
49
|
+
* Installed once, before plugins load, so their copies and pastes get it too.
|
|
50
|
+
*/
|
|
51
|
+
export declare function routeClipboard(): void;
|
|
52
|
+
export {};
|
|
@@ -13,6 +13,12 @@ export declare function fileUri(path: string): monaco.Uri;
|
|
|
13
13
|
export declare function setUntitledLanguage(path: string, id: string | null): void;
|
|
14
14
|
/** Take `path` for `owner`; false when another editor's buffer has it. */
|
|
15
15
|
export declare function claimUntitled(path: string, owner: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Put `value` into `m` as the one edit between their common start and end, rather than replacing
|
|
18
|
+
* the whole text: a cursor outside the change stays where it is. A whole-text replace (setValue, or
|
|
19
|
+
* an edit over the full range) moved every cursor to the top of the file, mid-typing.
|
|
20
|
+
*/
|
|
21
|
+
export declare function replaceText(m: monaco.editor.ITextModel, value: string): void;
|
|
16
22
|
export declare function getFileModel(path: string, initial: string): monaco.editor.ITextModel;
|
|
17
23
|
export declare function setModelValue(path: string, value: string): void;
|
|
18
24
|
export declare function disposeModel(path: string | undefined): void;
|