agent-deeplinks 0.1.24 → 0.1.25
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 +12 -1
- package/dist/catalog.d.ts +6 -3
- package/dist/catalog.js +3 -3
- package/dist/index.js +31 -0
- package/package.json +1 -1
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
|
+
npm install ./agent-deeplinks-0.1.25.tgz
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
## Usage
|
|
@@ -46,6 +46,17 @@ Use `getAgentLink("claude-code", "vscode", { prompt: "Review my changes." })` to
|
|
|
46
46
|
|
|
47
47
|
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
48
|
|
|
49
|
+
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)
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
const remoteDraft = getAgentLink("claude-code", "desktop", {
|
|
53
|
+
sshHost: "dev@build.example.com",
|
|
54
|
+
sshPort: "2222",
|
|
55
|
+
sshFolder: "~/project",
|
|
56
|
+
prompt: "Review the build logs.",
|
|
57
|
+
})
|
|
58
|
+
```
|
|
59
|
+
|
|
49
60
|
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
61
|
|
|
51
62
|
```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;
|
|
@@ -372,12 +372,15 @@ declare const catalog: {
|
|
|
372
372
|
readonly url: "claude://code/new";
|
|
373
373
|
readonly behavior: "draft";
|
|
374
374
|
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"];
|
|
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", "https://code.claude.com/docs/en/desktop#open-an-ssh-session-from-a-link"];
|
|
376
376
|
readonly fields: {
|
|
377
377
|
readonly prompt: "q";
|
|
378
378
|
readonly folder: "folder";
|
|
379
|
+
readonly sshHost: "ssh_host";
|
|
380
|
+
readonly sshPort: "ssh_port";
|
|
381
|
+
readonly sshFolder: "ssh_folder";
|
|
379
382
|
};
|
|
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.
|
|
383
|
+
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
384
|
};
|
|
382
385
|
readonly ios: {
|
|
383
386
|
readonly url: "claude://code/new";
|
package/dist/catalog.js
CHANGED
|
@@ -404,9 +404,9 @@ const catalog = {
|
|
|
404
404
|
url: "claude://code/new",
|
|
405
405
|
behavior: "draft",
|
|
406
406
|
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.
|
|
407
|
+
sources: [...claudeDesktopChecks, "https://code.claude.com/docs/en/desktop#open-an-ssh-session-from-a-link"],
|
|
408
|
+
fields: { prompt: "q", folder: "folder", sshHost: "ssh_host", sshPort: "ssh_port", sshFolder: "ssh_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. 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
410
|
},
|
|
411
411
|
ios: claudeCodeMobileRoute,
|
|
412
412
|
android: claudeCodeMobileRoute,
|
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))
|