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,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v21 People's part of the control-plane contract (docs/design/v21/people.md): coverage per person, setup links and
|
|
3
|
+
* leaving. Re-exported from `controlPlane.ts`; changed only through the orchestrating session.
|
|
4
|
+
*/
|
|
5
|
+
/** A person's first coverage gap, which is also what a setup link asks for. */
|
|
6
|
+
export type CpCoverageGap = {
|
|
7
|
+
kind: "guard_off";
|
|
8
|
+
client: "claude-code" | "codex" | "cursor";
|
|
9
|
+
computer: string;
|
|
10
|
+
} | {
|
|
11
|
+
kind: "guard_missing";
|
|
12
|
+
computers: number;
|
|
13
|
+
of: number;
|
|
14
|
+
} | {
|
|
15
|
+
kind: "guard_outdated";
|
|
16
|
+
computer: string;
|
|
17
|
+
} | {
|
|
18
|
+
kind: "not_set_up";
|
|
19
|
+
} | {
|
|
20
|
+
kind: "own_sign_in";
|
|
21
|
+
platform: string;
|
|
22
|
+
};
|
|
23
|
+
/** A person's coverage (v21 People, docs/design/v21/people.md section 1). The UI words it; never an email. */
|
|
24
|
+
export type CpPersonCoverage = {
|
|
25
|
+
state: "covered" | "partly" | "not_set_up";
|
|
26
|
+
guard: "on" | "off" | "outdated" | "not_set_up" | "chat_only" | "none";
|
|
27
|
+
/** Computers with a guarded agent, and how many have every agent's guard on ("On 1 of 2"). */
|
|
28
|
+
computers: number;
|
|
29
|
+
computersOn: number;
|
|
30
|
+
gap?: CpCoverageGap;
|
|
31
|
+
/** Agent coverage over apps with an activity log, 7 days; null when they had no such actions. */
|
|
32
|
+
percent: number | null;
|
|
33
|
+
/** Outside Passport actions on those apps that map to them (their own sign-in), 7 days. */
|
|
34
|
+
ownSignIn7d: number;
|
|
35
|
+
/** Distinct agent clients on their live connections, for logos. */
|
|
36
|
+
clients: string[];
|
|
37
|
+
/** Apps they use: connected through Passport, plus apps with a log they acted on in 7 days. */
|
|
38
|
+
apps: number;
|
|
39
|
+
/** Their only connections are AI apps (Claude, ChatGPT): "Through Passport only". */
|
|
40
|
+
chatOnly: boolean;
|
|
41
|
+
};
|
|
42
|
+
/** The newest setup link sent to someone. */
|
|
43
|
+
export type CpSetupLinkState = {
|
|
44
|
+
id: string;
|
|
45
|
+
sentAt: number;
|
|
46
|
+
expiresAt: number;
|
|
47
|
+
remindedAt?: number;
|
|
48
|
+
status: "open" | "done" | "expired" | "canceled";
|
|
49
|
+
};
|
|
50
|
+
/** Someone who left (removed in the identity provider, or by an admin). */
|
|
51
|
+
export type CpLeftPerson = {
|
|
52
|
+
at: number;
|
|
53
|
+
via: "okta" | "admin";
|
|
54
|
+
/** Set once offboarded; "automatic" when the setting did it, else the admin's name. */
|
|
55
|
+
offboarded?: {
|
|
56
|
+
at: number;
|
|
57
|
+
by: string;
|
|
58
|
+
};
|
|
59
|
+
/** What still holds access until offboarded. `keysToRevokeInApps`: keys they made in the apps themselves. */
|
|
60
|
+
remaining: {
|
|
61
|
+
links: number;
|
|
62
|
+
credentials: number;
|
|
63
|
+
keysToRevokeInApps: number;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
/** POST /api/cp/setup-links (admin). */
|
|
67
|
+
export type CpSetupLinkChannels = {
|
|
68
|
+
agent: boolean;
|
|
69
|
+
slack: boolean;
|
|
70
|
+
email: boolean;
|
|
71
|
+
};
|
|
72
|
+
export type CpSetupLinksRequest = {
|
|
73
|
+
memberIds: string[];
|
|
74
|
+
channels: CpSetupLinkChannels;
|
|
75
|
+
};
|
|
76
|
+
export type CpSetupLinksResponse = {
|
|
77
|
+
sent: {
|
|
78
|
+
memberId: string;
|
|
79
|
+
linkId: string;
|
|
80
|
+
expiresAt: number;
|
|
81
|
+
channels: {
|
|
82
|
+
agent: boolean;
|
|
83
|
+
slack: "sent" | "unavailable" | "off";
|
|
84
|
+
email: "sent" | "unavailable" | "off";
|
|
85
|
+
};
|
|
86
|
+
}[];
|
|
87
|
+
skipped: {
|
|
88
|
+
memberId: string;
|
|
89
|
+
reason: "covered" | "left" | "sent_recently" | "not_found";
|
|
90
|
+
}[];
|
|
91
|
+
};
|
|
92
|
+
/** POST /api/cp/people/:id/offboard (admin). */
|
|
93
|
+
export type CpOffboardResponse = {
|
|
94
|
+
offboarded: {
|
|
95
|
+
at: number;
|
|
96
|
+
};
|
|
97
|
+
done: {
|
|
98
|
+
apps: number;
|
|
99
|
+
agents: number;
|
|
100
|
+
links: number;
|
|
101
|
+
credentials: number;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
/** v21 fields on `CpAgentRow`: its last action or check-in (epoch ms), and the Passport CLI version the guard last
|
|
105
|
+
* reported from its computer, else the connection's own. v22: `program` marks a program the app's log saw act (GitHub
|
|
106
|
+
* Actions on a repository): `name` is the program, `runsOn` the repository, no person, guard "na". */
|
|
107
|
+
export type CpAgentV21 = {
|
|
108
|
+
lastSeenTs?: number;
|
|
109
|
+
version?: string;
|
|
110
|
+
program?: true;
|
|
111
|
+
};
|
|
112
|
+
/** v21 fields on `CpPersonRow`: coverage, the newest setup link, and (only with `?left=1`) leaving. */
|
|
113
|
+
export type CpPersonV21 = {
|
|
114
|
+
coverage?: CpPersonCoverage;
|
|
115
|
+
setupLink?: CpSetupLinkState;
|
|
116
|
+
left?: CpLeftPerson;
|
|
117
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Generated by scripts/generate-control-plane-classifier.mjs. Do not edit.
|
|
2
|
+
/**
|
|
3
|
+
* v21 People's part of the control-plane contract (docs/design/v21/people.md): coverage per person, setup links and
|
|
4
|
+
* leaving. Re-exported from `controlPlane.ts`; changed only through the orchestrating session.
|
|
5
|
+
*/
|
|
6
|
+
export {};
|
|
@@ -194,7 +194,9 @@ const action = (found) => ({
|
|
|
194
194
|
actionKey: found.actionKey,
|
|
195
195
|
summary: found.summary.slice(0, MAX_SUMMARY),
|
|
196
196
|
...(found.target ? { target: found.target } : {}),
|
|
197
|
-
...(found.nodes?.length ? { nodes: found.nodes } : {})
|
|
197
|
+
...(found.nodes?.length ? { nodes: found.nodes } : {}),
|
|
198
|
+
// What an unnamed action hit, coarse; the server makes it coarse again (`sanitizeUnnamed`).
|
|
199
|
+
...(found.unnamed ? { unnamed: found.unnamed } : {})
|
|
198
200
|
});
|
|
199
201
|
/** The decide request for one bundle. */
|
|
200
202
|
export function supabaseDecideBody(bundle, ask) {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an action Passport can't name hit (`UnnamedHit`, decided 2026-11-17), made coarse: an API path becomes a
|
|
3
|
+
* template of the platform's own path words, a command line its program and known subcommand words. Pure; the
|
|
4
|
+
* server, the bridge and the kit share it. Never an owner, repository, number, id, sha, branch, query string, body,
|
|
5
|
+
* flag or argument: a segment or word that isn't the platform's own vocabulary is a placeholder or dropped.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* What an action Passport can't name hit, so the next one to name is known (2026-11-17): an API call's method and
|
|
9
|
+
* path template (`repos/{owner}/{repo}/actions/runs/{id}/cancel`), or a command line's program and subcommand words
|
|
10
|
+
* (`gh run watch`). Never an owner, repository, number, id, branch, query string, body, flag or argument.
|
|
11
|
+
*/
|
|
12
|
+
export type UnnamedHit = {
|
|
13
|
+
via: "api";
|
|
14
|
+
method?: string;
|
|
15
|
+
path?: string;
|
|
16
|
+
} | {
|
|
17
|
+
via: "cli";
|
|
18
|
+
command: string;
|
|
19
|
+
};
|
|
20
|
+
/** An app's action Passport can't name (`github.unclassified`). */
|
|
21
|
+
export declare const isUnclassifiedAction: (actionKey: string) => boolean;
|
|
22
|
+
/** The kind an event is shown as: Unclassified for an unnamed action whatever kind it was stored with (events
|
|
23
|
+
* from before 2026-11-17 recorded it as a Delete), else its own. */
|
|
24
|
+
export declare function displayKind<K extends string>(event: {
|
|
25
|
+
actionKey: string;
|
|
26
|
+
kind: K;
|
|
27
|
+
}): K | "unclassified";
|
|
28
|
+
export declare const UNNAMED_METHODS: readonly string[];
|
|
29
|
+
/** GitHub REST's literal path words (api.github.com), not exhaustive: any other segment becomes a placeholder. */
|
|
30
|
+
export declare const GITHUB_PATH_WORDS: ReadonlySet<string>;
|
|
31
|
+
/** Supabase's Management API path words (api.supabase.com/v1). */
|
|
32
|
+
export declare const SUPABASE_PATH_WORDS: ReadonlySet<string>;
|
|
33
|
+
/** Railway is GraphQL: its path is one word. */
|
|
34
|
+
export declare const RAILWAY_PATH_WORDS: ReadonlySet<string>;
|
|
35
|
+
export declare function pathWordsFor(platform: string): ReadonlySet<string>;
|
|
36
|
+
/**
|
|
37
|
+
* An API path as a template of the platform's own words: scheme, host, query and fragment dropped; the names after
|
|
38
|
+
* `repos`, `orgs`, `users` (as the first word) are `{owner}/{repo}`, `{org}`, `{user}`; any other segment stays only
|
|
39
|
+
* when it is one of `known`, else it is one placeholder named by the word before it (`{number}` after `pulls`,
|
|
40
|
+
* `{branch}` after `branches`, `{sha}` for a commit hash, else `{id}`), a run of them collapsed into one.
|
|
41
|
+
*/
|
|
42
|
+
export declare function templatePath(raw: string, known: ReadonlySet<string>): string;
|
|
43
|
+
/**
|
|
44
|
+
* A command line as its program and at most two subcommand words: each a CLI word (`^[a-z][a-z-]{0,30}$`) and, for
|
|
45
|
+
* `gh` and `git`, one that CLI has, so a positional argument (a branch, a remote, a repository, a number) never
|
|
46
|
+
* passes as a subcommand. Flags end it. Null when the program itself isn't a plain name.
|
|
47
|
+
*/
|
|
48
|
+
export declare function unnamedCommand(argv: readonly string[]): string | null;
|
|
49
|
+
/** An API call's hit: its method (one of the HTTP methods) and its path's template; either may be unknown. */
|
|
50
|
+
export declare function unnamedApi(platform: string, method: string | undefined, path?: string): UnnamedHit;
|
|
51
|
+
/** A command line's hit; undefined when nothing of it can be kept. */
|
|
52
|
+
export declare function unnamedCli(argv: readonly string[]): UnnamedHit | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* What a caller sent (the bridge's classification) made coarse again, so nothing it adds survives: the method from
|
|
55
|
+
* the list, the path re-templated with the platform's words, the command re-read word by word. Anything else is
|
|
56
|
+
* dropped, never refused.
|
|
57
|
+
*/
|
|
58
|
+
export declare function sanitizeUnnamed(platform: string, value: unknown): UnnamedHit | undefined;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
// Generated by scripts/generate-control-plane-classifier.mjs. Do not edit.
|
|
2
|
+
/**
|
|
3
|
+
* What an action Passport can't name hit (`UnnamedHit`, decided 2026-11-17), made coarse: an API path becomes a
|
|
4
|
+
* template of the platform's own path words, a command line its program and known subcommand words. Pure; the
|
|
5
|
+
* server, the bridge and the kit share it. Never an owner, repository, number, id, sha, branch, query string, body,
|
|
6
|
+
* flag or argument: a segment or word that isn't the platform's own vocabulary is a placeholder or dropped.
|
|
7
|
+
*/
|
|
8
|
+
/** An app's action Passport can't name (`github.unclassified`). */
|
|
9
|
+
export const isUnclassifiedAction = (actionKey) => actionKey.endsWith(".unclassified");
|
|
10
|
+
/** The kind an event is shown as: Unclassified for an unnamed action whatever kind it was stored with (events
|
|
11
|
+
* from before 2026-11-17 recorded it as a Delete), else its own. */
|
|
12
|
+
export function displayKind(event) {
|
|
13
|
+
return isUnclassifiedAction(event.actionKey) ? "unclassified" : event.kind;
|
|
14
|
+
}
|
|
15
|
+
export const UNNAMED_METHODS = ["POST", "PUT", "PATCH", "DELETE", "GET", "HEAD"];
|
|
16
|
+
const MAX_SEGMENTS = 12;
|
|
17
|
+
const MAX_PATH = 200;
|
|
18
|
+
/** A subcommand word as a CLI spells one. */
|
|
19
|
+
const COMMAND_WORD = /^[a-z][a-z-]{0,30}$/;
|
|
20
|
+
const words = (text) => new Set(text.split(/\s+/).filter(Boolean));
|
|
21
|
+
/** GitHub REST's literal path words (api.github.com), not exhaustive: any other segment becomes a placeholder. */
|
|
22
|
+
export const GITHUB_PATH_WORDS = words(`
|
|
23
|
+
repos orgs users user enterprises graphql app installations installation
|
|
24
|
+
actions workflows runs jobs dispatches cancel force-cancel rerun rerun-failed-jobs approve logs timing attempts
|
|
25
|
+
artifacts caches secrets variables runners runner-groups permissions oidc environments deployment-protection-rules
|
|
26
|
+
pulls issues comments reviews requested_reviewers merge update-branch files commits labels assignees milestones
|
|
27
|
+
events timeline reactions lock sub_issues
|
|
28
|
+
releases assets latest tags git refs heads blobs trees matching-refs ref contents readme
|
|
29
|
+
branches protection required_status_checks required_pull_request_reviews enforce_admins restrictions rename
|
|
30
|
+
rulesets rules collaborators invitations members memberships teams outside_collaborators public_members
|
|
31
|
+
hooks tests pings deliveries config redeliver keys deployments statuses check-runs check-suites pages forks topics subscription subscribers stargazers
|
|
32
|
+
vulnerability-alerts automated-security-fixes code-scanning dependabot secret-scanning alerts autolinks
|
|
33
|
+
properties values transfer generate dispatch notifications languages contributors traffic projects codespaces
|
|
34
|
+
`);
|
|
35
|
+
/** Supabase's Management API path words (api.supabase.com/v1). */
|
|
36
|
+
export const SUPABASE_PATH_WORDS = words(`
|
|
37
|
+
v1 projects organizations branches database query migrations functions deploy body secrets api-keys config auth
|
|
38
|
+
postgrest pgbouncer storage buckets network-restrictions network-bans ssl-enforcement custom-hostname
|
|
39
|
+
vanity-subdomain restore pause unpause upgrade readonly health types typescript snippets sso providers
|
|
40
|
+
third-party-auth signing-keys billing addons apply push reset merge backups pitr settings members
|
|
41
|
+
`);
|
|
42
|
+
/** Railway is GraphQL: its path is one word. */
|
|
43
|
+
export const RAILWAY_PATH_WORDS = words("graphql v2");
|
|
44
|
+
export function pathWordsFor(platform) {
|
|
45
|
+
if (platform === "github")
|
|
46
|
+
return GITHUB_PATH_WORDS;
|
|
47
|
+
if (platform === "supabase")
|
|
48
|
+
return SUPABASE_PATH_WORDS;
|
|
49
|
+
if (platform === "railway")
|
|
50
|
+
return RAILWAY_PATH_WORDS;
|
|
51
|
+
return new Set();
|
|
52
|
+
}
|
|
53
|
+
/** A root word whose next segments are names, in order: `repos/{owner}/{repo}`. */
|
|
54
|
+
const POSITIONAL = {
|
|
55
|
+
repos: ["owner", "repo"],
|
|
56
|
+
orgs: ["org"],
|
|
57
|
+
users: ["user"],
|
|
58
|
+
enterprises: ["enterprise"]
|
|
59
|
+
};
|
|
60
|
+
/** The placeholder a value takes after a path word, when it isn't `{id}`. */
|
|
61
|
+
const AFTER = {
|
|
62
|
+
pulls: "number",
|
|
63
|
+
issues: "number",
|
|
64
|
+
milestones: "number",
|
|
65
|
+
branches: "branch",
|
|
66
|
+
heads: "branch",
|
|
67
|
+
tags: "tag",
|
|
68
|
+
labels: "name",
|
|
69
|
+
secrets: "name",
|
|
70
|
+
variables: "name",
|
|
71
|
+
environments: "name",
|
|
72
|
+
contents: "path",
|
|
73
|
+
commits: "sha",
|
|
74
|
+
projects: "ref",
|
|
75
|
+
functions: "slug"
|
|
76
|
+
};
|
|
77
|
+
function decoded(segment) {
|
|
78
|
+
try {
|
|
79
|
+
return decodeURIComponent(segment);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return segment;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* An API path as a template of the platform's own words: scheme, host, query and fragment dropped; the names after
|
|
87
|
+
* `repos`, `orgs`, `users` (as the first word) are `{owner}/{repo}`, `{org}`, `{user}`; any other segment stays only
|
|
88
|
+
* when it is one of `known`, else it is one placeholder named by the word before it (`{number}` after `pulls`,
|
|
89
|
+
* `{branch}` after `branches`, `{sha}` for a commit hash, else `{id}`), a run of them collapsed into one.
|
|
90
|
+
*/
|
|
91
|
+
export function templatePath(raw, known) {
|
|
92
|
+
const bare = raw
|
|
93
|
+
.trim()
|
|
94
|
+
.replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i, "")
|
|
95
|
+
.replace(/[?#][\s\S]*$/, "");
|
|
96
|
+
const segments = bare.split("/").filter(Boolean).slice(0, 64).map(decoded);
|
|
97
|
+
const out = [];
|
|
98
|
+
let index = 0;
|
|
99
|
+
const positional = segments[0] !== undefined && known.has(segments[0]) ? POSITIONAL[segments[0]] : undefined;
|
|
100
|
+
if (positional) {
|
|
101
|
+
out.push(segments[0]);
|
|
102
|
+
index = 1;
|
|
103
|
+
for (const name of positional) {
|
|
104
|
+
if (index >= segments.length)
|
|
105
|
+
break;
|
|
106
|
+
out.push(`{${name}}`);
|
|
107
|
+
index++;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
let word;
|
|
111
|
+
let inRun = false;
|
|
112
|
+
for (; index < segments.length; index++) {
|
|
113
|
+
const segment = segments[index];
|
|
114
|
+
if (known.has(segment)) {
|
|
115
|
+
out.push(segment);
|
|
116
|
+
word = segment;
|
|
117
|
+
inRun = false;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (inRun)
|
|
121
|
+
continue;
|
|
122
|
+
const name = /^[0-9a-f]{40}$/i.test(segment) ? "sha" : ((word && AFTER[word]) ?? "id");
|
|
123
|
+
out.push(`{${name}}`);
|
|
124
|
+
inRun = true;
|
|
125
|
+
}
|
|
126
|
+
return out.slice(0, MAX_SEGMENTS).join("/").slice(0, MAX_PATH);
|
|
127
|
+
}
|
|
128
|
+
/** `gh`'s command groups and their subcommands (gh 2.6x manual); a group with none takes no subcommand. */
|
|
129
|
+
const GH_COMMANDS = Object.fromEntries(Object.entries({
|
|
130
|
+
agent: "",
|
|
131
|
+
alias: "delete import list set",
|
|
132
|
+
api: "",
|
|
133
|
+
attestation: "download trusted-root verify",
|
|
134
|
+
auth: "login logout refresh setup-git status switch token",
|
|
135
|
+
browse: "",
|
|
136
|
+
cache: "delete list",
|
|
137
|
+
codespace: "code cp create delete edit jupyter list logs ports rebuild ssh stop view",
|
|
138
|
+
completion: "",
|
|
139
|
+
config: "clear-cache get list set",
|
|
140
|
+
extension: "browse create exec install list remove search upgrade",
|
|
141
|
+
gist: "clone create delete edit list rename view",
|
|
142
|
+
"gpg-key": "add delete list",
|
|
143
|
+
issue: "close comment create delete develop edit list lock pin reopen status transfer unlock unpin view", // copy-style-allow filler: gh's own subcommand names
|
|
144
|
+
label: "clone create delete edit list",
|
|
145
|
+
org: "list",
|
|
146
|
+
pr: "checkout checks close comment create diff edit list lock merge ready reopen review revert status unlock update-branch view", // copy-style-allow filler: gh's own subcommand names
|
|
147
|
+
project: "close copy create delete edit field-create field-delete field-list item-add item-archive item-create item-delete item-edit item-list link list mark-template unlink view",
|
|
148
|
+
release: "create delete delete-asset download edit list upload verify verify-asset view",
|
|
149
|
+
repo: "archive autolink clone create delete deploy-key edit fork gitignore license list rename set-default sync unarchive view",
|
|
150
|
+
ruleset: "check list view",
|
|
151
|
+
run: "cancel delete download list rerun view watch",
|
|
152
|
+
search: "code commits issues prs repos",
|
|
153
|
+
secret: "delete list set",
|
|
154
|
+
"ssh-key": "add delete list",
|
|
155
|
+
status: "",
|
|
156
|
+
variable: "delete get list set",
|
|
157
|
+
workflow: "disable enable list run view"
|
|
158
|
+
}).map(([group, subs]) => [group, words(subs)]));
|
|
159
|
+
/** Git's own commands; git takes one word. */
|
|
160
|
+
const GIT_COMMANDS = words(`
|
|
161
|
+
add am apply archive bisect blame branch bundle checkout cherry-pick clean clone commit config describe diff fetch
|
|
162
|
+
format-patch gc grep init log ls-files ls-remote merge mv notes pull push range-diff rebase reflog remote reset
|
|
163
|
+
restore revert rm shortlog show sparse-checkout stash status submodule switch tag worktree
|
|
164
|
+
`);
|
|
165
|
+
/** A program's name from its path: `/usr/bin/gh.exe` is `gh`. */
|
|
166
|
+
const programName = (argv0) => (argv0 ?? "").replace(/^.*[\\/]/, "").replace(/\.exe$/i, "");
|
|
167
|
+
/**
|
|
168
|
+
* A command line as its program and at most two subcommand words: each a CLI word (`^[a-z][a-z-]{0,30}$`) and, for
|
|
169
|
+
* `gh` and `git`, one that CLI has, so a positional argument (a branch, a remote, a repository, a number) never
|
|
170
|
+
* passes as a subcommand. Flags end it. Null when the program itself isn't a plain name.
|
|
171
|
+
*/
|
|
172
|
+
export function unnamedCommand(argv) {
|
|
173
|
+
const program = programName(argv[0]);
|
|
174
|
+
if (!COMMAND_WORD.test(program))
|
|
175
|
+
return null;
|
|
176
|
+
const out = [program];
|
|
177
|
+
const rest = argv.slice(1);
|
|
178
|
+
for (const word of rest.slice(0, 2)) {
|
|
179
|
+
if (!COMMAND_WORD.test(word))
|
|
180
|
+
break;
|
|
181
|
+
if (program === "git" && (out.length > 1 || !GIT_COMMANDS.has(word)))
|
|
182
|
+
break;
|
|
183
|
+
if (program === "gh") {
|
|
184
|
+
const group = out.length === 1 ? GH_COMMANDS[word] : GH_COMMANDS[out[1]];
|
|
185
|
+
if (out.length === 1 ? !Object.prototype.hasOwnProperty.call(GH_COMMANDS, word) : !group?.has(word))
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
out.push(word);
|
|
189
|
+
}
|
|
190
|
+
return out.join(" ");
|
|
191
|
+
}
|
|
192
|
+
/** An API call's hit: its method (one of the HTTP methods) and its path's template; either may be unknown. */
|
|
193
|
+
export function unnamedApi(platform, method, path) {
|
|
194
|
+
const upper = method?.toUpperCase();
|
|
195
|
+
const template = path === undefined ? "" : templatePath(path, pathWordsFor(platform));
|
|
196
|
+
return {
|
|
197
|
+
via: "api",
|
|
198
|
+
...(upper && UNNAMED_METHODS.includes(upper) ? { method: upper } : {}),
|
|
199
|
+
...(template ? { path: template } : {})
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
/** A command line's hit; undefined when nothing of it can be kept. */
|
|
203
|
+
export function unnamedCli(argv) {
|
|
204
|
+
const command = unnamedCommand(argv);
|
|
205
|
+
return command === null ? undefined : { via: "cli", command };
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* What a caller sent (the bridge's classification) made coarse again, so nothing it adds survives: the method from
|
|
209
|
+
* the list, the path re-templated with the platform's words, the command re-read word by word. Anything else is
|
|
210
|
+
* dropped, never refused.
|
|
211
|
+
*/
|
|
212
|
+
export function sanitizeUnnamed(platform, value) {
|
|
213
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
214
|
+
return undefined;
|
|
215
|
+
const hit = value;
|
|
216
|
+
if (hit.via === "api") {
|
|
217
|
+
const method = typeof hit.method === "string" ? hit.method.slice(0, 10) : undefined;
|
|
218
|
+
const path = typeof hit.path === "string" ? hit.path.slice(0, 2_000) : undefined;
|
|
219
|
+
return unnamedApi(platform, method, path);
|
|
220
|
+
}
|
|
221
|
+
if (hit.via === "cli" && typeof hit.command === "string") {
|
|
222
|
+
return unnamedCli(hit.command.slice(0, 200).trim().split(/\s+/));
|
|
223
|
+
}
|
|
224
|
+
return undefined;
|
|
225
|
+
}
|
package/dist/cpCli.js
CHANGED
|
@@ -14,6 +14,7 @@ import { readBoundedJson } from "./boundedResponse.js";
|
|
|
14
14
|
import { credentialDir, enforceOwner, ensurePrivateDirectory, writePrivateAtomic } from "./credentialStorage.js";
|
|
15
15
|
import { assertProfileName, getProfile } from "./credentials.js";
|
|
16
16
|
import { disarmFastPath } from "./fastPathFlag.js";
|
|
17
|
+
import { parseNotices, saveLocalNotices } from "./localNotices.js";
|
|
17
18
|
export const CP_CLI_PATH = "/api/cp/cli";
|
|
18
19
|
/** Older than this, the hooks refresh the copy after they have answered. */
|
|
19
20
|
export const CP_CLI_STALE_MS = 60 * 60 * 1000;
|
|
@@ -162,7 +163,10 @@ export async function refreshCpCli(profile, signal, deps = {}) {
|
|
|
162
163
|
await response.body?.cancel().catch(() => undefined);
|
|
163
164
|
return response.status === 404 ? "unavailable" : "failed";
|
|
164
165
|
}
|
|
165
|
-
const
|
|
166
|
+
const body = await readBoundedJson(response, MAX_BYTES);
|
|
167
|
+
const cli = parseCpCli(body);
|
|
168
|
+
// Notices are handed over once by this read: keep them before anything else can fail.
|
|
169
|
+
saveLocalNotices(profile, parseNotices(plainObject(body)?.notices));
|
|
166
170
|
if (!cli || signal.aborted)
|
|
167
171
|
return "failed";
|
|
168
172
|
writeCpCli(profile, cli, (deps.now ?? Date.now)());
|
package/dist/initAppsStep.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type AppsPlan = {
|
|
|
20
20
|
};
|
|
21
21
|
/** Apps to connect, in the order the scan found them. */
|
|
22
22
|
export declare function appsTodo(plan: AppsPlan): InitApp[];
|
|
23
|
-
export declare function detectApps(s: InitSession, candidates?: ("github" | "railway" | "supabase"
|
|
23
|
+
export declare function detectApps(s: InitSession, candidates?: ("github" | "railway" | "supabase")[]): AppsPlan;
|
|
24
24
|
export declare function pickApps(s: InitSession): Promise<InitApp[]>;
|
|
25
25
|
export declare function addApp(s: InitSession, app: InitApp): Promise<{
|
|
26
26
|
state: "pending" | "connected" | "attention";
|
package/dist/initAppsStep.js
CHANGED
|
@@ -11,7 +11,7 @@ import { firstText } from "./cliResult.js";
|
|
|
11
11
|
import { openUrl, readBoundedJson, safeApiError, sleep } from "./cliSupport.js";
|
|
12
12
|
import { APP_LABELS, INIT_APPS, appLabel, WAIT_CHUNK_SECONDS, WAIT_INTERACTIVE_MS, WAIT_NEXT_SECONDS, printable } from "./initState.js";
|
|
13
13
|
import { listOf } from "./initUi.js";
|
|
14
|
-
import {
|
|
14
|
+
import { CONNECT_LINK_LIFETIME, myAppLink } from "./webLinks.js";
|
|
15
15
|
export function connectionRows(managed) {
|
|
16
16
|
const rows = new Map();
|
|
17
17
|
for (const raw of managed.connections) {
|
|
@@ -46,7 +46,7 @@ export function detectApps(s, candidates = s.candidates) {
|
|
|
46
46
|
else if (row.status === "needs_your_signin")
|
|
47
47
|
plan.pending.push(app);
|
|
48
48
|
else
|
|
49
|
-
plan.attention.push({ app, message:
|
|
49
|
+
plan.attention.push({ app, message: `Your company doesn't have ${appLabel(app)} in Passport yet.` });
|
|
50
50
|
}
|
|
51
51
|
s.connected = [...plan.already];
|
|
52
52
|
return plan;
|
|
@@ -80,7 +80,7 @@ export async function addApp(s, app) {
|
|
|
80
80
|
const name = appLabel(app);
|
|
81
81
|
if (response.status === 401 || response.status === 403 || response.status === 405) {
|
|
82
82
|
await response.body?.cancel().catch(() => undefined);
|
|
83
|
-
return { state: "attention", message: `Add ${name} in Passport first: ${s.gateway.origin}/${
|
|
83
|
+
return { state: "attention", message: `Add ${name} in Passport first: ${s.gateway.origin}/${myAppLink(app)}` };
|
|
84
84
|
}
|
|
85
85
|
if (response.status === 404) {
|
|
86
86
|
const message = await safeApiError(response, "");
|
|
@@ -88,7 +88,7 @@ export async function addApp(s, app) {
|
|
|
88
88
|
state: "attention",
|
|
89
89
|
message: /catalog/i.test(message)
|
|
90
90
|
? `${name} isn't in this Passport's catalog.`
|
|
91
|
-
: `Add ${name} in Passport first: ${s.gateway.origin}/${
|
|
91
|
+
: `Add ${name} in Passport first: ${s.gateway.origin}/${myAppLink(app)}`
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
if (response.status === 429) {
|
|
@@ -102,7 +102,7 @@ export async function addApp(s, app) {
|
|
|
102
102
|
if (body.lifecycle === "waiting_on_admin") {
|
|
103
103
|
const reason = typeof body.statusReason === "string" ? body.statusReason : "";
|
|
104
104
|
if (body.request?.kind === "company_setup")
|
|
105
|
-
return { state: "attention", message:
|
|
105
|
+
return { state: "attention", message: `Your company doesn't have ${name} in Passport yet.` };
|
|
106
106
|
if (/blocked/i.test(reason))
|
|
107
107
|
return { state: "attention", message: `${name} is blocked by your workspace's app rules.` };
|
|
108
108
|
return { state: "attention", message: `${name} needs approval from your admin.` };
|
|
@@ -256,6 +256,7 @@ export async function connectApps(s, apps) {
|
|
|
256
256
|
else {
|
|
257
257
|
s.screen.line("Open this link to sign in:", "Apps");
|
|
258
258
|
s.screen.line(url);
|
|
259
|
+
s.screen.line(CONNECT_LINK_LIFETIME);
|
|
259
260
|
}
|
|
260
261
|
return "not_waited";
|
|
261
262
|
}
|
|
@@ -268,6 +269,7 @@ export async function connectApps(s, apps) {
|
|
|
268
269
|
else {
|
|
269
270
|
s.screen.line(`Open this link to sign in.${stopHint}`, "Apps");
|
|
270
271
|
s.screen.line(url);
|
|
272
|
+
s.screen.line(CONNECT_LINK_LIFETIME);
|
|
271
273
|
}
|
|
272
274
|
return waitForApps(s, apps, enter);
|
|
273
275
|
}
|
package/dist/initOutro.js
CHANGED
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
* ! Railway connects to Passport once you finish signing in
|
|
8
8
|
*
|
|
9
9
|
* Next: ask your agent to work with one of your apps, like GitHub or
|
|
10
|
-
* Railway.
|
|
11
|
-
* https://passportmcp.com/#cp/activity
|
|
10
|
+
* Railway. See what your agents do: https://passportmcp.com/#p
|
|
12
11
|
*/
|
|
13
12
|
import { EXEC_TOKEN_PAGES, EXEC_VENDOR_NAMES } from "./execVendors.js";
|
|
14
13
|
import { AGENT_NAMES } from "./initAgents.js";
|
|
@@ -19,7 +18,7 @@ import { desktopLine } from "./initLocalSteps.js";
|
|
|
19
18
|
import { TRY_IT, appLabel } from "./initState.js";
|
|
20
19
|
import { listOf } from "./initUi.js";
|
|
21
20
|
import { wrap } from "./term.js";
|
|
22
|
-
import {
|
|
21
|
+
import { MY_ACTIVITY_LINK, hashLink } from "./webLinks.js";
|
|
23
22
|
const done = (text) => ({ mark: "done", text });
|
|
24
23
|
const warn = (text) => ({ mark: "warn", text });
|
|
25
24
|
/** Apps this run connected, left waiting for a sign-in, skipped, or sent to an admin. */
|
|
@@ -114,15 +113,15 @@ function agentFollowUps(s) {
|
|
|
114
113
|
}
|
|
115
114
|
return items;
|
|
116
115
|
}
|
|
117
|
-
/** The one next step: put passport on PATH (then
|
|
118
|
-
* sign-ins, try an agent, or watch its work in
|
|
116
|
+
/** The one next step: put passport on PATH (then My activity), finish app
|
|
117
|
+
* sign-ins, try an agent, or watch its work in My activity. A command or link is
|
|
119
118
|
* never wrapped. */
|
|
120
119
|
function nextCommand(s, waiting) {
|
|
121
120
|
const stable = s.stable;
|
|
122
121
|
if (stable?.binDir && !stable.onPath) {
|
|
123
122
|
const line = pathLine(stable.binDir, s.env, s.home, s.platform);
|
|
124
123
|
s.summary.pathLine = line;
|
|
125
|
-
// PATH first, then
|
|
124
|
+
// PATH first, then My activity, so a first npx run still ends there.
|
|
126
125
|
const work = workNext(s, "Then");
|
|
127
126
|
return [...pathNext(line, s.terminal.width), ...(work.length ? ["", ...work] : [])];
|
|
128
127
|
}
|
|
@@ -137,13 +136,17 @@ function nextCommand(s, waiting) {
|
|
|
137
136
|
const work = workNext(s, "Next:");
|
|
138
137
|
return work.length ? work : ["Run: passport status"];
|
|
139
138
|
}
|
|
140
|
-
/** "Next: ask your agent to work with an app…" and the
|
|
139
|
+
/** "Next: ask your agent to work with an app…" and the My activity link; nothing without a server to link to. The
|
|
140
|
+
* link is never wrapped. */
|
|
141
141
|
function workNext(s, lead) {
|
|
142
|
-
const work = hashLink(s.gateway?.origin,
|
|
142
|
+
const work = hashLink(s.gateway?.origin, MY_ACTIVITY_LINK);
|
|
143
143
|
if (!work)
|
|
144
144
|
return [];
|
|
145
|
-
const step = `${lead} ask your agent to work with one of your apps, like GitHub or Railway
|
|
146
|
-
|
|
145
|
+
const step = `${lead} ask your agent to work with one of your apps, like GitHub or Railway.`;
|
|
146
|
+
const see = `See what your agents do: ${work}`;
|
|
147
|
+
// Narrow, the link gets a line of its own.
|
|
148
|
+
const tail = [...see].length <= s.terminal.width ? [see] : ["See what your agents do:", work];
|
|
149
|
+
return [...wrap(step, s.terminal.width), ...tail];
|
|
147
150
|
}
|
|
148
151
|
/** What to do next about PATH: the step, then the command on its own line. */
|
|
149
152
|
export function pathNext(line, width) {
|
package/dist/initState.d.ts
CHANGED
|
@@ -9,8 +9,9 @@ import type { InitScreen, InitTerminal } from "./initUi.js";
|
|
|
9
9
|
import type { CredentialsSwitch } from "./offInV1.js";
|
|
10
10
|
import type { ScanOptions, ScanResult } from "./scan.js";
|
|
11
11
|
export declare const PASSPORT_CLOUD = "https://passportmcp.com";
|
|
12
|
-
/** The production apps init looks for, in the order it lists them
|
|
13
|
-
|
|
12
|
+
/** The production apps init looks for, in the order it lists them: the deep apps (gateway apps were removed on
|
|
13
|
+
* 2026-11-17). */
|
|
14
|
+
export declare const INIT_APPS: readonly ["railway", "supabase", "github"];
|
|
14
15
|
export type InitApp = (typeof INIT_APPS)[number];
|
|
15
16
|
export declare const APP_LABELS: Record<InitApp, string>;
|
|
16
17
|
/** The short name init uses for an app in its copy. */
|
package/dist/initState.js
CHANGED
|
@@ -6,15 +6,13 @@
|
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
export const PASSPORT_CLOUD = "https://passportmcp.com";
|
|
9
|
-
/** The production apps init looks for, in the order it lists them
|
|
10
|
-
|
|
9
|
+
/** The production apps init looks for, in the order it lists them: the deep apps (gateway apps were removed on
|
|
10
|
+
* 2026-11-17). */
|
|
11
|
+
export const INIT_APPS = ["railway", "supabase", "github"];
|
|
11
12
|
export const APP_LABELS = {
|
|
12
13
|
railway: "Railway",
|
|
13
|
-
vercel: "Vercel",
|
|
14
14
|
supabase: "Supabase",
|
|
15
|
-
|
|
16
|
-
github: "GitHub",
|
|
17
|
-
stripe: "Stripe"
|
|
15
|
+
github: "GitHub"
|
|
18
16
|
};
|
|
19
17
|
/** The short name init uses for an app in its copy. */
|
|
20
18
|
export function appLabel(app) {
|
|
@@ -23,29 +21,20 @@ export function appLabel(app) {
|
|
|
23
21
|
/** A scan finding's provider → the catalog app that replaces the key. */
|
|
24
22
|
export const APP_BY_PROVIDER = {
|
|
25
23
|
Railway: "railway",
|
|
26
|
-
Vercel: "vercel",
|
|
27
24
|
Supabase: "supabase",
|
|
28
|
-
|
|
29
|
-
GitHub: "github",
|
|
30
|
-
Stripe: "stripe"
|
|
25
|
+
GitHub: "github"
|
|
31
26
|
};
|
|
32
27
|
/** A vendor CLI on PATH → its catalog app. */
|
|
33
28
|
export const APP_BY_CLI = [
|
|
34
29
|
["railway", "railway"],
|
|
35
|
-
["vercel", "vercel"],
|
|
36
30
|
["supabase", "supabase"],
|
|
37
|
-
["
|
|
38
|
-
["gh", "github"],
|
|
39
|
-
["stripe", "stripe"]
|
|
31
|
+
["gh", "github"]
|
|
40
32
|
];
|
|
41
33
|
/** A read-only first request per app, for the closing "Try it" line. */
|
|
42
34
|
export const TRY_IT = {
|
|
43
35
|
railway: "list your Railway services",
|
|
44
|
-
vercel: "list your Vercel deployments",
|
|
45
36
|
supabase: "list your Supabase projects",
|
|
46
|
-
|
|
47
|
-
github: "list your open GitHub pull requests",
|
|
48
|
-
stripe: "show your Stripe balance"
|
|
37
|
+
github: "list your open GitHub pull requests"
|
|
49
38
|
};
|
|
50
39
|
export const WAIT_INTERACTIVE_MS = 10 * 60 * 1000;
|
|
51
40
|
/** How long the printed `passport connect --wait` command waits. */
|