gencow 0.1.283 → 0.1.284
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/core/index.js +3 -0
- package/lib/env-command.mjs +50 -4
- package/package.json +3 -3
- package/runtime/server.mjs +57 -51
- package/runtime/tooling.mjs +3 -0
package/core/index.js
CHANGED
|
@@ -4126,6 +4126,9 @@ var RESERVED_TENANT_RUNTIME_ENV_KEYS = [
|
|
|
4126
4126
|
"GENCOW_MEMORY_MB",
|
|
4127
4127
|
"BUN_JSC_forceRAMSize",
|
|
4128
4128
|
"MIMALLOC_PURGE_DELAY",
|
|
4129
|
+
"BUN_JSC_numberOfGCMarkers",
|
|
4130
|
+
"BUN_JSC_numberOfDFGCompilerThreads",
|
|
4131
|
+
"BUN_JSC_numberOfFTLCompilerThreads",
|
|
4129
4132
|
"NODE_PATH"
|
|
4130
4133
|
];
|
|
4131
4134
|
var RESERVED_TENANT_RUNTIME_ENV_KEY_SET = new Set(RESERVED_TENANT_RUNTIME_ENV_KEYS);
|
package/lib/env-command.mjs
CHANGED
|
@@ -9,9 +9,12 @@ import {
|
|
|
9
9
|
import { resolveCloudAppTargetWithServerEnvironment } from "./cloud-target-environment.mjs";
|
|
10
10
|
import { cloudTargetRejectionMessage, prodRetryCommandLine, redactConfigSetValue, redactEnvPairs } from "./deploy-app-target.mjs";
|
|
11
11
|
import { BOLD, CYAN, DIM, GREEN, RESET, error, info, log, success, warn } from "./output.mjs";
|
|
12
|
+
import { renderLifecycleFailure } from "./app-lifecycle-format.mjs";
|
|
12
13
|
import { platformFetch, requireCreds, rpcQuery } from "./platform-client.mjs";
|
|
13
14
|
|
|
14
15
|
const ENV_RESPONSE_UNREADABLE_CODE = "ENV_RESPONSE_UNREADABLE";
|
|
16
|
+
const ENV_APP_NOT_FOUND_REASON = "App not found";
|
|
17
|
+
const ENV_APP_NOT_FOUND_CODE = "APP_NOT_FOUND";
|
|
15
18
|
|
|
16
19
|
// Reads a failed platform response. A JSON `null`, an empty body, or a non-object body
|
|
17
20
|
// normalizes to `message: null`, so callers never dereference the parsed value.
|
|
@@ -19,7 +22,24 @@ async function readEnvErrorResponse(response) {
|
|
|
19
22
|
const parsed = await response.json().catch(() => null);
|
|
20
23
|
const body = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
21
24
|
const message = typeof body?.error === "string" && body.error.trim() ? body.error.trim() : null;
|
|
22
|
-
|
|
25
|
+
const code = typeof body?.code === "string" ? body.code : null;
|
|
26
|
+
return { ...envResponseFacts(response), message, code };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// The Platform's typed missing-app answer is code APP_NOT_FOUND. Servers that predate the code answer
|
|
30
|
+
// 404 with the text "App not found", so that text is used only when no code is present.
|
|
31
|
+
function isEnvAppNotFound(failure) {
|
|
32
|
+
if (failure.status !== 404) return false;
|
|
33
|
+
if (typeof failure.code === "string") return failure.code === ENV_APP_NOT_FOUND_CODE;
|
|
34
|
+
return failure.message === ENV_APP_NOT_FOUND_REASON;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Shared typed rendering (same catalog as app status); the stage and correlation are the only per-call facts.
|
|
38
|
+
function envAppNotFoundOutput(failure, appId, stage) {
|
|
39
|
+
return renderLifecycleFailure("APP_NOT_FOUND", {
|
|
40
|
+
name: appId,
|
|
41
|
+
extra: [`Stage: ${stage}`, `Correlation: ${failure.correlationId ?? "none returned"}`],
|
|
42
|
+
});
|
|
23
43
|
}
|
|
24
44
|
|
|
25
45
|
function envResponseFacts(response) {
|
|
@@ -331,6 +351,15 @@ export function createEnvCommand(deps = {}) {
|
|
|
331
351
|
// A `null` or non-object error body must not turn into a TypeError that hides the HTTP status.
|
|
332
352
|
const body = await res.json().catch(() => null);
|
|
333
353
|
const reason = typeof body?.error === "string" && body.error ? body.error : null;
|
|
354
|
+
const failure = {
|
|
355
|
+
...envResponseFacts(res),
|
|
356
|
+
message: reason,
|
|
357
|
+
code: typeof body?.code === "string" ? body.code : null,
|
|
358
|
+
};
|
|
359
|
+
if (isEnvAppNotFound(failure)) {
|
|
360
|
+
error(envAppNotFoundOutput(failure, appId, "env_list"));
|
|
361
|
+
return 1;
|
|
362
|
+
}
|
|
334
363
|
throw new Error(reason ?? `HTTP ${res.status}`);
|
|
335
364
|
}
|
|
336
365
|
const vars = await res.json().catch(() => null);
|
|
@@ -421,8 +450,14 @@ export function createEnvCommand(deps = {}) {
|
|
|
421
450
|
body: JSON.stringify({ key: name, value, env: envTarget }),
|
|
422
451
|
});
|
|
423
452
|
if (!res.ok) {
|
|
453
|
+
const failure = await readEnvErrorResponse(res);
|
|
454
|
+
if (isEnvAppNotFound(failure)) {
|
|
455
|
+
error(envAppNotFoundOutput(failure, appId, "env_set"));
|
|
456
|
+
commandFailed = true;
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
424
459
|
throw new Error(
|
|
425
|
-
formatEnvErrorMessage(
|
|
460
|
+
formatEnvErrorMessage(failure, {
|
|
426
461
|
stage: "env_set",
|
|
427
462
|
checkCommand: envListCommand(appId, envTarget),
|
|
428
463
|
}),
|
|
@@ -476,8 +511,14 @@ export function createEnvCommand(deps = {}) {
|
|
|
476
511
|
},
|
|
477
512
|
);
|
|
478
513
|
if (!res.ok) {
|
|
514
|
+
const failure = await readEnvErrorResponse(res);
|
|
515
|
+
if (isEnvAppNotFound(failure)) {
|
|
516
|
+
error(envAppNotFoundOutput(failure, appId, "env_unset"));
|
|
517
|
+
commandFailed = true;
|
|
518
|
+
continue;
|
|
519
|
+
}
|
|
479
520
|
throw new Error(
|
|
480
|
-
formatEnvErrorMessage(
|
|
521
|
+
formatEnvErrorMessage(failure, {
|
|
481
522
|
stage: "env_unset",
|
|
482
523
|
checkCommand: envListCommand(appId, envTarget),
|
|
483
524
|
}),
|
|
@@ -572,8 +613,13 @@ export function createEnvCommand(deps = {}) {
|
|
|
572
613
|
body: JSON.stringify({ vars, env: envTarget }),
|
|
573
614
|
});
|
|
574
615
|
if (!res.ok) {
|
|
616
|
+
const failure = await readEnvErrorResponse(res);
|
|
617
|
+
if (isEnvAppNotFound(failure)) {
|
|
618
|
+
error(envAppNotFoundOutput(failure, appId, "env_push"));
|
|
619
|
+
return 1;
|
|
620
|
+
}
|
|
575
621
|
throw new Error(
|
|
576
|
-
formatEnvErrorMessage(
|
|
622
|
+
formatEnvErrorMessage(failure, {
|
|
577
623
|
stage: "env_push",
|
|
578
624
|
checkCommand: envListCommand(appId, envTarget),
|
|
579
625
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gencow",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.284",
|
|
4
4
|
"description": "Gencow — AI Backend Engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"ai": "^6.0.314",
|
|
41
41
|
"better-auth": "1.7.11",
|
|
42
42
|
"postgres": "^3.4.9",
|
|
43
|
-
"@gencow/client": "0.2.8",
|
|
44
43
|
"@gencow/core": "0.1.47",
|
|
44
|
+
"@gencow/shared": "0.0.0",
|
|
45
45
|
"@gencow/react": "0.2.8",
|
|
46
46
|
"@gencow/server": "0.1.3",
|
|
47
|
-
"@gencow/
|
|
47
|
+
"@gencow/client": "0.2.8"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "node scripts/bundle-core.mjs && node scripts/bundle-shared.mjs && node scripts/bundle-server.mjs",
|