@keystrokehq/hosting 0.1.16 → 0.1.18
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/docker.cjs +24 -1
- package/dist/docker.cjs.map +1 -1
- package/dist/docker.d.cts +1 -1
- package/dist/docker.d.mts +1 -1
- package/dist/docker.mjs +24 -1
- package/dist/docker.mjs.map +1 -1
- package/dist/index.cjs +117 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +76 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +76 -6
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +111 -4
- package/dist/index.mjs.map +1 -1
- package/dist/org-artifacts.d.cts +1 -1
- package/dist/org-artifacts.d.mts +1 -1
- package/dist/{plugin-is5oPt6x.d.cts → plugin-4cuXkf42.d.cts} +2 -2
- package/dist/{plugin-is5oPt6x.d.cts.map → plugin-4cuXkf42.d.cts.map} +1 -1
- package/dist/{plugin-qEl5Sx4m.d.mts → plugin-eiAXqE7P.d.mts} +2 -2
- package/dist/{plugin-qEl5Sx4m.d.mts.map → plugin-eiAXqE7P.d.mts.map} +1 -1
- package/dist/runtime-BmfsHLrk.mjs.map +1 -1
- package/dist/runtime-CV7pSfMl.cjs.map +1 -1
- package/dist/{runtime-B0jF0oMv.d.cts → runtime-Cp906goK.d.cts} +22 -3
- package/dist/runtime-Cp906goK.d.cts.map +1 -0
- package/dist/{runtime-B0jF0oMv.d.mts → runtime-Cp906goK.d.mts} +22 -3
- package/dist/runtime-Cp906goK.d.mts.map +1 -0
- package/dist/{wait-for-health-XEzPPQIO.mjs → wait-for-health-B4-AM1NR.mjs} +3 -2
- package/dist/wait-for-health-B4-AM1NR.mjs.map +1 -0
- package/dist/{wait-for-health-DM55_NQh.cjs → wait-for-health-CObmNF8o.cjs} +3 -2
- package/dist/wait-for-health-CObmNF8o.cjs.map +1 -0
- package/package.json +2 -2
- package/dist/runtime-B0jF0oMv.d.cts.map +0 -1
- package/dist/runtime-B0jF0oMv.d.mts.map +0 -1
- package/dist/wait-for-health-DM55_NQh.cjs.map +0 -1
- package/dist/wait-for-health-XEzPPQIO.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as ProjectRuntimeDatabase, c as ProjectRuntimeInput, d as
|
|
2
|
-
import { a as WorkerRuntimeConfig, i as OrganizationHostingResult, n as HostingPlugin, o as WorkerRuntimeConfigError, r as OrganizationHostingInput, s as resolveWorkerRuntimeConfig, t as HostingOptions } from "./plugin-
|
|
1
|
+
import { a as ProjectRuntimeDatabase, c as ProjectRuntimeInput, d as ProjectRuntimeSleepInput, f as ProjectRuntimeWakeInput, i as ProjectRuntime, l as ProjectRuntimeReconcileInput, m as parseOrgArtifactsFromEnv, n as OrgProjectDeploy, o as ProjectRuntimeDestroyInput, p as encodeOrgArtifacts, r as ProjectPingTarget, s as ProjectRuntimeHosting, t as OrgArtifactSpec, u as ProjectRuntimeResult } from "./runtime-Cp906goK.mjs";
|
|
2
|
+
import { a as WorkerRuntimeConfig, i as OrganizationHostingResult, n as HostingPlugin, o as WorkerRuntimeConfigError, r as OrganizationHostingInput, s as resolveWorkerRuntimeConfig, t as HostingOptions } from "./plugin-eiAXqE7P.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/constants.d.ts
|
|
5
5
|
declare const PROJECT_SERVER_IMAGE = "keystroke/project-server:local";
|
|
@@ -16,9 +16,41 @@ declare const PROJECT_SERVER_DEPLOY_STATUS: {
|
|
|
16
16
|
readonly port: 3000;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
19
|
+
//#region src/runtime-control.d.ts
|
|
20
|
+
declare const PROJECT_SERVER_CONTROL: {
|
|
21
|
+
readonly load: "/control/projects/load";
|
|
22
|
+
readonly promote: "/control/projects/promote";
|
|
23
|
+
readonly unload: "/control/projects/unload";
|
|
24
|
+
readonly port: 3000;
|
|
25
|
+
};
|
|
26
|
+
type LoadProjectOnRuntimeInput = {
|
|
27
|
+
projectId: string;
|
|
28
|
+
artifactId: string;
|
|
29
|
+
artifactVersion: number;
|
|
30
|
+
storageKey: string;
|
|
31
|
+
activate?: boolean;
|
|
32
|
+
};
|
|
33
|
+
type RuntimeControlOptions = {
|
|
34
|
+
fetchImpl?: typeof fetch;
|
|
35
|
+
timeoutMs?: number; /** Bearer token — typically the org's WORKER_INTERNAL_TOKEN. */
|
|
36
|
+
workerToken?: string;
|
|
37
|
+
};
|
|
38
|
+
declare function loadProjectOnRuntime(baseUrl: string, input: LoadProjectOnRuntimeInput, options?: RuntimeControlOptions): Promise<void>;
|
|
39
|
+
declare function promoteProjectOnRuntime(baseUrl: string, input: {
|
|
40
|
+
projectId: string;
|
|
41
|
+
artifactId: string;
|
|
42
|
+
}, options?: RuntimeControlOptions): Promise<void>;
|
|
43
|
+
declare function unloadProjectOnRuntime(baseUrl: string, input: {
|
|
44
|
+
projectId: string;
|
|
45
|
+
artifactId: string;
|
|
46
|
+
force?: boolean;
|
|
47
|
+
}, options?: RuntimeControlOptions): Promise<void>;
|
|
48
|
+
/** True when the org runtime answers /health. */
|
|
49
|
+
declare function pingRuntimeHealth(baseUrl: string, options?: RuntimeControlOptions): Promise<boolean>;
|
|
50
|
+
//#endregion
|
|
19
51
|
//#region src/runtime-env.d.ts
|
|
20
52
|
/** Env keys that must never be forwarded into untrusted org workers. */
|
|
21
|
-
declare const FORBIDDEN_WORKER_ENV_KEYS: readonly ["BETTER_AUTH_SECRET", "DATABASE_URL", "POSTHOG_API_KEY", "POSTGRES_PASSWORD", "PLATFORM_WORKER_TOKEN", "STRIPE_SECRET_KEY", "CREDENTIAL_ENCRYPTION_KEY"];
|
|
53
|
+
declare const FORBIDDEN_WORKER_ENV_KEYS: readonly ["BETTER_AUTH_SECRET", "DATABASE_URL", "POSTHOG_API_KEY", "POSTGRES_PASSWORD", "PLATFORM_WORKER_TOKEN", "STRIPE_SECRET_KEY", "CREDENTIAL_ENCRYPTION_KEY", "TURNSTILE_SECRET"];
|
|
22
54
|
/** Shared dev token when `PLATFORM_WORKER_TOKEN` is unset (non-production only). */
|
|
23
55
|
declare const DEV_PLATFORM_WORKER_TOKEN = "dev-platform-worker-token";
|
|
24
56
|
type RuntimeLaunchSpec = {
|
|
@@ -93,19 +125,57 @@ type ProjectDeployStatus = {
|
|
|
93
125
|
ok: boolean;
|
|
94
126
|
error?: string;
|
|
95
127
|
};
|
|
128
|
+
type VersionDeployStatus = {
|
|
129
|
+
projectId: string;
|
|
130
|
+
artifactId: string;
|
|
131
|
+
state: "active" | "resident" | "indexed";
|
|
132
|
+
ok: boolean;
|
|
133
|
+
activeJobCount?: number;
|
|
134
|
+
error?: string;
|
|
135
|
+
};
|
|
96
136
|
type DeployStatusResponse = {
|
|
97
137
|
projects: ProjectDeployStatus[];
|
|
138
|
+
versions?: VersionDeployStatus[];
|
|
98
139
|
};
|
|
99
140
|
type FetchDeployStatusOptions = {
|
|
100
141
|
fetchImpl?: typeof fetch;
|
|
101
142
|
timeoutMs?: number;
|
|
102
143
|
};
|
|
144
|
+
type WaitForDeployStatusOptions = {
|
|
145
|
+
fetchImpl?: typeof fetch;
|
|
146
|
+
timeoutMs?: number;
|
|
147
|
+
intervalMs?: number;
|
|
148
|
+
};
|
|
103
149
|
/**
|
|
104
150
|
* Ask a running org machine which projects bootstrapped and which failed.
|
|
105
|
-
*
|
|
106
|
-
*
|
|
151
|
+
* Returns undefined when the endpoint is unreachable, non-OK, times out, or
|
|
152
|
+
* returns an unusable payload — callers must treat that as non-affirmative
|
|
153
|
+
* health for every pending project (never promote on silence).
|
|
107
154
|
*/
|
|
108
155
|
declare function fetchDeployStatus(baseUrl: string, options?: FetchDeployStatusOptions): Promise<DeployStatusResponse | undefined>;
|
|
156
|
+
/**
|
|
157
|
+
* Poll `/deploy-status` until the real worker returns a usable payload or the
|
|
158
|
+
* deadline expires. Retries only transient unavailability (network errors,
|
|
159
|
+
* non-2xx including early-health 404, timeouts, malformed bodies). Any valid
|
|
160
|
+
* `{ projects: [...] }` response — including empty or explicit failures — is
|
|
161
|
+
* terminal so genuine bootstrap errors surface immediately.
|
|
162
|
+
*/
|
|
163
|
+
declare function waitForDeployStatus(baseUrl: string, options?: WaitForDeployStatusOptions): Promise<DeployStatusResponse | undefined>;
|
|
164
|
+
type DeployHealthVerdict = {
|
|
165
|
+
ok: true;
|
|
166
|
+
} | {
|
|
167
|
+
ok: false;
|
|
168
|
+
error: string;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Require an explicit `{ projectId, ok: true }` entry for each candidate.
|
|
172
|
+
* Missing entries, `ok: false`, empty `projects`, or an unavailable status
|
|
173
|
+
* response all fail closed for that project.
|
|
174
|
+
*/
|
|
175
|
+
declare function classifyDeployHealth(input: {
|
|
176
|
+
projectIds: string[];
|
|
177
|
+
deployStatus: DeployStatusResponse | undefined;
|
|
178
|
+
}): Map<string, DeployHealthVerdict>;
|
|
109
179
|
//#endregion
|
|
110
|
-
export { DEV_PLATFORM_WORKER_TOKEN, type DeployStatusResponse, FORBIDDEN_WORKER_ENV_KEYS, type FetchDeployStatusOptions, type HostingOptions, type HostingPlugin, type OrgArtifactSpec, type OrgProjectDeploy, type OrganizationHostingInput, type OrganizationHostingResult, PROJECT_SERVER_DEPLOY_STATUS, PROJECT_SERVER_FRAMEWORK_NODE_MODULES, PROJECT_SERVER_FRAMEWORK_ROOT, PROJECT_SERVER_HEALTH, PROJECT_SERVER_IMAGE, PROJECT_SERVER_PORT, PROJECT_SERVER_ROOT, type PingProjectOptions, type ProjectDeployStatus, type ProjectPingTarget, type ProjectRuntime, type ProjectRuntimeDatabase, type ProjectRuntimeDestroyInput, type ProjectRuntimeHosting, type ProjectRuntimeInput, type ProjectRuntimeReconcileInput, type ProjectRuntimeResult, RUNTIME_PING_TIMEOUT_MS, type RuntimeLaunchSpec, type VerifiedOrgWorkerToken, type WaitForHealthOptions, type WorkerRuntimeConfig, WorkerRuntimeConfigError, buildRuntimeEnv, canPingProjectTarget, encodeOrgArtifacts, fetchDeployStatus, formatDockerEnv, mintOrgWorkerToken, parseOrgArtifactsFromEnv, pingProject, pingProjectTarget, resolvePlatformWorkerToken, resolveProjectServerImage, resolveRuntimeLaunch, resolveWorkerPlatformUrl, resolveWorkerRuntimeConfig, rewriteLoopbackHost, rewriteLoopbackUrl, verifyOrgWorkerToken, waitForHealth };
|
|
180
|
+
export { DEV_PLATFORM_WORKER_TOKEN, type DeployHealthVerdict, type DeployStatusResponse, FORBIDDEN_WORKER_ENV_KEYS, type FetchDeployStatusOptions, type HostingOptions, type HostingPlugin, type LoadProjectOnRuntimeInput, type OrgArtifactSpec, type OrgProjectDeploy, type OrganizationHostingInput, type OrganizationHostingResult, PROJECT_SERVER_CONTROL, PROJECT_SERVER_DEPLOY_STATUS, PROJECT_SERVER_FRAMEWORK_NODE_MODULES, PROJECT_SERVER_FRAMEWORK_ROOT, PROJECT_SERVER_HEALTH, PROJECT_SERVER_IMAGE, PROJECT_SERVER_PORT, PROJECT_SERVER_ROOT, type PingProjectOptions, type ProjectDeployStatus, type ProjectPingTarget, type ProjectRuntime, type ProjectRuntimeDatabase, type ProjectRuntimeDestroyInput, type ProjectRuntimeHosting, type ProjectRuntimeInput, type ProjectRuntimeReconcileInput, type ProjectRuntimeResult, type ProjectRuntimeSleepInput, type ProjectRuntimeWakeInput, RUNTIME_PING_TIMEOUT_MS, type RuntimeControlOptions, type RuntimeLaunchSpec, type VerifiedOrgWorkerToken, type VersionDeployStatus, type WaitForDeployStatusOptions, type WaitForHealthOptions, type WorkerRuntimeConfig, WorkerRuntimeConfigError, buildRuntimeEnv, canPingProjectTarget, classifyDeployHealth, encodeOrgArtifacts, fetchDeployStatus, formatDockerEnv, loadProjectOnRuntime, mintOrgWorkerToken, parseOrgArtifactsFromEnv, pingProject, pingProjectTarget, pingRuntimeHealth, promoteProjectOnRuntime, resolvePlatformWorkerToken, resolveProjectServerImage, resolveRuntimeLaunch, resolveWorkerPlatformUrl, resolveWorkerRuntimeConfig, rewriteLoopbackHost, rewriteLoopbackUrl, unloadProjectOnRuntime, verifyOrgWorkerToken, waitForDeployStatus, waitForHealth };
|
|
111
181
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/constants.ts","../src/runtime-env.ts","../src/org-worker-token.ts","../src/wait-for-health.ts","../src/runtime-constants.ts","../src/ping-project.ts","../src/ping-project-target.ts","../src/deploy-status.ts"],"mappings":";;;;cAAa,oBAAA;AAAA,cAEA,mBAAA;AAAA,cAEA,mBAAA;AAAA,cAEA,6BAAA;AAAA,cAEA,qCAAA;AAAA,cAEA,qBAAA;EAAA,SAGH,IAAA;EAAA,SAAA,IAAA;AAAA;AAAA,cAEG,4BAAA;EAAA,SAGH,IAAA;EAAA,SAAA,IAAA;AAAA;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/constants.ts","../src/runtime-control.ts","../src/runtime-env.ts","../src/org-worker-token.ts","../src/wait-for-health.ts","../src/runtime-constants.ts","../src/ping-project.ts","../src/ping-project-target.ts","../src/deploy-status.ts"],"mappings":";;;;cAAa,oBAAA;AAAA,cAEA,mBAAA;AAAA,cAEA,mBAAA;AAAA,cAEA,6BAAA;AAAA,cAEA,qCAAA;AAAA,cAEA,qBAAA;EAAA,SAGH,IAAA;EAAA,SAAA,IAAA;AAAA;AAAA,cAEG,4BAAA;EAAA,SAGH,IAAA;EAAA,SAAA,IAAA;AAAA;;;cCfG,sBAAA;EAAA;;;;;KAOD,yBAAA;EACV,SAAA;EACA,UAAA;EACA,eAAA;EACA,UAAA;EACA,QAAA;AAAA;AAAA,KAGU,qBAAA;EACV,SAAA,UAAmB,KAAK;EACxB,SAAA;EAEA,WAAA;AAAA;AAAA,iBAoCoB,oBAAA,CACpB,OAAA,UACA,KAAA,EAAO,yBAAA,EACP,OAAA,GAAS,qBAAA,GACR,OAAA;AAAA,iB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dist/index.mjs
CHANGED
|
@@ -1,9 +1,49 @@
|
|
|
1
|
-
import { S as PROJECT_SERVER_ROOT, _ as PROJECT_SERVER_FRAMEWORK_NODE_MODULES, a as formatDockerEnv, b as PROJECT_SERVER_IMAGE, c as resolveRuntimeLaunch, d as rewriteLoopbackUrl, f as mintOrgWorkerToken, g as PROJECT_SERVER_DEPLOY_STATUS, h as resolveWorkerRuntimeConfig, i as buildRuntimeEnv, l as resolveWorkerPlatformUrl, m as WorkerRuntimeConfigError, n as DEV_PLATFORM_WORKER_TOKEN, o as resolvePlatformWorkerToken, p as verifyOrgWorkerToken, r as FORBIDDEN_WORKER_ENV_KEYS, s as resolveProjectServerImage, t as waitForHealth, u as rewriteLoopbackHost, v as PROJECT_SERVER_FRAMEWORK_ROOT, x as PROJECT_SERVER_PORT, y as PROJECT_SERVER_HEALTH } from "./wait-for-health-
|
|
1
|
+
import { S as PROJECT_SERVER_ROOT, _ as PROJECT_SERVER_FRAMEWORK_NODE_MODULES, a as formatDockerEnv, b as PROJECT_SERVER_IMAGE, c as resolveRuntimeLaunch, d as rewriteLoopbackUrl, f as mintOrgWorkerToken, g as PROJECT_SERVER_DEPLOY_STATUS, h as resolveWorkerRuntimeConfig, i as buildRuntimeEnv, l as resolveWorkerPlatformUrl, m as WorkerRuntimeConfigError, n as DEV_PLATFORM_WORKER_TOKEN, o as resolvePlatformWorkerToken, p as verifyOrgWorkerToken, r as FORBIDDEN_WORKER_ENV_KEYS, s as resolveProjectServerImage, t as waitForHealth, u as rewriteLoopbackHost, v as PROJECT_SERVER_FRAMEWORK_ROOT, x as PROJECT_SERVER_PORT, y as PROJECT_SERVER_HEALTH } from "./wait-for-health-B4-AM1NR.mjs";
|
|
2
2
|
import { n as parseOrgArtifactsFromEnv, t as encodeOrgArtifacts } from "./runtime-BmfsHLrk.mjs";
|
|
3
3
|
//#region src/runtime-constants.ts
|
|
4
4
|
/** Timeout for a single project runtime `/health` probe. */
|
|
5
5
|
const RUNTIME_PING_TIMEOUT_MS = 15e3;
|
|
6
6
|
//#endregion
|
|
7
|
+
//#region src/runtime-control.ts
|
|
8
|
+
const PROJECT_SERVER_CONTROL = {
|
|
9
|
+
load: "/control/projects/load",
|
|
10
|
+
promote: "/control/projects/promote",
|
|
11
|
+
unload: "/control/projects/unload",
|
|
12
|
+
port: PROJECT_SERVER_PORT
|
|
13
|
+
};
|
|
14
|
+
async function postControl(baseUrl, path, body, options = {}) {
|
|
15
|
+
const timeoutMs = options.timeoutMs ?? 15e3;
|
|
16
|
+
const headers = { "content-type": "application/json" };
|
|
17
|
+
if (options.workerToken) headers.authorization = `Bearer ${options.workerToken}`;
|
|
18
|
+
const response = await (options.fetchImpl ?? fetch)(new URL(path, baseUrl), {
|
|
19
|
+
method: "POST",
|
|
20
|
+
headers,
|
|
21
|
+
body: JSON.stringify(body),
|
|
22
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
23
|
+
});
|
|
24
|
+
const data = await response.json().catch(() => ({}));
|
|
25
|
+
if (!response.ok || data.ok === false) throw new Error(typeof data.error === "string" ? data.error : `Runtime control ${path} failed (${response.status})`);
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
async function loadProjectOnRuntime(baseUrl, input, options = {}) {
|
|
29
|
+
await postControl(baseUrl, PROJECT_SERVER_CONTROL.load, input, options);
|
|
30
|
+
}
|
|
31
|
+
async function promoteProjectOnRuntime(baseUrl, input, options = {}) {
|
|
32
|
+
await postControl(baseUrl, PROJECT_SERVER_CONTROL.promote, input, options);
|
|
33
|
+
}
|
|
34
|
+
async function unloadProjectOnRuntime(baseUrl, input, options = {}) {
|
|
35
|
+
await postControl(baseUrl, PROJECT_SERVER_CONTROL.unload, input, options);
|
|
36
|
+
}
|
|
37
|
+
/** True when the org runtime answers /health. */
|
|
38
|
+
async function pingRuntimeHealth(baseUrl, options = {}) {
|
|
39
|
+
const timeoutMs = options.timeoutMs ?? 15e3;
|
|
40
|
+
try {
|
|
41
|
+
return (await (options.fetchImpl ?? fetch)(new URL("/health", baseUrl), { signal: AbortSignal.timeout(timeoutMs) })).ok;
|
|
42
|
+
} catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
7
47
|
//#region src/ping-project.ts
|
|
8
48
|
async function pingProject(baseUrl, options = {}) {
|
|
9
49
|
const timeoutMs = options.timeoutMs ?? 15e3;
|
|
@@ -32,10 +72,14 @@ async function pingProjectTarget(target, options = {}) {
|
|
|
32
72
|
}
|
|
33
73
|
//#endregion
|
|
34
74
|
//#region src/deploy-status.ts
|
|
75
|
+
const DEFAULT_WAIT_TIMEOUT_MS = 12e4;
|
|
76
|
+
const DEFAULT_WAIT_INTERVAL_MS = 500;
|
|
77
|
+
const REQUEST_TIMEOUT_MS = 2e3;
|
|
35
78
|
/**
|
|
36
79
|
* Ask a running org machine which projects bootstrapped and which failed.
|
|
37
|
-
*
|
|
38
|
-
*
|
|
80
|
+
* Returns undefined when the endpoint is unreachable, non-OK, times out, or
|
|
81
|
+
* returns an unusable payload — callers must treat that as non-affirmative
|
|
82
|
+
* health for every pending project (never promote on silence).
|
|
39
83
|
*/
|
|
40
84
|
async function fetchDeployStatus(baseUrl, options = {}) {
|
|
41
85
|
const timeoutMs = options.timeoutMs ?? 15e3;
|
|
@@ -50,7 +94,70 @@ async function fetchDeployStatus(baseUrl, options = {}) {
|
|
|
50
94
|
return;
|
|
51
95
|
}
|
|
52
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Poll `/deploy-status` until the real worker returns a usable payload or the
|
|
99
|
+
* deadline expires. Retries only transient unavailability (network errors,
|
|
100
|
+
* non-2xx including early-health 404, timeouts, malformed bodies). Any valid
|
|
101
|
+
* `{ projects: [...] }` response — including empty or explicit failures — is
|
|
102
|
+
* terminal so genuine bootstrap errors surface immediately.
|
|
103
|
+
*/
|
|
104
|
+
async function waitForDeployStatus(baseUrl, options = {}) {
|
|
105
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS;
|
|
106
|
+
const intervalMs = options.intervalMs ?? DEFAULT_WAIT_INTERVAL_MS;
|
|
107
|
+
const deadline = Date.now() + timeoutMs;
|
|
108
|
+
while (Date.now() < deadline) {
|
|
109
|
+
const remainingMs = deadline - Date.now();
|
|
110
|
+
const requestTimeoutMs = Math.min(REQUEST_TIMEOUT_MS, Math.max(1, remainingMs));
|
|
111
|
+
const status = await fetchDeployStatus(baseUrl, {
|
|
112
|
+
fetchImpl: options.fetchImpl,
|
|
113
|
+
timeoutMs: requestTimeoutMs
|
|
114
|
+
});
|
|
115
|
+
if (status) return status;
|
|
116
|
+
if (Date.now() + intervalMs >= deadline) break;
|
|
117
|
+
await sleep(intervalMs);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function sleep(ms) {
|
|
121
|
+
return new Promise((resolve) => {
|
|
122
|
+
setTimeout(resolve, ms);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Require an explicit `{ projectId, ok: true }` entry for each candidate.
|
|
127
|
+
* Missing entries, `ok: false`, empty `projects`, or an unavailable status
|
|
128
|
+
* response all fail closed for that project.
|
|
129
|
+
*/
|
|
130
|
+
function classifyDeployHealth(input) {
|
|
131
|
+
const verdicts = /* @__PURE__ */ new Map();
|
|
132
|
+
if (!input.deployStatus) {
|
|
133
|
+
for (const projectId of input.projectIds) verdicts.set(projectId, {
|
|
134
|
+
ok: false,
|
|
135
|
+
error: "Deploy health status unavailable"
|
|
136
|
+
});
|
|
137
|
+
return verdicts;
|
|
138
|
+
}
|
|
139
|
+
const byId = new Map(input.deployStatus.projects.filter((entry) => typeof entry?.projectId === "string" && entry.projectId.length > 0).map((entry) => [entry.projectId, entry]));
|
|
140
|
+
for (const projectId of input.projectIds) {
|
|
141
|
+
const entry = byId.get(projectId);
|
|
142
|
+
if (!entry) {
|
|
143
|
+
verdicts.set(projectId, {
|
|
144
|
+
ok: false,
|
|
145
|
+
error: "Deploy health status omitted project"
|
|
146
|
+
});
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
if (entry.ok !== true) {
|
|
150
|
+
verdicts.set(projectId, {
|
|
151
|
+
ok: false,
|
|
152
|
+
error: entry.error?.trim() || "Project failed to start"
|
|
153
|
+
});
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
verdicts.set(projectId, { ok: true });
|
|
157
|
+
}
|
|
158
|
+
return verdicts;
|
|
159
|
+
}
|
|
53
160
|
//#endregion
|
|
54
|
-
export { DEV_PLATFORM_WORKER_TOKEN, FORBIDDEN_WORKER_ENV_KEYS, PROJECT_SERVER_DEPLOY_STATUS, PROJECT_SERVER_FRAMEWORK_NODE_MODULES, PROJECT_SERVER_FRAMEWORK_ROOT, PROJECT_SERVER_HEALTH, PROJECT_SERVER_IMAGE, PROJECT_SERVER_PORT, PROJECT_SERVER_ROOT, RUNTIME_PING_TIMEOUT_MS, WorkerRuntimeConfigError, buildRuntimeEnv, canPingProjectTarget, encodeOrgArtifacts, fetchDeployStatus, formatDockerEnv, mintOrgWorkerToken, parseOrgArtifactsFromEnv, pingProject, pingProjectTarget, resolvePlatformWorkerToken, resolveProjectServerImage, resolveRuntimeLaunch, resolveWorkerPlatformUrl, resolveWorkerRuntimeConfig, rewriteLoopbackHost, rewriteLoopbackUrl, verifyOrgWorkerToken, waitForHealth };
|
|
161
|
+
export { DEV_PLATFORM_WORKER_TOKEN, FORBIDDEN_WORKER_ENV_KEYS, PROJECT_SERVER_CONTROL, PROJECT_SERVER_DEPLOY_STATUS, PROJECT_SERVER_FRAMEWORK_NODE_MODULES, PROJECT_SERVER_FRAMEWORK_ROOT, PROJECT_SERVER_HEALTH, PROJECT_SERVER_IMAGE, PROJECT_SERVER_PORT, PROJECT_SERVER_ROOT, RUNTIME_PING_TIMEOUT_MS, WorkerRuntimeConfigError, buildRuntimeEnv, canPingProjectTarget, classifyDeployHealth, encodeOrgArtifacts, fetchDeployStatus, formatDockerEnv, loadProjectOnRuntime, mintOrgWorkerToken, parseOrgArtifactsFromEnv, pingProject, pingProjectTarget, pingRuntimeHealth, promoteProjectOnRuntime, resolvePlatformWorkerToken, resolveProjectServerImage, resolveRuntimeLaunch, resolveWorkerPlatformUrl, resolveWorkerRuntimeConfig, rewriteLoopbackHost, rewriteLoopbackUrl, unloadProjectOnRuntime, verifyOrgWorkerToken, waitForDeployStatus, waitForHealth };
|
|
55
162
|
|
|
56
163
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/runtime-constants.ts","../src/ping-project.ts","../src/ping-project-target.ts","../src/deploy-status.ts"],"sourcesContent":["/** Timeout for a single project runtime `/health` probe. */\nexport const RUNTIME_PING_TIMEOUT_MS = 15_000;\n","import { PROJECT_SERVER_HEALTH } from \"./constants\";\nimport type { HostingPlugin } from \"./plugin\";\nimport { RUNTIME_PING_TIMEOUT_MS } from \"./runtime-constants\";\n\nexport type PingProjectOptions = {\n runtimeId?: string | null;\n fetchImpl?: typeof fetch;\n timeoutMs?: number;\n plugin?: Pick<HostingPlugin, \"pingRequestHeaders\">;\n};\n\nexport async function pingProject(\n baseUrl: string,\n options: PingProjectOptions = {},\n): Promise<boolean> {\n const timeoutMs = options.timeoutMs ?? RUNTIME_PING_TIMEOUT_MS;\n const headers = options.plugin?.pingRequestHeaders?.(options.runtimeId ?? null) ?? {};\n\n try {\n const response = await (options.fetchImpl ?? fetch)(\n new URL(PROJECT_SERVER_HEALTH.path, baseUrl),\n {\n signal: AbortSignal.timeout(timeoutMs),\n headers,\n },\n );\n\n return response.ok;\n } catch {\n return false;\n }\n}\n","import type { HostingPlugin } from \"./plugin\";\nimport type { ProjectPingTarget } from \"./runtime\";\nimport { pingProject, type PingProjectOptions } from \"./ping-project\";\n\nexport function canPingProjectTarget(\n target: ProjectPingTarget,\n plugin?: Pick<HostingPlugin, \"canPingTarget\">,\n): target is { baseUrl: string; runtimeId: string | null } {\n if (plugin?.canPingTarget) {\n return plugin.canPingTarget(target);\n }\n\n return !!target.baseUrl;\n}\n\nexport async function pingProjectTarget(\n target: ProjectPingTarget,\n options: PingProjectOptions & {\n plugin?: Pick<HostingPlugin, \"canPingTarget\" | \"pingRequestHeaders\">;\n } = {},\n): Promise<boolean> {\n if (!canPingProjectTarget(target, options.plugin)) {\n return false;\n }\n\n return pingProject(target.baseUrl, {\n ...options,\n runtimeId: target.runtimeId,\n });\n}\n","import { PROJECT_SERVER_DEPLOY_STATUS } from \"./constants\";\nimport { RUNTIME_PING_TIMEOUT_MS } from \"./runtime-constants\";\n\n/** Per-project bootstrap outcome reported by an org runtime machine. */\nexport type ProjectDeployStatus = {\n projectId: string;\n ok: boolean;\n error?: string;\n};\n\nexport type DeployStatusResponse = {\n projects: ProjectDeployStatus[];\n};\n\nexport type FetchDeployStatusOptions = {\n fetchImpl?: typeof fetch;\n timeoutMs?: number;\n};\n\n/**\n * Ask a running org machine which projects bootstrapped and which failed.\n * Best-effort: returns undefined on any error so callers can fall back to\n * treating every project as healthy (preserving pre-existing behavior).\n */\nexport async function fetchDeployStatus(\n baseUrl: string,\n options: FetchDeployStatusOptions = {},\n): Promise<DeployStatusResponse | undefined> {\n const timeoutMs = options.timeoutMs ?? RUNTIME_PING_TIMEOUT_MS;\n\n try {\n const response = await (options.fetchImpl ?? fetch)(\n new URL(PROJECT_SERVER_DEPLOY_STATUS.path, baseUrl),\n { signal: AbortSignal.timeout(timeoutMs) },\n );\n\n if (!response.ok) {\n return undefined;\n }\n\n const data = (await response.json()) as DeployStatusResponse;\n if (!data || !Array.isArray(data.projects)) {\n return undefined;\n }\n\n return data;\n } catch (error) {\n // Best-effort: fall back to promote-all, but log so a consistently\n // unreachable /deploy-status (port/6PN/version skew) is diagnosable rather\n // than silently re-creating the pre-fix behavior.\n console.warn(`[deploy-status] failed to fetch from ${baseUrl}:`, error);\n return undefined;\n }\n}\n"],"mappings":";;;;AACA,MAAa,0BAA0B;;;ACUvC,eAAsB,YACpB,SACA,UAA8B,CAAC,GACb;CAClB,MAAM,YAAY,QAAQ,aAAA;CAC1B,MAAM,UAAU,QAAQ,QAAQ,qBAAqB,QAAQ,aAAa,IAAI,KAAK,CAAC;CAEpF,IAAI;EASF,QAAO,OARiB,QAAQ,aAAa,OAC3C,IAAI,IAAI,sBAAsB,MAAM,OAAO,GAC3C;GACE,QAAQ,YAAY,QAAQ,SAAS;GACrC;EACF,CACF,GAEgB;CAClB,QAAQ;EACN,OAAO;CACT;AACF;;;AC3BA,SAAgB,qBACd,QACA,QACyD;CACzD,IAAI,QAAQ,eACV,OAAO,OAAO,cAAc,MAAM;CAGpC,OAAO,CAAC,CAAC,OAAO;AAClB;AAEA,eAAsB,kBACpB,QACA,UAEI,CAAC,GACa;CAClB,IAAI,CAAC,qBAAqB,QAAQ,QAAQ,MAAM,GAC9C,OAAO;CAGT,OAAO,YAAY,OAAO,SAAS;EACjC,GAAG;EACH,WAAW,OAAO;CACpB,CAAC;AACH;;;;;;;;ACLA,eAAsB,kBACpB,SACA,UAAoC,CAAC,GACM;CAC3C,MAAM,YAAY,QAAQ,aAAA;CAE1B,IAAI;EACF,MAAM,WAAW,OAAO,QAAQ,aAAa,OAC3C,IAAI,IAAI,6BAA6B,MAAM,OAAO,GAClD,EAAE,QAAQ,YAAY,QAAQ,SAAS,EAAE,CAC3C;EAEA,IAAI,CAAC,SAAS,IACZ;EAGF,MAAM,OAAQ,MAAM,SAAS,KAAK;EAClC,IAAI,CAAC,QAAQ,CAAC,MAAM,QAAQ,KAAK,QAAQ,GACvC;EAGF,OAAO;CACT,SAAS,OAAO;EAId,QAAQ,KAAK,wCAAwC,QAAQ,IAAI,KAAK;EACtE;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/runtime-constants.ts","../src/runtime-control.ts","../src/ping-project.ts","../src/ping-project-target.ts","../src/deploy-status.ts"],"sourcesContent":["/** Timeout for a single project runtime `/health` probe. */\nexport const RUNTIME_PING_TIMEOUT_MS = 15_000;\n","import { PROJECT_SERVER_PORT } from \"./constants\";\nimport { RUNTIME_PING_TIMEOUT_MS } from \"./runtime-constants\";\n\nexport const PROJECT_SERVER_CONTROL = {\n load: \"/control/projects/load\",\n promote: \"/control/projects/promote\",\n unload: \"/control/projects/unload\",\n port: PROJECT_SERVER_PORT,\n} as const;\n\nexport type LoadProjectOnRuntimeInput = {\n projectId: string;\n artifactId: string;\n artifactVersion: number;\n storageKey: string;\n activate?: boolean;\n};\n\nexport type RuntimeControlOptions = {\n fetchImpl?: typeof fetch;\n timeoutMs?: number;\n /** Bearer token — typically the org's WORKER_INTERNAL_TOKEN. */\n workerToken?: string;\n};\n\nasync function postControl<T>(\n baseUrl: string,\n path: string,\n body: unknown,\n options: RuntimeControlOptions = {},\n): Promise<T> {\n const timeoutMs = options.timeoutMs ?? RUNTIME_PING_TIMEOUT_MS;\n const headers: Record<string, string> = {\n \"content-type\": \"application/json\",\n };\n if (options.workerToken) {\n headers.authorization = `Bearer ${options.workerToken}`;\n }\n\n const response = await (options.fetchImpl ?? fetch)(new URL(path, baseUrl), {\n method: \"POST\",\n headers,\n body: JSON.stringify(body),\n signal: AbortSignal.timeout(timeoutMs),\n });\n\n const data = (await response.json().catch(() => ({}))) as T & { ok?: boolean; error?: string };\n if (!response.ok || data.ok === false) {\n throw new Error(\n typeof data.error === \"string\"\n ? data.error\n : `Runtime control ${path} failed (${response.status})`,\n );\n }\n\n return data;\n}\n\nexport async function loadProjectOnRuntime(\n baseUrl: string,\n input: LoadProjectOnRuntimeInput,\n options: RuntimeControlOptions = {},\n): Promise<void> {\n await postControl(baseUrl, PROJECT_SERVER_CONTROL.load, input, options);\n}\n\nexport async function promoteProjectOnRuntime(\n baseUrl: string,\n input: { projectId: string; artifactId: string },\n options: RuntimeControlOptions = {},\n): Promise<void> {\n await postControl(baseUrl, PROJECT_SERVER_CONTROL.promote, input, options);\n}\n\nexport async function unloadProjectOnRuntime(\n baseUrl: string,\n input: { projectId: string; artifactId: string; force?: boolean },\n options: RuntimeControlOptions = {},\n): Promise<void> {\n await postControl(baseUrl, PROJECT_SERVER_CONTROL.unload, input, options);\n}\n\n/** True when the org runtime answers /health. */\nexport async function pingRuntimeHealth(\n baseUrl: string,\n options: RuntimeControlOptions = {},\n): Promise<boolean> {\n const timeoutMs = options.timeoutMs ?? RUNTIME_PING_TIMEOUT_MS;\n try {\n const response = await (options.fetchImpl ?? fetch)(new URL(\"/health\", baseUrl), {\n signal: AbortSignal.timeout(timeoutMs),\n });\n return response.ok;\n } catch {\n return false;\n }\n}\n","import { PROJECT_SERVER_HEALTH } from \"./constants\";\nimport type { HostingPlugin } from \"./plugin\";\nimport { RUNTIME_PING_TIMEOUT_MS } from \"./runtime-constants\";\n\nexport type PingProjectOptions = {\n runtimeId?: string | null;\n fetchImpl?: typeof fetch;\n timeoutMs?: number;\n plugin?: Pick<HostingPlugin, \"pingRequestHeaders\">;\n};\n\nexport async function pingProject(\n baseUrl: string,\n options: PingProjectOptions = {},\n): Promise<boolean> {\n const timeoutMs = options.timeoutMs ?? RUNTIME_PING_TIMEOUT_MS;\n const headers = options.plugin?.pingRequestHeaders?.(options.runtimeId ?? null) ?? {};\n\n try {\n const response = await (options.fetchImpl ?? fetch)(\n new URL(PROJECT_SERVER_HEALTH.path, baseUrl),\n {\n signal: AbortSignal.timeout(timeoutMs),\n headers,\n },\n );\n\n return response.ok;\n } catch {\n return false;\n }\n}\n","import type { HostingPlugin } from \"./plugin\";\nimport type { ProjectPingTarget } from \"./runtime\";\nimport { pingProject, type PingProjectOptions } from \"./ping-project\";\n\nexport function canPingProjectTarget(\n target: ProjectPingTarget,\n plugin?: Pick<HostingPlugin, \"canPingTarget\">,\n): target is { baseUrl: string; runtimeId: string | null } {\n if (plugin?.canPingTarget) {\n return plugin.canPingTarget(target);\n }\n\n return !!target.baseUrl;\n}\n\nexport async function pingProjectTarget(\n target: ProjectPingTarget,\n options: PingProjectOptions & {\n plugin?: Pick<HostingPlugin, \"canPingTarget\" | \"pingRequestHeaders\">;\n } = {},\n): Promise<boolean> {\n if (!canPingProjectTarget(target, options.plugin)) {\n return false;\n }\n\n return pingProject(target.baseUrl, {\n ...options,\n runtimeId: target.runtimeId,\n });\n}\n","import { PROJECT_SERVER_DEPLOY_STATUS } from \"./constants\";\nimport { RUNTIME_PING_TIMEOUT_MS } from \"./runtime-constants\";\n\nconst DEFAULT_WAIT_TIMEOUT_MS = 120_000;\nconst DEFAULT_WAIT_INTERVAL_MS = 500;\nconst REQUEST_TIMEOUT_MS = 2_000;\n\n/** Per-project bootstrap outcome reported by an org runtime machine. */\nexport type ProjectDeployStatus = {\n projectId: string;\n ok: boolean;\n error?: string;\n};\n\nexport type VersionDeployStatus = {\n projectId: string;\n artifactId: string;\n state: \"active\" | \"resident\" | \"indexed\";\n ok: boolean;\n activeJobCount?: number;\n error?: string;\n};\n\nexport type DeployStatusResponse = {\n projects: ProjectDeployStatus[];\n versions?: VersionDeployStatus[];\n};\n\nexport type FetchDeployStatusOptions = {\n fetchImpl?: typeof fetch;\n timeoutMs?: number;\n};\n\nexport type WaitForDeployStatusOptions = {\n fetchImpl?: typeof fetch;\n timeoutMs?: number;\n intervalMs?: number;\n};\n\n/**\n * Ask a running org machine which projects bootstrapped and which failed.\n * Returns undefined when the endpoint is unreachable, non-OK, times out, or\n * returns an unusable payload — callers must treat that as non-affirmative\n * health for every pending project (never promote on silence).\n */\nexport async function fetchDeployStatus(\n baseUrl: string,\n options: FetchDeployStatusOptions = {},\n): Promise<DeployStatusResponse | undefined> {\n const timeoutMs = options.timeoutMs ?? RUNTIME_PING_TIMEOUT_MS;\n\n try {\n const response = await (options.fetchImpl ?? fetch)(\n new URL(PROJECT_SERVER_DEPLOY_STATUS.path, baseUrl),\n { signal: AbortSignal.timeout(timeoutMs) },\n );\n\n if (!response.ok) {\n return undefined;\n }\n\n const data = (await response.json()) as DeployStatusResponse;\n if (!data || !Array.isArray(data.projects)) {\n return undefined;\n }\n\n return data;\n } catch (error) {\n console.warn(`[deploy-status] failed to fetch from ${baseUrl}:`, error);\n return undefined;\n }\n}\n\n/**\n * Poll `/deploy-status` until the real worker returns a usable payload or the\n * deadline expires. Retries only transient unavailability (network errors,\n * non-2xx including early-health 404, timeouts, malformed bodies). Any valid\n * `{ projects: [...] }` response — including empty or explicit failures — is\n * terminal so genuine bootstrap errors surface immediately.\n */\nexport async function waitForDeployStatus(\n baseUrl: string,\n options: WaitForDeployStatusOptions = {},\n): Promise<DeployStatusResponse | undefined> {\n const timeoutMs = options.timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS;\n const intervalMs = options.intervalMs ?? DEFAULT_WAIT_INTERVAL_MS;\n const deadline = Date.now() + timeoutMs;\n\n while (Date.now() < deadline) {\n const remainingMs = deadline - Date.now();\n const requestTimeoutMs = Math.min(REQUEST_TIMEOUT_MS, Math.max(1, remainingMs));\n const status = await fetchDeployStatus(baseUrl, {\n fetchImpl: options.fetchImpl,\n timeoutMs: requestTimeoutMs,\n });\n if (status) {\n return status;\n }\n\n if (Date.now() + intervalMs >= deadline) {\n break;\n }\n await sleep(intervalMs);\n }\n\n return undefined;\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n\nexport type DeployHealthVerdict = { ok: true } | { ok: false; error: string };\n\n/**\n * Require an explicit `{ projectId, ok: true }` entry for each candidate.\n * Missing entries, `ok: false`, empty `projects`, or an unavailable status\n * response all fail closed for that project.\n */\nexport function classifyDeployHealth(input: {\n projectIds: string[];\n deployStatus: DeployStatusResponse | undefined;\n}): Map<string, DeployHealthVerdict> {\n const verdicts = new Map<string, DeployHealthVerdict>();\n\n if (!input.deployStatus) {\n for (const projectId of input.projectIds) {\n verdicts.set(projectId, {\n ok: false,\n error: \"Deploy health status unavailable\",\n });\n }\n return verdicts;\n }\n\n const byId = new Map(\n input.deployStatus.projects\n .filter((entry) => typeof entry?.projectId === \"string\" && entry.projectId.length > 0)\n .map((entry) => [entry.projectId, entry]),\n );\n\n for (const projectId of input.projectIds) {\n const entry = byId.get(projectId);\n if (!entry) {\n verdicts.set(projectId, {\n ok: false,\n error: \"Deploy health status omitted project\",\n });\n continue;\n }\n if (entry.ok !== true) {\n verdicts.set(projectId, {\n ok: false,\n error: entry.error?.trim() || \"Project failed to start\",\n });\n continue;\n }\n verdicts.set(projectId, { ok: true });\n }\n\n return verdicts;\n}\n"],"mappings":";;;;AACA,MAAa,0BAA0B;;;ACEvC,MAAa,yBAAyB;CACpC,MAAM;CACN,SAAS;CACT,QAAQ;CACR,MAAM;AACR;AAiBA,eAAe,YACb,SACA,MACA,MACA,UAAiC,CAAC,GACtB;CACZ,MAAM,YAAY,QAAQ,aAAA;CAC1B,MAAM,UAAkC,EACtC,gBAAgB,mBAClB;CACA,IAAI,QAAQ,aACV,QAAQ,gBAAgB,UAAU,QAAQ;CAG5C,MAAM,WAAW,OAAO,QAAQ,aAAa,OAAO,IAAI,IAAI,MAAM,OAAO,GAAG;EAC1E,QAAQ;EACR;EACA,MAAM,KAAK,UAAU,IAAI;EACzB,QAAQ,YAAY,QAAQ,SAAS;CACvC,CAAC;CAED,MAAM,OAAQ,MAAM,SAAS,KAAK,EAAE,aAAa,CAAC,EAAE;CACpD,IAAI,CAAC,SAAS,MAAM,KAAK,OAAO,OAC9B,MAAM,IAAI,MACR,OAAO,KAAK,UAAU,WAClB,KAAK,QACL,mBAAmB,KAAK,WAAW,SAAS,OAAO,EACzD;CAGF,OAAO;AACT;AAEA,eAAsB,qBACpB,SACA,OACA,UAAiC,CAAC,GACnB;CACf,MAAM,YAAY,SAAS,uBAAuB,MAAM,OAAO,OAAO;AACxE;AAEA,eAAsB,wBACpB,SACA,OACA,UAAiC,CAAC,GACnB;CACf,MAAM,YAAY,SAAS,uBAAuB,SAAS,OAAO,OAAO;AAC3E;AAEA,eAAsB,uBACpB,SACA,OACA,UAAiC,CAAC,GACnB;CACf,MAAM,YAAY,SAAS,uBAAuB,QAAQ,OAAO,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,IAAI;IACJ,OAAO;GACT,CAAC;GACD;EACF;EACA,IAAI,MAAM,OAAO,MAAM;GACrB,SAAS,IAAI,WAAW;IACtB,IAAI;IACJ,OAAO,MAAM,OAAO,KAAK,KAAK;GAChC,CAAC;GACD;EACF;EACA,SAAS,IAAI,WAAW,EAAE,IAAI,KAAK,CAAC;CACtC;CAEA,OAAO;AACT"}
|
package/dist/org-artifacts.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ProjectRuntimeDatabase, c as ProjectRuntimeInput,
|
|
1
|
+
import { a as ProjectRuntimeDatabase, c as ProjectRuntimeInput, i as ProjectRuntime, l as ProjectRuntimeReconcileInput, m as parseOrgArtifactsFromEnv, n as OrgProjectDeploy, o as ProjectRuntimeDestroyInput, p as encodeOrgArtifacts, r as ProjectPingTarget, s as ProjectRuntimeHosting, t as OrgArtifactSpec, u as ProjectRuntimeResult } from "./runtime-Cp906goK.cjs";
|
|
2
2
|
export { type OrgArtifactSpec, type OrgProjectDeploy, type ProjectPingTarget, type ProjectRuntime, type ProjectRuntimeDatabase, type ProjectRuntimeDestroyInput, type ProjectRuntimeHosting, type ProjectRuntimeInput, type ProjectRuntimeReconcileInput, type ProjectRuntimeResult, encodeOrgArtifacts, parseOrgArtifactsFromEnv };
|
package/dist/org-artifacts.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ProjectRuntimeDatabase, c as ProjectRuntimeInput,
|
|
1
|
+
import { a as ProjectRuntimeDatabase, c as ProjectRuntimeInput, i as ProjectRuntime, l as ProjectRuntimeReconcileInput, m as parseOrgArtifactsFromEnv, n as OrgProjectDeploy, o as ProjectRuntimeDestroyInput, p as encodeOrgArtifacts, r as ProjectPingTarget, s as ProjectRuntimeHosting, t as OrgArtifactSpec, u as ProjectRuntimeResult } from "./runtime-Cp906goK.mjs";
|
|
2
2
|
export { type OrgArtifactSpec, type OrgProjectDeploy, type ProjectPingTarget, type ProjectRuntime, type ProjectRuntimeDatabase, type ProjectRuntimeDestroyInput, type ProjectRuntimeHosting, type ProjectRuntimeInput, type ProjectRuntimeReconcileInput, type ProjectRuntimeResult, encodeOrgArtifacts, parseOrgArtifactsFromEnv };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as ProjectRuntime, r as ProjectPingTarget } from "./runtime-
|
|
1
|
+
import { i as ProjectRuntime, r as ProjectPingTarget } from "./runtime-Cp906goK.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/worker-runtime-config.d.ts
|
|
4
4
|
/** Resolved platform ↔ project-server worker auth contract. */
|
|
@@ -41,4 +41,4 @@ type HostingPlugin = {
|
|
|
41
41
|
};
|
|
42
42
|
//#endregion
|
|
43
43
|
export { WorkerRuntimeConfig as a, OrganizationHostingResult as i, HostingPlugin as n, WorkerRuntimeConfigError as o, OrganizationHostingInput as r, resolveWorkerRuntimeConfig as s, HostingOptions as t };
|
|
44
|
-
//# sourceMappingURL=plugin-
|
|
44
|
+
//# sourceMappingURL=plugin-4cuXkf42.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-
|
|
1
|
+
{"version":3,"file":"plugin-4cuXkf42.d.cts","names":[],"sources":["../src/worker-runtime-config.ts","../src/plugin.ts"],"mappings":";;;;KAGY,mBAAA;yEAEV,WAAA,UAF6B;EAI7B,WAAW;AAAA;AAAA,cAGA,wBAAA,SAAiC,KAAK;EAAA,SACxC,OAAA;cAEG,OAAA;AAAA;;iBAWE,0BAAA,CACd,MAAA,GAAQ,MAAA,CAAO,UAAA,GACd,mBAAmB;;;KCvBV,cAAA;EACV,KAAA;EACA,GAAA,GAAM,MAAA,CAAO,UAAA;EACb,SAAA,UAAmB,KAAK;EACxB,eAAA;AAAA;AAAA,KAGU,wBAAA;EACV,cAAA;EACA,IAAI;AAAA;AAAA,KAGM,yBAAA;EACV,OAAO;AAAA;AAAA,KAGG,aAAA;EACV,IAAA,UDP6B;ECS7B,aAAA,EAAe,mBAAA;EACf,aAAA,IAAiB,cAAA;EACjB,qBAAA,EAAuB,KAAA,EAAO,wBAAA,GAA2B,OAAA,CAAQ,yBAAA;EACjE,uBAAA,EAAyB,MAAA,EAAQ,yBAAA,GAA4B,OAAA;EAC7D,aAAA,EACE,MAAA,EAAQ,iBAAA,GACP,MAAA;IAAY,OAAA;IAAiB,SAAA;EAAA;EAChC,kBAAA,EAAoB,SAAA,kBAA2B,MAAA;AAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as ProjectRuntime, r as ProjectPingTarget } from "./runtime-
|
|
1
|
+
import { i as ProjectRuntime, r as ProjectPingTarget } from "./runtime-Cp906goK.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/worker-runtime-config.d.ts
|
|
4
4
|
/** Resolved platform ↔ project-server worker auth contract. */
|
|
@@ -41,4 +41,4 @@ type HostingPlugin = {
|
|
|
41
41
|
};
|
|
42
42
|
//#endregion
|
|
43
43
|
export { WorkerRuntimeConfig as a, OrganizationHostingResult as i, HostingPlugin as n, WorkerRuntimeConfigError as o, OrganizationHostingInput as r, resolveWorkerRuntimeConfig as s, HostingOptions as t };
|
|
44
|
-
//# sourceMappingURL=plugin-
|
|
44
|
+
//# sourceMappingURL=plugin-eiAXqE7P.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-
|
|
1
|
+
{"version":3,"file":"plugin-eiAXqE7P.d.mts","names":[],"sources":["../src/worker-runtime-config.ts","../src/plugin.ts"],"mappings":";;;;KAGY,mBAAA;yEAEV,WAAA,UAF6B;EAI7B,WAAW;AAAA;AAAA,cAGA,wBAAA,SAAiC,KAAK;EAAA,SACxC,OAAA;cAEG,OAAA;AAAA;;iBAWE,0BAAA,CACd,MAAA,GAAQ,MAAA,CAAO,UAAA,GACd,mBAAmB;;;KCvBV,cAAA;EACV,KAAA;EACA,GAAA,GAAM,MAAA,CAAO,UAAA;EACb,SAAA,UAAmB,KAAK;EACxB,eAAA;AAAA;AAAA,KAGU,wBAAA;EACV,cAAA;EACA,IAAI;AAAA;AAAA,KAGM,yBAAA;EACV,OAAO;AAAA;AAAA,KAGG,aAAA;EACV,IAAA,UDP6B;ECS7B,aAAA,EAAe,mBAAA;EACf,aAAA,IAAiB,cAAA;EACjB,qBAAA,EAAuB,KAAA,EAAO,wBAAA,GAA2B,OAAA,CAAQ,yBAAA;EACjE,uBAAA,EAAyB,MAAA,EAAQ,yBAAA,GAA4B,OAAA;EAC7D,aAAA,EACE,MAAA,EAAQ,iBAAA,GACP,MAAA;IAAY,OAAA;IAAiB,SAAA;EAAA;EAChC,kBAAA,EAAoB,SAAA,kBAA2B,MAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-BmfsHLrk.mjs","names":[],"sources":["../src/runtime.ts"],"sourcesContent":["export type ProjectRuntimeDatabase = {\n host: string;\n port: number;\n database: string;\n user: string;\n password: string;\n searchPath: string;\n organizationId: string;\n /** @deprecated Per-project workers only — org workers omit this. */\n projectId?: string;\n};\n\nexport type OrgProjectDeploy = {\n projectId: string;\n name: string;\n artifactId: string;\n artifactStorageKey: string;\n artifactVersion: number;\n};\n\nexport type OrgArtifactSpec = {\n projectId: string;\n artifactStorageKey: string;\n artifactId: string;\n /** Monotonic per-project artifact version from the platform database. */\n artifactVersion: number;\n};\n\nexport type ProjectRuntimeHosting = {\n appName: string;\n};\n\nexport type ProjectRuntimeInput = {\n organizationId: string;\n projects: OrgProjectDeploy[];\n database: ProjectRuntimeDatabase;\n hosting?: ProjectRuntimeHosting;\n /** Extra env merged into the project server launch spec (e.g. from an llmProxy plugin). */\n env?: Record<string, string>;\n /** Previous runtime to retire after a successful cutover. */\n previousRuntimeId?: string | null;\n};\n\n/** Builds base64 `KEYSTROKE_ORG_ARTIFACTS` payload for org worker containers. */\nexport function encodeOrgArtifacts(artifacts: OrgArtifactSpec[]): string {\n return Buffer.from(JSON.stringify(artifacts)).toString(\"base64\");\n}\n\nexport function parseOrgArtifactsFromEnv(\n env: NodeJS.ProcessEnv = process.env,\n): OrgArtifactSpec[] | undefined {\n const raw = env.KEYSTROKE_ORG_ARTIFACTS?.trim();\n if (!raw) {\n return undefined;\n }\n\n const parsed = JSON.parse(Buffer.from(raw, \"base64\").toString(\"utf8\")) as unknown;\n if (!Array.isArray(parsed)) {\n throw new Error(\"KEYSTROKE_ORG_ARTIFACTS must decode to a JSON array\");\n }\n\n return parsed.map((entry) => {\n if (\n !entry ||\n typeof entry !== \"object\" ||\n typeof (entry as OrgArtifactSpec).projectId !== \"string\" ||\n typeof (entry as OrgArtifactSpec).artifactStorageKey !== \"string\" ||\n typeof (entry as OrgArtifactSpec).artifactId !== \"string\" ||\n typeof (entry as OrgArtifactSpec).artifactVersion !== \"number\"\n ) {\n throw new Error(\n \"KEYSTROKE_ORG_ARTIFACTS entries require projectId, artifactStorageKey, artifactId, and artifactVersion\",\n );\n }\n\n return entry as OrgArtifactSpec;\n });\n}\n\nexport type ProjectRuntimeDestroyInput = {\n runtimeId: string;\n hosting?: ProjectRuntimeHosting;\n};\n\nexport type ProjectRuntimeReconcileInput = {\n organizationId: string;\n /** The runtime to keep — every other runtime belonging to this org should be destroyed. */\n keepRuntimeId: string;\n hosting?: ProjectRuntimeHosting;\n};\n\nexport type ProjectRuntimeResult = {\n runtimeId: string;\n baseUrl: string;\n};\n\nexport type ProjectRuntime = {\n start(input: ProjectRuntimeInput): Promise<ProjectRuntimeResult>;\n destroy?(input: ProjectRuntimeDestroyInput): Promise<void>;\n /**\n * Sweep away every runtime for this org except `keepRuntimeId`, retrying\n * transient failures instead of giving up after one attempt. This catches\n * orphans that a single {@link destroy} call missed (e.g. a previous deploy's\n * destroy failed silently), not just the one runtime recorded as \"previous.\"\n */\n reconcile?(input: ProjectRuntimeReconcileInput): Promise<void>;\n};\n\nexport type ProjectPingTarget = {\n baseUrl: string | null;\n runtimeId: string | null;\n};\n"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"runtime-BmfsHLrk.mjs","names":[],"sources":["../src/runtime.ts"],"sourcesContent":["export type ProjectRuntimeDatabase = {\n host: string;\n port: number;\n database: string;\n user: string;\n password: string;\n searchPath: string;\n organizationId: string;\n /** @deprecated Per-project workers only — org workers omit this. */\n projectId?: string;\n};\n\nexport type OrgProjectDeploy = {\n projectId: string;\n name: string;\n artifactId: string;\n artifactStorageKey: string;\n artifactVersion: number;\n /** Require an affirmative artifact-specific health record before promotion. */\n requiresArtifactHealth?: boolean;\n};\n\nexport type OrgArtifactSpec = {\n projectId: string;\n artifactStorageKey: string;\n artifactId: string;\n /** Monotonic per-project artifact version from the platform database. */\n artifactVersion: number;\n};\n\nexport type ProjectRuntimeHosting = {\n appName: string;\n};\n\nexport type ProjectRuntimeInput = {\n organizationId: string;\n projects: OrgProjectDeploy[];\n database: ProjectRuntimeDatabase;\n hosting?: ProjectRuntimeHosting;\n /** Extra env merged into the project server launch spec (e.g. from an llmProxy plugin). */\n env?: Record<string, string>;\n /** Previous runtime to retire after a successful cutover. */\n previousRuntimeId?: string | null;\n};\n\n/** Builds base64 `KEYSTROKE_ORG_ARTIFACTS` payload for org worker containers. */\nexport function encodeOrgArtifacts(artifacts: OrgArtifactSpec[]): string {\n return Buffer.from(JSON.stringify(artifacts)).toString(\"base64\");\n}\n\nexport function parseOrgArtifactsFromEnv(\n env: NodeJS.ProcessEnv = process.env,\n): OrgArtifactSpec[] | undefined {\n const raw = env.KEYSTROKE_ORG_ARTIFACTS?.trim();\n if (!raw) {\n return undefined;\n }\n\n const parsed = JSON.parse(Buffer.from(raw, \"base64\").toString(\"utf8\")) as unknown;\n if (!Array.isArray(parsed)) {\n throw new Error(\"KEYSTROKE_ORG_ARTIFACTS must decode to a JSON array\");\n }\n\n return parsed.map((entry) => {\n if (\n !entry ||\n typeof entry !== \"object\" ||\n typeof (entry as OrgArtifactSpec).projectId !== \"string\" ||\n typeof (entry as OrgArtifactSpec).artifactStorageKey !== \"string\" ||\n typeof (entry as OrgArtifactSpec).artifactId !== \"string\" ||\n typeof (entry as OrgArtifactSpec).artifactVersion !== \"number\"\n ) {\n throw new Error(\n \"KEYSTROKE_ORG_ARTIFACTS entries require projectId, artifactStorageKey, artifactId, and artifactVersion\",\n );\n }\n\n return entry as OrgArtifactSpec;\n });\n}\n\nexport type ProjectRuntimeDestroyInput = {\n runtimeId: string;\n hosting?: ProjectRuntimeHosting;\n};\n\nexport type ProjectRuntimeReconcileInput = {\n organizationId: string;\n /** The runtime to keep — every other runtime belonging to this org should be destroyed. */\n keepRuntimeId: string;\n hosting?: ProjectRuntimeHosting;\n};\n\nexport type ProjectRuntimeResult = {\n runtimeId: string;\n baseUrl: string;\n};\n\nexport type ProjectRuntimeSleepInput = {\n runtimeId: string;\n hosting?: ProjectRuntimeHosting;\n};\n\nexport type ProjectRuntimeWakeInput = {\n runtimeId: string;\n hosting?: ProjectRuntimeHosting;\n};\n\nexport type ProjectRuntime = {\n start(input: ProjectRuntimeInput): Promise<ProjectRuntimeResult>;\n destroy?(input: ProjectRuntimeDestroyInput): Promise<void>;\n /**\n * Sweep away every runtime for this org except `keepRuntimeId`, retrying\n * transient failures instead of giving up after one attempt. This catches\n * orphans that a single {@link destroy} call missed (e.g. a previous deploy's\n * destroy failed silently), not just the one runtime recorded as \"previous.\"\n */\n reconcile?(input: ProjectRuntimeReconcileInput): Promise<void>;\n /**\n * Put an existing runtime to sleep without destroying it (e.g. Docker stop,\n * Fly suspend). Provider-specific; omit when unsupported.\n */\n sleep?(input: ProjectRuntimeSleepInput): Promise<void>;\n /**\n * Resume a sleeping runtime. May return a fresh {@link ProjectRuntimeResult}\n * when the base URL can change (e.g. Docker host port remap).\n */\n wake?(input: ProjectRuntimeWakeInput): Promise<ProjectRuntimeResult | void>;\n};\n\nexport type ProjectPingTarget = {\n baseUrl: string | null;\n runtimeId: string | null;\n};\n"],"mappings":";;AA8CA,SAAgB,mBAAmB,WAAsC;CACvE,OAAO,OAAO,KAAK,KAAK,UAAU,SAAS,CAAC,EAAE,SAAS,QAAQ;AACjE;AAEA,SAAgB,yBACd,MAAyB,QAAQ,KACF;CAC/B,MAAM,MAAM,IAAI,yBAAyB,KAAK;CAC9C,IAAI,CAAC,KACH;CAGF,MAAM,SAAS,KAAK,MAAM,OAAO,KAAK,KAAK,QAAQ,EAAE,SAAS,MAAM,CAAC;CACrE,IAAI,CAAC,MAAM,QAAQ,MAAM,GACvB,MAAM,IAAI,MAAM,qDAAqD;CAGvE,OAAO,OAAO,KAAK,UAAU;EAC3B,IACE,CAAC,SACD,OAAO,UAAU,YACjB,OAAQ,MAA0B,cAAc,YAChD,OAAQ,MAA0B,uBAAuB,YACzD,OAAQ,MAA0B,eAAe,YACjD,OAAQ,MAA0B,oBAAoB,UAEtD,MAAM,IAAI,MACR,wGACF;EAGF,OAAO;CACT,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-CV7pSfMl.cjs","names":[],"sources":["../src/runtime.ts"],"sourcesContent":["export type ProjectRuntimeDatabase = {\n host: string;\n port: number;\n database: string;\n user: string;\n password: string;\n searchPath: string;\n organizationId: string;\n /** @deprecated Per-project workers only — org workers omit this. */\n projectId?: string;\n};\n\nexport type OrgProjectDeploy = {\n projectId: string;\n name: string;\n artifactId: string;\n artifactStorageKey: string;\n artifactVersion: number;\n};\n\nexport type OrgArtifactSpec = {\n projectId: string;\n artifactStorageKey: string;\n artifactId: string;\n /** Monotonic per-project artifact version from the platform database. */\n artifactVersion: number;\n};\n\nexport type ProjectRuntimeHosting = {\n appName: string;\n};\n\nexport type ProjectRuntimeInput = {\n organizationId: string;\n projects: OrgProjectDeploy[];\n database: ProjectRuntimeDatabase;\n hosting?: ProjectRuntimeHosting;\n /** Extra env merged into the project server launch spec (e.g. from an llmProxy plugin). */\n env?: Record<string, string>;\n /** Previous runtime to retire after a successful cutover. */\n previousRuntimeId?: string | null;\n};\n\n/** Builds base64 `KEYSTROKE_ORG_ARTIFACTS` payload for org worker containers. */\nexport function encodeOrgArtifacts(artifacts: OrgArtifactSpec[]): string {\n return Buffer.from(JSON.stringify(artifacts)).toString(\"base64\");\n}\n\nexport function parseOrgArtifactsFromEnv(\n env: NodeJS.ProcessEnv = process.env,\n): OrgArtifactSpec[] | undefined {\n const raw = env.KEYSTROKE_ORG_ARTIFACTS?.trim();\n if (!raw) {\n return undefined;\n }\n\n const parsed = JSON.parse(Buffer.from(raw, \"base64\").toString(\"utf8\")) as unknown;\n if (!Array.isArray(parsed)) {\n throw new Error(\"KEYSTROKE_ORG_ARTIFACTS must decode to a JSON array\");\n }\n\n return parsed.map((entry) => {\n if (\n !entry ||\n typeof entry !== \"object\" ||\n typeof (entry as OrgArtifactSpec).projectId !== \"string\" ||\n typeof (entry as OrgArtifactSpec).artifactStorageKey !== \"string\" ||\n typeof (entry as OrgArtifactSpec).artifactId !== \"string\" ||\n typeof (entry as OrgArtifactSpec).artifactVersion !== \"number\"\n ) {\n throw new Error(\n \"KEYSTROKE_ORG_ARTIFACTS entries require projectId, artifactStorageKey, artifactId, and artifactVersion\",\n );\n }\n\n return entry as OrgArtifactSpec;\n });\n}\n\nexport type ProjectRuntimeDestroyInput = {\n runtimeId: string;\n hosting?: ProjectRuntimeHosting;\n};\n\nexport type ProjectRuntimeReconcileInput = {\n organizationId: string;\n /** The runtime to keep — every other runtime belonging to this org should be destroyed. */\n keepRuntimeId: string;\n hosting?: ProjectRuntimeHosting;\n};\n\nexport type ProjectRuntimeResult = {\n runtimeId: string;\n baseUrl: string;\n};\n\nexport type ProjectRuntime = {\n start(input: ProjectRuntimeInput): Promise<ProjectRuntimeResult>;\n destroy?(input: ProjectRuntimeDestroyInput): Promise<void>;\n /**\n * Sweep away every runtime for this org except `keepRuntimeId`, retrying\n * transient failures instead of giving up after one attempt. This catches\n * orphans that a single {@link destroy} call missed (e.g. a previous deploy's\n * destroy failed silently), not just the one runtime recorded as \"previous.\"\n */\n reconcile?(input: ProjectRuntimeReconcileInput): Promise<void>;\n};\n\nexport type ProjectPingTarget = {\n baseUrl: string | null;\n runtimeId: string | null;\n};\n"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"runtime-CV7pSfMl.cjs","names":[],"sources":["../src/runtime.ts"],"sourcesContent":["export type ProjectRuntimeDatabase = {\n host: string;\n port: number;\n database: string;\n user: string;\n password: string;\n searchPath: string;\n organizationId: string;\n /** @deprecated Per-project workers only — org workers omit this. */\n projectId?: string;\n};\n\nexport type OrgProjectDeploy = {\n projectId: string;\n name: string;\n artifactId: string;\n artifactStorageKey: string;\n artifactVersion: number;\n /** Require an affirmative artifact-specific health record before promotion. */\n requiresArtifactHealth?: boolean;\n};\n\nexport type OrgArtifactSpec = {\n projectId: string;\n artifactStorageKey: string;\n artifactId: string;\n /** Monotonic per-project artifact version from the platform database. */\n artifactVersion: number;\n};\n\nexport type ProjectRuntimeHosting = {\n appName: string;\n};\n\nexport type ProjectRuntimeInput = {\n organizationId: string;\n projects: OrgProjectDeploy[];\n database: ProjectRuntimeDatabase;\n hosting?: ProjectRuntimeHosting;\n /** Extra env merged into the project server launch spec (e.g. from an llmProxy plugin). */\n env?: Record<string, string>;\n /** Previous runtime to retire after a successful cutover. */\n previousRuntimeId?: string | null;\n};\n\n/** Builds base64 `KEYSTROKE_ORG_ARTIFACTS` payload for org worker containers. */\nexport function encodeOrgArtifacts(artifacts: OrgArtifactSpec[]): string {\n return Buffer.from(JSON.stringify(artifacts)).toString(\"base64\");\n}\n\nexport function parseOrgArtifactsFromEnv(\n env: NodeJS.ProcessEnv = process.env,\n): OrgArtifactSpec[] | undefined {\n const raw = env.KEYSTROKE_ORG_ARTIFACTS?.trim();\n if (!raw) {\n return undefined;\n }\n\n const parsed = JSON.parse(Buffer.from(raw, \"base64\").toString(\"utf8\")) as unknown;\n if (!Array.isArray(parsed)) {\n throw new Error(\"KEYSTROKE_ORG_ARTIFACTS must decode to a JSON array\");\n }\n\n return parsed.map((entry) => {\n if (\n !entry ||\n typeof entry !== \"object\" ||\n typeof (entry as OrgArtifactSpec).projectId !== \"string\" ||\n typeof (entry as OrgArtifactSpec).artifactStorageKey !== \"string\" ||\n typeof (entry as OrgArtifactSpec).artifactId !== \"string\" ||\n typeof (entry as OrgArtifactSpec).artifactVersion !== \"number\"\n ) {\n throw new Error(\n \"KEYSTROKE_ORG_ARTIFACTS entries require projectId, artifactStorageKey, artifactId, and artifactVersion\",\n );\n }\n\n return entry as OrgArtifactSpec;\n });\n}\n\nexport type ProjectRuntimeDestroyInput = {\n runtimeId: string;\n hosting?: ProjectRuntimeHosting;\n};\n\nexport type ProjectRuntimeReconcileInput = {\n organizationId: string;\n /** The runtime to keep — every other runtime belonging to this org should be destroyed. */\n keepRuntimeId: string;\n hosting?: ProjectRuntimeHosting;\n};\n\nexport type ProjectRuntimeResult = {\n runtimeId: string;\n baseUrl: string;\n};\n\nexport type ProjectRuntimeSleepInput = {\n runtimeId: string;\n hosting?: ProjectRuntimeHosting;\n};\n\nexport type ProjectRuntimeWakeInput = {\n runtimeId: string;\n hosting?: ProjectRuntimeHosting;\n};\n\nexport type ProjectRuntime = {\n start(input: ProjectRuntimeInput): Promise<ProjectRuntimeResult>;\n destroy?(input: ProjectRuntimeDestroyInput): Promise<void>;\n /**\n * Sweep away every runtime for this org except `keepRuntimeId`, retrying\n * transient failures instead of giving up after one attempt. This catches\n * orphans that a single {@link destroy} call missed (e.g. a previous deploy's\n * destroy failed silently), not just the one runtime recorded as \"previous.\"\n */\n reconcile?(input: ProjectRuntimeReconcileInput): Promise<void>;\n /**\n * Put an existing runtime to sleep without destroying it (e.g. Docker stop,\n * Fly suspend). Provider-specific; omit when unsupported.\n */\n sleep?(input: ProjectRuntimeSleepInput): Promise<void>;\n /**\n * Resume a sleeping runtime. May return a fresh {@link ProjectRuntimeResult}\n * when the base URL can change (e.g. Docker host port remap).\n */\n wake?(input: ProjectRuntimeWakeInput): Promise<ProjectRuntimeResult | void>;\n};\n\nexport type ProjectPingTarget = {\n baseUrl: string | null;\n runtimeId: string | null;\n};\n"],"mappings":";;AA8CA,SAAgB,mBAAmB,WAAsC;CACvE,OAAO,OAAO,KAAK,KAAK,UAAU,SAAS,CAAC,EAAE,SAAS,QAAQ;AACjE;AAEA,SAAgB,yBACd,MAAyB,QAAQ,KACF;CAC/B,MAAM,MAAM,IAAI,yBAAyB,KAAK;CAC9C,IAAI,CAAC,KACH;CAGF,MAAM,SAAS,KAAK,MAAM,OAAO,KAAK,KAAK,QAAQ,EAAE,SAAS,MAAM,CAAC;CACrE,IAAI,CAAC,MAAM,QAAQ,MAAM,GACvB,MAAM,IAAI,MAAM,qDAAqD;CAGvE,OAAO,OAAO,KAAK,UAAU;EAC3B,IACE,CAAC,SACD,OAAO,UAAU,YACjB,OAAQ,MAA0B,cAAc,YAChD,OAAQ,MAA0B,uBAAuB,YACzD,OAAQ,MAA0B,eAAe,YACjD,OAAQ,MAA0B,oBAAoB,UAEtD,MAAM,IAAI,MACR,wGACF;EAGF,OAAO;CACT,CAAC;AACH"}
|
|
@@ -14,7 +14,8 @@ type OrgProjectDeploy = {
|
|
|
14
14
|
name: string;
|
|
15
15
|
artifactId: string;
|
|
16
16
|
artifactStorageKey: string;
|
|
17
|
-
artifactVersion: number;
|
|
17
|
+
artifactVersion: number; /** Require an affirmative artifact-specific health record before promotion. */
|
|
18
|
+
requiresArtifactHealth?: boolean;
|
|
18
19
|
};
|
|
19
20
|
type OrgArtifactSpec = {
|
|
20
21
|
projectId: string;
|
|
@@ -49,6 +50,14 @@ type ProjectRuntimeResult = {
|
|
|
49
50
|
runtimeId: string;
|
|
50
51
|
baseUrl: string;
|
|
51
52
|
};
|
|
53
|
+
type ProjectRuntimeSleepInput = {
|
|
54
|
+
runtimeId: string;
|
|
55
|
+
hosting?: ProjectRuntimeHosting;
|
|
56
|
+
};
|
|
57
|
+
type ProjectRuntimeWakeInput = {
|
|
58
|
+
runtimeId: string;
|
|
59
|
+
hosting?: ProjectRuntimeHosting;
|
|
60
|
+
};
|
|
52
61
|
type ProjectRuntime = {
|
|
53
62
|
start(input: ProjectRuntimeInput): Promise<ProjectRuntimeResult>;
|
|
54
63
|
destroy?(input: ProjectRuntimeDestroyInput): Promise<void>;
|
|
@@ -59,11 +68,21 @@ type ProjectRuntime = {
|
|
|
59
68
|
* destroy failed silently), not just the one runtime recorded as "previous."
|
|
60
69
|
*/
|
|
61
70
|
reconcile?(input: ProjectRuntimeReconcileInput): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Put an existing runtime to sleep without destroying it (e.g. Docker stop,
|
|
73
|
+
* Fly suspend). Provider-specific; omit when unsupported.
|
|
74
|
+
*/
|
|
75
|
+
sleep?(input: ProjectRuntimeSleepInput): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Resume a sleeping runtime. May return a fresh {@link ProjectRuntimeResult}
|
|
78
|
+
* when the base URL can change (e.g. Docker host port remap).
|
|
79
|
+
*/
|
|
80
|
+
wake?(input: ProjectRuntimeWakeInput): Promise<ProjectRuntimeResult | void>;
|
|
62
81
|
};
|
|
63
82
|
type ProjectPingTarget = {
|
|
64
83
|
baseUrl: string | null;
|
|
65
84
|
runtimeId: string | null;
|
|
66
85
|
};
|
|
67
86
|
//#endregion
|
|
68
|
-
export { ProjectRuntimeDatabase as a, ProjectRuntimeInput as c,
|
|
69
|
-
//# sourceMappingURL=runtime-
|
|
87
|
+
export { ProjectRuntimeDatabase as a, ProjectRuntimeInput as c, ProjectRuntimeSleepInput as d, ProjectRuntimeWakeInput as f, ProjectRuntime as i, ProjectRuntimeReconcileInput as l, parseOrgArtifactsFromEnv as m, OrgProjectDeploy as n, ProjectRuntimeDestroyInput as o, encodeOrgArtifacts as p, ProjectPingTarget as r, ProjectRuntimeHosting as s, OrgArtifactSpec as t, ProjectRuntimeResult as u };
|
|
88
|
+
//# sourceMappingURL=runtime-Cp906goK.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-Cp906goK.d.cts","names":[],"sources":["../src/runtime.ts"],"mappings":";KAAY,sBAAA;EACV,IAAA;EACA,IAAA;EACA,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,iBAAA;EACV,OAAA;EACA,SAAS;AAAA"}
|
|
@@ -14,7 +14,8 @@ type OrgProjectDeploy = {
|
|
|
14
14
|
name: string;
|
|
15
15
|
artifactId: string;
|
|
16
16
|
artifactStorageKey: string;
|
|
17
|
-
artifactVersion: number;
|
|
17
|
+
artifactVersion: number; /** Require an affirmative artifact-specific health record before promotion. */
|
|
18
|
+
requiresArtifactHealth?: boolean;
|
|
18
19
|
};
|
|
19
20
|
type OrgArtifactSpec = {
|
|
20
21
|
projectId: string;
|
|
@@ -49,6 +50,14 @@ type ProjectRuntimeResult = {
|
|
|
49
50
|
runtimeId: string;
|
|
50
51
|
baseUrl: string;
|
|
51
52
|
};
|
|
53
|
+
type ProjectRuntimeSleepInput = {
|
|
54
|
+
runtimeId: string;
|
|
55
|
+
hosting?: ProjectRuntimeHosting;
|
|
56
|
+
};
|
|
57
|
+
type ProjectRuntimeWakeInput = {
|
|
58
|
+
runtimeId: string;
|
|
59
|
+
hosting?: ProjectRuntimeHosting;
|
|
60
|
+
};
|
|
52
61
|
type ProjectRuntime = {
|
|
53
62
|
start(input: ProjectRuntimeInput): Promise<ProjectRuntimeResult>;
|
|
54
63
|
destroy?(input: ProjectRuntimeDestroyInput): Promise<void>;
|
|
@@ -59,11 +68,21 @@ type ProjectRuntime = {
|
|
|
59
68
|
* destroy failed silently), not just the one runtime recorded as "previous."
|
|
60
69
|
*/
|
|
61
70
|
reconcile?(input: ProjectRuntimeReconcileInput): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Put an existing runtime to sleep without destroying it (e.g. Docker stop,
|
|
73
|
+
* Fly suspend). Provider-specific; omit when unsupported.
|
|
74
|
+
*/
|
|
75
|
+
sleep?(input: ProjectRuntimeSleepInput): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Resume a sleeping runtime. May return a fresh {@link ProjectRuntimeResult}
|
|
78
|
+
* when the base URL can change (e.g. Docker host port remap).
|
|
79
|
+
*/
|
|
80
|
+
wake?(input: ProjectRuntimeWakeInput): Promise<ProjectRuntimeResult | void>;
|
|
62
81
|
};
|
|
63
82
|
type ProjectPingTarget = {
|
|
64
83
|
baseUrl: string | null;
|
|
65
84
|
runtimeId: string | null;
|
|
66
85
|
};
|
|
67
86
|
//#endregion
|
|
68
|
-
export { ProjectRuntimeDatabase as a, ProjectRuntimeInput as c,
|
|
69
|
-
//# sourceMappingURL=runtime-
|
|
87
|
+
export { ProjectRuntimeDatabase as a, ProjectRuntimeInput as c, ProjectRuntimeSleepInput as d, ProjectRuntimeWakeInput as f, ProjectRuntime as i, ProjectRuntimeReconcileInput as l, parseOrgArtifactsFromEnv as m, OrgProjectDeploy as n, ProjectRuntimeDestroyInput as o, encodeOrgArtifacts as p, ProjectPingTarget as r, ProjectRuntimeHosting as s, OrgArtifactSpec as t, ProjectRuntimeResult as u };
|
|
88
|
+
//# sourceMappingURL=runtime-Cp906goK.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-Cp906goK.d.mts","names":[],"sources":["../src/runtime.ts"],"mappings":";KAAY,sBAAA;EACV,IAAA;EACA,IAAA;EACA,QAAA;EACA,IAAA;EACA,QAAA;EACA,UAAA;EACA,cAAA,UAHA;EAKA,SAAA;AAAA;AAAA,KAGU,gBAAA;EACV,SAAA;EACA,IAAA;EACA,UAAA;EACA,kBAAA;EACA,eAAA;EAEA,sBAAA;AAAA;AAAA,KAGU,eAAA;EACV,SAAA;EACA,kBAAA;EACA,UAAA,UANA;EAQA,eAAA;AAAA;AAAA,KAGU,qBAAA;EACV,OAAO;AAAA;AAAA,KAGG,mBAAA;EACV,cAAA;EACA,QAAA,EAAU,gBAAA;EACV,QAAA,EAAU,sBAAA;EACV,OAAA,GAAU,qBAAA,EAXK;EAaf,GAAA,GAAM,MAAA,kBAVI;EAYV,iBAAA;AAAA;;iBAIc,kBAAA,CAAmB,SAA4B,EAAjB,eAAe;AAAA,iBAI7C,wBAAA,CACd,GAAA,GAAK,MAAA,CAAO,UAAA,GACX,eAAe;AAAA,KA6BN,0BAAA;EACV,SAAA;EACA,OAAA,GAAU,qBAAqB;AAAA;AAAA,KAGrB,4BAAA;EACV,cAAA,UA/CY;EAiDZ,aAAA;EACA,OAAA,GAAU,qBAAqB;AAAA;AAAA,KAGrB,oBAAA;EACV,SAAA;EACA,OAAO;AAAA;AAAA,KAGG,wBAAA;EACV,SAAA;EACA,OAAA,GAAU,qBAAqB;AAAA;AAAA,KAGrB,uBAAA;EACV,SAAA;EACA,OAAA,GAAU,qBAAqB;AAAA;AAAA,KAGrB,cAAA;EACV,KAAA,CAAM,KAAA,EAAO,mBAAA,GAAsB,OAAA,CAAQ,oBAAA;EAC3C,OAAA,EAAS,KAAA,EAAO,0BAAA,GAA6B,OAAA;EA5D/B;;;;;;EAmEd,SAAA,EAAW,KAAA,EAAO,4BAAA,GAA+B,OAAA;EAjEhD;;AAAe;AA6BlB;EAyCE,KAAA,EAAO,KAAA,EAAO,wBAAA,GAA2B,OAAA;;;;;EAKzC,IAAA,EAAM,KAAA,EAAO,uBAAA,GAA0B,OAAA,CAAQ,oBAAA;AAAA;AAAA,KAGrC,iBAAA;EACV,OAAA;EACA,SAAS;AAAA"}
|
|
@@ -91,7 +91,8 @@ const FORBIDDEN_WORKER_ENV_KEYS = [
|
|
|
91
91
|
"POSTGRES_PASSWORD",
|
|
92
92
|
"PLATFORM_WORKER_TOKEN",
|
|
93
93
|
"STRIPE_SECRET_KEY",
|
|
94
|
-
"CREDENTIAL_ENCRYPTION_KEY"
|
|
94
|
+
"CREDENTIAL_ENCRYPTION_KEY",
|
|
95
|
+
"TURNSTILE_SECRET"
|
|
95
96
|
];
|
|
96
97
|
/** Provider and gateway env forwarded from the platform into project servers. */
|
|
97
98
|
const PROVIDER_ENV_KEYS = [
|
|
@@ -206,4 +207,4 @@ function sleep(ms) {
|
|
|
206
207
|
//#endregion
|
|
207
208
|
export { PROJECT_SERVER_ROOT as S, PROJECT_SERVER_FRAMEWORK_NODE_MODULES as _, formatDockerEnv as a, PROJECT_SERVER_IMAGE as b, resolveRuntimeLaunch as c, rewriteLoopbackUrl as d, mintOrgWorkerToken as f, PROJECT_SERVER_DEPLOY_STATUS as g, resolveWorkerRuntimeConfig as h, buildRuntimeEnv as i, resolveWorkerPlatformUrl as l, WorkerRuntimeConfigError as m, DEV_PLATFORM_WORKER_TOKEN as n, resolvePlatformWorkerToken as o, verifyOrgWorkerToken as p, FORBIDDEN_WORKER_ENV_KEYS as r, resolveProjectServerImage as s, waitForHealth as t, rewriteLoopbackHost as u, PROJECT_SERVER_FRAMEWORK_ROOT as v, PROJECT_SERVER_PORT as x, PROJECT_SERVER_HEALTH as y };
|
|
208
209
|
|
|
209
|
-
//# sourceMappingURL=wait-for-health-
|
|
210
|
+
//# sourceMappingURL=wait-for-health-B4-AM1NR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait-for-health-B4-AM1NR.mjs","names":[],"sources":["../src/constants.ts","../src/worker-runtime-config.ts","../src/org-worker-token.ts","../src/runtime-env.ts","../src/wait-for-health.ts"],"sourcesContent":["export const PROJECT_SERVER_IMAGE = \"keystroke/project-server:local\";\n\nexport const PROJECT_SERVER_PORT = 3000;\n\nexport const PROJECT_SERVER_ROOT = \"/app\";\n\nexport const PROJECT_SERVER_FRAMEWORK_ROOT = \"/opt/keystroke\";\n\nexport const PROJECT_SERVER_FRAMEWORK_NODE_MODULES = `${PROJECT_SERVER_FRAMEWORK_ROOT}/node_modules`;\n\nexport const PROJECT_SERVER_HEALTH = {\n path: \"/health\",\n port: PROJECT_SERVER_PORT,\n} as const;\n\nexport const PROJECT_SERVER_DEPLOY_STATUS = {\n path: \"/deploy-status\",\n port: PROJECT_SERVER_PORT,\n} as const;\n","import { resolvePlatformWorkerToken, resolveWorkerPlatformUrl } from \"./runtime-env\";\n\n/** Resolved platform ↔ project-server worker auth contract. */\nexport type WorkerRuntimeConfig = {\n /** Platform API base URL reachable from the project-server runtime. */\n platformUrl: string;\n /** Bearer token for platform `/internal` routes. */\n workerToken: string;\n};\n\nexport class WorkerRuntimeConfigError extends Error {\n readonly missing: readonly string[];\n\n constructor(missing: string[]) {\n super(\n `Worker runtime config incomplete (missing: ${missing.join(\", \")}). ` +\n \"In production set PLATFORM_WORKER_TOKEN and PUBLIC_PLATFORM_URL (or PLATFORM_URL).\",\n );\n this.name = \"WorkerRuntimeConfigError\";\n this.missing = missing;\n }\n}\n\n/** Fail fast when the platform cannot start worker-mode project servers. */\nexport function resolveWorkerRuntimeConfig(\n source: NodeJS.ProcessEnv = process.env,\n): WorkerRuntimeConfig {\n const platformUrl = resolveWorkerPlatformUrl(source);\n const workerToken = resolvePlatformWorkerToken(source);\n const missing: string[] = [];\n\n if (!platformUrl) {\n missing.push(\"PUBLIC_PLATFORM_URL or PLATFORM_URL\");\n }\n\n if (!workerToken) {\n missing.push(\"PLATFORM_WORKER_TOKEN\");\n }\n\n if (missing.length > 0) {\n throw new WorkerRuntimeConfigError(missing);\n }\n\n return { platformUrl: platformUrl!, workerToken: workerToken! };\n}\n","import { createHmac, timingSafeEqual } from \"node:crypto\";\n\nfunction sign(secret: string, organizationId: string): string {\n return createHmac(\"sha256\", secret).update(`org-worker:${organizationId}`).digest(\"base64url\");\n}\n\n/**\n * Per-org worker token: `{organizationId}.{hmac}`. Self-describing so the\n * platform can tell which org a machine is calling as, and stateless — verified\n * by re-signing with the shared `PLATFORM_WORKER_TOKEN` secret.\n */\nexport function mintOrgWorkerToken(secret: string, organizationId: string): string {\n return `${organizationId}.${sign(secret, organizationId)}`;\n}\n\nexport type VerifiedOrgWorkerToken = {\n organizationId: string;\n};\n\nexport function verifyOrgWorkerToken(\n secret: string | undefined,\n token: string | undefined,\n): VerifiedOrgWorkerToken | undefined {\n if (!secret || !token) {\n return undefined;\n }\n\n // The signature is base64url (no dots), so the last dot ends the org id.\n const separator = token.lastIndexOf(\".\");\n if (separator <= 0) {\n return undefined;\n }\n\n const organizationId = token.slice(0, separator);\n const signature = Buffer.from(token.slice(separator + 1));\n const expected = Buffer.from(sign(secret, organizationId));\n if (signature.length !== expected.length || !timingSafeEqual(signature, expected)) {\n return undefined;\n }\n\n return { organizationId };\n}\n","import {\n LOCAL_PLATFORM_ORIGIN,\n resolveExplicitPublicPlatformOrigin,\n} from \"@keystrokehq/shared/platform-origin\";\n\nimport type { ProjectRuntimeDatabase } from \"./runtime\";\nimport { encodeOrgArtifacts, type OrgArtifactSpec } from \"./runtime\";\nimport {\n PROJECT_SERVER_FRAMEWORK_NODE_MODULES,\n PROJECT_SERVER_HEALTH,\n PROJECT_SERVER_IMAGE,\n PROJECT_SERVER_PORT,\n PROJECT_SERVER_ROOT,\n} from \"./constants\";\nimport type { HostingOptions } from \"./plugin\";\nimport { resolveWorkerRuntimeConfig } from \"./worker-runtime-config\";\nimport { mintOrgWorkerToken } from \"./org-worker-token\";\n\n/** Non-secret runtime config forwarded into org workers. Never include platform secrets. */\nconst RUNTIME_ENV_KEYS = [\n \"PUBLIC_PLATFORM_URL\",\n \"PUBLIC_PLATFORM_PROXY_URL\",\n \"PUBLIC_WEB_URL\",\n \"UPSTASH_REDIS_URL\",\n \"REDIS_URL\",\n \"KEYSTROKE_QUEUE_PREFIX\",\n] as const;\n\n/**\n * Observability ingest config for org workers (PostHog error tracking + crash reports).\n * Ingest tokens only — never forward `POSTHOG_API_KEY` (management) into workers.\n */\nconst OBSERVABILITY_ENV_KEYS = [\n \"POSTHOG_PROJECT_TOKEN\",\n \"POSTHOG_HOST\",\n \"POSTHOG_FLUSH_MODE\",\n \"KEYSTROKE_ENVIRONMENT\",\n \"KEYSTROKE_RELEASE\",\n] as const;\n\n/** Env keys that must never be forwarded into untrusted org workers. */\nexport const FORBIDDEN_WORKER_ENV_KEYS = [\n \"BETTER_AUTH_SECRET\",\n \"DATABASE_URL\",\n \"POSTHOG_API_KEY\",\n \"POSTGRES_PASSWORD\",\n \"PLATFORM_WORKER_TOKEN\",\n \"STRIPE_SECRET_KEY\",\n \"CREDENTIAL_ENCRYPTION_KEY\",\n \"TURNSTILE_SECRET\",\n] as const;\n\n/** Provider and gateway env forwarded from the platform into project servers. */\nconst PROVIDER_ENV_KEYS = [\n \"ANTHROPIC_API_KEY\",\n \"OPENAI_API_KEY\",\n \"AI_GATEWAY_API_KEY\",\n \"AI_GATEWAY_BASE_URL\",\n] as const;\n\n/** Shared dev token when `PLATFORM_WORKER_TOKEN` is unset (non-production only). */\nexport const DEV_PLATFORM_WORKER_TOKEN = \"dev-platform-worker-token\";\n\nexport type RuntimeLaunchSpec = {\n image: string;\n env: Record<string, string>;\n port: number;\n health: typeof PROJECT_SERVER_HEALTH;\n};\n\n/**\n * Builds the launch spec for an org worker. Each deploy artifact is encoded in\n * `KEYSTROKE_ORG_ARTIFACTS` — there is no base image, so at least one artifact is required.\n */\nexport function resolveRuntimeLaunch(\n options: HostingOptions,\n artifacts: OrgArtifactSpec[],\n database: ProjectRuntimeDatabase,\n extraEnv?: Record<string, string>,\n): RuntimeLaunchSpec {\n if (artifacts.length === 0) {\n throw new Error(\"Cannot start an org worker without at least one artifact\");\n }\n\n const env = options.env ?? process.env;\n\n return {\n image: resolveProjectServerImage(env, options.image),\n env: buildRuntimeEnv(env, artifacts, database, extraEnv),\n port: PROJECT_SERVER_PORT,\n health: PROJECT_SERVER_HEALTH,\n };\n}\n\n/** @deprecated Single-project launch — prefer org {@link resolveRuntimeLaunch}. */\nexport function resolveSingleProjectRuntimeLaunch(\n options: HostingOptions,\n artifact: { storageKey: string; artifactId: string; artifactVersion: number },\n database: ProjectRuntimeDatabase & { projectId: string },\n extraEnv?: Record<string, string>,\n): RuntimeLaunchSpec {\n return resolveRuntimeLaunch(\n options,\n [\n {\n projectId: database.projectId,\n artifactStorageKey: artifact.storageKey,\n artifactId: artifact.artifactId,\n artifactVersion: artifact.artifactVersion,\n },\n ],\n database,\n extraEnv,\n );\n}\n\n/** Env vars passed into the org worker container/machine. */\nexport function buildRuntimeEnv(\n source: NodeJS.ProcessEnv,\n artifacts: OrgArtifactSpec[],\n database: ProjectRuntimeDatabase,\n extraEnv?: Record<string, string>,\n): Record<string, string> {\n const entries = new Map<string, string>([\n [\"PORT\", String(PROJECT_SERVER_PORT)],\n [\"KEYSTROKE_ROOT\", PROJECT_SERVER_ROOT],\n [\"KEYSTROKE_RUNTIME_NODE_MODULES\", PROJECT_SERVER_FRAMEWORK_NODE_MODULES],\n [\"KEYSTROKE_ORG_ARTIFACTS\", encodeOrgArtifacts(artifacts)],\n [\"ORGANIZATION_ID\", database.organizationId],\n [\"TENANT_ID\", database.organizationId],\n ]);\n\n for (const key of RUNTIME_ENV_KEYS) {\n const value = source[key]?.trim();\n if (!value) {\n continue;\n }\n entries.set(key, value);\n }\n\n for (const key of OBSERVABILITY_ENV_KEYS) {\n const value = source[key]?.trim();\n if (!value) {\n continue;\n }\n entries.set(key, value);\n }\n\n // OSS self-host: forward BYO provider/gateway env. Cloud llmProxy supplies extraEnv instead.\n if (!extraEnv) {\n for (const key of PROVIDER_ENV_KEYS) {\n const value = source[key]?.trim();\n if (value) {\n entries.set(key, value);\n }\n }\n }\n\n // Project containers always run as workers: they resolve credentials/secrets through\n // the platform internal API and are deliberately never given the decryption key.\n // The token is minted per org so the platform knows which org a machine calls as.\n const worker = resolveWorkerRuntimeConfig(source);\n entries.set(\"PLATFORM_URL\", worker.platformUrl);\n entries.set(\n \"WORKER_INTERNAL_TOKEN\",\n mintOrgWorkerToken(worker.workerToken, database.organizationId),\n );\n\n if (extraEnv) {\n for (const [key, value] of Object.entries(extraEnv)) {\n entries.set(key, value);\n }\n }\n\n for (const key of FORBIDDEN_WORKER_ENV_KEYS) {\n entries.delete(key);\n }\n\n return Object.fromEntries(entries);\n}\n\nexport function resolvePlatformWorkerToken(\n source: NodeJS.ProcessEnv = process.env,\n): string | undefined {\n const explicit = source.PLATFORM_WORKER_TOKEN?.trim() ?? source.WORKER_INTERNAL_TOKEN?.trim();\n if (explicit) {\n return explicit;\n }\n\n if (source.NODE_ENV === \"production\") {\n return undefined;\n }\n\n return DEV_PLATFORM_WORKER_TOKEN;\n}\n\n/** Platform API URL reachable from a project-server container. */\nexport function resolveWorkerPlatformUrl(\n source: NodeJS.ProcessEnv = process.env,\n): string | undefined {\n const raw =\n source.PLATFORM_URL?.trim() ??\n resolveExplicitPublicPlatformOrigin(source) ??\n (source.NODE_ENV === \"production\" ? undefined : LOCAL_PLATFORM_ORIGIN);\n if (!raw) {\n return undefined;\n }\n\n return rewriteLoopbackUrl(raw);\n}\n\n/** Rewrite loopback hosts so containers can reach Postgres and other host services. */\nexport function rewriteLoopbackHost(host: string): string {\n if (host === \"localhost\" || host === \"127.0.0.1\") {\n return \"host.docker.internal\";\n }\n\n return host;\n}\n\nexport function rewriteLoopbackUrl(url: string): string {\n try {\n const parsed = new URL(url);\n parsed.hostname = rewriteLoopbackHost(parsed.hostname);\n return parsed.toString().replace(/\\/$/, \"\");\n } catch {\n return url;\n }\n}\n\n/** dockerode expects `KEY=value` strings. */\nexport function formatDockerEnv(env: Record<string, string>): string[] {\n return Object.entries(env).map(([key, value]) => `${key}=${value}`);\n}\n\nexport function resolveProjectServerImage(\n env: NodeJS.ProcessEnv = process.env,\n override?: string,\n): string {\n return override ?? env.PROJECT_DOCKER_IMAGE ?? env.TENANT_DOCKER_IMAGE ?? PROJECT_SERVER_IMAGE;\n}\n","import { PROJECT_SERVER_HEALTH } from \"./constants\";\n\nconst DEFAULT_TIMEOUT_MS = 120_000;\nconst DEFAULT_INTERVAL_MS = 500;\n\nexport type WaitForHealthOptions = {\n timeoutMs?: number;\n intervalMs?: number;\n fetchImpl?: typeof fetch;\n};\n\nexport async function waitForHealth(\n baseUrl: string,\n options: WaitForHealthOptions = {},\n): Promise<void> {\n const fetchImpl = options.fetchImpl ?? fetch;\n const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const intervalMs = options.intervalMs ?? DEFAULT_INTERVAL_MS;\n const deadline = Date.now() + timeoutMs;\n const url = new URL(PROJECT_SERVER_HEALTH.path, baseUrl);\n\n while (Date.now() < deadline) {\n try {\n const response = await fetchImpl(url, { signal: AbortSignal.timeout(2_000) });\n if (response.ok) {\n return;\n }\n } catch {\n // retry until timeout\n }\n\n await sleep(intervalMs);\n }\n\n throw new Error(`Project server health check timed out after ${timeoutMs}ms (${url})`);\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n"],"mappings":";;;;AAAA,MAAa,uBAAuB;AAEpC,MAAa,sBAAsB;AAEnC,MAAa,sBAAsB;AAEnC,MAAa,gCAAgC;AAE7C,MAAa,wCAAwC,GAAG,8BAA8B;AAEtF,MAAa,wBAAwB;CACnC,MAAM;CACN,MAAM;AACR;AAEA,MAAa,+BAA+B;CAC1C,MAAM;CACN,MAAM;AACR;;;ACRA,IAAa,2BAAb,cAA8C,MAAM;CAClD;CAEA,YAAY,SAAmB;EAC7B,MACE,8CAA8C,QAAQ,KAAK,IAAI,EAAE,sFAEnE;EACA,KAAK,OAAO;EACZ,KAAK,UAAU;CACjB;AACF;;AAGA,SAAgB,2BACd,SAA4B,QAAQ,KACf;CACrB,MAAM,cAAc,yBAAyB,MAAM;CACnD,MAAM,cAAc,2BAA2B,MAAM;CACrD,MAAM,UAAoB,CAAC;CAE3B,IAAI,CAAC,aACH,QAAQ,KAAK,qCAAqC;CAGpD,IAAI,CAAC,aACH,QAAQ,KAAK,uBAAuB;CAGtC,IAAI,QAAQ,SAAS,GACnB,MAAM,IAAI,yBAAyB,OAAO;CAG5C,OAAO;EAAe;EAA2B;CAAa;AAChE;;;AC1CA,SAAS,KAAK,QAAgB,gBAAgC;CAC5D,OAAO,WAAW,UAAU,MAAM,EAAE,OAAO,cAAc,gBAAgB,EAAE,OAAO,WAAW;AAC/F;;;;;;AAOA,SAAgB,mBAAmB,QAAgB,gBAAgC;CACjF,OAAO,GAAG,eAAe,GAAG,KAAK,QAAQ,cAAc;AACzD;AAMA,SAAgB,qBACd,QACA,OACoC;CACpC,IAAI,CAAC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S,EAAE,QAAQ,OAAO,EAAE;CAC5C,QAAQ;EACN,OAAO;CACT;AACF;;AAGA,SAAgB,gBAAgB,KAAuC;CACrE,OAAO,OAAO,QAAQ,GAAG,EAAE,KAAK,CAAC,KAAK,WAAW,GAAG,IAAI,GAAG,OAAO;AACpE;AAEA,SAAgB,0BACd,MAAyB,QAAQ,KACjC,UACQ;CACR,OAAO,YAAY,IAAI,wBAAwB,IAAI,uBAAA;AACrD;;;AC9OA,MAAM,qBAAqB;AAC3B,MAAM,sBAAsB;AAQ5B,eAAsB,cACpB,SACA,UAAgC,CAAC,GAClB;CACf,MAAM,YAAY,QAAQ,aAAa;CACvC,MAAM,YAAY,QAAQ,aAAa;CACvC,MAAM,aAAa,QAAQ,cAAc;CACzC,MAAM,WAAW,KAAK,IAAI,IAAI;CAC9B,MAAM,MAAM,IAAI,IAAI,sBAAsB,MAAM,OAAO;CAEvD,OAAO,KAAK,IAAI,IAAI,UAAU;EAC5B,IAAI;GAEF,KAAI,MADmB,UAAU,KAAK,EAAE,QAAQ,YAAY,QAAQ,GAAK,EAAE,CAAC,GAC/D,IACX;EAEJ,QAAQ,CAER;EAEA,MAAM,MAAM,UAAU;CACxB;CAEA,MAAM,IAAI,MAAM,+CAA+C,UAAU,MAAM,IAAI,EAAE;AACvF;AAEA,SAAS,MAAM,IAA2B;CACxC,OAAO,IAAI,SAAS,YAAY;EAC9B,WAAW,SAAS,EAAE;CACxB,CAAC;AACH"}
|
|
@@ -91,7 +91,8 @@ const FORBIDDEN_WORKER_ENV_KEYS = [
|
|
|
91
91
|
"POSTGRES_PASSWORD",
|
|
92
92
|
"PLATFORM_WORKER_TOKEN",
|
|
93
93
|
"STRIPE_SECRET_KEY",
|
|
94
|
-
"CREDENTIAL_ENCRYPTION_KEY"
|
|
94
|
+
"CREDENTIAL_ENCRYPTION_KEY",
|
|
95
|
+
"TURNSTILE_SECRET"
|
|
95
96
|
];
|
|
96
97
|
/** Provider and gateway env forwarded from the platform into project servers. */
|
|
97
98
|
const PROVIDER_ENV_KEYS = [
|
|
@@ -337,4 +338,4 @@ Object.defineProperty(exports, "waitForHealth", {
|
|
|
337
338
|
}
|
|
338
339
|
});
|
|
339
340
|
|
|
340
|
-
//# sourceMappingURL=wait-for-health-
|
|
341
|
+
//# sourceMappingURL=wait-for-health-CObmNF8o.cjs.map
|