@osva-ai/cli 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/README.md +36 -0
  2. package/dist/bin/osva.js +26 -0
  3. package/dist/bin/osva.js.map +1 -1
  4. package/dist/commands/index.js +6 -0
  5. package/dist/commands/index.js.map +1 -1
  6. package/dist/doctor/redact.d.ts.map +1 -1
  7. package/dist/doctor/redact.js +3 -1
  8. package/dist/doctor/redact.js.map +1 -1
  9. package/dist/doctor/run-doctor.d.ts +2 -1
  10. package/dist/doctor/run-doctor.d.ts.map +1 -1
  11. package/dist/doctor/run-doctor.js +1 -1
  12. package/dist/doctor/run-doctor.js.map +1 -1
  13. package/dist/doctor/streaming-redact.d.ts +11 -0
  14. package/dist/doctor/streaming-redact.d.ts.map +1 -0
  15. package/dist/doctor/streaming-redact.js +29 -0
  16. package/dist/doctor/streaming-redact.js.map +1 -0
  17. package/dist/platform/compose-inspect.d.ts +9 -0
  18. package/dist/platform/compose-inspect.d.ts.map +1 -0
  19. package/dist/platform/compose-inspect.js +114 -0
  20. package/dist/platform/compose-inspect.js.map +1 -0
  21. package/dist/platform/doctor.d.ts +10 -0
  22. package/dist/platform/doctor.d.ts.map +1 -0
  23. package/dist/platform/doctor.js +154 -0
  24. package/dist/platform/doctor.js.map +1 -0
  25. package/dist/platform/format.d.ts +10 -0
  26. package/dist/platform/format.d.ts.map +1 -0
  27. package/dist/platform/format.js +73 -0
  28. package/dist/platform/format.js.map +1 -0
  29. package/dist/platform/index.d.ts +9 -0
  30. package/dist/platform/index.d.ts.map +1 -0
  31. package/dist/platform/index.js +143 -0
  32. package/dist/platform/index.js.map +1 -0
  33. package/dist/platform/lifecycle.d.ts +20 -0
  34. package/dist/platform/lifecycle.d.ts.map +1 -0
  35. package/dist/platform/lifecycle.js +136 -0
  36. package/dist/platform/lifecycle.js.map +1 -0
  37. package/dist/platform/logs.d.ts +12 -0
  38. package/dist/platform/logs.d.ts.map +1 -0
  39. package/dist/platform/logs.js +81 -0
  40. package/dist/platform/logs.js.map +1 -0
  41. package/dist/platform/readiness.d.ts +9 -0
  42. package/dist/platform/readiness.d.ts.map +1 -0
  43. package/dist/platform/readiness.js +58 -0
  44. package/dist/platform/readiness.js.map +1 -0
  45. package/dist/platform/resolve-installation.d.ts +5 -0
  46. package/dist/platform/resolve-installation.d.ts.map +1 -0
  47. package/dist/platform/resolve-installation.js +115 -0
  48. package/dist/platform/resolve-installation.js.map +1 -0
  49. package/dist/platform/services.d.ts +7 -0
  50. package/dist/platform/services.d.ts.map +1 -0
  51. package/dist/platform/services.js +21 -0
  52. package/dist/platform/services.js.map +1 -0
  53. package/dist/platform/status.d.ts +7 -0
  54. package/dist/platform/status.d.ts.map +1 -0
  55. package/dist/platform/status.js +60 -0
  56. package/dist/platform/status.js.map +1 -0
  57. package/dist/platform/types.d.ts +37 -0
  58. package/dist/platform/types.d.ts.map +1 -0
  59. package/dist/platform/types.js +8 -0
  60. package/dist/platform/types.js.map +1 -0
  61. package/dist/platform/upgrade/backup-policy.d.ts +4 -0
  62. package/dist/platform/upgrade/backup-policy.d.ts.map +1 -0
  63. package/dist/platform/upgrade/backup-policy.js +20 -0
  64. package/dist/platform/upgrade/backup-policy.js.map +1 -0
  65. package/dist/platform/upgrade/catalog.d.ts +26 -0
  66. package/dist/platform/upgrade/catalog.d.ts.map +1 -0
  67. package/dist/platform/upgrade/catalog.js +56 -0
  68. package/dist/platform/upgrade/catalog.js.map +1 -0
  69. package/dist/platform/upgrade/options.d.ts +8 -0
  70. package/dist/platform/upgrade/options.d.ts.map +1 -0
  71. package/dist/platform/upgrade/options.js +17 -0
  72. package/dist/platform/upgrade/options.js.map +1 -0
  73. package/dist/platform/upgrade/preflight.d.ts +25 -0
  74. package/dist/platform/upgrade/preflight.d.ts.map +1 -0
  75. package/dist/platform/upgrade/preflight.js +91 -0
  76. package/dist/platform/upgrade/preflight.js.map +1 -0
  77. package/dist/platform/upgrade/run-upgrade.d.ts +22 -0
  78. package/dist/platform/upgrade/run-upgrade.d.ts.map +1 -0
  79. package/dist/platform/upgrade/run-upgrade.js +253 -0
  80. package/dist/platform/upgrade/run-upgrade.js.map +1 -0
  81. package/dist/platform/upgrade/state.d.ts +31 -0
  82. package/dist/platform/upgrade/state.d.ts.map +1 -0
  83. package/dist/platform/upgrade/state.js +129 -0
  84. package/dist/platform/upgrade/state.js.map +1 -0
  85. package/dist/platform/upgrade/version.d.ts +11 -0
  86. package/dist/platform/upgrade/version.d.ts.map +1 -0
  87. package/dist/platform/upgrade/version.js +70 -0
  88. package/dist/platform/upgrade/version.js.map +1 -0
  89. package/dist/platform/upgrade-guard.d.ts +2 -0
  90. package/dist/platform/upgrade-guard.d.ts.map +1 -0
  91. package/dist/platform/upgrade-guard.js +12 -0
  92. package/dist/platform/upgrade-guard.js.map +1 -0
  93. package/dist/setup/acceptance-install.d.ts +15 -0
  94. package/dist/setup/acceptance-install.d.ts.map +1 -0
  95. package/dist/setup/acceptance-install.js +44 -0
  96. package/dist/setup/acceptance-install.js.map +1 -0
  97. package/dist/setup/atomic-write.d.ts +4 -0
  98. package/dist/setup/atomic-write.d.ts.map +1 -0
  99. package/dist/setup/atomic-write.js +19 -0
  100. package/dist/setup/atomic-write.js.map +1 -0
  101. package/dist/setup/bootstrap-capture.d.ts +9 -0
  102. package/dist/setup/bootstrap-capture.d.ts.map +1 -0
  103. package/dist/setup/bootstrap-capture.js +64 -0
  104. package/dist/setup/bootstrap-capture.js.map +1 -0
  105. package/dist/setup/compose-exec.d.ts +21 -0
  106. package/dist/setup/compose-exec.d.ts.map +1 -0
  107. package/dist/setup/compose-exec.js +55 -0
  108. package/dist/setup/compose-exec.js.map +1 -0
  109. package/dist/setup/compose-project.d.ts +3 -0
  110. package/dist/setup/compose-project.d.ts.map +1 -0
  111. package/dist/setup/compose-project.js +12 -0
  112. package/dist/setup/compose-project.js.map +1 -0
  113. package/dist/setup/compose-template-root.d.ts +3 -0
  114. package/dist/setup/compose-template-root.d.ts.map +1 -0
  115. package/dist/setup/compose-template-root.js +8 -0
  116. package/dist/setup/compose-template-root.js.map +1 -0
  117. package/dist/setup/distribution.d.ts +13 -0
  118. package/dist/setup/distribution.d.ts.map +1 -0
  119. package/dist/setup/distribution.js +55 -0
  120. package/dist/setup/distribution.js.map +1 -0
  121. package/dist/setup/env-file.d.ts +23 -0
  122. package/dist/setup/env-file.d.ts.map +1 -0
  123. package/dist/setup/env-file.js +141 -0
  124. package/dist/setup/env-file.js.map +1 -0
  125. package/dist/setup/format.d.ts +4 -0
  126. package/dist/setup/format.d.ts.map +1 -0
  127. package/dist/setup/format.js +58 -0
  128. package/dist/setup/format.js.map +1 -0
  129. package/dist/setup/index.d.ts +17 -0
  130. package/dist/setup/index.d.ts.map +1 -0
  131. package/dist/setup/index.js +45 -0
  132. package/dist/setup/index.js.map +1 -0
  133. package/dist/setup/install-path.d.ts +3 -0
  134. package/dist/setup/install-path.d.ts.map +1 -0
  135. package/dist/setup/install-path.js +26 -0
  136. package/dist/setup/install-path.js.map +1 -0
  137. package/dist/setup/installation-state.d.ts +29 -0
  138. package/dist/setup/installation-state.d.ts.map +1 -0
  139. package/dist/setup/installation-state.js +83 -0
  140. package/dist/setup/installation-state.js.map +1 -0
  141. package/dist/setup/installation-status.d.ts +14 -0
  142. package/dist/setup/installation-status.d.ts.map +1 -0
  143. package/dist/setup/installation-status.js +36 -0
  144. package/dist/setup/installation-status.js.map +1 -0
  145. package/dist/setup/materialize-install.d.ts +24 -0
  146. package/dist/setup/materialize-install.d.ts.map +1 -0
  147. package/dist/setup/materialize-install.js +108 -0
  148. package/dist/setup/materialize-install.js.map +1 -0
  149. package/dist/setup/probe-spawn.d.ts +16 -0
  150. package/dist/setup/probe-spawn.d.ts.map +1 -0
  151. package/dist/setup/probe-spawn.js +87 -0
  152. package/dist/setup/probe-spawn.js.map +1 -0
  153. package/dist/setup/read-options.d.ts +15 -0
  154. package/dist/setup/read-options.d.ts.map +1 -0
  155. package/dist/setup/read-options.js +69 -0
  156. package/dist/setup/read-options.js.map +1 -0
  157. package/dist/setup/run-onboarding.d.ts +22 -0
  158. package/dist/setup/run-onboarding.d.ts.map +1 -0
  159. package/dist/setup/run-onboarding.js +273 -0
  160. package/dist/setup/run-onboarding.js.map +1 -0
  161. package/dist/setup/run-provision.d.ts +17 -0
  162. package/dist/setup/run-provision.d.ts.map +1 -0
  163. package/dist/setup/run-provision.js +224 -0
  164. package/dist/setup/run-provision.js.map +1 -0
  165. package/dist/setup/run-setup.d.ts +26 -0
  166. package/dist/setup/run-setup.d.ts.map +1 -0
  167. package/dist/setup/run-setup.js +227 -0
  168. package/dist/setup/run-setup.js.map +1 -0
  169. package/dist/setup/secrets.d.ts +2 -0
  170. package/dist/setup/secrets.d.ts.map +1 -0
  171. package/dist/setup/secrets.js +8 -0
  172. package/dist/setup/secrets.js.map +1 -0
  173. package/dist/setup/setup-report.d.ts +19 -0
  174. package/dist/setup/setup-report.d.ts.map +1 -0
  175. package/dist/setup/setup-report.js +35 -0
  176. package/dist/setup/setup-report.js.map +1 -0
  177. package/dist/tsconfig.tsbuildinfo +1 -1
  178. package/package.json +3 -3
  179. package/templates/compose-install/compose.yml +307 -0
  180. package/templates/compose-install/distribution.json +5 -0
  181. package/templates/compose-install/upgrade-catalog.json +39 -0
@@ -0,0 +1,81 @@
1
+ import { buildComposeSpawnEnv, composeBaseArgs, runComposeCommand, } from "../setup/compose-exec.js";
2
+ import { redactSecrets } from "../doctor/redact.js";
3
+ import { defaultProbeSpawn, spawnStreamingCommand, } from "../setup/probe-spawn.js";
4
+ import { KNOWN_COMPOSE_SERVICES } from "./services.js";
5
+ import { PlatformCommandError } from "./types.js";
6
+ export const DEFAULT_LOG_TAIL = 100;
7
+ export const MAX_LOG_TAIL = 10_000;
8
+ export const COMPOSE_LOGS_TIMEOUT_MS = 120_000;
9
+ export function parsePlatformLogsOptions(flags) {
10
+ const follow = flags.follow === true;
11
+ const serviceFlag = flags.service;
12
+ let service;
13
+ if (typeof serviceFlag === "string" && serviceFlag.trim().length > 0) {
14
+ service = serviceFlag.trim();
15
+ }
16
+ else if (serviceFlag === true) {
17
+ throw new PlatformCommandError("usage", "--service requires a Compose service name (for example web, postgres, console).");
18
+ }
19
+ const tailFlag = flags.tail;
20
+ if (tailFlag === true) {
21
+ throw new PlatformCommandError("usage", "--tail requires a positive integer (default 100).");
22
+ }
23
+ let tail = DEFAULT_LOG_TAIL;
24
+ if (typeof tailFlag === "string" && tailFlag.trim().length > 0) {
25
+ if (!/^\d+$/.test(tailFlag.trim())) {
26
+ throw new PlatformCommandError("usage", `Invalid --tail value '${tailFlag}'; use an integer between 1 and ${String(MAX_LOG_TAIL)}.`);
27
+ }
28
+ tail = Number(tailFlag.trim());
29
+ if (tail < 1 || tail > MAX_LOG_TAIL) {
30
+ throw new PlatformCommandError("usage", `--tail must be between 1 and ${String(MAX_LOG_TAIL)}.`);
31
+ }
32
+ }
33
+ return { service, tail, follow };
34
+ }
35
+ export async function runPlatformLogs(installation, options) {
36
+ if (options.service !== undefined) {
37
+ const known = KNOWN_COMPOSE_SERVICES.includes(options.service);
38
+ if (!known) {
39
+ throw new PlatformCommandError("usage", `Unknown service '${options.service}'. Expected one of: ${KNOWN_COMPOSE_SERVICES.join(", ")}.`);
40
+ }
41
+ }
42
+ const args = [
43
+ "logs",
44
+ `--tail=${String(options.tail)}`,
45
+ ...(options.follow ? ["--follow"] : []),
46
+ ...(options.service === undefined ? [] : [options.service]),
47
+ ];
48
+ const spawnEnv = buildComposeSpawnEnv(installation.execCtx);
49
+ const dockerArgs = [...composeBaseArgs(installation.execCtx), ...args];
50
+ if (options.follow) {
51
+ const { exitCode } = await spawnStreamingCommand("docker", dockerArgs, spawnEnv);
52
+ return exitCode === 0 ? 0 : 1;
53
+ }
54
+ const result = runComposeCommand(installation.execCtx, args, {
55
+ timeoutMs: COMPOSE_LOGS_TIMEOUT_MS,
56
+ processEnv: spawnEnv,
57
+ spawn: (executable, spawnArgs, timeoutMs, processEnv) => {
58
+ const output = defaultProbeSpawn(executable, spawnArgs, timeoutMs, processEnv);
59
+ if (output.stdout.length > 0) {
60
+ process.stdout.write(redactSecrets(output.stdout));
61
+ if (!output.stdout.endsWith("\n")) {
62
+ process.stdout.write("\n");
63
+ }
64
+ }
65
+ if (output.stderr.length > 0) {
66
+ process.stderr.write(redactSecrets(output.stderr));
67
+ if (!output.stderr.endsWith("\n")) {
68
+ process.stderr.write("\n");
69
+ }
70
+ }
71
+ return output;
72
+ },
73
+ });
74
+ if (result.status !== 0) {
75
+ throw new PlatformCommandError("compose_failed", redactSecrets(result.stderr.trim() ||
76
+ result.stdout.trim() ||
77
+ "Failed to read service logs."));
78
+ }
79
+ return 0;
80
+ }
81
+ //# sourceMappingURL=logs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.js","sourceRoot":"","sources":["../../src/platform/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAA6B,MAAM,YAAY,CAAC;AAE7E,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AACpC,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC;AACnC,MAAM,CAAC,MAAM,uBAAuB,GAAG,OAAO,CAAC;AAQ/C,MAAM,UAAU,wBAAwB,CACtC,KAAiD;IAEjD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC;IACrC,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC;IAClC,IAAI,OAA2B,CAAC;IAChC,IAAI,OAAO,WAAW,KAAK,QAAQ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AiB,CAC9B,UAAU,EACV,SAAS,EACT,SAAS,EACT,UAAU,CACX,CAAC;YACF,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC7B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;gBACnD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;oBAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC7B,CAAC;YACH,CAAC;YACD,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC7B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;gBACnD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;oBAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC7B,CAAC;YACH,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,oBAAoB,CAC5B,gBAAgB,EAChB,aAAa,CACX,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;YAClB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;YACpB,8BAA8B,CACjC,CACF,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { ResolvedInstallation } from "./types.js";
2
+ export interface ReadinessSnapshot {
3
+ readonly apiHealthOk: boolean;
4
+ readonly apiReadyOk: boolean;
5
+ readonly consoleReady: boolean;
6
+ readonly apiReadyDetail: string | undefined;
7
+ }
8
+ export declare function probeInstallationReadiness(installation: ResolvedInstallation, fetchImpl?: typeof fetch, probeTimeoutMs?: number): Promise<ReadinessSnapshot>;
9
+ //# sourceMappingURL=readiness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readiness.d.ts","sourceRoot":"","sources":["../../src/platform/readiness.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7C;AAED,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,oBAAoB,EAClC,SAAS,GAAE,OAAO,KAAa,EAC/B,cAAc,GAAE,MAAiC,GAChD,OAAO,CAAC,iBAAiB,CAAC,CAiC5B"}
@@ -0,0 +1,58 @@
1
+ import { createFetchProbeTransport } from "../doctor/http-probe.js";
2
+ import { DEFAULT_PROBE_TIMEOUT_MS } from "../doctor/run-doctor.js";
3
+ export async function probeInstallationReadiness(installation, fetchImpl = fetch, probeTimeoutMs = DEFAULT_PROBE_TIMEOUT_MS) {
4
+ const transport = createFetchProbeTransport(fetchImpl, probeTimeoutMs);
5
+ const health = await transport.getJson(`${installation.webUrl}/health`);
6
+ const apiHealthOk = health.kind === "ok" &&
7
+ health.status === 200 &&
8
+ isHealthOkBody(health.body);
9
+ let apiReadyOk = false;
10
+ let apiReadyDetail;
11
+ const ready = await transport.getJson(`${installation.webUrl}/ready`);
12
+ if (ready.kind === "ok" && ready.status === 200) {
13
+ apiReadyOk = true;
14
+ }
15
+ else if (ready.kind === "ok" && ready.status === 503) {
16
+ apiReadyDetail = readyFailureDetail(ready.body);
17
+ apiReadyOk = false;
18
+ }
19
+ else if (ready.kind === "ok") {
20
+ apiReadyDetail = `HTTP ${String(ready.status)}`;
21
+ }
22
+ else {
23
+ apiReadyDetail = ready.kind === "timeout" ? "timed out" : "transport error";
24
+ }
25
+ let consoleReady = false;
26
+ try {
27
+ const response = await fetchImpl(`${installation.consoleUrl}/`, {
28
+ signal: AbortSignal.timeout(probeTimeoutMs),
29
+ });
30
+ consoleReady = response.ok;
31
+ }
32
+ catch {
33
+ consoleReady = false;
34
+ }
35
+ return { apiHealthOk, apiReadyOk, consoleReady, apiReadyDetail };
36
+ }
37
+ function isHealthOkBody(body) {
38
+ return (typeof body === "object" &&
39
+ body !== null &&
40
+ "status" in body &&
41
+ body.status === "ok");
42
+ }
43
+ function readyFailureDetail(body) {
44
+ if (typeof body !== "object" || body === null) {
45
+ return undefined;
46
+ }
47
+ const failed = body.failedDependency;
48
+ if (typeof failed === "string" && failed.length > 0) {
49
+ return failed;
50
+ }
51
+ const failedMany = body
52
+ .failedDependencies;
53
+ if (Array.isArray(failedMany) && failedMany.length > 0) {
54
+ return failedMany.map(String).join(", ");
55
+ }
56
+ return undefined;
57
+ }
58
+ //# sourceMappingURL=readiness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readiness.js","sourceRoot":"","sources":["../../src/platform/readiness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAUnE,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,YAAkC,EAClC,YAA0B,KAAK,EAC/B,iBAAyB,wBAAwB;IAEjD,MAAM,SAAS,GAAG,yBAAyB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IACvE,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,MAAM,SAAS,CAAC,CAAC;IACxE,MAAM,WAAW,GACf,MAAM,CAAC,IAAI,KAAK,IAAI;QACpB,MAAM,CAAC,MAAM,KAAK,GAAG;QACrB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IACnC,OAAO,CACL,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,QAAQ,IAAI,IAAI;QACf,IAA6B,CAAC,MAAM,KAAK,IAAI,CAC/C,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAa;IACvC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAC9C,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,MAAM,GAAI,IAAuC,CAAC,gBAAgB,CAAC;IACzE,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,MAAM,UAAU,GAAI,IAAyC;SAC1D,kBAAkB,CAAC;IACtB,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvD,OAAO,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { type InstallEnvValues } from "../setup/env-file.js";
2
+ import { type ResolvedInstallation } from "./types.js";
3
+ export declare function resolveInstallationForLifecycle(flags: Readonly<Record<string, string | boolean>>, processEnv?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): Promise<ResolvedInstallation>;
4
+ export declare function installEnvValuesFromMap(envMap: Map<string, string>): InstallEnvValues;
5
+ //# sourceMappingURL=resolve-installation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-installation.d.ts","sourceRoot":"","sources":["../../src/platform/resolve-installation.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,gBAAgB,EAEtB,MAAM,sBAAsB,CAAC;AAU9B,OAAO,EAAwB,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE7E,wBAAsB,+BAA+B,CACnD,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,EACjD,UAAU,GAAE,MAAM,CAAC,UAAwB,EAC3C,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAC3C,OAAO,CAAC,oBAAoB,CAAC,CA6E/B;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,gBAAgB,CAkBlB"}
@@ -0,0 +1,115 @@
1
+ import { access } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { detectShellEnvConflicts, readInstallEnvFile, INSTALL_ENV_KEYS, } from "../setup/env-file.js";
4
+ import { deriveComposeProjectName } from "../setup/compose-project.js";
5
+ import { assessInstallDirectory, INSTALLATION_MARKER_RELATIVE, } from "../setup/installation-state.js";
6
+ import { resolveInstallDir } from "../setup/install-path.js";
7
+ import { isIncompleteUpgrade, readUpgradeState } from "./upgrade/state.js";
8
+ import { PlatformCommandError } from "./types.js";
9
+ export async function resolveInstallationForLifecycle(flags, processEnv = process.env, platform = process.platform) {
10
+ const installDir = resolveInstallDir(flags, processEnv, platform);
11
+ const assessment = await assessInstallDirectory(installDir);
12
+ if (assessment.kind === "missing") {
13
+ throw new PlatformCommandError("installation_missing", `No OSVA installation at ${installDir}. Run \`osva setup\` to install first.`);
14
+ }
15
+ if (assessment.kind === "empty") {
16
+ throw new PlatformCommandError("installation_missing", `Installation directory ${installDir} is empty. Run \`osva setup\` to install OSVA.`);
17
+ }
18
+ if (assessment.kind === "foreign") {
19
+ throw new PlatformCommandError("installation_invalid", `Directory ${installDir} is not an OSVA installation (unrelated files: ${assessment.foreignEntries.join(", ")}).`);
20
+ }
21
+ if (assessment.marker === undefined) {
22
+ throw new PlatformCommandError("installation_invalid", `Missing or invalid installation marker at ${path.join(installDir, INSTALLATION_MARKER_RELATIVE)}.`);
23
+ }
24
+ const composePath = path.join(installDir, "compose.yml");
25
+ const envPath = path.join(installDir, ".env");
26
+ await assertReadableFile(composePath, "compose.yml");
27
+ await assertReadableFile(envPath, ".env");
28
+ const marker = assessment.marker;
29
+ validateMarkerPaths(installDir, marker);
30
+ const envMap = await readInstallEnvFile(envPath);
31
+ if (envMap === undefined) {
32
+ throw new PlatformCommandError("installation_invalid", `Could not read installation environment at ${envPath}.`);
33
+ }
34
+ const envValues = installEnvValuesFromMap(envMap);
35
+ await validateMarkerMetadata(marker, installDir, envValues);
36
+ const conflicts = detectShellEnvConflicts(envValues, processEnv);
37
+ if (conflicts.length > 0) {
38
+ const keys = conflicts.map((conflict) => conflict.key).join(", ");
39
+ throw new PlatformCommandError("env_conflict", `Host environment variables override installation secrets and differ from .env: ${keys}. Unset them or align values before continuing.`);
40
+ }
41
+ const execCtx = {
42
+ installDir,
43
+ envFilePath: envPath,
44
+ projectName: envValues.COMPOSE_PROJECT_NAME,
45
+ };
46
+ const webPort = Number(envValues.OSVA_PUBLISH_WEB_PORT);
47
+ const mcpPort = Number(envValues.OSVA_PUBLISH_MCP_PORT);
48
+ const consolePort = Number(envValues.OSVA_PUBLISH_CONSOLE_PORT);
49
+ return {
50
+ installDir,
51
+ marker,
52
+ envValues,
53
+ envPath,
54
+ composePath,
55
+ execCtx,
56
+ webUrl: `http://127.0.0.1:${String(webPort)}`,
57
+ mcpUrl: `http://127.0.0.1:${String(mcpPort)}`,
58
+ consoleUrl: `http://127.0.0.1:${String(consolePort)}`,
59
+ };
60
+ }
61
+ export function installEnvValuesFromMap(envMap) {
62
+ const values = {};
63
+ const missing = [];
64
+ for (const key of INSTALL_ENV_KEYS) {
65
+ const raw = envMap.get(key)?.trim();
66
+ if (raw === undefined || raw.length === 0) {
67
+ missing.push(key);
68
+ continue;
69
+ }
70
+ values[key] = raw;
71
+ }
72
+ if (missing.length > 0) {
73
+ throw new PlatformCommandError("installation_invalid", `Installation .env is missing required keys: ${missing.join(", ")}.`);
74
+ }
75
+ return values;
76
+ }
77
+ function validateMarkerPaths(installDir, marker) {
78
+ const normalizedInstallDir = normalizePath(installDir);
79
+ const normalizedMarkerDir = normalizePath(marker.installDir);
80
+ if (normalizedInstallDir !== normalizedMarkerDir &&
81
+ !pathsEquivalent(normalizedInstallDir, normalizedMarkerDir)) {
82
+ throw new PlatformCommandError("installation_invalid", `Installation marker installDir (${marker.installDir}) does not match the requested directory (${installDir}). Use --install-dir ${marker.installDir} or repair ${INSTALLATION_MARKER_RELATIVE}.`);
83
+ }
84
+ }
85
+ async function validateMarkerMetadata(marker, installDir, envValues) {
86
+ const expectedProject = deriveComposeProjectName(installDir);
87
+ if (envValues.COMPOSE_PROJECT_NAME !== marker.composeProjectName) {
88
+ throw new PlatformCommandError("installation_invalid", `Compose project name in .env (${envValues.COMPOSE_PROJECT_NAME}) does not match installation marker (${marker.composeProjectName}).`);
89
+ }
90
+ if (expectedProject !== marker.composeProjectName) {
91
+ throw new PlatformCommandError("installation_invalid", `Installation marker project name (${marker.composeProjectName}) does not match this install directory (expected ${expectedProject}). Repair ${INSTALLATION_MARKER_RELATIVE} or use the correct --install-dir.`);
92
+ }
93
+ if (envValues.OSVA_IMAGE !== marker.imageRef) {
94
+ const upgradeState = await readUpgradeState(installDir);
95
+ if (upgradeState !== undefined && isIncompleteUpgrade(upgradeState)) {
96
+ return;
97
+ }
98
+ throw new PlatformCommandError("installation_invalid", `Installed image in .env (${envValues.OSVA_IMAGE}) does not match installation marker (${marker.imageRef}). Repair metadata or run \`osva platform upgrade --dry-run\`.`);
99
+ }
100
+ }
101
+ function normalizePath(value) {
102
+ return path.resolve(value).replace(/\\/g, "/").toLowerCase();
103
+ }
104
+ function pathsEquivalent(left, right) {
105
+ return (left === right || left.endsWith(`/${right}`) || right.endsWith(`/${left}`));
106
+ }
107
+ async function assertReadableFile(filePath, label) {
108
+ try {
109
+ await access(filePath);
110
+ }
111
+ catch {
112
+ throw new PlatformCommandError("installation_invalid", `Installation is missing ${label} at ${filePath}.`);
113
+ }
114
+ }
115
+ //# sourceMappingURL=resolve-installation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-installation.js","sourceRoot":"","sources":["../../src/platform/resolve-installation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAGlB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EACL,sBAAsB,EACtB,4BAA4B,GAE7B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAA6B,MAAM,YAAY,CAAC;AAE7E,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,KAAiD,EACjD,aAAgC,OAAO,CAAC,GAAG,EAC3C,WAA4B,OAAO,CAAC,QAAQ;IAE5C,MAAM,UAAU,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IAClE,MAAM,UAAU,GAAG,MAAM,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAE5D,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,IAAI,oBAAoB,CAC5B,sBAAsB,EACtB,2BAA2B,UAAU,wCAAwC,CAC9E,CAAC;IACJ,CAAC;IACD,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAChC,MAAM,IAAI,oBAAoB,CAC5B,sBAAsB,EACtB,0BAA0B,UAAU,gDAAgD,CACrF,CAAC;IACJ,CAAC;IACD,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM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AM,gBAAgB,CAAC,UAAU,CAAC,CAAC;QACxD,IAAI,YAAY,KAAK,SAAS,IAAI,mBAAmB,CAAC,YAAY,CAAC,EAAE,CAAC;YACpE,OAAO;QACT,CAAC;QACD,MAAM,IAAI,oBAAoB,CAC5B,sBAAsB,EACtB,4BAA4B,SAAS,CAAC,UAAU,yCAAyC,MAAM,CAAC,QAAQ,gEAAgE,CACzK,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AAC/D,CAAC;AAED,SAAS,eAAe,CAAC,IAAY,EAAE,KAAa;IAClD,OAAO,CACL,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC,CAC3E,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,kBAAkB,CAC/B,QAAgB,EAChB,KAAa;IAEb,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,oBAAoB,CAC5B,sBAAsB,EACtB,2BAA2B,KAAK,OAAO,QAAQ,GAAG,CACnD,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ /** Long-running OSVA application services (excludes one-shot migrate/bootstrap jobs). */
2
+ export declare const PLATFORM_APPLICATION_SERVICES: readonly ["web", "worker", "scheduler", "workflow-orchestrator", "knowledge-worker", "mcp-server", "console"];
3
+ export declare const PLATFORM_DATA_SERVICES: readonly ["postgres", "valkey"];
4
+ export declare const PLATFORM_LIFECYCLE_SERVICES: readonly ["postgres", "valkey", "web", "worker", "scheduler", "workflow-orchestrator", "knowledge-worker", "mcp-server", "console"];
5
+ export type PlatformServiceName = (typeof PLATFORM_DATA_SERVICES)[number] | (typeof PLATFORM_APPLICATION_SERVICES)[number] | "migrate";
6
+ export declare const KNOWN_COMPOSE_SERVICES: readonly PlatformServiceName[];
7
+ //# sourceMappingURL=services.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/platform/services.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,eAAO,MAAM,6BAA6B,+GAQhC,CAAC;AAEX,eAAO,MAAM,sBAAsB,iCAAkC,CAAC;AAEtE,eAAO,MAAM,2BAA2B,qIAG9B,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAC3B,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,GACvC,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,GAC9C,SAAS,CAAC;AAEd,eAAO,MAAM,sBAAsB,EAAE,SAAS,mBAAmB,EAIhE,CAAC"}
@@ -0,0 +1,21 @@
1
+ /** Long-running OSVA application services (excludes one-shot migrate/bootstrap jobs). */
2
+ export const PLATFORM_APPLICATION_SERVICES = [
3
+ "web",
4
+ "worker",
5
+ "scheduler",
6
+ "workflow-orchestrator",
7
+ "knowledge-worker",
8
+ "mcp-server",
9
+ "console",
10
+ ];
11
+ export const PLATFORM_DATA_SERVICES = ["postgres", "valkey"];
12
+ export const PLATFORM_LIFECYCLE_SERVICES = [
13
+ ...PLATFORM_DATA_SERVICES,
14
+ ...PLATFORM_APPLICATION_SERVICES,
15
+ ];
16
+ export const KNOWN_COMPOSE_SERVICES = [
17
+ ...PLATFORM_DATA_SERVICES,
18
+ "migrate",
19
+ ...PLATFORM_APPLICATION_SERVICES,
20
+ ];
21
+ //# sourceMappingURL=services.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.js","sourceRoot":"","sources":["../../src/platform/services.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,KAAK;IACL,QAAQ;IACR,WAAW;IACX,uBAAuB;IACvB,kBAAkB;IAClB,YAAY;IACZ,SAAS;CACD,CAAC;AAEX,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAU,CAAC;AAEtE,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,GAAG,sBAAsB;IACzB,GAAG,6BAA6B;CACxB,CAAC;AAOX,MAAM,CAAC,MAAM,sBAAsB,GAAmC;IACpE,GAAG,sBAAsB;IACzB,SAAS;IACT,GAAG,6BAA6B;CACjC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ProbeSpawnFn } from "../setup/probe-spawn.js";
2
+ import type { PlatformStatusReport, ResolvedInstallation } from "./types.js";
3
+ export declare function collectPlatformStatus(installation: ResolvedInstallation, deps?: {
4
+ readonly fetch?: typeof fetch;
5
+ readonly spawn?: ProbeSpawnFn;
6
+ }): Promise<PlatformStatusReport>;
7
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/platform/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAQ5D,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EAErB,MAAM,YAAY,CAAC;AAEpB,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,oBAAoB,EAClC,IAAI,GAAE;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAA;CAAO,GAC1E,OAAO,CAAC,oBAAoB,CAAC,CAmE/B"}
@@ -0,0 +1,60 @@
1
+ import { inspectComposeServices, migrateJobCompleted, } from "./compose-inspect.js";
2
+ import { probeInstallationReadiness } from "./readiness.js";
3
+ import { KNOWN_COMPOSE_SERVICES } from "./services.js";
4
+ import { isIncompleteUpgrade, readUpgradeState } from "./upgrade/state.js";
5
+ export async function collectPlatformStatus(installation, deps = {}) {
6
+ const upgradeState = await readUpgradeState(installation.installDir);
7
+ const services = inspectComposeServices(installation.execCtx, deps.spawn);
8
+ const readiness = await probeInstallationReadiness(installation, deps.fetch ?? fetch);
9
+ const problems = [];
10
+ if (isIncompleteUpgrade(upgradeState)) {
11
+ problems.push(`Platform upgrade state: ${upgradeState.phase}${upgradeState.lastError === undefined ? "" : ` (${upgradeState.lastError})`}.`);
12
+ }
13
+ for (const expected of KNOWN_COMPOSE_SERVICES) {
14
+ if (!services.some((service) => service.name === expected)) {
15
+ problems.push(`Missing Compose service record for '${expected}'.`);
16
+ }
17
+ }
18
+ const migrateCompleted = migrateJobCompleted(services);
19
+ if (migrateCompleted === false) {
20
+ problems.push("Database migration job has not completed successfully; platform applications may fail to start.");
21
+ }
22
+ for (const service of services) {
23
+ if (service.state === "unhealthy" ||
24
+ (service.state === "running" &&
25
+ service.name !== "migrate" &&
26
+ service.statusText.toLowerCase().includes("health") &&
27
+ !service.statusText.toLowerCase().includes("healthy"))) {
28
+ problems.push(`Service '${service.name}' is unhealthy (${service.statusText}).`);
29
+ }
30
+ }
31
+ if (!readiness.apiHealthOk) {
32
+ problems.push("Control plane /health is not OK.");
33
+ }
34
+ if (!readiness.apiReadyOk) {
35
+ const detail = readiness.apiReadyDetail === undefined
36
+ ? ""
37
+ : `: ${readiness.apiReadyDetail}`;
38
+ problems.push(`Control plane /ready is not OK${detail}.`);
39
+ }
40
+ if (!readiness.consoleReady) {
41
+ problems.push(`Console is not reachable at ${installation.consoleUrl}.`);
42
+ }
43
+ const platformReady = readiness.apiReadyOk && !hasUnhealthyCore(services);
44
+ return {
45
+ installation,
46
+ services,
47
+ platformReady,
48
+ consoleReady: readiness.consoleReady,
49
+ apiHealthOk: readiness.apiHealthOk,
50
+ apiReadyOk: readiness.apiReadyOk,
51
+ problems,
52
+ upgradeState,
53
+ };
54
+ }
55
+ function hasUnhealthyCore(services) {
56
+ const core = new Set(["postgres", "valkey", "web", "worker"]);
57
+ return services.some((service) => core.has(service.name) &&
58
+ (service.state === "unhealthy" || service.state === "stopped"));
59
+ }
60
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/platform/status.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAO3E,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,YAAkC,EAClC,OAAyE,EAAE;IAE3E,MAAM,YAAY,GAAG,MAAM,gBAAgB,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IACrE,MAAM,QAAQ,GAAG,sBAAsB,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1E,MAAM,SAAS,GAAG,MAAM,0BAA0B,CAChD,YAAY,EACZ,IAAI,CAAC,KAAK,IAAI,KAAK,CACpB,CAAC;IAEF,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,mBAAmB,CAAC,YAAY,CAAC,EAAE,CAAC;QACtC,QAAQ,CAAC,IAAI,CACX,2BAA2B,YAAa,CAAC,KAAK,GAAG,YAAa,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,YAAa,CAAC,SAAS,GAAG,GAAG,CACjI,CAAC;IACJ,CAAC;IACD,KAAK,MAAM,QAAQ,IAAI,sBAAsB,EAAE,CAAC;QAC9C,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC,EAAE,CAAC;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ED,MAAM,aAAa,GAAG,SAAS,CAAC,UAAU,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAE1E,OAAO;QACL,YAAY;QACZ,QAAQ;QACR,aAAa;QACb,YAAY,EAAE,SAAS,CAAC,YAAY;QACpC,WAAW,EAAE,SAAS,CAAC,WAAW;QAClC,UAAU,EAAE,SAAS,CAAC,UAAU;QAChC,QAAQ;QACR,YAAY;KACb,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CACvB,QAGG;IAEH,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC9D,OAAO,QAAQ,CAAC,IAAI,CAClB,CAAC,OAAO,EAAE,EAAE,CACV,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;QACtB,CAAC,OAAO,CAAC,KAAK,KAAK,WAAW,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CACjE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { InstallationMarker } from "../setup/installation-state.js";
2
+ import type { UpgradeState } from "./upgrade/state.js";
3
+ import type { InstallEnvValues } from "../setup/env-file.js";
4
+ import type { ComposeExecContext } from "../setup/compose-exec.js";
5
+ export type ServiceRuntimeState = "stopped" | "starting" | "running" | "healthy" | "unhealthy" | "unknown";
6
+ export interface ComposeServiceSnapshot {
7
+ readonly name: string;
8
+ readonly state: ServiceRuntimeState;
9
+ readonly statusText: string;
10
+ readonly health: string | undefined;
11
+ }
12
+ export interface ResolvedInstallation {
13
+ readonly installDir: string;
14
+ readonly marker: InstallationMarker;
15
+ readonly envValues: InstallEnvValues;
16
+ readonly envPath: string;
17
+ readonly composePath: string;
18
+ readonly execCtx: ComposeExecContext;
19
+ readonly webUrl: string;
20
+ readonly mcpUrl: string;
21
+ readonly consoleUrl: string;
22
+ }
23
+ export interface PlatformStatusReport {
24
+ readonly installation: ResolvedInstallation;
25
+ readonly services: readonly ComposeServiceSnapshot[];
26
+ readonly platformReady: boolean;
27
+ readonly consoleReady: boolean;
28
+ readonly apiHealthOk: boolean;
29
+ readonly apiReadyOk: boolean;
30
+ readonly problems: readonly string[];
31
+ readonly upgradeState: UpgradeState | undefined;
32
+ }
33
+ export declare class PlatformCommandError extends Error {
34
+ readonly code: "usage" | "installation_missing" | "installation_invalid" | "env_conflict" | "docker_unavailable" | "compose_failed" | "platform_not_ready";
35
+ constructor(code: PlatformCommandError["code"], message: string);
36
+ }
37
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/platform/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,MAAM,MAAM,mBAAmB,GAC7B,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;AAE3E,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACrD,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC;CACjD;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,IAAI,EACT,OAAO,GACP,sBAAsB,GACtB,sBAAsB,GACtB,cAAc,GACd,oBAAoB,GACpB,gBAAgB,GAChB,oBAAoB,CAAC;gBAEb,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM;CAIhE"}
@@ -0,0 +1,8 @@
1
+ export class PlatformCommandError extends Error {
2
+ code;
3
+ constructor(code, message) {
4
+ super(message);
5
+ this.code = code;
6
+ }
7
+ }
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/platform/types.ts"],"names":[],"mappings":"AAsCA,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,IAAI,CAOY;IAEzB,YAAY,IAAkC,EAAE,OAAe;QAC7D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ export declare const BACKUP_ATTESTATION_FLAG = "backup-confirmed";
2
+ export declare function backupRequirementsText(): string;
3
+ export declare function requiresBackupAttestation(migrationRequired: boolean): boolean;
4
+ //# sourceMappingURL=backup-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backup-policy.d.ts","sourceRoot":"","sources":["../../../src/platform/upgrade/backup-policy.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAE1D,wBAAgB,sBAAsB,IAAI,MAAM,CAc/C;AAED,wBAAgB,yBAAyB,CAAC,iBAAiB,EAAE,OAAO,GAAG,OAAO,CAE7E"}
@@ -0,0 +1,20 @@
1
+ export const BACKUP_ATTESTATION_FLAG = "backup-confirmed";
2
+ export function backupRequirementsText() {
3
+ return [
4
+ "Before upgrading OSVA you must back up durable state manually:",
5
+ "",
6
+ "1. PostgreSQL — logical dump (pg_dump) or your managed snapshot process.",
7
+ " OSVA stores Runs, workflows, agents, API keys, and migration history in PostgreSQL.",
8
+ "2. Artifact storage — back up the Compose artifact volume (filesystem mode) or your S3 bucket.",
9
+ "3. Document secrets separately — OSVA does not back up OSVA_AUTH_SECRET or provider keys.",
10
+ "",
11
+ "OSVA migrations are forward-only. A backup confirmation flag is operator attestation only;",
12
+ "it does not prove a backup exists or that restore was tested.",
13
+ "",
14
+ "See docs/operations/BACKUP_AND_RECOVERY.md and docs/operations/UPGRADE.md.",
15
+ ].join("\n");
16
+ }
17
+ export function requiresBackupAttestation(migrationRequired) {
18
+ return migrationRequired;
19
+ }
20
+ //# sourceMappingURL=backup-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backup-policy.js","sourceRoot":"","sources":["../../../src/platform/upgrade/backup-policy.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,kBAAkB,CAAC;AAE1D,MAAM,UAAU,sBAAsB;IACpC,OAAO;QACL,gEAAgE;QAChE,EAAE;QACF,0EAA0E;QAC1E,wFAAwF;QACxF,gGAAgG;QAChG,2FAA2F;QAC3F,EAAE;QACF,4FAA4F;QAC5F,+DAA+D;QAC/D,EAAE;QACF,4EAA4E;KAC7E,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,iBAA0B;IAClE,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,26 @@
1
+ export interface UpgradeTarget {
2
+ readonly platformVersion: string;
3
+ readonly imageRef: string;
4
+ }
5
+ export interface UpgradePath {
6
+ readonly fromPlatformVersion: string;
7
+ readonly toPlatformVersion: string;
8
+ readonly migrationRequired: boolean;
9
+ readonly composeTemplateUpdate: boolean;
10
+ }
11
+ export interface ResolvedUpgradeTarget {
12
+ readonly platformVersion: string;
13
+ readonly imageRef: string;
14
+ readonly composeYaml: string;
15
+ readonly path: UpgradePath;
16
+ }
17
+ export declare function loadUpgradeCatalog(): Promise<{
18
+ readonly targets: readonly UpgradeTarget[];
19
+ readonly paths: readonly UpgradePath[];
20
+ }>;
21
+ export declare function resolveUpgradeTarget(input: {
22
+ readonly toPlatformVersion: string;
23
+ readonly fromPlatformVersion: string;
24
+ readonly processEnv: NodeJS.ProcessEnv;
25
+ }): Promise<ResolvedUpgradeTarget>;
26
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/platform/upgrade/catalog.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;CACzC;AAQD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC;IAClD,QAAQ,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;CACxC,CAAC,CAWD;AAED,wBAAsB,oBAAoB,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC;CACxC,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAqDjC"}
@@ -0,0 +1,56 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { assertPinnedImageRef, loadComposeDistribution, } from "../../setup/distribution.js";
4
+ import { resolveComposeInstallTemplateRoot } from "../../setup/compose-template-root.js";
5
+ import { comparePlatformVersions } from "./version.js";
6
+ export async function loadUpgradeCatalog() {
7
+ const templateRoot = resolveComposeInstallTemplateRoot();
8
+ const catalogPath = path.join(templateRoot, "upgrade-catalog.json");
9
+ const raw = await readFile(catalogPath, "utf8");
10
+ const parsed = JSON.parse(raw);
11
+ if (parsed.schemaVersion !== 1) {
12
+ throw new Error(`Unsupported upgrade catalog schema version ${String(parsed.schemaVersion)}.`);
13
+ }
14
+ return { targets: parsed.targets, paths: parsed.paths };
15
+ }
16
+ export async function resolveUpgradeTarget(input) {
17
+ const catalog = await loadUpgradeCatalog();
18
+ const distribution = await loadComposeDistribution();
19
+ const targetEntry = catalog.targets.find((target) => target.platformVersion === input.toPlatformVersion) ??
20
+ (distribution.manifest.platformVersion === input.toPlatformVersion
21
+ ? {
22
+ platformVersion: distribution.manifest.platformVersion,
23
+ imageRef: distribution.manifest.imageRef,
24
+ }
25
+ : undefined);
26
+ if (targetEntry === undefined) {
27
+ throw new Error(`Unsupported upgrade target '${input.toPlatformVersion}'. This CLI supports explicit upgrades to: ${catalog.targets.map((target) => target.platformVersion).join(", ")}.`);
28
+ }
29
+ const pathRule = catalog.paths.find((candidate) => candidate.fromPlatformVersion === input.fromPlatformVersion &&
30
+ candidate.toPlatformVersion === input.toPlatformVersion);
31
+ if (pathRule === undefined) {
32
+ throw new Error(`No supported upgrade path from ${input.fromPlatformVersion} to ${input.toPlatformVersion}. See docs/operations/UPGRADE.md and docs/release/COMPATIBILITY.md.`);
33
+ }
34
+ if (comparePlatformVersions(input.fromPlatformVersion, input.toPlatformVersion) >= 0) {
35
+ throw new Error(`Refusing downgrade or no-op upgrade (${input.fromPlatformVersion} → ${input.toPlatformVersion}).`);
36
+ }
37
+ const imageRef = resolveUpgradeImageRef({
38
+ target: targetEntry,
39
+ processEnv: input.processEnv,
40
+ });
41
+ assertPinnedImageRef(imageRef);
42
+ return {
43
+ platformVersion: targetEntry.platformVersion,
44
+ imageRef,
45
+ composeYaml: distribution.composeYaml,
46
+ path: pathRule,
47
+ };
48
+ }
49
+ function resolveUpgradeImageRef(input) {
50
+ const override = input.processEnv.OSVA_UPGRADE_LOCAL_IMAGE?.trim();
51
+ if (override !== undefined && override.length > 0) {
52
+ return override;
53
+ }
54
+ return input.target.imageRef;
55
+ }
56
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../src/platform/upgrade/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,O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KAG/B;IACC,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,wBAAwB,EAAE,IAAI,EAAE,CAAC;IACnE,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClD,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface PlatformUpgradeOptions {
2
+ readonly toPlatformVersion: string;
3
+ readonly dryRun: boolean;
4
+ readonly backupConfirmed: boolean;
5
+ readonly authorizeExecute: boolean;
6
+ }
7
+ export declare function parsePlatformUpgradeOptions(flags: Readonly<Record<string, string | boolean>>): PlatformUpgradeOptions;
8
+ //# sourceMappingURL=options.d.ts.map