@cat-factory/local-server 0.110.0 → 0.111.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.
Files changed (51) hide show
  1. package/dist/LocalContainerRunnerTransport.d.ts +21 -1
  2. package/dist/LocalContainerRunnerTransport.d.ts.map +1 -1
  3. package/dist/LocalContainerRunnerTransport.js +26 -11
  4. package/dist/LocalContainerRunnerTransport.js.map +1 -1
  5. package/dist/LocalPreviewTransport.d.ts +9 -1
  6. package/dist/LocalPreviewTransport.d.ts.map +1 -1
  7. package/dist/LocalPreviewTransport.js +9 -8
  8. package/dist/LocalPreviewTransport.js.map +1 -1
  9. package/dist/config.js +1 -1
  10. package/dist/config.js.map +1 -1
  11. package/dist/container.d.ts +11 -1
  12. package/dist/container.d.ts.map +1 -1
  13. package/dist/container.js +224 -107
  14. package/dist/container.js.map +1 -1
  15. package/dist/gateProviderFollowing.d.ts +39 -0
  16. package/dist/gateProviderFollowing.d.ts.map +1 -0
  17. package/dist/gateProviderFollowing.js +62 -0
  18. package/dist/gateProviderFollowing.js.map +1 -0
  19. package/dist/github.d.ts +44 -47
  20. package/dist/github.d.ts.map +1 -1
  21. package/dist/github.js +77 -95
  22. package/dist/github.js.map +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +1 -1
  25. package/dist/installations.d.ts +21 -6
  26. package/dist/installations.d.ts.map +1 -1
  27. package/dist/installations.js +15 -5
  28. package/dist/installations.js.map +1 -1
  29. package/dist/mothership.d.ts.map +1 -1
  30. package/dist/mothership.js +1 -16
  31. package/dist/mothership.js.map +1 -1
  32. package/dist/server.d.ts.map +1 -1
  33. package/dist/server.js +17 -9
  34. package/dist/server.js.map +1 -1
  35. package/dist/sqlite/db.d.ts +6 -0
  36. package/dist/sqlite/db.d.ts.map +1 -1
  37. package/dist/sqlite/db.js +20 -3
  38. package/dist/sqlite/db.js.map +1 -1
  39. package/dist/sqlite/vcsCredentialStore.d.ts +29 -0
  40. package/dist/sqlite/vcsCredentialStore.d.ts.map +1 -0
  41. package/dist/sqlite/vcsCredentialStore.js +145 -0
  42. package/dist/sqlite/vcsCredentialStore.js.map +1 -0
  43. package/dist/vcsClientRouter.d.ts +14 -0
  44. package/dist/vcsClientRouter.d.ts.map +1 -0
  45. package/dist/vcsClientRouter.js +65 -0
  46. package/dist/vcsClientRouter.js.map +1 -0
  47. package/dist/vcsCredential.d.ts +40 -0
  48. package/dist/vcsCredential.d.ts.map +1 -0
  49. package/dist/vcsCredential.js +168 -0
  50. package/dist/vcsCredential.js.map +1 -0
  51. package/package.json +11 -11
@@ -0,0 +1,39 @@
1
+ import type { Logger, ProviderRegistry, ProviderToken } from '@cat-factory/kernel';
2
+ /**
3
+ * The built-in gate providers built FROM the VCS client. Each answers a question only source
4
+ * control can answer, so each must be wired exactly while the deployment can reach it — see
5
+ * {@link followVcsReachOnProviderRegistry}. (`release-health` and `incident-enrichment` are
6
+ * Datadog-shaped and unrelated, so they are deliberately absent.)
7
+ */
8
+ export declare const VCS_BACKED_GATE_PROVIDERS: readonly ProviderToken<unknown>[];
9
+ /**
10
+ * Make the VCS-backed gate providers follow whatever can currently answer them.
11
+ *
12
+ * A gate probes iff its provider is wired, and local mode hands the build a VCS client that ALWAYS
13
+ * exists (so that "no token" can be a refusal naming the fix rather than an absent client the
14
+ * layers above read as "this deployment does no source control"). The build therefore wires all
15
+ * four regardless. That is right the moment the client can reach a host and wrong before it: a
16
+ * deployment reaching nothing would probe CI with nothing to ask and fail runs whose documented
17
+ * behaviour is to pass through. So the impls the build produced are captured once and re-wired (or
18
+ * cleared) as the answer changes. This decides only WHETHER they are wired; the impls are the
19
+ * build's own, verbatim.
20
+ *
21
+ * `canReach` is the SAME question the client router and `mintInstallationToken` ask, and it is
22
+ * deliberately NOT just "is there a credential": a mothership node reaches GitHub on installation
23
+ * tokens the mothership mints, holding no local PAT at all, and backing gates/merge is one of the
24
+ * things that delegation exists for. Keyed on the credential alone, every mothership run would
25
+ * advance as if CI were green.
26
+ *
27
+ * `warnUnwiredGates` runs on a TRANSITION to unwired, because the build's own call saw them wired
28
+ * and therefore said nothing — and "CI is never checked, PRs advance as if green" is exactly what
29
+ * an operator must hear. Only on the transition, so a re-apply doesn't reprint the unrelated
30
+ * advisories the build already logged.
31
+ */
32
+ export declare function followVcsReachOnProviderRegistry(params: {
33
+ registry: ProviderRegistry;
34
+ canReach: () => boolean;
35
+ /** Register a callback fired whenever the answer to {@link canReach} may have changed. */
36
+ onChange: (fn: () => void) => void;
37
+ logger: Logger;
38
+ }): void;
39
+ //# sourceMappingURL=gateProviderFollowing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gateProviderFollowing.d.ts","sourceRoot":"","sources":["../src/gateProviderFollowing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAmBlF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,aAAa,CAAC,OAAO,CAAC,EAKtE,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,gCAAgC,CAAC,MAAM,EAAE;IACvD,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,QAAQ,EAAE,MAAM,OAAO,CAAA;IACvB,0FAA0F;IAC1F,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;IAClC,MAAM,EAAE,MAAM,CAAA;CACf,GAAG,IAAI,CAcP"}
@@ -0,0 +1,62 @@
1
+ import { CI_STATUS_PROVIDER, DOC_QUALITY_PROVIDER, MERGEABILITY_PROVIDER, PULL_REQUEST_REVIEW_PROVIDER, warnUnwiredGates, } from '@cat-factory/gates';
2
+ // Keeping the VCS-backed gate providers in step with what can actually answer them.
3
+ //
4
+ // Everywhere else, local mode's "no source control" state is resolved PER CALL. A gate is the one
5
+ // thing that cannot be: `wired()` is what decides whether the gate probes at all, and it is read
6
+ // off the provider registry the build populated. So this is the seam that re-derives that decision
7
+ // when the deployment's reach changes, and it lives beside `vcsCredential.ts` rather than inside
8
+ // the container assembly because getting it wrong is invisible in both directions (a deployment
9
+ // that fails every run, or one that advances PRs as if CI were green) and it is worth testing on
10
+ // its own.
11
+ /**
12
+ * The built-in gate providers built FROM the VCS client. Each answers a question only source
13
+ * control can answer, so each must be wired exactly while the deployment can reach it — see
14
+ * {@link followVcsReachOnProviderRegistry}. (`release-health` and `incident-enrichment` are
15
+ * Datadog-shaped and unrelated, so they are deliberately absent.)
16
+ */
17
+ export const VCS_BACKED_GATE_PROVIDERS = [
18
+ CI_STATUS_PROVIDER,
19
+ MERGEABILITY_PROVIDER,
20
+ PULL_REQUEST_REVIEW_PROVIDER,
21
+ DOC_QUALITY_PROVIDER,
22
+ ];
23
+ /**
24
+ * Make the VCS-backed gate providers follow whatever can currently answer them.
25
+ *
26
+ * A gate probes iff its provider is wired, and local mode hands the build a VCS client that ALWAYS
27
+ * exists (so that "no token" can be a refusal naming the fix rather than an absent client the
28
+ * layers above read as "this deployment does no source control"). The build therefore wires all
29
+ * four regardless. That is right the moment the client can reach a host and wrong before it: a
30
+ * deployment reaching nothing would probe CI with nothing to ask and fail runs whose documented
31
+ * behaviour is to pass through. So the impls the build produced are captured once and re-wired (or
32
+ * cleared) as the answer changes. This decides only WHETHER they are wired; the impls are the
33
+ * build's own, verbatim.
34
+ *
35
+ * `canReach` is the SAME question the client router and `mintInstallationToken` ask, and it is
36
+ * deliberately NOT just "is there a credential": a mothership node reaches GitHub on installation
37
+ * tokens the mothership mints, holding no local PAT at all, and backing gates/merge is one of the
38
+ * things that delegation exists for. Keyed on the credential alone, every mothership run would
39
+ * advance as if CI were green.
40
+ *
41
+ * `warnUnwiredGates` runs on a TRANSITION to unwired, because the build's own call saw them wired
42
+ * and therefore said nothing — and "CI is never checked, PRs advance as if green" is exactly what
43
+ * an operator must hear. Only on the transition, so a re-apply doesn't reprint the unrelated
44
+ * advisories the build already logged.
45
+ */
46
+ export function followVcsReachOnProviderRegistry(params) {
47
+ const { registry, canReach, onChange, logger } = params;
48
+ const built = new Map(VCS_BACKED_GATE_PROVIDERS.map((token) => [token, registry.get(token)]));
49
+ let wired;
50
+ const apply = () => {
51
+ const reachable = canReach();
52
+ for (const token of VCS_BACKED_GATE_PROVIDERS) {
53
+ registry.wire(token, reachable ? built.get(token) : undefined);
54
+ }
55
+ if (!reachable && wired !== false)
56
+ warnUnwiredGates(registry, logger);
57
+ wired = reachable;
58
+ };
59
+ apply();
60
+ onChange(apply);
61
+ }
62
+ //# sourceMappingURL=gateProviderFollowing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gateProviderFollowing.js","sourceRoot":"","sources":["../src/gateProviderFollowing.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,oBAAoB,CAAA;AAE3B,oFAAoF;AACpF,EAAE;AACF,kGAAkG;AAClG,iGAAiG;AACjG,mGAAmG;AACnG,iGAAiG;AACjG,gGAAgG;AAChG,iGAAiG;AACjG,WAAW;AAEX;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAsC;IAC1E,kBAAkB;IAClB,qBAAqB;IACrB,4BAA4B;IAC5B,oBAAoB;CACrB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,gCAAgC,CAAC,MAMhD;IACC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAAA;IACvD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IAC7F,IAAI,KAA0B,CAAA;IAC9B,MAAM,KAAK,GAAG,GAAG,EAAE;QACjB,MAAM,SAAS,GAAG,QAAQ,EAAE,CAAA;QAC5B,KAAK,MAAM,KAAK,IAAI,yBAAyB,EAAE,CAAC;YAC9C,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;QAChE,CAAC;QACD,IAAI,CAAC,SAAS,IAAI,KAAK,KAAK,KAAK;YAAE,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QACrE,KAAK,GAAG,SAAS,CAAA;IACnB,CAAC,CAAA;IACD,KAAK,EAAE,CAAA;IACP,QAAQ,CAAC,KAAK,CAAC,CAAA;AACjB,CAAC"}
package/dist/github.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { GitHubClient, GitHubRepo, GroupCacheHandle, InstallationPermissions } from '@cat-factory/kernel';
2
- import type { Logger, VcsIdentityRegistry, VcsProvider } from '@cat-factory/kernel';
2
+ import type { Logger, VcsIdentityRegistry } from '@cat-factory/kernel';
3
+ import type { LocalVcsCredential } from './vcsCredential.js';
3
4
  import { type AppTokenSource } from '@cat-factory/server';
4
5
  import type { PatAccount } from './installations.js';
5
6
  /**
@@ -9,11 +10,21 @@ import type { PatAccount } from './installations.js';
9
10
  * `scopes` query param for pre-selection.
10
11
  */
11
12
  export declare function githubPatCreationUrl(): string;
12
- /** An {@link AppTokenSource} that returns a fixed PAT for every installation call. */
13
- export declare class StaticTokenAppRegistry implements AppTokenSource {
14
- private readonly token;
13
+ /**
14
+ * The refusal every credential-reading path shares, so an unconfigured deployment says the same
15
+ * actionable thing wherever it is hit (a gate probe, a repo enumeration, a clone) instead of a
16
+ * generic 500 or an empty result that reads like "no repos".
17
+ */
18
+ export declare function noVcsCredentialError(): Error;
19
+ /**
20
+ * An {@link AppTokenSource} that returns the deployment's CURRENT PAT for every installation call.
21
+ * The token is read per call, so a credential installed from the sign-in screen is used by the
22
+ * very next dispatch.
23
+ */
24
+ export declare class LocalPatAppTokenSource implements AppTokenSource {
25
+ private readonly resolveToken;
15
26
  readonly defaultAppId = "";
16
- constructor(token: string);
27
+ constructor(resolveToken: () => string | undefined);
17
28
  apps(): readonly {
18
29
  appId: string;
19
30
  }[];
@@ -28,7 +39,7 @@ export declare class StaticTokenAppRegistry implements AppTokenSource {
28
39
  * to it in the connect UI. Best-effort: a failed/forbidden call falls back to an empty
29
40
  * login (the link flow only needs the installation row to exist, not its account label).
30
41
  */
31
- export declare function fetchPatAccount(env: NodeJS.ProcessEnv): Promise<PatAccount>;
42
+ export declare function fetchPatAccount(env: NodeJS.ProcessEnv, pat: string | undefined): Promise<PatAccount>;
32
43
  /**
33
44
  * Verdict of the optional boot-time GITHUB_PAT probe ({@link probeGitHubPat}). `ok` means the token
34
45
  * authenticated and — for a classic token whose scopes GitHub reports — carries the scopes local
@@ -57,19 +68,21 @@ export declare function classifyPatProbe(res: {
57
68
  scopesHeader: string | null;
58
69
  }): PatProbeVerdict;
59
70
  /**
60
- * Best-effort boot-time validation of a SET `GITHUB_PAT`: one `GET /user`. Returns the verdict, or
61
- * undefined when there is no PAT to probe or the probe couldn't complete (network error / timeout) —
71
+ * Best-effort boot-time validation of the deployment's GitHub PAT: one `GET /user`. Returns the
72
+ * verdict, or undefined when there is no PAT to probe or the probe couldn't complete (network error / timeout) —
62
73
  * a probe must NEVER block or crash boot, so an unreachable GitHub is treated as "unknown", not a
63
74
  * failure. `fetchImpl` + `timeoutMs` are injectable for tests.
64
75
  */
65
- export declare function probeGitHubPat(env: NodeJS.ProcessEnv, opts?: {
76
+ export declare function probeGitHubPat(env: NodeJS.ProcessEnv, pat: string | undefined, opts?: {
66
77
  fetchImpl?: typeof fetch;
67
78
  timeoutMs?: number;
68
79
  }): Promise<PatProbeVerdict | undefined>;
69
80
  /**
70
81
  * The boot warning for a non-OK {@link probeGitHubPat} verdict (undefined when the PAT is fine).
71
82
  * Mirrors the MISSING-PAT boot warning: it names the exact problem and links the classic-token
72
- * creation URL with the local-mode scopes pre-selected, so the fix is one click + restart.
83
+ * creation URL with the local-mode scopes pre-selected, so the fix is one click. It names BOTH
84
+ * ways to apply the replacement, because the token it just rejected may have come from either:
85
+ * `.env` (which the sign-in screen will not override) or a previous browser install.
73
86
  */
74
87
  export declare function describePatProbeVerdict(verdict: PatProbeVerdict): string | undefined;
75
88
  /**
@@ -81,7 +94,7 @@ export declare function describePatProbeVerdict(verdict: PatProbeVerdict): strin
81
94
  * swallows network errors and the resolution handler is defensively guarded). `fetchImpl` +
82
95
  * `timeoutMs` are injectable for tests.
83
96
  */
84
- export declare function warnOnGitHubPatProblemInBackground(env: NodeJS.ProcessEnv, log: Logger, opts?: {
97
+ export declare function warnOnGitHubPatProblemInBackground(env: NodeJS.ProcessEnv, pat: string | undefined, log: Logger, opts?: {
85
98
  fetchImpl?: typeof fetch;
86
99
  timeoutMs?: number;
87
100
  }): void;
@@ -93,25 +106,24 @@ export declare function warnOnGitHubPatProblemInBackground(env: NodeJS.ProcessEn
93
106
  */
94
107
  export declare function gitlabPatCreationUrl(): string;
95
108
  /**
96
- * Assemble the source-control PAT-login registry from env — the provider-agnostic seam the
97
- * `/auth/pat` endpoint resolves through. A provider is "configured" (sign-in available) when
98
- * its PAT is set in env; that env token is also the operational credential, so a provider
99
- * without one can't sign in (the SPA shows no button for it). The browser never sees a token
100
- * sign-in just selects a provider. Adding a third provider is one more entry here + its
101
- * resolver, with no change to the endpoint or the UI flow.
109
+ * Assemble the source-control PAT-login registry — the provider-agnostic seam the `/auth/pat`
110
+ * endpoint resolves through. A provider is "configured" (one-click sign-in available) when the
111
+ * deployment holds ITS token, read LIVE from `credential` so a token installed from the sign-in
112
+ * screen turns the button on for the next caller. The browser never sees a token — one-click
113
+ * sign-in just selects a provider. Adding a third provider is one more entry here + its resolver,
114
+ * with no change to the endpoint or the UI flow.
102
115
  */
103
- export declare function buildVcsIdentityRegistry(env: NodeJS.ProcessEnv): {
104
- registry: VcsIdentityRegistry;
105
- configured: VcsProvider[];
106
- };
116
+ export declare function buildVcsIdentityRegistry(env: NodeJS.ProcessEnv, credential: () => LocalVcsCredential | undefined): VcsIdentityRegistry;
107
117
  /**
108
- * Build a {@link GitHubClient} that authenticates with the PAT, for the CI / merge /
109
- * mergeability gates AND the repo-link / board "add from repo" flows. Returns undefined
110
- * when no PAT is configured (the gates then pass through, like the Node default).
111
- * `repoEnumCache` is the `AppCaches.patInstallationRepos` handle backing the picker
112
- * typeahead (optional absent, the search enumerates live per request).
118
+ * Build a {@link GitHubClient} that authenticates with the deployment's GitHub PAT, for the CI /
119
+ * merge / mergeability gates AND the repo-link / board "add from repo" flows. Always returns a
120
+ * client: the token is read per call, so "no token yet" is a REFUSAL the client raises (naming
121
+ * how to fix it) rather than an absent client — which the layers above would otherwise read as
122
+ * "this deployment has no source control at all" and wire nothing, permanently.
123
+ * `repoEnumCache` is the `AppCaches.patInstallationRepos` handle backing the picker typeahead
124
+ * (optional — absent, the search enumerates live per request).
113
125
  */
114
- export declare function createLocalGitHubClient(env: NodeJS.ProcessEnv, repoEnumCache?: GroupCacheHandle<GitHubRepo[]>): GitHubClient | undefined;
126
+ export declare function createLocalGitHubClient(env: NodeJS.ProcessEnv, resolveToken: () => string | undefined, repoEnumCache?: GroupCacheHandle<GitHubRepo[]>): GitHubClient;
115
127
  /**
116
128
  * Build a {@link GitHubClient} over a mothership-delegated {@link AppTokenSource}
117
129
  * (mothership mode with no local `GITHUB_PAT`): every installation token is minted by the
@@ -127,30 +139,15 @@ export declare function createDelegatedGitHubClient(env: NodeJS.ProcessEnv, toke
127
139
  * Build a {@link GitHubClient} for a GitLab-only local deployment, through the SAME
128
140
  * {@link buildGitLabEngineClient} the hosted facades use — a PAT-backed `VcsClient` adapted to the
129
141
  * legacy `GitHubClient` port the CI / merge / mergeability gates + repo-link flows still consume.
130
- * So a developer who set only `GITLAB_PAT` gets the same gating/merge/repo-read surface a
142
+ * So a developer whose credential is a GitLab one gets the same gating/merge/repo-read surface a
131
143
  * GitHub PAT gives — the engine talks to GitLab through the adapter without being migrated to
132
- * the neutral port. Returns undefined when no `GITLAB_PAT` is configured (the gates then pass
133
- * through). For a self-managed instance set `GITLAB_API_BASE` (e.g.
134
- * `https://gitlab.example.com/api/v4`).
144
+ * the neutral port. Like {@link createLocalGitHubClient} it is always built and reads its token
145
+ * per call, so an installed credential is live immediately. For a self-managed instance set
146
+ * `GITLAB_API_BASE` (e.g. `https://gitlab.example.com/api/v4`).
135
147
  *
136
148
  * It goes THROUGH the builder rather than assembling the client + adapter pair itself, which is
137
149
  * what it did until that drifted: the builder is documented as the single source of this wiring,
138
150
  * so anything it gained reached the two hosted facades and silently skipped local.
139
151
  */
140
- export declare function createLocalGitLabClient(env: NodeJS.ProcessEnv): GitHubClient | undefined;
141
- /**
142
- * The host a GitLab local deployment clones/pushes against, derived from `GITLAB_API_BASE`'s
143
- * host (a self-managed instance) or the public `gitlab.com`. Single source of truth for BOTH
144
- * the clone URL the server builds (`resolveRepoOrigin`) and the harness host allow-list, so
145
- * they can never disagree. Returns undefined when no `GITLAB_PAT` is configured (GitHub mode).
146
- */
147
- export declare function gitlabVcsHost(env: NodeJS.ProcessEnv): string | undefined;
148
- /**
149
- * The comma-separated host allow-list the harness container is given (`GITHUB_ALLOWED_HOSTS`).
150
- * The harness rejects any clone/push host not on this list (default github.com), so a GitLab
151
- * deployment must add its host or every clone is refused. Combines any operator-set
152
- * `GITHUB_ALLOWED_HOSTS` with the resolved GitLab host. Returns undefined when neither applies
153
- * (GitHub mode with no extra hosts ⇒ the harness keeps its github.com default).
154
- */
155
- export declare function harnessAllowedHosts(env: NodeJS.ProcessEnv): string | undefined;
152
+ export declare function createLocalGitLabClient(env: NodeJS.ProcessEnv, resolveToken: () => string | undefined): GitHubClient;
156
153
  //# sourceMappingURL=github.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":"AACA,O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BAAoB,IAAI,MAAM,CAM7C;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,UAAU,EAAE,MAAM,kBAAkB,GAAG,SAAS,GAC/C,mBAAmB,CAiBrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,YAAY,EAAE,MAAM,MAAM,GAAG,SAAS,EACtC,aAAa,CAAC,EAAE,gBAAgB,CAAC,UAAU,EAAE,CAAC,GAC7C,YAAY,CAad;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,WAAW,EAAE,cAAc,GAC1B,YAAY,CASd;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,YAAY,EAAE,MAAM,MAAM,GAAG,SAAS,GACrC,YAAY,CAGd"}
package/dist/github.js CHANGED
@@ -3,9 +3,14 @@ import { runBestEffort } from '@cat-factory/kernel';
3
3
  import { FetchGitHubClient, GitHubIdentityResolver, logger, } from '@cat-factory/server';
4
4
  import { buildGitLabEngineClient, GITLAB_PUBLIC_API_BASE, GitLabIdentityResolver, } from '@cat-factory/gitlab';
5
5
  // PAT-backed GitHub access for local mode. The shared FetchGitHubClient normally mints
6
- // per-installation tokens via the GitHub App registry; here we feed it a static-token
7
- // source returning the developer's PAT, so the CI gate + merge / mergeability
8
- // providers (wired in container.ts from this client) hit real GitHub with the PAT.
6
+ // per-installation tokens via the GitHub App registry; here we feed it a token source returning
7
+ // the deployment's PAT, so the CI gate + merge / mergeability providers (wired in container.ts
8
+ // from this client) hit real GitHub with the PAT.
9
+ //
10
+ // Every token read here goes through a getter rather than a captured string: local mode's
11
+ // credential can be installed from the sign-in screen while the server runs (see
12
+ // `vcsCredential.ts`), and a value snapshotted at container-build time would pin the state the
13
+ // process booted in.
9
14
  //
10
15
  // The app-JWT paths (installation discovery / listing) are never reached in local
11
16
  // mode — those are the GitHub-App connect flow, which local mode replaces with the
@@ -27,12 +32,24 @@ export function githubPatCreationUrl() {
27
32
  });
28
33
  return `https://github.com/settings/tokens/new?${params.toString()}`;
29
34
  }
30
- /** An {@link AppTokenSource} that returns a fixed PAT for every installation call. */
31
- export class StaticTokenAppRegistry {
32
- token;
35
+ /**
36
+ * The refusal every credential-reading path shares, so an unconfigured deployment says the same
37
+ * actionable thing wherever it is hit (a gate probe, a repo enumeration, a clone) instead of a
38
+ * generic 500 or an empty result that reads like "no repos".
39
+ */
40
+ export function noVcsCredentialError() {
41
+ return new Error('This deployment has no source-control token yet. Sign in with a GitHub or GitLab personal access token, or set GITHUB_PAT / GITLAB_PAT in your .env.');
42
+ }
43
+ /**
44
+ * An {@link AppTokenSource} that returns the deployment's CURRENT PAT for every installation call.
45
+ * The token is read per call, so a credential installed from the sign-in screen is used by the
46
+ * very next dispatch.
47
+ */
48
+ export class LocalPatAppTokenSource {
49
+ resolveToken;
33
50
  defaultAppId = '';
34
- constructor(token) {
35
- this.token = token;
51
+ constructor(resolveToken) {
52
+ this.resolveToken = resolveToken;
36
53
  }
37
54
  apps() {
38
55
  return [{ appId: '' }];
@@ -43,7 +60,8 @@ export class StaticTokenAppRegistry {
43
60
  };
44
61
  }
45
62
  installationToken() {
46
- return Promise.resolve(this.token);
63
+ const token = this.resolveToken();
64
+ return token ? Promise.resolve(token) : Promise.reject(noVcsCredentialError());
47
65
  }
48
66
  // A static PAT carries no App-granted permissions map; canPush then relies on the
49
67
  // repo object's user-role `permissions.push`, which IS authoritative for a PAT.
@@ -82,9 +100,9 @@ function patHeaders(pat) {
82
100
  * the installation-token paths, so they fall through to the base implementation.
83
101
  */
84
102
  class PatGitHubClient extends FetchGitHubClient {
85
- pat;
103
+ resolvePat;
86
104
  repoEnumCache;
87
- constructor(deps, pat,
105
+ constructor(deps, resolvePat,
88
106
  /**
89
107
  * The `AppCaches.patInstallationRepos` handle (keyed/grouped by installation id). When
90
108
  * wired, the realtime picker search filters a cached complete enumeration in memory
@@ -93,7 +111,7 @@ class PatGitHubClient extends FetchGitHubClient {
93
111
  */
94
112
  repoEnumCache) {
95
113
  super(deps);
96
- this.pat = pat;
114
+ this.resolvePat = resolvePat;
97
115
  this.repoEnumCache = repoEnumCache;
98
116
  }
99
117
  async listInstallationRepos(installationId) {
@@ -103,7 +121,10 @@ class PatGitHubClient extends FetchGitHubClient {
103
121
  // page-by-page crawl. The rows come back stamped as personal (`user_pat`, placeholder
104
122
  // installation), so re-stamp them: local mode's shared `GITHUB_PAT` is the workspace-wide
105
123
  // credential, so repos it enumerates are App-reachable (visible to every member).
106
- const { items, truncated } = await this.listReposForToken(this.pat);
124
+ const pat = this.resolvePat();
125
+ if (!pat)
126
+ throw noVcsCredentialError();
127
+ const { items, truncated } = await this.listReposForToken(pat);
107
128
  return {
108
129
  items: items.map((r) => ({ ...r, installationId, linkedVia: 'app' })),
109
130
  ...(truncated !== undefined ? { truncated } : {}),
@@ -135,9 +156,8 @@ class PatGitHubClient extends FetchGitHubClient {
135
156
  * to it in the connect UI. Best-effort: a failed/forbidden call falls back to an empty
136
157
  * login (the link flow only needs the installation row to exist, not its account label).
137
158
  */
138
- export async function fetchPatAccount(env) {
159
+ export async function fetchPatAccount(env, pat) {
139
160
  const fallback = { accountId: null, accountLogin: '', targetType: 'User' };
140
- const pat = env.GITHUB_PAT?.trim();
141
161
  if (!pat)
142
162
  return fallback;
143
163
  const apiBase = (env.GITHUB_API_BASE?.trim() || 'https://api.github.com').replace(/\/+$/, '');
@@ -190,13 +210,12 @@ export function classifyPatProbe(res) {
190
210
  : { ok: false, reason: 'underscoped', missing: [...missing] };
191
211
  }
192
212
  /**
193
- * Best-effort boot-time validation of a SET `GITHUB_PAT`: one `GET /user`. Returns the verdict, or
194
- * undefined when there is no PAT to probe or the probe couldn't complete (network error / timeout) —
213
+ * Best-effort boot-time validation of the deployment's GitHub PAT: one `GET /user`. Returns the
214
+ * verdict, or undefined when there is no PAT to probe or the probe couldn't complete (network error / timeout) —
195
215
  * a probe must NEVER block or crash boot, so an unreachable GitHub is treated as "unknown", not a
196
216
  * failure. `fetchImpl` + `timeoutMs` are injectable for tests.
197
217
  */
198
- export async function probeGitHubPat(env, opts = {}) {
199
- const pat = env.GITHUB_PAT?.trim();
218
+ export async function probeGitHubPat(env, pat, opts = {}) {
200
219
  if (!pat)
201
220
  return undefined;
202
221
  const apiBase = (env.GITHUB_API_BASE?.trim() || 'https://api.github.com').replace(/\/+$/, '');
@@ -220,17 +239,20 @@ export async function probeGitHubPat(env, opts = {}) {
220
239
  /**
221
240
  * The boot warning for a non-OK {@link probeGitHubPat} verdict (undefined when the PAT is fine).
222
241
  * Mirrors the MISSING-PAT boot warning: it names the exact problem and links the classic-token
223
- * creation URL with the local-mode scopes pre-selected, so the fix is one click + restart.
242
+ * creation URL with the local-mode scopes pre-selected, so the fix is one click. It names BOTH
243
+ * ways to apply the replacement, because the token it just rejected may have come from either:
244
+ * `.env` (which the sign-in screen will not override) or a previous browser install.
224
245
  */
225
246
  export function describePatProbeVerdict(verdict) {
226
247
  if (verdict.ok)
227
248
  return undefined;
228
249
  const tail = `agent steps that clone, push, open PRs, gate on CI or merge will fail. Create a token ` +
229
- `(scopes pre-selected) at ${githubPatCreationUrl()}, then set GITHUB_PAT and restart.`;
250
+ `(scopes pre-selected) at ${githubPatCreationUrl()}, then sign in with it on the sign-in ` +
251
+ `screen, or set GITHUB_PAT in your .env and restart.`;
230
252
  if (verdict.reason === 'underscoped') {
231
- return `local mode: GITHUB_PAT is missing required scope(s) ${verdict.missing.join(', ')} — ${tail}`;
253
+ return `local mode: the configured GitHub token is missing required scope(s) ${verdict.missing.join(', ')} — ${tail}`;
232
254
  }
233
- return `local mode: GITHUB_PAT was rejected by GitHub (${verdict.detail}) — ${tail}`;
255
+ return `local mode: the configured GitHub token was rejected by GitHub (${verdict.detail}) — ${tail}`;
234
256
  }
235
257
  /**
236
258
  * Fire the boot-time {@link probeGitHubPat} check WITHOUT blocking boot (app-startup initiative,
@@ -241,9 +263,9 @@ export function describePatProbeVerdict(verdict) {
241
263
  * swallows network errors and the resolution handler is defensively guarded). `fetchImpl` +
242
264
  * `timeoutMs` are injectable for tests.
243
265
  */
244
- export function warnOnGitHubPatProblemInBackground(env, log, opts = {}) {
266
+ export function warnOnGitHubPatProblemInBackground(env, pat, log, opts = {}) {
245
267
  void runBestEffort(log, 'github.patProbe', async () => {
246
- const verdict = await probeGitHubPat(env, opts);
268
+ const verdict = await probeGitHubPat(env, pat, opts);
247
269
  const warning = describePatProbeVerdict(verdict ?? { ok: true });
248
270
  if (warning)
249
271
  log.warn(warning);
@@ -263,48 +285,49 @@ export function gitlabPatCreationUrl() {
263
285
  return `https://gitlab.com/-/user_settings/personal_access_tokens?${params.toString()}`;
264
286
  }
265
287
  /**
266
- * Assemble the source-control PAT-login registry from env — the provider-agnostic seam the
267
- * `/auth/pat` endpoint resolves through. A provider is "configured" (sign-in available) when
268
- * its PAT is set in env; that env token is also the operational credential, so a provider
269
- * without one can't sign in (the SPA shows no button for it). The browser never sees a token
270
- * sign-in just selects a provider. Adding a third provider is one more entry here + its
271
- * resolver, with no change to the endpoint or the UI flow.
288
+ * Assemble the source-control PAT-login registry — the provider-agnostic seam the `/auth/pat`
289
+ * endpoint resolves through. A provider is "configured" (one-click sign-in available) when the
290
+ * deployment holds ITS token, read LIVE from `credential` so a token installed from the sign-in
291
+ * screen turns the button on for the next caller. The browser never sees a token — one-click
292
+ * sign-in just selects a provider. Adding a third provider is one more entry here + its resolver,
293
+ * with no change to the endpoint or the UI flow.
272
294
  */
273
- export function buildVcsIdentityRegistry(env) {
295
+ export function buildVcsIdentityRegistry(env, credential) {
274
296
  const githubApiBase = env.GITHUB_API_BASE?.trim() || 'https://api.github.com';
275
297
  const gitlabApiBase = env.GITLAB_API_BASE?.trim() || undefined;
276
- const registry = {
298
+ const tokenFor = (provider) => () => {
299
+ const current = credential();
300
+ return current?.provider === provider ? current.token : undefined;
301
+ };
302
+ return {
277
303
  github: {
278
304
  resolver: new GitHubIdentityResolver({ apiBase: githubApiBase }),
279
- configuredToken: env.GITHUB_PAT?.trim() || undefined,
305
+ configuredToken: tokenFor('github'),
280
306
  },
281
307
  gitlab: {
282
308
  resolver: new GitLabIdentityResolver({ apiBase: gitlabApiBase }),
283
- configuredToken: env.GITLAB_PAT?.trim() || undefined,
309
+ configuredToken: tokenFor('gitlab'),
284
310
  },
285
311
  };
286
- const configured = Object.keys(registry).filter((p) => registry[p]?.configuredToken);
287
- return { registry, configured };
288
312
  }
289
313
  /**
290
- * Build a {@link GitHubClient} that authenticates with the PAT, for the CI / merge /
291
- * mergeability gates AND the repo-link / board "add from repo" flows. Returns undefined
292
- * when no PAT is configured (the gates then pass through, like the Node default).
293
- * `repoEnumCache` is the `AppCaches.patInstallationRepos` handle backing the picker
294
- * typeahead (optional absent, the search enumerates live per request).
314
+ * Build a {@link GitHubClient} that authenticates with the deployment's GitHub PAT, for the CI /
315
+ * merge / mergeability gates AND the repo-link / board "add from repo" flows. Always returns a
316
+ * client: the token is read per call, so "no token yet" is a REFUSAL the client raises (naming
317
+ * how to fix it) rather than an absent client — which the layers above would otherwise read as
318
+ * "this deployment has no source control at all" and wire nothing, permanently.
319
+ * `repoEnumCache` is the `AppCaches.patInstallationRepos` handle backing the picker typeahead
320
+ * (optional — absent, the search enumerates live per request).
295
321
  */
296
- export function createLocalGitHubClient(env, repoEnumCache) {
297
- const pat = env.GITHUB_PAT?.trim();
298
- if (!pat)
299
- return undefined;
322
+ export function createLocalGitHubClient(env, resolveToken, repoEnumCache) {
300
323
  const apiBase = env.GITHUB_API_BASE?.trim() || 'https://api.github.com';
301
324
  return new PatGitHubClient({
302
- registry: new StaticTokenAppRegistry(pat),
325
+ registry: new LocalPatAppTokenSource(resolveToken),
303
326
  rateLimitRepository: new NoopRateLimitRepository(),
304
327
  idGenerator: localIdGenerator,
305
328
  clock: localClock,
306
329
  apiBase,
307
- }, pat, repoEnumCache);
330
+ }, resolveToken, repoEnumCache);
308
331
  }
309
332
  /**
310
333
  * Build a {@link GitHubClient} over a mothership-delegated {@link AppTokenSource}
@@ -330,59 +353,18 @@ export function createDelegatedGitHubClient(env, tokenSource) {
330
353
  * Build a {@link GitHubClient} for a GitLab-only local deployment, through the SAME
331
354
  * {@link buildGitLabEngineClient} the hosted facades use — a PAT-backed `VcsClient` adapted to the
332
355
  * legacy `GitHubClient` port the CI / merge / mergeability gates + repo-link flows still consume.
333
- * So a developer who set only `GITLAB_PAT` gets the same gating/merge/repo-read surface a
356
+ * So a developer whose credential is a GitLab one gets the same gating/merge/repo-read surface a
334
357
  * GitHub PAT gives — the engine talks to GitLab through the adapter without being migrated to
335
- * the neutral port. Returns undefined when no `GITLAB_PAT` is configured (the gates then pass
336
- * through). For a self-managed instance set `GITLAB_API_BASE` (e.g.
337
- * `https://gitlab.example.com/api/v4`).
358
+ * the neutral port. Like {@link createLocalGitHubClient} it is always built and reads its token
359
+ * per call, so an installed credential is live immediately. For a self-managed instance set
360
+ * `GITLAB_API_BASE` (e.g. `https://gitlab.example.com/api/v4`).
338
361
  *
339
362
  * It goes THROUGH the builder rather than assembling the client + adapter pair itself, which is
340
363
  * what it did until that drifted: the builder is documented as the single source of this wiring,
341
364
  * so anything it gained reached the two hosted facades and silently skipped local.
342
365
  */
343
- export function createLocalGitLabClient(env) {
344
- const pat = env.GITLAB_PAT?.trim();
345
- if (!pat)
346
- return undefined;
366
+ export function createLocalGitLabClient(env, resolveToken) {
347
367
  const apiBase = env.GITLAB_API_BASE?.trim() || GITLAB_PUBLIC_API_BASE;
348
- return buildGitLabEngineClient({ token: pat, apiBase, clock: localClock, logger });
349
- }
350
- /**
351
- * The host a GitLab local deployment clones/pushes against, derived from `GITLAB_API_BASE`'s
352
- * host (a self-managed instance) or the public `gitlab.com`. Single source of truth for BOTH
353
- * the clone URL the server builds (`resolveRepoOrigin`) and the harness host allow-list, so
354
- * they can never disagree. Returns undefined when no `GITLAB_PAT` is configured (GitHub mode).
355
- */
356
- export function gitlabVcsHost(env) {
357
- if (!env.GITLAB_PAT?.trim())
358
- return undefined;
359
- const apiBase = env.GITLAB_API_BASE?.trim();
360
- if (!apiBase)
361
- return 'gitlab.com';
362
- try {
363
- return new URL(apiBase).host;
364
- }
365
- catch {
366
- return 'gitlab.com';
367
- }
368
- }
369
- /**
370
- * The comma-separated host allow-list the harness container is given (`GITHUB_ALLOWED_HOSTS`).
371
- * The harness rejects any clone/push host not on this list (default github.com), so a GitLab
372
- * deployment must add its host or every clone is refused. Combines any operator-set
373
- * `GITHUB_ALLOWED_HOSTS` with the resolved GitLab host. Returns undefined when neither applies
374
- * (GitHub mode with no extra hosts ⇒ the harness keeps its github.com default).
375
- */
376
- export function harnessAllowedHosts(env) {
377
- const hosts = new Set();
378
- for (const h of (env.GITHUB_ALLOWED_HOSTS ?? '').split(',')) {
379
- const t = h.trim();
380
- if (t)
381
- hosts.add(t);
382
- }
383
- const gitlab = gitlabVcsHost(env);
384
- if (gitlab)
385
- hosts.add(gitlab);
386
- return hosts.size > 0 ? [...hosts].join(',') : undefined;
368
+ return buildGitLabEngineClient({ token: resolveToken, apiBase, clock: localClock, logger });
387
369
  }
388
370
  //# sourceMappingURL=github.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAaxC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAEL,iBAAiB,EACjB,sBAAsB,EACtB,MAAM,GACP,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,qBAAqB,CAAA;AAG5B,uFAAuF;AACvF,sFAAsF;AACtF,8EAA8E;AAC9E,mFAAmF;AACnF,EAAE;AACF,kFAAkF;AAClF,mFAAmF;AACnF,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