deck-plugin-sdk 1.7.0 → 1.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.
package/README.md CHANGED
@@ -36,6 +36,7 @@ an optimisation but a requirement: two Reacts in one tree break hooks.
36
36
  | `deck-plugin dev` | rebuild whenever a source changes, and install each build into the test Deck |
37
37
  | `deck-plugin check` | validate `plugin.json` without building |
38
38
  | `deck-plugin install` | build once, then install into your real Deck |
39
+ | `deck-plugin publish` | check everything Deck's registry checks, then tag, release on GitHub and submit it (`--dry-run`: only check); see [Publishing](../docs/guide/publishing.md) |
39
40
 
40
41
  `--target test` or `--target main` picks the other Deck for either command. The test Deck keeps
41
42
  its plugins in `%APPDATA%\Deck-Dev\plugins`, your real Deck in `%APPDATA%\Deck\plugins`.
@@ -1,10 +1,12 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  // The Deck plugin CLI.
3
3
  //
4
4
  // deck-plugin build bundle src/ into plugin.js
5
5
  // deck-plugin dev rebuild whenever a source changes, into the test Deck each time
6
6
  // deck-plugin check validate plugin.json without building
7
7
  // deck-plugin install build once and copy into your Deck
8
+ // deck-plugin publish check, tag, release on GitHub, and submit to Deck's registry
9
+ // (--dry-run: only check; see ../publish.mjs)
8
10
  //
9
11
  // --target test|main which Deck dev and install write to (defaults: dev -> test, install -> main)
10
12
  //
@@ -13,6 +15,7 @@ import { watch } from "node:fs";
13
15
  import { cpSync, existsSync, mkdirSync, readFileSync } from "node:fs";
14
16
  import { join } from "node:path";
15
17
  import { buildPlugin } from "../build-plugin.mjs";
18
+ import { publish } from "../publish.mjs";
16
19
 
17
20
  const argv = process.argv.slice(2);
18
21
  const at = argv.indexOf("--target");
@@ -104,6 +107,12 @@ switch (cmd) {
104
107
  break;
105
108
  }
106
109
 
110
+ case "publish": {
111
+ const manifest = check();
112
+ await publish(dir, manifest, { dryRun: argv.includes("--dry-run"), buildPlugin });
113
+ break;
114
+ }
115
+
107
116
  case "install": {
108
117
  const manifest = check();
109
118
  await buildPlugin(dir);
package/package.json CHANGED
@@ -1,57 +1,60 @@
1
- {
2
- "name": "deck-plugin-sdk",
3
- "version": "1.7.0",
4
- "description": "Build a plugin for Deck, outside the Deck repository.",
5
- "type": "module",
6
- "license": "MIT",
7
- "bin": {
8
- "deck-plugin": "bin/deck-plugin.mjs"
9
- },
10
- "exports": {
11
- "./build": "./build-plugin.mjs",
12
- "./*": {
13
- "types": "./shim/*.d.ts",
14
- "default": "./shim/*.js"
15
- },
16
- "./package.json": "./package.json"
17
- },
18
- "files": [
19
- "bin",
20
- "shim",
21
- "types",
22
- "template",
23
- "build-plugin.mjs",
24
- "packages.mjs",
25
- "README.md"
26
- ],
27
- "dependencies": {
28
- "esbuild": "^0.28.0"
29
- },
30
- "peerDependencies": {
31
- "@types/react": "^19.0.0",
32
- "framer-motion": "^13.0.0",
33
- "lucide-react": "^1.0.0",
34
- "monaco-editor": "^0.56.0",
35
- "react": "^19.0.0",
36
- "typescript": "^5.0.0"
37
- },
38
- "peerDependenciesMeta": {
39
- "framer-motion": {
40
- "optional": true
41
- },
42
- "monaco-editor": {
43
- "optional": true
44
- },
45
- "typescript": {
46
- "optional": true
47
- }
48
- },
49
- "engines": {
50
- "node": ">=20"
51
- },
52
- "keywords": [
53
- "deck",
54
- "plugin",
55
- "sdk"
56
- ]
57
- }
1
+ {
2
+ "name": "deck-plugin-sdk",
3
+ "version": "1.8.0",
4
+ "description": "Build a plugin for Deck, outside the Deck repository.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "bin": {
8
+ "deck-plugin": "bin/deck-plugin.mjs"
9
+ },
10
+ "exports": {
11
+ "./build": "./build-plugin.mjs",
12
+ "./*": {
13
+ "types": "./shim/*.d.ts",
14
+ "default": "./shim/*.js"
15
+ },
16
+ "./package.json": "./package.json"
17
+ },
18
+ "files": [
19
+ "bin",
20
+ "shim",
21
+ "types",
22
+ "template",
23
+ "build-plugin.mjs",
24
+ "packages.mjs",
25
+ "README.md",
26
+ "permissions.json",
27
+ "publish.mjs",
28
+ "validate.mjs"
29
+ ],
30
+ "dependencies": {
31
+ "esbuild": "^0.28.0"
32
+ },
33
+ "peerDependencies": {
34
+ "@types/react": "^19.0.0",
35
+ "framer-motion": "^13.0.0",
36
+ "lucide-react": "^1.0.0",
37
+ "monaco-editor": "^0.56.0",
38
+ "react": "^19.0.0",
39
+ "typescript": "^5.0.0"
40
+ },
41
+ "peerDependenciesMeta": {
42
+ "framer-motion": {
43
+ "optional": true
44
+ },
45
+ "monaco-editor": {
46
+ "optional": true
47
+ },
48
+ "typescript": {
49
+ "optional": true
50
+ }
51
+ },
52
+ "engines": {
53
+ "node": ">=20"
54
+ },
55
+ "keywords": [
56
+ "deck",
57
+ "plugin",
58
+ "sdk"
59
+ ]
60
+ }
@@ -0,0 +1,230 @@
1
+ {
2
+ "generated": "by sdk/gen-permissions.mjs from src/core/permissions.ts; do not edit",
3
+ "permissions": {
4
+ "files": "Read and change files anywhere on this PC",
5
+ "processes": "Run programs and commands",
6
+ "git": "Read and change git repositories, and push",
7
+ "network": "Connect to servers: web requests, SSH, databases and other Decks",
8
+ "terminals": "Use your terminals and the AI agents running in them",
9
+ "browser": "Control Deck's browser and the pages open in it",
10
+ "secrets": "Use your saved passwords, your Google account and sudo passwords",
11
+ "system": "Change this PC's apps, startup programs, wallpaper and running processes",
12
+ "deck": "Change Deck itself: its settings, backups, plugins and languages"
13
+ },
14
+ "bridge": {
15
+ "adblockConfig": "browser",
16
+ "adblockInfo": "browser",
17
+ "adblockRebuild": "browser",
18
+ "adblockUpdate": "browser",
19
+ "agentClis": "terminals",
20
+ "agentMcpStatus": "terminals",
21
+ "agentStop": "terminals",
22
+ "askSudoPassword": "secrets",
23
+ "backupExport": "deck",
24
+ "backupInspect": "deck",
25
+ "backupRestore": "deck",
26
+ "bookmarksBarMode": "browser",
27
+ "browserAgentAnswer": "browser",
28
+ "browserAgentConfig": "browser",
29
+ "browserAgentFillAnswer": "browser",
30
+ "browserBounds": "browser",
31
+ "browserCapture": "browser",
32
+ "browserCdp": "browser",
33
+ "browserClear": "browser",
34
+ "browserClose": "browser",
35
+ "browserDefaultRegister": "browser",
36
+ "browserDefaultStatus": "browser",
37
+ "browserDevtools": "browser",
38
+ "browserDownload": "browser",
39
+ "browserFind": "browser",
40
+ "browserHistoryCount": "browser",
41
+ "browserHistoryForgetRange": "browser",
42
+ "browserHistoryForgetUrl": "browser",
43
+ "browserHistoryList": "browser",
44
+ "browserHistoryRecent": "browser",
45
+ "browserHistorySuggest": "browser",
46
+ "browserHistoryVisit": "browser",
47
+ "browserMute": "browser",
48
+ "browserNav": "browser",
49
+ "browserNotificationClicked": "browser",
50
+ "browserOpen": "browser",
51
+ "browserOpenAppLink": "browser",
52
+ "browserPermissionAnswer": "browser",
53
+ "browserPermissions": "browser",
54
+ "browserPermissionSet": "browser",
55
+ "browserPrint": "browser",
56
+ "browserPrivacy": "browser",
57
+ "browserReloadHung": "browser",
58
+ "browserSetKeys": "browser",
59
+ "browserSite": "browser",
60
+ "browserSiteAnswer": "browser",
61
+ "browserSiteClear": "browser",
62
+ "browserSleep": "browser",
63
+ "browserWindowFullscreen": "browser",
64
+ "browserZoom": "browser",
65
+ "claudePlanLimits": "terminals",
66
+ "claudeUsage": "terminals",
67
+ "clearWallpaper": "system",
68
+ "convertFileSrc": "files",
69
+ "dbConnect": "network",
70
+ "dbDisconnect": "network",
71
+ "dbQuery": "network",
72
+ "dbSchema": "network",
73
+ "deleteIconPack": "deck",
74
+ "exec": "processes",
75
+ "extensionInstallFolder": "browser",
76
+ "extensionInstallStore": "browser",
77
+ "extensionPopup": "browser",
78
+ "extensionPopupClose": "browser",
79
+ "extensionReload": "browser",
80
+ "extensionRemove": "browser",
81
+ "extensionSetEnabled": "browser",
82
+ "extensionsList": "browser",
83
+ "fsCopy": "files",
84
+ "fsCreateDir": "files",
85
+ "fsCreateFile": "files",
86
+ "fsDelete": "files",
87
+ "fsDrives": "files",
88
+ "fsFiles": "files",
89
+ "fsFind": "files",
90
+ "fsHash": "files",
91
+ "fsList": "files",
92
+ "fsMove": "files",
93
+ "fsOpen": "files",
94
+ "fsRead": "files",
95
+ "fsReadBytes": "files",
96
+ "fsRename": "files",
97
+ "fsReplace": "files",
98
+ "fsReveal": "files",
99
+ "fsSaveUnique": "files",
100
+ "fsSearch": "files",
101
+ "fsSize": "files",
102
+ "fsThumbnail": "files",
103
+ "fsTrash": "files",
104
+ "fsWrite": "files",
105
+ "fsWriteBytes": "files",
106
+ "ghPrLineComment": "network",
107
+ "ghPrThreads": "network",
108
+ "ghRun": "processes",
109
+ "ghThreadReply": "network",
110
+ "ghThreadResolve": "network",
111
+ "gitAiCommitMsg": "git",
112
+ "gitBlameLine": "git",
113
+ "gitCheckout": "git",
114
+ "gitCheckoutDetach": "git",
115
+ "gitCheckoutNew": "git",
116
+ "gitCheckoutTrack": "git",
117
+ "gitCommitFiles": "git",
118
+ "gitDiscard": "git",
119
+ "gitFileBytes": "git",
120
+ "gitFileDiff": "git",
121
+ "gitInfo": "git",
122
+ "gitLogGraph": "git",
123
+ "gitPoll": "git",
124
+ "gitRangeFiles": "git",
125
+ "gitRefs": "git",
126
+ "gitRepos": "git",
127
+ "gitRun": "git",
128
+ "gitStatus": "git",
129
+ "glabApi": "network",
130
+ "glabRun": "processes",
131
+ "googleAccount": "secrets",
132
+ "googleSignIn": "secrets",
133
+ "googleSignOut": "secrets",
134
+ "googleToken": "secrets",
135
+ "httpCancel": "network",
136
+ "httpSend": "network",
137
+ "httpSendAs": "network",
138
+ "httpSendReply": "network",
139
+ "importIconPack": "deck",
140
+ "installAgentHooks": "terminals",
141
+ "installAgentMcp": "terminals",
142
+ "installAgentSkills": "terminals",
143
+ "installFromRegistry": "deck",
144
+ "launchFiles": "files",
145
+ "listApps": "system",
146
+ "listInstalled": "system",
147
+ "logLatest": "deck",
148
+ "mediaMeta": "files",
149
+ "memKill": "system",
150
+ "openFile": "files",
151
+ "openTestDeck": "deck",
152
+ "procKill": "processes",
153
+ "procStream": "processes",
154
+ "procWrite": "processes",
155
+ "readIconPackTheme": "deck",
156
+ "readTermLayout": "terminals",
157
+ "readTrackMeta": "files",
158
+ "remoteHome": "network",
159
+ "remoteStat": "network",
160
+ "remoteSudoPassword": "secrets",
161
+ "removeLanguage": "deck",
162
+ "restartApp": "deck",
163
+ "runScriptNow": "processes",
164
+ "sessionList": "terminals",
165
+ "setAutostart": "system",
166
+ "setDebugTargets": "processes",
167
+ "setWallpaper": "system",
168
+ "sshHosts": "network",
169
+ "sshTunnelClose": "network",
170
+ "sshTunnelOpen": "network",
171
+ "vaultChangePassword": "secrets",
172
+ "vaultConfig": "secrets",
173
+ "vaultCreate": "secrets",
174
+ "vaultDelete": "secrets",
175
+ "vaultExport": "secrets",
176
+ "vaultFill": "secrets",
177
+ "vaultFillNew": "secrets",
178
+ "vaultGenerate": "secrets",
179
+ "vaultImport": "secrets",
180
+ "vaultList": "secrets",
181
+ "vaultLock": "secrets",
182
+ "vaultMatches": "secrets",
183
+ "vaultNeverList": "secrets",
184
+ "vaultNeverRemove": "secrets",
185
+ "vaultOfferAnswer": "secrets",
186
+ "vaultSave": "secrets",
187
+ "vaultSecret": "secrets",
188
+ "vaultStatus": "secrets",
189
+ "vaultTotp": "secrets",
190
+ "vaultUnlock": "secrets",
191
+ "vpsRunsPull": "network",
192
+ "watchFiles": "files"
193
+ },
194
+ "modules": {
195
+ "terminals": "terminals",
196
+ "p2p": "network"
197
+ },
198
+ "free": [
199
+ "DEFAULT_SETTINGS",
200
+ "FOOTER_ITEMS",
201
+ "configDelete",
202
+ "configRead",
203
+ "configWrite",
204
+ "dataDir",
205
+ "deckReady",
206
+ "dirsDownload",
207
+ "footerOrder",
208
+ "fsHomeDir",
209
+ "getAutostart",
210
+ "isFullscreen",
211
+ "languagesDir",
212
+ "launchUrls",
213
+ "mediaSetNowPlaying",
214
+ "mediaSetPlayback",
215
+ "memUsage",
216
+ "notifyOs",
217
+ "openExternal",
218
+ "pickAnyFile",
219
+ "pickExe",
220
+ "pickFile",
221
+ "pickFolder",
222
+ "pickImage",
223
+ "pickSavePath",
224
+ "pickScript",
225
+ "pluginsDir",
226
+ "revealInFolder",
227
+ "startupMarks",
228
+ "toggleFullscreen"
229
+ ]
230
+ }
package/publish.mjs ADDED
@@ -0,0 +1,116 @@
1
+ // `deck-plugin publish`: put this version of a plugin in Deck's registry.
2
+ //
3
+ // deck-plugin publish --dry-run check everything, publish nothing
4
+ // deck-plugin publish tag, release on GitHub, and open the submission PR
5
+ //
6
+ // Runs on the author's machine the checks the registry runs on its own (validate.mjs, shared),
7
+ // so a submission that would fail fails here, before anything is public:
8
+ // the manifest, README, LICENSE and package-lock.json; a clean, pushed git tree; a build from
9
+ // the lockfile exactly as the registry will repeat it (npm ci, then this SDK's build); the
10
+ // release's files and sizes; and that its permissions cover what the bundle calls.
11
+ // Then it tags v<version>, makes the GitHub release with the built files, and opens a pull
12
+ // request to the registry adding submissions/<id>.json, through the author's fork. The registry's
13
+ // checks run on that PR and merge it when they pass.
14
+ //
15
+ // Needs git and the GitHub CLI (gh), signed in.
16
+ import { execFileSync } from "node:child_process";
17
+ import { existsSync, readFileSync, statSync } from "node:fs";
18
+ import { dirname, join } from "node:path";
19
+ import { fileURLToPath } from "node:url";
20
+ import { checkAssets, checkId, checkLockfile, checkManifest, checkPermissions } from "./validate.mjs";
21
+
22
+ const here = dirname(fileURLToPath(import.meta.url));
23
+ const REGISTRY = "deck-desktop/deck-registry";
24
+
25
+ /** npm's own entry point, run with node: on Windows npm is npm.cmd, which Node will not execFile. */
26
+ function npmCli() {
27
+ for (const p of [join(dirname(process.execPath), "node_modules", "npm", "bin", "npm-cli.js"),
28
+ join(dirname(process.execPath), "..", "lib", "node_modules", "npm", "bin", "npm-cli.js")]) if (existsSync(p)) return p;
29
+ return null;
30
+ }
31
+
32
+ export async function publish(dir, manifest, { dryRun, buildPlugin }) {
33
+ const run = (cmd, args, opts = {}) => execFileSync(cmd, args, { cwd: dir, stdio: ["ignore", "pipe", "pipe"], ...opts }).toString().trim();
34
+ const ok = (cmd, args) => { try { run(cmd, args); return true; } catch { return false; } };
35
+ const errors = [], notes = [];
36
+ const say = (s) => console.log(s);
37
+
38
+ // ---- what is in the folder ----
39
+ errors.push(...checkId(manifest.id ?? ""), ...checkManifest(manifest));
40
+ if (!existsSync(join(dir, "README.md"))) errors.push("no README.md: it is the plugin's page in Deck and on the website");
41
+ if (!["LICENSE", "LICENSE.md", "LICENSE.txt", "COPYING"].some((f) => existsSync(join(dir, f)))) errors.push("no LICENSE: say how others may use it (the scaffold's is MIT)");
42
+ if (existsSync(join(dir, ".npmrc"))) errors.push("there is an .npmrc: the registry installs from registry.npmjs.org only, so remove it");
43
+ const lockAt = join(dir, "package-lock.json");
44
+ if (!existsSync(lockAt)) errors.push("no package-lock.json: commit it, so the registry can repeat the build exactly");
45
+ else errors.push(...checkLockfile(JSON.parse(readFileSync(lockAt, "utf8"))));
46
+ const custom = existsSync(join(dir, "deck-plugin.config.mjs"));
47
+ if (custom) notes.push("It has a deck-plugin.config.mjs, which the build runs, so the registry will not rebuild it to check it: it is listed as build not verified.");
48
+
49
+ // ---- git and GitHub ----
50
+ if (!ok("git", ["rev-parse", "--is-inside-work-tree"])) errors.push("this is not a git repository");
51
+ let repo = "";
52
+ try {
53
+ const url = run("git", ["remote", "get-url", "origin"]);
54
+ repo = /github\.com[:/]([\w.-]+\/[\w.-]+?)(?:\.git)?$/.exec(url)?.[1] ?? "";
55
+ if (!repo) errors.push(`origin is ${url}, not a GitHub repository`);
56
+ } catch { errors.push("there is no origin remote: push it to a public GitHub repository first"); }
57
+ if (ok("git", ["rev-parse", "HEAD"]) && run("git", ["status", "--porcelain"])) errors.push("there are uncommitted changes: commit them, so the release is what the repository holds");
58
+ if (!ok("gh", ["auth", "status"])) errors.push("the GitHub CLI is not signed in: run `gh auth login`");
59
+ const tag = `v${manifest.version}`;
60
+ if (ok("git", ["rev-parse", "-q", "--verify", `refs/tags/${tag}`])) errors.push(`${tag} is already tagged: bump the version in plugin.json`);
61
+ if (repo && ok("gh", ["release", "view", tag, "--repo", repo])) errors.push(`${repo} already has a release ${tag}: bump the version in plugin.json`);
62
+ if (repo && ok("gh", ["api", `repos/${repo}`]) && JSON.parse(run("gh", ["api", `repos/${repo}`])).private) errors.push(`${repo} is private: a package's source has to be public`);
63
+
64
+ if (errors.length) {
65
+ for (const e of errors) console.error(` ✗ ${e}`);
66
+ process.exit(1);
67
+ }
68
+
69
+ // ---- the build, exactly as the registry will repeat it ----
70
+ say("Building from the lockfile, as the registry will…");
71
+ const npm = npmCli();
72
+ if (!npm) { console.error(" ✗ npm was not found beside node"); process.exit(1); }
73
+ run(process.execPath, [npm, "ci", "--ignore-scripts", "--no-audit", "--no-fund"]);
74
+ await buildPlugin(dir);
75
+ const files = ["plugin.json", "plugin.js", "mcp.js"].filter((f) => existsSync(join(dir, f)));
76
+ errors.push(...checkAssets("plugin", files.map((f) => ({ name: f, size: statSync(join(dir, f)).size }))));
77
+ const table = JSON.parse(readFileSync(join(here, "permissions.json"), "utf8"));
78
+ const perms = checkPermissions(manifest.permissions, readFileSync(join(dir, "plugin.js"), "utf8"), table);
79
+ errors.push(...perms.errors);
80
+ notes.push(...perms.notes);
81
+ if (errors.length) {
82
+ for (const e of errors) console.error(` ✗ ${e}`);
83
+ process.exit(1);
84
+ }
85
+
86
+ say(`\n${manifest.name} ${manifest.version} is ready: ${files.join(", ")}${manifest.permissions.length ? `; it uses ${manifest.permissions.join(", ")}` : ""}.`);
87
+ for (const n of notes) say(` note: ${n}`);
88
+ if (dryRun) {
89
+ say(`\nDry run: nothing was tagged, released or submitted. Without --dry-run this tags ${tag}, releases it on ${repo}, and opens a PR to ${REGISTRY}.`);
90
+ return;
91
+ }
92
+
93
+ // ---- tag, release, submit ----
94
+ say(`Tagging ${tag} and pushing…`);
95
+ run("git", ["tag", tag]);
96
+ run("git", ["push", "-q", "origin", "HEAD", tag]);
97
+ say(`Releasing ${tag} on ${repo}…`);
98
+ run("gh", ["release", "create", tag, ...files.map((f) => join(dir, f)), "--repo", repo,
99
+ "--title", `${manifest.name} ${manifest.version}`, "--notes", `${manifest.name} ${manifest.version}, for Deck ${manifest.minDeck} and later.`]);
100
+
101
+ say(`Opening the submission to ${REGISTRY}…`);
102
+ const me = JSON.parse(run("gh", ["api", "user"])).login;
103
+ ok("gh", ["repo", "fork", REGISTRY, "--clone=false"]);
104
+ const fork = `${me}/${REGISTRY.split("/")[1]}`;
105
+ // The fork may be behind; the submission branch starts from the registry's main as it is now.
106
+ ok("gh", ["repo", "sync", fork, "--source", REGISTRY]);
107
+ const sha = JSON.parse(run("gh", ["api", `repos/${fork}/git/ref/heads/main`])).object.sha;
108
+ const branch = `submit/${manifest.id}-${manifest.version}`;
109
+ run("gh", ["api", "-X", "POST", `repos/${fork}/git/refs`, "-f", `ref=refs/heads/${branch}`, "-f", `sha=${sha}`]);
110
+ const body = JSON.stringify({ kind: "plugin", repo, tag }) + "\n";
111
+ run("gh", ["api", "-X", "PUT", `repos/${fork}/contents/submissions/${manifest.id}.json`,
112
+ "-f", `message=Submit ${manifest.id} ${tag}`, "-f", `content=${Buffer.from(body).toString("base64")}`, "-f", `branch=${branch}`]);
113
+ const pr = run("gh", ["pr", "create", "--repo", REGISTRY, "--base", "main", "--head", `${me}:${branch}`,
114
+ "--title", `Submit ${manifest.id} ${tag}`, "--body", `${manifest.name} ${manifest.version} from ${repo}.\n\nOpened by \`deck-plugin publish\`.`]);
115
+ say(`\nSubmitted: ${pr}\nThe registry's checks run there and comment what they find; when they pass it is merged and listed.`);
116
+ }
package/shim/bridge.js CHANGED
@@ -4,8 +4,10 @@
4
4
  // evaluated during loadPlugins, and a reference copied out then would capture a half-built
5
5
  // object. Functions forward their arguments; plain values are proxied.
6
6
  import { pluginId, scoped } from "./scope.js";
7
+ // The plugin's own view (Deck 1.8+), which refuses what its permissions do not cover; an older
8
+ // Deck has only the whole bridge.
7
9
  const b = () => {
8
- const x = window.__deck?.bridge;
10
+ const x = window.__deck?.forPlugin?.(pluginId)?.bridge ?? window.__deck?.bridge;
9
11
  if (!x) throw new Error("window.__deck.bridge is missing — this plugin only runs inside Deck");
10
12
  return x;
11
13
  };
package/shim/p2p.js CHANGED
@@ -1,15 +1,16 @@
1
- // GENERATED by sdk/gen-shim.mjs — do not edit.
2
- //
3
- // Deck's live connections to other Decks. Resolved at USE time like the bridge: a plugin module is evaluated
4
- // during loadPlugins, and a reference copied out at import time would capture a half-built
5
- // object. One transport for every plugin, so a fix to it reaches all of them.
6
- const t = () => {
7
- const x = window.__deck?.p2p;
8
- if (!x) throw new Error("window.__deck.p2p is missing — this plugin only runs inside Deck");
9
- return x;
10
- };
11
-
12
- export const cleanCode = (...a) => t().cleanCode(...a);
13
- export const newCode = (...a) => t().newCode(...a);
14
- export const selfId = (...a) => t().selfId(...a);
15
- export const share = (...a) => t().share(...a);
1
+ // GENERATED by sdk/gen-shim.mjs — do not edit.
2
+ //
3
+ // Deck's live connections to other Decks. Resolved at USE time like the bridge: a plugin module is evaluated
4
+ // during loadPlugins, and a reference copied out at import time would capture a half-built
5
+ // object. One transport for every plugin, so a fix to it reaches all of them.
6
+ import { pluginId } from "./scope.js";
7
+ const t = () => {
8
+ const x = window.__deck?.forPlugin?.(pluginId)?.p2p ?? window.__deck?.p2p;
9
+ if (!x) throw new Error("window.__deck.p2p is missing — this plugin only runs inside Deck");
10
+ return x;
11
+ };
12
+
13
+ export const cleanCode = (...a) => t().cleanCode(...a);
14
+ export const newCode = (...a) => t().newCode(...a);
15
+ export const selfId = (...a) => t().selfId(...a);
16
+ export const share = (...a) => t().share(...a);
package/shim/settings.js CHANGED
@@ -1,16 +1,17 @@
1
- // GENERATED by sdk/gen-shim.mjs — do not edit.
2
- //
3
- // Deck's settings store. Use this ONLY for settings Deck itself defines and its Rust side reads;
4
- // a plugin's own settings belong in its own config file via configRead/configWrite.
5
- const s = () => {
6
- const x = window.__deck?.settings;
7
- if (!x) throw new Error("window.__deck.settings is missing — this plugin only runs inside Deck");
8
- return x;
9
- };
10
-
11
- export const useSettings = (...a) => s().use(...a);
12
- export const getSettings = (...a) => s().get(...a);
13
- export const saveSettings = (...a) => s().save(...a);
14
- // What to call the user (needs a Deck newer than 1.1): the name set in Settings, else their Google or Windows
15
- // account's. For a plugin that shows the user to someone else.
16
- export const userName = (...a) => s().userName(...a);
1
+ // GENERATED by sdk/gen-shim.mjs — do not edit.
2
+ //
3
+ // Deck's settings store. Use this ONLY for settings Deck itself defines and its Rust side reads;
4
+ // a plugin's own settings belong in its own config file via configRead/configWrite.
5
+ import { pluginId } from "./scope.js";
6
+ const s = () => {
7
+ const x = window.__deck?.forPlugin?.(pluginId)?.settings ?? window.__deck?.settings;
8
+ if (!x) throw new Error("window.__deck.settings is missing — this plugin only runs inside Deck");
9
+ return x;
10
+ };
11
+
12
+ export const useSettings = (...a) => s().use(...a);
13
+ export const getSettings = (...a) => s().get(...a);
14
+ export const saveSettings = (...a) => s().save(...a);
15
+ // What to call the user (needs a Deck newer than 1.1): the name set in Settings, else their Google or Windows
16
+ // account's. For a plugin that shows the user to someone else.
17
+ export const userName = (...a) => s().userName(...a);
package/shim/terminals.js CHANGED
@@ -4,8 +4,9 @@
4
4
  // during loadPlugins, and a reference copied out at import time would capture a half-built
5
5
  // object. The layout store is shared, not copied — a second one would not know about the panes
6
6
  // Deck already has open.
7
+ import { pluginId } from "./scope.js";
7
8
  const t = () => {
8
- const x = window.__deck?.terminals;
9
+ const x = window.__deck?.forPlugin?.(pluginId)?.terminals ?? window.__deck?.terminals;
9
10
  if (!x) throw new Error("window.__deck.terminals is missing — this plugin only runs inside Deck");
10
11
  return x;
11
12
  };