everything-dev 2.0.0-rc.7 → 2.0.0-rc.9

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 (142) hide show
  1. package/dist/api/auth-middleware.cjs +14 -1
  2. package/dist/api/auth-middleware.cjs.map +1 -1
  3. package/dist/api/auth-middleware.d.cts +9 -0
  4. package/dist/api/auth-middleware.d.mts +9 -0
  5. package/dist/api/auth-middleware.mjs +14 -1
  6. package/dist/api/auth-middleware.mjs.map +1 -1
  7. package/dist/apps/upload/src/client.cjs +7 -1
  8. package/dist/apps/upload/src/client.cjs.map +1 -1
  9. package/dist/apps/upload/src/client.mjs +7 -1
  10. package/dist/apps/upload/src/client.mjs.map +1 -1
  11. package/dist/auth-login.cjs +24 -1
  12. package/dist/auth-login.cjs.map +1 -1
  13. package/dist/auth-login.mjs +24 -1
  14. package/dist/auth-login.mjs.map +1 -1
  15. package/dist/auth-session.cjs +4 -2
  16. package/dist/auth-session.cjs.map +1 -1
  17. package/dist/auth-session.mjs +4 -2
  18. package/dist/auth-session.mjs.map +1 -1
  19. package/dist/cdn-deploy.cjs +11 -7
  20. package/dist/cdn-deploy.cjs.map +1 -1
  21. package/dist/cdn-deploy.mjs +11 -7
  22. package/dist/cdn-deploy.mjs.map +1 -1
  23. package/dist/cli/import.cjs +1140 -0
  24. package/dist/cli/import.cjs.map +1 -0
  25. package/dist/cli/import.mjs +1126 -0
  26. package/dist/cli/import.mjs.map +1 -0
  27. package/dist/cli/init.cjs +33 -14
  28. package/dist/cli/init.cjs.map +1 -1
  29. package/dist/cli/init.d.cts +8 -2
  30. package/dist/cli/init.d.mts +8 -2
  31. package/dist/cli/init.mjs +33 -15
  32. package/dist/cli/init.mjs.map +1 -1
  33. package/dist/cli.cjs +59 -3
  34. package/dist/cli.cjs.map +1 -1
  35. package/dist/cli.mjs +59 -3
  36. package/dist/cli.mjs.map +1 -1
  37. package/dist/commands/import.cjs +49 -0
  38. package/dist/commands/import.cjs.map +1 -0
  39. package/dist/commands/import.mjs +46 -0
  40. package/dist/commands/import.mjs.map +1 -0
  41. package/dist/commands/keys.cjs +25 -4
  42. package/dist/commands/keys.cjs.map +1 -1
  43. package/dist/commands/keys.mjs +25 -4
  44. package/dist/commands/keys.mjs.map +1 -1
  45. package/dist/config.d.cts +1 -0
  46. package/dist/config.d.mts +1 -0
  47. package/dist/contract.cjs +89 -0
  48. package/dist/contract.cjs.map +1 -1
  49. package/dist/contract.d.cts +190 -1
  50. package/dist/contract.d.mts +190 -1
  51. package/dist/contract.meta.cjs +17 -1
  52. package/dist/contract.meta.cjs.map +1 -1
  53. package/dist/contract.meta.d.cts +27 -1
  54. package/dist/contract.meta.d.mts +27 -1
  55. package/dist/contract.meta.mjs +17 -1
  56. package/dist/contract.meta.mjs.map +1 -1
  57. package/dist/contract.mjs +84 -1
  58. package/dist/contract.mjs.map +1 -1
  59. package/dist/custody-signer.cjs +70 -0
  60. package/dist/custody-signer.cjs.map +1 -0
  61. package/dist/custody-signer.mjs +68 -0
  62. package/dist/custody-signer.mjs.map +1 -0
  63. package/dist/db/core.cjs +22 -4
  64. package/dist/db/core.cjs.map +1 -1
  65. package/dist/db/core.mjs +22 -4
  66. package/dist/db/core.mjs.map +1 -1
  67. package/dist/descriptor/schema.cjs +8 -5
  68. package/dist/descriptor/schema.cjs.map +1 -1
  69. package/dist/descriptor/schema.d.cts +1 -0
  70. package/dist/descriptor/schema.d.mts +1 -0
  71. package/dist/descriptor/schema.mjs +8 -5
  72. package/dist/descriptor/schema.mjs.map +1 -1
  73. package/dist/descriptor/serialize.cjs +1 -1
  74. package/dist/descriptor/serialize.cjs.map +1 -1
  75. package/dist/descriptor/serialize.mjs +1 -1
  76. package/dist/descriptor/serialize.mjs.map +1 -1
  77. package/dist/http-client.cjs +14 -4
  78. package/dist/http-client.cjs.map +1 -1
  79. package/dist/http-client.mjs +14 -4
  80. package/dist/http-client.mjs.map +1 -1
  81. package/dist/index.cjs +6 -0
  82. package/dist/index.d.cts +2 -2
  83. package/dist/index.d.mts +2 -2
  84. package/dist/index.mjs +2 -2
  85. package/dist/infra/planner.cjs +6 -2
  86. package/dist/infra/planner.cjs.map +1 -1
  87. package/dist/infra/planner.mjs +6 -2
  88. package/dist/infra/planner.mjs.map +1 -1
  89. package/dist/outlayer-login.cjs +54 -0
  90. package/dist/outlayer-login.cjs.map +1 -0
  91. package/dist/outlayer-login.mjs +54 -0
  92. package/dist/outlayer-login.mjs.map +1 -0
  93. package/dist/plugin.cjs +2 -0
  94. package/dist/plugin.cjs.map +1 -1
  95. package/dist/plugin.d.cts +74 -0
  96. package/dist/plugin.d.mts +74 -0
  97. package/dist/plugin.mjs +2 -0
  98. package/dist/plugin.mjs.map +1 -1
  99. package/dist/publish.cjs +145 -22
  100. package/dist/publish.cjs.map +1 -1
  101. package/dist/publish.mjs +147 -24
  102. package/dist/publish.mjs.map +1 -1
  103. package/dist/source-archive.cjs +51 -0
  104. package/dist/source-archive.cjs.map +1 -0
  105. package/dist/source-archive.mjs +50 -0
  106. package/dist/source-archive.mjs.map +1 -0
  107. package/dist/storage-upload.cjs +6 -1
  108. package/dist/storage-upload.cjs.map +1 -1
  109. package/dist/storage-upload.mjs +6 -1
  110. package/dist/storage-upload.mjs.map +1 -1
  111. package/dist/types.cjs +5 -1
  112. package/dist/types.cjs.map +1 -1
  113. package/dist/types.d.cts +2 -0
  114. package/dist/types.d.mts +2 -0
  115. package/dist/types.mjs +5 -1
  116. package/dist/types.mjs.map +1 -1
  117. package/dist/ui/auth.d.cts +217 -123
  118. package/dist/ui/auth.d.mts +217 -123
  119. package/dist/ui/router-client.cjs +2 -1
  120. package/dist/ui/router-client.cjs.map +1 -1
  121. package/dist/ui/router-client.mjs +2 -1
  122. package/dist/ui/router-client.mjs.map +1 -1
  123. package/dist/utils/workspace-subtree.cjs +37 -0
  124. package/dist/utils/workspace-subtree.cjs.map +1 -0
  125. package/dist/utils/workspace-subtree.mjs +36 -0
  126. package/dist/utils/workspace-subtree.mjs.map +1 -0
  127. package/dist/version-manifest-deploy.cjs +4 -2
  128. package/dist/version-manifest-deploy.cjs.map +1 -1
  129. package/dist/version-manifest-deploy.mjs +4 -2
  130. package/dist/version-manifest-deploy.mjs.map +1 -1
  131. package/dist/version-manifest-resolve.cjs +2 -1
  132. package/dist/version-manifest-resolve.cjs.map +1 -1
  133. package/dist/version-manifest-resolve.d.cts +3 -0
  134. package/dist/version-manifest-resolve.d.mts +3 -0
  135. package/dist/version-manifest-resolve.mjs +2 -1
  136. package/dist/version-manifest-resolve.mjs.map +1 -1
  137. package/package.json +11 -10
  138. package/skills/api-and-auth/SKILL.md +12 -9
  139. package/skills/api-and-auth/references/middleware.md +38 -0
  140. package/skills/cli-reference/SKILL.md +38 -6
  141. package/skills/init-upgrade/SKILL.md +76 -3
  142. package/skills/talk-to-the-app/SKILL.md +32 -5
@@ -1 +1 @@
1
- {"version":3,"file":"http-client.mjs","names":[],"sources":["../src/http-client.ts"],"sourcesContent":["import { Context, Data, Duration, Effect, Layer, Schedule } from \"effect\";\n\n// --- Tagged errors ---\n\nexport class FetchNetworkError extends Data.TaggedError(\"FetchNetworkError\")<{\n url: string;\n cause: unknown;\n}> {}\n\nexport class FetchTimeoutError extends Data.TaggedError(\"FetchTimeoutError\")<{\n url: string;\n}> {}\n\nexport class FetchHttpError extends Data.TaggedError(\"FetchHttpError\")<{\n url: string;\n status: number;\n statusText: string;\n}> {}\n\nexport type FetchError = FetchNetworkError | FetchTimeoutError | FetchHttpError;\n\n// --- Options ---\n\nexport interface FetchOptions {\n method?: string;\n headers?: Record<string, string>;\n body?: BodyInit;\n redirect?: RequestRedirect;\n timeout?: Duration.Input;\n}\n\nexport interface FetchWithRetryOptions extends FetchOptions {\n retries?: number;\n}\n\n// --- Defaults ---\n\nconst DEFAULT_TIMEOUT = \"10 seconds\";\nconst DEFAULT_RETRIES = 3;\n\nconst EXPONENTIAL_BASE = Duration.seconds(1);\nconst EXPONENTIAL_CAP = Duration.seconds(15);\n\ntype FetchImpl = typeof globalThis.fetch;\n\n// --- Helpers ---\n\nconst isRetryable = (error: FetchError): boolean => {\n if (error instanceof FetchNetworkError) return true;\n if (error instanceof FetchTimeoutError) return true;\n if (error instanceof FetchHttpError) return error.status >= 500;\n return false;\n};\n\nexport interface HttpFetchShape {\n /** One network attempt: no status assertion, no internal deadline. The\n * fiber's signal is composed with any caller-provided signal, so an\n * `Effect.timeout` around the call aborts the in-flight request, and a\n * caller-initiated cancellation still wins. */\n readonly attempt: (\n input: string | URL | Request,\n init?: RequestInit,\n ) => Effect.Effect<Response, FetchNetworkError>;\n /** attempt + deadline + ok assertion (non-2xx → `FetchHttpError`) + capped\n * exponential jittered retry (5xx/network/timeout retried, 4xx not). */\n readonly get: (\n url: string,\n options?: FetchWithRetryOptions,\n ) => Effect.Effect<Response, FetchError>;\n}\n\nconst makeHttpFetch = (\n base: (input: string | URL | Request, init?: RequestInit) => Promise<Response>,\n): HttpFetchShape => {\n const urlOf = (input: string | URL | Request): string =>\n typeof input === \"string\" ? input : input instanceof URL ? input.href : input.url;\n\n const attempt = (\n input: string | URL | Request,\n init?: RequestInit,\n ): Effect.Effect<Response, FetchNetworkError> =>\n Effect.tryPromise({\n try: (signal) =>\n base(input, {\n ...init,\n signal: init?.signal ? AbortSignal.any([init.signal, signal]) : signal,\n }),\n catch: (cause) => new FetchNetworkError({ url: urlOf(input), cause }),\n });\n\n const get = (\n url: string,\n options?: FetchWithRetryOptions,\n ): Effect.Effect<Response, FetchError> => {\n const timeoutMs = Duration.toMillis(options?.timeout ?? DEFAULT_TIMEOUT);\n const retries = options?.retries ?? DEFAULT_RETRIES;\n const once = attempt(url, {\n method: options?.method ?? \"GET\",\n headers: options?.headers,\n body: options?.body,\n redirect: options?.redirect,\n }).pipe(\n Effect.timeoutOrElse({\n duration: timeoutMs,\n orElse: () => Effect.fail(new FetchTimeoutError({ url })),\n }),\n Effect.filterOrFail(\n (response) => response.ok,\n (response) =>\n new FetchHttpError({ url, status: response.status, statusText: response.statusText }),\n ),\n );\n if (retries <= 0) return once;\n return once.pipe(\n Effect.retry({\n schedule: Schedule.exponential(EXPONENTIAL_BASE).pipe(\n Schedule.upTo({ duration: EXPONENTIAL_CAP, times: retries }),\n Schedule.jittered,\n ),\n while: isRetryable,\n }),\n );\n };\n\n return { attempt, get };\n};\n\nconst defaultHttpFetch = makeHttpFetch((url, init) => globalThis.fetch(url, init));\n\n/**\n * The HTTP seam for boot-path consumers (bundle resolution, federation\n * loading, orchestrator deadlines): one resilience policy — interruption-\n * backed deadlines, capped exponential jittered retry, typed errors — with\n * the base fetch injectable so the bundle fetch interceptor can point it at\n * the pre-patch `fetch` and not re-enter itself.\n */\nexport class HttpFetch extends Context.Service<HttpFetch, HttpFetchShape>()(\n \"everything-dev/http-client/HttpFetch\",\n) {\n static layerWith(options: { fetchImpl: FetchImpl }): Layer.Layer<HttpFetch> {\n return Layer.succeed(HttpFetch, makeHttpFetch(options.fetchImpl));\n }\n\n static readonly layer: Layer.Layer<HttpFetch> = Layer.succeed(HttpFetch, defaultHttpFetch);\n}\n\n// --- In-memory GET cache (per-process, prevents duplicate round trips) ---\n\nconst getCache = new Map<string, { data: unknown; expiresAt: number }>();\nconst GET_CACHE_TTL_MS = 30_000;\n\nexport function clearHttpCache(): void {\n getCache.clear();\n}\n\nfunction isCacheable(_url: string, options?: FetchWithRetryOptions): boolean {\n if (options?.method && options.method !== \"GET\") return false;\n if (options?.body) return false;\n return true;\n}\n\n// --- Promise wrappers (bridge for non-Effect code) — the ambient call-time\n// lookup means a boot fetch crossing the bundle interceptor still gains its\n// retry/deadline policy; the fiber-signal composition aborts the in-flight\n// request at the deadline. ---\n\n/** One raw fetch attempt with a deadline: returns the Response regardless of\n * status; rejects on network failure or deadline expiry. */\nexport const fetchRaw = (\n url: string,\n init?: RequestInit,\n timeout: Duration.Input = DEFAULT_TIMEOUT,\n): Promise<Response> =>\n Effect.runPromise(\n defaultHttpFetch.attempt(url, init).pipe(\n Effect.timeoutOrElse({\n duration: timeout,\n orElse: () => Effect.fail(new FetchTimeoutError({ url })),\n }),\n ),\n );\n\nexport const fetchResponse = (url: string, options?: FetchOptions): Promise<Response> =>\n Effect.runPromise(\n defaultHttpFetch\n .attempt(url, {\n method: options?.method,\n headers: options?.headers,\n body: options?.body,\n redirect: options?.redirect,\n })\n .pipe(\n Effect.timeoutOrElse({\n duration: options?.timeout ?? DEFAULT_TIMEOUT,\n orElse: () => Effect.fail(new FetchTimeoutError({ url })),\n }),\n ),\n );\n\nexport const fetchJsonOrNull = async <T>(\n url: string,\n options?: FetchWithRetryOptions,\n): Promise<T | null> => {\n if (isCacheable(url, options)) {\n const cached = getCache.get(url);\n if (cached && cached.expiresAt > Date.now()) {\n return cached.data as T;\n }\n }\n\n try {\n const res = await Effect.runPromise(defaultHttpFetch.get(url, options));\n const data = (await res.json()) as T;\n if (isCacheable(url, options)) {\n getCache.set(url, { data, expiresAt: Date.now() + GET_CACHE_TTL_MS });\n }\n return data;\n } catch (error) {\n const msg =\n error instanceof FetchNetworkError\n ? `[http] Network error: ${error.url} — ${String(error.cause)}`\n : error instanceof FetchTimeoutError\n ? `[http] Timeout: ${error.url}`\n : error instanceof FetchHttpError\n ? `[http] HTTP ${error.status}: ${error.url}`\n : `[http] Unknown error while fetching ${url}`;\n console.error(msg);\n return null;\n }\n};\n\nexport const fetchWithRetryEff = (\n url: string,\n options?: FetchWithRetryOptions,\n): Effect.Effect<Response, FetchError> => defaultHttpFetch.get(url, options);\n"],"mappings":";;;AAIA,IAAa,oBAAb,cAAuC,KAAK,YAAY,mBAAmB,CAAC,CAGzE,CAAC;AAEJ,IAAa,oBAAb,cAAuC,KAAK,YAAY,mBAAmB,CAAC,CAEzE,CAAC;AAEJ,IAAa,iBAAb,cAAoC,KAAK,YAAY,gBAAgB,CAAC,CAInE,CAAC;AAoBJ,MAAM,kBAAkB;AACxB,MAAM,kBAAkB;AAExB,MAAM,mBAAmB,SAAS,QAAQ,CAAC;AAC3C,MAAM,kBAAkB,SAA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,iBAAiB,IAAI,KAAK,OAAO,CAAC,EAC/C,CAAC,KAAK;EAC7B,IAAI,YAAY,KAAK,OAAO,GAC1B,SAAS,IAAI,KAAK;GAAE;GAAM,WAAW,KAAK,IAAI,IAAI;EAAiB,CAAC;EAEtE,OAAO;CACT,SAAS,OAAO;EACd,MAAM,MACJ,iBAAiB,oBACb,yBAAyB,MAAM,IAAI,KAAK,OAAO,MAAM,KAAK,MAC1D,iBAAiB,oBACf,mBAAmB,MAAM,QACzB,iBAAiB,iBACf,eAAe,MAAM,OAAO,IAAI,MAAM,QACtC,uCAAuC;EACjD,QAAQ,MAAM,GAAG;EACjB,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"http-client.mjs","names":[],"sources":["../src/http-client.ts"],"sourcesContent":["import { Context, Data, Duration, Effect, Layer, Schedule } from \"effect\";\n\n// --- Tagged errors ---\n\nexport class FetchNetworkError extends Data.TaggedError(\"FetchNetworkError\")<{\n url: string;\n cause: unknown;\n}> {}\n\nexport class FetchTimeoutError extends Data.TaggedError(\"FetchTimeoutError\")<{\n url: string;\n}> {}\n\nexport class FetchHttpError extends Data.TaggedError(\"FetchHttpError\")<{\n url: string;\n status: number;\n statusText: string;\n}> {}\n\nexport type FetchError = FetchNetworkError | FetchTimeoutError | FetchHttpError;\n\n// --- Options ---\n\nexport interface FetchOptions {\n method?: string;\n headers?: Record<string, string>;\n body?: BodyInit;\n redirect?: RequestRedirect;\n timeout?: Duration.Input;\n}\n\nexport interface FetchWithRetryOptions extends FetchOptions {\n retries?: number;\n}\n\n// --- Defaults ---\n\nconst DEFAULT_TIMEOUT = \"10 seconds\";\nconst DEFAULT_RETRIES = 3;\n\nconst EXPONENTIAL_BASE = Duration.seconds(1);\nconst EXPONENTIAL_CAP = Duration.seconds(15);\n\ntype FetchImpl = typeof globalThis.fetch;\n\n// --- Helpers ---\n\nconst isRetryable = (error: FetchError): boolean => {\n if (error instanceof FetchNetworkError) return true;\n if (error instanceof FetchTimeoutError) return true;\n if (error instanceof FetchHttpError) return error.status >= 500;\n return false;\n};\n\nexport interface HttpFetchShape {\n /** One network attempt: no status assertion, no internal deadline. The\n * fiber's signal is composed with any caller-provided signal, so an\n * `Effect.timeout` around the call aborts the in-flight request, and a\n * caller-initiated cancellation still wins. */\n readonly attempt: (\n input: string | URL | Request,\n init?: RequestInit,\n ) => Effect.Effect<Response, FetchNetworkError>;\n /** attempt + deadline + ok assertion (non-2xx → `FetchHttpError`) + capped\n * exponential jittered retry (5xx/network/timeout retried, 4xx not). */\n readonly get: (\n url: string,\n options?: FetchWithRetryOptions,\n ) => Effect.Effect<Response, FetchError>;\n}\n\nconst makeHttpFetch = (\n base: (input: string | URL | Request, init?: RequestInit) => Promise<Response>,\n): HttpFetchShape => {\n const urlOf = (input: string | URL | Request): string =>\n typeof input === \"string\" ? input : input instanceof URL ? input.href : input.url;\n\n const attempt = (\n input: string | URL | Request,\n init?: RequestInit,\n ): Effect.Effect<Response, FetchNetworkError> =>\n Effect.tryPromise({\n try: (signal) =>\n base(input, {\n ...init,\n signal: init?.signal ? AbortSignal.any([init.signal, signal]) : signal,\n }),\n catch: (cause) => new FetchNetworkError({ url: urlOf(input), cause }),\n });\n\n const get = (\n url: string,\n options?: FetchWithRetryOptions,\n ): Effect.Effect<Response, FetchError> => {\n const timeoutMs = Duration.toMillis(options?.timeout ?? DEFAULT_TIMEOUT);\n const retries = options?.retries ?? DEFAULT_RETRIES;\n const once = attempt(url, {\n method: options?.method ?? \"GET\",\n headers: options?.headers,\n body: options?.body,\n redirect: options?.redirect,\n }).pipe(\n Effect.timeoutOrElse({\n duration: timeoutMs,\n orElse: () => Effect.fail(new FetchTimeoutError({ url })),\n }),\n Effect.filterOrFail(\n (response) => response.ok,\n (response) =>\n new FetchHttpError({ url, status: response.status, statusText: response.statusText }),\n ),\n );\n if (retries <= 0) return once;\n return once.pipe(\n Effect.retry({\n schedule: Schedule.exponential(EXPONENTIAL_BASE).pipe(\n Schedule.upTo({ duration: EXPONENTIAL_CAP, times: retries }),\n Schedule.jittered,\n ),\n while: isRetryable,\n }),\n );\n };\n\n return { attempt, get };\n};\n\nconst defaultHttpFetch = makeHttpFetch((url, init) => globalThis.fetch(url, init));\n\n/**\n * The HTTP seam for boot-path consumers (bundle resolution, federation\n * loading, orchestrator deadlines): one resilience policy — interruption-\n * backed deadlines, capped exponential jittered retry, typed errors — with\n * the base fetch injectable so the bundle fetch interceptor can point it at\n * the pre-patch `fetch` and not re-enter itself.\n */\nexport class HttpFetch extends Context.Service<HttpFetch, HttpFetchShape>()(\n \"everything-dev/http-client/HttpFetch\",\n) {\n static layerWith(options: { fetchImpl: FetchImpl }): Layer.Layer<HttpFetch> {\n return Layer.succeed(HttpFetch, makeHttpFetch(options.fetchImpl));\n }\n\n static readonly layer: Layer.Layer<HttpFetch> = Layer.succeed(HttpFetch, defaultHttpFetch);\n}\n\n// --- In-memory GET cache (per-process, prevents duplicate round trips) ---\n\nconst getCache = new Map<string, { data: unknown; expiresAt: number }>();\nconst GET_CACHE_TTL_MS = 30_000;\nconst GET_CACHE_MAX_ENTRIES = 128;\n\nexport function clearHttpCache(): void {\n getCache.clear();\n}\n\nexport function httpCacheSize(): number {\n return getCache.size;\n}\n\nfunction setCached(url: string, data: unknown): void {\n const now = Date.now();\n for (const [key, entry] of getCache) {\n if (entry.expiresAt <= now) getCache.delete(key);\n }\n if (getCache.size >= GET_CACHE_MAX_ENTRIES) {\n for (const key of getCache.keys()) {\n getCache.delete(key);\n if (getCache.size < GET_CACHE_MAX_ENTRIES) break;\n }\n }\n getCache.set(url, { data, expiresAt: now + GET_CACHE_TTL_MS });\n}\n\nfunction isCacheable(_url: string, options?: FetchWithRetryOptions): boolean {\n if (options?.method && options.method !== \"GET\") return false;\n if (options?.body) return false;\n return true;\n}\n\n// --- Promise wrappers (bridge for non-Effect code) — the ambient call-time\n// lookup means a boot fetch crossing the bundle interceptor still gains its\n// retry/deadline policy; the fiber-signal composition aborts the in-flight\n// request at the deadline. ---\n\n/** One raw fetch attempt with a deadline: returns the Response regardless of\n * status; rejects on network failure or deadline expiry. */\nexport const fetchRaw = (\n url: string,\n init?: RequestInit,\n timeout: Duration.Input = DEFAULT_TIMEOUT,\n): Promise<Response> =>\n Effect.runPromise(\n defaultHttpFetch.attempt(url, init).pipe(\n Effect.timeoutOrElse({\n duration: timeout,\n orElse: () => Effect.fail(new FetchTimeoutError({ url })),\n }),\n ),\n );\n\nexport const fetchResponse = (url: string, options?: FetchOptions): Promise<Response> =>\n Effect.runPromise(\n defaultHttpFetch\n .attempt(url, {\n method: options?.method,\n headers: options?.headers,\n body: options?.body,\n redirect: options?.redirect,\n })\n .pipe(\n Effect.timeoutOrElse({\n duration: options?.timeout ?? DEFAULT_TIMEOUT,\n orElse: () => Effect.fail(new FetchTimeoutError({ url })),\n }),\n ),\n );\n\nexport const fetchJsonOrNull = async <T>(\n url: string,\n options?: FetchWithRetryOptions,\n): Promise<T | null> => {\n if (isCacheable(url, options)) {\n const cached = getCache.get(url);\n if (cached && cached.expiresAt > Date.now()) {\n return cached.data as T;\n }\n }\n\n try {\n const res = await Effect.runPromise(defaultHttpFetch.get(url, options));\n const data = (await res.json()) as T;\n if (isCacheable(url, options)) {\n setCached(url, data);\n }\n return data;\n } catch (error) {\n const msg =\n error instanceof FetchNetworkError\n ? `[http] Network error: ${error.url} — ${String(error.cause)}`\n : error instanceof FetchTimeoutError\n ? `[http] Timeout: ${error.url}`\n : error instanceof FetchHttpError\n ? `[http] HTTP ${error.status}: ${error.url}`\n : `[http] Unknown error while fetching ${url}`;\n console.error(msg);\n return null;\n }\n};\n\nexport const fetchWithRetryEff = (\n url: string,\n options?: FetchWithRetryOptions,\n): Effect.Effect<Response, FetchError> => defaultHttpFetch.get(url, options);\n"],"mappings":";;;AAIA,IAAa,oBAAb,cAAuC,KAAK,YAAY,mBAAmB,CAAC,CAGzE,CAAC;AAEJ,IAAa,oBAAb,cAAuC,KAAK,YAAY,mBAAmB,CAAC,CAEzE,CAAC;AAEJ,IAAa,iBAAb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CACF;AAEF,MAAa,iBAAiB,KAAa,YACzC,OAAO,WACL,iBACG,QAAQ,KAAK;CACZ,QAAQ,SAAS;CACjB,SAAS,SAAS;CAClB,MAAM,SAAS;CACf,UAAU,SAAS;AACrB,CAAC,CAAC,CACD,KACC,OAAO,cAAc;CACnB,UAAU,SAAS,WAAW;CAC9B,cAAc,OAAO,KAAK,IAAI,kBAAkB,EAAE,IAAI,CAAC,CAAC;AAC1D,CAAC,CACH,CACJ;AAEF,MAAa,kBAAkB,OAC7B,KACA,YACsB;CACtB,IAAI,YAAY,KAAK,OAAO,GAAG;EAC7B,MAAM,SAAS,SAAS,IAAI,GAAG;EAC/B,IAAI,UAAU,OAAO,YAAY,KAAK,IAAI,GACxC,OAAO,OAAO;CAElB;CAEA,IAAI;EAEF,MAAM,OAAQ,OAAM,MADF,OAAO,WAAW,iBAAiB,IAAI,KAAK,OAAO,CAAC,EAC/C,CAAC,KAAK;EAC7B,IAAI,YAAY,KAAK,OAAO,GAC1B,UAAU,KAAK,IAAI;EAErB,OAAO;CACT,SAAS,OAAO;EACd,MAAM,MACJ,iBAAiB,oBACb,yBAAyB,MAAM,IAAI,KAAK,OAAO,MAAM,KAAK,MAC1D,iBAAiB,oBACf,mBAAmB,MAAM,QACzB,iBAAiB,iBACf,eAAe,MAAM,OAAO,IAAI,MAAM,QACtC,uCAAuC;EACjD,QAAQ,MAAM,GAAG;EACjB,OAAO;CACT;AACF"}
package/dist/index.cjs CHANGED
@@ -61,6 +61,12 @@ Object.defineProperty(exports, 'Effect', {
61
61
  exports.ExtendsSchema = require_types.ExtendsSchema;
62
62
  exports.FederationEntrySchema = require_types.FederationEntrySchema;
63
63
  exports.HostConfigSchema = require_types.HostConfigSchema;
64
+ exports.ImportMigrationAppendSchema = require_contract.ImportMigrationAppendSchema;
65
+ exports.ImportMigrationCollisionSchema = require_contract.ImportMigrationCollisionSchema;
66
+ exports.ImportMigrationReconciliationSchema = require_contract.ImportMigrationReconciliationSchema;
67
+ exports.ImportOptionsSchema = require_contract.ImportOptionsSchema;
68
+ exports.ImportResultSchema = require_contract.ImportResultSchema;
69
+ exports.ImportRouteDeltaSchema = require_contract.ImportRouteDeltaSchema;
64
70
  exports.InfraExportOptionsSchema = require_contract.InfraExportOptionsSchema;
65
71
  exports.InfraExportResultSchema = require_contract.InfraExportResultSchema;
66
72
  exports.InfraExportServiceSchema = require_contract.InfraExportServiceSchema;
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { ApiPluginConfig, ApiPluginConfigSchema, BosConfig, BosConfigInput, BosConfigInputAppEntry, BosConfigInputSchema, BosConfigSchema, BosPluginRef, BosPluginRefSchema, BosStaging, BosStagingSchema, CdnConfig, CdnConfigSchema, CiConfig, CiConfigSchema, ClientRuntimeConfig, ClientRuntimeConfigSchema, ClientRuntimeInfo, ClientRuntimeInfoSchema, ComposableAppEntry, ComposableAppEntrySchema, DependencyNodeKind, DependencyNodeKindSchema, Extends, ExtendsConfig, ExtendsSchema, FederationEntry, FederationEntrySchema, HostConfig, HostConfigSchema, JsonObject, JsonObjectSchema, JsonPrimitive, JsonValue, JsonValueSchema, ParentStarterConfig, ParentStarterConfigSchema, PluginEntries, PluginEntryValue, PluginRuntimeUi, PluginUiConfig, PluginUiConfigSchema, PublishAuth, PublishAuthSchema, PublishConfig, PublishConfigSchema, RailwayCi, RailwayCiSchema, RuntimeConfig, RuntimeConfigSchema, RuntimeDependencyNode, RuntimeDependencyNodeSchema, RuntimeLineage, RuntimeLineageSchema, RuntimePluginConfig, RuntimePluginConfigSchema, SharedConfig, SharedConfigSchema, SharedDepConfig, SharedDepConfigSchema, SharedDepMapSchema, SlotPin, SlotPinSchema, SourceMode, SourceModeSchema, StarterLevel, StarterLevelConfig, StarterLevelConfigSchema, StarterLevelSchema, UiConfig, UiConfigSchema } from "./types.cjs";
2
- import { BosConfigResult, BuildOptions, BuildOptionsSchema, BuildResultSchema, ConfigOptionsSchema, ConfigResultSchema, DbDoctorOptions, DbDoctorOptionsSchema, DbDoctorResult, DbDoctorResultSchema, DbRepairOptions, DbRepairOptionsSchema, DbRepairResult, DbRepairResultSchema, DbStudioOptions, DbStudioOptionsSchema, DbStudioResult, DbStudioResultSchema, DeployManifestListEntrySchema, DeployOptions, DeployOptionsSchema, DeployResult, DeployResultSchema, DeployedVersionStatusSchema, DevOptions, DevOptionsSchema, DevResult, DevResultSchema, InfraExportOptions, InfraExportOptionsSchema, InfraExportResult, InfraExportResultSchema, InfraExportService, InfraExportServiceSchema, InitOptions, InitOptionsSchema, InitResult, InitResultSchema, KeyPublishOptions, KeyPublishOptionsSchema, KeyPublishResult, KeyPublishResultSchema, KillOptions, KillOptionsSchema, KillResult, KillResultSchema, LoginOptions, LoginOptionsSchema, LoginResult, LoginResultSchema, LogoutOptions, LogoutOptionsSchema, LogoutResult, LogoutResultSchema, LogsOptions, LogsOptionsSchema, LogsResult, LogsResultSchema, MfCheckOptions, MfCheckOptionsSchema, MfCheckRemoteResultSchema, MfCheckResult, MfCheckResultSchema, OverrideSection, OverrideSectionSchema, PhaseTiming, PhaseTimingSchema, PidEntry, PidEntrySchema, PluginAddOptions, PluginAddOptionsSchema, PluginAddResult, PluginAddResultSchema, PluginListResult, PluginListResultSchema, PluginPublishOptions, PluginPublishOptionsSchema, PluginPublishResult, PluginPublishResultSchema, PluginRemoveOptions, PluginRemoveOptionsSchema, PluginRemoveResult, PluginRemoveResultSchema, ProcessRole, ProcessRoleSchema, PsResult, PsResultSchema, PublishOptions, PublishOptionsSchema, PublishResult, PublishResultSchema, RegistryUseOptionsSchema, RegistryUseResultSchema, RollbackHistoryEntrySchema, RollbackOptionsSchema, RollbackResultSchema, RollbackSlotCheckSchema, RuntimeOverrideTarget, RuntimeOverrideTargetBaseSchema, RuntimeOverrideTargetSchema, SmokeOptionsSchema, SmokeResultSchema, StartOptions, StartOptionsSchema, StartResult, StartResultSchema, StatusResult, StatusResultSchema, SyncOptions, SyncOptionsSchema, SyncResult, SyncResultSchema, TypecheckOptions, TypecheckOptionsSchema, TypecheckResult, TypecheckResultSchema, TypecheckWorkspaceResult, TypecheckWorkspaceResultSchema, TypesGenOptions, TypesGenOptionsSchema, TypesGenResult, TypesGenResultSchema, UpgradeOptions, UpgradeOptionsSchema, UpgradeResult, UpgradeResultSchema, WorkspaceDeployResult, WorkspaceDeployResultSchema, bosContract, commandOptionSchemas } from "./contract.cjs";
2
+ import { BosConfigResult, BuildOptions, BuildOptionsSchema, BuildResultSchema, ConfigOptionsSchema, ConfigResultSchema, DbDoctorOptions, DbDoctorOptionsSchema, DbDoctorResult, DbDoctorResultSchema, DbRepairOptions, DbRepairOptionsSchema, DbRepairResult, DbRepairResultSchema, DbStudioOptions, DbStudioOptionsSchema, DbStudioResult, DbStudioResultSchema, DeployManifestListEntrySchema, DeployOptions, DeployOptionsSchema, DeployResult, DeployResultSchema, DeployedVersionStatusSchema, DevOptions, DevOptionsSchema, DevResult, DevResultSchema, ImportMigrationAppend, ImportMigrationAppendSchema, ImportMigrationCollision, ImportMigrationCollisionSchema, ImportMigrationReconciliation, ImportMigrationReconciliationSchema, ImportOptions, ImportOptionsSchema, ImportResult, ImportResultSchema, ImportRouteDelta, ImportRouteDeltaSchema, InfraExportOptions, InfraExportOptionsSchema, InfraExportResult, InfraExportResultSchema, InfraExportService, InfraExportServiceSchema, InitOptions, InitOptionsSchema, InitResult, InitResultSchema, KeyPublishOptions, KeyPublishOptionsSchema, KeyPublishResult, KeyPublishResultSchema, KillOptions, KillOptionsSchema, KillResult, KillResultSchema, LoginOptions, LoginOptionsSchema, LoginResult, LoginResultSchema, LogoutOptions, LogoutOptionsSchema, LogoutResult, LogoutResultSchema, LogsOptions, LogsOptionsSchema, LogsResult, LogsResultSchema, MfCheckOptions, MfCheckOptionsSchema, MfCheckRemoteResultSchema, MfCheckResult, MfCheckResultSchema, OverrideSection, OverrideSectionSchema, PhaseTiming, PhaseTimingSchema, PidEntry, PidEntrySchema, PluginAddOptions, PluginAddOptionsSchema, PluginAddResult, PluginAddResultSchema, PluginListResult, PluginListResultSchema, PluginPublishOptions, PluginPublishOptionsSchema, PluginPublishResult, PluginPublishResultSchema, PluginRemoveOptions, PluginRemoveOptionsSchema, PluginRemoveResult, PluginRemoveResultSchema, ProcessRole, ProcessRoleSchema, PsResult, PsResultSchema, PublishOptions, PublishOptionsSchema, PublishResult, PublishResultSchema, RegistryUseOptionsSchema, RegistryUseResultSchema, RollbackHistoryEntrySchema, RollbackOptionsSchema, RollbackResultSchema, RollbackSlotCheckSchema, RuntimeOverrideTarget, RuntimeOverrideTargetBaseSchema, RuntimeOverrideTargetSchema, SmokeOptionsSchema, SmokeResultSchema, StartOptions, StartOptionsSchema, StartResult, StartResultSchema, StatusResult, StatusResultSchema, SyncOptions, SyncOptionsSchema, SyncResult, SyncResultSchema, TypecheckOptions, TypecheckOptionsSchema, TypecheckResult, TypecheckResultSchema, TypecheckWorkspaceResult, TypecheckWorkspaceResultSchema, TypesGenOptions, TypesGenOptionsSchema, TypesGenResult, TypesGenResultSchema, UpgradeOptions, UpgradeOptionsSchema, UpgradeResult, UpgradeResultSchema, WorkspaceDeployResult, WorkspaceDeployResultSchema, bosContract, commandOptionSchemas } from "./contract.cjs";
3
3
  import { CliCommandMeta, cliCommandMeta } from "./contract.meta.cjs";
4
4
  import { ConfigHistoryEntry, DeployManifestEntry, NetworkId, PluginManifest, buildRegistryConfigUrl, buildRegistryConfigUrlForNetwork, fetchBosConfigFromFastKv, fetchConfigHistory, fetchDeployManifests, fetchPublishedConfigFromFastKv, fetchRemotePluginManifest, getFastKvBaseUrlForNetwork, getRegistryNamespaceForAccount, getRegistryNamespaceForNetwork, parseBosUrl, parseFastKvConfigValue } from "./fastkv.cjs";
5
5
  import { AnySchema, Context, Effect, Layer, LoadedPluginWithBinding, Plugin, PluginRuntime, RouterContract, Scope, createPlugin, createPluginRuntime, oc, z } from "./sdk.cjs";
6
6
  import { StartConfigSource, isRegistryStart, resolveStartConfigSource } from "./start-config-source.cjs";
7
7
  import { BOS_CONFIG_ORDER, BosEnv, mergeBosConfigWithExtends, rebuildOrderedConfig, resolveExtendsRef } from "./merge.cjs";
8
8
  import { BuildRuntimeConfigOptions, CircularExtendsError, ConfigExtendsError, ConfigLoadError, ConfigNotfoundError, ConfigVersionManifestError, DEV_OVERLAY_FILENAME, DevOverlayError, MISSING_CONFIG_MESSAGE, ResolvedComposableReference, buildRuntimeConfig, buildRuntimeConfigEffect, buildRuntimePluginsForConfig, defaultConfigEnv, findConfigPath, getConfigBaseDir, getHostDevelopmentPort, getResolvedConfigPath, isAppDescriptorPath, isLocalDevelopmentTarget, isRuntimeOverrideAllowed, loadAppDescriptorConfig, loadGeneratedResolvedConfig, localConfigEntryPath, parseAppDescriptorModule, parseDevOverlayModule, parseExtendsTarget, parsePort, parseRuntimeOverrideTargets, readAuthoredConfigInput, readBosConfigForBuild, readLocalAuthoredConfigInput, resetConfigPathCache, resolveBosConfigPath, resolveComposableReference, resolveConfigComposableEntries, resolveDevelopmentHostUrl, resolveLocalDevelopmentPath, resolvePluginRuntimeName, resolveUiRuntimeName, runWithConfigWarningSink, writeResolvedConfig } from "./config.cjs";
9
- export { type AnySchema, ApiPluginConfig, ApiPluginConfigSchema, BOS_CONFIG_ORDER, BosConfig, BosConfigInput, BosConfigInputAppEntry, BosConfigInputSchema, BosConfigResult, BosConfigSchema, type BosEnv, BosPluginRef, BosPluginRefSchema, BosStaging, BosStagingSchema, BuildOptions, BuildOptionsSchema, BuildResultSchema, BuildRuntimeConfigOptions, CdnConfig, CdnConfigSchema, CiConfig, CiConfigSchema, CircularExtendsError, CliCommandMeta, ClientRuntimeConfig, ClientRuntimeConfigSchema, ClientRuntimeInfo, ClientRuntimeInfoSchema, ComposableAppEntry, ComposableAppEntrySchema, ConfigExtendsError, ConfigHistoryEntry, ConfigLoadError, ConfigNotfoundError, ConfigOptionsSchema, ConfigResultSchema, ConfigVersionManifestError, Context, DEV_OVERLAY_FILENAME, DbDoctorOptions, DbDoctorOptionsSchema, DbDoctorResult, DbDoctorResultSchema, DbRepairOptions, DbRepairOptionsSchema, DbRepairResult, DbRepairResultSchema, DbStudioOptions, DbStudioOptionsSchema, DbStudioResult, DbStudioResultSchema, DependencyNodeKind, DependencyNodeKindSchema, DeployManifestEntry, DeployManifestListEntrySchema, DeployOptions, DeployOptionsSchema, DeployResult, DeployResultSchema, DeployedVersionStatusSchema, DevOptions, DevOptionsSchema, DevOverlayError, DevResult, DevResultSchema, Effect, Extends, ExtendsConfig, ExtendsSchema, FederationEntry, FederationEntrySchema, HostConfig, HostConfigSchema, InfraExportOptions, InfraExportOptionsSchema, InfraExportResult, InfraExportResultSchema, InfraExportService, InfraExportServiceSchema, InitOptions, InitOptionsSchema, InitResult, InitResultSchema, JsonObject, JsonObjectSchema, JsonPrimitive, JsonValue, JsonValueSchema, KeyPublishOptions, KeyPublishOptionsSchema, KeyPublishResult, KeyPublishResultSchema, KillOptions, KillOptionsSchema, KillResult, KillResultSchema, Layer, type LoadedPluginWithBinding, LoginOptions, LoginOptionsSchema, LoginResult, LoginResultSchema, LogoutOptions, LogoutOptionsSchema, LogoutResult, LogoutResultSchema, LogsOptions, LogsOptionsSchema, LogsResult, LogsResultSchema, MISSING_CONFIG_MESSAGE, MfCheckOptions, MfCheckOptionsSchema, MfCheckRemoteResultSchema, MfCheckResult, MfCheckResultSchema, NetworkId, OverrideSection, OverrideSectionSchema, ParentStarterConfig, ParentStarterConfigSchema, PhaseTiming, PhaseTimingSchema, PidEntry, PidEntrySchema, type Plugin, PluginAddOptions, PluginAddOptionsSchema, PluginAddResult, PluginAddResultSchema, PluginEntries, PluginEntryValue, PluginListResult, PluginListResultSchema, PluginManifest, PluginPublishOptions, PluginPublishOptionsSchema, PluginPublishResult, PluginPublishResultSchema, PluginRemoveOptions, PluginRemoveOptionsSchema, PluginRemoveResult, PluginRemoveResultSchema, PluginRuntime, PluginRuntimeUi, PluginUiConfig, PluginUiConfigSchema, ProcessRole, ProcessRoleSchema, PsResult, PsResultSchema, PublishAuth, PublishAuthSchema, PublishConfig, PublishConfigSchema, PublishOptions, PublishOptionsSchema, PublishResult, PublishResultSchema, RailwayCi, RailwayCiSchema, RegistryUseOptionsSchema, RegistryUseResultSchema, ResolvedComposableReference, RollbackHistoryEntrySchema, RollbackOptionsSchema, RollbackResultSchema, RollbackSlotCheckSchema, type RouterContract, RuntimeConfig, RuntimeConfigSchema, RuntimeDependencyNode, RuntimeDependencyNodeSchema, RuntimeLineage, RuntimeLineageSchema, RuntimeOverrideTarget, RuntimeOverrideTargetBaseSchema, RuntimeOverrideTargetSchema, RuntimePluginConfig, RuntimePluginConfigSchema, Scope, SharedConfig, SharedConfigSchema, SharedDepConfig, SharedDepConfigSchema, SharedDepMapSchema, SlotPin, SlotPinSchema, SmokeOptionsSchema, SmokeResultSchema, SourceMode, SourceModeSchema, StartConfigSource, StartOptions, StartOptionsSchema, StartResult, StartResultSchema, StarterLevel, StarterLevelConfig, StarterLevelConfigSchema, StarterLevelSchema, StatusResult, StatusResultSchema, SyncOptions, SyncOptionsSchema, SyncResult, SyncResultSchema, TypecheckOptions, TypecheckOptionsSchema, TypecheckResult, TypecheckResultSchema, TypecheckWorkspaceResult, TypecheckWorkspaceResultSchema, TypesGenOptions, TypesGenOptionsSchema, TypesGenResult, TypesGenResultSchema, UiConfig, UiConfigSchema, UpgradeOptions, UpgradeOptionsSchema, UpgradeResult, UpgradeResultSchema, WorkspaceDeployResult, WorkspaceDeployResultSchema, bosContract, buildRegistryConfigUrl, buildRegistryConfigUrlForNetwork, buildRuntimeConfig, buildRuntimeConfigEffect, buildRuntimePluginsForConfig, cliCommandMeta, commandOptionSchemas, createPlugin, createPluginRuntime, defaultConfigEnv, fetchBosConfigFromFastKv, fetchConfigHistory, fetchDeployManifests, fetchPublishedConfigFromFastKv, fetchRemotePluginManifest, findConfigPath, getConfigBaseDir, getFastKvBaseUrlForNetwork, getHostDevelopmentPort, getRegistryNamespaceForAccount, getRegistryNamespaceForNetwork, getResolvedConfigPath, isAppDescriptorPath, isLocalDevelopmentTarget, isRegistryStart, isRuntimeOverrideAllowed, loadAppDescriptorConfig, loadGeneratedResolvedConfig, localConfigEntryPath, mergeBosConfigWithExtends, oc, parseAppDescriptorModule, parseBosUrl, parseDevOverlayModule, parseExtendsTarget, parseFastKvConfigValue, parsePort, parseRuntimeOverrideTargets, readAuthoredConfigInput, readBosConfigForBuild, readLocalAuthoredConfigInput, rebuildOrderedConfig, resetConfigPathCache, resolveBosConfigPath, resolveComposableReference, resolveConfigComposableEntries, resolveDevelopmentHostUrl, resolveExtendsRef, resolveLocalDevelopmentPath, resolvePluginRuntimeName, resolveStartConfigSource, resolveUiRuntimeName, runWithConfigWarningSink, writeResolvedConfig, z };
9
+ export { type AnySchema, ApiPluginConfig, ApiPluginConfigSchema, BOS_CONFIG_ORDER, BosConfig, BosConfigInput, BosConfigInputAppEntry, BosConfigInputSchema, BosConfigResult, BosConfigSchema, type BosEnv, BosPluginRef, BosPluginRefSchema, BosStaging, BosStagingSchema, BuildOptions, BuildOptionsSchema, BuildResultSchema, BuildRuntimeConfigOptions, CdnConfig, CdnConfigSchema, CiConfig, CiConfigSchema, CircularExtendsError, CliCommandMeta, ClientRuntimeConfig, ClientRuntimeConfigSchema, ClientRuntimeInfo, ClientRuntimeInfoSchema, ComposableAppEntry, ComposableAppEntrySchema, ConfigExtendsError, ConfigHistoryEntry, ConfigLoadError, ConfigNotfoundError, ConfigOptionsSchema, ConfigResultSchema, ConfigVersionManifestError, Context, DEV_OVERLAY_FILENAME, DbDoctorOptions, DbDoctorOptionsSchema, DbDoctorResult, DbDoctorResultSchema, DbRepairOptions, DbRepairOptionsSchema, DbRepairResult, DbRepairResultSchema, DbStudioOptions, DbStudioOptionsSchema, DbStudioResult, DbStudioResultSchema, DependencyNodeKind, DependencyNodeKindSchema, DeployManifestEntry, DeployManifestListEntrySchema, DeployOptions, DeployOptionsSchema, DeployResult, DeployResultSchema, DeployedVersionStatusSchema, DevOptions, DevOptionsSchema, DevOverlayError, DevResult, DevResultSchema, Effect, Extends, ExtendsConfig, ExtendsSchema, FederationEntry, FederationEntrySchema, HostConfig, HostConfigSchema, ImportMigrationAppend, ImportMigrationAppendSchema, ImportMigrationCollision, ImportMigrationCollisionSchema, ImportMigrationReconciliation, ImportMigrationReconciliationSchema, ImportOptions, ImportOptionsSchema, ImportResult, ImportResultSchema, ImportRouteDelta, ImportRouteDeltaSchema, InfraExportOptions, InfraExportOptionsSchema, InfraExportResult, InfraExportResultSchema, InfraExportService, InfraExportServiceSchema, InitOptions, InitOptionsSchema, InitResult, InitResultSchema, JsonObject, JsonObjectSchema, JsonPrimitive, JsonValue, JsonValueSchema, KeyPublishOptions, KeyPublishOptionsSchema, KeyPublishResult, KeyPublishResultSchema, KillOptions, KillOptionsSchema, KillResult, KillResultSchema, Layer, type LoadedPluginWithBinding, LoginOptions, LoginOptionsSchema, LoginResult, LoginResultSchema, LogoutOptions, LogoutOptionsSchema, LogoutResult, LogoutResultSchema, LogsOptions, LogsOptionsSchema, LogsResult, LogsResultSchema, MISSING_CONFIG_MESSAGE, MfCheckOptions, MfCheckOptionsSchema, MfCheckRemoteResultSchema, MfCheckResult, MfCheckResultSchema, NetworkId, OverrideSection, OverrideSectionSchema, ParentStarterConfig, ParentStarterConfigSchema, PhaseTiming, PhaseTimingSchema, PidEntry, PidEntrySchema, type Plugin, PluginAddOptions, PluginAddOptionsSchema, PluginAddResult, PluginAddResultSchema, PluginEntries, PluginEntryValue, PluginListResult, PluginListResultSchema, PluginManifest, PluginPublishOptions, PluginPublishOptionsSchema, PluginPublishResult, PluginPublishResultSchema, PluginRemoveOptions, PluginRemoveOptionsSchema, PluginRemoveResult, PluginRemoveResultSchema, PluginRuntime, PluginRuntimeUi, PluginUiConfig, PluginUiConfigSchema, ProcessRole, ProcessRoleSchema, PsResult, PsResultSchema, PublishAuth, PublishAuthSchema, PublishConfig, PublishConfigSchema, PublishOptions, PublishOptionsSchema, PublishResult, PublishResultSchema, RailwayCi, RailwayCiSchema, RegistryUseOptionsSchema, RegistryUseResultSchema, ResolvedComposableReference, RollbackHistoryEntrySchema, RollbackOptionsSchema, RollbackResultSchema, RollbackSlotCheckSchema, type RouterContract, RuntimeConfig, RuntimeConfigSchema, RuntimeDependencyNode, RuntimeDependencyNodeSchema, RuntimeLineage, RuntimeLineageSchema, RuntimeOverrideTarget, RuntimeOverrideTargetBaseSchema, RuntimeOverrideTargetSchema, RuntimePluginConfig, RuntimePluginConfigSchema, Scope, SharedConfig, SharedConfigSchema, SharedDepConfig, SharedDepConfigSchema, SharedDepMapSchema, SlotPin, SlotPinSchema, SmokeOptionsSchema, SmokeResultSchema, SourceMode, SourceModeSchema, StartConfigSource, StartOptions, StartOptionsSchema, StartResult, StartResultSchema, StarterLevel, StarterLevelConfig, StarterLevelConfigSchema, StarterLevelSchema, StatusResult, StatusResultSchema, SyncOptions, SyncOptionsSchema, SyncResult, SyncResultSchema, TypecheckOptions, TypecheckOptionsSchema, TypecheckResult, TypecheckResultSchema, TypecheckWorkspaceResult, TypecheckWorkspaceResultSchema, TypesGenOptions, TypesGenOptionsSchema, TypesGenResult, TypesGenResultSchema, UiConfig, UiConfigSchema, UpgradeOptions, UpgradeOptionsSchema, UpgradeResult, UpgradeResultSchema, WorkspaceDeployResult, WorkspaceDeployResultSchema, bosContract, buildRegistryConfigUrl, buildRegistryConfigUrlForNetwork, buildRuntimeConfig, buildRuntimeConfigEffect, buildRuntimePluginsForConfig, cliCommandMeta, commandOptionSchemas, createPlugin, createPluginRuntime, defaultConfigEnv, fetchBosConfigFromFastKv, fetchConfigHistory, fetchDeployManifests, fetchPublishedConfigFromFastKv, fetchRemotePluginManifest, findConfigPath, getConfigBaseDir, getFastKvBaseUrlForNetwork, getHostDevelopmentPort, getRegistryNamespaceForAccount, getRegistryNamespaceForNetwork, getResolvedConfigPath, isAppDescriptorPath, isLocalDevelopmentTarget, isRegistryStart, isRuntimeOverrideAllowed, loadAppDescriptorConfig, loadGeneratedResolvedConfig, localConfigEntryPath, mergeBosConfigWithExtends, oc, parseAppDescriptorModule, parseBosUrl, parseDevOverlayModule, parseExtendsTarget, parseFastKvConfigValue, parsePort, parseRuntimeOverrideTargets, readAuthoredConfigInput, readBosConfigForBuild, readLocalAuthoredConfigInput, rebuildOrderedConfig, resetConfigPathCache, resolveBosConfigPath, resolveComposableReference, resolveConfigComposableEntries, resolveDevelopmentHostUrl, resolveExtendsRef, resolveLocalDevelopmentPath, resolvePluginRuntimeName, resolveStartConfigSource, resolveUiRuntimeName, runWithConfigWarningSink, writeResolvedConfig, z };
package/dist/index.d.mts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { ApiPluginConfig, ApiPluginConfigSchema, BosConfig, BosConfigInput, BosConfigInputAppEntry, BosConfigInputSchema, BosConfigSchema, BosPluginRef, BosPluginRefSchema, BosStaging, BosStagingSchema, CdnConfig, CdnConfigSchema, CiConfig, CiConfigSchema, ClientRuntimeConfig, ClientRuntimeConfigSchema, ClientRuntimeInfo, ClientRuntimeInfoSchema, ComposableAppEntry, ComposableAppEntrySchema, DependencyNodeKind, DependencyNodeKindSchema, Extends, ExtendsConfig, ExtendsSchema, FederationEntry, FederationEntrySchema, HostConfig, HostConfigSchema, JsonObject, JsonObjectSchema, JsonPrimitive, JsonValue, JsonValueSchema, ParentStarterConfig, ParentStarterConfigSchema, PluginEntries, PluginEntryValue, PluginRuntimeUi, PluginUiConfig, PluginUiConfigSchema, PublishAuth, PublishAuthSchema, PublishConfig, PublishConfigSchema, RailwayCi, RailwayCiSchema, RuntimeConfig, RuntimeConfigSchema, RuntimeDependencyNode, RuntimeDependencyNodeSchema, RuntimeLineage, RuntimeLineageSchema, RuntimePluginConfig, RuntimePluginConfigSchema, SharedConfig, SharedConfigSchema, SharedDepConfig, SharedDepConfigSchema, SharedDepMapSchema, SlotPin, SlotPinSchema, SourceMode, SourceModeSchema, StarterLevel, StarterLevelConfig, StarterLevelConfigSchema, StarterLevelSchema, UiConfig, UiConfigSchema } from "./types.mjs";
2
- import { BosConfigResult, BuildOptions, BuildOptionsSchema, BuildResultSchema, ConfigOptionsSchema, ConfigResultSchema, DbDoctorOptions, DbDoctorOptionsSchema, DbDoctorResult, DbDoctorResultSchema, DbRepairOptions, DbRepairOptionsSchema, DbRepairResult, DbRepairResultSchema, DbStudioOptions, DbStudioOptionsSchema, DbStudioResult, DbStudioResultSchema, DeployManifestListEntrySchema, DeployOptions, DeployOptionsSchema, DeployResult, DeployResultSchema, DeployedVersionStatusSchema, DevOptions, DevOptionsSchema, DevResult, DevResultSchema, InfraExportOptions, InfraExportOptionsSchema, InfraExportResult, InfraExportResultSchema, InfraExportService, InfraExportServiceSchema, InitOptions, InitOptionsSchema, InitResult, InitResultSchema, KeyPublishOptions, KeyPublishOptionsSchema, KeyPublishResult, KeyPublishResultSchema, KillOptions, KillOptionsSchema, KillResult, KillResultSchema, LoginOptions, LoginOptionsSchema, LoginResult, LoginResultSchema, LogoutOptions, LogoutOptionsSchema, LogoutResult, LogoutResultSchema, LogsOptions, LogsOptionsSchema, LogsResult, LogsResultSchema, MfCheckOptions, MfCheckOptionsSchema, MfCheckRemoteResultSchema, MfCheckResult, MfCheckResultSchema, OverrideSection, OverrideSectionSchema, PhaseTiming, PhaseTimingSchema, PidEntry, PidEntrySchema, PluginAddOptions, PluginAddOptionsSchema, PluginAddResult, PluginAddResultSchema, PluginListResult, PluginListResultSchema, PluginPublishOptions, PluginPublishOptionsSchema, PluginPublishResult, PluginPublishResultSchema, PluginRemoveOptions, PluginRemoveOptionsSchema, PluginRemoveResult, PluginRemoveResultSchema, ProcessRole, ProcessRoleSchema, PsResult, PsResultSchema, PublishOptions, PublishOptionsSchema, PublishResult, PublishResultSchema, RegistryUseOptionsSchema, RegistryUseResultSchema, RollbackHistoryEntrySchema, RollbackOptionsSchema, RollbackResultSchema, RollbackSlotCheckSchema, RuntimeOverrideTarget, RuntimeOverrideTargetBaseSchema, RuntimeOverrideTargetSchema, SmokeOptionsSchema, SmokeResultSchema, StartOptions, StartOptionsSchema, StartResult, StartResultSchema, StatusResult, StatusResultSchema, SyncOptions, SyncOptionsSchema, SyncResult, SyncResultSchema, TypecheckOptions, TypecheckOptionsSchema, TypecheckResult, TypecheckResultSchema, TypecheckWorkspaceResult, TypecheckWorkspaceResultSchema, TypesGenOptions, TypesGenOptionsSchema, TypesGenResult, TypesGenResultSchema, UpgradeOptions, UpgradeOptionsSchema, UpgradeResult, UpgradeResultSchema, WorkspaceDeployResult, WorkspaceDeployResultSchema, bosContract, commandOptionSchemas } from "./contract.mjs";
2
+ import { BosConfigResult, BuildOptions, BuildOptionsSchema, BuildResultSchema, ConfigOptionsSchema, ConfigResultSchema, DbDoctorOptions, DbDoctorOptionsSchema, DbDoctorResult, DbDoctorResultSchema, DbRepairOptions, DbRepairOptionsSchema, DbRepairResult, DbRepairResultSchema, DbStudioOptions, DbStudioOptionsSchema, DbStudioResult, DbStudioResultSchema, DeployManifestListEntrySchema, DeployOptions, DeployOptionsSchema, DeployResult, DeployResultSchema, DeployedVersionStatusSchema, DevOptions, DevOptionsSchema, DevResult, DevResultSchema, ImportMigrationAppend, ImportMigrationAppendSchema, ImportMigrationCollision, ImportMigrationCollisionSchema, ImportMigrationReconciliation, ImportMigrationReconciliationSchema, ImportOptions, ImportOptionsSchema, ImportResult, ImportResultSchema, ImportRouteDelta, ImportRouteDeltaSchema, InfraExportOptions, InfraExportOptionsSchema, InfraExportResult, InfraExportResultSchema, InfraExportService, InfraExportServiceSchema, InitOptions, InitOptionsSchema, InitResult, InitResultSchema, KeyPublishOptions, KeyPublishOptionsSchema, KeyPublishResult, KeyPublishResultSchema, KillOptions, KillOptionsSchema, KillResult, KillResultSchema, LoginOptions, LoginOptionsSchema, LoginResult, LoginResultSchema, LogoutOptions, LogoutOptionsSchema, LogoutResult, LogoutResultSchema, LogsOptions, LogsOptionsSchema, LogsResult, LogsResultSchema, MfCheckOptions, MfCheckOptionsSchema, MfCheckRemoteResultSchema, MfCheckResult, MfCheckResultSchema, OverrideSection, OverrideSectionSchema, PhaseTiming, PhaseTimingSchema, PidEntry, PidEntrySchema, PluginAddOptions, PluginAddOptionsSchema, PluginAddResult, PluginAddResultSchema, PluginListResult, PluginListResultSchema, PluginPublishOptions, PluginPublishOptionsSchema, PluginPublishResult, PluginPublishResultSchema, PluginRemoveOptions, PluginRemoveOptionsSchema, PluginRemoveResult, PluginRemoveResultSchema, ProcessRole, ProcessRoleSchema, PsResult, PsResultSchema, PublishOptions, PublishOptionsSchema, PublishResult, PublishResultSchema, RegistryUseOptionsSchema, RegistryUseResultSchema, RollbackHistoryEntrySchema, RollbackOptionsSchema, RollbackResultSchema, RollbackSlotCheckSchema, RuntimeOverrideTarget, RuntimeOverrideTargetBaseSchema, RuntimeOverrideTargetSchema, SmokeOptionsSchema, SmokeResultSchema, StartOptions, StartOptionsSchema, StartResult, StartResultSchema, StatusResult, StatusResultSchema, SyncOptions, SyncOptionsSchema, SyncResult, SyncResultSchema, TypecheckOptions, TypecheckOptionsSchema, TypecheckResult, TypecheckResultSchema, TypecheckWorkspaceResult, TypecheckWorkspaceResultSchema, TypesGenOptions, TypesGenOptionsSchema, TypesGenResult, TypesGenResultSchema, UpgradeOptions, UpgradeOptionsSchema, UpgradeResult, UpgradeResultSchema, WorkspaceDeployResult, WorkspaceDeployResultSchema, bosContract, commandOptionSchemas } from "./contract.mjs";
3
3
  import { CliCommandMeta, cliCommandMeta } from "./contract.meta.mjs";
4
4
  import { ConfigHistoryEntry, DeployManifestEntry, NetworkId, PluginManifest, buildRegistryConfigUrl, buildRegistryConfigUrlForNetwork, fetchBosConfigFromFastKv, fetchConfigHistory, fetchDeployManifests, fetchPublishedConfigFromFastKv, fetchRemotePluginManifest, getFastKvBaseUrlForNetwork, getRegistryNamespaceForAccount, getRegistryNamespaceForNetwork, parseBosUrl, parseFastKvConfigValue } from "./fastkv.mjs";
5
5
  import { AnySchema, Context, Effect, Layer, LoadedPluginWithBinding, Plugin, PluginRuntime, RouterContract, Scope, createPlugin, createPluginRuntime, oc, z } from "./sdk.mjs";
6
6
  import { StartConfigSource, isRegistryStart, resolveStartConfigSource } from "./start-config-source.mjs";
7
7
  import { BOS_CONFIG_ORDER, BosEnv, mergeBosConfigWithExtends, rebuildOrderedConfig, resolveExtendsRef } from "./merge.mjs";
8
8
  import { BuildRuntimeConfigOptions, CircularExtendsError, ConfigExtendsError, ConfigLoadError, ConfigNotfoundError, ConfigVersionManifestError, DEV_OVERLAY_FILENAME, DevOverlayError, MISSING_CONFIG_MESSAGE, ResolvedComposableReference, buildRuntimeConfig, buildRuntimeConfigEffect, buildRuntimePluginsForConfig, defaultConfigEnv, findConfigPath, getConfigBaseDir, getHostDevelopmentPort, getResolvedConfigPath, isAppDescriptorPath, isLocalDevelopmentTarget, isRuntimeOverrideAllowed, loadAppDescriptorConfig, loadGeneratedResolvedConfig, localConfigEntryPath, parseAppDescriptorModule, parseDevOverlayModule, parseExtendsTarget, parsePort, parseRuntimeOverrideTargets, readAuthoredConfigInput, readBosConfigForBuild, readLocalAuthoredConfigInput, resetConfigPathCache, resolveBosConfigPath, resolveComposableReference, resolveConfigComposableEntries, resolveDevelopmentHostUrl, resolveLocalDevelopmentPath, resolvePluginRuntimeName, resolveUiRuntimeName, runWithConfigWarningSink, writeResolvedConfig } from "./config.mjs";
9
- export { type AnySchema, ApiPluginConfig, ApiPluginConfigSchema, BOS_CONFIG_ORDER, BosConfig, BosConfigInput, BosConfigInputAppEntry, BosConfigInputSchema, BosConfigResult, BosConfigSchema, type BosEnv, BosPluginRef, BosPluginRefSchema, BosStaging, BosStagingSchema, BuildOptions, BuildOptionsSchema, BuildResultSchema, BuildRuntimeConfigOptions, CdnConfig, CdnConfigSchema, CiConfig, CiConfigSchema, CircularExtendsError, CliCommandMeta, ClientRuntimeConfig, ClientRuntimeConfigSchema, ClientRuntimeInfo, ClientRuntimeInfoSchema, ComposableAppEntry, ComposableAppEntrySchema, ConfigExtendsError, ConfigHistoryEntry, ConfigLoadError, ConfigNotfoundError, ConfigOptionsSchema, ConfigResultSchema, ConfigVersionManifestError, Context, DEV_OVERLAY_FILENAME, DbDoctorOptions, DbDoctorOptionsSchema, DbDoctorResult, DbDoctorResultSchema, DbRepairOptions, DbRepairOptionsSchema, DbRepairResult, DbRepairResultSchema, DbStudioOptions, DbStudioOptionsSchema, DbStudioResult, DbStudioResultSchema, DependencyNodeKind, DependencyNodeKindSchema, DeployManifestEntry, DeployManifestListEntrySchema, DeployOptions, DeployOptionsSchema, DeployResult, DeployResultSchema, DeployedVersionStatusSchema, DevOptions, DevOptionsSchema, DevOverlayError, DevResult, DevResultSchema, Effect, Extends, ExtendsConfig, ExtendsSchema, FederationEntry, FederationEntrySchema, HostConfig, HostConfigSchema, InfraExportOptions, InfraExportOptionsSchema, InfraExportResult, InfraExportResultSchema, InfraExportService, InfraExportServiceSchema, InitOptions, InitOptionsSchema, InitResult, InitResultSchema, JsonObject, JsonObjectSchema, JsonPrimitive, JsonValue, JsonValueSchema, KeyPublishOptions, KeyPublishOptionsSchema, KeyPublishResult, KeyPublishResultSchema, KillOptions, KillOptionsSchema, KillResult, KillResultSchema, Layer, type LoadedPluginWithBinding, LoginOptions, LoginOptionsSchema, LoginResult, LoginResultSchema, LogoutOptions, LogoutOptionsSchema, LogoutResult, LogoutResultSchema, LogsOptions, LogsOptionsSchema, LogsResult, LogsResultSchema, MISSING_CONFIG_MESSAGE, MfCheckOptions, MfCheckOptionsSchema, MfCheckRemoteResultSchema, MfCheckResult, MfCheckResultSchema, NetworkId, OverrideSection, OverrideSectionSchema, ParentStarterConfig, ParentStarterConfigSchema, PhaseTiming, PhaseTimingSchema, PidEntry, PidEntrySchema, type Plugin, PluginAddOptions, PluginAddOptionsSchema, PluginAddResult, PluginAddResultSchema, PluginEntries, PluginEntryValue, PluginListResult, PluginListResultSchema, PluginManifest, PluginPublishOptions, PluginPublishOptionsSchema, PluginPublishResult, PluginPublishResultSchema, PluginRemoveOptions, PluginRemoveOptionsSchema, PluginRemoveResult, PluginRemoveResultSchema, PluginRuntime, PluginRuntimeUi, PluginUiConfig, PluginUiConfigSchema, ProcessRole, ProcessRoleSchema, PsResult, PsResultSchema, PublishAuth, PublishAuthSchema, PublishConfig, PublishConfigSchema, PublishOptions, PublishOptionsSchema, PublishResult, PublishResultSchema, RailwayCi, RailwayCiSchema, RegistryUseOptionsSchema, RegistryUseResultSchema, ResolvedComposableReference, RollbackHistoryEntrySchema, RollbackOptionsSchema, RollbackResultSchema, RollbackSlotCheckSchema, type RouterContract, RuntimeConfig, RuntimeConfigSchema, RuntimeDependencyNode, RuntimeDependencyNodeSchema, RuntimeLineage, RuntimeLineageSchema, RuntimeOverrideTarget, RuntimeOverrideTargetBaseSchema, RuntimeOverrideTargetSchema, RuntimePluginConfig, RuntimePluginConfigSchema, Scope, SharedConfig, SharedConfigSchema, SharedDepConfig, SharedDepConfigSchema, SharedDepMapSchema, SlotPin, SlotPinSchema, SmokeOptionsSchema, SmokeResultSchema, SourceMode, SourceModeSchema, StartConfigSource, StartOptions, StartOptionsSchema, StartResult, StartResultSchema, StarterLevel, StarterLevelConfig, StarterLevelConfigSchema, StarterLevelSchema, StatusResult, StatusResultSchema, SyncOptions, SyncOptionsSchema, SyncResult, SyncResultSchema, TypecheckOptions, TypecheckOptionsSchema, TypecheckResult, TypecheckResultSchema, TypecheckWorkspaceResult, TypecheckWorkspaceResultSchema, TypesGenOptions, TypesGenOptionsSchema, TypesGenResult, TypesGenResultSchema, UiConfig, UiConfigSchema, UpgradeOptions, UpgradeOptionsSchema, UpgradeResult, UpgradeResultSchema, WorkspaceDeployResult, WorkspaceDeployResultSchema, bosContract, buildRegistryConfigUrl, buildRegistryConfigUrlForNetwork, buildRuntimeConfig, buildRuntimeConfigEffect, buildRuntimePluginsForConfig, cliCommandMeta, commandOptionSchemas, createPlugin, createPluginRuntime, defaultConfigEnv, fetchBosConfigFromFastKv, fetchConfigHistory, fetchDeployManifests, fetchPublishedConfigFromFastKv, fetchRemotePluginManifest, findConfigPath, getConfigBaseDir, getFastKvBaseUrlForNetwork, getHostDevelopmentPort, getRegistryNamespaceForAccount, getRegistryNamespaceForNetwork, getResolvedConfigPath, isAppDescriptorPath, isLocalDevelopmentTarget, isRegistryStart, isRuntimeOverrideAllowed, loadAppDescriptorConfig, loadGeneratedResolvedConfig, localConfigEntryPath, mergeBosConfigWithExtends, oc, parseAppDescriptorModule, parseBosUrl, parseDevOverlayModule, parseExtendsTarget, parseFastKvConfigValue, parsePort, parseRuntimeOverrideTargets, readAuthoredConfigInput, readBosConfigForBuild, readLocalAuthoredConfigInput, rebuildOrderedConfig, resetConfigPathCache, resolveBosConfigPath, resolveComposableReference, resolveConfigComposableEntries, resolveDevelopmentHostUrl, resolveExtendsRef, resolveLocalDevelopmentPath, resolvePluginRuntimeName, resolveStartConfigSource, resolveUiRuntimeName, runWithConfigWarningSink, writeResolvedConfig, z };
9
+ export { type AnySchema, ApiPluginConfig, ApiPluginConfigSchema, BOS_CONFIG_ORDER, BosConfig, BosConfigInput, BosConfigInputAppEntry, BosConfigInputSchema, BosConfigResult, BosConfigSchema, type BosEnv, BosPluginRef, BosPluginRefSchema, BosStaging, BosStagingSchema, BuildOptions, BuildOptionsSchema, BuildResultSchema, BuildRuntimeConfigOptions, CdnConfig, CdnConfigSchema, CiConfig, CiConfigSchema, CircularExtendsError, CliCommandMeta, ClientRuntimeConfig, ClientRuntimeConfigSchema, ClientRuntimeInfo, ClientRuntimeInfoSchema, ComposableAppEntry, ComposableAppEntrySchema, ConfigExtendsError, ConfigHistoryEntry, ConfigLoadError, ConfigNotfoundError, ConfigOptionsSchema, ConfigResultSchema, ConfigVersionManifestError, Context, DEV_OVERLAY_FILENAME, DbDoctorOptions, DbDoctorOptionsSchema, DbDoctorResult, DbDoctorResultSchema, DbRepairOptions, DbRepairOptionsSchema, DbRepairResult, DbRepairResultSchema, DbStudioOptions, DbStudioOptionsSchema, DbStudioResult, DbStudioResultSchema, DependencyNodeKind, DependencyNodeKindSchema, DeployManifestEntry, DeployManifestListEntrySchema, DeployOptions, DeployOptionsSchema, DeployResult, DeployResultSchema, DeployedVersionStatusSchema, DevOptions, DevOptionsSchema, DevOverlayError, DevResult, DevResultSchema, Effect, Extends, ExtendsConfig, ExtendsSchema, FederationEntry, FederationEntrySchema, HostConfig, HostConfigSchema, ImportMigrationAppend, ImportMigrationAppendSchema, ImportMigrationCollision, ImportMigrationCollisionSchema, ImportMigrationReconciliation, ImportMigrationReconciliationSchema, ImportOptions, ImportOptionsSchema, ImportResult, ImportResultSchema, ImportRouteDelta, ImportRouteDeltaSchema, InfraExportOptions, InfraExportOptionsSchema, InfraExportResult, InfraExportResultSchema, InfraExportService, InfraExportServiceSchema, InitOptions, InitOptionsSchema, InitResult, InitResultSchema, JsonObject, JsonObjectSchema, JsonPrimitive, JsonValue, JsonValueSchema, KeyPublishOptions, KeyPublishOptionsSchema, KeyPublishResult, KeyPublishResultSchema, KillOptions, KillOptionsSchema, KillResult, KillResultSchema, Layer, type LoadedPluginWithBinding, LoginOptions, LoginOptionsSchema, LoginResult, LoginResultSchema, LogoutOptions, LogoutOptionsSchema, LogoutResult, LogoutResultSchema, LogsOptions, LogsOptionsSchema, LogsResult, LogsResultSchema, MISSING_CONFIG_MESSAGE, MfCheckOptions, MfCheckOptionsSchema, MfCheckRemoteResultSchema, MfCheckResult, MfCheckResultSchema, NetworkId, OverrideSection, OverrideSectionSchema, ParentStarterConfig, ParentStarterConfigSchema, PhaseTiming, PhaseTimingSchema, PidEntry, PidEntrySchema, type Plugin, PluginAddOptions, PluginAddOptionsSchema, PluginAddResult, PluginAddResultSchema, PluginEntries, PluginEntryValue, PluginListResult, PluginListResultSchema, PluginManifest, PluginPublishOptions, PluginPublishOptionsSchema, PluginPublishResult, PluginPublishResultSchema, PluginRemoveOptions, PluginRemoveOptionsSchema, PluginRemoveResult, PluginRemoveResultSchema, PluginRuntime, PluginRuntimeUi, PluginUiConfig, PluginUiConfigSchema, ProcessRole, ProcessRoleSchema, PsResult, PsResultSchema, PublishAuth, PublishAuthSchema, PublishConfig, PublishConfigSchema, PublishOptions, PublishOptionsSchema, PublishResult, PublishResultSchema, RailwayCi, RailwayCiSchema, RegistryUseOptionsSchema, RegistryUseResultSchema, ResolvedComposableReference, RollbackHistoryEntrySchema, RollbackOptionsSchema, RollbackResultSchema, RollbackSlotCheckSchema, type RouterContract, RuntimeConfig, RuntimeConfigSchema, RuntimeDependencyNode, RuntimeDependencyNodeSchema, RuntimeLineage, RuntimeLineageSchema, RuntimeOverrideTarget, RuntimeOverrideTargetBaseSchema, RuntimeOverrideTargetSchema, RuntimePluginConfig, RuntimePluginConfigSchema, Scope, SharedConfig, SharedConfigSchema, SharedDepConfig, SharedDepConfigSchema, SharedDepMapSchema, SlotPin, SlotPinSchema, SmokeOptionsSchema, SmokeResultSchema, SourceMode, SourceModeSchema, StartConfigSource, StartOptions, StartOptionsSchema, StartResult, StartResultSchema, StarterLevel, StarterLevelConfig, StarterLevelConfigSchema, StarterLevelSchema, StatusResult, StatusResultSchema, SyncOptions, SyncOptionsSchema, SyncResult, SyncResultSchema, TypecheckOptions, TypecheckOptionsSchema, TypecheckResult, TypecheckResultSchema, TypecheckWorkspaceResult, TypecheckWorkspaceResultSchema, TypesGenOptions, TypesGenOptionsSchema, TypesGenResult, TypesGenResultSchema, UiConfig, UiConfigSchema, UpgradeOptions, UpgradeOptionsSchema, UpgradeResult, UpgradeResultSchema, WorkspaceDeployResult, WorkspaceDeployResultSchema, bosContract, buildRegistryConfigUrl, buildRegistryConfigUrlForNetwork, buildRuntimeConfig, buildRuntimeConfigEffect, buildRuntimePluginsForConfig, cliCommandMeta, commandOptionSchemas, createPlugin, createPluginRuntime, defaultConfigEnv, fetchBosConfigFromFastKv, fetchConfigHistory, fetchDeployManifests, fetchPublishedConfigFromFastKv, fetchRemotePluginManifest, findConfigPath, getConfigBaseDir, getFastKvBaseUrlForNetwork, getHostDevelopmentPort, getRegistryNamespaceForAccount, getRegistryNamespaceForNetwork, getResolvedConfigPath, isAppDescriptorPath, isLocalDevelopmentTarget, isRegistryStart, isRuntimeOverrideAllowed, loadAppDescriptorConfig, loadGeneratedResolvedConfig, localConfigEntryPath, mergeBosConfigWithExtends, oc, parseAppDescriptorModule, parseBosUrl, parseDevOverlayModule, parseExtendsTarget, parseFastKvConfigValue, parsePort, parseRuntimeOverrideTargets, readAuthoredConfigInput, readBosConfigForBuild, readLocalAuthoredConfigInput, rebuildOrderedConfig, resetConfigPathCache, resolveBosConfigPath, resolveComposableReference, resolveConfigComposableEntries, resolveDevelopmentHostUrl, resolveExtendsRef, resolveLocalDevelopmentPath, resolvePluginRuntimeName, resolveStartConfigSource, resolveUiRuntimeName, runWithConfigWarningSink, writeResolvedConfig, z };
package/dist/index.mjs CHANGED
@@ -3,8 +3,8 @@ import { ApiPluginConfigSchema, BosConfigInputSchema, BosConfigSchema, BosPlugin
3
3
  import { buildRegistryConfigUrl, buildRegistryConfigUrlForNetwork, fetchBosConfigFromFastKv, fetchConfigHistory, fetchDeployManifests, fetchPublishedConfigFromFastKv, fetchRemotePluginManifest, getFastKvBaseUrlForNetwork, getRegistryNamespaceForAccount, getRegistryNamespaceForNetwork, parseBosUrl, parseFastKvConfigValue } from "./fastkv.mjs";
4
4
  import { CircularExtendsError, ConfigExtendsError, ConfigLoadError, ConfigNotfoundError, ConfigVersionManifestError, DEV_OVERLAY_FILENAME, DevOverlayError, MISSING_CONFIG_MESSAGE, buildRuntimeConfig, buildRuntimeConfigEffect, buildRuntimePluginsForConfig, defaultConfigEnv, findConfigPath, getConfigBaseDir, getHostDevelopmentPort, getResolvedConfigPath, isAppDescriptorPath, isLocalDevelopmentTarget, isRuntimeOverrideAllowed, loadAppDescriptorConfig, loadGeneratedResolvedConfig, localConfigEntryPath, parseAppDescriptorModule, parseDevOverlayModule, parseExtendsTarget, parsePort, parseRuntimeOverrideTargets, readAuthoredConfigInput, readBosConfigForBuild, readLocalAuthoredConfigInput, resetConfigPathCache, resolveBosConfigPath, resolveComposableReference, resolveConfigComposableEntries, resolveDevelopmentHostUrl, resolveLocalDevelopmentPath, resolvePluginRuntimeName, resolveUiRuntimeName, runWithConfigWarningSink, writeResolvedConfig } from "./config.mjs";
5
5
  import { Context, Effect, Layer, PluginRuntime, Scope, createPlugin, createPluginRuntime, oc, z } from "./sdk.mjs";
6
- import { BuildOptionsSchema, BuildResultSchema, ConfigOptionsSchema, ConfigResultSchema, DbDoctorOptionsSchema, DbDoctorResultSchema, DbRepairOptionsSchema, DbRepairResultSchema, DbStudioOptionsSchema, DbStudioResultSchema, DeployManifestListEntrySchema, DeployOptionsSchema, DeployResultSchema, DeployedVersionStatusSchema, DevOptionsSchema, DevResultSchema, InfraExportOptionsSchema, InfraExportResultSchema, InfraExportServiceSchema, InitOptionsSchema, InitResultSchema, KeyPublishOptionsSchema, KeyPublishResultSchema, KillOptionsSchema, KillResultSchema, LoginOptionsSchema, LoginResultSchema, LogoutOptionsSchema, LogoutResultSchema, LogsOptionsSchema, LogsResultSchema, MfCheckOptionsSchema, MfCheckRemoteResultSchema, MfCheckResultSchema, OverrideSectionSchema, PhaseTimingSchema, PidEntrySchema, PluginAddOptionsSchema, PluginAddResultSchema, PluginListResultSchema, PluginPublishOptionsSchema, PluginPublishResultSchema, PluginRemoveOptionsSchema, PluginRemoveResultSchema, ProcessRoleSchema, PsResultSchema, PublishOptionsSchema, PublishResultSchema, RegistryUseOptionsSchema, RegistryUseResultSchema, RollbackHistoryEntrySchema, RollbackOptionsSchema, RollbackResultSchema, RollbackSlotCheckSchema, RuntimeOverrideTargetBaseSchema, RuntimeOverrideTargetSchema, SmokeOptionsSchema, SmokeResultSchema, StartOptionsSchema, StartResultSchema, StatusResultSchema, SyncOptionsSchema, SyncResultSchema, TypecheckOptionsSchema, TypecheckResultSchema, TypecheckWorkspaceResultSchema, TypesGenOptionsSchema, TypesGenResultSchema, UpgradeOptionsSchema, UpgradeResultSchema, WorkspaceDeployResultSchema, bosContract, commandOptionSchemas } from "./contract.mjs";
6
+ import { BuildOptionsSchema, BuildResultSchema, ConfigOptionsSchema, ConfigResultSchema, DbDoctorOptionsSchema, DbDoctorResultSchema, DbRepairOptionsSchema, DbRepairResultSchema, DbStudioOptionsSchema, DbStudioResultSchema, DeployManifestListEntrySchema, DeployOptionsSchema, DeployResultSchema, DeployedVersionStatusSchema, DevOptionsSchema, DevResultSchema, ImportMigrationAppendSchema, ImportMigrationCollisionSchema, ImportMigrationReconciliationSchema, ImportOptionsSchema, ImportResultSchema, ImportRouteDeltaSchema, InfraExportOptionsSchema, InfraExportResultSchema, InfraExportServiceSchema, InitOptionsSchema, InitResultSchema, KeyPublishOptionsSchema, KeyPublishResultSchema, KillOptionsSchema, KillResultSchema, LoginOptionsSchema, LoginResultSchema, LogoutOptionsSchema, LogoutResultSchema, LogsOptionsSchema, LogsResultSchema, MfCheckOptionsSchema, MfCheckRemoteResultSchema, MfCheckResultSchema, OverrideSectionSchema, PhaseTimingSchema, PidEntrySchema, PluginAddOptionsSchema, PluginAddResultSchema, PluginListResultSchema, PluginPublishOptionsSchema, PluginPublishResultSchema, PluginRemoveOptionsSchema, PluginRemoveResultSchema, ProcessRoleSchema, PsResultSchema, PublishOptionsSchema, PublishResultSchema, RegistryUseOptionsSchema, RegistryUseResultSchema, RollbackHistoryEntrySchema, RollbackOptionsSchema, RollbackResultSchema, RollbackSlotCheckSchema, RuntimeOverrideTargetBaseSchema, RuntimeOverrideTargetSchema, SmokeOptionsSchema, SmokeResultSchema, StartOptionsSchema, StartResultSchema, StatusResultSchema, SyncOptionsSchema, SyncResultSchema, TypecheckOptionsSchema, TypecheckResultSchema, TypecheckWorkspaceResultSchema, TypesGenOptionsSchema, TypesGenResultSchema, UpgradeOptionsSchema, UpgradeResultSchema, WorkspaceDeployResultSchema, bosContract, commandOptionSchemas } from "./contract.mjs";
7
7
  import { cliCommandMeta } from "./contract.meta.mjs";
8
8
  import { isRegistryStart, resolveStartConfigSource } from "./start-config-source.mjs";
9
9
 
10
- export { ApiPluginConfigSchema, BOS_CONFIG_ORDER, BosConfigInputSchema, BosConfigSchema, BosPluginRefSchema, BosStagingSchema, BuildOptionsSchema, BuildResultSchema, CdnConfigSchema, CiConfigSchema, CircularExtendsError, ClientRuntimeConfigSchema, ClientRuntimeInfoSchema, ComposableAppEntrySchema, ConfigExtendsError, ConfigLoadError, ConfigNotfoundError, ConfigOptionsSchema, ConfigResultSchema, ConfigVersionManifestError, Context, DEV_OVERLAY_FILENAME, DbDoctorOptionsSchema, DbDoctorResultSchema, DbRepairOptionsSchema, DbRepairResultSchema, DbStudioOptionsSchema, DbStudioResultSchema, DependencyNodeKindSchema, DeployManifestListEntrySchema, DeployOptionsSchema, DeployResultSchema, DeployedVersionStatusSchema, DevOptionsSchema, DevOverlayError, DevResultSchema, Effect, ExtendsSchema, FederationEntrySchema, HostConfigSchema, InfraExportOptionsSchema, InfraExportResultSchema, InfraExportServiceSchema, InitOptionsSchema, InitResultSchema, JsonObjectSchema, JsonValueSchema, KeyPublishOptionsSchema, KeyPublishResultSchema, KillOptionsSchema, KillResultSchema, Layer, LoginOptionsSchema, LoginResultSchema, LogoutOptionsSchema, LogoutResultSchema, LogsOptionsSchema, LogsResultSchema, MISSING_CONFIG_MESSAGE, MfCheckOptionsSchema, MfCheckRemoteResultSchema, MfCheckResultSchema, OverrideSectionSchema, ParentStarterConfigSchema, PhaseTimingSchema, PidEntrySchema, PluginAddOptionsSchema, PluginAddResultSchema, PluginListResultSchema, PluginPublishOptionsSchema, PluginPublishResultSchema, PluginRemoveOptionsSchema, PluginRemoveResultSchema, PluginRuntime, PluginUiConfigSchema, ProcessRoleSchema, PsResultSchema, PublishAuthSchema, PublishConfigSchema, PublishOptionsSchema, PublishResultSchema, RailwayCiSchema, RegistryUseOptionsSchema, RegistryUseResultSchema, RollbackHistoryEntrySchema, RollbackOptionsSchema, RollbackResultSchema, RollbackSlotCheckSchema, RuntimeConfigSchema, RuntimeDependencyNodeSchema, RuntimeLineageSchema, RuntimeOverrideTargetBaseSchema, RuntimeOverrideTargetSchema, RuntimePluginConfigSchema, Scope, SharedConfigSchema, SharedDepConfigSchema, SharedDepMapSchema, SlotPinSchema, SmokeOptionsSchema, SmokeResultSchema, SourceModeSchema, StartOptionsSchema, StartResultSchema, StarterLevelConfigSchema, StarterLevelSchema, StatusResultSchema, SyncOptionsSchema, SyncResultSchema, TypecheckOptionsSchema, TypecheckResultSchema, TypecheckWorkspaceResultSchema, TypesGenOptionsSchema, TypesGenResultSchema, UiConfigSchema, UpgradeOptionsSchema, UpgradeResultSchema, WorkspaceDeployResultSchema, bosContract, buildRegistryConfigUrl, buildRegistryConfigUrlForNetwork, buildRuntimeConfig, buildRuntimeConfigEffect, buildRuntimePluginsForConfig, cliCommandMeta, commandOptionSchemas, createPlugin, createPluginRuntime, defaultConfigEnv, fetchBosConfigFromFastKv, fetchConfigHistory, fetchDeployManifests, fetchPublishedConfigFromFastKv, fetchRemotePluginManifest, findConfigPath, getConfigBaseDir, getFastKvBaseUrlForNetwork, getHostDevelopmentPort, getRegistryNamespaceForAccount, getRegistryNamespaceForNetwork, getResolvedConfigPath, isAppDescriptorPath, isLocalDevelopmentTarget, isRegistryStart, isRuntimeOverrideAllowed, loadAppDescriptorConfig, loadGeneratedResolvedConfig, localConfigEntryPath, mergeBosConfigWithExtends, oc, parseAppDescriptorModule, parseBosUrl, parseDevOverlayModule, parseExtendsTarget, parseFastKvConfigValue, parsePort, parseRuntimeOverrideTargets, readAuthoredConfigInput, readBosConfigForBuild, readLocalAuthoredConfigInput, rebuildOrderedConfig, resetConfigPathCache, resolveBosConfigPath, resolveComposableReference, resolveConfigComposableEntries, resolveDevelopmentHostUrl, resolveExtendsRef, resolveLocalDevelopmentPath, resolvePluginRuntimeName, resolveStartConfigSource, resolveUiRuntimeName, runWithConfigWarningSink, writeResolvedConfig, z };
10
+ export { ApiPluginConfigSchema, BOS_CONFIG_ORDER, BosConfigInputSchema, BosConfigSchema, BosPluginRefSchema, BosStagingSchema, BuildOptionsSchema, BuildResultSchema, CdnConfigSchema, CiConfigSchema, CircularExtendsError, ClientRuntimeConfigSchema, ClientRuntimeInfoSchema, ComposableAppEntrySchema, ConfigExtendsError, ConfigLoadError, ConfigNotfoundError, ConfigOptionsSchema, ConfigResultSchema, ConfigVersionManifestError, Context, DEV_OVERLAY_FILENAME, DbDoctorOptionsSchema, DbDoctorResultSchema, DbRepairOptionsSchema, DbRepairResultSchema, DbStudioOptionsSchema, DbStudioResultSchema, DependencyNodeKindSchema, DeployManifestListEntrySchema, DeployOptionsSchema, DeployResultSchema, DeployedVersionStatusSchema, DevOptionsSchema, DevOverlayError, DevResultSchema, Effect, ExtendsSchema, FederationEntrySchema, HostConfigSchema, ImportMigrationAppendSchema, ImportMigrationCollisionSchema, ImportMigrationReconciliationSchema, ImportOptionsSchema, ImportResultSchema, ImportRouteDeltaSchema, InfraExportOptionsSchema, InfraExportResultSchema, InfraExportServiceSchema, InitOptionsSchema, InitResultSchema, JsonObjectSchema, JsonValueSchema, KeyPublishOptionsSchema, KeyPublishResultSchema, KillOptionsSchema, KillResultSchema, Layer, LoginOptionsSchema, LoginResultSchema, LogoutOptionsSchema, LogoutResultSchema, LogsOptionsSchema, LogsResultSchema, MISSING_CONFIG_MESSAGE, MfCheckOptionsSchema, MfCheckRemoteResultSchema, MfCheckResultSchema, OverrideSectionSchema, ParentStarterConfigSchema, PhaseTimingSchema, PidEntrySchema, PluginAddOptionsSchema, PluginAddResultSchema, PluginListResultSchema, PluginPublishOptionsSchema, PluginPublishResultSchema, PluginRemoveOptionsSchema, PluginRemoveResultSchema, PluginRuntime, PluginUiConfigSchema, ProcessRoleSchema, PsResultSchema, PublishAuthSchema, PublishConfigSchema, PublishOptionsSchema, PublishResultSchema, RailwayCiSchema, RegistryUseOptionsSchema, RegistryUseResultSchema, RollbackHistoryEntrySchema, RollbackOptionsSchema, RollbackResultSchema, RollbackSlotCheckSchema, RuntimeConfigSchema, RuntimeDependencyNodeSchema, RuntimeLineageSchema, RuntimeOverrideTargetBaseSchema, RuntimeOverrideTargetSchema, RuntimePluginConfigSchema, Scope, SharedConfigSchema, SharedDepConfigSchema, SharedDepMapSchema, SlotPinSchema, SmokeOptionsSchema, SmokeResultSchema, SourceModeSchema, StartOptionsSchema, StartResultSchema, StarterLevelConfigSchema, StarterLevelSchema, StatusResultSchema, SyncOptionsSchema, SyncResultSchema, TypecheckOptionsSchema, TypecheckResultSchema, TypecheckWorkspaceResultSchema, TypesGenOptionsSchema, TypesGenResultSchema, UiConfigSchema, UpgradeOptionsSchema, UpgradeResultSchema, WorkspaceDeployResultSchema, bosContract, buildRegistryConfigUrl, buildRegistryConfigUrlForNetwork, buildRuntimeConfig, buildRuntimeConfigEffect, buildRuntimePluginsForConfig, cliCommandMeta, commandOptionSchemas, createPlugin, createPluginRuntime, defaultConfigEnv, fetchBosConfigFromFastKv, fetchConfigHistory, fetchDeployManifests, fetchPublishedConfigFromFastKv, fetchRemotePluginManifest, findConfigPath, getConfigBaseDir, getFastKvBaseUrlForNetwork, getHostDevelopmentPort, getRegistryNamespaceForAccount, getRegistryNamespaceForNetwork, getResolvedConfigPath, isAppDescriptorPath, isLocalDevelopmentTarget, isRegistryStart, isRuntimeOverrideAllowed, loadAppDescriptorConfig, loadGeneratedResolvedConfig, localConfigEntryPath, mergeBosConfigWithExtends, oc, parseAppDescriptorModule, parseBosUrl, parseDevOverlayModule, parseExtendsTarget, parseFastKvConfigValue, parsePort, parseRuntimeOverrideTargets, readAuthoredConfigInput, readBosConfigForBuild, readLocalAuthoredConfigInput, rebuildOrderedConfig, resetConfigPathCache, resolveBosConfigPath, resolveComposableReference, resolveConfigComposableEntries, resolveDevelopmentHostUrl, resolveExtendsRef, resolveLocalDevelopmentPath, resolvePluginRuntimeName, resolveStartConfigSource, resolveUiRuntimeName, runWithConfigWarningSink, writeResolvedConfig, z };
@@ -273,13 +273,17 @@ function planInfra(input) {
273
273
  return effect.Effect.gen(function* () {
274
274
  const cliPorts = normalizeCliPorts(input.cli);
275
275
  const wKey = workspaceKey(input.configDir);
276
- const { ports: svcPorts, claims, devPortsState } = yield* allocateServices(cliPorts, input.bosConfig.plugins ?? {}, input.configDir, input.bosConfig.auth, {
276
+ const plugins = input.bosConfig.plugins ?? {};
277
+ const { ports: svcPorts, claims, devPortsState } = yield* allocateServices(cliPorts, plugins, input.configDir, input.bosConfig.auth, {
277
278
  host: input.bosConfig.host?.source,
278
279
  api: input.bosConfig.api?.source,
279
280
  auth: input.bosConfig.auth?.source,
280
281
  ui: input.bosConfig.ui?.source
281
282
  });
282
- const { dbs, redisPlans } = yield* allocateDatabases(input.bosConfig);
283
+ const { dbs, redisPlans } = input.bosConfig.host?.source === "local" || input.bosConfig.api?.source === "local" || input.bosConfig.auth?.source === "local" || input.bosConfig.ui?.source === "local" || Object.values(plugins).some((p) => p?.source === "local" || p?.ui?.source === "local") ? yield* allocateDatabases(input.bosConfig) : {
284
+ dbs: [],
285
+ redisPlans: []
286
+ };
283
287
  const resolvedPorts = { ...svcPorts };
284
288
  const previousDevPorts = require_infra.loadPortState(input.configDir).devPorts ?? {};
285
289
  const devPorts = {
@@ -1 +1 @@
1
- {"version":3,"file":"planner.cjs","names":["createHash","resolve","Effect","loadPortState","PortAllocator","isAuthMirrorPluginEntry","ownerOfPort","Clock","InfraError","getSecretGroups","buildConventionalDatabases","buildConventionalRedis","shouldPersistPortState","buildDescription"],"sources":["../../src/infra/planner.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { resolve } from \"node:path\";\nimport { Clock, Effect } from \"effect\";\nimport { PortAllocator, type PortBlockEntry } from \"../app\";\nimport {\n buildConventionalDatabases,\n buildConventionalRedis,\n getSecretGroups,\n loadPortState,\n savePortState,\n} from \"../cli/infra\";\nimport {\n type AuthSlotShape,\n buildDescription,\n isAuthMirrorPluginEntry,\n} from \"../service-descriptor\";\nimport type { RuntimeConfig } from \"../types\";\nimport { shouldPersistPortState } from \"./materializer\";\nimport { ownerOfPort } from \"./port-ownership\";\nimport type {\n ClaimRecord,\n CliPorts,\n DatabasePlan,\n InfraInput,\n InfraPlan,\n RedisPlan,\n ResolvedPorts,\n RuntimeLaunchSpec,\n ServiceDescriptorPlan,\n} from \"./types\";\nimport { InfraError } from \"./types\";\n\nconst DEFAULT_HOST_PORT = 3000;\n\nconst POSTGRES_USER = \"everythingdev\";\nconst POSTGRES_PASSWORD = \"everythingdev\";\n\nexport function workspaceKey(configDir: string): string {\n const hash = createHash(\"sha256\").update(resolve(configDir)).digest(\"hex\");\n return hash.slice(0, 12);\n}\n\nfunction normalizeCliPorts(input: InfraInput[\"cli\"]): CliPorts {\n return {\n host: input.port,\n api: input.apiPort,\n auth: input.authPort,\n ui: input.uiPort,\n pluginsStart: input.pluginPortStart,\n plugins: input.plugins,\n };\n}\n\ninterface AllocateServicesResult {\n ports: ResolvedPorts;\n claims: ClaimRecord[];\n devPortsState: {\n host?: number;\n api?: number;\n auth?: number;\n ui?: number;\n pluginPortStart?: number;\n };\n}\n\nexport interface ServiceSources {\n host?: \"local\" | \"remote\";\n api?: \"local\" | \"remote\";\n auth?: \"local\" | \"remote\";\n ui?: \"local\" | \"remote\";\n}\n\nconst PLUGIN_START_OFFSET = 10;\nconst BLOCK_STEP = 100;\n\nfunction allocateServices(\n cliPorts: CliPorts,\n plugins: Record<\n string,\n { source: string; localPath?: string; ui?: { source: string; localPath?: string } }\n >,\n configDir: string,\n auth?: AuthSlotShape,\n sources?: ServiceSources,\n): Effect.Effect<AllocateServicesResult, InfraError, PortAllocator> {\n return Effect.gen(function* () {\n const wKey = workspaceKey(configDir);\n const persisted = loadPortState(configDir).devPorts;\n const allocator = yield* PortAllocator;\n\n const base = cliPorts.host ?? persisted?.host ?? DEFAULT_HOST_PORT;\n const pluginStartPreferred =\n cliPorts.pluginsStart ?? persisted?.pluginPortStart ?? base + PLUGIN_START_OFFSET;\n const pluginStartPinned =\n cliPorts.pluginsStart !== undefined || persisted?.pluginPortStart !== undefined;\n\n const entries: PortBlockEntry[] = [];\n const addEntry = (\n key: string,\n flag: number | undefined,\n persistedValue: number | undefined,\n derived: number,\n ) => {\n if (flag !== undefined) {\n entries.push({ key, preferred: flag, pinned: true });\n } else if (persistedValue !== undefined) {\n entries.push({ key, preferred: persistedValue, pinned: true });\n } else {\n entries.push({ key, preferred: derived, pinned: false });\n }\n };\n\n // Remote-source services spawn nothing locally (ADR 0009 start stack:\n // remotes load over MF from their published origins) — no port is\n // allocated for them. The host is the exception: even when loaded as a\n // remote module, runServer binds its own port.\n addEntry(\"host\", cliPorts.host, undefined, base);\n if (sources?.api !== \"remote\") {\n addEntry(\"api\", cliPorts.api, persisted?.api, base + 1);\n }\n if (sources?.auth !== \"remote\") {\n addEntry(\"auth\", cliPorts.auth, persisted?.auth, base + 2);\n }\n if (sources?.ui !== \"remote\") {\n addEntry(\"ui\", cliPorts.ui, persisted?.ui, base + 3);\n }\n\n const pluginKeys = Object.keys(plugins).sort();\n const isAuthMirrorFor = (\n pluginId: string,\n pluginCfg: { source: string; localPath?: string } | undefined,\n ) => pluginCfg !== undefined && isAuthMirrorPluginEntry(auth, pluginId, pluginCfg);\n\n let pluginSlot = 0;\n for (const pluginId of pluginKeys) {\n const pluginCfg = plugins[pluginId];\n const pluginIsLocal = pluginCfg?.source === \"local\";\n const slotBase = pluginStartPinned ? pluginStartPreferred : base + PLUGIN_START_OFFSET;\n // The auth mirror's backend is owned by the `auth` app slot — no api\n // port. Its ui surface is still real: without a port the runtime config\n // advertises an empty ui.url and the browser can never load the remote\n // (the /login page never renders).\n if (!isAuthMirrorFor(pluginId, pluginCfg) && pluginIsLocal) {\n addEntry(\n `plugin:${pluginId}`,\n cliPorts.plugins?.[pluginId]?.api,\n undefined,\n slotBase + pluginSlot,\n );\n pluginSlot += 1;\n }\n if (\n pluginCfg?.source === \"local\" &&\n pluginCfg?.localPath &&\n pluginCfg?.ui?.source === \"local\"\n ) {\n addEntry(\n `plugin-ui:${pluginId}`,\n cliPorts.plugins?.[pluginId]?.ui,\n undefined,\n slotBase + pluginSlot,\n );\n pluginSlot += 1;\n }\n }\n\n const allocation = yield* allocator.acquireBlock({ base, step: BLOCK_STEP, entries });\n\n if (allocation.base !== base) {\n yield* Effect.logError(\n `[Dev] Preferred port block starting at ${base} is occupied — using ${allocation.base} (this run only; restarts will retry ${base})`,\n );\n for (const conflict of allocation.conflicts.slice(0, 6)) {\n if (conflict.claimed) {\n yield* Effect.logError(\n `[Dev] port ${conflict.port} (${conflict.key}) — live bos session (registry claim)`,\n );\n } else {\n const owner = yield* ownerOfPort(conflict.port);\n yield* Effect.logError(\n `[Dev] port ${conflict.port} (${conflict.key}) — ${\n owner ? `pid ${owner.pid} (${owner.command})` : \"foreign holder (lsof unavailable)\"\n }`,\n );\n }\n }\n }\n\n const pluginApiPorts: Record<string, number> = {};\n const pluginUiPorts: Record<string, number> = {};\n for (const pluginId of pluginKeys) {\n const api = allocation.ports[`plugin:${pluginId}`];\n if (api !== undefined) pluginApiPorts[pluginId] = api;\n const ui = allocation.ports[`plugin-ui:${pluginId}`];\n if (ui !== undefined) pluginUiPorts[pluginId] = ui;\n }\n\n const resolved: ResolvedPorts = {\n host: allocation.ports.host,\n api: allocation.ports.api,\n auth: allocation.ports.auth,\n ui: allocation.ports.ui,\n plugins: Object.fromEntries(\n pluginKeys.map((k) => [k, { api: pluginApiPorts[k], ui: pluginUiPorts[k] }]),\n ),\n };\n\n const devPortsState = {\n host: cliPorts.host,\n api: cliPorts.api,\n auth: cliPorts.auth,\n ui: cliPorts.ui,\n pluginPortStart: cliPorts.pluginsStart,\n };\n\n const claimPorts: Record<string, number> = {};\n for (const [key, port] of Object.entries(allocation.ports)) {\n claimPorts[key] = port;\n }\n\n const claim: ClaimRecord = {\n resourceKey: `workspace:${wKey}`,\n pid: process.pid,\n configDir,\n ports: claimPorts,\n startedAt: yield* Clock.currentTimeMillis,\n };\n\n return { ports: resolved, claims: [claim], devPortsState };\n }).pipe(\n Effect.mapError(\n (portErr) =>\n new InfraError({\n phase: \"allocate-services\",\n message: `Port allocation failed: ${String(portErr)}`,\n cause: portErr,\n }),\n ),\n );\n}\n\nfunction allocateDatabases(runtimeConfig: RuntimeConfig): Effect.Effect<\n {\n dbs: DatabasePlan[];\n redisPlans: RedisPlan[];\n },\n InfraError,\n PortAllocator\n> {\n return Effect.gen(function* () {\n const groups = getSecretGroups(runtimeConfig);\n const allSecrets = groups.flatMap((group) => group.secrets);\n const allocator = yield* PortAllocator;\n\n const conventionalDatabases = buildConventionalDatabases(allSecrets);\n const conventionalRedis = buildConventionalRedis(allSecrets);\n\n const dbs: DatabasePlan[] = [];\n const allocatedByDesired = new Map<number, number>();\n for (const db of conventionalDatabases) {\n let port: number;\n if (allocatedByDesired.has(db.port)) {\n port = allocatedByDesired.get(db.port)!;\n } else {\n port = yield* allocator.pickAvailable(db.port);\n allocatedByDesired.set(db.port, port);\n }\n dbs.push({\n secret: db.secret,\n slug: db.slug,\n port,\n dbName: db.databaseName,\n url: `postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:${port}/${db.databaseName}`,\n });\n }\n\n const redisPlans: RedisPlan[] = [];\n for (const r of conventionalRedis) {\n const port = yield* allocator.pickAvailable(r.port);\n redisPlans.push({\n secret: r.secret,\n slug: r.slug,\n port,\n url: `redis://localhost:${port}`,\n });\n }\n\n return { dbs, redisPlans };\n }).pipe(\n Effect.mapError(\n (portErr) =>\n new InfraError({\n phase: \"allocate-databases\",\n message: `Database port allocation failed: ${String(portErr)}`,\n cause: portErr,\n }),\n ),\n );\n}\n\nexport function buildServiceDescriptors(\n runtimeConfig: RuntimeConfig,\n resolvedPorts: ResolvedPorts,\n): ServiceDescriptorPlan[] {\n const descriptors: ServiceDescriptorPlan[] = [];\n\n if (runtimeConfig.host) {\n const isLocal = runtimeConfig.host.source === \"local\";\n descriptors.push({\n key: \"host\",\n source: runtimeConfig.host.source,\n url: isLocal ? `http://localhost:${resolvedPorts.host}` : runtimeConfig.host.url,\n port: isLocal ? resolvedPorts.host : undefined,\n localPath: isLocal ? runtimeConfig.host.localPath : undefined,\n });\n }\n\n if (runtimeConfig.api) {\n const isLocal = runtimeConfig.api.source === \"local\";\n descriptors.push({\n key: \"api\",\n source: runtimeConfig.api.source,\n url: isLocal ? `http://localhost:${resolvedPorts.api}` : runtimeConfig.api.url,\n port: isLocal ? resolvedPorts.api : undefined,\n localPath: isLocal ? runtimeConfig.api.localPath : undefined,\n });\n }\n\n if (runtimeConfig.auth) {\n const isLocal = runtimeConfig.auth.source === \"local\";\n descriptors.push({\n key: \"auth\",\n source: runtimeConfig.auth.source,\n url: isLocal ? `http://localhost:${resolvedPorts.auth}` : runtimeConfig.auth.url,\n port: isLocal ? resolvedPorts.auth : undefined,\n localPath: isLocal ? runtimeConfig.auth.localPath : undefined,\n });\n }\n\n if (runtimeConfig.ui) {\n const isLocal = runtimeConfig.ui.source === \"local\";\n descriptors.push({\n key: \"ui\",\n source: runtimeConfig.ui.source,\n url: isLocal ? `http://localhost:${resolvedPorts.ui}` : runtimeConfig.ui.url,\n port: isLocal ? resolvedPorts.ui : undefined,\n localPath: isLocal ? runtimeConfig.ui.localPath : undefined,\n });\n }\n\n if (runtimeConfig.plugins) {\n for (const [pluginId, pluginCfg] of Object.entries(runtimeConfig.plugins)) {\n const pluginIsLocal = pluginCfg.source === \"local\";\n const p = resolvedPorts.plugins[pluginId];\n const isAuthMirror = isAuthMirrorPluginEntry(runtimeConfig.auth, pluginId, pluginCfg);\n if (pluginIsLocal && p?.api && !isAuthMirror) {\n descriptors.push({\n key: `plugin:${pluginId}`,\n source: \"local\",\n url: `http://localhost:${p.api}`,\n port: p.api,\n localPath: pluginCfg.localPath,\n });\n }\n if (!pluginIsLocal && pluginCfg.url && !isAuthMirror) {\n descriptors.push({\n key: `plugin:${pluginId}`,\n source: \"remote\",\n url: pluginCfg.url,\n port: undefined,\n localPath: undefined,\n });\n }\n if (pluginIsLocal && p?.ui && pluginCfg.ui?.source === \"local\") {\n descriptors.push({\n key: `plugin-ui:${pluginId}`,\n source: \"local\",\n url: `http://localhost:${p.ui}`,\n port: p.ui,\n localPath: pluginCfg.ui?.localPath,\n });\n }\n }\n }\n\n return descriptors;\n}\n\nexport function buildLaunchSpec(\n runtimeConfig: RuntimeConfig,\n resolvedPorts: ResolvedPorts,\n): RuntimeLaunchSpec {\n const hostPort =\n runtimeConfig.host?.source === \"local\" ? resolvedPorts.host : runtimeConfig.host?.port;\n const corsOrigin = hostPort ? `http://localhost:${hostPort}` : `http://localhost:3000`;\n\n return {\n port: resolvedPorts.host,\n hostUrl: runtimeConfig.host?.url,\n corsOrigin,\n env: {\n ...(resolvedPorts.host ? { PORT: String(resolvedPorts.host) } : {}),\n ...(resolvedPorts.api ? { API_PORT: String(resolvedPorts.api) } : {}),\n ...(resolvedPorts.ui ? { UI_PORT: String(resolvedPorts.ui) } : {}),\n ...(resolvedPorts.auth ? { AUTH_PORT: String(resolvedPorts.auth) } : {}),\n },\n runtimeConfig,\n };\n}\n\nexport function buildEnvGenerated(\n resolvedPorts: ResolvedPorts,\n dbs: DatabasePlan[],\n redisPlans: RedisPlan[],\n): Record<string, string> {\n const env: Record<string, string> = {};\n\n if (resolvedPorts.host) {\n env.CORS_ORIGIN = `http://localhost:${resolvedPorts.host}`;\n // The host origin for plugins that derive absolute URLs from it (e.g. the\n // auth plugin's Better Auth baseURL — email links, passkey RP id).\n env.BASE_URL = `http://localhost:${resolvedPorts.host}`;\n }\n\n for (const db of dbs) {\n env[db.secret] = db.url;\n }\n for (const r of redisPlans) {\n env[r.secret] = r.url;\n }\n\n return env;\n}\n\nexport function planInfra(input: InfraInput): Effect.Effect<InfraPlan, InfraError, PortAllocator> {\n return Effect.gen(function* () {\n const cliPorts = normalizeCliPorts(input.cli);\n const wKey = workspaceKey(input.configDir);\n\n const plugins = (input.bosConfig.plugins ?? {}) as Record<\n string,\n { source: string; localPath?: string; ui?: { source: string; localPath?: string } }\n >;\n\n const {\n ports: svcPorts,\n claims,\n devPortsState,\n } = yield* allocateServices(cliPorts, plugins, input.configDir, input.bosConfig.auth, {\n host: input.bosConfig.host?.source,\n api: input.bosConfig.api?.source,\n auth: input.bosConfig.auth?.source,\n ui: input.bosConfig.ui?.source,\n });\n\n const { dbs, redisPlans } = yield* allocateDatabases(input.bosConfig);\n\n const resolvedPorts: ResolvedPorts = { ...svcPorts };\n\n // Write merged state once after all allocations succeed\n // Skip persistence for regression tests / ephemeral runs\n // devPorts pins are explicit choices only (ADR 0012 §4): this run's flags,\n // falling back to previously-persisted explicit choices — never drift.\n const previousDevPorts = loadPortState(input.configDir).devPorts ?? {};\n const devPorts = {\n host: devPortsState.host ?? previousDevPorts.host,\n api: devPortsState.api ?? previousDevPorts.api,\n auth: devPortsState.auth ?? previousDevPorts.auth,\n ui: devPortsState.ui ?? previousDevPorts.ui,\n pluginPortStart: devPortsState.pluginPortStart ?? previousDevPorts.pluginPortStart,\n };\n if (shouldPersistPortState()) {\n savePortState(input.configDir, { devPorts });\n }\n\n const hostIsLocal = input.bosConfig.host?.source === \"local\";\n const apiIsLocal = input.bosConfig.api?.source === \"local\";\n const uiIsLocal = input.bosConfig.ui?.source === \"local\";\n const authIsLocal = input.bosConfig.auth?.source === \"local\";\n const assignedRuntimeConfig: RuntimeConfig = {\n ...input.bosConfig,\n host: resolvedPorts.host\n ? {\n ...input.bosConfig.host,\n port: resolvedPorts.host,\n url: `http://localhost:${resolvedPorts.host}`,\n remoteUrl: !hostIsLocal\n ? (input.bosConfig.host.remoteUrl ?? input.bosConfig.host.url)\n : undefined,\n }\n : input.bosConfig.host,\n api:\n apiIsLocal && resolvedPorts.api\n ? {\n ...input.bosConfig.api,\n port: resolvedPorts.api,\n url: `http://localhost:${resolvedPorts.api}`,\n }\n : input.bosConfig.api,\n ui:\n uiIsLocal && resolvedPorts.ui\n ? {\n ...input.bosConfig.ui,\n port: resolvedPorts.ui,\n url: `http://localhost:${resolvedPorts.ui}`,\n ssrUrl: undefined,\n }\n : input.bosConfig.ui,\n auth:\n authIsLocal && resolvedPorts.auth && input.bosConfig.auth\n ? {\n ...input.bosConfig.auth,\n port: resolvedPorts.auth,\n url: `http://localhost:${resolvedPorts.auth}`,\n }\n : input.bosConfig.auth,\n plugins: input.bosConfig.plugins\n ? Object.fromEntries(\n Object.entries(input.bosConfig.plugins).map(([id, p]) => {\n const isAuthMirror = isAuthMirrorPluginEntry(input.bosConfig.auth, id, p);\n const pluginPort = resolvedPorts.plugins[id];\n const patchedUi = (() => {\n if (p.ui?.source !== \"local\" || !p.ui?.localPath || !pluginPort?.ui) return p.ui;\n return {\n ...p.ui,\n port: pluginPort.ui,\n url: `http://localhost:${pluginPort.ui}`,\n ssrUrl: undefined,\n };\n })();\n if (isAuthMirror) {\n return [id, { ...p, ui: patchedUi }];\n }\n if (p.source === \"local\" && pluginPort?.api) {\n return [\n id,\n {\n ...p,\n port: pluginPort.api,\n url: `http://localhost:${pluginPort.api}`,\n ui: patchedUi,\n },\n ];\n }\n return [id, p];\n }),\n )\n : undefined,\n };\n\n const serviceDescriptors = buildServiceDescriptors(assignedRuntimeConfig, resolvedPorts);\n\n const launch = buildLaunchSpec(input.bosConfig, resolvedPorts);\n const envGenerated = buildEnvGenerated(resolvedPorts, dbs, redisPlans);\n\n const packages = serviceDescriptors.map((d) => d.key);\n const descriptionMap = new Map(serviceDescriptors.map((d) => [d.key, d]));\n const description = buildDescription(descriptionMap);\n\n const orchestrator = {\n packages,\n env: {},\n description,\n port: resolvedPorts.host,\n interactive: input.cli.interactive,\n };\n\n return {\n workspaceKey: wKey,\n cliPorts,\n resolvedPorts,\n runtimeConfig: assignedRuntimeConfig,\n launch,\n description,\n serviceDescriptors: new Map(serviceDescriptors.map((d) => [d.key, d])),\n envGenerated,\n claims,\n orchestrator,\n };\n });\n}\n"],"mappings":";;;;;;;;;;;AAgCA,MAAM,oBAAoB;AAE1B,MAAM,gBAAgB;AACtB,MAAM,oBAAoB;AAE1B,SAAgB,aAAa,WAA2B;CAEtD,WADaA,wBAAW,QAAQ,CAAC,CAAC,WAAOC,mBAAQ,SAAS,CAAC,CAAC,CAAC,OAAO,KAC1D,CAAC,CAAC,MAAM,GAAG,EAAE;AACzB;AAEA,SAAS,kBAAkB,OAAoC;C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AAI,OAAO,EAAE;KAC9E,OAAO;MACL,GAAG,EAAE;MACL,MAAM,WAAW;MACjB,KAAK,oBAAoB,WAAW;MACpC,QAAQ;KACV;IACF,EAAC,CAAE;IACH,IAAI,cACF,OAAO,CAAC,IAAI;KAAE,GAAG;KAAG,IAAI;IAAU,CAAC;IAErC,IAAI,EAAE,WAAW,WAAW,YAAY,KACtC,OAAO,CACL,IACA;KACE,GAAG;KACH,MAAM,WAAW;KACjB,KAAK,oBAAoB,WAAW;KACpC,IAAI;IACN,CACF;IAEF,OAAO,CAAC,IAAI,CAAC;GACf,CAAC,CACH,IACA;EACN;EAEA,MAAM,qBAAqB,wBAAwB,uBAAuB,aAAa;EAEvF,MAAM,SAAS,gBAAgB,MAAM,WAAW,aAAa;EAC7D,MAAM,eAAe,kBAAkB,eAAe,KAAK,UAAU;EAErE,MAAM,WAAW,mBAAmB,KAAK,MAAM,EAAE,GAAG;EACpD,MAAM,iBAAiB,IAAI,IAAI,mBAAmB,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;EACxE,MAAM,cAAcQ,4CAAiB,cAAc;EAEnD,MAAM,eAAe;GACnB;GACA,KAAK,CAAC;GACN;GACA,MAAM,cAAc;GACpB,aAAa,MAAM,IAAI;EACzB;EAEA,OAAO;GACL,cAAc;GACd;GACA;GACA,eAAe;GACf;GACA;GACA,oBAAoB,IAAI,IAAI,mBAAmB,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;GACrE;GACA;GACA;EACF;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"planner.cjs","names":["createHash","resolve","Effect","loadPortState","PortAllocator","isAuthMirrorPluginEntry","ownerOfPort","Clock","InfraError","getSecretGroups","buildConventionalDatabases","buildConventionalRedis","shouldPersistPortState","buildDescription"],"sources":["../../src/infra/planner.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { resolve } from \"node:path\";\nimport { Clock, Effect } from \"effect\";\nimport { PortAllocator, type PortBlockEntry } from \"../app\";\nimport {\n buildConventionalDatabases,\n buildConventionalRedis,\n getSecretGroups,\n loadPortState,\n savePortState,\n} from \"../cli/infra\";\nimport {\n type AuthSlotShape,\n buildDescription,\n isAuthMirrorPluginEntry,\n} from \"../service-descriptor\";\nimport type { RuntimeConfig } from \"../types\";\nimport { shouldPersistPortState } from \"./materializer\";\nimport { ownerOfPort } from \"./port-ownership\";\nimport type {\n ClaimRecord,\n CliPorts,\n DatabasePlan,\n InfraInput,\n InfraPlan,\n RedisPlan,\n ResolvedPorts,\n RuntimeLaunchSpec,\n ServiceDescriptorPlan,\n} from \"./types\";\nimport { InfraError } from \"./types\";\n\nconst DEFAULT_HOST_PORT = 3000;\n\nconst POSTGRES_USER = \"everythingdev\";\nconst POSTGRES_PASSWORD = \"everythingdev\";\n\nexport function workspaceKey(configDir: string): string {\n const hash = createHash(\"sha256\").update(resolve(configDir)).digest(\"hex\");\n return hash.slice(0, 12);\n}\n\nfunction normalizeCliPorts(input: InfraInput[\"cli\"]): CliPorts {\n return {\n host: input.port,\n api: input.apiPort,\n auth: input.authPort,\n ui: input.uiPort,\n pluginsStart: input.pluginPortStart,\n plugins: input.plugins,\n };\n}\n\ninterface AllocateServicesResult {\n ports: ResolvedPorts;\n claims: ClaimRecord[];\n devPortsState: {\n host?: number;\n api?: number;\n auth?: number;\n ui?: number;\n pluginPortStart?: number;\n };\n}\n\nexport interface ServiceSources {\n host?: \"local\" | \"remote\";\n api?: \"local\" | \"remote\";\n auth?: \"local\" | \"remote\";\n ui?: \"local\" | \"remote\";\n}\n\nconst PLUGIN_START_OFFSET = 10;\nconst BLOCK_STEP = 100;\n\nfunction allocateServices(\n cliPorts: CliPorts,\n plugins: Record<\n string,\n { source: string; localPath?: string; ui?: { source: string; localPath?: string } }\n >,\n configDir: string,\n auth?: AuthSlotShape,\n sources?: ServiceSources,\n): Effect.Effect<AllocateServicesResult, InfraError, PortAllocator> {\n return Effect.gen(function* () {\n const wKey = workspaceKey(configDir);\n const persisted = loadPortState(configDir).devPorts;\n const allocator = yield* PortAllocator;\n\n const base = cliPorts.host ?? persisted?.host ?? DEFAULT_HOST_PORT;\n const pluginStartPreferred =\n cliPorts.pluginsStart ?? persisted?.pluginPortStart ?? base + PLUGIN_START_OFFSET;\n const pluginStartPinned =\n cliPorts.pluginsStart !== undefined || persisted?.pluginPortStart !== undefined;\n\n const entries: PortBlockEntry[] = [];\n const addEntry = (\n key: string,\n flag: number | undefined,\n persistedValue: number | undefined,\n derived: number,\n ) => {\n if (flag !== undefined) {\n entries.push({ key, preferred: flag, pinned: true });\n } else if (persistedValue !== undefined) {\n entries.push({ key, preferred: persistedValue, pinned: true });\n } else {\n entries.push({ key, preferred: derived, pinned: false });\n }\n };\n\n // Remote-source services spawn nothing locally (ADR 0009 start stack:\n // remotes load over MF from their published origins) — no port is\n // allocated for them. The host is the exception: even when loaded as a\n // remote module, runServer binds its own port.\n addEntry(\"host\", cliPorts.host, undefined, base);\n if (sources?.api !== \"remote\") {\n addEntry(\"api\", cliPorts.api, persisted?.api, base + 1);\n }\n if (sources?.auth !== \"remote\") {\n addEntry(\"auth\", cliPorts.auth, persisted?.auth, base + 2);\n }\n if (sources?.ui !== \"remote\") {\n addEntry(\"ui\", cliPorts.ui, persisted?.ui, base + 3);\n }\n\n const pluginKeys = Object.keys(plugins).sort();\n const isAuthMirrorFor = (\n pluginId: string,\n pluginCfg: { source: string; localPath?: string } | undefined,\n ) => pluginCfg !== undefined && isAuthMirrorPluginEntry(auth, pluginId, pluginCfg);\n\n let pluginSlot = 0;\n for (const pluginId of pluginKeys) {\n const pluginCfg = plugins[pluginId];\n const pluginIsLocal = pluginCfg?.source === \"local\";\n const slotBase = pluginStartPinned ? pluginStartPreferred : base + PLUGIN_START_OFFSET;\n // The auth mirror's backend is owned by the `auth` app slot — no api\n // port. Its ui surface is still real: without a port the runtime config\n // advertises an empty ui.url and the browser can never load the remote\n // (the /login page never renders).\n if (!isAuthMirrorFor(pluginId, pluginCfg) && pluginIsLocal) {\n addEntry(\n `plugin:${pluginId}`,\n cliPorts.plugins?.[pluginId]?.api,\n undefined,\n slotBase + pluginSlot,\n );\n pluginSlot += 1;\n }\n if (\n pluginCfg?.source === \"local\" &&\n pluginCfg?.localPath &&\n pluginCfg?.ui?.source === \"local\"\n ) {\n addEntry(\n `plugin-ui:${pluginId}`,\n cliPorts.plugins?.[pluginId]?.ui,\n undefined,\n slotBase + pluginSlot,\n );\n pluginSlot += 1;\n }\n }\n\n const allocation = yield* allocator.acquireBlock({ base, step: BLOCK_STEP, entries });\n\n if (allocation.base !== base) {\n yield* Effect.logError(\n `[Dev] Preferred port block starting at ${base} is occupied — using ${allocation.base} (this run only; restarts will retry ${base})`,\n );\n for (const conflict of allocation.conflicts.slice(0, 6)) {\n if (conflict.claimed) {\n yield* Effect.logError(\n `[Dev] port ${conflict.port} (${conflict.key}) — live bos session (registry claim)`,\n );\n } else {\n const owner = yield* ownerOfPort(conflict.port);\n yield* Effect.logError(\n `[Dev] port ${conflict.port} (${conflict.key}) — ${\n owner ? `pid ${owner.pid} (${owner.command})` : \"foreign holder (lsof unavailable)\"\n }`,\n );\n }\n }\n }\n\n const pluginApiPorts: Record<string, number> = {};\n const pluginUiPorts: Record<string, number> = {};\n for (const pluginId of pluginKeys) {\n const api = allocation.ports[`plugin:${pluginId}`];\n if (api !== undefined) pluginApiPorts[pluginId] = api;\n const ui = allocation.ports[`plugin-ui:${pluginId}`];\n if (ui !== undefined) pluginUiPorts[pluginId] = ui;\n }\n\n const resolved: ResolvedPorts = {\n host: allocation.ports.host,\n api: allocation.ports.api,\n auth: allocation.ports.auth,\n ui: allocation.ports.ui,\n plugins: Object.fromEntries(\n pluginKeys.map((k) => [k, { api: pluginApiPorts[k], ui: pluginUiPorts[k] }]),\n ),\n };\n\n const devPortsState = {\n host: cliPorts.host,\n api: cliPorts.api,\n auth: cliPorts.auth,\n ui: cliPorts.ui,\n pluginPortStart: cliPorts.pluginsStart,\n };\n\n const claimPorts: Record<string, number> = {};\n for (const [key, port] of Object.entries(allocation.ports)) {\n claimPorts[key] = port;\n }\n\n const claim: ClaimRecord = {\n resourceKey: `workspace:${wKey}`,\n pid: process.pid,\n configDir,\n ports: claimPorts,\n startedAt: yield* Clock.currentTimeMillis,\n };\n\n return { ports: resolved, claims: [claim], devPortsState };\n }).pipe(\n Effect.mapError(\n (portErr) =>\n new InfraError({\n phase: \"allocate-services\",\n message: `Port allocation failed: ${String(portErr)}`,\n cause: portErr,\n }),\n ),\n );\n}\n\nfunction allocateDatabases(runtimeConfig: RuntimeConfig): Effect.Effect<\n {\n dbs: DatabasePlan[];\n redisPlans: RedisPlan[];\n },\n InfraError,\n PortAllocator\n> {\n return Effect.gen(function* () {\n const groups = getSecretGroups(runtimeConfig);\n const allSecrets = groups.flatMap((group) => group.secrets);\n const allocator = yield* PortAllocator;\n\n const conventionalDatabases = buildConventionalDatabases(allSecrets);\n const conventionalRedis = buildConventionalRedis(allSecrets);\n\n const dbs: DatabasePlan[] = [];\n const allocatedByDesired = new Map<number, number>();\n for (const db of conventionalDatabases) {\n let port: number;\n if (allocatedByDesired.has(db.port)) {\n port = allocatedByDesired.get(db.port)!;\n } else {\n port = yield* allocator.pickAvailable(db.port);\n allocatedByDesired.set(db.port, port);\n }\n dbs.push({\n secret: db.secret,\n slug: db.slug,\n port,\n dbName: db.databaseName,\n url: `postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:${port}/${db.databaseName}`,\n });\n }\n\n const redisPlans: RedisPlan[] = [];\n for (const r of conventionalRedis) {\n const port = yield* allocator.pickAvailable(r.port);\n redisPlans.push({\n secret: r.secret,\n slug: r.slug,\n port,\n url: `redis://localhost:${port}`,\n });\n }\n\n return { dbs, redisPlans };\n }).pipe(\n Effect.mapError(\n (portErr) =>\n new InfraError({\n phase: \"allocate-databases\",\n message: `Database port allocation failed: ${String(portErr)}`,\n cause: portErr,\n }),\n ),\n );\n}\n\nexport function buildServiceDescriptors(\n runtimeConfig: RuntimeConfig,\n resolvedPorts: ResolvedPorts,\n): ServiceDescriptorPlan[] {\n const descriptors: ServiceDescriptorPlan[] = [];\n\n if (runtimeConfig.host) {\n const isLocal = runtimeConfig.host.source === \"local\";\n descriptors.push({\n key: \"host\",\n source: runtimeConfig.host.source,\n url: isLocal ? `http://localhost:${resolvedPorts.host}` : runtimeConfig.host.url,\n port: isLocal ? resolvedPorts.host : undefined,\n localPath: isLocal ? runtimeConfig.host.localPath : undefined,\n });\n }\n\n if (runtimeConfig.api) {\n const isLocal = runtimeConfig.api.source === \"local\";\n descriptors.push({\n key: \"api\",\n source: runtimeConfig.api.source,\n url: isLocal ? `http://localhost:${resolvedPorts.api}` : runtimeConfig.api.url,\n port: isLocal ? resolvedPorts.api : undefined,\n localPath: isLocal ? runtimeConfig.api.localPath : undefined,\n });\n }\n\n if (runtimeConfig.auth) {\n const isLocal = runtimeConfig.auth.source === \"local\";\n descriptors.push({\n key: \"auth\",\n source: runtimeConfig.auth.source,\n url: isLocal ? `http://localhost:${resolvedPorts.auth}` : runtimeConfig.auth.url,\n port: isLocal ? resolvedPorts.auth : undefined,\n localPath: isLocal ? runtimeConfig.auth.localPath : undefined,\n });\n }\n\n if (runtimeConfig.ui) {\n const isLocal = runtimeConfig.ui.source === \"local\";\n descriptors.push({\n key: \"ui\",\n source: runtimeConfig.ui.source,\n url: isLocal ? `http://localhost:${resolvedPorts.ui}` : runtimeConfig.ui.url,\n port: isLocal ? resolvedPorts.ui : undefined,\n localPath: isLocal ? runtimeConfig.ui.localPath : undefined,\n });\n }\n\n if (runtimeConfig.plugins) {\n for (const [pluginId, pluginCfg] of Object.entries(runtimeConfig.plugins)) {\n const pluginIsLocal = pluginCfg.source === \"local\";\n const p = resolvedPorts.plugins[pluginId];\n const isAuthMirror = isAuthMirrorPluginEntry(runtimeConfig.auth, pluginId, pluginCfg);\n if (pluginIsLocal && p?.api && !isAuthMirror) {\n descriptors.push({\n key: `plugin:${pluginId}`,\n source: \"local\",\n url: `http://localhost:${p.api}`,\n port: p.api,\n localPath: pluginCfg.localPath,\n });\n }\n if (!pluginIsLocal && pluginCfg.url && !isAuthMirror) {\n descriptors.push({\n key: `plugin:${pluginId}`,\n source: \"remote\",\n url: pluginCfg.url,\n port: undefined,\n localPath: undefined,\n });\n }\n if (pluginIsLocal && p?.ui && pluginCfg.ui?.source === \"local\") {\n descriptors.push({\n key: `plugin-ui:${pluginId}`,\n source: \"local\",\n url: `http://localhost:${p.ui}`,\n port: p.ui,\n localPath: pluginCfg.ui?.localPath,\n });\n }\n }\n }\n\n return descriptors;\n}\n\nexport function buildLaunchSpec(\n runtimeConfig: RuntimeConfig,\n resolvedPorts: ResolvedPorts,\n): RuntimeLaunchSpec {\n const hostPort =\n runtimeConfig.host?.source === \"local\" ? resolvedPorts.host : runtimeConfig.host?.port;\n const corsOrigin = hostPort ? `http://localhost:${hostPort}` : `http://localhost:3000`;\n\n return {\n port: resolvedPorts.host,\n hostUrl: runtimeConfig.host?.url,\n corsOrigin,\n env: {\n ...(resolvedPorts.host ? { PORT: String(resolvedPorts.host) } : {}),\n ...(resolvedPorts.api ? { API_PORT: String(resolvedPorts.api) } : {}),\n ...(resolvedPorts.ui ? { UI_PORT: String(resolvedPorts.ui) } : {}),\n ...(resolvedPorts.auth ? { AUTH_PORT: String(resolvedPorts.auth) } : {}),\n },\n runtimeConfig,\n };\n}\n\nexport function buildEnvGenerated(\n resolvedPorts: ResolvedPorts,\n dbs: DatabasePlan[],\n redisPlans: RedisPlan[],\n): Record<string, string> {\n const env: Record<string, string> = {};\n\n if (resolvedPorts.host) {\n env.CORS_ORIGIN = `http://localhost:${resolvedPorts.host}`;\n // The host origin for plugins that derive absolute URLs from it (e.g. the\n // auth plugin's Better Auth baseURL — email links, passkey RP id).\n env.BASE_URL = `http://localhost:${resolvedPorts.host}`;\n }\n\n for (const db of dbs) {\n env[db.secret] = db.url;\n }\n for (const r of redisPlans) {\n env[r.secret] = r.url;\n }\n\n return env;\n}\n\nexport function planInfra(input: InfraInput): Effect.Effect<InfraPlan, InfraError, PortAllocator> {\n return Effect.gen(function* () {\n const cliPorts = normalizeCliPorts(input.cli);\n const wKey = workspaceKey(input.configDir);\n\n const plugins = (input.bosConfig.plugins ?? {}) as Record<\n string,\n { source: string; localPath?: string; ui?: { source: string; localPath?: string } }\n >;\n\n const {\n ports: svcPorts,\n claims,\n devPortsState,\n } = yield* allocateServices(cliPorts, plugins, input.configDir, input.bosConfig.auth, {\n host: input.bosConfig.host?.source,\n api: input.bosConfig.api?.source,\n auth: input.bosConfig.auth?.source,\n ui: input.bosConfig.ui?.source,\n });\n\n // DB/Redis port probes only matter for services that will actually spawn\n // locally — their generated URLs are consumed exclusively by local spawn\n // env (composeSpawnEnv). When every source is remote (start mode, ADR\n // 0009), nothing binds those ports and the probes are wasted work in the\n // container boot path — and a probe against an occupied port (the staged\n // dist servers) can drift the whole plan (the #363 failure class).\n const hasLocalServices =\n input.bosConfig.host?.source === \"local\" ||\n input.bosConfig.api?.source === \"local\" ||\n input.bosConfig.auth?.source === \"local\" ||\n input.bosConfig.ui?.source === \"local\" ||\n Object.values(plugins).some((p) => p?.source === \"local\" || p?.ui?.source === \"local\");\n\n const { dbs, redisPlans } = hasLocalServices\n ? yield* allocateDatabases(input.bosConfig)\n : { dbs: [], redisPlans: [] };\n\n const resolvedPorts: ResolvedPorts = { ...svcPorts };\n\n // Write merged state once after all allocations succeed\n // Skip persistence for regression tests / ephemeral runs\n // devPorts pins are explicit choices only (ADR 0012 §4): this run's flags,\n // falling back to previously-persisted explicit choices — never drift.\n const previousDevPorts = loadPortState(input.configDir).devPorts ?? {};\n const devPorts = {\n host: devPortsState.host ?? previousDevPorts.host,\n api: devPortsState.api ?? previousDevPorts.api,\n auth: devPortsState.auth ?? previousDevPorts.auth,\n ui: devPortsState.ui ?? previousDevPorts.ui,\n pluginPortStart: devPortsState.pluginPortStart ?? previousDevPorts.pluginPortStart,\n };\n if (shouldPersistPortState()) {\n savePortState(input.configDir, { devPorts });\n }\n\n const hostIsLocal = input.bosConfig.host?.source === \"local\";\n const apiIsLocal = input.bosConfig.api?.source === \"local\";\n const uiIsLocal = input.bosConfig.ui?.source === \"local\";\n const authIsLocal = input.bosConfig.auth?.source === \"local\";\n const assignedRuntimeConfig: RuntimeConfig = {\n ...input.bosConfig,\n host: resolvedPorts.host\n ? {\n ...input.bosConfig.host,\n port: resolvedPorts.host,\n url: `http://localhost:${resolvedPorts.host}`,\n remoteUrl: !hostIsLocal\n ? (input.bosConfig.host.remoteUrl ?? input.bosConfig.host.url)\n : undefined,\n }\n : input.bosConfig.host,\n api:\n apiIsLocal && resolvedPorts.api\n ? {\n ...input.bosConfig.api,\n port: resolvedPorts.api,\n url: `http://localhost:${resolvedPorts.api}`,\n }\n : input.bosConfig.api,\n ui:\n uiIsLocal && resolvedPorts.ui\n ? {\n ...input.bosConfig.ui,\n port: resolvedPorts.ui,\n url: `http://localhost:${resolvedPorts.ui}`,\n ssrUrl: undefined,\n }\n : input.bosConfig.ui,\n auth:\n authIsLocal && resolvedPorts.auth && input.bosConfig.auth\n ? {\n ...input.bosConfig.auth,\n port: resolvedPorts.auth,\n url: `http://localhost:${resolvedPorts.auth}`,\n }\n : input.bosConfig.auth,\n plugins: input.bosConfig.plugins\n ? Object.fromEntries(\n Object.entries(input.bosConfig.plugins).map(([id, p]) => {\n const isAuthMirror = isAuthMirrorPluginEntry(input.bosConfig.auth, id, p);\n const pluginPort = resolvedPorts.plugins[id];\n const patchedUi = (() => {\n if (p.ui?.source !== \"local\" || !p.ui?.localPath || !pluginPort?.ui) return p.ui;\n return {\n ...p.ui,\n port: pluginPort.ui,\n url: `http://localhost:${pluginPort.ui}`,\n ssrUrl: undefined,\n };\n })();\n if (isAuthMirror) {\n return [id, { ...p, ui: patchedUi }];\n }\n if (p.source === \"local\" && pluginPort?.api) {\n return [\n id,\n {\n ...p,\n port: pluginPort.api,\n url: `http://localhost:${pluginPort.api}`,\n ui: patchedUi,\n },\n ];\n }\n return [id, p];\n }),\n )\n : undefined,\n };\n\n const serviceDescriptors = buildServiceDescriptors(assignedRuntimeConfig, resolvedPorts);\n\n const launch = buildLaunchSpec(input.bosConfig, resolvedPorts);\n const envGenerated = buildEnvGenerated(resolvedPorts, dbs, redisPlans);\n\n const packages = serviceDescriptors.map((d) => d.key);\n const descriptionMap = new Map(serviceDescriptors.map((d) => [d.key, d]));\n const description = buildDescription(descriptionMap);\n\n const orchestrator = {\n packages,\n env: {},\n description,\n port: resolvedPorts.host,\n interactive: input.cli.interactive,\n };\n\n return {\n workspaceKey: wKey,\n cliPorts,\n resolvedPorts,\n runtimeConfig: assignedRuntimeConfig,\n launch,\n description,\n serviceDescriptors: new Map(serviceDescriptors.map((d) => [d.key, d])),\n envGenerated,\n claims,\n orchestrator,\n };\n });\n}\n"],"mappings":";;;;;;;;;;;AAgCA,MAAM,oBAAoB;AAE1B,MAAM,gBAAgB;AACtB,MAAM,oBAAoB;AAE1B,SAAgB,aAAa,WAA2B;CAEtD,WADaA,wBAAW,QAAQ,CAAC,CAAC,WAAOC,mBAAQ,SAAS,CAAC,CAAC,CAAC,OAAO,KAC1D,CAAC,CAAC,MAAM,GAAG,EAAE;AACzB;AAEA,SAAS,kBAAkB,OAAoC;CAC7D,OAAO;EACL,MAAM,MAAM;EACZ,KAAK,MAAM;EACX,MAAM,MAAM;EACZ,IAAI,MAAM;EACV,cAAc,MAAM;EACpB,SAAS,MAAM;CACjB;AACF;AAqBA,MAAM,sBAAsB;AAC5B,MAAM,aAAa;AAEnB,SAAS,iBACP,UACA,SAIA,WACA,MACA,SACkE;CAClE,OAAOC,cAAO,IAAI,aAAa;EAC7B,MAAM,OAAO,aAAa,SAAS;EACnC,MAAM,YAAYC,4BAAc,SAAS,CAAC,CAAC;EAC3C,MAAM,YAAY,OAAOC;EAEzB,MAAM,OAAO,SAAS,QAAQ,WAAW,QAAQ;EACjD,MAAM,uBACJ,SAAS,gBAAgB,WAAW,mBAAmB,OAAO;EAChE,MAAM,oBACJ,SAAS,iBAAiB,UAAa,WA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EAAE,WAAW,WAAW,YAAY,KACtC,OAAO,CACL,IACA;KACE,GAAG;KACH,MAAM,WAAW;KACjB,KAAK,oBAAoB,WAAW;KACpC,IAAI;IACN,CACF;IAEF,OAAO,CAAC,IAAI,CAAC;GACf,CAAC,CACH,IACA;EACN;EAEA,MAAM,qBAAqB,wBAAwB,uBAAuB,aAAa;EAEvF,MAAM,SAAS,gBAAgB,MAAM,WAAW,aAAa;EAC7D,MAAM,eAAe,kBAAkB,eAAe,KAAK,UAAU;EAErE,MAAM,WAAW,mBAAmB,KAAK,MAAM,EAAE,GAAG;EACpD,MAAM,iBAAiB,IAAI,IAAI,mBAAmB,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;EACxE,MAAM,cAAcQ,4CAAiB,cAAc;EAEnD,MAAM,eAAe;GACnB;GACA,KAAK,CAAC;GACN;GACA,MAAM,cAAc;GACpB,aAAa,MAAM,IAAI;EACzB;EAEA,OAAO;GACL,cAAc;GACd;GACA;GACA,eAAe;GACf;GACA;GACA,oBAAoB,IAAI,IAAI,mBAAmB,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;GACrE;GACA;GACA;EACF;CACF,CAAC;AACH"}
@@ -273,13 +273,17 @@ function planInfra(input) {
273
273
  return Effect.gen(function* () {
274
274
  const cliPorts = normalizeCliPorts(input.cli);
275
275
  const wKey = workspaceKey(input.configDir);
276
- const { ports: svcPorts, claims, devPortsState } = yield* allocateServices(cliPorts, input.bosConfig.plugins ?? {}, input.configDir, input.bosConfig.auth, {
276
+ const plugins = input.bosConfig.plugins ?? {};
277
+ const { ports: svcPorts, claims, devPortsState } = yield* allocateServices(cliPorts, plugins, input.configDir, input.bosConfig.auth, {
277
278
  host: input.bosConfig.host?.source,
278
279
  api: input.bosConfig.api?.source,
279
280
  auth: input.bosConfig.auth?.source,
280
281
  ui: input.bosConfig.ui?.source
281
282
  });
282
- const { dbs, redisPlans } = yield* allocateDatabases(input.bosConfig);
283
+ const { dbs, redisPlans } = input.bosConfig.host?.source === "local" || input.bosConfig.api?.source === "local" || input.bosConfig.auth?.source === "local" || input.bosConfig.ui?.source === "local" || Object.values(plugins).some((p) => p?.source === "local" || p?.ui?.source === "local") ? yield* allocateDatabases(input.bosConfig) : {
284
+ dbs: [],
285
+ redisPlans: []
286
+ };
283
287
  const resolvedPorts = { ...svcPorts };
284
288
  const previousDevPorts = loadPortState(input.configDir).devPorts ?? {};
285
289
  const devPorts = {
@@ -1 +1 @@
1
- {"version":3,"file":"planner.mjs","names":[],"sources":["../../src/infra/planner.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { resolve } from \"node:path\";\nimport { Clock, Effect } from \"effect\";\nimport { PortAllocator, type PortBlockEntry } from \"../app\";\nimport {\n buildConventionalDatabases,\n buildConventionalRedis,\n getSecretGroups,\n loadPortState,\n savePortState,\n} from \"../cli/infra\";\nimport {\n type AuthSlotShape,\n buildDescription,\n isAuthMirrorPluginEntry,\n} from \"../service-descriptor\";\nimport type { RuntimeConfig } from \"../types\";\nimport { shouldPersistPortState } from \"./materializer\";\nimport { ownerOfPort } from \"./port-ownership\";\nimport type {\n ClaimRecord,\n CliPorts,\n DatabasePlan,\n InfraInput,\n InfraPlan,\n RedisPlan,\n ResolvedPorts,\n RuntimeLaunchSpec,\n ServiceDescriptorPlan,\n} from \"./types\";\nimport { InfraError } from \"./types\";\n\nconst DEFAULT_HOST_PORT = 3000;\n\nconst POSTGRES_USER = \"everythingdev\";\nconst POSTGRES_PASSWORD = \"everythingdev\";\n\nexport function workspaceKey(configDir: string): string {\n const hash = createHash(\"sha256\").update(resolve(configDir)).digest(\"hex\");\n return hash.slice(0, 12);\n}\n\nfunction normalizeCliPorts(input: InfraInput[\"cli\"]): CliPorts {\n return {\n host: input.port,\n api: input.apiPort,\n auth: input.authPort,\n ui: input.uiPort,\n pluginsStart: input.pluginPortStart,\n plugins: input.plugins,\n };\n}\n\ninterface AllocateServicesResult {\n ports: ResolvedPorts;\n claims: ClaimRecord[];\n devPortsState: {\n host?: number;\n api?: number;\n auth?: number;\n ui?: number;\n pluginPortStart?: number;\n };\n}\n\nexport interface ServiceSources {\n host?: \"local\" | \"remote\";\n api?: \"local\" | \"remote\";\n auth?: \"local\" | \"remote\";\n ui?: \"local\" | \"remote\";\n}\n\nconst PLUGIN_START_OFFSET = 10;\nconst BLOCK_STEP = 100;\n\nfunction allocateServices(\n cliPorts: CliPorts,\n plugins: Record<\n string,\n { source: string; localPath?: string; ui?: { source: string; localPath?: string } }\n >,\n configDir: string,\n auth?: AuthSlotShape,\n sources?: ServiceSources,\n): Effect.Effect<AllocateServicesResult, InfraError, PortAllocator> {\n return Effect.gen(function* () {\n const wKey = workspaceKey(configDir);\n const persisted = loadPortState(configDir).devPorts;\n const allocator = yield* PortAllocator;\n\n const base = cliPorts.host ?? persisted?.host ?? DEFAULT_HOST_PORT;\n const pluginStartPreferred =\n cliPorts.pluginsStart ?? persisted?.pluginPortStart ?? base + PLUGIN_START_OFFSET;\n const pluginStartPinned =\n cliPorts.pluginsStart !== undefined || persisted?.pluginPortStart !== undefined;\n\n const entries: PortBlockEntry[] = [];\n const addEntry = (\n key: string,\n flag: number | undefined,\n persistedValue: number | undefined,\n derived: number,\n ) => {\n if (flag !== undefined) {\n entries.push({ key, preferred: flag, pinned: true });\n } else if (persistedValue !== undefined) {\n entries.push({ key, preferred: persistedValue, pinned: true });\n } else {\n entries.push({ key, preferred: derived, pinned: false });\n }\n };\n\n // Remote-source services spawn nothing locally (ADR 0009 start stack:\n // remotes load over MF from their published origins) — no port is\n // allocated for them. The host is the exception: even when loaded as a\n // remote module, runServer binds its own port.\n addEntry(\"host\", cliPorts.host, undefined, base);\n if (sources?.api !== \"remote\") {\n addEntry(\"api\", cliPorts.api, persisted?.api, base + 1);\n }\n if (sources?.auth !== \"remote\") {\n addEntry(\"auth\", cliPorts.auth, persisted?.auth, base + 2);\n }\n if (sources?.ui !== \"remote\") {\n addEntry(\"ui\", cliPorts.ui, persisted?.ui, base + 3);\n }\n\n const pluginKeys = Object.keys(plugins).sort();\n const isAuthMirrorFor = (\n pluginId: string,\n pluginCfg: { source: string; localPath?: string } | undefined,\n ) => pluginCfg !== undefined && isAuthMirrorPluginEntry(auth, pluginId, pluginCfg);\n\n let pluginSlot = 0;\n for (const pluginId of pluginKeys) {\n const pluginCfg = plugins[pluginId];\n const pluginIsLocal = pluginCfg?.source === \"local\";\n const slotBase = pluginStartPinned ? pluginStartPreferred : base + PLUGIN_START_OFFSET;\n // The auth mirror's backend is owned by the `auth` app slot — no api\n // port. Its ui surface is still real: without a port the runtime config\n // advertises an empty ui.url and the browser can never load the remote\n // (the /login page never renders).\n if (!isAuthMirrorFor(pluginId, pluginCfg) && pluginIsLocal) {\n addEntry(\n `plugin:${pluginId}`,\n cliPorts.plugins?.[pluginId]?.api,\n undefined,\n slotBase + pluginSlot,\n );\n pluginSlot += 1;\n }\n if (\n pluginCfg?.source === \"local\" &&\n pluginCfg?.localPath &&\n pluginCfg?.ui?.source === \"local\"\n ) {\n addEntry(\n `plugin-ui:${pluginId}`,\n cliPorts.plugins?.[pluginId]?.ui,\n undefined,\n slotBase + pluginSlot,\n );\n pluginSlot += 1;\n }\n }\n\n const allocation = yield* allocator.acquireBlock({ base, step: BLOCK_STEP, entries });\n\n if (allocation.base !== base) {\n yield* Effect.logError(\n `[Dev] Preferred port block starting at ${base} is occupied — using ${allocation.base} (this run only; restarts will retry ${base})`,\n );\n for (const conflict of allocation.conflicts.slice(0, 6)) {\n if (conflict.claimed) {\n yield* Effect.logError(\n `[Dev] port ${conflict.port} (${conflict.key}) — live bos session (registry claim)`,\n );\n } else {\n const owner = yield* ownerOfPort(conflict.port);\n yield* Effect.logError(\n `[Dev] port ${conflict.port} (${conflict.key}) — ${\n owner ? `pid ${owner.pid} (${owner.command})` : \"foreign holder (lsof unavailable)\"\n }`,\n );\n }\n }\n }\n\n const pluginApiPorts: Record<string, number> = {};\n const pluginUiPorts: Record<string, number> = {};\n for (const pluginId of pluginKeys) {\n const api = allocation.ports[`plugin:${pluginId}`];\n if (api !== undefined) pluginApiPorts[pluginId] = api;\n const ui = allocation.ports[`plugin-ui:${pluginId}`];\n if (ui !== undefined) pluginUiPorts[pluginId] = ui;\n }\n\n const resolved: ResolvedPorts = {\n host: allocation.ports.host,\n api: allocation.ports.api,\n auth: allocation.ports.auth,\n ui: allocation.ports.ui,\n plugins: Object.fromEntries(\n pluginKeys.map((k) => [k, { api: pluginApiPorts[k], ui: pluginUiPorts[k] }]),\n ),\n };\n\n const devPortsState = {\n host: cliPorts.host,\n api: cliPorts.api,\n auth: cliPorts.auth,\n ui: cliPorts.ui,\n pluginPortStart: cliPorts.pluginsStart,\n };\n\n const claimPorts: Record<string, number> = {};\n for (const [key, port] of Object.entries(allocation.ports)) {\n claimPorts[key] = port;\n }\n\n const claim: ClaimRecord = {\n resourceKey: `workspace:${wKey}`,\n pid: process.pid,\n configDir,\n ports: claimPorts,\n startedAt: yield* Clock.currentTimeMillis,\n };\n\n return { ports: resolved, claims: [claim], devPortsState };\n }).pipe(\n Effect.mapError(\n (portErr) =>\n new InfraError({\n phase: \"allocate-services\",\n message: `Port allocation failed: ${String(portErr)}`,\n cause: portErr,\n }),\n ),\n );\n}\n\nfunction allocateDatabases(runtimeConfig: RuntimeConfig): Effect.Effect<\n {\n dbs: DatabasePlan[];\n redisPlans: RedisPlan[];\n },\n InfraError,\n PortAllocator\n> {\n return Effect.gen(function* () {\n const groups = getSecretGroups(runtimeConfig);\n const allSecrets = groups.flatMap((group) => group.secrets);\n const allocator = yield* PortAllocator;\n\n const conventionalDatabases = buildConventionalDatabases(allSecrets);\n const conventionalRedis = buildConventionalRedis(allSecrets);\n\n const dbs: DatabasePlan[] = [];\n const allocatedByDesired = new Map<number, number>();\n for (const db of conventionalDatabases) {\n let port: number;\n if (allocatedByDesired.has(db.port)) {\n port = allocatedByDesired.get(db.port)!;\n } else {\n port = yield* allocator.pickAvailable(db.port);\n allocatedByDesired.set(db.port, port);\n }\n dbs.push({\n secret: db.secret,\n slug: db.slug,\n port,\n dbName: db.databaseName,\n url: `postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:${port}/${db.databaseName}`,\n });\n }\n\n const redisPlans: RedisPlan[] = [];\n for (const r of conventionalRedis) {\n const port = yield* allocator.pickAvailable(r.port);\n redisPlans.push({\n secret: r.secret,\n slug: r.slug,\n port,\n url: `redis://localhost:${port}`,\n });\n }\n\n return { dbs, redisPlans };\n }).pipe(\n Effect.mapError(\n (portErr) =>\n new InfraError({\n phase: \"allocate-databases\",\n message: `Database port allocation failed: ${String(portErr)}`,\n cause: portErr,\n }),\n ),\n );\n}\n\nexport function buildServiceDescriptors(\n runtimeConfig: RuntimeConfig,\n resolvedPorts: ResolvedPorts,\n): ServiceDescriptorPlan[] {\n const descriptors: ServiceDescriptorPlan[] = [];\n\n if (runtimeConfig.host) {\n const isLocal = runtimeConfig.host.source === \"local\";\n descriptors.push({\n key: \"host\",\n source: runtimeConfig.host.source,\n url: isLocal ? `http://localhost:${resolvedPorts.host}` : runtimeConfig.host.url,\n port: isLocal ? resolvedPorts.host : undefined,\n localPath: isLocal ? runtimeConfig.host.localPath : undefined,\n });\n }\n\n if (runtimeConfig.api) {\n const isLocal = runtimeConfig.api.source === \"local\";\n descriptors.push({\n key: \"api\",\n source: runtimeConfig.api.source,\n url: isLocal ? `http://localhost:${resolvedPorts.api}` : runtimeConfig.api.url,\n port: isLocal ? resolvedPorts.api : undefined,\n localPath: isLocal ? runtimeConfig.api.localPath : undefined,\n });\n }\n\n if (runtimeConfig.auth) {\n const isLocal = runtimeConfig.auth.source === \"local\";\n descriptors.push({\n key: \"auth\",\n source: runtimeConfig.auth.source,\n url: isLocal ? `http://localhost:${resolvedPorts.auth}` : runtimeConfig.auth.url,\n port: isLocal ? resolvedPorts.auth : undefined,\n localPath: isLocal ? runtimeConfig.auth.localPath : undefined,\n });\n }\n\n if (runtimeConfig.ui) {\n const isLocal = runtimeConfig.ui.source === \"local\";\n descriptors.push({\n key: \"ui\",\n source: runtimeConfig.ui.source,\n url: isLocal ? `http://localhost:${resolvedPorts.ui}` : runtimeConfig.ui.url,\n port: isLocal ? resolvedPorts.ui : undefined,\n localPath: isLocal ? runtimeConfig.ui.localPath : undefined,\n });\n }\n\n if (runtimeConfig.plugins) {\n for (const [pluginId, pluginCfg] of Object.entries(runtimeConfig.plugins)) {\n const pluginIsLocal = pluginCfg.source === \"local\";\n const p = resolvedPorts.plugins[pluginId];\n const isAuthMirror = isAuthMirrorPluginEntry(runtimeConfig.auth, pluginId, pluginCfg);\n if (pluginIsLocal && p?.api && !isAuthMirror) {\n descriptors.push({\n key: `plugin:${pluginId}`,\n source: \"local\",\n url: `http://localhost:${p.api}`,\n port: p.api,\n localPath: pluginCfg.localPath,\n });\n }\n if (!pluginIsLocal && pluginCfg.url && !isAuthMirror) {\n descriptors.push({\n key: `plugin:${pluginId}`,\n source: \"remote\",\n url: pluginCfg.url,\n port: undefined,\n localPath: undefined,\n });\n }\n if (pluginIsLocal && p?.ui && pluginCfg.ui?.source === \"local\") {\n descriptors.push({\n key: `plugin-ui:${pluginId}`,\n source: \"local\",\n url: `http://localhost:${p.ui}`,\n port: p.ui,\n localPath: pluginCfg.ui?.localPath,\n });\n }\n }\n }\n\n return descriptors;\n}\n\nexport function buildLaunchSpec(\n runtimeConfig: RuntimeConfig,\n resolvedPorts: ResolvedPorts,\n): RuntimeLaunchSpec {\n const hostPort =\n runtimeConfig.host?.source === \"local\" ? resolvedPorts.host : runtimeConfig.host?.port;\n const corsOrigin = hostPort ? `http://localhost:${hostPort}` : `http://localhost:3000`;\n\n return {\n port: resolvedPorts.host,\n hostUrl: runtimeConfig.host?.url,\n corsOrigin,\n env: {\n ...(resolvedPorts.host ? { PORT: String(resolvedPorts.host) } : {}),\n ...(resolvedPorts.api ? { API_PORT: String(resolvedPorts.api) } : {}),\n ...(resolvedPorts.ui ? { UI_PORT: String(resolvedPorts.ui) } : {}),\n ...(resolvedPorts.auth ? { AUTH_PORT: String(resolvedPorts.auth) } : {}),\n },\n runtimeConfig,\n };\n}\n\nexport function buildEnvGenerated(\n resolvedPorts: ResolvedPorts,\n dbs: DatabasePlan[],\n redisPlans: RedisPlan[],\n): Record<string, string> {\n const env: Record<string, string> = {};\n\n if (resolvedPorts.host) {\n env.CORS_ORIGIN = `http://localhost:${resolvedPorts.host}`;\n // The host origin for plugins that derive absolute URLs from it (e.g. the\n // auth plugin's Better Auth baseURL — email links, passkey RP id).\n env.BASE_URL = `http://localhost:${resolvedPorts.host}`;\n }\n\n for (const db of dbs) {\n env[db.secret] = db.url;\n }\n for (const r of redisPlans) {\n env[r.secret] = r.url;\n }\n\n return env;\n}\n\nexport function planInfra(input: InfraInput): Effect.Effect<InfraPlan, InfraError, PortAllocator> {\n return Effect.gen(function* () {\n const cliPorts = normalizeCliPorts(input.cli);\n const wKey = workspaceKey(input.configDir);\n\n const plugins = (input.bosConfig.plugins ?? {}) as Record<\n string,\n { source: string; localPath?: string; ui?: { source: string; localPath?: string } }\n >;\n\n const {\n ports: svcPorts,\n claims,\n devPortsState,\n } = yield* allocateServices(cliPorts, plugins, input.configDir, input.bosConfig.auth, {\n host: input.bosConfig.host?.source,\n api: input.bosConfig.api?.source,\n auth: input.bosConfig.auth?.source,\n ui: input.bosConfig.ui?.source,\n });\n\n const { dbs, redisPlans } = yield* allocateDatabases(input.bosConfig);\n\n const resolvedPorts: ResolvedPorts = { ...svcPorts };\n\n // Write merged state once after all allocations succeed\n // Skip persistence for regression tests / ephemeral runs\n // devPorts pins are explicit choices only (ADR 0012 §4): this run's flags,\n // falling back to previously-persisted explicit choices — never drift.\n const previousDevPorts = loadPortState(input.configDir).devPorts ?? {};\n const devPorts = {\n host: devPortsState.host ?? previousDevPorts.host,\n api: devPortsState.api ?? previousDevPorts.api,\n auth: devPortsState.auth ?? previousDevPorts.auth,\n ui: devPortsState.ui ?? previousDevPorts.ui,\n pluginPortStart: devPortsState.pluginPortStart ?? previousDevPorts.pluginPortStart,\n };\n if (shouldPersistPortState()) {\n savePortState(input.configDir, { devPorts });\n }\n\n const hostIsLocal = input.bosConfig.host?.source === \"local\";\n const apiIsLocal = input.bosConfig.api?.source === \"local\";\n const uiIsLocal = input.bosConfig.ui?.source === \"local\";\n const authIsLocal = input.bosConfig.auth?.source === \"local\";\n const assignedRuntimeConfig: RuntimeConfig = {\n ...input.bosConfig,\n host: resolvedPorts.host\n ? {\n ...input.bosConfig.host,\n port: resolvedPorts.host,\n url: `http://localhost:${resolvedPorts.host}`,\n remoteUrl: !hostIsLocal\n ? (input.bosConfig.host.remoteUrl ?? input.bosConfig.host.url)\n : undefined,\n }\n : input.bosConfig.host,\n api:\n apiIsLocal && resolvedPorts.api\n ? {\n ...input.bosConfig.api,\n port: resolvedPorts.api,\n url: `http://localhost:${resolvedPorts.api}`,\n }\n : input.bosConfig.api,\n ui:\n uiIsLocal && resolvedPorts.ui\n ? {\n ...input.bosConfig.ui,\n port: resolvedPorts.ui,\n url: `http://localhost:${resolvedPorts.ui}`,\n ssrUrl: undefined,\n }\n : input.bosConfig.ui,\n auth:\n authIsLocal && resolvedPorts.auth && input.bosConfig.auth\n ? {\n ...input.bosConfig.auth,\n port: resolvedPorts.auth,\n url: `http://localhost:${resolvedPorts.auth}`,\n }\n : input.bosConfig.auth,\n plugins: input.bosConfig.plugins\n ? Object.fromEntries(\n Object.entries(input.bosConfig.plugins).map(([id, p]) => {\n const isAuthMirror = isAuthMirrorPluginEntry(input.bosConfig.auth, id, p);\n const pluginPort = resolvedPorts.plugins[id];\n const patchedUi = (() => {\n if (p.ui?.source !== \"local\" || !p.ui?.localPath || !pluginPort?.ui) return p.ui;\n return {\n ...p.ui,\n port: pluginPort.ui,\n url: `http://localhost:${pluginPort.ui}`,\n ssrUrl: undefined,\n };\n })();\n if (isAuthMirror) {\n return [id, { ...p, ui: patchedUi }];\n }\n if (p.source === \"local\" && pluginPort?.api) {\n return [\n id,\n {\n ...p,\n port: pluginPort.api,\n url: `http://localhost:${pluginPort.api}`,\n ui: patchedUi,\n },\n ];\n }\n return [id, p];\n }),\n )\n : undefined,\n };\n\n const serviceDescriptors = buildServiceDescriptors(assignedRuntimeConfig, resolvedPorts);\n\n const launch = buildLaunchSpec(input.bosConfig, resolvedPorts);\n const envGenerated = buildEnvGenerated(resolvedPorts, dbs, redisPlans);\n\n const packages = serviceDescriptors.map((d) => d.key);\n const descriptionMap = new Map(serviceDescriptors.map((d) => [d.key, d]));\n const description = buildDescription(descriptionMap);\n\n const orchestrator = {\n packages,\n env: {},\n description,\n port: resolvedPorts.host,\n interactive: input.cli.interactive,\n };\n\n return {\n workspaceKey: wKey,\n cliPorts,\n resolvedPorts,\n runtimeConfig: assignedRuntimeConfig,\n launch,\n description,\n serviceDescriptors: new Map(serviceDescriptors.map((d) => [d.key, d])),\n envGenerated,\n claims,\n orchestrator,\n };\n });\n}\n"],"mappings":";;;;;;;;;;;AAgCA,MAAM,oBAAoB;AAE1B,MAAM,gBAAgB;AACtB,MAAM,oBAAoB;AAE1B,SAAgB,aAAa,WAA2B;CAEtD,OADa,WAAW,QAAQ,CAAC,CAAC,OAAO,QAAQ,SAAS,CAAC,CAAC,CAAC,OAAO,KAC1D,CAAC,CAAC,MAAM,GAAG,EAAE;AACzB;AAEA,SAAS,kBAAkB,OAAoC;CAC7D,OAAO;EACL,MAAM,MAAM;EACZ,KAAK,MAAM;EACX,MAAM,MAAM;EACZ,IAAI,MAAM;EACV,cAAc,MAAM;EACpB,SAAS,MAAM;CACjB;AACF;AAqBA,MAAM,sBAAsB;AAC5B,MAAM,aAAa;AAEnB,SAAS,iBACP,UACA,SAIA,WACA,MACA,SACkE;CAClE,OAAO,OAAO,IAAI,aAAa;EAC7B,MAAM,OAAO,aAAa,SAAS;EACnC,MAAM,YAAY,cAAc,SAAS,CAAC,CAAC;EAC3C,MAAM,YAAY,OAAO;EAEzB,MAAM,OAAO,SAAS,QAAQ,WAAW,QAAQ;EACjD,MAAM,uBACJ,SAAS,gBAAgB,WAAW,mBAAm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Aa;EAC7D,MAAM,eAAe,kBAAkB,eAAe,KAAK,UAAU;EAErE,MAAM,WAAW,mBAAmB,KAAK,MAAM,EAAE,GAAG;EACpD,MAAM,iBAAiB,IAAI,IAAI,mBAAmB,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;EACxE,MAAM,cAAc,iBAAiB,cAAc;EAEnD,MAAM,eAAe;GACnB;GACA,KAAK,CAAC;GACN;GACA,MAAM,cAAc;GACpB,aAAa,MAAM,IAAI;EACzB;EAEA,OAAO;GACL,cAAc;GACd;GACA;GACA,eAAe;GACf;GACA;GACA,oBAAoB,IAAI,IAAI,mBAAmB,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;GACrE;GACA;GACA;EACF;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"planner.mjs","names":[],"sources":["../../src/infra/planner.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { resolve } from \"node:path\";\nimport { Clock, Effect } from \"effect\";\nimport { PortAllocator, type PortBlockEntry } from \"../app\";\nimport {\n buildConventionalDatabases,\n buildConventionalRedis,\n getSecretGroups,\n loadPortState,\n savePortState,\n} from \"../cli/infra\";\nimport {\n type AuthSlotShape,\n buildDescription,\n isAuthMirrorPluginEntry,\n} from \"../service-descriptor\";\nimport type { RuntimeConfig } from \"../types\";\nimport { shouldPersistPortState } from \"./materializer\";\nimport { ownerOfPort } from \"./port-ownership\";\nimport type {\n ClaimRecord,\n CliPorts,\n DatabasePlan,\n InfraInput,\n InfraPlan,\n RedisPlan,\n ResolvedPorts,\n RuntimeLaunchSpec,\n ServiceDescriptorPlan,\n} from \"./types\";\nimport { InfraError } from \"./types\";\n\nconst DEFAULT_HOST_PORT = 3000;\n\nconst POSTGRES_USER = \"everythingdev\";\nconst POSTGRES_PASSWORD = \"everythingdev\";\n\nexport function workspaceKey(configDir: string): string {\n const hash = createHash(\"sha256\").update(resolve(configDir)).digest(\"hex\");\n return hash.slice(0, 12);\n}\n\nfunction normalizeCliPorts(input: InfraInput[\"cli\"]): CliPorts {\n return {\n host: input.port,\n api: input.apiPort,\n auth: input.authPort,\n ui: input.uiPort,\n pluginsStart: input.pluginPortStart,\n plugins: input.plugins,\n };\n}\n\ninterface AllocateServicesResult {\n ports: ResolvedPorts;\n claims: ClaimRecord[];\n devPortsState: {\n host?: number;\n api?: number;\n auth?: number;\n ui?: number;\n pluginPortStart?: number;\n };\n}\n\nexport interface ServiceSources {\n host?: \"local\" | \"remote\";\n api?: \"local\" | \"remote\";\n auth?: \"local\" | \"remote\";\n ui?: \"local\" | \"remote\";\n}\n\nconst PLUGIN_START_OFFSET = 10;\nconst BLOCK_STEP = 100;\n\nfunction allocateServices(\n cliPorts: CliPorts,\n plugins: Record<\n string,\n { source: string; localPath?: string; ui?: { source: string; localPath?: string } }\n >,\n configDir: string,\n auth?: AuthSlotShape,\n sources?: ServiceSources,\n): Effect.Effect<AllocateServicesResult, InfraError, PortAllocator> {\n return Effect.gen(function* () {\n const wKey = workspaceKey(configDir);\n const persisted = loadPortState(configDir).devPorts;\n const allocator = yield* PortAllocator;\n\n const base = cliPorts.host ?? persisted?.host ?? DEFAULT_HOST_PORT;\n const pluginStartPreferred =\n cliPorts.pluginsStart ?? persisted?.pluginPortStart ?? base + PLUGIN_START_OFFSET;\n const pluginStartPinned =\n cliPorts.pluginsStart !== undefined || persisted?.pluginPortStart !== undefined;\n\n const entries: PortBlockEntry[] = [];\n const addEntry = (\n key: string,\n flag: number | undefined,\n persistedValue: number | undefined,\n derived: number,\n ) => {\n if (flag !== undefined) {\n entries.push({ key, preferred: flag, pinned: true });\n } else if (persistedValue !== undefined) {\n entries.push({ key, preferred: persistedValue, pinned: true });\n } else {\n entries.push({ key, preferred: derived, pinned: false });\n }\n };\n\n // Remote-source services spawn nothing locally (ADR 0009 start stack:\n // remotes load over MF from their published origins) — no port is\n // allocated for them. The host is the exception: even when loaded as a\n // remote module, runServer binds its own port.\n addEntry(\"host\", cliPorts.host, undefined, base);\n if (sources?.api !== \"remote\") {\n addEntry(\"api\", cliPorts.api, persisted?.api, base + 1);\n }\n if (sources?.auth !== \"remote\") {\n addEntry(\"auth\", cliPorts.auth, persisted?.auth, base + 2);\n }\n if (sources?.ui !== \"remote\") {\n addEntry(\"ui\", cliPorts.ui, persisted?.ui, base + 3);\n }\n\n const pluginKeys = Object.keys(plugins).sort();\n const isAuthMirrorFor = (\n pluginId: string,\n pluginCfg: { source: string; localPath?: string } | undefined,\n ) => pluginCfg !== undefined && isAuthMirrorPluginEntry(auth, pluginId, pluginCfg);\n\n let pluginSlot = 0;\n for (const pluginId of pluginKeys) {\n const pluginCfg = plugins[pluginId];\n const pluginIsLocal = pluginCfg?.source === \"local\";\n const slotBase = pluginStartPinned ? pluginStartPreferred : base + PLUGIN_START_OFFSET;\n // The auth mirror's backend is owned by the `auth` app slot — no api\n // port. Its ui surface is still real: without a port the runtime config\n // advertises an empty ui.url and the browser can never load the remote\n // (the /login page never renders).\n if (!isAuthMirrorFor(pluginId, pluginCfg) && pluginIsLocal) {\n addEntry(\n `plugin:${pluginId}`,\n cliPorts.plugins?.[pluginId]?.api,\n undefined,\n slotBase + pluginSlot,\n );\n pluginSlot += 1;\n }\n if (\n pluginCfg?.source === \"local\" &&\n pluginCfg?.localPath &&\n pluginCfg?.ui?.source === \"local\"\n ) {\n addEntry(\n `plugin-ui:${pluginId}`,\n cliPorts.plugins?.[pluginId]?.ui,\n undefined,\n slotBase + pluginSlot,\n );\n pluginSlot += 1;\n }\n }\n\n const allocation = yield* allocator.acquireBlock({ base, step: BLOCK_STEP, entries });\n\n if (allocation.base !== base) {\n yield* Effect.logError(\n `[Dev] Preferred port block starting at ${base} is occupied — using ${allocation.base} (this run only; restarts will retry ${base})`,\n );\n for (const conflict of allocation.conflicts.slice(0, 6)) {\n if (conflict.claimed) {\n yield* Effect.logError(\n `[Dev] port ${conflict.port} (${conflict.key}) — live bos session (registry claim)`,\n );\n } else {\n const owner = yield* ownerOfPort(conflict.port);\n yield* Effect.logError(\n `[Dev] port ${conflict.port} (${conflict.key}) — ${\n owner ? `pid ${owner.pid} (${owner.command})` : \"foreign holder (lsof unavailable)\"\n }`,\n );\n }\n }\n }\n\n const pluginApiPorts: Record<string, number> = {};\n const pluginUiPorts: Record<string, number> = {};\n for (const pluginId of pluginKeys) {\n const api = allocation.ports[`plugin:${pluginId}`];\n if (api !== undefined) pluginApiPorts[pluginId] = api;\n const ui = allocation.ports[`plugin-ui:${pluginId}`];\n if (ui !== undefined) pluginUiPorts[pluginId] = ui;\n }\n\n const resolved: ResolvedPorts = {\n host: allocation.ports.host,\n api: allocation.ports.api,\n auth: allocation.ports.auth,\n ui: allocation.ports.ui,\n plugins: Object.fromEntries(\n pluginKeys.map((k) => [k, { api: pluginApiPorts[k], ui: pluginUiPorts[k] }]),\n ),\n };\n\n const devPortsState = {\n host: cliPorts.host,\n api: cliPorts.api,\n auth: cliPorts.auth,\n ui: cliPorts.ui,\n pluginPortStart: cliPorts.pluginsStart,\n };\n\n const claimPorts: Record<string, number> = {};\n for (const [key, port] of Object.entries(allocation.ports)) {\n claimPorts[key] = port;\n }\n\n const claim: ClaimRecord = {\n resourceKey: `workspace:${wKey}`,\n pid: process.pid,\n configDir,\n ports: claimPorts,\n startedAt: yield* Clock.currentTimeMillis,\n };\n\n return { ports: resolved, claims: [claim], devPortsState };\n }).pipe(\n Effect.mapError(\n (portErr) =>\n new InfraError({\n phase: \"allocate-services\",\n message: `Port allocation failed: ${String(portErr)}`,\n cause: portErr,\n }),\n ),\n );\n}\n\nfunction allocateDatabases(runtimeConfig: RuntimeConfig): Effect.Effect<\n {\n dbs: DatabasePlan[];\n redisPlans: RedisPlan[];\n },\n InfraError,\n PortAllocator\n> {\n return Effect.gen(function* () {\n const groups = getSecretGroups(runtimeConfig);\n const allSecrets = groups.flatMap((group) => group.secrets);\n const allocator = yield* PortAllocator;\n\n const conventionalDatabases = buildConventionalDatabases(allSecrets);\n const conventionalRedis = buildConventionalRedis(allSecrets);\n\n const dbs: DatabasePlan[] = [];\n const allocatedByDesired = new Map<number, number>();\n for (const db of conventionalDatabases) {\n let port: number;\n if (allocatedByDesired.has(db.port)) {\n port = allocatedByDesired.get(db.port)!;\n } else {\n port = yield* allocator.pickAvailable(db.port);\n allocatedByDesired.set(db.port, port);\n }\n dbs.push({\n secret: db.secret,\n slug: db.slug,\n port,\n dbName: db.databaseName,\n url: `postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:${port}/${db.databaseName}`,\n });\n }\n\n const redisPlans: RedisPlan[] = [];\n for (const r of conventionalRedis) {\n const port = yield* allocator.pickAvailable(r.port);\n redisPlans.push({\n secret: r.secret,\n slug: r.slug,\n port,\n url: `redis://localhost:${port}`,\n });\n }\n\n return { dbs, redisPlans };\n }).pipe(\n Effect.mapError(\n (portErr) =>\n new InfraError({\n phase: \"allocate-databases\",\n message: `Database port allocation failed: ${String(portErr)}`,\n cause: portErr,\n }),\n ),\n );\n}\n\nexport function buildServiceDescriptors(\n runtimeConfig: RuntimeConfig,\n resolvedPorts: ResolvedPorts,\n): ServiceDescriptorPlan[] {\n const descriptors: ServiceDescriptorPlan[] = [];\n\n if (runtimeConfig.host) {\n const isLocal = runtimeConfig.host.source === \"local\";\n descriptors.push({\n key: \"host\",\n source: runtimeConfig.host.source,\n url: isLocal ? `http://localhost:${resolvedPorts.host}` : runtimeConfig.host.url,\n port: isLocal ? resolvedPorts.host : undefined,\n localPath: isLocal ? runtimeConfig.host.localPath : undefined,\n });\n }\n\n if (runtimeConfig.api) {\n const isLocal = runtimeConfig.api.source === \"local\";\n descriptors.push({\n key: \"api\",\n source: runtimeConfig.api.source,\n url: isLocal ? `http://localhost:${resolvedPorts.api}` : runtimeConfig.api.url,\n port: isLocal ? resolvedPorts.api : undefined,\n localPath: isLocal ? runtimeConfig.api.localPath : undefined,\n });\n }\n\n if (runtimeConfig.auth) {\n const isLocal = runtimeConfig.auth.source === \"local\";\n descriptors.push({\n key: \"auth\",\n source: runtimeConfig.auth.source,\n url: isLocal ? `http://localhost:${resolvedPorts.auth}` : runtimeConfig.auth.url,\n port: isLocal ? resolvedPorts.auth : undefined,\n localPath: isLocal ? runtimeConfig.auth.localPath : undefined,\n });\n }\n\n if (runtimeConfig.ui) {\n const isLocal = runtimeConfig.ui.source === \"local\";\n descriptors.push({\n key: \"ui\",\n source: runtimeConfig.ui.source,\n url: isLocal ? `http://localhost:${resolvedPorts.ui}` : runtimeConfig.ui.url,\n port: isLocal ? resolvedPorts.ui : undefined,\n localPath: isLocal ? runtimeConfig.ui.localPath : undefined,\n });\n }\n\n if (runtimeConfig.plugins) {\n for (const [pluginId, pluginCfg] of Object.entries(runtimeConfig.plugins)) {\n const pluginIsLocal = pluginCfg.source === \"local\";\n const p = resolvedPorts.plugins[pluginId];\n const isAuthMirror = isAuthMirrorPluginEntry(runtimeConfig.auth, pluginId, pluginCfg);\n if (pluginIsLocal && p?.api && !isAuthMirror) {\n descriptors.push({\n key: `plugin:${pluginId}`,\n source: \"local\",\n url: `http://localhost:${p.api}`,\n port: p.api,\n localPath: pluginCfg.localPath,\n });\n }\n if (!pluginIsLocal && pluginCfg.url && !isAuthMirror) {\n descriptors.push({\n key: `plugin:${pluginId}`,\n source: \"remote\",\n url: pluginCfg.url,\n port: undefined,\n localPath: undefined,\n });\n }\n if (pluginIsLocal && p?.ui && pluginCfg.ui?.source === \"local\") {\n descriptors.push({\n key: `plugin-ui:${pluginId}`,\n source: \"local\",\n url: `http://localhost:${p.ui}`,\n port: p.ui,\n localPath: pluginCfg.ui?.localPath,\n });\n }\n }\n }\n\n return descriptors;\n}\n\nexport function buildLaunchSpec(\n runtimeConfig: RuntimeConfig,\n resolvedPorts: ResolvedPorts,\n): RuntimeLaunchSpec {\n const hostPort =\n runtimeConfig.host?.source === \"local\" ? resolvedPorts.host : runtimeConfig.host?.port;\n const corsOrigin = hostPort ? `http://localhost:${hostPort}` : `http://localhost:3000`;\n\n return {\n port: resolvedPorts.host,\n hostUrl: runtimeConfig.host?.url,\n corsOrigin,\n env: {\n ...(resolvedPorts.host ? { PORT: String(resolvedPorts.host) } : {}),\n ...(resolvedPorts.api ? { API_PORT: String(resolvedPorts.api) } : {}),\n ...(resolvedPorts.ui ? { UI_PORT: String(resolvedPorts.ui) } : {}),\n ...(resolvedPorts.auth ? { AUTH_PORT: String(resolvedPorts.auth) } : {}),\n },\n runtimeConfig,\n };\n}\n\nexport function buildEnvGenerated(\n resolvedPorts: ResolvedPorts,\n dbs: DatabasePlan[],\n redisPlans: RedisPlan[],\n): Record<string, string> {\n const env: Record<string, string> = {};\n\n if (resolvedPorts.host) {\n env.CORS_ORIGIN = `http://localhost:${resolvedPorts.host}`;\n // The host origin for plugins that derive absolute URLs from it (e.g. the\n // auth plugin's Better Auth baseURL — email links, passkey RP id).\n env.BASE_URL = `http://localhost:${resolvedPorts.host}`;\n }\n\n for (const db of dbs) {\n env[db.secret] = db.url;\n }\n for (const r of redisPlans) {\n env[r.secret] = r.url;\n }\n\n return env;\n}\n\nexport function planInfra(input: InfraInput): Effect.Effect<InfraPlan, InfraError, PortAllocator> {\n return Effect.gen(function* () {\n const cliPorts = normalizeCliPorts(input.cli);\n const wKey = workspaceKey(input.configDir);\n\n const plugins = (input.bosConfig.plugins ?? {}) as Record<\n string,\n { source: string; localPath?: string; ui?: { source: string; localPath?: string } }\n >;\n\n const {\n ports: svcPorts,\n claims,\n devPortsState,\n } = yield* allocateServices(cliPorts, plugins, input.configDir, input.bosConfig.auth, {\n host: input.bosConfig.host?.source,\n api: input.bosConfig.api?.source,\n auth: input.bosConfig.auth?.source,\n ui: input.bosConfig.ui?.source,\n });\n\n // DB/Redis port probes only matter for services that will actually spawn\n // locally — their generated URLs are consumed exclusively by local spawn\n // env (composeSpawnEnv). When every source is remote (start mode, ADR\n // 0009), nothing binds those ports and the probes are wasted work in the\n // container boot path — and a probe against an occupied port (the staged\n // dist servers) can drift the whole plan (the #363 failure class).\n const hasLocalServices =\n input.bosConfig.host?.source === \"local\" ||\n input.bosConfig.api?.source === \"local\" ||\n input.bosConfig.auth?.source === \"local\" ||\n input.bosConfig.ui?.source === \"local\" ||\n Object.values(plugins).some((p) => p?.source === \"local\" || p?.ui?.source === \"local\");\n\n const { dbs, redisPlans } = hasLocalServices\n ? yield* allocateDatabases(input.bosConfig)\n : { dbs: [], redisPlans: [] };\n\n const resolvedPorts: ResolvedPorts = { ...svcPorts };\n\n // Write merged state once after all allocations succeed\n // Skip persistence for regression tests / ephemeral runs\n // devPorts pins are explicit choices only (ADR 0012 §4): this run's flags,\n // falling back to previously-persisted explicit choices — never drift.\n const previousDevPorts = loadPortState(input.configDir).devPorts ?? {};\n const devPorts = {\n host: devPortsState.host ?? previousDevPorts.host,\n api: devPortsState.api ?? previousDevPorts.api,\n auth: devPortsState.auth ?? previousDevPorts.auth,\n ui: devPortsState.ui ?? previousDevPorts.ui,\n pluginPortStart: devPortsState.pluginPortStart ?? previousDevPorts.pluginPortStart,\n };\n if (shouldPersistPortState()) {\n savePortState(input.configDir, { devPorts });\n }\n\n const hostIsLocal = input.bosConfig.host?.source === \"local\";\n const apiIsLocal = input.bosConfig.api?.source === \"local\";\n const uiIsLocal = input.bosConfig.ui?.source === \"local\";\n const authIsLocal = input.bosConfig.auth?.source === \"local\";\n const assignedRuntimeConfig: RuntimeConfig = {\n ...input.bosConfig,\n host: resolvedPorts.host\n ? {\n ...input.bosConfig.host,\n port: resolvedPorts.host,\n url: `http://localhost:${resolvedPorts.host}`,\n remoteUrl: !hostIsLocal\n ? (input.bosConfig.host.remoteUrl ?? input.bosConfig.host.url)\n : undefined,\n }\n : input.bosConfig.host,\n api:\n apiIsLocal && resolvedPorts.api\n ? {\n ...input.bosConfig.api,\n port: resolvedPorts.api,\n url: `http://localhost:${resolvedPorts.api}`,\n }\n : input.bosConfig.api,\n ui:\n uiIsLocal && resolvedPorts.ui\n ? {\n ...input.bosConfig.ui,\n port: resolvedPorts.ui,\n url: `http://localhost:${resolvedPorts.ui}`,\n ssrUrl: undefined,\n }\n : input.bosConfig.ui,\n auth:\n authIsLocal && resolvedPorts.auth && input.bosConfig.auth\n ? {\n ...input.bosConfig.auth,\n port: resolvedPorts.auth,\n url: `http://localhost:${resolvedPorts.auth}`,\n }\n : input.bosConfig.auth,\n plugins: input.bosConfig.plugins\n ? Object.fromEntries(\n Object.entries(input.bosConfig.plugins).map(([id, p]) => {\n const isAuthMirror = isAuthMirrorPluginEntry(input.bosConfig.auth, id, p);\n const pluginPort = resolvedPorts.plugins[id];\n const patchedUi = (() => {\n if (p.ui?.source !== \"local\" || !p.ui?.localPath || !pluginPort?.ui) return p.ui;\n return {\n ...p.ui,\n port: pluginPort.ui,\n url: `http://localhost:${pluginPort.ui}`,\n ssrUrl: undefined,\n };\n })();\n if (isAuthMirror) {\n return [id, { ...p, ui: patchedUi }];\n }\n if (p.source === \"local\" && pluginPort?.api) {\n return [\n id,\n {\n ...p,\n port: pluginPort.api,\n url: `http://localhost:${pluginPort.api}`,\n ui: patchedUi,\n },\n ];\n }\n return [id, p];\n }),\n )\n : undefined,\n };\n\n const serviceDescriptors = buildServiceDescriptors(assignedRuntimeConfig, resolvedPorts);\n\n const launch = buildLaunchSpec(input.bosConfig, resolvedPorts);\n const envGenerated = buildEnvGenerated(resolvedPorts, dbs, redisPlans);\n\n const packages = serviceDescriptors.map((d) => d.key);\n const descriptionMap = new Map(serviceDescriptors.map((d) => [d.key, d]));\n const description = buildDescription(descriptionMap);\n\n const orchestrator = {\n packages,\n env: {},\n description,\n port: resolvedPorts.host,\n interactive: input.cli.interactive,\n };\n\n return {\n workspaceKey: wKey,\n cliPorts,\n resolvedPorts,\n runtimeConfig: assignedRuntimeConfig,\n launch,\n description,\n serviceDescriptors: new Map(serviceDescriptors.map((d) => [d.key, d])),\n envGenerated,\n claims,\n orchestrator,\n };\n });\n}\n"],"mappings":";;;;;;;;;;;AAgCA,MAAM,oBAAoB;AAE1B,MAAM,gBAAgB;AACtB,MAAM,oBAAoB;AAE1B,SAAgB,aAAa,WAA2B;CAEtD,OAD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,oBAAoB,IAAI,IAAI,mBAAmB,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;GACrE;GACA;GACA;EACF;CACF,CAAC;AACH"}
@@ -0,0 +1,54 @@
1
+ let execa = require("execa");
2
+
3
+ //#region src/outlayer-login.ts
4
+ async function loginOutlayerCli(custodyWallet, env = process.env) {
5
+ try {
6
+ await (0, execa.execa)("outlayer", ["--version"], {
7
+ env,
8
+ stdio: "pipe"
9
+ });
10
+ } catch (error) {
11
+ if (error.code === "ENOENT") return {
12
+ status: "cli-missing",
13
+ network: custodyWallet.network
14
+ };
15
+ return {
16
+ status: "error",
17
+ network: custodyWallet.network,
18
+ detail: error instanceof Error ? error.message : "Unknown error"
19
+ };
20
+ }
21
+ const args = custodyWallet.network === "testnet" ? [
22
+ "login",
23
+ "testnet",
24
+ "--wallet-key",
25
+ custodyWallet.apiKey
26
+ ] : [
27
+ "login",
28
+ "--wallet-key",
29
+ custodyWallet.apiKey
30
+ ];
31
+ const login = await (0, execa.execa)("outlayer", args, {
32
+ env,
33
+ stdio: "pipe",
34
+ reject: false
35
+ });
36
+ if (login.failed) return {
37
+ status: "error",
38
+ network: custodyWallet.network,
39
+ detail: [login.stderr, login.stdout].filter(Boolean).join("\n").trim() || "OutLayer CLI login failed"
40
+ };
41
+ const whoami = await (0, execa.execa)("outlayer", ["whoami"], {
42
+ env,
43
+ stdio: "pipe"
44
+ }).catch(() => null);
45
+ return {
46
+ status: "linked",
47
+ network: custodyWallet.network,
48
+ detail: whoami?.stdout.trim()
49
+ };
50
+ }
51
+
52
+ //#endregion
53
+ exports.loginOutlayerCli = loginOutlayerCli;
54
+ //# sourceMappingURL=outlayer-login.cjs.map