@myrialabs/clopen 0.4.38 → 0.4.39
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/backend/auth/permissions.ts +25 -0
- package/backend/chat/stream-manager.ts +1 -1
- package/backend/database/crypto/secret-columns.ts +5 -1
- package/backend/database/migrations/075_create_deploy_bindings.ts +54 -0
- package/backend/database/migrations/076_remove_memory_code_graph.ts +229 -0
- package/backend/database/migrations/077_create_integration_db_links.ts +150 -0
- package/backend/database/migrations/index.ts +21 -0
- package/backend/database/queries/db-client-connection-queries.ts +19 -0
- package/backend/database/queries/deploy-queries.ts +124 -0
- package/backend/database/queries/graph-queries.ts +291 -247
- package/backend/database/queries/index.ts +4 -0
- package/backend/database/queries/integration-db-link-queries.ts +168 -0
- package/backend/database/queries/integration-queries.ts +34 -6
- package/backend/db-client/integrations/index.ts +37 -0
- package/backend/db-client/integrations/links.ts +533 -0
- package/backend/db-client/integrations/projector.test.ts +280 -0
- package/backend/db-client/integrations/projector.ts +256 -0
- package/backend/db-client/integrations/supabase-service.ts +266 -0
- package/backend/db-client/providers/registry.ts +27 -0
- package/backend/db-client/providers/supabase/adapter.ts +500 -0
- package/backend/db-client/providers/supabase/api-types.ts +92 -0
- package/backend/db-client/providers/supabase/apply-migration.ts +104 -0
- package/backend/db-client/providers/supabase/client.ts +259 -0
- package/backend/db-client/providers/supabase/features.ts +502 -0
- package/backend/db-client/providers/supabase/local.test.ts +78 -0
- package/backend/db-client/providers/supabase/local.ts +137 -0
- package/backend/db-client/providers/types.ts +137 -0
- package/backend/deployments/bindings.test.ts +43 -0
- package/backend/deployments/bindings.ts +216 -0
- package/backend/deployments/index.ts +53 -0
- package/backend/deployments/log-streams.ts +214 -0
- package/backend/deployments/prompts.ts +70 -0
- package/backend/deployments/providers/vercel/adapter.ts +757 -0
- package/backend/deployments/providers/vercel/build-logs.test.ts +80 -0
- package/backend/deployments/providers/vercel/build-logs.ts +211 -0
- package/backend/deployments/providers/vercel/client.ts +203 -0
- package/backend/deployments/providers/vercel/list.test.ts +624 -0
- package/backend/deployments/providers/vercel/normalise.test.ts +115 -0
- package/backend/deployments/providers/vercel/normalise.ts +113 -0
- package/backend/deployments/providers/vercel/types.ts +104 -0
- package/backend/deployments/registry.ts +27 -0
- package/backend/deployments/service.ts +458 -0
- package/backend/deployments/types.ts +278 -0
- package/backend/index.ts +4 -0
- package/backend/integrations/projections/index.ts +0 -0
- package/backend/integrations/projections/mcp-projector.ts +7 -3
- package/backend/integrations/projections/types.ts +21 -9
- package/backend/integrations/registry/index.ts +5 -1
- package/backend/integrations/registry/providers/supabase.ts +61 -0
- package/backend/integrations/registry/providers/vercel.ts +46 -0
- package/backend/mcp/internal/servers/memory-graph/description.ts +3 -3
- package/backend/mcp/internal/servers/memory-graph/runner.ts +4 -9
- package/backend/mcp/internal/servers/memory-graph/schema.ts +0 -4
- package/backend/memory/README.md +57 -34
- package/backend/memory/compose.test.ts +3 -3
- package/backend/memory/compose.ts +6 -9
- package/backend/memory/config.ts +0 -5
- package/backend/memory/consolidate.ts +1 -2
- package/backend/memory/context.test.ts +8 -54
- package/backend/memory/context.ts +19 -25
- package/backend/memory/extract/episodic.ts +10 -12
- package/backend/memory/extract/index.ts +23 -52
- package/backend/memory/extract/scheduler.ts +3 -6
- package/backend/memory/index.ts +6 -5
- package/backend/memory/invalidate.ts +36 -48
- package/backend/memory/layout.ts +319 -130
- package/backend/memory/retention.ts +12 -42
- package/backend/memory/retrieval.eval.test.ts +2 -2
- package/backend/memory/retrieval.test.ts +228 -183
- package/backend/memory/retrieval.ts +22 -21
- package/backend/memory/revise.test.ts +62 -116
- package/backend/memory/revise.ts +0 -1
- package/backend/memory/view.ts +8 -5
- package/backend/snapshot/helpers.ts +35 -41
- package/backend/snapshot/snapshot-service.ts +90 -0
- package/backend/snapshot/turn-changes.test.ts +163 -0
- package/backend/snapshot/turn-changes.ts +131 -0
- package/backend/ws/db-client/accounts.ts +225 -0
- package/backend/ws/db-client/connections.ts +34 -3
- package/backend/ws/db-client/context.ts +37 -0
- package/backend/ws/db-client/index.ts +20 -1
- package/backend/ws/db-client/supabase.ts +188 -0
- package/backend/ws/deployments/actions.ts +360 -0
- package/backend/ws/deployments/context.ts +43 -0
- package/backend/ws/deployments/crud.ts +152 -0
- package/backend/ws/deployments/index.ts +15 -0
- package/backend/ws/deployments/schemas.ts +183 -0
- package/backend/ws/index.ts +6 -2
- package/backend/ws/memory/crud.ts +4 -16
- package/backend/ws/snapshot/changes.ts +279 -0
- package/backend/ws/snapshot/index.ts +4 -3
- package/dist/assets/{index-CyH7fSbR.js → index-BrF6nqld.js} +1 -1
- package/dist/assets/{index-DSHIANSy.js → index-C8Gi-b6U.js} +1 -1
- package/dist/assets/main-Bd3gb79F.css +1 -0
- package/dist/assets/main-Bo1hD7mt.js +1191 -0
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/shared/constants/tool-icons.ts +9 -0
- package/shared/types/db-client/connection.ts +6 -0
- package/shared/types/db-client/index.ts +2 -0
- package/shared/types/db-client/integrations.ts +174 -0
- package/shared/types/db-client/supabase.ts +131 -0
- package/shared/types/deployments.ts +382 -0
- package/shared/types/memory.ts +34 -51
- package/shared/types/ui/components.ts +1 -1
- package/shared/utils/diff-calculator.test.ts +89 -0
- package/shared/utils/diff-calculator.ts +30 -65
- package/shared/utils/logger.ts +1 -0
- package/backend/memory/extract/languages.ts +0 -176
- package/backend/memory/extract/structural.test.ts +0 -215
- package/backend/memory/extract/structural.ts +0 -364
- package/backend/ws/snapshot/content.ts +0 -85
- package/dist/assets/main-D2IOjftb.css +0 -1
- package/dist/assets/main-DM-tHKbW.js +0 -1152
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turning Vercel's vocabulary into the surface's.
|
|
3
|
+
*
|
|
4
|
+
* The two cases worth guarding are the ones where being wrong is silent rather
|
|
5
|
+
* than loud: a state that maps to the wrong category keeps the poller running
|
|
6
|
+
* forever (or stops it on a build that is still going), and `isCurrent` decides
|
|
7
|
+
* whether the panel tells someone a build is serving production traffic.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { describe, it, expect } from 'bun:test';
|
|
11
|
+
|
|
12
|
+
import { isLive, toDeployment, toEnvironment, toState } from './normalise';
|
|
13
|
+
import type { VercelDeployment } from './types';
|
|
14
|
+
|
|
15
|
+
describe('toState', () => {
|
|
16
|
+
it('maps the states that mean "not started yet" onto queued', () => {
|
|
17
|
+
expect(toState('QUEUED')).toBe('queued');
|
|
18
|
+
expect(toState('INITIALIZING')).toBe('queued');
|
|
19
|
+
// A build held by a blocking check has not started and still may.
|
|
20
|
+
expect(toState('BLOCKED')).toBe('queued');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('maps the terminal states', () => {
|
|
24
|
+
expect(toState('READY')).toBe('ready');
|
|
25
|
+
expect(toState('ERROR')).toBe('error');
|
|
26
|
+
expect(toState('CANCELED')).toBe('canceled');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('treats an unknown state as an error rather than as ready', () => {
|
|
30
|
+
// Guessing "ready" for something we do not recognise would show a green
|
|
31
|
+
// row for a build that may have failed. Guessing "error" is the safe way
|
|
32
|
+
// to be wrong, because it is visible.
|
|
33
|
+
expect(toState('SOMETHING_NEW')).toBe('error');
|
|
34
|
+
expect(toState(undefined)).toBe('error');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('keeps polling only for states the provider can still change', () => {
|
|
38
|
+
expect(isLive('queued')).toBe(true);
|
|
39
|
+
expect(isLive('building')).toBe(true);
|
|
40
|
+
expect(isLive('ready')).toBe(false);
|
|
41
|
+
expect(isLive('error')).toBe(false);
|
|
42
|
+
expect(isLive('canceled')).toBe(false);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe('toEnvironment', () => {
|
|
47
|
+
it('reads production from the target', () => {
|
|
48
|
+
expect(toEnvironment({ target: 'production' } as VercelDeployment)).toBe('production');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('treats a null target as preview, because there is no preview target', () => {
|
|
52
|
+
expect(toEnvironment({ target: null } as VercelDeployment)).toBe('preview');
|
|
53
|
+
expect(toEnvironment({} as VercelDeployment)).toBe('preview');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('keeps a custom environment out of preview', () => {
|
|
57
|
+
const raw = { target: null, customEnvironment: { id: 'env_1', slug: 'staging' } } as VercelDeployment;
|
|
58
|
+
expect(toEnvironment(raw)).toBe('custom');
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const base: VercelDeployment = {
|
|
63
|
+
uid: 'dpl_1',
|
|
64
|
+
name: 'web',
|
|
65
|
+
url: 'web-abc.vercel.app',
|
|
66
|
+
readyState: 'READY',
|
|
67
|
+
target: 'production',
|
|
68
|
+
createdAt: 1_700_000_000_000
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
describe('toDeployment', () => {
|
|
72
|
+
it('is only "current" when the project says this is what is live', () => {
|
|
73
|
+
expect(toDeployment(base, 'dpl_1').isCurrent).toBe(true);
|
|
74
|
+
// Ready, production, and superseded. Without the project's answer this
|
|
75
|
+
// row would claim to be serving traffic it lost.
|
|
76
|
+
expect(toDeployment(base, 'dpl_2').isCurrent).toBe(false);
|
|
77
|
+
expect(toDeployment(base, null).isCurrent).toBe(false);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('finds git metadata whatever provider prefixed it', () => {
|
|
81
|
+
const withGithub = toDeployment(
|
|
82
|
+
{ ...base, meta: { githubCommitRef: 'main', githubCommitSha: 'abc123', githubCommitMessage: 'fix: thing' } },
|
|
83
|
+
null
|
|
84
|
+
);
|
|
85
|
+
expect(withGithub.branch).toBe('main');
|
|
86
|
+
expect(withGithub.commitSha).toBe('abc123');
|
|
87
|
+
expect(withGithub.commitMessage).toBe('fix: thing');
|
|
88
|
+
|
|
89
|
+
// Same deployment from GitLab, same fields on the surface.
|
|
90
|
+
const withGitlab = toDeployment({ ...base, meta: { gitlabCommitRef: 'trunk' } }, null);
|
|
91
|
+
expect(withGitlab.branch).toBe('trunk');
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('keeps the provider word alongside the normalised state', () => {
|
|
95
|
+
const row = toDeployment({ ...base, readyState: 'BLOCKED' }, null);
|
|
96
|
+
expect(row.state).toBe('queued');
|
|
97
|
+
expect(row.stateDetail).toBe('BLOCKED');
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('reports a still-uploading deployment as having no URL', () => {
|
|
101
|
+
expect(toDeployment({ ...base, url: null }, null).url).toBeNull();
|
|
102
|
+
// An empty string is the same fact and must not become "https://".
|
|
103
|
+
expect(toDeployment({ ...base, url: '' }, null).url).toBeNull();
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('keeps "not a candidate" and "did not say" apart', () => {
|
|
107
|
+
// Three answers, not two. Collapsing the missing one into `false` hid the
|
|
108
|
+
// rollback action on every listing that omitted the field — the action
|
|
109
|
+
// existed and was simply unreachable.
|
|
110
|
+
expect(toDeployment(base, null).isRollbackCandidate).toBeNull();
|
|
111
|
+
expect(toDeployment({ ...base, isRollbackCandidate: null }, null).isRollbackCandidate).toBeNull();
|
|
112
|
+
expect(toDeployment({ ...base, isRollbackCandidate: false }, null).isRollbackCandidate).toBe(false);
|
|
113
|
+
expect(toDeployment({ ...base, isRollbackCandidate: true }, null).isRollbackCandidate).toBe(true);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turning Vercel's vocabulary into the surface's.
|
|
3
|
+
*
|
|
4
|
+
* Kept out of the adapter so it can be tested without a token, and so the one
|
|
5
|
+
* rule that matters is visible on its own: the panel must never see a Vercel
|
|
6
|
+
* word. `BLOCKED`, `readySubstate` and `target: null` are all facts about
|
|
7
|
+
* Vercel, and every one of them has to be spent here.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { Deployment, DeploymentEnvironment, DeploymentState } from '$shared/types/deployments';
|
|
11
|
+
import type { VercelDeployment } from './types';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Vercel's eight states onto the surface's five.
|
|
15
|
+
*
|
|
16
|
+
* `BLOCKED` is a build waiting on a blocking check, which from a reader's point
|
|
17
|
+
* of view is queued — it has not started and may still start. `DELETED` has no
|
|
18
|
+
* state of its own here because a deleted deployment is filtered out of the
|
|
19
|
+
* list entirely rather than rendered as a row nobody can act on.
|
|
20
|
+
*/
|
|
21
|
+
export function toState(raw: string | undefined): DeploymentState {
|
|
22
|
+
switch ((raw ?? '').toUpperCase()) {
|
|
23
|
+
case 'READY':
|
|
24
|
+
return 'ready';
|
|
25
|
+
case 'BUILDING':
|
|
26
|
+
return 'building';
|
|
27
|
+
case 'QUEUED':
|
|
28
|
+
case 'INITIALIZING':
|
|
29
|
+
case 'BLOCKED':
|
|
30
|
+
return 'queued';
|
|
31
|
+
case 'CANCELED':
|
|
32
|
+
return 'canceled';
|
|
33
|
+
case 'ERROR':
|
|
34
|
+
case 'DELETED':
|
|
35
|
+
default:
|
|
36
|
+
return 'error';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** True while the provider may still change this deployment's state on its own. */
|
|
41
|
+
export function isLive(state: DeploymentState): boolean {
|
|
42
|
+
return state === 'queued' || state === 'building';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Which environment a build belongs to.
|
|
47
|
+
*
|
|
48
|
+
* `target` is `production` for a production build and NULL for a preview one —
|
|
49
|
+
* there is no `target: 'preview'` to match on, which is why the list endpoint
|
|
50
|
+
* cannot filter previews server-side and this function has to decide.
|
|
51
|
+
*/
|
|
52
|
+
export function toEnvironment(deployment: VercelDeployment): DeploymentEnvironment {
|
|
53
|
+
if (deployment.customEnvironment) return 'custom';
|
|
54
|
+
return deployment.target === 'production' ? 'production' : 'preview';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Git metadata is keyed by provider, so the value is found by suffix. */
|
|
58
|
+
function gitMeta(meta: Record<string, string> | undefined, suffix: string): string | null {
|
|
59
|
+
if (!meta) return null;
|
|
60
|
+
const key = Object.keys(meta).find((name) => name.toLowerCase().endsWith(suffix.toLowerCase()));
|
|
61
|
+
return key ? meta[key] || null : null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function toIso(value: number | undefined | null): string | null {
|
|
65
|
+
return typeof value === 'number' && Number.isFinite(value) ? new Date(value).toISOString() : null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* One list row.
|
|
70
|
+
*
|
|
71
|
+
* `currentProductionId` comes from the project rather than the deployment,
|
|
72
|
+
* because "is this what is live" is not a property of a build: a production
|
|
73
|
+
* build that was superseded, or rolled back away from, is still `READY` and
|
|
74
|
+
* still `production` and yet serves nobody. `readySubstate: PROMOTED` says it
|
|
75
|
+
* saw traffic once, not that it has it now.
|
|
76
|
+
*/
|
|
77
|
+
export function toDeployment(raw: VercelDeployment, currentProductionId: string | null): Deployment {
|
|
78
|
+
const id = raw.uid ?? raw.id ?? '';
|
|
79
|
+
const nativeState = raw.readyState ?? raw.state;
|
|
80
|
+
const state = toState(nativeState);
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
id,
|
|
84
|
+
name: raw.name,
|
|
85
|
+
url: raw.url || null,
|
|
86
|
+
inspectorUrl: raw.inspectorUrl ?? null,
|
|
87
|
+
state,
|
|
88
|
+
stateDetail: nativeState ?? 'UNKNOWN',
|
|
89
|
+
environment: toEnvironment(raw),
|
|
90
|
+
isCurrent: currentProductionId !== null && id === currentProductionId,
|
|
91
|
+
// Three-way, not two. `undefined` means the listing did not say, and
|
|
92
|
+
// treating that as `false` hid the rollback action on every deployment
|
|
93
|
+
// whose response omitted the field.
|
|
94
|
+
isRollbackCandidate: raw.isRollbackCandidate ?? null,
|
|
95
|
+
branch: gitMeta(raw.meta, 'CommitRef'),
|
|
96
|
+
commitSha: gitMeta(raw.meta, 'CommitSha'),
|
|
97
|
+
commitMessage: gitMeta(raw.meta, 'CommitMessage'),
|
|
98
|
+
creator: raw.creator?.username ?? raw.creator?.githubLogin ?? raw.creator?.email ?? null,
|
|
99
|
+
createdAt: toIso(raw.createdAt ?? raw.created) ?? new Date(0).toISOString(),
|
|
100
|
+
buildingAt: toIso(raw.buildingAt),
|
|
101
|
+
readyAt: toIso(raw.ready),
|
|
102
|
+
errorCode: raw.errorCode ?? null,
|
|
103
|
+
errorMessage: raw.errorMessage ?? null,
|
|
104
|
+
source: raw.source ?? null
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Build duration, or null when the build never finished. */
|
|
109
|
+
export function durationOf(raw: VercelDeployment): number | null {
|
|
110
|
+
if (typeof raw.buildingAt !== 'number' || typeof raw.ready !== 'number') return null;
|
|
111
|
+
const elapsed = raw.ready - raw.buildingAt;
|
|
112
|
+
return elapsed >= 0 ? elapsed : null;
|
|
113
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The subset of Vercel's API shapes this adapter reads.
|
|
3
|
+
*
|
|
4
|
+
* Hand-written rather than generated: the published schema for one deployment
|
|
5
|
+
* carries roughly sixty fields, of which this surface uses twelve, and a
|
|
6
|
+
* generated type would make every one of the other forty-eight look like
|
|
7
|
+
* something a reader should account for.
|
|
8
|
+
*
|
|
9
|
+
* Everything optional is optional because Vercel genuinely omits it — `url` is
|
|
10
|
+
* null while a deployment uploads, `target` is null for a preview build, and
|
|
11
|
+
* `meta` is absent entirely for a CLI deployment with no git behind it.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export interface VercelDeployment {
|
|
15
|
+
uid?: string;
|
|
16
|
+
id?: string;
|
|
17
|
+
name: string;
|
|
18
|
+
url: string | null;
|
|
19
|
+
created?: number;
|
|
20
|
+
createdAt?: number;
|
|
21
|
+
buildingAt?: number;
|
|
22
|
+
ready?: number;
|
|
23
|
+
state?: string;
|
|
24
|
+
readyState?: string;
|
|
25
|
+
readySubstate?: string;
|
|
26
|
+
/** `production` for a production build; null for a preview one. */
|
|
27
|
+
target?: string | null;
|
|
28
|
+
source?: string;
|
|
29
|
+
inspectorUrl?: string | null;
|
|
30
|
+
errorCode?: string;
|
|
31
|
+
errorMessage?: string | null;
|
|
32
|
+
isRollbackCandidate?: boolean | null;
|
|
33
|
+
customEnvironment?: { id: string; slug?: string } | null;
|
|
34
|
+
creator?: { uid: string; username?: string; email?: string; githubLogin?: string };
|
|
35
|
+
/** Git metadata, keyed by provider — `githubCommitSha`, `gitlabCommitSha`, … */
|
|
36
|
+
meta?: Record<string, string>;
|
|
37
|
+
alias?: string[];
|
|
38
|
+
aliasAssigned?: number | boolean | null;
|
|
39
|
+
projectSettings?: { framework?: string | null };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface VercelDeploymentList {
|
|
43
|
+
deployments: VercelDeployment[];
|
|
44
|
+
pagination: { count: number; next: number | null; prev: number | null };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface VercelProject {
|
|
48
|
+
id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
/** True when the project ignores pushes entirely. */
|
|
51
|
+
paused?: boolean;
|
|
52
|
+
framework?: string | null;
|
|
53
|
+
link?: { type?: string; org?: string; repo?: string; repoId?: number | string; productionBranch?: string | null } | null;
|
|
54
|
+
/** Current deployment per target. `targets.production.id` is what is live. */
|
|
55
|
+
targets?: Record<string, { id?: string } | null> | null;
|
|
56
|
+
lastAliasRequest?: {
|
|
57
|
+
toDeploymentId?: string;
|
|
58
|
+
jobStatus?: 'failed' | 'in-progress' | 'pending' | 'skipped' | 'succeeded';
|
|
59
|
+
type?: 'promote' | 'rollback';
|
|
60
|
+
} | null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface VercelProjectList {
|
|
64
|
+
projects: VercelProject[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface VercelTeam {
|
|
68
|
+
id: string;
|
|
69
|
+
slug?: string;
|
|
70
|
+
name?: string | null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface VercelTeamList {
|
|
74
|
+
teams: VercelTeam[];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface VercelUser {
|
|
78
|
+
user: { id: string; username?: string; email?: string; name?: string | null };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** One line of the build-log stream. */
|
|
82
|
+
export interface VercelEvent {
|
|
83
|
+
type?: string;
|
|
84
|
+
created?: number;
|
|
85
|
+
text?: string;
|
|
86
|
+
level?: string;
|
|
87
|
+
payload?: { text?: string; date?: number; id?: string };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* A git account or organisation the Vercel account can reach.
|
|
92
|
+
*
|
|
93
|
+
* An empty list means the Vercel ACCOUNT has no git login connection at all,
|
|
94
|
+
* which is the prerequisite behind "You need to add a Login Connection to your
|
|
95
|
+
* GitHub account first".
|
|
96
|
+
*/
|
|
97
|
+
export interface VercelGitNamespace {
|
|
98
|
+
id: string | number;
|
|
99
|
+
slug: string;
|
|
100
|
+
name?: string;
|
|
101
|
+
provider: string;
|
|
102
|
+
ownerType: string;
|
|
103
|
+
isAccessRestricted?: boolean;
|
|
104
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter registry for the Deployments surface.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately dumb: a map from provider id to adapter, filled at module load.
|
|
5
|
+
* Adding Netlify is one directory in `providers/` plus one line in `index.ts` —
|
|
6
|
+
* the same shape as the Issues registry and the internal-MCP `defineServer()`
|
|
7
|
+
* pattern, so there is one thing to learn rather than three.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { DeployProviderAdapter } from './types';
|
|
11
|
+
|
|
12
|
+
const adapters = new Map<string, DeployProviderAdapter>();
|
|
13
|
+
|
|
14
|
+
export function registerDeployProvider(adapter: DeployProviderAdapter): void {
|
|
15
|
+
if (adapters.has(adapter.provider)) {
|
|
16
|
+
throw new Error(`A deploy adapter for "${adapter.provider}" is already registered`);
|
|
17
|
+
}
|
|
18
|
+
adapters.set(adapter.provider, adapter);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function getDeployAdapter(provider: string): DeployProviderAdapter | null {
|
|
22
|
+
return adapters.get(provider) ?? null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function listDeployAdapters(): DeployProviderAdapter[] {
|
|
26
|
+
return [...adapters.values()];
|
|
27
|
+
}
|