passport-bridge 0.44.0 → 0.46.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/dist/cliArgs.d.ts +1 -1
- package/dist/cliArgs.js +3 -0
- package/dist/cliConnect.d.ts +3 -1
- package/dist/cliConnect.js +58 -6
- package/dist/cliConnections.d.ts +3 -3
- package/dist/cliConnections.js +13 -5
- package/dist/cliExec.js +1 -5
- package/dist/cliGuardHealth.js +2 -1
- package/dist/cliHook.js +5 -1
- package/dist/cliHookAfter.js +2 -2
- package/dist/cliHookNotices.d.ts +7 -0
- package/dist/cliHookNotices.js +14 -0
- package/dist/cliMain.js +33 -3
- package/dist/cliOutput.js +4 -6
- package/dist/cliRequest.d.ts +65 -0
- package/dist/cliRequest.js +135 -0
- package/dist/cliScan.js +1 -1
- package/dist/cliSession.d.ts +0 -1
- package/dist/cliSession.js +0 -2
- package/dist/cliStatus.d.ts +4 -2
- package/dist/cliStatus.js +21 -4
- package/dist/cliSupport.d.ts +0 -8
- package/dist/completion.js +1 -0
- package/dist/connectorKit/engine.generated.d.ts +2 -2
- package/dist/connectorKit/engine.generated.js +23 -3
- package/dist/connectorKit/manifest.generated.d.ts +1 -1
- package/dist/connectorKit/manifests/github.generated.js +26 -3
- package/dist/connectorKit/manifests/githubCapture.generated.js +41 -10
- package/dist/connectorKit/manifests/githubHooks.generated.js +21 -1
- package/dist/connectorKit/manifests/githubReads.generated.d.ts +2 -0
- package/dist/connectorKit/manifests/githubReads.generated.js +30 -5
- package/dist/connectorKit/manifests/railway.generated.js +3 -3
- package/dist/connectorKit/manifests/supabase.generated.js +1 -1
- package/dist/connectorKit/manifests/supabaseApi.generated.js +1 -1
- package/dist/connectorKit/manifests/supabaseCapture.generated.js +1 -1
- package/dist/connectorKit/manifests/supabaseCatalog.generated.d.ts +1 -1
- package/dist/connectorKit/manifests/supabaseCatalog.generated.js +4 -4
- package/dist/controlPlane.generated.d.ts +18 -17
- package/dist/controlPlane.generated.js +15 -21
- package/dist/controlPlaneBasic.generated.d.ts +5 -5
- package/dist/controlPlaneBasic.generated.js +5 -5
- package/dist/controlPlaneGithub.generated.d.ts +2 -2
- package/dist/controlPlaneGithub.generated.js +12 -2
- package/dist/controlPlaneGithubApi.generated.d.ts +2 -0
- package/dist/controlPlaneGithubApi.generated.js +56 -1
- package/dist/controlPlaneGithubCatalog.generated.d.ts +9 -3
- package/dist/controlPlaneGithubCatalog.generated.js +19 -13
- package/dist/controlPlaneGithubCli.generated.d.ts +2 -0
- package/dist/controlPlaneGithubCli.generated.js +65 -12
- package/dist/controlPlaneGuard.js +2 -0
- package/dist/controlPlanePeople.generated.d.ts +117 -0
- package/dist/controlPlanePeople.generated.js +6 -0
- package/dist/controlPlaneSupabase.js +3 -1
- package/dist/controlPlaneUnnamed.generated.d.ts +58 -0
- package/dist/controlPlaneUnnamed.generated.js +225 -0
- package/dist/cpCli.js +5 -1
- package/dist/initAppsStep.d.ts +1 -1
- package/dist/initAppsStep.js +7 -5
- package/dist/initOutro.js +13 -10
- package/dist/initState.d.ts +3 -2
- package/dist/initState.js +7 -18
- package/dist/localNotices.d.ts +22 -0
- package/dist/localNotices.js +100 -0
- package/dist/pluginPin.d.ts +1 -1
- package/dist/pluginPin.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/webLinks.d.ts +23 -6
- package/dist/webLinks.js +21 -22
- package/npm-shrinkwrap.json +8 -8
- package/package.json +1 -1
- package/dist/cliApprovalLink.d.ts +0 -5
- package/dist/cliApprovalLink.js +0 -21
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One-time notices for this person (docs/design/v21/requests.md section 9b; docs/design/v21/people.md section 4):
|
|
3
|
+
* `GET /api/cp/cli` hands them over once (`notices`, marked delivered by that read), the CLI keeps them in a private
|
|
4
|
+
* local file, and whichever prints first takes them: the CLI at the end of a command, or the Claude Code hook as a
|
|
5
|
+
* system message after a command Passport handled. Taking is a rename, so two processes never print the same notice.
|
|
6
|
+
*
|
|
7
|
+
* Reading and taking never throw: a missing, corrupt or foreign-owned file is treated as empty.
|
|
8
|
+
*/
|
|
9
|
+
export type LocalNotice = {
|
|
10
|
+
id: string;
|
|
11
|
+
text: string;
|
|
12
|
+
url?: string;
|
|
13
|
+
linkLabel?: string;
|
|
14
|
+
};
|
|
15
|
+
/** Validate notices from the server or the file; anything malformed is dropped, never thrown. */
|
|
16
|
+
export declare function parseNotices(value: unknown): LocalNotice[];
|
|
17
|
+
/** Keep notices the server just handed over, beside any not yet printed (newest kept when over the cap). */
|
|
18
|
+
export declare function saveLocalNotices(profile: string, notices: readonly LocalNotice[]): void;
|
|
19
|
+
/** Take every waiting notice, once: the file is renamed away first, so a parallel process finds nothing. */
|
|
20
|
+
export declare function takeLocalNotices(profile: string): LocalNotice[];
|
|
21
|
+
/** One notice as a person reads it: "Northwind · Priya Sharma asked you to … Open setup: https://…". */
|
|
22
|
+
export declare function noticeLine(notice: LocalNotice, workspace?: string): string;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One-time notices for this person (docs/design/v21/requests.md section 9b; docs/design/v21/people.md section 4):
|
|
3
|
+
* `GET /api/cp/cli` hands them over once (`notices`, marked delivered by that read), the CLI keeps them in a private
|
|
4
|
+
* local file, and whichever prints first takes them: the CLI at the end of a command, or the Claude Code hook as a
|
|
5
|
+
* system message after a command Passport handled. Taking is a rename, so two processes never print the same notice.
|
|
6
|
+
*
|
|
7
|
+
* Reading and taking never throw: a missing, corrupt or foreign-owned file is treated as empty.
|
|
8
|
+
*/
|
|
9
|
+
import { lstatSync, renameSync, rmSync } from "node:fs";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
import { readBoundedUtf8File } from "./boundedFile.js";
|
|
12
|
+
import { credentialDir, enforceOwner, writePrivateAtomic } from "./credentialStorage.js";
|
|
13
|
+
import { assertProfileName } from "./credentials.js";
|
|
14
|
+
const MAX_BYTES = 16 * 1024;
|
|
15
|
+
const MAX_KEPT = 10;
|
|
16
|
+
const ID = /^nt_[0-9a-f]{8,32}$/;
|
|
17
|
+
function safeUrl(value) {
|
|
18
|
+
if (typeof value !== "string" || value.length > 600)
|
|
19
|
+
return undefined;
|
|
20
|
+
try {
|
|
21
|
+
const url = new URL(value);
|
|
22
|
+
return url.protocol === "https:" || (url.protocol === "http:" && ["localhost", "127.0.0.1"].includes(url.hostname))
|
|
23
|
+
? url.toString()
|
|
24
|
+
: undefined;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** Validate notices from the server or the file; anything malformed is dropped, never thrown. */
|
|
31
|
+
export function parseNotices(value) {
|
|
32
|
+
if (!Array.isArray(value))
|
|
33
|
+
return [];
|
|
34
|
+
const out = [];
|
|
35
|
+
for (const entry of value.slice(0, MAX_KEPT)) {
|
|
36
|
+
if (!entry || typeof entry !== "object")
|
|
37
|
+
continue;
|
|
38
|
+
const { id, text, url, linkLabel } = entry;
|
|
39
|
+
if (typeof id !== "string" || !ID.test(id) || typeof text !== "string")
|
|
40
|
+
continue;
|
|
41
|
+
const line = text
|
|
42
|
+
.replace(/[\u0000-\u001f\u007f]+/g, " ")
|
|
43
|
+
.trim()
|
|
44
|
+
.slice(0, 200);
|
|
45
|
+
if (!line)
|
|
46
|
+
continue;
|
|
47
|
+
const link = safeUrl(url);
|
|
48
|
+
const label = typeof linkLabel === "string" ? linkLabel.replace(/[^\p{L}\p{N} ]+/gu, "").slice(0, 24) : undefined;
|
|
49
|
+
out.push({ id, text: line, ...(link ? { url: link } : {}), ...(link && label ? { linkLabel: label } : {}) });
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
function noticesPath(profile) {
|
|
54
|
+
assertProfileName(profile);
|
|
55
|
+
return join(credentialDir(), `notices-${profile}.json`);
|
|
56
|
+
}
|
|
57
|
+
function readFile(path) {
|
|
58
|
+
try {
|
|
59
|
+
enforceOwner(lstatSync(path), "notices");
|
|
60
|
+
return parseNotices(JSON.parse(readBoundedUtf8File(path, MAX_BYTES)));
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** Keep notices the server just handed over, beside any not yet printed (newest kept when over the cap). */
|
|
67
|
+
export function saveLocalNotices(profile, notices) {
|
|
68
|
+
if (!notices.length)
|
|
69
|
+
return;
|
|
70
|
+
try {
|
|
71
|
+
const path = noticesPath(profile);
|
|
72
|
+
const kept = readFile(path);
|
|
73
|
+
for (const notice of notices)
|
|
74
|
+
if (!kept.some((existing) => existing.id === notice.id))
|
|
75
|
+
kept.push(notice);
|
|
76
|
+
writePrivateAtomic(path, ".notices", `${JSON.stringify(kept.slice(-MAX_KEPT))}\n`, "notices");
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
/* A notice lost here is one line someone doesn't see; Slack and email still carry setup asks. */
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** Take every waiting notice, once: the file is renamed away first, so a parallel process finds nothing. */
|
|
83
|
+
export function takeLocalNotices(profile) {
|
|
84
|
+
try {
|
|
85
|
+
const path = noticesPath(profile);
|
|
86
|
+
const claimed = `${path}.${process.pid}.taking`;
|
|
87
|
+
renameSync(path, claimed);
|
|
88
|
+
const notices = readFile(claimed);
|
|
89
|
+
rmSync(claimed, { force: true });
|
|
90
|
+
return notices;
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/** One notice as a person reads it: "Northwind · Priya Sharma asked you to … Open setup: https://…". */
|
|
97
|
+
export function noticeLine(notice, workspace) {
|
|
98
|
+
const link = notice.url ? ` ${notice.linkLabel || "Open"}: ${notice.url}` : "";
|
|
99
|
+
return `${workspace ? `${workspace} · ` : ""}${notice.text}${link}`;
|
|
100
|
+
}
|
package/dist/pluginPin.d.ts
CHANGED
package/dist/pluginPin.js
CHANGED
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.46.0";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Keep in lockstep with bridge/package.json.
|
|
2
|
-
export const VERSION = "0.
|
|
2
|
+
export const VERSION = "0.46.0";
|
package/dist/webLinks.d.ts
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Links into the Passport web app for things the CLI names. The web app is
|
|
3
|
+
* served from the same origin as the profile's endpoint, and routes by hash.
|
|
4
|
+
* A member's own pages (docs/design/v21/member.md):
|
|
5
|
+
*
|
|
6
|
+
* #p My activity: what your agents did, and your apps
|
|
7
|
+
* #p?app=<key> My activity with one app highlighted under Your apps
|
|
8
|
+
* #cp/rules Allow and Block rules (an admin's page)
|
|
9
|
+
*
|
|
10
|
+
* A block's message carries the person's Why blocked link itself
|
|
11
|
+
* (`<origin>/b/<eventId>`), so the CLI prints no link of its own for it.
|
|
12
|
+
* Each returns null when the origin or page is unusable, so callers print a
|
|
13
|
+
* link only when they know exactly what it points at.
|
|
14
|
+
*/
|
|
15
|
+
/** How long a connect or connections link lasts (the server's default; docs/design/v21/member.md, link lifetimes). */
|
|
16
|
+
export declare const LINK_MINUTES = 15;
|
|
17
|
+
/** The line under a connect link. */
|
|
18
|
+
export declare const CONNECT_LINK_LIFETIME = "Link expires in 15 minutes.";
|
|
19
|
+
/** My activity. */
|
|
20
|
+
export declare const MY_ACTIVITY_LINK = "#p";
|
|
2
21
|
export declare const RULES_LINK = "#cp/rules";
|
|
3
|
-
/**
|
|
4
|
-
export declare
|
|
22
|
+
/** My activity with `app` highlighted under Your apps (just My activity for a key that isn't one). */
|
|
23
|
+
export declare function myAppLink(app: string): string;
|
|
5
24
|
/** `https://passportmcp.com` from an endpoint or origin, or null. */
|
|
6
25
|
export declare function webOrigin(endpointOrOrigin: string | undefined): string | null;
|
|
7
|
-
/**
|
|
8
|
-
export declare function approvalLink(origin: string | undefined, approvalId: string | undefined, _workspaceId?: string): string | null;
|
|
9
|
-
/** A page the server named by its hash (`#cp/connections`), or null. */
|
|
26
|
+
/** A page the server named by its hash (`#p`), or null. */
|
|
10
27
|
export declare function hashLink(origin: string | undefined, hash: unknown): string | null;
|
package/dist/webLinks.js
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Links into the Passport web app for things the CLI names. The web app is
|
|
3
|
-
* served from the same origin as the profile's endpoint, and routes by hash
|
|
3
|
+
* served from the same origin as the profile's endpoint, and routes by hash.
|
|
4
|
+
* A member's own pages (docs/design/v21/member.md):
|
|
4
5
|
*
|
|
5
|
-
* #
|
|
6
|
-
* #
|
|
7
|
-
* #cp/
|
|
8
|
-
* #cp/blocked where an admin answers a block
|
|
6
|
+
* #p My activity: what your agents did, and your apps
|
|
7
|
+
* #p?app=<key> My activity with one app highlighted under Your apps
|
|
8
|
+
* #cp/rules Allow and Block rules (an admin's page)
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* A block's message carries the person's Why blocked link itself
|
|
11
|
+
* (`<origin>/b/<eventId>`), so the CLI prints no link of its own for it.
|
|
12
|
+
* Each returns null when the origin or page is unusable, so callers print a
|
|
13
|
+
* link only when they know exactly what it points at.
|
|
12
14
|
*/
|
|
13
|
-
|
|
14
|
-
export const
|
|
15
|
+
/** How long a connect or connections link lasts (the server's default; docs/design/v21/member.md, link lifetimes). */
|
|
16
|
+
export const LINK_MINUTES = 15;
|
|
17
|
+
/** The line under a connect link. */
|
|
18
|
+
export const CONNECT_LINK_LIFETIME = `Link expires in ${LINK_MINUTES} minutes.`;
|
|
19
|
+
/** My activity. */
|
|
20
|
+
export const MY_ACTIVITY_LINK = "#p";
|
|
15
21
|
export const RULES_LINK = "#cp/rules";
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
const APP_KEY = /^[a-z0-9][a-z0-9._-]{0,63}$/;
|
|
23
|
+
/** My activity with `app` highlighted under Your apps (just My activity for a key that isn't one). */
|
|
24
|
+
export function myAppLink(app) {
|
|
25
|
+
return APP_KEY.test(app) ? `${MY_ACTIVITY_LINK}?app=${encodeURIComponent(app)}` : MY_ACTIVITY_LINK;
|
|
26
|
+
}
|
|
18
27
|
/** `https://passportmcp.com` from an endpoint or origin, or null. */
|
|
19
28
|
export function webOrigin(endpointOrOrigin) {
|
|
20
29
|
if (!endpointOrOrigin)
|
|
@@ -27,17 +36,7 @@ export function webOrigin(endpointOrOrigin) {
|
|
|
27
36
|
return null;
|
|
28
37
|
}
|
|
29
38
|
}
|
|
30
|
-
|
|
31
|
-
return typeof id === "string" && ID.test(id);
|
|
32
|
-
}
|
|
33
|
-
/** Where a block is answered: Blocked, in Passport. */
|
|
34
|
-
export function approvalLink(origin, approvalId, _workspaceId) {
|
|
35
|
-
const base = webOrigin(origin);
|
|
36
|
-
if (!base || !usable(approvalId))
|
|
37
|
-
return null;
|
|
38
|
-
return `${base}/#cp/blocked`;
|
|
39
|
-
}
|
|
40
|
-
/** A page the server named by its hash (`#cp/connections`), or null. */
|
|
39
|
+
/** A page the server named by its hash (`#p`), or null. */
|
|
41
40
|
export function hashLink(origin, hash) {
|
|
42
41
|
const base = webOrigin(origin);
|
|
43
42
|
if (!base || typeof hash !== "string" || !/^#[A-Za-z0-9_.~%/?=&-]{1,200}$/.test(hash))
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passport-bridge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "passport-bridge",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.46.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@modelcontextprotocol/sdk": "1.32.1"
|
|
@@ -363,9 +363,9 @@
|
|
|
363
363
|
}
|
|
364
364
|
},
|
|
365
365
|
"node_modules/@hono/node-server": {
|
|
366
|
-
"version": "2.1.
|
|
367
|
-
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.
|
|
368
|
-
"integrity": "sha512-
|
|
366
|
+
"version": "2.1.6",
|
|
367
|
+
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.6.tgz",
|
|
368
|
+
"integrity": "sha512-p/KH9MnfNcsm3sR6x4lNgm5j+QN4Et8srKredl9DZfXiyZ1UQ3aQ2YVpFLbqktYN5JI+DB+VZFKM2PqE5hLKjQ==",
|
|
369
369
|
"license": "MIT",
|
|
370
370
|
"engines": {
|
|
371
371
|
"node": ">=20"
|
|
@@ -998,9 +998,9 @@
|
|
|
998
998
|
}
|
|
999
999
|
},
|
|
1000
1000
|
"node_modules/hono": {
|
|
1001
|
-
"version": "4.13.
|
|
1002
|
-
"resolved": "https://registry.npmjs.org/hono/-/hono-4.13.
|
|
1003
|
-
"integrity": "sha512-
|
|
1001
|
+
"version": "4.13.16",
|
|
1002
|
+
"resolved": "https://registry.npmjs.org/hono/-/hono-4.13.16.tgz",
|
|
1003
|
+
"integrity": "sha512-AOLOEhvrV+iH92xXCnFr/5+3KjPKcI3xP63XJtX5spAnkznPdHijlIsUTpi7/9EhWqrTCekw5c5zh1K+YsVw7A==",
|
|
1004
1004
|
"license": "MIT",
|
|
1005
1005
|
"engines": {
|
|
1006
1006
|
"node": ">=16.9.0"
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ParsedArgs } from "./cliArgs.js";
|
|
2
|
-
import { type CliFailure, type Env } from "./cliSupport.js";
|
|
3
|
-
/** A failure that names an approval also names where to answer it. Returns
|
|
4
|
-
* the same failure, so the CLI's catch can link it in one step. */
|
|
5
|
-
export declare function linkApproval(error: CliFailure, args: ParsedArgs | undefined, env: Env): CliFailure;
|
package/dist/cliApprovalLink.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { resolveCliAuth } from "./cliSupport.js";
|
|
2
|
-
import { workspaceOfToken } from "./tokenWorkspace.js";
|
|
3
|
-
import { approvalLink } from "./webLinks.js";
|
|
4
|
-
/** A failure that names an approval also names where to answer it. Returns
|
|
5
|
-
* the same failure, so the CLI's catch can link it in one step. */
|
|
6
|
-
export function linkApproval(error, args, env) {
|
|
7
|
-
const id = error.details.approvalId;
|
|
8
|
-
if (!args || !id || error.details.approvalUrl || error.cause === "unknown_approval")
|
|
9
|
-
return error;
|
|
10
|
-
try {
|
|
11
|
-
const auth = resolveCliAuth(args, env);
|
|
12
|
-
const workspace = auth.kind === "profile" ? workspaceOfToken(auth.refreshToken) : "";
|
|
13
|
-
const url = approvalLink(auth.endpoint, id, workspace || undefined);
|
|
14
|
-
if (url)
|
|
15
|
-
error.details.approvalUrl = url;
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
// No profile to read the origin from: the approval id alone still works.
|
|
19
|
-
}
|
|
20
|
-
return error;
|
|
21
|
-
}
|