agent-deeplinks 0.1.24 → 0.1.26

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
@@ -21,7 +21,7 @@ On npm 12, add `--allow-remote=root` when installing the tarball URL. [npm 12 in
21
21
  You can also download the ZIP from GitHub Releases and install its bundled npm tarball. The ZIP includes a static demo and the SVG files.
22
22
 
23
23
  ```sh
24
- npm install ./agent-deeplinks-0.1.24.tgz
24
+ npm install ./agent-deeplinks-0.1.26.tgz
25
25
  ```
26
26
 
27
27
  ## Usage
@@ -40,12 +40,25 @@ console.log(url, route?.behavior, agents.cursor.name)
40
40
 
41
41
  Experimental routes require `allowExperimental: true`. Routes that auto-submit require `allowSend: true`. Prompt text goes into the URL and can appear in browser history and logs. Keep credentials and private data out of shareable links.
42
42
 
43
+ Cursor Desktop links encode the draft for both decoders in the app. The official Cursor web handoff can turn literal plus signs into spaces in the desktop review. Choose Desktop when the exact punctuation matters. [Cursor verification](research/coding-agents.md#cursor)
44
+
43
45
  Claude Code's iOS, Android, and HTTPS draft links support a prompt, a session `mode` of `plan` or `code`, an optional GitHub `repo` in `owner/name` format, and an optional `branch` when a repository is supplied.
44
46
 
45
47
  Use `getAgentLink("claude-code", "vscode", { prompt: "Review my changes." })` to prefill a draft in the Claude Code extension for VS Code. Pass `session` to resume a session from the current workspace.
46
48
 
47
49
  For Claude and Claude Code web links, use `browserOnly: true` to keep the link in the browser on iOS. Leave it unset for the usual Universal Link handoff.
48
50
 
51
+ Claude Code Desktop also accepts `sshHost` with optional `sshPort` and `sshFolder`. Claude shows the target for review before use and keeps the prompt as an editable draft. This requires Desktop v2.110.0 or later and a signed-in account. [SSH deeplinks](https://code.claude.com/docs/en/desktop#open-an-ssh-session-from-a-link)
52
+
53
+ ```ts
54
+ const remoteDraft = getAgentLink("claude-code", "desktop", {
55
+ sshHost: "dev@build.example.com",
56
+ sshPort: "2222",
57
+ sshFolder: "~/project",
58
+ prompt: "Review the build logs.",
59
+ })
60
+ ```
61
+
49
62
  GitHub Copilot Desktop can open a draft with a prompt, an `owner/repo` repository, or a custom agent. The Web option wraps draft links in GitHub’s hosted launcher. Choose `vscode` to open the VS Code Agents window with a prompt and an optional `workspace` folder URI.
50
63
 
51
64
  ```ts
package/dist/catalog.d.ts CHANGED
@@ -3,7 +3,7 @@ export type Platform = (typeof platforms)[number];
3
3
  export declare const platformNames: Readonly<Record<Platform, string>>;
4
4
  export type Evidence = "documented" | "source" | "observed" | "verified";
5
5
  export type LinkBehavior = "draft" | "launch" | "handoff" | "confirm" | "send" | "unknown";
6
- export type LinkField = "prompt" | "cwd" | "repo" | "path" | "originUrl" | "directory" | "provider" | "model" | "botId" | "folder" | "server" | "mode" | "branch" | "session" | "pr" | "customAgent" | "workspace";
6
+ export type LinkField = "prompt" | "cwd" | "repo" | "path" | "originUrl" | "directory" | "provider" | "model" | "botId" | "folder" | "server" | "mode" | "branch" | "session" | "pr" | "customAgent" | "workspace" | "sshHost" | "sshPort" | "sshFolder";
7
7
  export interface AgentRoute {
8
8
  readonly url: string;
9
9
  readonly behavior: LinkBehavior;
@@ -45,8 +45,8 @@ declare const catalog: {
45
45
  readonly launchUrl: "https://cursor.com/agents";
46
46
  readonly behavior: "handoff";
47
47
  readonly evidence: "verified";
48
- readonly sources: readonly ["https://cursor.com/docs/reference/deeplinks", "https://cursor.com/docs/cloud-agent"];
49
- readonly note: "The browser handoff displayed the draft and produced the exact native link. An empty link opens Cloud Agents in the browser.";
48
+ readonly sources: readonly ["https://cursor.com/docs/reference/deeplinks", "https://cursor.com/docs/cloud-agent", "https://github.com/lalalune/agent-deeplinks/actions/runs/45487974246/artifacts/14965396228"];
49
+ readonly note: "The browser preview reached Cursor’s native review on Ubuntu. Cursor’s handoff turned a literal plus into a space in that review. An empty link opens Cloud Agents in the browser.";
50
50
  readonly fields: {
51
51
  readonly prompt: "text";
52
52
  };
@@ -55,9 +55,10 @@ declare const catalog: {
55
55
  };
56
56
  readonly desktop: {
57
57
  readonly url: "cursor://anysphere.cursor-deeplink/prompt";
58
- readonly sources: readonly ["https://cursor.com/docs/reference/deeplinks", "https://github.com/lalalune/agent-deeplinks/actions/runs/45460026095/job/138679769952", "https://github.com/lalalune/agent-deeplinks/actions/runs/45460380555/job/138681026834"];
59
- readonly note: "macOS and Ubuntu opened Cursor Agents at sign-in. Windows received the exact link after first launch registered Cursor's handler. Signed-in composer prefill remains unverified.";
60
- readonly behavior: "draft";
58
+ readonly encodeQueryValuesTwice: true;
59
+ readonly sources: readonly ["https://cursor.com/docs/reference/deeplinks", "https://github.com/lalalune/agent-deeplinks/actions/runs/45460026095/job/138679769952", "https://github.com/lalalune/agent-deeplinks/actions/runs/45460380555/job/138681026834", "https://github.com/lalalune/agent-deeplinks/actions/runs/45489023213/artifacts/14966850011"];
60
+ readonly note: "Cursor asks for prompt confirmation. The corrected link preserved the full text in the shipped parser and activated Cursor 3.31.15 on Ubuntu. The corrected link’s visible review remains unverified.";
61
+ readonly behavior: "confirm";
61
62
  readonly evidence: "documented";
62
63
  readonly fields: {
63
64
  readonly prompt: "text";
@@ -126,8 +127,8 @@ declare const catalog: {
126
127
  readonly url: "https://cursor.com/grok-bot/link/v1/prompt";
127
128
  readonly behavior: "handoff";
128
129
  readonly evidence: "verified";
129
- readonly note: "The handoff attempts to open Grok Bot. The button and automatic dispatch used the exact native URL in desktop and mobile browser profiles.";
130
- readonly sources: readonly ["https://docs.x.ai/grok-bot/deep-links"];
130
+ readonly sources: readonly ["https://docs.x.ai/grok-bot/deep-links", "https://github.com/lalalune/agent-deeplinks/actions/runs/45488932416/artifacts/14966115165"];
131
+ readonly note: "The published Playground opened the native Grok Bot sign-in screen through stock Chrome on Ubuntu after the browser’s one-time approval. The mobile browser preview also produced the exact native URL.";
131
132
  readonly fields: {
132
133
  readonly prompt: "text";
133
134
  readonly botId: "id";
@@ -372,12 +373,15 @@ declare const catalog: {
372
373
  readonly url: "claude://code/new";
373
374
  readonly behavior: "draft";
374
375
  readonly evidence: "verified";
375
- readonly sources: readonly ["https://support.claude.com/en/articles/14729294-open-claude-desktop-with-a-link", "https://github.com/lalalune/agent-deeplinks/actions/runs/45460279575/job/138680666371", "https://github.com/lalalune/agent-deeplinks/actions/runs/45460279575/job/138680666686"];
376
+ readonly sources: readonly ["https://support.claude.com/en/articles/14729294-open-claude-desktop-with-a-link", "https://github.com/lalalune/agent-deeplinks/actions/runs/45460279575/job/138680666371", "https://github.com/lalalune/agent-deeplinks/actions/runs/45460279575/job/138680666686", "https://code.claude.com/docs/en/desktop#open-an-ssh-session-from-a-link"];
376
377
  readonly fields: {
377
378
  readonly prompt: "q";
378
379
  readonly folder: "folder";
380
+ readonly sshHost: "ssh_host";
381
+ readonly sshPort: "ssh_port";
382
+ readonly sshFolder: "ssh_folder";
379
383
  };
380
- readonly note: "Prefill verified in Claude Desktop’s Code tab in 6.28899.6 on macOS. Windows and Ubuntu received the exact link and showed first-run onboarding. Signed-in composers on those platforms still need verification.";
384
+ readonly note: "Prefill verified in Claude Desktop’s Code tab in 6.28899.6 on macOS. Windows and Ubuntu received the exact link and showed first-run onboarding. SSH fields require Desktop v2.110.0 or later and confirmation before use. The SSH flow is documented and its signed-in review remains unverified.";
381
385
  };
382
386
  readonly ios: {
383
387
  readonly url: "claude://code/new";
@@ -413,14 +417,14 @@ declare const catalog: {
413
417
  readonly url: "claude-cli://open";
414
418
  readonly behavior: "draft";
415
419
  readonly evidence: "documented";
416
- readonly sources: readonly ["https://code.claude.com/docs/en/deep-links"];
420
+ readonly sources: readonly ["https://code.claude.com/docs/en/deep-links", "https://github.com/lalalune/agent-deeplinks/actions/runs/45488368601/artifacts/14965540998", "https://github.com/lalalune/agent-deeplinks/actions/runs/45487910168/artifacts/14964986411"];
417
421
  readonly fields: {
418
422
  readonly prompt: "q";
419
423
  readonly cwd: "cwd";
420
424
  readonly repo: "repo";
421
425
  };
422
426
  readonly promptLimit: 5000;
423
- readonly note: "macOS terminal delivery checked. The fresh local Claude Code session reached account selection. Anthropic also documents the Windows and Linux handlers. cwd takes precedence over repo.";
427
+ readonly note: "Native launch delivered the exact prompt to Claude Code on macOS, Ubuntu, and Windows. Ubuntu and Windows opened the requested working directory. Signed-in terminal prefill remains unverified. cwd takes precedence over repo.";
424
428
  };
425
429
  readonly vscode: {
426
430
  readonly url: "vscode://anthropic.claude-code/open";
package/dist/catalog.js CHANGED
@@ -66,7 +66,7 @@ const antigravityMobileRoute = {
66
66
  note: "Opens Antigravity Remote Control in a mobile browser. Sign-in verified in iPhone WebKit and Android Chromium profiles. Google supports adding it to the home screen.",
67
67
  };
68
68
  const cursorRoute = {
69
- behavior: "draft",
69
+ behavior: "confirm",
70
70
  evidence: "documented",
71
71
  sources: [cursorDocs],
72
72
  fields: { prompt: "text" },
@@ -148,18 +148,24 @@ const catalog = {
148
148
  launchUrl: cursorCloud,
149
149
  behavior: "handoff",
150
150
  evidence: "verified",
151
- sources: [cursorDocs, cursorCloudDocs],
152
- note: "The browser handoff displayed the draft and produced the exact native link. An empty link opens Cloud Agents in the browser.",
151
+ sources: [
152
+ cursorDocs,
153
+ cursorCloudDocs,
154
+ "https://github.com/lalalune/agent-deeplinks/actions/runs/45487974246/artifacts/14965396228",
155
+ ],
156
+ note: "The browser preview reached Cursor’s native review on Ubuntu. Cursor’s handoff turned a literal plus into a space in that review. An empty link opens Cloud Agents in the browser.",
153
157
  },
154
158
  desktop: {
155
159
  ...cursorRoute,
156
160
  url: "cursor://anysphere.cursor-deeplink/prompt",
161
+ encodeQueryValuesTwice: true,
157
162
  sources: [
158
163
  cursorDocs,
159
164
  "https://github.com/lalalune/agent-deeplinks/actions/runs/45460026095/job/138679769952",
160
165
  "https://github.com/lalalune/agent-deeplinks/actions/runs/45460380555/job/138681026834",
166
+ "https://github.com/lalalune/agent-deeplinks/actions/runs/45489023213/artifacts/14966850011",
161
167
  ],
162
- note: "macOS and Ubuntu opened Cursor Agents at sign-in. Windows received the exact link after first launch registered Cursor's handler. Signed-in composer prefill remains unverified.",
168
+ note: "Cursor asks for prompt confirmation. The corrected link preserved the full text in the shipped parser and activated Cursor 3.31.15 on Ubuntu. The corrected link’s visible review remains unverified.",
163
169
  },
164
170
  ios: {
165
171
  url: cursorCloud,
@@ -219,7 +225,8 @@ const catalog = {
219
225
  url: "https://cursor.com/grok-bot/link/v1/prompt",
220
226
  behavior: "handoff",
221
227
  evidence: "verified",
222
- note: "The handoff attempts to open Grok Bot. The button and automatic dispatch used the exact native URL in desktop and mobile browser profiles.",
228
+ sources: [grokBotDocs, "https://github.com/lalalune/agent-deeplinks/actions/runs/45488932416/artifacts/14966115165"],
229
+ note: "The published Playground opened the native Grok Bot sign-in screen through stock Chrome on Ubuntu after the browser’s one-time approval. The mobile browser preview also produced the exact native URL.",
223
230
  },
224
231
  desktop: {
225
232
  ...grokBotRoute,
@@ -404,9 +411,9 @@ const catalog = {
404
411
  url: "claude://code/new",
405
412
  behavior: "draft",
406
413
  evidence: "verified",
407
- sources: claudeDesktopChecks,
408
- fields: { prompt: "q", folder: "folder" },
409
- note: "Prefill verified in Claude Desktop’s Code tab in 6.28899.6 on macOS. Windows and Ubuntu received the exact link and showed first-run onboarding. Signed-in composers on those platforms still need verification.",
414
+ sources: [...claudeDesktopChecks, "https://code.claude.com/docs/en/desktop#open-an-ssh-session-from-a-link"],
415
+ fields: { prompt: "q", folder: "folder", sshHost: "ssh_host", sshPort: "ssh_port", sshFolder: "ssh_folder" },
416
+ note: "Prefill verified in Claude Desktop’s Code tab in 6.28899.6 on macOS. Windows and Ubuntu received the exact link and showed first-run onboarding. SSH fields require Desktop v2.110.0 or later and confirmation before use. The SSH flow is documented and its signed-in review remains unverified.",
410
417
  },
411
418
  ios: claudeCodeMobileRoute,
412
419
  android: claudeCodeMobileRoute,
@@ -414,10 +421,14 @@ const catalog = {
414
421
  url: "claude-cli://open",
415
422
  behavior: "draft",
416
423
  evidence: "documented",
417
- sources: [claudeCodeDocs],
424
+ sources: [
425
+ claudeCodeDocs,
426
+ "https://github.com/lalalune/agent-deeplinks/actions/runs/45488368601/artifacts/14965540998",
427
+ "https://github.com/lalalune/agent-deeplinks/actions/runs/45487910168/artifacts/14964986411",
428
+ ],
418
429
  fields: { prompt: "q", cwd: "cwd", repo: "repo" },
419
430
  promptLimit: 5_000,
420
- note: "macOS terminal delivery checked. The fresh local Claude Code session reached account selection. Anthropic also documents the Windows and Linux handlers. cwd takes precedence over repo.",
431
+ note: "Native launch delivered the exact prompt to Claude Code on macOS, Ubuntu, and Windows. Ubuntu and Windows opened the requested working directory. Signed-in terminal prefill remains unverified. cwd takes precedence over repo.",
421
432
  },
422
433
  vscode: {
423
434
  url: "vscode://anthropic.claude-code/open",
package/dist/index.js CHANGED
@@ -7,6 +7,9 @@ const hiddenPathCharacters = /[\p{Cc}\p{Cf}]/u;
7
7
  const qualifiedSkill = /^[\w.@-]+(?:\/[\w.@-]+)+$/u;
8
8
  const invalidSessionId = /[\\/\u0000]|\.\./u;
9
9
  const openCodePairingUrl = /^([A-Za-z]+:\/\/[^/@\\?#]+)\/auth\/connect\/([A-Za-z0-9_-]+)$/u;
10
+ const sshHostPattern = /^(?:[A-Za-z0-9._][A-Za-z0-9._-]{0,63}@)?([A-Za-z0-9.:_][A-Za-z0-9.:_-]{0,252})$/u;
11
+ const sshFolderCharacters = /^[\p{L}\p{N}\p{M}\p{P} +<=>^`|~$]+$/u;
12
+ const excludedSshFolderCharacters = /[\\'\u2018-\u201b\p{Default_Ignorable_Code_Point}\u0590-\u08ff\ufb1d-\ufdff\ufe70-\ufeff\u{10800}-\u{10fff}\u{1e800}-\u{1efff}\u{13441}\u{13442}\u{16910}\u{16fe4}]/u;
10
13
  function parseServerUrl(value) {
11
14
  try {
12
15
  const url = new URL(value);
@@ -32,6 +35,31 @@ function isLocalPath(path) {
32
35
  !hiddenPathCharacters.test(path) &&
33
36
  !path.split(/[\\/]/u).includes("..");
34
37
  }
38
+ function isSshFolder(folder) {
39
+ const withoutMarks = folder.replace(/\p{M}+/gu, "");
40
+ return /^(?:\/(?!\/)|~(?:\/|$))/u.test(folder) &&
41
+ folder.length <= 1024 && withoutMarks === withoutMarks.trim() &&
42
+ !/^\/\.(?:vol|file)(?:\/|$)/iu.test(folder) &&
43
+ sshFolderCharacters.test(folder) && !excludedSshFolderCharacters.test(folder) &&
44
+ !folder.split("/").includes("..") && !/\p{M}{4,}/u.test(folder) && !/ {3}/u.test(withoutMarks) &&
45
+ (folder.match(/ /gu)?.length ?? 0) <= 8;
46
+ }
47
+ function isSshTarget(host, port, folder) {
48
+ const hostname = sshHostPattern.exec(host)?.[1];
49
+ if (!hostname || hiddenPathCharacters.test(host))
50
+ return false;
51
+ // Match Claude Desktop’s check for host values that resemble JSON scalars.
52
+ try {
53
+ if (String(JSON.parse(host)) !== host)
54
+ return false;
55
+ }
56
+ catch {
57
+ // Ordinary hostnames are not JSON values.
58
+ }
59
+ if (port && (!/^[1-9]\d{0,4}$/u.test(port) || Number(port) > 65535 || /^[^:]+:\d+$/u.test(hostname)))
60
+ return false;
61
+ return !folder || isSshFolder(folder);
62
+ }
35
63
  function parseWorkspaceUri(value) {
36
64
  if (value !== value.trim() || hiddenPathCharacters.test(value) ||
37
65
  !/^(?:file:\/|vscode-remote:\/\/)/iu.test(value))
@@ -76,6 +104,9 @@ export function getAgentLink(agent, platform, options = {}) {
76
104
  if ([fields.cwd, fields.path, fields.directory, fields.folder].some((path) => path !== undefined && !isLocalPath(path))) {
77
105
  return null;
78
106
  }
107
+ if ((fields.sshHost || fields.sshPort || fields.sshFolder) &&
108
+ (fields.folder || !isSshTarget(fields.sshHost ?? "", fields.sshPort, fields.sshFolder)))
109
+ return null;
79
110
  if (fields.model && !fields.provider)
80
111
  return null;
81
112
  if (fields.mode && !route.modes?.includes(fields.mode))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-deeplinks",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "description": "Evidence-backed deep links for AI agents with SVG icons and React helpers.",
5
5
  "type": "module",
6
6
  "license": "MIT",