target-supabase-sdk 0.2.2 → 0.2.4

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 (168) hide show
  1. package/README.md +24 -18
  2. package/dist/browser.d.ts +11 -4
  3. package/dist/browser.d.ts.map +1 -1
  4. package/dist/browser.js +3 -3
  5. package/dist/chunks/{enable-log-persist-BH-tbKEj.js → enable-log-persist-B8rg_wXG.js} +41 -8
  6. package/dist/chunks/enable-log-persist-B8rg_wXG.js.map +1 -0
  7. package/dist/chunks/{create-logger-DyH3mZ8p.js → list.api-Ab9v8yOg.js} +66 -57
  8. package/dist/chunks/list.api-Ab9v8yOg.js.map +1 -0
  9. package/dist/chunks/{word.interface-DLgRobKV.js → word.interface-B_fbVFOW.js} +1078 -97
  10. package/dist/chunks/word.interface-B_fbVFOW.js.map +1 -0
  11. package/dist/extraction/extraction.api.d.ts +117 -0
  12. package/dist/extraction/extraction.api.d.ts.map +1 -0
  13. package/dist/extraction/extraction.interface.d.ts +43 -0
  14. package/dist/extraction/extraction.interface.d.ts.map +1 -0
  15. package/dist/list/list.interface.d.ts +2 -2
  16. package/dist/list/list.interface.d.ts.map +1 -1
  17. package/dist/node/env/index.d.ts +2 -2
  18. package/dist/node/env/index.d.ts.map +1 -1
  19. package/dist/node/env/init-supabase-from-env.d.ts +1 -1
  20. package/dist/node/env/init-supabase-from-env.d.ts.map +1 -1
  21. package/dist/node/env/load-env.d.ts +15 -1
  22. package/dist/node/env/load-env.d.ts.map +1 -1
  23. package/dist/node/node-runtime.base.d.ts +13 -1
  24. package/dist/node/node-runtime.base.d.ts.map +1 -1
  25. package/dist/node/preload/run-service-preload.d.ts +1 -1
  26. package/dist/node/preload/run-service-preload.d.ts.map +1 -1
  27. package/dist/node/process/create-managed-child-processes.d.ts +12 -0
  28. package/dist/node/process/create-managed-child-processes.d.ts.map +1 -0
  29. package/dist/node/process/index.d.ts +3 -1
  30. package/dist/node/process/index.d.ts.map +1 -1
  31. package/dist/node/process/managed-child-processes.d.ts +15 -2
  32. package/dist/node/process/managed-child-processes.d.ts.map +1 -1
  33. package/dist/node/runtime-state/create-service-runtime-state-store.d.ts +23 -0
  34. package/dist/node/runtime-state/create-service-runtime-state-store.d.ts.map +1 -0
  35. package/dist/node/runtime-state/index.d.ts +4 -0
  36. package/dist/node/runtime-state/index.d.ts.map +1 -0
  37. package/dist/node/runtime-state/service-runtime-state.types.d.ts +57 -0
  38. package/dist/node/runtime-state/service-runtime-state.types.d.ts.map +1 -0
  39. package/dist/node/service-guard/index.d.ts +9 -0
  40. package/dist/node/service-guard/index.d.ts.map +1 -0
  41. package/dist/node/service-guard/register-service-guard-runner.d.ts +9 -0
  42. package/dist/node/service-guard/register-service-guard-runner.d.ts.map +1 -0
  43. package/dist/node/service-guard/run-readiness-gate.d.ts +11 -0
  44. package/dist/node/service-guard/run-readiness-gate.d.ts.map +1 -0
  45. package/dist/node/service-guard/run-service-guard-tick.d.ts +7 -0
  46. package/dist/node/service-guard/run-service-guard-tick.d.ts.map +1 -0
  47. package/dist/node/service-guard/service-guard-node.d.ts +18 -0
  48. package/dist/node/service-guard/service-guard-node.d.ts.map +1 -0
  49. package/dist/node/service-guard/service-guard.interface.d.ts +58 -0
  50. package/dist/node/service-guard/service-guard.interface.d.ts.map +1 -0
  51. package/dist/node/service-guard/worker-spawn-cooldown.d.ts +4 -0
  52. package/dist/node/service-guard/worker-spawn-cooldown.d.ts.map +1 -0
  53. package/dist/node/service-host/index.d.ts +9 -0
  54. package/dist/node/service-host/index.d.ts.map +1 -0
  55. package/dist/node/service-host/registry-slot-guard-step.d.ts +21 -0
  56. package/dist/node/service-host/registry-slot-guard-step.d.ts.map +1 -0
  57. package/dist/node/service-host/service-host.d.ts +36 -0
  58. package/dist/node/service-host/service-host.d.ts.map +1 -0
  59. package/dist/node/service-host/single-process-service.d.ts +21 -0
  60. package/dist/node/service-host/single-process-service.d.ts.map +1 -0
  61. package/dist/node.d.ts +17 -4
  62. package/dist/node.d.ts.map +1 -1
  63. package/dist/node.js +2088 -1495
  64. package/dist/node.js.map +1 -1
  65. package/dist/preload.js +5 -4
  66. package/dist/preload.js.map +1 -1
  67. package/dist/service/config.api.d.ts +143 -0
  68. package/dist/service/config.api.d.ts.map +1 -0
  69. package/dist/service/config.interface.d.ts +22 -0
  70. package/dist/service/config.interface.d.ts.map +1 -0
  71. package/dist/service/index.d.ts +16 -17
  72. package/dist/service/index.d.ts.map +1 -1
  73. package/dist/service/registry-lifecycle.d.ts +43 -0
  74. package/dist/service/registry-lifecycle.d.ts.map +1 -0
  75. package/dist/service/registry.service.d.ts +94 -0
  76. package/dist/service/registry.service.d.ts.map +1 -0
  77. package/dist/service/service-bootstrap.d.ts +28 -0
  78. package/dist/service/service-bootstrap.d.ts.map +1 -0
  79. package/dist/service/service.api.d.ts +160 -0
  80. package/dist/service/service.api.d.ts.map +1 -1
  81. package/dist/service/service.interface.d.ts +32 -1
  82. package/dist/service/service.interface.d.ts.map +1 -1
  83. package/dist/shared/log/index.d.ts +4 -0
  84. package/dist/shared/log/index.d.ts.map +1 -1
  85. package/dist/shared/log/log-batch.d.ts +44 -0
  86. package/dist/shared/log/log-batch.d.ts.map +1 -0
  87. package/dist/shared/log/log-persist-coordinator.d.ts +37 -0
  88. package/dist/shared/log/log-persist-coordinator.d.ts.map +1 -0
  89. package/dist/shared/log/log-persist-flush.d.ts.map +1 -1
  90. package/dist/shared/log/log-persist.config.d.ts +0 -1
  91. package/dist/shared/log/log-persist.config.d.ts.map +1 -1
  92. package/dist/shared/log/log-persist.interface.d.ts +8 -0
  93. package/dist/shared/log/log-persist.interface.d.ts.map +1 -1
  94. package/dist/shared/utils/config-path.utils.d.ts +21 -0
  95. package/dist/shared/utils/config-path.utils.d.ts.map +1 -1
  96. package/dist/shared/utils/get-value-at-path.d.ts +3 -0
  97. package/dist/shared/utils/get-value-at-path.d.ts.map +1 -0
  98. package/dist/task/index.d.ts +2 -0
  99. package/dist/task/index.d.ts.map +1 -1
  100. package/dist/task/task-manager.d.ts +1 -1
  101. package/dist/task/task-manager.d.ts.map +1 -1
  102. package/dist/task/task-post-retry.api.d.ts +24 -0
  103. package/dist/task/task-post-retry.api.d.ts.map +1 -0
  104. package/dist/task/task-repo-context.d.ts +7 -1
  105. package/dist/task/task-repo-context.d.ts.map +1 -1
  106. package/dist/trigger/trigger-manager.d.ts +1 -1
  107. package/dist/trigger/trigger-manager.d.ts.map +1 -1
  108. package/dist/trigger/trigger-node.d.ts +1 -0
  109. package/dist/trigger/trigger-node.d.ts.map +1 -1
  110. package/dist/trigger/trigger.constant.d.ts +1 -1
  111. package/dist/trigger/trigger.constant.d.ts.map +1 -1
  112. package/dist/trigger/trigger.interface.d.ts +10 -0
  113. package/dist/trigger/trigger.interface.d.ts.map +1 -1
  114. package/package.json +4 -2
  115. package/src/browser.ts +98 -4
  116. package/src/extraction/extraction.api.ts +232 -0
  117. package/src/extraction/extraction.interface.ts +45 -0
  118. package/src/list/list.interface.ts +2 -2
  119. package/src/node/env/index.ts +13 -2
  120. package/src/node/env/init-supabase-from-env.ts +1 -1
  121. package/src/node/env/load-env.ts +48 -2
  122. package/src/node/node-runtime.base.ts +37 -6
  123. package/src/node/preload/run-service-preload.ts +3 -2
  124. package/src/node/process/create-managed-child-processes.ts +27 -0
  125. package/src/node/process/index.ts +4 -0
  126. package/src/node/process/managed-child-processes.ts +48 -15
  127. package/src/node/runtime-state/create-service-runtime-state-store.ts +125 -0
  128. package/src/node/runtime-state/index.ts +17 -0
  129. package/src/node/runtime-state/service-runtime-state.types.ts +64 -0
  130. package/src/node/service-guard/index.ts +17 -0
  131. package/src/node/service-guard/register-service-guard-runner.ts +64 -0
  132. package/src/node/service-guard/run-readiness-gate.ts +34 -0
  133. package/src/node/service-guard/run-service-guard-tick.ts +106 -0
  134. package/src/node/service-guard/service-guard-node.ts +52 -0
  135. package/src/node/service-guard/service-guard.interface.ts +64 -0
  136. package/src/node/service-guard/worker-spawn-cooldown.ts +13 -0
  137. package/src/node/service-host/index.ts +30 -0
  138. package/src/node/service-host/registry-slot-guard-step.ts +57 -0
  139. package/src/node/service-host/service-host.ts +168 -0
  140. package/src/node/service-host/single-process-service.ts +58 -0
  141. package/src/node.ts +76 -0
  142. package/src/service/config.api.ts +224 -0
  143. package/src/service/config.interface.ts +25 -0
  144. package/src/service/index.ts +74 -149
  145. package/src/service/registry-lifecycle.ts +144 -0
  146. package/src/service/registry.service.ts +564 -0
  147. package/src/service/service-bootstrap.ts +74 -0
  148. package/src/service/service.api.ts +13 -0
  149. package/src/service/service.interface.ts +36 -1
  150. package/src/shared/log/index.ts +13 -0
  151. package/src/shared/log/log-batch.ts +156 -0
  152. package/src/shared/log/log-persist-coordinator.ts +107 -0
  153. package/src/shared/log/log-persist-flush.ts +3 -3
  154. package/src/shared/log/log-persist.config.ts +0 -2
  155. package/src/shared/log/log-persist.interface.ts +10 -0
  156. package/src/shared/utils/config-path.utils.ts +35 -0
  157. package/src/shared/utils/get-value-at-path.ts +17 -0
  158. package/src/task/index.ts +2 -0
  159. package/src/task/task-manager.ts +10 -4
  160. package/src/task/task-post-retry.api.ts +61 -0
  161. package/src/task/task-repo-context.ts +8 -1
  162. package/src/trigger/trigger-manager.ts +4 -2
  163. package/src/trigger/trigger-node.ts +10 -4
  164. package/src/trigger/trigger.constant.ts +1 -1
  165. package/src/trigger/trigger.interface.ts +10 -0
  166. package/dist/chunks/create-logger-DyH3mZ8p.js.map +0 -1
  167. package/dist/chunks/enable-log-persist-BH-tbKEj.js.map +0 -1
  168. package/dist/chunks/word.interface-DLgRobKV.js.map +0 -1
package/README.md CHANGED
@@ -97,7 +97,7 @@ const target = await getTarget({ id: "..." });
97
97
 
98
98
  ### Service catalog
99
99
 
100
- Register and discover HTTP-backed services and their Api capabilities in Supabase Target rows.
100
+ Register services and Api capabilities in Supabase Target rows. L3 startup uses **`claimServiceRegistrySlot`** (see [l3-service-host](.cursor/skills/l3-service-host/SKILL.md)) — each process creates a new Service instance and claims a registry slot.
101
101
 
102
102
  ```typescript
103
103
  import {
@@ -105,7 +105,7 @@ import {
105
105
  postService,
106
106
  getService,
107
107
  getApi,
108
- discoverService,
108
+ claimServiceRegistrySlot,
109
109
  ApiMethod,
110
110
  ServiceLifecycleStatus,
111
111
  } from "target-supabase-sdk";
@@ -131,28 +131,34 @@ await postApi({
131
131
  },
132
132
  });
133
133
 
134
- // Register a Service that references Api keys
135
- await postService({
136
- name: "Storage Service",
137
- value: "storage-service",
138
- tagList: [],
139
- details: {
140
- manifestVersion: 0,
141
- apiKeys: ["storage.post.chunk.0"],
142
- dependencies: [],
143
- lifecycle: { /* same shape as Api */ },
144
- },
134
+ // L3 startup: new instance + registry slot claim
135
+ const session = await claimServiceRegistrySlot({
136
+ serviceValue: "storage-service",
137
+ createInstance: () =>
138
+ postService({
139
+ name: "Storage Service",
140
+ value: "storage-service",
141
+ tagList: [],
142
+ details: {
143
+ manifestVersion: 0,
144
+ apiKeys: ["storage.post.chunk.0"],
145
+ dependencies: [],
146
+ lifecycle: { /* same shape as Api */ },
147
+ },
148
+ }).then((r) => {
149
+ if (!r.success || r.data == null) throw new Error(r.error?.message ?? "postService failed");
150
+ return r.data;
151
+ }),
145
152
  });
146
-
147
- // Discover — only returns ACTIVE services
148
- const { data: service } = await discoverService({ value: "storage-service" });
153
+ // session.release() on graceful shutdown
149
154
  ```
150
155
 
151
156
  | API | Description |
152
157
  |-----|-------------|
153
158
  | `postApi` / `getApi` | Create or fetch Api Target rows |
154
- | `postService` / `getService` | Create or fetch Service Target rows (`getService` optional `lifecycleStatus` filter) |
155
- | `discoverService` | Resolve a single ACTIVE service by `value`; errors: `SERVICE_NOT_FOUND`, `SERVICE_NOT_AVAILABLE` |
159
+ | `postService` / `getService` | Create or fetch Service rows (`getService({ id })` for a specific instance) |
160
+ | `claimServiceRegistrySlot` | Preflight + register slot for a new instance (`createServiceHost` wraps this) |
161
+ | `getTargetSystemRegistry` | Read slot layout and which instance ids are ACTIVE |
156
162
 
157
163
  Types: `Service`, `Api`, `ApiDetails` (`method`, `path`, `endpoint`, `request`, `response`), `FieldDefinition` for inline schemas.
158
164
 
package/dist/browser.d.ts CHANGED
@@ -8,6 +8,10 @@ export type { SupabaseClient } from "@supabase/supabase-js";
8
8
  export * from "./core.api";
9
9
  export * from "./core.interface";
10
10
  export * from "./core.utils";
11
+ export type { GetExtractionPayload, PatchExtractionObjectsPayload, PostExtractionPayload, ScanExtractionListPayload, } from "./extraction/extraction.api";
12
+ export { getExtraction, getExtractionSchema, patchExtractionObjects, patchExtractionObjectsSchema, postExtraction, postExtractionSchema, scanExtractionList, scanExtractionListSchema, } from "./extraction/extraction.api";
13
+ export type { Extraction, ExtractionDetails } from "./extraction/extraction.interface";
14
+ export { CategoryExtraction } from "./extraction/extraction.interface";
11
15
  export * from "./idea/idea.interface";
12
16
  export * from "./link/link.api";
13
17
  export * from "./link/link.interface";
@@ -34,13 +38,14 @@ export type { ProviderProbeMap, StorageProviderRegistry } from "./parcel/storage
34
38
  export { createStorageProviderRegistry } from "./parcel/storage-provider-registry";
35
39
  export * from "./repo/repo.api";
36
40
  export * from "./repo/repo.interface";
37
- export type { Api, ApiDetails, DiscoverServiceInput, GetApiPayload, GetServicePayload, PostApiPayload, PostServicePayload, Service, ServiceDetails, } from "./service/index";
38
- export { ApiMethod, apiDetailsSchema, CategoryService, discoverService, fieldDefinitionSchema, getApi, getApiSchema, getService, getServiceSchema, postApi, postApiSchema, postService, postServiceSchema, ServiceLifecycleStatus, schemaDefinitionSchema, serviceDetailsSchema, serviceLifecycleSchema, } from "./service/index";
41
+ export type { Api, ApiDetails, ClaimRegistrySlotInput, Config, ConfigDetails, GetApiPayload, GetConfigPayload, GetServicePayload, PatchServiceRuntimeInput, PostApiPayload, PostServiceInstanceOptions, PostServicePayload, PostSystemRegistryConfigPayload, RegisterServiceInput, RegistrySlotGuardResult, RegistrySlotRuntimeState, ResetSystemRegistryConfigPayload, Service, ServiceBootstrapResult, ServiceDetails, ServiceNodeSnapshot, ServiceRegistrySession, ServiceRuntime, ServiceSlot, SystemRegistrySeedSlot, TargetSystemRegistrySlotView, TargetSystemRegistryView, } from "./service/index";
42
+ export { ApiMethod, apiDetailsSchema, assertRegistrySlotAvailable, assertRegistrySlotOwner, buildEmptyServiceSlots, buildSystemRegistryConfigDetails, CategoryConfig, CategoryService, claimServiceRegistrySlot, createActiveServiceLifecycle, createClaimedRegistrySlotRuntimeState, DEFAULT_SYSTEM_REGISTRY_SEED_SLOTS, defaultL3ServiceDetails, EMPTY_REGISTRY_SLOT_RUNTIME_STATE, fieldDefinitionSchema, getApi, getApiSchema, getConfig, getConfigSchema, getService, getServiceSchema, getTargetSystemRegistry, parseServiceSlot, parseServiceSlots, patchServiceRuntime, postApi, postApiSchema, postService, postServiceInstance, postServiceSchema, postSystemRegistryConfig, postSystemRegistryConfigSchema, registerService, registerServiceAtStartup, registrySlotRuntimePatchFromGuardResult, resetSystemRegistryConfig, resetSystemRegistryConfigSchema, resolveActiveRegistryServiceId, runRegistrySlotGuardCheck, ServiceLifecycleStatus, ServiceRegistryError, ServiceSlotStatus, schemaDefinitionSchema, serviceDetailsSchema, serviceLifecycleSchema, serviceNodeSnapshotSchema, serviceRuntimeSchema, systemRegistrySeedSlotSchema, TARGET_SYSTEM_REGISTRY_KEY, unregisterService, unregisterServiceAtShutdown, } from "./service/index";
39
43
  export type { FetchInitFactory, FetchRetryOptions } from "./shared/http/fetch-retry";
40
44
  export { fetchBinaryWithRetry, fetchWithRetry, isRetryableHttpStatus, requestHasBody, } from "./shared/http/fetch-retry";
41
- export type { CreateLoggerInput, LoggerWithScope, LogScope, LogScopePatch } from "./shared/log";
42
- export { createLogger, LogLevel, logManager } from "./shared/log";
45
+ export type { CreateLoggerInput, DecodedLogBatch, FlatLogEntry, LogEntry, LoggerWithScope, LogScope, LogScopePatch, } from "./shared/log";
46
+ export { createLogger, decodeLogBatch, decodeLogBatchList, flattenLogBatch, flattenLogBatches, isLogBatchList, isLogEntry, LOG_BATCH_LOADER_KEY, LOG_PERSIST_LOADER_KEY, LogLevel, logManager, parseLogBatchMeta, } from "./shared/log";
43
47
  export { isHttpUrl, resolveFetchUrl } from "./shared/utils/fetch-url";
48
+ export { getValueAtPath } from "./shared/utils/get-value-at-path";
44
49
  export type { ClassifiedNetworkError, FormatNetworkErrorOptions, NetworkErrorKind, } from "./shared/utils/network-error";
45
50
  export { classifyNetworkError, formatNetworkError, } from "./shared/utils/network-error";
46
51
  export type { SanitizeFileNameOptions } from "./shared/utils/safe-file-name";
@@ -54,6 +59,8 @@ export type { Task, TaskDetails, TaskFlow } from "./task/task.interface";
54
59
  export { CategoryTask, ResultCode, TaskStatus, TaskStatusAction, } from "./task/task.interface";
55
60
  export type { PostTaskPayload } from "./task/task-post.api";
56
61
  export { postTask, postTaskSchema } from "./task/task-post.api";
62
+ export type { PostTaskWithRetryOptions, PostTaskWithRetryResult } from "./task/task-post-retry.api";
63
+ export { POST_TASK_DEFAULT_MAX_ATTEMPTS, postTaskWithRetry } from "./task/task-post-retry.api";
57
64
  export type { TaskStatusCount } from "./task/task-queue";
58
65
  export { countTasksByType, summarizeTaskQueue } from "./task/task-queue";
59
66
  export * from "./word/word.interface";
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,YAAY,EACR,+BAA+B,EAC/B,wBAAwB,EACxB,sBAAsB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,E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AC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EACR,4BAA4B,EAC5B,qBAAqB,EACrB,wBAAwB,GAC3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACH,qBAAqB,EACrB,2BAA2B,EAC3B,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEzE,OAAO,EACH,YAAY,EACZ,UAAU,EACV,UAAU,EACV,gBAAgB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAChE,YAAY,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACpG,OAAO,EAAE,8BAA8B,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/F,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACzE,cAAc,uBAAuB,CAAC"}
package/dist/browser.js CHANGED
@@ -1,6 +1,6 @@
1
- export { B as BaseValidator, C as CREATE_TARGET_ALREADY_EXISTS_MESSAGE, a as CategoryList, L as LogLevel, M as MAX_POLL_TARGET_LIST_SIZE, b as MAX_TARGET_LIST_PAGE_SIZE, O as OPTIMISTIC_LOCK_ERROR_CODE, c as OPTIMISTIC_LOCK_FAILED_MESSAGE, P as PostListValidator, S as StatusCode, d as createLogger, e as createTarget, f as deleteTarget, g as generateResponse, h as getPossibleTarget, i as getTarget, j as getTargetList, k as getTargetTotalCount, l as handleSupabaseError, m as isCreateTargetAlreadyExistsError, n as isDevEnvironment, o as isOptimisticLockError, p as isOptimisticLockResponse, q as logDev, r as logDevGroup, s as logManager, t as patchTarget, u as pollTargetList, v as postListCreate, w as postLogListCreate, x as postTarget, y as scanTargetList, z as supabase, A as updateTargetDetails, D as validateWith, E as validateWithSchema } from './chunks/create-logger-DyH3mZ8p.js';
2
- export { A as ApiMethod, C as CategoryIdea, a as CategoryLink, b as CategoryNode, c as CategoryParcel, d as CategoryRepo, e as CategoryService, f as CategoryTask, g as CategoryWord, M as Market, N as NodeStatus, P as ParcelManager, h as PostLinkValidator, R as ResultCode, S as ServiceLifecycleStatus, T as TASK_REPO_USAGE, i as TaskStatus, j as TaskStatusAction, k as apiDetailsSchema, l as classifyNetworkError, m as countTasksByType, n as createStorageProviderRegistry, o as createUploadTracker, p as deleteParcel, q as deleteParcelSchema, r as discoverService, s as evaluateBusyNodeLiveness, t as fetchBinaryWithRetry, u as fetchWithRetry, v as fieldDefinitionSchema, w as formatNetworkError, x as getApi, y as getApiSchema, z as getParcel, B as getParcelSchema, D as getScanRemoteRepoValues, E as getScanRemoteRepoValuesSchema, F as getService, G as getServiceSchema, H as installChunkFetchRegistry, I as isHttpUrl, J as isLocalFilesystemPath, K as isOpaqueChunkUrl, L as isRetryableHttpStatus, O as parcelDetailsSchema, Q as parseProviderPrefixedUrl, U as patchChangeNodeStatus, V as patchChangeNodeStatusSchema, W as patchChangeTaskStatus, X as patchChangeTaskStatusSchema, Y as patchClaimTask, Z as patchClaimTaskSchema, _ as patchNodeHeartBeat, $ as patchNodeHeartBeatSchema, a0 as patchStopNode, a1 as patchStopNodeSchema, a2 as patchTaskProgress, a3 as patchTaskProgressSchema, a4 as postApi, a5 as postApiSchema, a6 as postLinkCreate, a7 as postParcel, a8 as postParcelSchema, a9 as postRegisterNode, aa as postRegisterNodeSchema, ab as postService, ac as postServiceSchema, ad as postTask, ae as postTaskSchema, af as publishParcel, ag as registerProviderChunkResolver, ah as requestHasBody, ai as resolveFetchUrl, aj as restoreParcel, ak as restoreParcelById, al as sanitizeFileName, am as sanitizeParcelFileName, an as schemaDefinitionSchema, ao as serviceDetailsSchema, ap as serviceLifecycleSchema, aq as sha256Hex, ar as summarizeTaskQueue } from './chunks/word.interface-DLgRobKV.js';
3
- import '@supabase/supabase-js';
1
+ export { B as BaseValidator, C as CREATE_TARGET_ALREADY_EXISTS_MESSAGE, a as CategoryList, L as LOG_BATCH_LOADER_KEY, b as LOG_PERSIST_LOADER_KEY, c as LogLevel, M as MAX_POLL_TARGET_LIST_SIZE, d as MAX_TARGET_LIST_PAGE_SIZE, O as OPTIMISTIC_LOCK_ERROR_CODE, e as OPTIMISTIC_LOCK_FAILED_MESSAGE, P as PostListValidator, S as StatusCode, f as createLogger, g as createTarget, h as deleteTarget, i as generateResponse, j as getPossibleTarget, k as getTarget, l as getTargetList, m as getTargetTotalCount, n as handleSupabaseError, o as isCreateTargetAlreadyExistsError, p as isDevEnvironment, q as isOptimisticLockError, r as isOptimisticLockResponse, s as logDev, t as logDevGroup, u as logManager, v as patchTarget, w as pollTargetList, x as postListCreate, y as postLogListCreate, z as postTarget, A as scanTargetList, D as supabase, E as updateTargetDetails, F as validateWith, G as validateWithSchema } from './chunks/list.api-Ab9v8yOg.js';
2
+ export { A as ApiMethod, C as CategoryConfig, a as CategoryExtraction, b as CategoryIdea, c as CategoryLink, d as CategoryNode, e as CategoryParcel, f as CategoryRepo, g as CategoryService, h as CategoryTask, i as CategoryWord, D as DEFAULT_SYSTEM_REGISTRY_SEED_SLOTS, E as EMPTY_REGISTRY_SLOT_RUNTIME_STATE, M as Market, N as NodeStatus, P as POST_TASK_DEFAULT_MAX_ATTEMPTS, j as ParcelManager, k as PostLinkValidator, R as ResultCode, S as ServiceLifecycleStatus, l as ServiceRegistryError, m as ServiceSlotStatus, T as TARGET_SYSTEM_REGISTRY_KEY, n as TASK_REPO_USAGE, o as TaskStatus, p as TaskStatusAction, q as apiDetailsSchema, r as assertRegistrySlotAvailable, s as assertRegistrySlotOwner, t as buildEmptyServiceSlots, u as buildSystemRegistryConfigDetails, v as claimServiceRegistrySlot, w as classifyNetworkError, x as countTasksByType, y as createActiveServiceLifecycle, z as createClaimedRegistrySlotRuntimeState, B as createStorageProviderRegistry, F as createUploadTracker, G as decodeLogBatch, H as decodeLogBatchList, I as defaultL3ServiceDetails, J as deleteParcel, K as deleteParcelSchema, L as evaluateBusyNodeLiveness, O as fetchBinaryWithRetry, Q as fetchWithRetry, U as fieldDefinitionSchema, V as flattenLogBatch, W as flattenLogBatches, X as formatNetworkError, Y as getApi, Z as getApiSchema, _ as getConfig, $ as getConfigSchema, a0 as getExtraction, a1 as getExtractionSchema, a2 as getParcel, a3 as getParcelSchema, a4 as getScanRemoteRepoValues, a5 as getScanRemoteRepoValuesSchema, a6 as getService, a7 as getServiceSchema, a8 as getTargetSystemRegistry, a9 as getValueAtPath, aa as installChunkFetchRegistry, ab as isHttpUrl, ac as isLocalFilesystemPath, ad as isLogBatchList, ae as isLogEntry, af as isOpaqueChunkUrl, ag as isRetryableHttpStatus, ah as parcelDetailsSchema, ai as parseLogBatchMeta, aj as parseProviderPrefixedUrl, ak as parseServiceSlot, al as parseServiceSlots, am as patchChangeNodeStatus, an as patchChangeNodeStatusSchema, ao as patchChangeTaskStatus, ap as patchChangeTaskStatusSchema, aq as patchClaimTask, ar as patchClaimTaskSchema, as as patchExtractionObjects, at as patchExtractionObjectsSchema, au as patchNodeHeartBeat, av as patchNodeHeartBeatSchema, aw as patchServiceRuntime, ax as patchStopNode, ay as patchStopNodeSchema, az as patchTaskProgress, aA as patchTaskProgressSchema, aB as postApi, aC as postApiSchema, aD as postExtraction, aE as postExtractionSchema, aF as postLinkCreate, aG as postParcel, aH as postParcelSchema, aI as postRegisterNode, aJ as postRegisterNodeSchema, aK as postService, aL as postServiceInstance, aM as postServiceSchema, aN as postSystemRegistryConfig, aO as postSystemRegistryConfigSchema, aP as postTask, aQ as postTaskSchema, aR as postTaskWithRetry, aS as publishParcel, aT as registerProviderChunkResolver, aU as registerService, aV as registerServiceAtStartup, aW as registrySlotRuntimePatchFromGuardResult, aX as requestHasBody, aY as resetSystemRegistryConfig, aZ as resetSystemRegistryConfigSchema, a_ as resolveActiveRegistryServiceId, a$ as resolveFetchUrl, b0 as restoreParcel, b1 as restoreParcelById, b2 as runRegistrySlotGuardCheck, b3 as sanitizeFileName, b4 as sanitizeParcelFileName, b5 as scanExtractionList, b6 as scanExtractionListSchema, b7 as schemaDefinitionSchema, b8 as serviceDetailsSchema, b9 as serviceLifecycleSchema, ba as serviceNodeSnapshotSchema, bb as serviceRuntimeSchema, bc as sha256Hex, bd as summarizeTaskQueue, be as systemRegistrySeedSlotSchema, bf as unregisterService, bg as unregisterServiceAtShutdown } from './chunks/word.interface-B_fbVFOW.js';
4
3
  import 'lodash-es';
4
+ import '@supabase/supabase-js';
5
5
  import 'zod';
6
6
  //# sourceMappingURL=browser.js.map
@@ -2,7 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { resolve, dirname, join } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import { readFile, mkdir, writeFile, rename, readdir } from 'node:fs/promises';
5
- import { d as createLogger, a as CategoryList, w as postLogListCreate, m as isCreateTargetAlreadyExistsError, L as LogLevel, F as registerLogPersistOffer } from './create-logger-DyH3mZ8p.js';
5
+ import { f as createLogger, b as LOG_PERSIST_LOADER_KEY, a as CategoryList, y as postLogListCreate, o as isCreateTargetAlreadyExistsError, c as LogLevel, H as registerLogPersistOffer } from './list.api-Ab9v8yOg.js';
6
6
  import 'lodash-es';
7
7
  import { createHash } from 'node:crypto';
8
8
 
@@ -74,6 +74,39 @@ function envBool(name, defaultValue = false, env = process.env) {
74
74
  }
75
75
 
76
76
  const DEFAULT_ENV_FILES = [".env.local", ".env"];
77
+ const PROD_ENV_FILES = [".env.prod"];
78
+ const SERVICE_ENV_PROFILE_ENV_KEY = "SERVICE_ENV_PROFILE";
79
+ const SERVICE_ENV_PROFILE_PROD = "prod";
80
+ const CLI_PROD_FLAG = "--prod";
81
+ /** Resolve active env profile from `SERVICE_ENV_PROFILE` or `--prod` on argv. */
82
+ function envProfileFromProcess(options) {
83
+ const env = options?.env ?? process.env;
84
+ const argv = options?.argv ?? process.argv;
85
+ const fromEnv = env[SERVICE_ENV_PROFILE_ENV_KEY]?.trim();
86
+ if (fromEnv != null && fromEnv !== "") {
87
+ return fromEnv;
88
+ }
89
+ if (argv.includes(CLI_PROD_FLAG)) {
90
+ return SERVICE_ENV_PROFILE_PROD;
91
+ }
92
+ return undefined;
93
+ }
94
+ /** Default env file list for a profile (`prod` → `.env.prod`; otherwise `.env.local` → `.env`). */
95
+ function resolveDefaultEnvFiles(profile) {
96
+ if (profile === SERVICE_ENV_PROFILE_PROD) {
97
+ return PROD_ENV_FILES;
98
+ }
99
+ return DEFAULT_ENV_FILES;
100
+ }
101
+ /** Pin `SERVICE_ENV_PROFILE=prod` when `--prod` is on argv (for child process inheritance). */
102
+ function pinEnvProfileFromArgv(env = process.env, argv = process.argv) {
103
+ if (env[SERVICE_ENV_PROFILE_ENV_KEY]?.trim()) {
104
+ return;
105
+ }
106
+ if (argv.includes(CLI_PROD_FLAG)) {
107
+ env[SERVICE_ENV_PROFILE_ENV_KEY] = SERVICE_ENV_PROFILE_PROD;
108
+ }
109
+ }
77
110
  function stripQuotes(value) {
78
111
  return value.replace(/^["']|["']$/g, "");
79
112
  }
@@ -109,12 +142,13 @@ function parseEnvFile(filePath, env) {
109
142
  parseEnvFileContent(readFileSync(filePath, "utf8"), env);
110
143
  }
111
144
  /**
112
- * Load `.env.local` then `.env` into `process.env` (or `options.env`).
145
+ * Load env files into `process.env` (or `options.env`).
146
+ * Default files: `.env.local` → `.env`, or `.env.prod` when profile is `prod` / `--prod`.
113
147
  * Existing non-empty env values are not overwritten.
114
148
  */
115
149
  function loadEnvFiles(root, options) {
116
150
  const env = options?.env ?? process.env;
117
- const files = options?.files ?? DEFAULT_ENV_FILES;
151
+ const files = options?.files ?? resolveDefaultEnvFiles(envProfileFromProcess({ env }));
118
152
  for (const name of files) {
119
153
  parseEnvFile(resolve(root, name), env);
120
154
  }
@@ -232,7 +266,6 @@ async function pollUntil(options) {
232
266
  throw new Error(`pollUntil timeout after ${options.timeoutMs}ms`);
233
267
  }
234
268
 
235
- const LOG_PERSIST_LOADER_KEY = "LogBatch.0";
236
269
  const DEFAULT_LOG_PERSIST_CONFIG = {
237
270
  fast: {
238
271
  maxBufferEntries: 500,
@@ -391,7 +424,7 @@ function buildLogListDraft(input) {
391
424
  details: {
392
425
  manifestVersion: 0,
393
426
  loaderKey: LOG_PERSIST_LOADER_KEY,
394
- meta: JSON.stringify({
427
+ meta: {
395
428
  service,
396
429
  process,
397
430
  pid: globalThis.process.pid,
@@ -401,7 +434,7 @@ function buildLogListDraft(input) {
401
434
  to: last?.timestamp ?? null,
402
435
  flushedAt: Date.now(),
403
436
  idempotencyKey,
404
- }),
437
+ },
405
438
  preview: first?.message ?? "",
406
439
  items: entries,
407
440
  },
@@ -1477,5 +1510,5 @@ function resolveLogPersistRegistryPath(registryDir) {
1477
1510
  return defaultLogPersistRegistryPath(resolve(dir ?? ""));
1478
1511
  }
1479
1512
 
1480
- export { logPersistEnabledFromEnv as a, readEnv as b, requireEnv as c, createJsonFileStateStore as d, disableLogPersist as e, enableLogPersist as f, ensureLogPersistFromEnv as g, envBool as h, envInt as i, envMs as j, envNumber as k, loadEnvFiles as l, envPort as m, getLogPersistStats as n, parseEnvLine as o, parseEnvFile as p, pollUntil as q, resolveProjectRootByPackageName as r, resolveLogPersistRegistryPath as s, resolveProjectRootFromModule as t, snapshotLogPersistReady as u, validateLogPersistPreloadEnv as v, waitForLogPersistReady as w };
1481
- //# sourceMappingURL=enable-log-persist-BH-tbKEj.js.map
1513
+ export { resolveProjectRootFromModule as A, CLI_PROD_FLAG as C, SERVICE_ENV_PROFILE_ENV_KEY as S, logPersistEnabledFromEnv as a, readEnv as b, requireEnv as c, createJsonFileStateStore as d, disableLogPersist as e, ensureLogPersistFromEnv as f, getLogPersistStats as g, SERVICE_ENV_PROFILE_PROD as h, enableLogPersist as i, envBool as j, envInt as k, loadEnvFiles as l, envMs as m, envNumber as n, envPort as o, pinEnvProfileFromArgv as p, envProfileFromProcess as q, resolveProjectRootByPackageName as r, snapshotLogPersistReady as s, parseEnvFile as t, parseEnvLine as u, validateLogPersistPreloadEnv as v, waitForLogPersistReady as w, pollUntil as x, resolveDefaultEnvFiles as y, resolveLogPersistRegistryPath as z };
1514
+ //# sourceMappingURL=enable-log-persist-B8rg_wXG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enable-log-persist-B8rg_wXG.js","sources":["../../src/node/env/require-env.ts","../../src/node/env/env-parsers.ts","../../src/node/env/load-env.ts","../../src/node/env/project-root.ts","../../src/node/fs/json-state-store.ts","../../src/node/readiness/poll-until.ts","../../src/shared/log/log-persist.config.ts","../../src/shared/log/log-persist-batch-id.ts","../../src/shared/log/log-persist-logger.ts","../../src/shared/log/log-persist-flush.ts","../../src/shared/log/log-persist-registry.ts","../../src/shared/log/log-persist.ts","../../src/shared/log/enable-log-persist.ts"],"sourcesContent":["export function readEnv(name: string, env: NodeJS.ProcessEnv = process.env): string | undefined {\n const value = env[name]?.trim();\n if (value == null || value === \"\") {\n return undefined;\n }\n return value;\n}\n\nexport function requireEnv(name: string, env: NodeJS.ProcessEnv = process.env): string {\n const value = readEnv(name, env);\n if (value == null) {\n throw new Error(`Missing required environment variable: ${name}`);\n }\n return value;\n}\n","import { readEnv } from \"./require-env\";\n\nexport interface EnvIntOptions {\n env?: NodeJS.ProcessEnv;\n min?: number;\n max?: number;\n}\n\nexport function envInt(name: string, defaultValue: number, options?: EnvIntOptions): number {\n const env = options?.env ?? process.env;\n const raw = readEnv(name, env);\n if (raw == null) {\n return defaultValue;\n }\n\n const value = Number(raw);\n if (!Number.isInteger(value)) {\n throw new Error(`Invalid ${name}: ${raw}`);\n }\n\n const min = options?.min;\n if (min != null && value < min) {\n throw new Error(`Invalid ${name}: ${raw}`);\n }\n\n const max = options?.max;\n if (max != null && value > max) {\n throw new Error(`Invalid ${name}: ${raw}`);\n }\n\n return value;\n}\n\nexport function envMs(name: string, defaultMs: number, options?: EnvIntOptions): number {\n return envInt(name, defaultMs, { ...options, min: options?.min ?? 1 });\n}\n\nexport function envPort(defaultPort = 3100, options?: EnvIntOptions & { envKey?: string }): number {\n const envKey = options?.envKey ?? \"PORT\";\n return envInt(envKey, defaultPort, { ...options, min: 1, max: 65535 });\n}\n\nexport interface EnvNumberOptions {\n env?: NodeJS.ProcessEnv;\n min?: number;\n /** When true, use Math.floor on parsed value. */\n floor?: boolean;\n}\n\nexport function envNumber(name: string, defaultValue: number, options?: EnvNumberOptions): number {\n const env = options?.env ?? process.env;\n const raw = readEnv(name, env);\n if (raw == null) {\n return defaultValue;\n }\n\n const value = Number(raw);\n if (!Number.isFinite(value)) {\n throw new Error(`Invalid ${name}: ${raw}`);\n }\n\n const min = options?.min;\n const resolved = options?.floor === true ? Math.floor(value) : value;\n if (min != null && resolved < min) {\n throw new Error(`Invalid ${name}: ${raw}`);\n }\n\n return resolved;\n}\n\nexport function envBool(name: string, defaultValue = false, env: NodeJS.ProcessEnv = process.env): boolean {\n const raw = readEnv(name, env)?.toLowerCase();\n if (raw == null) {\n return defaultValue;\n }\n return raw === \"1\" || raw === \"true\" || raw === \"yes\";\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nconst DEFAULT_ENV_FILES = [\".env.local\", \".env\"] as const;\nconst PROD_ENV_FILES = [\".env.prod\"] as const;\n\nexport const SERVICE_ENV_PROFILE_ENV_KEY = \"SERVICE_ENV_PROFILE\" as const;\nexport const SERVICE_ENV_PROFILE_PROD = \"prod\" as const;\nexport const CLI_PROD_FLAG = \"--prod\" as const;\n\nexport interface EnvProfileFromProcessOptions {\n env?: NodeJS.ProcessEnv;\n argv?: readonly string[];\n}\n\n/** Resolve active env profile from `SERVICE_ENV_PROFILE` or `--prod` on argv. */\nexport function envProfileFromProcess(options?: EnvProfileFromProcessOptions): string | undefined {\n const env = options?.env ?? process.env;\n const argv = options?.argv ?? process.argv;\n const fromEnv = env[SERVICE_ENV_PROFILE_ENV_KEY]?.trim();\n if (fromEnv != null && fromEnv !== \"\") {\n return fromEnv;\n }\n if (argv.includes(CLI_PROD_FLAG)) {\n return SERVICE_ENV_PROFILE_PROD;\n }\n return undefined;\n}\n\n/** Default env file list for a profile (`prod` → `.env.prod`; otherwise `.env.local` → `.env`). */\nexport function resolveDefaultEnvFiles(profile?: string): readonly string[] {\n if (profile === SERVICE_ENV_PROFILE_PROD) {\n return PROD_ENV_FILES;\n }\n return DEFAULT_ENV_FILES;\n}\n\n/** Pin `SERVICE_ENV_PROFILE=prod` when `--prod` is on argv (for child process inheritance). */\nexport function pinEnvProfileFromArgv(\n env: NodeJS.ProcessEnv = process.env,\n argv: readonly string[] = process.argv,\n): void {\n if (env[SERVICE_ENV_PROFILE_ENV_KEY]?.trim()) {\n return;\n }\n if (argv.includes(CLI_PROD_FLAG)) {\n env[SERVICE_ENV_PROFILE_ENV_KEY] = SERVICE_ENV_PROFILE_PROD;\n }\n}\n\nexport interface LoadEnvFilesOptions {\n /** Files to load in order (later files do not override existing env). */\n files?: readonly string[];\n env?: NodeJS.ProcessEnv;\n /** Called after all files are merged (e.g. legacy alias normalization). */\n afterLoad?: () => void;\n}\n\nfunction stripQuotes(value: string): string {\n return value.replace(/^[\"']|[\"']$/g, \"\");\n}\n\n/** Parse one KEY=VALUE line; returns null if line should be skipped. */\nexport function parseEnvLine(line: string): { key: string; value: string } | null {\n const trimmed = line.trim();\n if (trimmed === \"\" || trimmed.startsWith(\"#\")) {\n return null;\n }\n\n const eq = trimmed.indexOf(\"=\");\n if (eq === -1) {\n return null;\n }\n\n const key = trimmed.slice(0, eq).trim();\n const raw = trimmed.slice(eq + 1).trim();\n return { key, value: stripQuotes(raw) };\n}\n\nexport function parseEnvFileContent(content: string, env: NodeJS.ProcessEnv): void {\n for (const line of content.split(\"\\n\")) {\n const parsed = parseEnvLine(line);\n if (parsed == null) {\n continue;\n }\n if (env[parsed.key] == null || env[parsed.key] === \"\") {\n env[parsed.key] = parsed.value;\n }\n }\n}\n\nexport function parseEnvFile(filePath: string, env: NodeJS.ProcessEnv): void {\n if (!existsSync(filePath)) {\n return;\n }\n parseEnvFileContent(readFileSync(filePath, \"utf8\"), env);\n}\n\n/**\n * Load env files into `process.env` (or `options.env`).\n * Default files: `.env.local` → `.env`, or `.env.prod` when profile is `prod` / `--prod`.\n * Existing non-empty env values are not overwritten.\n */\nexport function loadEnvFiles(root: string, options?: LoadEnvFilesOptions): void {\n const env = options?.env ?? process.env;\n const files = options?.files ?? resolveDefaultEnvFiles(envProfileFromProcess({ env }));\n\n for (const name of files) {\n parseEnvFile(resolve(root, name), env);\n }\n\n options?.afterLoad?.();\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * Resolve project root from a module URL (typically `import.meta.url`).\n * @param relativePath Path relative to the module file (default `\"..\"` = parent directory).\n */\nexport function resolveProjectRootFromModule(importMetaUrl: string, relativePath = \"..\"): string {\n return resolve(fileURLToPath(new URL(relativePath, importMetaUrl)));\n}\n\n/**\n * Walk upward from `importMetaUrl` until a `package.json` with matching `name` is found.\n * Use for esbuild bundles under `dist/` where a single `..` hop lands in `dist/`, not repo root.\n */\nexport function resolveProjectRootByPackageName(importMetaUrl: string, packageName: string): string {\n let dir = dirname(fileURLToPath(importMetaUrl));\n for (;;) {\n const packageJsonPath = resolve(dir, \"package.json\");\n if (existsSync(packageJsonPath)) {\n const pkg = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as { name?: string };\n if (pkg.name === packageName) {\n return dir;\n }\n }\n const parent = dirname(dir);\n if (parent === dir) {\n break;\n }\n dir = parent;\n }\n throw new Error(`Could not find package root for \"${packageName}\" from ${importMetaUrl}`);\n}\n","import { mkdir, readFile, rename, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\nexport type JsonStatePatch<T extends object, NK extends keyof T> = Partial<Omit<T, NK>> & {\n [K in NK]?: T[K] extends object ? Partial<T[K]> : T[K];\n};\n\nexport interface JsonFileStateStore<T extends object, NK extends keyof T = never> {\n read(): Promise<T>;\n write(patch: JsonStatePatch<T, NK>): Promise<T>;\n reset(): Promise<T>;\n}\n\nexport interface CreateJsonFileStateStoreOptions<T extends object, NK extends keyof T = never> {\n filePath: string;\n defaultState: T;\n /** Top-level keys shallow-merged one level deep on read and write. */\n nestedKeys?: NK[];\n /** When set, assigned `new Date().toISOString()` on write and reset. */\n updatedAtKey?: keyof T;\n}\n\nfunction mergeWithNested<T extends object>(\n defaults: T,\n current: Partial<T> | undefined,\n patch: Partial<T>,\n nestedKeys: (keyof T)[],\n): T {\n const merged = {\n ...defaults,\n ...current,\n ...patch,\n } as T;\n\n for (const key of nestedKeys) {\n const defaultNested = defaults[key];\n if (defaultNested != null && typeof defaultNested === \"object\") {\n (merged as Record<keyof T, unknown>)[key] = {\n ...defaultNested,\n ...(current?.[key] as object | undefined),\n ...(patch[key] as object | undefined),\n };\n }\n }\n\n return merged;\n}\n\nasync function atomicWriteJson(filePath: string, data: unknown): Promise<void> {\n await mkdir(dirname(filePath), { recursive: true });\n const content = `${JSON.stringify(data, null, 2)}\\n`;\n const tempPath = `${filePath}.${process.pid}.tmp`;\n await writeFile(tempPath, content, \"utf8\");\n await rename(tempPath, filePath);\n}\n\n/** JSON file-backed state with optional nested key merge and atomic writes. */\nexport function createJsonFileStateStore<T extends object, NK extends keyof T = never>(\n options: CreateJsonFileStateStoreOptions<T, NK>,\n): JsonFileStateStore<T, NK> {\n const { filePath, defaultState, nestedKeys = [] as NK[], updatedAtKey } = options;\n\n function touchUpdatedAt(state: T): T {\n if (updatedAtKey == null) {\n return state;\n }\n return {\n ...state,\n [updatedAtKey]: new Date().toISOString(),\n };\n }\n\n return {\n async read(): Promise<T> {\n try {\n const raw = await readFile(filePath, \"utf8\");\n const parsed = JSON.parse(raw) as Partial<T>;\n return mergeWithNested(defaultState, parsed, {}, nestedKeys);\n } catch {\n return { ...defaultState };\n }\n },\n\n async write(patch: JsonStatePatch<T, NK>): Promise<T> {\n const current = await this.read();\n const next = touchUpdatedAt(mergeWithNested(defaultState, current, patch as Partial<T>, nestedKeys));\n await atomicWriteJson(filePath, next);\n return next;\n },\n\n async reset(): Promise<T> {\n const next = touchUpdatedAt({ ...defaultState });\n await atomicWriteJson(filePath, next);\n return next;\n },\n };\n}\n","function sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nexport interface PollUntilOptions {\n timeoutMs: number;\n intervalMs?: number;\n until: () => boolean | Promise<boolean>;\n}\n\n/**\n * Poll `until()` until it returns true or `timeoutMs` elapses.\n * @throws Error on timeout\n */\nexport async function pollUntil(options: PollUntilOptions): Promise<void> {\n const intervalMs = options.intervalMs ?? 500;\n const deadline = Date.now() + options.timeoutMs;\n\n while (Date.now() < deadline) {\n if (await options.until()) {\n return;\n }\n await sleep(intervalMs);\n }\n\n throw new Error(`pollUntil timeout after ${options.timeoutMs}ms`);\n}\n","import { envBool, envInt, envMs } from \"../../node/env/env-parsers\";\nimport type { LogPersistConfig } from \"./log-persist.interface\";\n\nexport const DEFAULT_LOG_PERSIST_CONFIG: LogPersistConfig = {\n fast: {\n maxBufferEntries: 500,\n },\n medium: {\n debounceMs: 5_000,\n maxEntries: 20,\n maxBytes: 512 * 1024,\n maxBufferEntries: 1_000,\n },\n slow: {\n maxEntries: 400,\n maxBytes: 512 * 1024,\n maxAgeMs: 120_000,\n maxBufferEntries: 2_000,\n },\n postTimeoutMs: 30_000,\n shutdownDrainTimeoutMs: 15_000,\n};\n\nexport function resolveLogPersistConfig(partial?: Partial<LogPersistConfig>): LogPersistConfig {\n const defaults = DEFAULT_LOG_PERSIST_CONFIG;\n return {\n fast: { ...defaults.fast, ...partial?.fast },\n medium: { ...defaults.medium, ...partial?.medium },\n slow: { ...defaults.slow, ...partial?.slow },\n postTimeoutMs: partial?.postTimeoutMs ?? defaults.postTimeoutMs,\n shutdownDrainTimeoutMs: partial?.shutdownDrainTimeoutMs ?? defaults.shutdownDrainTimeoutMs,\n };\n}\n\nexport function logPersistEnabledFromEnv(env: NodeJS.ProcessEnv = process.env): boolean {\n return envBool(\"LOG_PERSIST_ENABLED\", false, env);\n}\n\nexport function logPersistServiceFromEnv(env: NodeJS.ProcessEnv = process.env): string | undefined {\n const raw = env.LOG_PERSIST_SERVICE?.trim();\n return raw != null && raw !== \"\" ? raw : undefined;\n}\n\nexport function logPersistProcessFromEnv(env: NodeJS.ProcessEnv = process.env): string | undefined {\n const raw = env.LOG_PERSIST_PROCESS?.trim();\n return raw != null && raw !== \"\" ? raw : undefined;\n}\n\nexport function logPersistRegistryDirFromEnv(env: NodeJS.ProcessEnv = process.env): string | undefined {\n const configured = env.LOG_PERSIST_REGISTRY_DIR?.trim();\n if (configured != null && configured !== \"\") {\n return configured;\n }\n const runtime = env.RUNTIME_DATA_DIR?.trim();\n return runtime != null && runtime !== \"\" ? runtime : undefined;\n}\n\nexport function logPersistConfigFromEnv(env: NodeJS.ProcessEnv = process.env): LogPersistConfig {\n return resolveLogPersistConfig({\n fast: {\n maxBufferEntries: envInt(\"LOG_FAST_MAX_BUFFER_ENTRIES\", DEFAULT_LOG_PERSIST_CONFIG.fast.maxBufferEntries, {\n env,\n min: 1,\n }),\n },\n medium: {\n debounceMs: envMs(\"LOG_MEDIUM_DEBOUNCE_MS\", DEFAULT_LOG_PERSIST_CONFIG.medium.debounceMs, { env }),\n maxEntries: envInt(\"LOG_MEDIUM_MAX_ENTRIES\", DEFAULT_LOG_PERSIST_CONFIG.medium.maxEntries, {\n env,\n min: 1,\n }),\n maxBytes: envInt(\"LOG_MEDIUM_MAX_BYTES\", DEFAULT_LOG_PERSIST_CONFIG.medium.maxBytes, { env, min: 1 }),\n maxBufferEntries: envInt(\n \"LOG_MEDIUM_MAX_BUFFER_ENTRIES\",\n DEFAULT_LOG_PERSIST_CONFIG.medium.maxBufferEntries,\n { env, min: 1 },\n ),\n },\n slow: {\n maxEntries: envInt(\"LOG_SLOW_MAX_ENTRIES\", DEFAULT_LOG_PERSIST_CONFIG.slow.maxEntries, { env, min: 1 }),\n maxBytes: envInt(\"LOG_SLOW_MAX_BYTES\", DEFAULT_LOG_PERSIST_CONFIG.slow.maxBytes, { env, min: 1 }),\n maxAgeMs: envMs(\"LOG_SLOW_MAX_AGE_MS\", DEFAULT_LOG_PERSIST_CONFIG.slow.maxAgeMs, { env }),\n maxBufferEntries: envInt(\"LOG_SLOW_MAX_BUFFER_ENTRIES\", DEFAULT_LOG_PERSIST_CONFIG.slow.maxBufferEntries, {\n env,\n min: 1,\n }),\n },\n postTimeoutMs: envMs(\"LOG_PERSIST_POST_TIMEOUT_MS\", DEFAULT_LOG_PERSIST_CONFIG.postTimeoutMs, { env }),\n shutdownDrainTimeoutMs: envMs(\n \"LOG_PERSIST_SHUTDOWN_DRAIN_MS\",\n DEFAULT_LOG_PERSIST_CONFIG.shutdownDrainTimeoutMs,\n { env },\n ),\n });\n}\n","import { createHash } from \"node:crypto\";\nimport type { LogEntry } from \"./log-manager\";\nimport type { LogPersistLane } from \"./log-persist.interface\";\n\nconst BATCH_ID_VERSION = 1;\n\n/** Stable subset of LogEntry for idempotency hashing (same batch → same key). */\nfunction canonicalLogEntry(entry: LogEntry): Record<string, unknown> {\n return {\n timestamp: entry.timestamp,\n level: entry.level,\n message: entry.message,\n topic: entry.topic,\n module: entry.module,\n traceId: entry.traceId,\n traceParentId: entry.traceParentId ?? null,\n extra: entry.extra ?? null,\n data: entry.data ?? null,\n labels: entry.labels ?? null,\n };\n}\n\n/**\n * Deterministic List.value for a log batch — retries after timeout map to the same row key.\n * SHA-256 over canonical JSON (service + process + lane + entries in order).\n */\nexport function computeLogBatchIdempotencyKey(input: {\n service: string;\n process: string;\n lane: LogPersistLane;\n entries: LogEntry[];\n}): string {\n const payload = {\n v: BATCH_ID_VERSION,\n service: input.service,\n process: input.process,\n lane: input.lane,\n entries: input.entries.map(canonicalLogEntry),\n };\n\n const hash = createHash(\"sha256\").update(JSON.stringify(payload), \"utf8\").digest(\"hex\");\n return `${hash.slice(0, 32)}`;\n}\n","import { createLogger } from \"./create-logger\";\n\n/** User-facing / lifecycle logs — may be persisted like normal app logs. */\nexport const LOG_PERSIST_TOPIC = \"log-persist\";\n\n/** Operational logs from the persist pipeline — never re-offered to avoid feedback loops. */\nexport const LOG_PERSIST_INTERNAL_TOPIC = \"log-persist-internal\";\n\nconst logger = createLogger({ module: \"log-persist\" });\n\nexport function isLogPersistInternalTopic(topic: string | undefined): boolean {\n return topic === LOG_PERSIST_INTERNAL_TOPIC;\n}\n\ntype PersistLogData = Record<string, unknown>;\n\nfunction write(level: \"debug\" | \"info\" | \"warn\" | \"error\", message: string, data?: PersistLogData): void {\n logger[level](message, {\n topic: LOG_PERSIST_INTERNAL_TOPIC,\n ...(data != null ? { data } : {}),\n });\n}\n\nexport const persistLogger = {\n debug: (message: string, data?: PersistLogData) => write(\"debug\", message, data),\n info: (message: string, data?: PersistLogData) => write(\"info\", message, data),\n warn: (message: string, data?: PersistLogData) => write(\"warn\", message, data),\n error: (message: string, data?: PersistLogData) => write(\"error\", message, data),\n};\n\nexport function patchPersistLoggerScope(labels: Record<string, string>): void {\n logger.resetScope({ labels });\n}\n","import { isCreateTargetAlreadyExistsError } from \"../../core.api\";\nimport { postLogListCreate } from \"../../list/list.api\";\nimport { CategoryList } from \"../../list/list.interface\";\nimport type { LogEntry } from \"./log-manager\";\nimport type { BuildLogListDraftInput, LogListDraft } from \"./log-persist.interface\";\nimport { LOG_PERSIST_LOADER_KEY } from \"./log-persist.interface\";\nimport { persistLogger } from \"./log-persist-logger\";\n\nexport function estimateEntriesBytes(entries: LogEntry[]): number {\n if (entries.length === 0) {\n return 0;\n }\n try {\n return Buffer.byteLength(JSON.stringify(entries), \"utf8\");\n } catch {\n return entries.length * 512;\n }\n}\n\nexport function buildLogListDraft(input: BuildLogListDraftInput): LogListDraft {\n const { service, process, lane, idempotencyKey, entries } = input;\n const first = entries[0];\n const last = entries[entries.length - 1];\n\n return {\n name: `log-batch:${service}:${process}:${lane}`,\n value: idempotencyKey,\n category: CategoryList.LIST,\n tagList: [\"log\", lane, service],\n details: {\n manifestVersion: 0,\n loaderKey: LOG_PERSIST_LOADER_KEY,\n meta: {\n service,\n process,\n pid: globalThis.process.pid,\n lane,\n count: entries.length,\n from: first?.timestamp ?? null,\n to: last?.timestamp ?? null,\n flushedAt: Date.now(),\n idempotencyKey,\n },\n preview: first?.message ?? \"\",\n items: entries,\n },\n };\n}\n\nasync function withTimeout<T>(promise: Promise<T>, timeoutMs: number, label: string): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | null = null;\n try {\n return await Promise.race([\n promise,\n new Promise<T>((_resolve, reject) => {\n timer = setTimeout(() => {\n reject(new Error(`${label} timed out after ${timeoutMs}ms`));\n }, timeoutMs);\n }),\n ]);\n } finally {\n if (timer != null) {\n clearTimeout(timer);\n }\n }\n}\n\nexport async function postLogBatch(draft: LogListDraft, postTimeoutMs: number): Promise<void> {\n try {\n const result = await withTimeout(\n postLogListCreate({\n name: draft.name,\n value: draft.value,\n category: draft.category,\n details: draft.details,\n }),\n postTimeoutMs,\n \"postLogListCreate\",\n );\n\n if (!result.success) {\n const message = result.error?.message ?? \"postLogListCreate failed\";\n persistLogger.error(\"post log batch failed\", {\n idempotencyKey: draft.value,\n name: draft.name,\n error: message,\n });\n throw new Error(message);\n }\n } catch (error) {\n if (isCreateTargetAlreadyExistsError(error)) {\n persistLogger.error(\"post log batch idempotent duplicate — treating as success\", {\n idempotencyKey: draft.value,\n name: draft.name,\n });\n return;\n }\n throw error;\n }\n}\n\n/** Take a prefix of entries that fits within maxBytes. */\nexport function takeEntriesWithinBytes(entries: LogEntry[], maxBytes: number): LogEntry[] {\n if (entries.length === 0) {\n return [];\n }\n\n const taken: LogEntry[] = [];\n for (const entry of entries) {\n const candidate = [...taken, entry];\n if (taken.length > 0 && estimateEntriesBytes(candidate) > maxBytes) {\n break;\n }\n taken.push(entry);\n }\n\n const result = taken.length > 0 ? taken : [entries[0]];\n if (result.length < entries.length) {\n persistLogger.warn(\"trimmed batch to maxBytes\", {\n requested: entries.length,\n taken: result.length,\n maxBytes,\n takenBytes: estimateEntriesBytes(result),\n });\n }\n\n return result;\n}\n","import { mkdir, readdir, readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { createJsonFileStateStore } from \"../../node/fs/json-state-store\";\nimport type { LogPersistProcessRecord, LogPersistRegistryState } from \"./log-persist.interface\";\nimport { persistLogger } from \"./log-persist-logger\";\n\nconst DEFAULT_REGISTRY: LogPersistRegistryState = {\n updatedAt: new Date(0).toISOString(),\n service: \"\",\n processes: {},\n};\n\n/** Per-process shard — each process owns one file; no cross-process RMW. */\ninterface LogPersistProcessShard extends LogPersistProcessRecord {\n service: string;\n updatedAt: string;\n}\n\nconst DEFAULT_SHARD: LogPersistProcessShard = {\n service: \"\",\n updatedAt: new Date(0).toISOString(),\n pid: 0,\n enabledAt: new Date(0).toISOString(),\n lastHeartbeatAt: new Date(0).toISOString(),\n};\n\nconst legacyStores = new Map<\n string,\n ReturnType<typeof createJsonFileStateStore<LogPersistRegistryState, \"processes\">>\n>();\n\nconst shardStores = new Map<string, ReturnType<typeof createJsonFileStateStore<LogPersistProcessShard>>>();\n\nfunction isLegacyRegistryFile(registryPath: string): boolean {\n return registryPath.endsWith(\".json\");\n}\n\nfunction legacyStoreFor(filePath: string) {\n let store = legacyStores.get(filePath);\n if (store == null) {\n store = createJsonFileStateStore<LogPersistRegistryState, \"processes\">({\n filePath,\n defaultState: DEFAULT_REGISTRY,\n nestedKeys: [\"processes\"],\n updatedAtKey: \"updatedAt\",\n });\n legacyStores.set(filePath, store);\n }\n return store;\n}\n\nfunction shardStoreFor(shardFilePath: string) {\n let store = shardStores.get(shardFilePath);\n if (store == null) {\n store = createJsonFileStateStore<LogPersistProcessShard>({\n filePath: shardFilePath,\n defaultState: DEFAULT_SHARD,\n updatedAtKey: \"updatedAt\",\n });\n shardStores.set(shardFilePath, store);\n }\n return store;\n}\n\nfunction shardFilePath(registryDir: string, process: string): string {\n return join(registryDir, `${process}.json`);\n}\n\n/** Registry root directory — one shard file per process under this path. */\nexport function defaultLogPersistRegistryPath(registryDir: string): string {\n return join(registryDir, \"log-persist-registry\");\n}\n\nasync function readShardedLogPersistRegistry(registryDir: string): Promise<LogPersistRegistryState> {\n await mkdir(registryDir, { recursive: true });\n\n let entries: string[];\n try {\n entries = await readdir(registryDir);\n } catch {\n return { ...DEFAULT_REGISTRY };\n }\n\n const processes: Record<string, LogPersistProcessRecord> = {};\n let service = \"\";\n let updatedAt = new Date(0).toISOString();\n\n for (const name of entries) {\n if (!name.endsWith(\".json\")) {\n continue;\n }\n\n const processName = name.slice(0, -\".json\".length);\n if (processName === \"\" || processName.startsWith(\"_\")) {\n continue;\n }\n\n try {\n const raw = await readFile(join(registryDir, name), \"utf8\");\n const shard = JSON.parse(raw) as Partial<LogPersistProcessShard>;\n if (shard.service != null && shard.service !== \"\") {\n service = shard.service;\n }\n if (shard.updatedAt != null && shard.updatedAt > updatedAt) {\n updatedAt = shard.updatedAt;\n }\n processes[processName] = {\n pid: shard.pid ?? 0,\n enabledAt: shard.enabledAt ?? new Date(0).toISOString(),\n lastHeartbeatAt: shard.lastHeartbeatAt ?? new Date(0).toISOString(),\n };\n } catch {\n persistLogger.warn(\"registry shard read skipped — corrupt or missing\", {\n registryDir,\n shard: name,\n });\n }\n }\n\n return { updatedAt, service, processes };\n}\n\nexport async function registerLogPersistProcess(input: {\n registryFilePath: string;\n service: string;\n process: string;\n}): Promise<void> {\n const now = new Date().toISOString();\n const record: LogPersistProcessRecord = {\n pid: process.pid,\n enabledAt: now,\n lastHeartbeatAt: now,\n };\n\n if (isLegacyRegistryFile(input.registryFilePath)) {\n await legacyStoreFor(input.registryFilePath).write({\n service: input.service,\n processes: {\n [input.process]: record,\n },\n });\n } else {\n await shardStoreFor(shardFilePath(input.registryFilePath, input.process)).write({\n service: input.service,\n pid: record.pid,\n enabledAt: record.enabledAt,\n lastHeartbeatAt: record.lastHeartbeatAt,\n });\n }\n\n persistLogger.info(\"registry process registered\", {\n registryFilePath: input.registryFilePath,\n service: input.service,\n process: input.process,\n pid: record.pid,\n });\n}\n\nexport async function heartbeatLogPersistProcess(input: { registryFilePath: string; process: string }): Promise<void> {\n if (isLegacyRegistryFile(input.registryFilePath)) {\n const current = await legacyStoreFor(input.registryFilePath).read();\n const existing = current.processes[input.process];\n if (existing == null) {\n persistLogger.warn(\"registry heartbeat skipped — process not registered\", {\n registryFilePath: input.registryFilePath,\n process: input.process,\n });\n return;\n }\n\n await legacyStoreFor(input.registryFilePath).write({\n processes: {\n [input.process]: {\n ...existing,\n lastHeartbeatAt: new Date().toISOString(),\n },\n },\n });\n return;\n }\n\n const store = shardStoreFor(shardFilePath(input.registryFilePath, input.process));\n const current = await store.read();\n if (current.pid === 0) {\n persistLogger.warn(\"registry heartbeat skipped — process not registered\", {\n registryFilePath: input.registryFilePath,\n process: input.process,\n });\n return;\n }\n\n await store.write({\n lastHeartbeatAt: new Date().toISOString(),\n });\n}\n\nexport async function unregisterLogPersistProcess(input: { registryFilePath: string; process: string }): Promise<void> {\n if (isLegacyRegistryFile(input.registryFilePath)) {\n const current = await legacyStoreFor(input.registryFilePath).read();\n const existing = current.processes[input.process];\n if (existing == null) {\n persistLogger.warn(\"registry unregister skipped — process not found\", {\n registryFilePath: input.registryFilePath,\n process: input.process,\n });\n return;\n }\n\n await legacyStoreFor(input.registryFilePath).write({\n processes: {\n [input.process]: {\n ...existing,\n pid: 0,\n lastHeartbeatAt: new Date(0).toISOString(),\n },\n },\n });\n\n persistLogger.info(\"registry process unregistered\", {\n registryFilePath: input.registryFilePath,\n process: input.process,\n });\n return;\n }\n\n const store = shardStoreFor(shardFilePath(input.registryFilePath, input.process));\n const current = await store.read();\n if (current.pid === 0) {\n persistLogger.warn(\"registry unregister skipped — process not found\", {\n registryFilePath: input.registryFilePath,\n process: input.process,\n });\n return;\n }\n\n await store.write({\n pid: 0,\n lastHeartbeatAt: new Date(0).toISOString(),\n });\n\n persistLogger.info(\"registry process unregistered\", {\n registryFilePath: input.registryFilePath,\n process: input.process,\n });\n}\n\nexport async function readLogPersistRegistry(registryFilePath: string): Promise<LogPersistRegistryState> {\n if (isLegacyRegistryFile(registryFilePath)) {\n return legacyStoreFor(registryFilePath).read();\n }\n return readShardedLogPersistRegistry(registryFilePath);\n}\n","import { type LogEntry, LogLevel } from \"./log-manager\";\nimport { DEFAULT_LOG_PERSIST_CONFIG, resolveLogPersistConfig } from \"./log-persist.config\";\nimport type {\n EnableLogPersistOptions,\n LogPersistConfig,\n LogPersistLane,\n LogPersistStats,\n} from \"./log-persist.interface\";\nimport { computeLogBatchIdempotencyKey } from \"./log-persist-batch-id\";\nimport { buildLogListDraft, estimateEntriesBytes, postLogBatch, takeEntriesWithinBytes } from \"./log-persist-flush\";\nimport { registerLogPersistOffer } from \"./log-persist-hook\";\nimport { isLogPersistInternalTopic, patchPersistLoggerScope, persistLogger } from \"./log-persist-logger\";\nimport { heartbeatLogPersistProcess } from \"./log-persist-registry\";\n\nconst FAST_RETRY_INTERVAL_MS = 5_000;\nconst HEARTBEAT_INTERVAL_MS = 30_000;\n\nfunction routeLane(level: LogLevel): LogPersistLane {\n if (level === LogLevel.CRITICAL) {\n return \"fast\";\n }\n if (level === LogLevel.ERROR || level === LogLevel.SUCCESS) {\n return \"medium\";\n }\n return \"slow\";\n}\n\nclass LogPersist {\n private static instance: LogPersist | null = null;\n\n private enabled = false;\n private draining = false;\n private service: string | null = null;\n private processName: string | null = null;\n private registryFilePath: string | null = null;\n private config: LogPersistConfig = DEFAULT_LOG_PERSIST_CONFIG;\n\n private fastQueue: LogEntry[] = [];\n private fastRetryQueue: LogEntry[] = [];\n private mediumQueue: LogEntry[] = [];\n private slowQueue: LogEntry[] = [];\n\n private mediumDebounceTimer: ReturnType<typeof setTimeout> | null = null;\n private slowQueueStartedAt: number | null = null;\n private fastRetryTimer: ReturnType<typeof setTimeout> | null = null;\n private heartbeatTimer: ReturnType<typeof setInterval> | null = null;\n private lastHeartbeatAt = 0;\n\n private laneFlushing: Record<LogPersistLane, boolean> = {\n fast: false,\n medium: false,\n slow: false,\n };\n\n private consecutiveFailures: Record<LogPersistLane, number> = {\n fast: 0,\n medium: 0,\n slow: 0,\n };\n\n private lastFlushAt: Record<LogPersistLane, string | null> = {\n fast: null,\n medium: null,\n slow: null,\n };\n\n private lastError: string | null = null;\n private lastErrorAt: string | null = null;\n private shutdownHookInstalled = false;\n private shutdownPromise: Promise<void> | null = null;\n\n static getInstance(): LogPersist {\n LogPersist.instance ??= new LogPersist();\n return LogPersist.instance;\n }\n\n async enable(options: EnableLogPersistOptions): Promise<void> {\n if (this.enabled) {\n persistLogger.warn(\"log persist core enable skipped — already enabled\", {\n service: this.service,\n process: this.processName,\n });\n return;\n }\n\n this.service = options.service;\n this.processName = options.process;\n this.registryFilePath = options.registryFilePath ?? null;\n this.config = resolveLogPersistConfig(options.config);\n this.draining = false;\n this.shutdownPromise = null;\n this.consecutiveFailures = { fast: 0, medium: 0, slow: 0 };\n this.lastError = null;\n this.lastErrorAt = null;\n this.enabled = true;\n\n patchPersistLoggerScope({\n service: options.service,\n process: options.process,\n });\n\n persistLogger.info(\"log persist core enabled\", {\n service: options.service,\n process: options.process,\n registryFilePath: this.registryFilePath,\n config: this.config,\n pid: process.pid,\n });\n\n registerLogPersistOffer((entry) => {\n this.offer(entry);\n });\n\n if (this.registryFilePath != null) {\n const { registerLogPersistProcess } = await import(\"./log-persist-registry\");\n await registerLogPersistProcess({\n registryFilePath: this.registryFilePath,\n service: options.service,\n process: options.process,\n });\n this.startHeartbeat();\n }\n\n this.installShutdownHook();\n }\n\n async disable(): Promise<void> {\n if (!this.enabled && !this.draining) {\n persistLogger.debug(\"disable skipped — not enabled\");\n return;\n }\n\n persistLogger.info(\"log persist core disabling\", this.queueSnapshot());\n this.cancelMediumDebounce();\n this.stopHeartbeat();\n await this.shutdown();\n persistLogger.info(\"log persist core disabled\");\n }\n\n offer(entry: LogEntry): void {\n if (isLogPersistInternalTopic(entry.topic)) {\n return;\n }\n\n if (!this.enabled || this.draining || this.service == null || this.processName == null) {\n return;\n }\n\n void this.touchRegistryHeartbeat();\n\n const lane = routeLane(entry.level);\n\n if (lane === \"fast\") {\n this.fastQueue.push(entry);\n this.evictFastOverflow();\n void this.flushFast();\n return;\n }\n\n if (lane === \"medium\") {\n this.mediumQueue.push(entry);\n this.evictMediumOverflow();\n this.scheduleMediumFlush();\n return;\n }\n\n this.slowQueue.push(entry);\n if (this.slowQueueStartedAt == null) {\n this.slowQueueStartedAt = Date.now();\n }\n this.evictSlowOverflow();\n this.scheduleSlowFlush();\n }\n\n getStats(): LogPersistStats {\n return {\n enabled: this.enabled,\n draining: this.draining,\n service: this.service,\n process: this.processName,\n queues: {\n fast: this.fastQueue.length,\n fastRetry: this.fastRetryQueue.length,\n medium: this.mediumQueue.length,\n slow: this.slowQueue.length,\n },\n queueBytes: {\n fast: estimateEntriesBytes(this.fastQueue),\n fastRetry: estimateEntriesBytes(this.fastRetryQueue),\n medium: estimateEntriesBytes(this.mediumQueue),\n slow: estimateEntriesBytes(this.slowQueue),\n },\n mediumDebouncePending: this.mediumDebounceTimer != null,\n laneFlushing: { ...this.laneFlushing },\n consecutiveFailures: { ...this.consecutiveFailures },\n config: this.config,\n lastFlushAt: { ...this.lastFlushAt },\n lastError: this.lastError,\n lastErrorAt: this.lastErrorAt,\n };\n }\n\n async shutdown(): Promise<void> {\n if (this.shutdownPromise != null) {\n return this.shutdownPromise;\n }\n\n this.shutdownPromise = this.shutdownInner();\n return this.shutdownPromise;\n }\n\n private async shutdownInner(): Promise<void> {\n if (this.draining) {\n return;\n }\n\n this.draining = true;\n this.enabled = false;\n registerLogPersistOffer(null);\n\n persistLogger.info(\"shutdown flush started\", this.queueSnapshot());\n\n this.cancelMediumDebounce();\n await this.drainQueues(this.config.shutdownDrainTimeoutMs);\n\n if (this.registryFilePath != null && this.processName != null) {\n const { unregisterLogPersistProcess } = await import(\"./log-persist-registry\");\n await unregisterLogPersistProcess({\n registryFilePath: this.registryFilePath,\n process: this.processName,\n });\n }\n\n if (this.hasQueued()) {\n persistLogger.warn(\"shutdown drain incomplete — queued logs dropped\", {\n ...this.queueSnapshot(),\n shutdownDrainTimeoutMs: this.config.shutdownDrainTimeoutMs,\n });\n this.fastQueue = [];\n this.fastRetryQueue = [];\n this.mediumQueue = [];\n this.slowQueue = [];\n this.slowQueueStartedAt = null;\n }\n\n persistLogger.info(\"shutdown flush completed\", this.queueSnapshot());\n }\n\n private hasQueued(): boolean {\n return (\n this.fastQueue.length > 0 ||\n this.fastRetryQueue.length > 0 ||\n this.mediumQueue.length > 0 ||\n this.slowQueue.length > 0\n );\n }\n\n private async drainQueues(timeoutMs: number): Promise<void> {\n const deadline = Date.now() + timeoutMs;\n while (this.hasQueued() && Date.now() < deadline) {\n await this.flushFast();\n await this.flushMedium();\n await this.flushSlow();\n }\n }\n\n private recordLaneError(lane: LogPersistLane, error: unknown): void {\n const message = error instanceof Error ? error.message : String(error);\n this.lastError = message;\n this.lastErrorAt = new Date().toISOString();\n this.consecutiveFailures[lane] += 1;\n }\n\n private recordLaneSuccess(lane: LogPersistLane): void {\n this.lastError = null;\n this.consecutiveFailures[lane] = 0;\n }\n\n private queueSnapshot(): Record<string, unknown> {\n return {\n queues: {\n fast: this.fastQueue.length,\n fastRetry: this.fastRetryQueue.length,\n medium: this.mediumQueue.length,\n slow: this.slowQueue.length,\n },\n queueBytes: {\n fast: estimateEntriesBytes(this.fastQueue),\n fastRetry: estimateEntriesBytes(this.fastRetryQueue),\n medium: estimateEntriesBytes(this.mediumQueue),\n slow: estimateEntriesBytes(this.slowQueue),\n },\n laneFlushing: { ...this.laneFlushing },\n consecutiveFailures: { ...this.consecutiveFailures },\n lastError: this.lastError,\n };\n }\n\n private installShutdownHook(): void {\n if (this.shutdownHookInstalled) {\n return;\n }\n this.shutdownHookInstalled = true;\n\n const handler = (signal: NodeJS.Signals) => {\n persistLogger.info(\"shutdown signal received\", { signal });\n void this.shutdown();\n };\n process.once(\"SIGTERM\", handler);\n process.once(\"SIGINT\", handler);\n }\n\n private startHeartbeat(): void {\n this.stopHeartbeat();\n this.heartbeatTimer = setInterval(() => {\n void this.touchRegistryHeartbeat(true);\n }, HEARTBEAT_INTERVAL_MS);\n this.heartbeatTimer.unref?.();\n }\n\n private stopHeartbeat(): void {\n if (this.heartbeatTimer != null) {\n clearInterval(this.heartbeatTimer);\n this.heartbeatTimer = null;\n }\n }\n\n private async touchRegistryHeartbeat(force = false): Promise<void> {\n if (this.registryFilePath == null || this.processName == null) {\n return;\n }\n const now = Date.now();\n if (!force && now - this.lastHeartbeatAt < HEARTBEAT_INTERVAL_MS) {\n return;\n }\n this.lastHeartbeatAt = now;\n await heartbeatLogPersistProcess({\n registryFilePath: this.registryFilePath,\n process: this.processName,\n });\n }\n\n private scheduleMediumFlush(): void {\n const { debounceMs, maxEntries, maxBytes } = this.config.medium;\n const queueBytes = estimateEntriesBytes(this.mediumQueue);\n if (this.mediumQueue.length >= maxEntries || queueBytes >= maxBytes) {\n persistLogger.warn(\"medium flush scheduled — threshold\", {\n reason: this.mediumQueue.length >= maxEntries ? \"maxEntries\" : \"maxBytes\",\n queueLength: this.mediumQueue.length,\n maxEntries,\n queueBytes,\n maxBytes,\n });\n this.cancelMediumDebounce();\n void this.flushMedium();\n return;\n }\n\n if (this.mediumDebounceTimer == null && this.mediumQueue.length > 0) {\n persistLogger.debug(\"medium flush debounce scheduled\", {\n debounceMs,\n queueLength: this.mediumQueue.length,\n queueBytes,\n });\n this.mediumDebounceTimer = setTimeout(() => {\n this.mediumDebounceTimer = null;\n persistLogger.debug(\"medium flush debounce fired\");\n void this.flushMedium();\n }, debounceMs);\n this.mediumDebounceTimer.unref?.();\n }\n }\n\n private cancelMediumDebounce(): void {\n if (this.mediumDebounceTimer != null) {\n clearTimeout(this.mediumDebounceTimer);\n this.mediumDebounceTimer = null;\n persistLogger.debug(\"medium flush debounce cancelled\");\n }\n }\n\n private scheduleSlowFlush(): void {\n const { maxEntries, maxBytes, maxAgeMs } = this.config.slow;\n const queueBytes = estimateEntriesBytes(this.slowQueue);\n const ageMs = this.slowQueueStartedAt != null ? Date.now() - this.slowQueueStartedAt : 0;\n if (this.slowQueue.length >= maxEntries || queueBytes >= maxBytes || ageMs >= maxAgeMs) {\n persistLogger.debug(\"slow flush scheduled — threshold\", {\n reason:\n this.slowQueue.length >= maxEntries\n ? \"maxEntries\"\n : queueBytes >= maxBytes\n ? \"maxBytes\"\n : \"maxAgeMs\",\n queueLength: this.slowQueue.length,\n maxEntries,\n queueBytes,\n maxBytes,\n ageMs,\n maxAgeMs,\n });\n void this.flushSlow();\n }\n }\n\n private evictFastOverflow(): void {\n const { maxBufferEntries } = this.config.fast;\n let evicted = 0;\n while (this.fastQueue.length + this.fastRetryQueue.length > maxBufferEntries) {\n const removed = this.fastQueue.length > 0 ? this.fastQueue.shift() : this.fastRetryQueue.shift();\n evicted += 1;\n persistLogger.warn(\"fast queue overflow — evicted entry\", {\n evictedLevel: removed?.level,\n evictedTopic: removed?.topic,\n fromRetryQueue: this.fastQueue.length === 0,\n maxBufferEntries,\n });\n }\n if (evicted > 0) {\n persistLogger.warn(\"fast queue overflow summary\", { evicted, maxBufferEntries });\n }\n }\n\n private evictMediumOverflow(): void {\n const { maxBufferEntries } = this.config.medium;\n let evicted = 0;\n while (this.mediumQueue.length > maxBufferEntries) {\n const successIndex = this.mediumQueue.findIndex((entry) => entry.level === LogLevel.SUCCESS);\n const removed = successIndex >= 0 ? this.mediumQueue.splice(successIndex, 1)[0] : this.mediumQueue.shift();\n evicted += 1;\n persistLogger.warn(\"medium queue overflow — evicted entry\", {\n evictedLevel: removed?.level,\n evictedTopic: removed?.topic,\n queueLength: this.mediumQueue.length,\n maxBufferEntries,\n });\n }\n if (evicted > 0) {\n persistLogger.warn(\"medium queue overflow summary\", {\n evicted,\n queueLength: this.mediumQueue.length,\n maxBufferEntries,\n });\n }\n }\n\n private evictSlowOverflow(): void {\n const { maxBufferEntries } = this.config.slow;\n let evicted = 0;\n while (this.slowQueue.length > maxBufferEntries) {\n const debugIndex = this.slowQueue.findIndex((entry) => entry.level === LogLevel.DEBUG);\n const removed = debugIndex >= 0 ? this.slowQueue.splice(debugIndex, 1)[0] : this.slowQueue.shift();\n evicted += 1;\n persistLogger.warn(\"slow queue overflow — evicted entry\", {\n evictedLevel: removed?.level,\n evictedTopic: removed?.topic,\n queueLength: this.slowQueue.length,\n maxBufferEntries,\n });\n }\n if (evicted > 0) {\n persistLogger.warn(\"slow queue overflow summary\", {\n evicted,\n queueLength: this.slowQueue.length,\n maxBufferEntries,\n });\n }\n if (this.slowQueue.length === 0) {\n this.slowQueueStartedAt = null;\n }\n }\n\n private async flushFast(): Promise<void> {\n if (this.laneFlushing.fast) {\n persistLogger.debug(\"fast flush skipped — already flushing\");\n return;\n }\n if (this.service == null || this.processName == null) {\n return;\n }\n\n this.laneFlushing.fast = true;\n try {\n while (this.fastQueue.length > 0 || this.fastRetryQueue.length > 0) {\n const fromRetry = this.fastQueue.length === 0;\n const entry = this.fastQueue.shift() ?? this.fastRetryQueue.shift();\n if (entry == null) {\n break;\n }\n\n const idempotencyKey = computeLogBatchIdempotencyKey({\n service: this.service,\n process: this.processName,\n lane: \"fast\",\n entries: [entry],\n });\n\n try {\n const draft = buildLogListDraft({\n service: this.service,\n process: this.processName,\n lane: \"fast\",\n idempotencyKey,\n entries: [entry],\n });\n persistLogger.debug(\"fast flush posting batch\", {\n idempotencyKey,\n fromRetry,\n level: entry.level,\n topic: entry.topic,\n });\n await postLogBatch(draft, this.config.postTimeoutMs);\n this.lastFlushAt.fast = new Date().toISOString();\n this.recordLaneSuccess(\"fast\");\n persistLogger.info(\"fast lane flushed\", {\n idempotencyKey,\n level: entry.level,\n topic: entry.topic,\n fastRetryRemaining: this.fastRetryQueue.length,\n });\n } catch (error) {\n this.recordLaneError(\"fast\", error);\n this.fastRetryQueue.push(entry);\n persistLogger.error(\"fast flush failed — queued for retry\", {\n idempotencyKey,\n error: this.lastError,\n retryInMs: FAST_RETRY_INTERVAL_MS,\n fastRetryQueue: this.fastRetryQueue.length,\n });\n this.scheduleFastRetry();\n break;\n }\n }\n } finally {\n this.laneFlushing.fast = false;\n }\n }\n\n private scheduleFastRetry(): void {\n if (this.fastRetryTimer != null) {\n return;\n }\n persistLogger.warn(\"fast flush retry scheduled\", { retryInMs: FAST_RETRY_INTERVAL_MS });\n this.fastRetryTimer = setTimeout(() => {\n this.fastRetryTimer = null;\n persistLogger.debug(\"fast flush retry timer fired\");\n void this.flushFast();\n }, FAST_RETRY_INTERVAL_MS);\n this.fastRetryTimer.unref?.();\n }\n\n private async flushMedium(): Promise<void> {\n if (this.laneFlushing.medium) {\n persistLogger.debug(\"medium flush skipped — already flushing\");\n return;\n }\n if (this.mediumQueue.length === 0) {\n return;\n }\n if (this.service == null || this.processName == null) {\n return;\n }\n\n this.laneFlushing.medium = true;\n try {\n while (this.mediumQueue.length > 0) {\n const batch = takeEntriesWithinBytes(this.mediumQueue, this.config.medium.maxBytes);\n if (batch.length === 0) {\n break;\n }\n\n const idempotencyKey = computeLogBatchIdempotencyKey({\n service: this.service,\n process: this.processName,\n lane: \"medium\",\n entries: batch,\n });\n const batchBytes = estimateEntriesBytes(batch);\n\n try {\n persistLogger.debug(\"medium flush posting batch\", {\n idempotencyKey,\n batchSize: batch.length,\n batchBytes,\n queueRemaining: this.mediumQueue.length,\n });\n const draft = buildLogListDraft({\n service: this.service,\n process: this.processName,\n lane: \"medium\",\n idempotencyKey,\n entries: batch,\n });\n await postLogBatch(draft, this.config.postTimeoutMs);\n this.mediumQueue.splice(0, batch.length);\n this.lastFlushAt.medium = new Date().toISOString();\n this.recordLaneSuccess(\"medium\");\n persistLogger.info(\"medium lane flushed\", {\n idempotencyKey,\n batchSize: batch.length,\n batchBytes,\n queueRemaining: this.mediumQueue.length,\n });\n } catch (error) {\n this.recordLaneError(\"medium\", error);\n persistLogger.error(\"medium flush failed — entries retained\", {\n idempotencyKey,\n batchSize: batch.length,\n batchBytes,\n error: this.lastError,\n queueRemaining: this.mediumQueue.length,\n });\n this.scheduleMediumFlush();\n break;\n }\n }\n } finally {\n this.laneFlushing.medium = false;\n }\n\n if (this.mediumQueue.length > 0 && !this.laneFlushing.medium) {\n this.scheduleMediumFlush();\n }\n }\n\n private async flushSlow(): Promise<void> {\n if (this.laneFlushing.slow) {\n persistLogger.debug(\"slow flush skipped — already flushing\");\n return;\n }\n if (this.slowQueue.length === 0) {\n return;\n }\n if (this.service == null || this.processName == null) {\n return;\n }\n\n this.laneFlushing.slow = true;\n try {\n while (this.slowQueue.length > 0) {\n const batch = takeEntriesWithinBytes(this.slowQueue, this.config.slow.maxBytes);\n if (batch.length === 0) {\n break;\n }\n\n const idempotencyKey = computeLogBatchIdempotencyKey({\n service: this.service,\n process: this.processName,\n lane: \"slow\",\n entries: batch,\n });\n const batchBytes = estimateEntriesBytes(batch);\n\n try {\n persistLogger.debug(\"slow flush posting batch\", {\n idempotencyKey,\n batchSize: batch.length,\n batchBytes,\n queueRemaining: this.slowQueue.length,\n });\n const draft = buildLogListDraft({\n service: this.service,\n process: this.processName,\n lane: \"slow\",\n idempotencyKey,\n entries: batch,\n });\n await postLogBatch(draft, this.config.postTimeoutMs);\n this.slowQueue.splice(0, batch.length);\n this.lastFlushAt.slow = new Date().toISOString();\n this.recordLaneSuccess(\"slow\");\n persistLogger.info(\"slow lane flushed\", {\n idempotencyKey,\n batchSize: batch.length,\n batchBytes,\n queueRemaining: this.slowQueue.length,\n });\n } catch (error) {\n this.recordLaneError(\"slow\", error);\n persistLogger.error(\"slow flush failed — entries retained\", {\n idempotencyKey,\n batchSize: batch.length,\n batchBytes,\n error: this.lastError,\n queueRemaining: this.slowQueue.length,\n });\n this.scheduleSlowFlush();\n break;\n }\n }\n\n if (this.slowQueue.length === 0) {\n this.slowQueueStartedAt = null;\n }\n } finally {\n this.laneFlushing.slow = false;\n }\n\n if (this.slowQueue.length > 0 && !this.laneFlushing.slow) {\n this.scheduleSlowFlush();\n }\n }\n}\n\nexport { LogPersist };\n","import { resolve } from \"node:path\";\nimport { envBool } from \"../../node/env/env-parsers\";\nimport { readEnv, requireEnv } from \"../../node/env/require-env\";\nimport { pollUntil } from \"../../node/readiness\";\nimport { createLogger } from \"./create-logger\";\nimport { LogPersist } from \"./log-persist\";\nimport {\n logPersistConfigFromEnv,\n logPersistEnabledFromEnv,\n logPersistProcessFromEnv,\n logPersistRegistryDirFromEnv,\n logPersistServiceFromEnv,\n resolveLogPersistConfig,\n} from \"./log-persist.config\";\nimport type {\n EnableLogPersistOptions,\n EnsureLogPersistFromEnvOptions,\n LogPersistReadySnapshot,\n LogPersistStats,\n WaitForLogPersistReadyOptions,\n} from \"./log-persist.interface\";\nimport { registerLogPersistOffer } from \"./log-persist-hook\";\nimport { LOG_PERSIST_TOPIC, persistLogger } from \"./log-persist-logger\";\nimport { defaultLogPersistRegistryPath, readLogPersistRegistry } from \"./log-persist-registry\";\n\nexport { logPersistEnabledFromEnv };\n\nfunction resolveRegistryFilePath(explicit?: string): string {\n if (explicit != null && explicit.trim() !== \"\") {\n return resolve(explicit);\n }\n const dir = logPersistRegistryDirFromEnv();\n if (dir == null) {\n throw new Error(\n \"[LogPersist] registry path required: set registryFilePath option or LOG_PERSIST_REGISTRY_DIR / RUNTIME_DATA_DIR\",\n );\n }\n return defaultLogPersistRegistryPath(resolve(dir));\n}\n\nexport async function enableLogPersist(options: EnableLogPersistOptions): Promise<void> {\n const registryFilePath = options.registryFilePath != null ? resolve(options.registryFilePath) : undefined;\n const resolvedRegistry = registryFilePath ?? resolveRegistryFilePath();\n\n const envConfig = logPersistConfigFromEnv();\n await LogPersist.getInstance().enable({\n ...options,\n registryFilePath: resolvedRegistry,\n config: resolveLogPersistConfig({\n fast: { ...envConfig.fast, ...options.config?.fast },\n medium: { ...envConfig.medium, ...options.config?.medium },\n slow: { ...envConfig.slow, ...options.config?.slow },\n postTimeoutMs: options.config?.postTimeoutMs ?? envConfig.postTimeoutMs,\n shutdownDrainTimeoutMs: options.config?.shutdownDrainTimeoutMs ?? envConfig.shutdownDrainTimeoutMs,\n }),\n });\n}\n\nexport async function disableLogPersist(): Promise<void> {\n await LogPersist.getInstance().disable();\n}\n\nexport function getLogPersistStats(): LogPersistStats {\n return LogPersist.getInstance().getStats();\n}\n\n/**\n * Enable log persistence when LOG_PERSIST_ENABLED=true.\n * `process` / `service` can be passed explicitly or via LOG_PERSIST_PROCESS / LOG_PERSIST_SERVICE.\n */\nexport async function ensureLogPersistFromEnv(options: EnsureLogPersistFromEnvOptions = {}): Promise<boolean> {\n if (!logPersistEnabledFromEnv()) {\n registerLogPersistOffer(null);\n return false;\n }\n\n const service = options.service ?? logPersistServiceFromEnv();\n const processName = options.process ?? logPersistProcessFromEnv();\n if (service == null || service === \"\") {\n throw new Error(\"[LogPersist] LOG_PERSIST_SERVICE is required when LOG_PERSIST_ENABLED=true\");\n }\n if (processName == null || processName === \"\") {\n throw new Error(\n \"[LogPersist] LOG_PERSIST_PROCESS is required when LOG_PERSIST_ENABLED=true (or pass process option)\",\n );\n }\n\n const registryFilePath =\n options.registryFilePath != null ? resolve(options.registryFilePath) : resolveRegistryFilePath();\n\n await enableLogPersist({\n service,\n process: processName,\n registryFilePath,\n config: options.config,\n });\n\n const lifecycleLogger = createLogger({ module: \"log-persist\" });\n lifecycleLogger.info(\"log persist enabled from env\", {\n topic: LOG_PERSIST_TOPIC,\n data: { service, process: processName, registryFilePath },\n });\n\n return true;\n}\n\n/**\n * Preload guard: when persistence is enabled, required env must be present before app code runs.\n */\nexport function validateLogPersistPreloadEnv(env: NodeJS.ProcessEnv = process.env): void {\n if (!envBool(\"LOG_PERSIST_ENABLED\", false, env)) {\n return;\n }\n\n const missing: string[] = [];\n if (readEnv(\"LOG_PERSIST_SERVICE\", env) == null) {\n missing.push(\"LOG_PERSIST_SERVICE\");\n }\n const registryDir = logPersistRegistryDirFromEnv(env);\n if (registryDir == null) {\n missing.push(\"LOG_PERSIST_REGISTRY_DIR or RUNTIME_DATA_DIR\");\n }\n\n if (missing.length > 0) {\n throw new Error(`[LogPersist] preload env incomplete: ${missing.join(\", \")}`);\n }\n}\n\nfunction evaluateLogPersistReady(\n state: Awaited<ReturnType<typeof readLogPersistRegistry>>,\n expectedProcesses: string[],\n staleMs: number,\n now: number,\n): LogPersistReadySnapshot {\n const missing: string[] = [];\n const stale: string[] = [];\n const registered: string[] = [];\n\n for (const processName of expectedProcesses) {\n const record = state.processes[processName];\n if (record == null) {\n missing.push(processName);\n continue;\n }\n\n const heartbeatAt = Date.parse(record.lastHeartbeatAt);\n if (!Number.isFinite(heartbeatAt) || now - heartbeatAt > staleMs) {\n stale.push(processName);\n continue;\n }\n\n registered.push(processName);\n }\n\n return {\n ok: missing.length === 0 && stale.length === 0,\n missing,\n stale,\n registered,\n };\n}\n\n/**\n * Wait until every expected process has registered in the shared registry with a fresh heartbeat.\n * Call from the service main process after spawning children.\n */\nexport async function waitForLogPersistReady(options: WaitForLogPersistReadyOptions): Promise<LogPersistReadySnapshot> {\n const timeoutMs = options.timeoutMs ?? 60_000;\n const pollIntervalMs = options.pollIntervalMs ?? 500;\n const staleMs = options.staleMs ?? 90_000;\n\n let last: LogPersistReadySnapshot = {\n ok: false,\n missing: [...options.expectedProcesses],\n stale: [],\n registered: [],\n };\n\n try {\n await pollUntil({\n intervalMs: pollIntervalMs,\n timeoutMs,\n until: async () => {\n const state = await readLogPersistRegistry(options.registryFilePath);\n if (state.service !== options.service) {\n last = {\n ok: false,\n missing: options.expectedProcesses,\n stale: [],\n registered: [],\n };\n return false;\n }\n last = evaluateLogPersistReady(state, options.expectedProcesses, staleMs, Date.now());\n return last.ok;\n },\n });\n } catch {\n persistLogger.warn(\"waitForLogPersistReady timed out\", {\n timeoutMs,\n expectedProcesses: options.expectedProcesses,\n ...last,\n });\n }\n\n return last;\n}\n\nexport async function snapshotLogPersistReady(options: {\n registryFilePath: string;\n service: string;\n expectedProcesses: string[];\n staleMs?: number;\n}): Promise<LogPersistReadySnapshot> {\n const state = await readLogPersistRegistry(options.registryFilePath);\n return evaluateLogPersistReady(state, options.expectedProcesses, options.staleMs ?? 90_000, Date.now());\n}\n\nexport function resolveLogPersistRegistryPath(registryDir?: string): string {\n const dir = registryDir ?? logPersistRegistryDirFromEnv();\n if (dir == null) {\n requireEnv(\"LOG_PERSIST_REGISTRY_DIR\");\n }\n return defaultLogPersistRegistryPath(resolve(dir ?? \"\"));\n}\n"],"names":[],"mappings":";;;;;;;;AAAM,SAAU,OAAO,CAAC,IAAY,EAAE,GAAA,GAAyB,OAAO,CAAC,GAAG,EAAA;IACtE,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE;IAC/B,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,EAAE;AAC/B,QAAA,OAAO,SAAS;IACpB;AACA,IAAA,OAAO,KAAK;AAChB;AAEM,SAAU,UAAU,CAAC,IAAY,EAAE,GAAA,GAAyB,OAAO,CAAC,GAAG,EAAA;IACzE,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;AAChC,IAAA,IAAI,KAAK,IAAI,IAAI,EAAE;AACf,QAAA,MAAM,IAAI,KAAK,CAAC,0CAA0C,IAAI,CAAA,CAAE,CAAC;IACrE;AACA,IAAA,OAAO,KAAK;AAChB;;SCNgB,MAAM,CAAC,IAAY,EAAE,YAAoB,EAAE,OAAuB,EAAA;IAC9E,MAAM,GAAG,GAAG,OAAO,EAAE,GAAG,IAAI,OAAO,CAAC,GAAG;IACvC,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;AAC9B,IAAA,IAAI,GAAG,IAAI,IAAI,EAAE;AACb,QAAA,OAAO,YAAY;IACvB;AAEA,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC;IACzB,I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