target-supabase-sdk 0.2.13 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +1 -1
- package/dist/chunks/{enable-DqnfLPsQ.js → enable-C7lFooTG.js} +2 -2
- package/dist/chunks/{enable-DqnfLPsQ.js.map → enable-C7lFooTG.js.map} +1 -1
- package/dist/chunks/{task-queue-6X3aglJh.js → task-queue-qSnsfiIg.js} +5 -3
- package/dist/chunks/task-queue-qSnsfiIg.js.map +1 -0
- package/dist/node/env/index.d.ts +1 -1
- package/dist/node/env/index.d.ts.map +1 -1
- package/dist/node/node-runtime.base.d.ts +14 -1
- package/dist/node/node-runtime.base.d.ts.map +1 -1
- package/dist/node/node.api.d.ts.map +1 -1
- package/dist/node/node.constant.d.ts +3 -0
- package/dist/node/node.constant.d.ts.map +1 -0
- package/dist/node/node.utils.d.ts +0 -2
- package/dist/node/node.utils.d.ts.map +1 -1
- package/dist/node/readiness/index.d.ts +2 -0
- package/dist/node/readiness/index.d.ts.map +1 -1
- package/dist/node/{service-guard → readiness}/run-readiness-gate.d.ts +1 -1
- package/dist/node/readiness/run-readiness-gate.d.ts.map +1 -0
- package/dist/node/readiness/service-ready-gate.d.ts.map +1 -1
- package/dist/node/runtime-state/create-service-runtime-state-store.d.ts.map +1 -1
- package/dist/node/runtime-state/service-runtime-state.types.d.ts +16 -0
- package/dist/node/runtime-state/service-runtime-state.types.d.ts.map +1 -1
- package/dist/node/service-guard/index.d.ts +4 -4
- package/dist/node/service-guard/index.d.ts.map +1 -1
- package/dist/node/service-guard/register-service-guard-runner.d.ts +1 -2
- package/dist/node/service-guard/register-service-guard-runner.d.ts.map +1 -1
- package/dist/node/service-guard/registry-slot-guard-step.d.ts.map +1 -0
- package/dist/node/service-guard/run-service-guard-tick.d.ts.map +1 -1
- package/dist/node/service-guard/service-guard-node.d.ts +25 -2
- package/dist/node/service-guard/service-guard-node.d.ts.map +1 -1
- package/dist/node/service-guard/service-guard.interface.d.ts +25 -10
- package/dist/node/service-guard/service-guard.interface.d.ts.map +1 -1
- package/dist/node/service-host/claim-registry-slot.d.ts +15 -0
- package/dist/node/service-host/claim-registry-slot.d.ts.map +1 -0
- package/dist/node/service-host/create-l3-child-launcher.d.ts +38 -0
- package/dist/node/service-host/create-l3-child-launcher.d.ts.map +1 -0
- package/dist/node/service-host/index.d.ts +2 -5
- package/dist/node/service-host/index.d.ts.map +1 -1
- package/dist/node/service-host/service-host.d.ts +3 -3
- package/dist/node/service-host/service-host.d.ts.map +1 -1
- package/dist/node/service-host/single-process-service.d.ts +3 -3
- package/dist/node/service-host/single-process-service.d.ts.map +1 -1
- package/dist/node.d.ts +8 -6
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +627 -264
- package/dist/node.js.map +1 -1
- package/dist/preload.js +1 -1
- package/package.json +1 -1
- package/src/node/env/index.ts +0 -4
- package/src/node/node-runtime.base.ts +33 -5
- package/src/node/node.api.ts +1 -1
- package/src/node/node.constant.ts +2 -0
- package/src/node/node.utils.ts +2 -2
- package/src/node/readiness/index.ts +2 -0
- package/src/node/{service-guard → readiness}/run-readiness-gate.ts +2 -2
- package/src/node/readiness/service-ready-gate.ts +27 -23
- package/src/node/runtime-state/create-service-runtime-state-store.ts +11 -0
- package/src/node/runtime-state/service-runtime-state.types.ts +12 -0
- package/src/node/service-guard/index.ts +7 -8
- package/src/node/service-guard/register-service-guard-runner.ts +0 -2
- package/src/node/service-guard/run-service-guard-tick.ts +5 -2
- package/src/node/service-guard/service-guard-node.ts +229 -6
- package/src/node/service-guard/service-guard.interface.ts +35 -10
- package/src/node/service-host/claim-registry-slot.ts +33 -0
- package/src/node/service-host/create-l3-child-launcher.ts +157 -0
- package/src/node/service-host/index.ts +5 -24
- package/src/node/service-host/service-host.ts +11 -18
- package/src/node/service-host/single-process-service.ts +10 -20
- package/src/node.ts +21 -18
- package/dist/chunks/task-queue-6X3aglJh.js.map +0 -1
- package/dist/node/service-guard/run-readiness-gate.d.ts.map +0 -1
- package/dist/node/service-host/registry-slot-guard-step.d.ts.map +0 -1
- /package/dist/node/{service-host → service-guard}/registry-slot-guard-step.d.ts +0 -0
- /package/src/node/{service-host → service-guard}/registry-slot-guard-step.ts +0 -0
package/dist/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { B as BaseValidator, C as CREATE_TARGET_ALREADY_EXISTS_MESSAGE, a as CategoryList, L as LOG_BATCH_LOADER_KEY, b as LOG_MIN_LEVEL_ENV_KEY, c as LOG_PERSIST_LOADER_KEY, d as LogLevel, M as MAX_POLL_TARGET_LIST_SIZE, e as MAX_TARGET_LIST_PAGE_SIZE, O as OPTIMISTIC_LOCK_ERROR_CODE, f as OPTIMISTIC_LOCK_FAILED_MESSAGE, P as PostListValidator, S as StatusCode, U as UPDATE_TARGET_NOT_FOUND_MESSAGE, g as createLogger, h as createTarget, i as deleteTarget, j as formatZodError, k as generateResponse, l as getPossibleTarget, m as getTarget, n as getTargetList, o as getTargetTotalCount, p as handleSupabaseError, q as isCreateTargetAlreadyExistsError, r as isDevEnvironment, s as isOptimisticLockError, t as isOptimisticLockResponse, u as logDev, v as logDevGroup, w as logManager, x as logMinLevelFromEnv, y as patchTarget, z as pollTargetList, A as postListCreate, D as postLogListCreate, E as postTarget, F as postTargetPayloadSchema, G as queryFilterSchema, H as resolveLogMinLevel, I as safeParseWithSchema, J as scanTargetList, K as supabase, N as targetDraftSchema, Q as updateTarget, R as updateTargetDetails, T as validateWith, V as validateWithSchema } from './chunks/list.api-BzbTJBsM.js';
|
|
2
|
-
export { A as ApiMethod, C as CategoryConfig, a as CategoryExtraction, b as CategoryLink, c as CategoryNode, d as CategoryParcel, e as CategoryRepo, f as CategoryService, g as CategoryTask, D as DEFAULT_SYSTEM_REGISTRY_SEED_SLOTS, E as EMPTY_REGISTRY_SLOT_RUNTIME_STATE, L as LINK_MANIFEST_VERSION, h as LIST_MANIFEST_VERSION, N as NodeStatus, P as POST_TASK_DEFAULT_MAX_ATTEMPTS, i as ParcelManager, j as PostLinkValidator, R as ResultCode, S as ServiceLifecycleStatus, k as ServiceRegistryError, l as ServiceSlotStatus, T as TARGET_SYSTEM_REGISTRY_KEY, m as TASK_REPO_USAGE, n as TaskStatus, o as TaskStatusAction, p as apiDetailsSchema, q as appendSystemRegistrySlots, r as assertRegistrySlotAvailable, s as assertRegistrySlotOwner, t as buildEmptyServiceSlots, u as buildLinkTargetDraft, v as buildListTargetDraft, w as buildSystemRegistryConfigDetails, x as claimServiceRegistrySlot, y as classifyNetworkError, z as countTasksByType, B as createActiveServiceLifecycle, F as createClaimedRegistrySlotRuntimeState, G as createStorageProviderRegistry, H as createUploadTracker, I as decodeLogBatch, J as decodeLogBatchList, K as defaultL3ServiceDetails, M as deleteParcel, O as deleteParcelSchema, Q as evaluateBusyNodeLiveness, U as fetchBinaryWithRetry, V as fetchWithRetry, W as fieldDefinitionSchema, X as flattenLogBatch, Y as flattenLogBatches, Z as formatNetworkError, _ as getApi, $ as getApiSchema, a0 as getConfig, a1 as getConfigSchema, a2 as getExtraction, a3 as getExtractionSchema, a4 as getParcel, a5 as getParcelSchema, a6 as getScanRemoteRepoValues, a7 as getScanRemoteRepoValuesSchema, a8 as getService, a9 as getServiceSchema, aa as getTargetSystemRegistry, ab as getValueAtPath, ac as installChunkFetchRegistry, ad as isHttpUrl, ae as isLocalFilesystemPath, af as isLogBatchList, ag as isLogEntry, ah as isOpaqueChunkUrl, ai as isRetryableHttpStatus, aj as linkTargetDraftBuildInputSchema, ak as parcelDetailsSchema, al as parseLogBatchMeta, am as parseProviderPrefixedUrl, an as parseServiceSlot, ao as parseServiceSlots, ap as patchChangeNodeStatus, aq as patchChangeNodeStatusSchema, ar as patchChangeTaskStatus, as as patchChangeTaskStatusSchema, at as patchClaimTask, au as patchClaimTaskSchema, av as patchExtractionObjects, aw as patchExtractionObjectsSchema, ax as patchNodeHeartBeat, ay as patchNodeHeartBeatSchema, az as patchServiceRuntime, aA as patchStopNode, aB as patchStopNodeSchema, aC as patchTaskProgress, aD as patchTaskProgressSchema, aE as postApi, aF as postApiSchema, aG as postExtraction, aH as postExtractionSchema, aI as postLinkCreate, aJ as postParcel, aK as postParcelSchema, aL as postRegisterNode, aM as postRegisterNodeSchema, aN as postService, aO as postServiceInstance, aP as postServiceSchema, aQ as postSystemRegistryConfig, aR as postSystemRegistryConfigSchema, aS as postTask, aT as postTaskSchema, aU as postTaskWithRetry, aV as publishParcel, aW as registerProviderChunkResolver, aX as registerService, aY as registerServiceAtStartup, aZ as registrySlotRuntimePatchFromGuardResult, a_ as releaseSystemRegistrySlots, a$ as releaseSystemRegistrySlotsByServiceId, b0 as requestHasBody, b1 as resetSystemRegistryConfig, b2 as resetSystemRegistryConfigSchema, b3 as resolveActiveRegistryServiceId, b4 as resolveFetchUrl, b5 as restoreParcel, b6 as restoreParcelById, b7 as runRegistrySlotGuardCheck, b8 as sanitizeFileName, b9 as sanitizeParcelFileName, ba as scanExtractionList, bb as scanExtractionListSchema, bc as schemaDefinitionSchema, bd as serviceDetailsSchema, be as serviceLifecycleSchema, bf as serviceNodeSnapshotSchema, bg as serviceRuntimeSchema, bh as sha256Hex, bi as summarizeTaskQueue, bj as systemRegistrySeedSlotSchema, bk as unregisterService, bl as unregisterServiceAtShutdown } from './chunks/task-queue-
|
|
2
|
+
export { A as ApiMethod, C as CategoryConfig, a as CategoryExtraction, b as CategoryLink, c as CategoryNode, d as CategoryParcel, e as CategoryRepo, f as CategoryService, g as CategoryTask, D as DEFAULT_SYSTEM_REGISTRY_SEED_SLOTS, E as EMPTY_REGISTRY_SLOT_RUNTIME_STATE, L as LINK_MANIFEST_VERSION, h as LIST_MANIFEST_VERSION, N as NodeStatus, P as POST_TASK_DEFAULT_MAX_ATTEMPTS, i as ParcelManager, j as PostLinkValidator, R as ResultCode, S as ServiceLifecycleStatus, k as ServiceRegistryError, l as ServiceSlotStatus, T as TARGET_SYSTEM_REGISTRY_KEY, m as TASK_REPO_USAGE, n as TaskStatus, o as TaskStatusAction, p as apiDetailsSchema, q as appendSystemRegistrySlots, r as assertRegistrySlotAvailable, s as assertRegistrySlotOwner, t as buildEmptyServiceSlots, u as buildLinkTargetDraft, v as buildListTargetDraft, w as buildSystemRegistryConfigDetails, x as claimServiceRegistrySlot, y as classifyNetworkError, z as countTasksByType, B as createActiveServiceLifecycle, F as createClaimedRegistrySlotRuntimeState, G as createStorageProviderRegistry, H as createUploadTracker, I as decodeLogBatch, J as decodeLogBatchList, K as defaultL3ServiceDetails, M as deleteParcel, O as deleteParcelSchema, Q as evaluateBusyNodeLiveness, U as fetchBinaryWithRetry, V as fetchWithRetry, W as fieldDefinitionSchema, X as flattenLogBatch, Y as flattenLogBatches, Z as formatNetworkError, _ as getApi, $ as getApiSchema, a0 as getConfig, a1 as getConfigSchema, a2 as getExtraction, a3 as getExtractionSchema, a4 as getParcel, a5 as getParcelSchema, a6 as getScanRemoteRepoValues, a7 as getScanRemoteRepoValuesSchema, a8 as getService, a9 as getServiceSchema, aa as getTargetSystemRegistry, ab as getValueAtPath, ac as installChunkFetchRegistry, ad as isHttpUrl, ae as isLocalFilesystemPath, af as isLogBatchList, ag as isLogEntry, ah as isOpaqueChunkUrl, ai as isRetryableHttpStatus, aj as linkTargetDraftBuildInputSchema, ak as parcelDetailsSchema, al as parseLogBatchMeta, am as parseProviderPrefixedUrl, an as parseServiceSlot, ao as parseServiceSlots, ap as patchChangeNodeStatus, aq as patchChangeNodeStatusSchema, ar as patchChangeTaskStatus, as as patchChangeTaskStatusSchema, at as patchClaimTask, au as patchClaimTaskSchema, av as patchExtractionObjects, aw as patchExtractionObjectsSchema, ax as patchNodeHeartBeat, ay as patchNodeHeartBeatSchema, az as patchServiceRuntime, aA as patchStopNode, aB as patchStopNodeSchema, aC as patchTaskProgress, aD as patchTaskProgressSchema, aE as postApi, aF as postApiSchema, aG as postExtraction, aH as postExtractionSchema, aI as postLinkCreate, aJ as postParcel, aK as postParcelSchema, aL as postRegisterNode, aM as postRegisterNodeSchema, aN as postService, aO as postServiceInstance, aP as postServiceSchema, aQ as postSystemRegistryConfig, aR as postSystemRegistryConfigSchema, aS as postTask, aT as postTaskSchema, aU as postTaskWithRetry, aV as publishParcel, aW as registerProviderChunkResolver, aX as registerService, aY as registerServiceAtStartup, aZ as registrySlotRuntimePatchFromGuardResult, a_ as releaseSystemRegistrySlots, a$ as releaseSystemRegistrySlotsByServiceId, b0 as requestHasBody, b1 as resetSystemRegistryConfig, b2 as resetSystemRegistryConfigSchema, b3 as resolveActiveRegistryServiceId, b4 as resolveFetchUrl, b5 as restoreParcel, b6 as restoreParcelById, b7 as runRegistrySlotGuardCheck, b8 as sanitizeFileName, b9 as sanitizeParcelFileName, ba as scanExtractionList, bb as scanExtractionListSchema, bc as schemaDefinitionSchema, bd as serviceDetailsSchema, be as serviceLifecycleSchema, bf as serviceNodeSnapshotSchema, bg as serviceRuntimeSchema, bh as sha256Hex, bi as summarizeTaskQueue, bj as systemRegistrySeedSlotSchema, bk as unregisterService, bl as unregisterServiceAtShutdown } from './chunks/task-queue-qSnsfiIg.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import 'lodash-es';
|
|
5
5
|
import '@supabase/supabase-js';
|
|
@@ -870,5 +870,5 @@ function validateLogSpoolPreloadEnv(env = process.env) {
|
|
|
870
870
|
}
|
|
871
871
|
}
|
|
872
872
|
|
|
873
|
-
export { envMs as A, envNumber as B, CLI_PROD_FLAG as C, envPort as D, envProfileFromProcess as E,
|
|
874
|
-
//# sourceMappingURL=enable-
|
|
873
|
+
export { envMs as A, envNumber as B, CLI_PROD_FLAG as C, envPort as D, envProfileFromProcess as E, resolveDefaultEnvFiles as F, resolveProjectRootFromModule as G, LOG_SPOOL_SERVICE_ID_ENV as L, SERVICE_ENV_PROFILE_ENV_KEY as S, logSpoolEnabledFromEnv as a, readEnv as b, requireEnv as c, resolveLogSpoolSpawnEnvForLabel as d, resolveLogSpoolConfig as e, resolveLogSpoolRoot as f, resolveAllLogSpoolProcessRoles as g, logSpoolProcessDir as h, parseLogSpoolBatchFilename as i, computeLogBatchIdempotencyKey as j, buildLogListDraft as k, loadEnvFiles as l, mergeLogSpoolExtraProcessRolesEnv as m, postLogBatch as n, logSpoolConfigFromEnv as o, pinEnvProfileFromArgv as p, ensureLogSpoolFromEnv as q, resolveProjectRootByPackageName as r, spoolLogger as s, shutdownLogSpoolFromEnv as t, getLogSpoolStats as u, validateLogSpoolPreloadEnv as v, SERVICE_ENV_PROFILE_PROD as w, buildLogSpoolSpawnEnv as x, envBool as y, envInt as z };
|
|
874
|
+
//# sourceMappingURL=enable-C7lFooTG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enable-DqnfLPsQ.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/shared/log/upload/env.ts","../../src/shared/log/upload/logger.ts","../../src/shared/log/spool/config.ts","../../src/shared/log/spool/paths.ts","../../src/shared/log/spool/process-roles.ts","../../src/shared/log/upload/flush.ts","../../src/shared/log/upload/batch-id.ts","../../src/shared/log/spool/file.ts","../../src/shared/log/spool/writer.ts","../../src/shared/log/spool/enable.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 { envBool } from \"../../../node/env/env-parsers\";\n\n/** Master switch — env name kept for compatibility (`LOG_PERSIST_ENABLED`). */\nexport function logSpoolEnabledFromEnv(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\n/** `LOG_PERSIST_REGISTRY_DIR` or `RUNTIME_DATA_DIR`. */\nexport function runtimeDataDirFromEnv(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","import { createLogger } from \"../core/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\ntype PipelineLogData = Record<string, unknown>;\n\nfunction createPipelineLogger(module: string) {\n const logger = createLogger({ module });\n\n function write(level: \"debug\" | \"info\" | \"warn\" | \"error\", message: string, data?: PipelineLogData): void {\n logger[level](message, {\n topic: LOG_PERSIST_INTERNAL_TOPIC,\n ...(data != null ? { data } : {}),\n });\n }\n\n return {\n debug: (message: string, data?: PipelineLogData) => write(\"debug\", message, data),\n info: (message: string, data?: PipelineLogData) => write(\"info\", message, data),\n warn: (message: string, data?: PipelineLogData) => write(\"warn\", message, data),\n error: (message: string, data?: PipelineLogData) => write(\"error\", message, data),\n };\n}\n\n/** Supabase upload path (`postLogBatch`). */\nexport const persistLogger = createPipelineLogger(\"log-upload\");\n\n/** File spool writer + collector. */\nexport const spoolLogger = createPipelineLogger(\"log-spool\");\n\nexport function isLogPersistInternalTopic(topic: string | undefined): boolean {\n return topic === LOG_PERSIST_INTERNAL_TOPIC;\n}\n","import { envInt, envMs } from \"../../../node/env/env-parsers\";\nimport type { LogSpoolConfig } from \"./interface\";\n\nexport const LOG_SPOOL_SERVICE_ID_ENV = \"LOG_SPOOL_SERVICE_ID\";\n\nexport const DEFAULT_LOG_SPOOL_CONFIG: LogSpoolConfig = {\n writer: {\n maxEntries: 2000,\n maxBytes: 2 * 1024 * 1024,\n flushDebounceMs: 3_000,\n maxAgeMs: 60_000,\n postTimeoutMs: 30_000,\n },\n gc: {\n intervalMs: 24 * 60 * 60 * 1000,\n syncedRetentionMs: 7 * 24 * 60 * 60 * 1000,\n tmpRetentionMs: 7 * 24 * 60 * 60 * 1000,\n },\n collectIntervalMs: 60_000,\n};\n\nexport function resolveLogSpoolConfig(partial?: Partial<LogSpoolConfig>): LogSpoolConfig {\n const defaults = DEFAULT_LOG_SPOOL_CONFIG;\n return {\n writer: { ...defaults.writer, ...partial?.writer },\n gc: { ...defaults.gc, ...partial?.gc },\n collectIntervalMs: partial?.collectIntervalMs ?? defaults.collectIntervalMs,\n };\n}\n\nexport function logSpoolConfigFromEnv(env: NodeJS.ProcessEnv = process.env): LogSpoolConfig {\n return resolveLogSpoolConfig({\n writer: {\n maxEntries: envInt(\"LOG_SPOOL_MAX_ENTRIES\", DEFAULT_LOG_SPOOL_CONFIG.writer.maxEntries, { env, min: 1 }),\n maxBytes: envInt(\"LOG_SPOOL_MAX_BYTES\", DEFAULT_LOG_SPOOL_CONFIG.writer.maxBytes, { env, min: 1 }),\n flushDebounceMs: envMs(\"LOG_SPOOL_FLUSH_DEBOUNCE_MS\", DEFAULT_LOG_SPOOL_CONFIG.writer.flushDebounceMs, {\n env,\n }),\n maxAgeMs: envMs(\"LOG_SPOOL_MAX_AGE_MS\", DEFAULT_LOG_SPOOL_CONFIG.writer.maxAgeMs, { env }),\n postTimeoutMs: envMs(\"LOG_PERSIST_POST_TIMEOUT_MS\", DEFAULT_LOG_SPOOL_CONFIG.writer.postTimeoutMs, { env }),\n },\n gc: {\n intervalMs: envMs(\"LOG_SPOOL_GC_INTERVAL_MS\", DEFAULT_LOG_SPOOL_CONFIG.gc.intervalMs, { env }),\n syncedRetentionMs: envMs(\"LOG_SPOOL_SYNCED_RETENTION_MS\", DEFAULT_LOG_SPOOL_CONFIG.gc.syncedRetentionMs, {\n env,\n }),\n tmpRetentionMs: envMs(\"LOG_SPOOL_TMP_RETENTION_MS\", DEFAULT_LOG_SPOOL_CONFIG.gc.tmpRetentionMs, { env }),\n },\n collectIntervalMs: envMs(\"LOG_SPOOL_COLLECT_INTERVAL_MS\", DEFAULT_LOG_SPOOL_CONFIG.collectIntervalMs, { env }),\n });\n}\n\nexport function logSpoolServiceIdFromEnv(env: NodeJS.ProcessEnv = process.env): string | undefined {\n const raw = env[LOG_SPOOL_SERVICE_ID_ENV]?.trim();\n return raw != null && raw !== \"\" ? raw : undefined;\n}\n","import { join } from \"node:path\";\nimport { runtimeDataDirFromEnv } from \"../upload/env\";\nimport type { LogSpoolProcessRole } from \"./interface\";\n\nexport const LOG_SPOOL_DIR_NAME = \"log-spool\";\n\nexport function resolveLogSpoolRoot(explicit?: string): string {\n if (explicit != null && explicit.trim() !== \"\") {\n return explicit;\n }\n const configured = process.env.LOG_SPOOL_DIR?.trim();\n if (configured != null && configured !== \"\") {\n return configured;\n }\n const runtimeDir = runtimeDataDirFromEnv();\n if (runtimeDir == null) {\n throw new Error(\n \"[LogSpool] spool root required: set LOG_SPOOL_DIR or LOG_PERSIST_REGISTRY_DIR / RUNTIME_DATA_DIR\",\n );\n }\n return join(runtimeDir, LOG_SPOOL_DIR_NAME);\n}\n\nexport function logSpoolServiceDir(spoolRoot: string, serviceId: string): string {\n return join(spoolRoot, serviceId);\n}\n\nexport function logSpoolProcessDir(spoolRoot: string, serviceId: string, processRole: LogSpoolProcessRole): string {\n return join(spoolRoot, serviceId, processRole);\n}\n","/** Four-process L3 blueprint roles — always scanned by collect-log. */\nexport const LOG_SPOOL_CORE_PROCESS_ROLES = [\"main\", \"guard\", \"scheduler\", \"worker\"] as const;\n\nexport type LogSpoolCoreProcessRole = (typeof LOG_SPOOL_CORE_PROCESS_ROLES)[number];\n\n/** Spool directory / `LOG_PERSIST_PROCESS` name — core or service-specific extra. */\nexport type LogSpoolProcessRole = LogSpoolCoreProcessRole | string;\n\nexport const LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV = \"LOG_SPOOL_EXTRA_PROCESS_ROLES\";\n\nconst EXTRA_ROLE_PATTERN = /^[a-z][a-z0-9-]*$/;\n\nfunction parseRoleList(raw: string | undefined): string[] {\n if (raw == null || raw.trim() === \"\") {\n return [];\n }\n return raw\n .split(\",\")\n .map((part) => part.trim())\n .filter((part) => part !== \"\");\n}\n\n/** Parse comma-separated extra roles from env (e.g. `chrome-sidecar`). */\nexport function logSpoolExtraProcessRolesFromEnv(env: NodeJS.ProcessEnv = process.env): string[] {\n return parseRoleList(env[LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV]);\n}\n\n/** Core + extras, deduped, stable order (core first). */\nexport function resolveAllLogSpoolProcessRoles(env: NodeJS.ProcessEnv = process.env): LogSpoolProcessRole[] {\n const extras = logSpoolExtraProcessRolesFromEnv(env);\n const seen = new Set<string>(LOG_SPOOL_CORE_PROCESS_ROLES);\n const all: LogSpoolProcessRole[] = [...LOG_SPOOL_CORE_PROCESS_ROLES];\n for (const role of extras) {\n if (!seen.has(role)) {\n seen.add(role);\n all.push(role);\n }\n }\n return all;\n}\n\nexport function isLogSpoolCoreProcessRole(value: string): value is LogSpoolCoreProcessRole {\n return (LOG_SPOOL_CORE_PROCESS_ROLES as readonly string[]).includes(value);\n}\n\n/** Whether `value` is a known spool role (core or configured extra). */\nexport function isKnownLogSpoolProcessRole(value: string, env: NodeJS.ProcessEnv = process.env): boolean {\n if (isLogSpoolCoreProcessRole(value)) {\n return true;\n }\n return logSpoolExtraProcessRolesFromEnv(env).includes(value);\n}\n\n/** Validate extra role token — lowercase alphanumeric + hyphen, not a duplicate core name. */\nexport function assertValidLogSpoolExtraProcessRole(role: string): void {\n if (role === \"\" || !EXTRA_ROLE_PATTERN.test(role)) {\n throw new Error(\n `[LogSpool] invalid extra process role \"${role}\" — use lowercase letters, digits, hyphen (e.g. chrome-sidecar)`,\n );\n }\n if (isLogSpoolCoreProcessRole(role)) {\n throw new Error(`[LogSpool] extra process role \"${role}\" duplicates a core role`);\n }\n}\n\nexport function mergeLogSpoolExtraProcessRolesEnv(env: NodeJS.ProcessEnv, extraRoles: readonly string[]): void {\n if (extraRoles.length === 0) {\n return;\n }\n for (const role of extraRoles) {\n assertValidLogSpoolExtraProcessRole(role);\n }\n const merged = new Set([...logSpoolExtraProcessRolesFromEnv(env), ...extraRoles]);\n env[LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV] = [...merged].join(\",\");\n}\n","import { isCreateTargetAlreadyExistsError } from \"../../../core.api\";\nimport { postLogListCreate } from \"../../../list/list.api\";\nimport { CategoryList } from \"../../../list/list.interface\";\nimport type { LogEntry } from \"../core/log-manager\";\nimport type { BuildLogListDraftInput, LogListDraft } from \"./interface\";\nimport { LOG_PERSIST_LOADER_KEY } from \"./interface\";\nimport { persistLogger } from \"./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 // TODO: `lane` is legacy transport metadata — scheduled for removal; callers still pass a fixed value for decode compatibility.\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 { createHash } from \"node:crypto\";\nimport type { LogEntry } from \"../core/log-manager\";\nimport type { LogPersistLane } from \"./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 type { LogEntry } from \"../core/log-manager\";\nimport { computeLogBatchIdempotencyKey } from \"../upload/batch-id\";\nimport type { LogSpoolProcessRole } from \"./interface\";\n\n/** `role.timestamp.hash.tmp|json` — role is lowercase alphanumeric + hyphen. */\nconst BATCH_FILE_PATTERN = /^([a-z][a-z0-9-]*)\\.(\\d{14})\\.([a-f0-9]{8})\\.(tmp|json)$/;\n\nexport function formatLogSpoolBatchTimestamp(ms: number): string {\n const d = new Date(ms);\n const pad = (n: number) => String(n).padStart(2, \"0\");\n return (\n `${d.getFullYear()}` +\n `${pad(d.getMonth() + 1)}` +\n `${pad(d.getDate())}` +\n `${pad(d.getHours())}` +\n `${pad(d.getMinutes())}` +\n `${pad(d.getSeconds())}`\n );\n}\n\nexport function computeLogSpoolShortHash(input: {\n serviceValue: string;\n serviceId: string;\n processRole: LogSpoolProcessRole;\n entries: LogEntry[];\n}): string {\n const processKey = `${input.serviceId}:${input.processRole}`;\n const idempotencyKey = computeLogBatchIdempotencyKey({\n service: input.serviceValue,\n process: processKey,\n lane: \"slow\",\n entries: input.entries,\n });\n return idempotencyKey.slice(0, 8);\n}\n\nexport function buildLogSpoolBatchBaseName(input: {\n processRole: LogSpoolProcessRole;\n firstEntryTimestamp: number;\n shortHash: string;\n}): string {\n const ts = formatLogSpoolBatchTimestamp(input.firstEntryTimestamp);\n return `${input.processRole}.${ts}.${input.shortHash}`;\n}\n\nexport function parseLogSpoolBatchFilename(filename: string): {\n processRole: LogSpoolProcessRole;\n timestampMs: number;\n shortHash: string;\n extension: \"tmp\" | \"json\";\n} | null {\n const match = BATCH_FILE_PATTERN.exec(filename);\n if (match == null) {\n return null;\n }\n\n const processRole = match[1] as LogSpoolProcessRole;\n const tsRaw = match[2];\n const shortHash = match[3];\n const extension = match[4] as \"tmp\" | \"json\";\n\n const year = Number(tsRaw.slice(0, 4));\n const month = Number(tsRaw.slice(4, 6));\n const day = Number(tsRaw.slice(6, 8));\n const hour = Number(tsRaw.slice(8, 10));\n const minute = Number(tsRaw.slice(10, 12));\n const second = Number(tsRaw.slice(12, 14));\n const timestampMs = Date.UTC(year, month - 1, day, hour, minute, second);\n\n if (!Number.isFinite(timestampMs)) {\n return null;\n }\n\n return { processRole, timestampMs, shortHash, extension };\n}\n","import { mkdir, rename, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport type { LogEntry } from \"../core/log-manager\";\nimport { estimateEntriesBytes, takeEntriesWithinBytes } from \"../upload/flush\";\nimport { registerLogPersistOffer } from \"../upload/hook\";\nimport { isLogPersistInternalTopic, spoolLogger } from \"../upload/logger\";\nimport { DEFAULT_LOG_SPOOL_CONFIG, resolveLogSpoolConfig } from \"./config\";\nimport { buildLogSpoolBatchBaseName, computeLogSpoolShortHash } from \"./file\";\nimport type { EnableLogSpoolOptions, LogSpoolBatchFile, LogSpoolProcessRole, LogSpoolWriterStats } from \"./interface\";\nimport { logSpoolProcessDir, resolveLogSpoolRoot } from \"./paths\";\n\nclass LogSpoolWriter {\n private static instance: LogSpoolWriter | null = null;\n\n private enabled = false;\n private buffer: LogEntry[] = [];\n private flushInProgress = false;\n private debounceTimer: ReturnType<typeof setTimeout> | null = null;\n private ageTimer: ReturnType<typeof setTimeout> | null = null;\n private serviceId: string | null = null;\n private processRole: LogSpoolProcessRole | null = null;\n private serviceValue: string | null = null;\n private spoolRoot: string | null = null;\n private config = DEFAULT_LOG_SPOOL_CONFIG.writer;\n\n static getInstance(): LogSpoolWriter {\n LogSpoolWriter.instance ??= new LogSpoolWriter();\n return LogSpoolWriter.instance;\n }\n\n async enable(options: EnableLogSpoolOptions): Promise<void> {\n if (this.enabled) {\n spoolLogger.warn(\"log spool writer already enabled\", {\n serviceId: this.serviceId,\n processRole: this.processRole,\n });\n return;\n }\n\n this.serviceId = options.serviceId;\n this.processRole = options.processRole;\n this.serviceValue = options.serviceValue;\n this.spoolRoot = options.spoolRoot ?? resolveLogSpoolRoot();\n this.config = resolveLogSpoolConfig(options.config).writer;\n this.enabled = true;\n\n registerLogPersistOffer((entry) => this.offer(entry));\n\n spoolLogger.info(\"log spool writer enabled\", {\n serviceId: options.serviceId,\n processRole: options.processRole,\n serviceValue: options.serviceValue,\n spoolRoot: this.spoolRoot,\n config: this.config,\n });\n }\n\n async shutdown(): Promise<void> {\n this.cancelDebounce();\n this.cancelAgeFlush();\n registerLogPersistOffer(null);\n this.enabled = false;\n\n while (this.buffer.length > 0) {\n await this.flushChunk({ reason: \"shutdown\" });\n }\n\n spoolLogger.info(\"log spool writer shutdown complete\", {\n serviceId: this.serviceId,\n processRole: this.processRole,\n });\n }\n\n getStats(): LogSpoolWriterStats {\n return {\n enabled: this.enabled,\n bufferedEntries: this.buffer.length,\n bufferedBytes: estimateEntriesBytes(this.buffer),\n flushInProgress: this.flushInProgress,\n debouncePending: this.debounceTimer != null,\n ageFlushPending: this.ageTimer != null,\n serviceId: this.serviceId,\n processRole: this.processRole,\n };\n }\n\n offer(entry: LogEntry): void {\n if (isLogPersistInternalTopic(entry.topic)) {\n return;\n }\n\n if (!this.enabled) {\n return;\n }\n\n if (this.buffer.length === 0) {\n this.scheduleAgeFlush();\n }\n\n this.buffer.push(entry);\n\n if (this.shouldScheduleDebouncedFlush()) {\n this.scheduleDebouncedFlush();\n }\n }\n\n private shouldScheduleDebouncedFlush(): boolean {\n return (\n this.buffer.length >= this.config.maxEntries || estimateEntriesBytes(this.buffer) >= this.config.maxBytes\n );\n }\n\n private scheduleDebouncedFlush(): void {\n if (this.debounceTimer != null) {\n return;\n }\n\n spoolLogger.debug(\"log spool flush debounce scheduled\", {\n debounceMs: this.config.flushDebounceMs,\n bufferedEntries: this.buffer.length,\n });\n\n this.debounceTimer = setTimeout(() => {\n this.debounceTimer = null;\n void this.flushChunk({ reason: \"debounce\" });\n }, this.config.flushDebounceMs);\n this.debounceTimer.unref?.();\n }\n\n private scheduleAgeFlush(): void {\n if (this.ageTimer != null) {\n return;\n }\n\n spoolLogger.debug(\"log spool age flush scheduled\", {\n maxAgeMs: this.config.maxAgeMs,\n });\n\n this.ageTimer = setTimeout(() => {\n this.ageTimer = null;\n void this.flushChunk({ reason: \"maxAge\" });\n }, this.config.maxAgeMs);\n this.ageTimer.unref?.();\n }\n\n private cancelDebounce(): void {\n if (this.debounceTimer != null) {\n clearTimeout(this.debounceTimer);\n this.debounceTimer = null;\n }\n }\n\n private cancelAgeFlush(): void {\n if (this.ageTimer != null) {\n clearTimeout(this.ageTimer);\n this.ageTimer = null;\n }\n }\n\n private async flushChunk(input: { reason: string }): Promise<void> {\n if (this.flushInProgress || this.buffer.length === 0) {\n return;\n }\n if (this.serviceId == null || this.processRole == null || this.serviceValue == null || this.spoolRoot == null) {\n return;\n }\n\n this.cancelDebounce();\n this.cancelAgeFlush();\n this.flushInProgress = true;\n try {\n const byCount = this.buffer.slice(0, this.config.maxEntries);\n const entries = takeEntriesWithinBytes(byCount, this.config.maxBytes);\n this.buffer = this.buffer.slice(entries.length);\n\n if (entries.length === 0) {\n if (this.buffer.length > 0) {\n this.scheduleAgeFlush();\n } else {\n this.cancelAgeFlush();\n }\n return;\n }\n\n const batchFile = await this.writeBatchTmp({\n entries,\n serviceId: this.serviceId,\n processRole: this.processRole,\n serviceValue: this.serviceValue,\n spoolRoot: this.spoolRoot,\n });\n\n spoolLogger.info(\"log spool flushed to tmp\", {\n reason: input.reason,\n fileName: batchFile.fileName,\n entryCount: entries.length,\n remainingBuffered: this.buffer.length,\n });\n\n if (this.buffer.length > 0) {\n this.scheduleAgeFlush();\n if (this.shouldScheduleDebouncedFlush()) {\n this.scheduleDebouncedFlush();\n }\n } else {\n this.cancelAgeFlush();\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n spoolLogger.error(\"log spool flush failed\", { reason: input.reason, error: message });\n if (this.buffer.length > 0) {\n this.scheduleAgeFlush();\n }\n } finally {\n this.flushInProgress = false;\n }\n }\n\n private async writeBatchTmp(input: {\n entries: LogEntry[];\n serviceId: string;\n processRole: LogSpoolProcessRole;\n serviceValue: string;\n spoolRoot: string;\n }): Promise<{ fileName: string; tmpPath: string }> {\n const first = input.entries[0];\n const shortHash = computeLogSpoolShortHash({\n serviceValue: input.serviceValue,\n serviceId: input.serviceId,\n processRole: input.processRole,\n entries: input.entries,\n });\n const baseName = buildLogSpoolBatchBaseName({\n processRole: input.processRole,\n firstEntryTimestamp: first.timestamp,\n shortHash,\n });\n const fileName = `${baseName}.tmp`;\n const processDir = logSpoolProcessDir(input.spoolRoot, input.serviceId, input.processRole);\n await mkdir(processDir, { recursive: true });\n\n const tmpPath = join(processDir, fileName);\n const partPath = `${tmpPath}.part`;\n const payload: LogSpoolBatchFile = {\n entries: input.entries,\n meta: {\n serviceId: input.serviceId,\n processRole: input.processRole,\n serviceValue: input.serviceValue,\n },\n };\n const content = `${JSON.stringify(payload)}\\n`;\n\n await writeFile(partPath, content, \"utf8\");\n await rename(partPath, tmpPath);\n\n return { fileName, tmpPath };\n }\n}\n\nexport { LogSpoolWriter };\n\nexport async function enableLogSpoolWriter(options: EnableLogSpoolOptions): Promise<void> {\n await LogSpoolWriter.getInstance().enable(options);\n}\n\nexport async function shutdownLogSpoolWriter(): Promise<void> {\n await LogSpoolWriter.getInstance().shutdown();\n}\n\nexport function getLogSpoolWriterStats(): LogSpoolWriterStats {\n return LogSpoolWriter.getInstance().getStats();\n}\n","import { createLogger } from \"../core/create-logger\";\nimport { logPersistProcessFromEnv, logPersistServiceFromEnv, logSpoolEnabledFromEnv } from \"../upload/env\";\nimport { registerLogPersistOffer } from \"../upload/hook\";\nimport { LOG_PERSIST_TOPIC } from \"../upload/logger\";\nimport { LOG_SPOOL_SERVICE_ID_ENV, logSpoolConfigFromEnv, logSpoolServiceIdFromEnv } from \"./config\";\nimport type { EnsureLogSpoolFromEnvOptions, LogSpoolProcessRole } from \"./interface\";\nimport { resolveLogSpoolRoot } from \"./paths\";\nimport {\n assertValidLogSpoolExtraProcessRole,\n isKnownLogSpoolProcessRole,\n LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV,\n} from \"./process-roles\";\nimport { enableLogSpoolWriter, getLogSpoolWriterStats, shutdownLogSpoolWriter } from \"./writer\";\n\nexport { logSpoolEnabledFromEnv };\n\nexport function resolveLogSpoolProcessRole(explicit?: string): LogSpoolProcessRole {\n const raw = explicit ?? logPersistProcessFromEnv();\n if (raw == null || raw === \"\") {\n throw new Error(\"[LogSpool] LOG_PERSIST_PROCESS is required when LOG_PERSIST_ENABLED=true\");\n }\n if (!isKnownLogSpoolProcessRole(raw)) {\n throw new Error(\n `[LogSpool] invalid LOG_PERSIST_PROCESS: ${raw} (not a core role and not listed in ${LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV})`,\n );\n }\n return raw;\n}\n\n/**\n * Env vars for child spawn after main claims registry slot.\n * Optional when using {@link ManagedChildProcesses.spawn} — auto-injected from parent env.\n */\nexport function buildLogSpoolSpawnEnv(input: {\n serviceId: string;\n processRole: LogSpoolProcessRole;\n}): Record<string, string> {\n return {\n [LOG_SPOOL_SERVICE_ID_ENV]: input.serviceId,\n LOG_PERSIST_PROCESS: input.processRole,\n };\n}\n\n/**\n * When persistence is enabled and parent has `LOG_SPOOL_SERVICE_ID`, map spawn `label`\n * to spool env when `label` is a known core or extra process role.\n */\nexport function resolveLogSpoolSpawnEnvForLabel(\n label: string,\n env: NodeJS.ProcessEnv = process.env,\n): Record<string, string> {\n if (!logSpoolEnabledFromEnv(env)) {\n return {};\n }\n const serviceId = env[LOG_SPOOL_SERVICE_ID_ENV]?.trim();\n if (serviceId == null || serviceId === \"\") {\n return {};\n }\n if (!isKnownLogSpoolProcessRole(label, env)) {\n return {};\n }\n return buildLogSpoolSpawnEnv({ serviceId, processRole: label });\n}\n\nexport async function ensureLogSpoolFromEnv(options: EnsureLogSpoolFromEnvOptions = {}): Promise<boolean> {\n if (!logSpoolEnabledFromEnv()) {\n registerLogPersistOffer(null);\n return false;\n }\n\n const serviceId = options.serviceId ?? logSpoolServiceIdFromEnv();\n const serviceValue = options.serviceValue ?? logPersistServiceFromEnv();\n const processRole = resolveLogSpoolProcessRole(options.processRole);\n\n if (serviceId == null || serviceId === \"\") {\n throw new Error(\n \"[LogSpool] LOG_SPOOL_SERVICE_ID is required when LOG_PERSIST_ENABLED=true (set after registry claim or pass serviceId)\",\n );\n }\n if (serviceValue == null || serviceValue === \"\") {\n throw new Error(\"[LogSpool] LOG_PERSIST_SERVICE is required when LOG_PERSIST_ENABLED=true\");\n }\n\n const spoolRoot = options.spoolRoot ?? resolveLogSpoolRoot();\n\n await enableLogSpoolWriter({\n serviceId,\n processRole,\n serviceValue,\n spoolRoot,\n config: options.config ?? logSpoolConfigFromEnv(),\n });\n\n const lifecycleLogger = createLogger({ module: \"log-spool\" });\n lifecycleLogger.info(\"log spool enabled from env\", {\n topic: LOG_PERSIST_TOPIC,\n data: { serviceId, processRole, serviceValue, spoolRoot },\n });\n\n return true;\n}\n\nexport async function shutdownLogSpoolFromEnv(): Promise<void> {\n await shutdownLogSpoolWriter();\n}\n\nexport function getLogSpoolStats(): ReturnType<typeof getLogSpoolWriterStats> {\n return getLogSpoolWriterStats();\n}\n\nexport function validateLogSpoolPreloadEnv(env: NodeJS.ProcessEnv = process.env): void {\n if (!logSpoolEnabledFromEnv(env)) {\n return;\n }\n\n const missing: string[] = [];\n if (env.LOG_PERSIST_SERVICE?.trim() == null || env.LOG_PERSIST_SERVICE.trim() === \"\") {\n missing.push(\"LOG_PERSIST_SERVICE\");\n }\n const runtimeDir = env.LOG_PERSIST_REGISTRY_DIR?.trim() || env.RUNTIME_DATA_DIR?.trim();\n if (runtimeDir == null || runtimeDir === \"\") {\n missing.push(\"LOG_PERSIST_REGISTRY_DIR or RUNTIME_DATA_DIR\");\n }\n\n if (missing.length > 0) {\n throw new Error(`[LogSpool] preload env incomplete: ${missing.join(\", \")}`);\n }\n\n for (const role of env[LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV]?.split(\",\") ?? []) {\n const trimmed = role.trim();\n if (trimmed === \"\") {\n continue;\n }\n assertValidLogSpoolExtraProcessRole(trimmed);\n }\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,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,CAAC,CAAA,mCAAA,EAAsC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CAAC;IAC/E;AAEA,IAAA,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,iCAAiC,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE;AACzE,QAAA,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE;AAC3B,QAAA,IAAI,OAAO,KAAK,EAAE,EAAE;YAChB;QACJ;QACA,mCAAmC,CAAC,OAAO,CAAC;IAChD;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"enable-C7lFooTG.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/shared/log/upload/env.ts","../../src/shared/log/upload/logger.ts","../../src/shared/log/spool/config.ts","../../src/shared/log/spool/paths.ts","../../src/shared/log/spool/process-roles.ts","../../src/shared/log/upload/flush.ts","../../src/shared/log/upload/batch-id.ts","../../src/shared/log/spool/file.ts","../../src/shared/log/spool/writer.ts","../../src/shared/log/spool/enable.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 { envBool } from \"../../../node/env/env-parsers\";\n\n/** Master switch — env name kept for compatibility (`LOG_PERSIST_ENABLED`). */\nexport function logSpoolEnabledFromEnv(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\n/** `LOG_PERSIST_REGISTRY_DIR` or `RUNTIME_DATA_DIR`. */\nexport function runtimeDataDirFromEnv(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","import { createLogger } from \"../core/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\ntype PipelineLogData = Record<string, unknown>;\n\nfunction createPipelineLogger(module: string) {\n const logger = createLogger({ module });\n\n function write(level: \"debug\" | \"info\" | \"warn\" | \"error\", message: string, data?: PipelineLogData): void {\n logger[level](message, {\n topic: LOG_PERSIST_INTERNAL_TOPIC,\n ...(data != null ? { data } : {}),\n });\n }\n\n return {\n debug: (message: string, data?: PipelineLogData) => write(\"debug\", message, data),\n info: (message: string, data?: PipelineLogData) => write(\"info\", message, data),\n warn: (message: string, data?: PipelineLogData) => write(\"warn\", message, data),\n error: (message: string, data?: PipelineLogData) => write(\"error\", message, data),\n };\n}\n\n/** Supabase upload path (`postLogBatch`). */\nexport const persistLogger = createPipelineLogger(\"log-upload\");\n\n/** File spool writer + collector. */\nexport const spoolLogger = createPipelineLogger(\"log-spool\");\n\nexport function isLogPersistInternalTopic(topic: string | undefined): boolean {\n return topic === LOG_PERSIST_INTERNAL_TOPIC;\n}\n","import { envInt, envMs } from \"../../../node/env/env-parsers\";\nimport type { LogSpoolConfig } from \"./interface\";\n\nexport const LOG_SPOOL_SERVICE_ID_ENV = \"LOG_SPOOL_SERVICE_ID\";\n\nexport const DEFAULT_LOG_SPOOL_CONFIG: LogSpoolConfig = {\n writer: {\n maxEntries: 2000,\n maxBytes: 2 * 1024 * 1024,\n flushDebounceMs: 3_000,\n maxAgeMs: 60_000,\n postTimeoutMs: 30_000,\n },\n gc: {\n intervalMs: 24 * 60 * 60 * 1000,\n syncedRetentionMs: 7 * 24 * 60 * 60 * 1000,\n tmpRetentionMs: 7 * 24 * 60 * 60 * 1000,\n },\n collectIntervalMs: 60_000,\n};\n\nexport function resolveLogSpoolConfig(partial?: Partial<LogSpoolConfig>): LogSpoolConfig {\n const defaults = DEFAULT_LOG_SPOOL_CONFIG;\n return {\n writer: { ...defaults.writer, ...partial?.writer },\n gc: { ...defaults.gc, ...partial?.gc },\n collectIntervalMs: partial?.collectIntervalMs ?? defaults.collectIntervalMs,\n };\n}\n\nexport function logSpoolConfigFromEnv(env: NodeJS.ProcessEnv = process.env): LogSpoolConfig {\n return resolveLogSpoolConfig({\n writer: {\n maxEntries: envInt(\"LOG_SPOOL_MAX_ENTRIES\", DEFAULT_LOG_SPOOL_CONFIG.writer.maxEntries, { env, min: 1 }),\n maxBytes: envInt(\"LOG_SPOOL_MAX_BYTES\", DEFAULT_LOG_SPOOL_CONFIG.writer.maxBytes, { env, min: 1 }),\n flushDebounceMs: envMs(\"LOG_SPOOL_FLUSH_DEBOUNCE_MS\", DEFAULT_LOG_SPOOL_CONFIG.writer.flushDebounceMs, {\n env,\n }),\n maxAgeMs: envMs(\"LOG_SPOOL_MAX_AGE_MS\", DEFAULT_LOG_SPOOL_CONFIG.writer.maxAgeMs, { env }),\n postTimeoutMs: envMs(\"LOG_PERSIST_POST_TIMEOUT_MS\", DEFAULT_LOG_SPOOL_CONFIG.writer.postTimeoutMs, { env }),\n },\n gc: {\n intervalMs: envMs(\"LOG_SPOOL_GC_INTERVAL_MS\", DEFAULT_LOG_SPOOL_CONFIG.gc.intervalMs, { env }),\n syncedRetentionMs: envMs(\"LOG_SPOOL_SYNCED_RETENTION_MS\", DEFAULT_LOG_SPOOL_CONFIG.gc.syncedRetentionMs, {\n env,\n }),\n tmpRetentionMs: envMs(\"LOG_SPOOL_TMP_RETENTION_MS\", DEFAULT_LOG_SPOOL_CONFIG.gc.tmpRetentionMs, { env }),\n },\n collectIntervalMs: envMs(\"LOG_SPOOL_COLLECT_INTERVAL_MS\", DEFAULT_LOG_SPOOL_CONFIG.collectIntervalMs, { env }),\n });\n}\n\nexport function logSpoolServiceIdFromEnv(env: NodeJS.ProcessEnv = process.env): string | undefined {\n const raw = env[LOG_SPOOL_SERVICE_ID_ENV]?.trim();\n return raw != null && raw !== \"\" ? raw : undefined;\n}\n","import { join } from \"node:path\";\nimport { runtimeDataDirFromEnv } from \"../upload/env\";\nimport type { LogSpoolProcessRole } from \"./interface\";\n\nexport const LOG_SPOOL_DIR_NAME = \"log-spool\";\n\nexport function resolveLogSpoolRoot(explicit?: string): string {\n if (explicit != null && explicit.trim() !== \"\") {\n return explicit;\n }\n const configured = process.env.LOG_SPOOL_DIR?.trim();\n if (configured != null && configured !== \"\") {\n return configured;\n }\n const runtimeDir = runtimeDataDirFromEnv();\n if (runtimeDir == null) {\n throw new Error(\n \"[LogSpool] spool root required: set LOG_SPOOL_DIR or LOG_PERSIST_REGISTRY_DIR / RUNTIME_DATA_DIR\",\n );\n }\n return join(runtimeDir, LOG_SPOOL_DIR_NAME);\n}\n\nexport function logSpoolServiceDir(spoolRoot: string, serviceId: string): string {\n return join(spoolRoot, serviceId);\n}\n\nexport function logSpoolProcessDir(spoolRoot: string, serviceId: string, processRole: LogSpoolProcessRole): string {\n return join(spoolRoot, serviceId, processRole);\n}\n","/** Four-process L3 blueprint roles — always scanned by collect-log. */\nexport const LOG_SPOOL_CORE_PROCESS_ROLES = [\"main\", \"guard\", \"scheduler\", \"worker\"] as const;\n\nexport type LogSpoolCoreProcessRole = (typeof LOG_SPOOL_CORE_PROCESS_ROLES)[number];\n\n/** Spool directory / `LOG_PERSIST_PROCESS` name — core or service-specific extra. */\nexport type LogSpoolProcessRole = LogSpoolCoreProcessRole | string;\n\nexport const LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV = \"LOG_SPOOL_EXTRA_PROCESS_ROLES\";\n\nconst EXTRA_ROLE_PATTERN = /^[a-z][a-z0-9-]*$/;\n\nfunction parseRoleList(raw: string | undefined): string[] {\n if (raw == null || raw.trim() === \"\") {\n return [];\n }\n return raw\n .split(\",\")\n .map((part) => part.trim())\n .filter((part) => part !== \"\");\n}\n\n/** Parse comma-separated extra roles from env (e.g. `chrome-sidecar`). */\nexport function logSpoolExtraProcessRolesFromEnv(env: NodeJS.ProcessEnv = process.env): string[] {\n return parseRoleList(env[LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV]);\n}\n\n/** Core + extras, deduped, stable order (core first). */\nexport function resolveAllLogSpoolProcessRoles(env: NodeJS.ProcessEnv = process.env): LogSpoolProcessRole[] {\n const extras = logSpoolExtraProcessRolesFromEnv(env);\n const seen = new Set<string>(LOG_SPOOL_CORE_PROCESS_ROLES);\n const all: LogSpoolProcessRole[] = [...LOG_SPOOL_CORE_PROCESS_ROLES];\n for (const role of extras) {\n if (!seen.has(role)) {\n seen.add(role);\n all.push(role);\n }\n }\n return all;\n}\n\nexport function isLogSpoolCoreProcessRole(value: string): value is LogSpoolCoreProcessRole {\n return (LOG_SPOOL_CORE_PROCESS_ROLES as readonly string[]).includes(value);\n}\n\n/** Whether `value` is a known spool role (core or configured extra). */\nexport function isKnownLogSpoolProcessRole(value: string, env: NodeJS.ProcessEnv = process.env): boolean {\n if (isLogSpoolCoreProcessRole(value)) {\n return true;\n }\n return logSpoolExtraProcessRolesFromEnv(env).includes(value);\n}\n\n/** Validate extra role token — lowercase alphanumeric + hyphen, not a duplicate core name. */\nexport function assertValidLogSpoolExtraProcessRole(role: string): void {\n if (role === \"\" || !EXTRA_ROLE_PATTERN.test(role)) {\n throw new Error(\n `[LogSpool] invalid extra process role \"${role}\" — use lowercase letters, digits, hyphen (e.g. chrome-sidecar)`,\n );\n }\n if (isLogSpoolCoreProcessRole(role)) {\n throw new Error(`[LogSpool] extra process role \"${role}\" duplicates a core role`);\n }\n}\n\nexport function mergeLogSpoolExtraProcessRolesEnv(env: NodeJS.ProcessEnv, extraRoles: readonly string[]): void {\n if (extraRoles.length === 0) {\n return;\n }\n for (const role of extraRoles) {\n assertValidLogSpoolExtraProcessRole(role);\n }\n const merged = new Set([...logSpoolExtraProcessRolesFromEnv(env), ...extraRoles]);\n env[LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV] = [...merged].join(\",\");\n}\n","import { isCreateTargetAlreadyExistsError } from \"../../../core.api\";\nimport { postLogListCreate } from \"../../../list/list.api\";\nimport { CategoryList } from \"../../../list/list.interface\";\nimport type { LogEntry } from \"../core/log-manager\";\nimport type { BuildLogListDraftInput, LogListDraft } from \"./interface\";\nimport { LOG_PERSIST_LOADER_KEY } from \"./interface\";\nimport { persistLogger } from \"./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 // TODO: `lane` is legacy transport metadata — scheduled for removal; callers still pass a fixed value for decode compatibility.\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 { createHash } from \"node:crypto\";\nimport type { LogEntry } from \"../core/log-manager\";\nimport type { LogPersistLane } from \"./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 type { LogEntry } from \"../core/log-manager\";\nimport { computeLogBatchIdempotencyKey } from \"../upload/batch-id\";\nimport type { LogSpoolProcessRole } from \"./interface\";\n\n/** `role.timestamp.hash.tmp|json` — role is lowercase alphanumeric + hyphen. */\nconst BATCH_FILE_PATTERN = /^([a-z][a-z0-9-]*)\\.(\\d{14})\\.([a-f0-9]{8})\\.(tmp|json)$/;\n\nexport function formatLogSpoolBatchTimestamp(ms: number): string {\n const d = new Date(ms);\n const pad = (n: number) => String(n).padStart(2, \"0\");\n return (\n `${d.getFullYear()}` +\n `${pad(d.getMonth() + 1)}` +\n `${pad(d.getDate())}` +\n `${pad(d.getHours())}` +\n `${pad(d.getMinutes())}` +\n `${pad(d.getSeconds())}`\n );\n}\n\nexport function computeLogSpoolShortHash(input: {\n serviceValue: string;\n serviceId: string;\n processRole: LogSpoolProcessRole;\n entries: LogEntry[];\n}): string {\n const processKey = `${input.serviceId}:${input.processRole}`;\n const idempotencyKey = computeLogBatchIdempotencyKey({\n service: input.serviceValue,\n process: processKey,\n lane: \"slow\",\n entries: input.entries,\n });\n return idempotencyKey.slice(0, 8);\n}\n\nexport function buildLogSpoolBatchBaseName(input: {\n processRole: LogSpoolProcessRole;\n firstEntryTimestamp: number;\n shortHash: string;\n}): string {\n const ts = formatLogSpoolBatchTimestamp(input.firstEntryTimestamp);\n return `${input.processRole}.${ts}.${input.shortHash}`;\n}\n\nexport function parseLogSpoolBatchFilename(filename: string): {\n processRole: LogSpoolProcessRole;\n timestampMs: number;\n shortHash: string;\n extension: \"tmp\" | \"json\";\n} | null {\n const match = BATCH_FILE_PATTERN.exec(filename);\n if (match == null) {\n return null;\n }\n\n const processRole = match[1] as LogSpoolProcessRole;\n const tsRaw = match[2];\n const shortHash = match[3];\n const extension = match[4] as \"tmp\" | \"json\";\n\n const year = Number(tsRaw.slice(0, 4));\n const month = Number(tsRaw.slice(4, 6));\n const day = Number(tsRaw.slice(6, 8));\n const hour = Number(tsRaw.slice(8, 10));\n const minute = Number(tsRaw.slice(10, 12));\n const second = Number(tsRaw.slice(12, 14));\n const timestampMs = Date.UTC(year, month - 1, day, hour, minute, second);\n\n if (!Number.isFinite(timestampMs)) {\n return null;\n }\n\n return { processRole, timestampMs, shortHash, extension };\n}\n","import { mkdir, rename, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport type { LogEntry } from \"../core/log-manager\";\nimport { estimateEntriesBytes, takeEntriesWithinBytes } from \"../upload/flush\";\nimport { registerLogPersistOffer } from \"../upload/hook\";\nimport { isLogPersistInternalTopic, spoolLogger } from \"../upload/logger\";\nimport { DEFAULT_LOG_SPOOL_CONFIG, resolveLogSpoolConfig } from \"./config\";\nimport { buildLogSpoolBatchBaseName, computeLogSpoolShortHash } from \"./file\";\nimport type { EnableLogSpoolOptions, LogSpoolBatchFile, LogSpoolProcessRole, LogSpoolWriterStats } from \"./interface\";\nimport { logSpoolProcessDir, resolveLogSpoolRoot } from \"./paths\";\n\nclass LogSpoolWriter {\n private static instance: LogSpoolWriter | null = null;\n\n private enabled = false;\n private buffer: LogEntry[] = [];\n private flushInProgress = false;\n private debounceTimer: ReturnType<typeof setTimeout> | null = null;\n private ageTimer: ReturnType<typeof setTimeout> | null = null;\n private serviceId: string | null = null;\n private processRole: LogSpoolProcessRole | null = null;\n private serviceValue: string | null = null;\n private spoolRoot: string | null = null;\n private config = DEFAULT_LOG_SPOOL_CONFIG.writer;\n\n static getInstance(): LogSpoolWriter {\n LogSpoolWriter.instance ??= new LogSpoolWriter();\n return LogSpoolWriter.instance;\n }\n\n async enable(options: EnableLogSpoolOptions): Promise<void> {\n if (this.enabled) {\n spoolLogger.warn(\"log spool writer already enabled\", {\n serviceId: this.serviceId,\n processRole: this.processRole,\n });\n return;\n }\n\n this.serviceId = options.serviceId;\n this.processRole = options.processRole;\n this.serviceValue = options.serviceValue;\n this.spoolRoot = options.spoolRoot ?? resolveLogSpoolRoot();\n this.config = resolveLogSpoolConfig(options.config).writer;\n this.enabled = true;\n\n registerLogPersistOffer((entry) => this.offer(entry));\n\n spoolLogger.info(\"log spool writer enabled\", {\n serviceId: options.serviceId,\n processRole: options.processRole,\n serviceValue: options.serviceValue,\n spoolRoot: this.spoolRoot,\n config: this.config,\n });\n }\n\n async shutdown(): Promise<void> {\n this.cancelDebounce();\n this.cancelAgeFlush();\n registerLogPersistOffer(null);\n this.enabled = false;\n\n while (this.buffer.length > 0) {\n await this.flushChunk({ reason: \"shutdown\" });\n }\n\n spoolLogger.info(\"log spool writer shutdown complete\", {\n serviceId: this.serviceId,\n processRole: this.processRole,\n });\n }\n\n getStats(): LogSpoolWriterStats {\n return {\n enabled: this.enabled,\n bufferedEntries: this.buffer.length,\n bufferedBytes: estimateEntriesBytes(this.buffer),\n flushInProgress: this.flushInProgress,\n debouncePending: this.debounceTimer != null,\n ageFlushPending: this.ageTimer != null,\n serviceId: this.serviceId,\n processRole: this.processRole,\n };\n }\n\n offer(entry: LogEntry): void {\n if (isLogPersistInternalTopic(entry.topic)) {\n return;\n }\n\n if (!this.enabled) {\n return;\n }\n\n if (this.buffer.length === 0) {\n this.scheduleAgeFlush();\n }\n\n this.buffer.push(entry);\n\n if (this.shouldScheduleDebouncedFlush()) {\n this.scheduleDebouncedFlush();\n }\n }\n\n private shouldScheduleDebouncedFlush(): boolean {\n return (\n this.buffer.length >= this.config.maxEntries || estimateEntriesBytes(this.buffer) >= this.config.maxBytes\n );\n }\n\n private scheduleDebouncedFlush(): void {\n if (this.debounceTimer != null) {\n return;\n }\n\n spoolLogger.debug(\"log spool flush debounce scheduled\", {\n debounceMs: this.config.flushDebounceMs,\n bufferedEntries: this.buffer.length,\n });\n\n this.debounceTimer = setTimeout(() => {\n this.debounceTimer = null;\n void this.flushChunk({ reason: \"debounce\" });\n }, this.config.flushDebounceMs);\n this.debounceTimer.unref?.();\n }\n\n private scheduleAgeFlush(): void {\n if (this.ageTimer != null) {\n return;\n }\n\n spoolLogger.debug(\"log spool age flush scheduled\", {\n maxAgeMs: this.config.maxAgeMs,\n });\n\n this.ageTimer = setTimeout(() => {\n this.ageTimer = null;\n void this.flushChunk({ reason: \"maxAge\" });\n }, this.config.maxAgeMs);\n this.ageTimer.unref?.();\n }\n\n private cancelDebounce(): void {\n if (this.debounceTimer != null) {\n clearTimeout(this.debounceTimer);\n this.debounceTimer = null;\n }\n }\n\n private cancelAgeFlush(): void {\n if (this.ageTimer != null) {\n clearTimeout(this.ageTimer);\n this.ageTimer = null;\n }\n }\n\n private async flushChunk(input: { reason: string }): Promise<void> {\n if (this.flushInProgress || this.buffer.length === 0) {\n return;\n }\n if (this.serviceId == null || this.processRole == null || this.serviceValue == null || this.spoolRoot == null) {\n return;\n }\n\n this.cancelDebounce();\n this.cancelAgeFlush();\n this.flushInProgress = true;\n try {\n const byCount = this.buffer.slice(0, this.config.maxEntries);\n const entries = takeEntriesWithinBytes(byCount, this.config.maxBytes);\n this.buffer = this.buffer.slice(entries.length);\n\n if (entries.length === 0) {\n if (this.buffer.length > 0) {\n this.scheduleAgeFlush();\n } else {\n this.cancelAgeFlush();\n }\n return;\n }\n\n const batchFile = await this.writeBatchTmp({\n entries,\n serviceId: this.serviceId,\n processRole: this.processRole,\n serviceValue: this.serviceValue,\n spoolRoot: this.spoolRoot,\n });\n\n spoolLogger.info(\"log spool flushed to tmp\", {\n reason: input.reason,\n fileName: batchFile.fileName,\n entryCount: entries.length,\n remainingBuffered: this.buffer.length,\n });\n\n if (this.buffer.length > 0) {\n this.scheduleAgeFlush();\n if (this.shouldScheduleDebouncedFlush()) {\n this.scheduleDebouncedFlush();\n }\n } else {\n this.cancelAgeFlush();\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n spoolLogger.error(\"log spool flush failed\", { reason: input.reason, error: message });\n if (this.buffer.length > 0) {\n this.scheduleAgeFlush();\n }\n } finally {\n this.flushInProgress = false;\n }\n }\n\n private async writeBatchTmp(input: {\n entries: LogEntry[];\n serviceId: string;\n processRole: LogSpoolProcessRole;\n serviceValue: string;\n spoolRoot: string;\n }): Promise<{ fileName: string; tmpPath: string }> {\n const first = input.entries[0];\n const shortHash = computeLogSpoolShortHash({\n serviceValue: input.serviceValue,\n serviceId: input.serviceId,\n processRole: input.processRole,\n entries: input.entries,\n });\n const baseName = buildLogSpoolBatchBaseName({\n processRole: input.processRole,\n firstEntryTimestamp: first.timestamp,\n shortHash,\n });\n const fileName = `${baseName}.tmp`;\n const processDir = logSpoolProcessDir(input.spoolRoot, input.serviceId, input.processRole);\n await mkdir(processDir, { recursive: true });\n\n const tmpPath = join(processDir, fileName);\n const partPath = `${tmpPath}.part`;\n const payload: LogSpoolBatchFile = {\n entries: input.entries,\n meta: {\n serviceId: input.serviceId,\n processRole: input.processRole,\n serviceValue: input.serviceValue,\n },\n };\n const content = `${JSON.stringify(payload)}\\n`;\n\n await writeFile(partPath, content, \"utf8\");\n await rename(partPath, tmpPath);\n\n return { fileName, tmpPath };\n }\n}\n\nexport { LogSpoolWriter };\n\nexport async function enableLogSpoolWriter(options: EnableLogSpoolOptions): Promise<void> {\n await LogSpoolWriter.getInstance().enable(options);\n}\n\nexport async function shutdownLogSpoolWriter(): Promise<void> {\n await LogSpoolWriter.getInstance().shutdown();\n}\n\nexport function getLogSpoolWriterStats(): LogSpoolWriterStats {\n return LogSpoolWriter.getInstance().getStats();\n}\n","import { createLogger } from \"../core/create-logger\";\nimport { logPersistProcessFromEnv, logPersistServiceFromEnv, logSpoolEnabledFromEnv } from \"../upload/env\";\nimport { registerLogPersistOffer } from \"../upload/hook\";\nimport { LOG_PERSIST_TOPIC } from \"../upload/logger\";\nimport { LOG_SPOOL_SERVICE_ID_ENV, logSpoolConfigFromEnv, logSpoolServiceIdFromEnv } from \"./config\";\nimport type { EnsureLogSpoolFromEnvOptions, LogSpoolProcessRole } from \"./interface\";\nimport { resolveLogSpoolRoot } from \"./paths\";\nimport {\n assertValidLogSpoolExtraProcessRole,\n isKnownLogSpoolProcessRole,\n LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV,\n} from \"./process-roles\";\nimport { enableLogSpoolWriter, getLogSpoolWriterStats, shutdownLogSpoolWriter } from \"./writer\";\n\nexport { logSpoolEnabledFromEnv };\n\nexport function resolveLogSpoolProcessRole(explicit?: string): LogSpoolProcessRole {\n const raw = explicit ?? logPersistProcessFromEnv();\n if (raw == null || raw === \"\") {\n throw new Error(\"[LogSpool] LOG_PERSIST_PROCESS is required when LOG_PERSIST_ENABLED=true\");\n }\n if (!isKnownLogSpoolProcessRole(raw)) {\n throw new Error(\n `[LogSpool] invalid LOG_PERSIST_PROCESS: ${raw} (not a core role and not listed in ${LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV})`,\n );\n }\n return raw;\n}\n\n/**\n * Env vars for child spawn after main claims registry slot.\n * Optional when using {@link ManagedChildProcesses.spawn} — auto-injected from parent env.\n */\nexport function buildLogSpoolSpawnEnv(input: {\n serviceId: string;\n processRole: LogSpoolProcessRole;\n}): Record<string, string> {\n return {\n [LOG_SPOOL_SERVICE_ID_ENV]: input.serviceId,\n LOG_PERSIST_PROCESS: input.processRole,\n };\n}\n\n/**\n * When persistence is enabled and parent has `LOG_SPOOL_SERVICE_ID`, map spawn `label`\n * to spool env when `label` is a known core or extra process role.\n */\nexport function resolveLogSpoolSpawnEnvForLabel(\n label: string,\n env: NodeJS.ProcessEnv = process.env,\n): Record<string, string> {\n if (!logSpoolEnabledFromEnv(env)) {\n return {};\n }\n const serviceId = env[LOG_SPOOL_SERVICE_ID_ENV]?.trim();\n if (serviceId == null || serviceId === \"\") {\n return {};\n }\n if (!isKnownLogSpoolProcessRole(label, env)) {\n return {};\n }\n return buildLogSpoolSpawnEnv({ serviceId, processRole: label });\n}\n\nexport async function ensureLogSpoolFromEnv(options: EnsureLogSpoolFromEnvOptions = {}): Promise<boolean> {\n if (!logSpoolEnabledFromEnv()) {\n registerLogPersistOffer(null);\n return false;\n }\n\n const serviceId = options.serviceId ?? logSpoolServiceIdFromEnv();\n const serviceValue = options.serviceValue ?? logPersistServiceFromEnv();\n const processRole = resolveLogSpoolProcessRole(options.processRole);\n\n if (serviceId == null || serviceId === \"\") {\n throw new Error(\n \"[LogSpool] LOG_SPOOL_SERVICE_ID is required when LOG_PERSIST_ENABLED=true (set after registry claim or pass serviceId)\",\n );\n }\n if (serviceValue == null || serviceValue === \"\") {\n throw new Error(\"[LogSpool] LOG_PERSIST_SERVICE is required when LOG_PERSIST_ENABLED=true\");\n }\n\n const spoolRoot = options.spoolRoot ?? resolveLogSpoolRoot();\n\n await enableLogSpoolWriter({\n serviceId,\n processRole,\n serviceValue,\n spoolRoot,\n config: options.config ?? logSpoolConfigFromEnv(),\n });\n\n const lifecycleLogger = createLogger({ module: \"log-spool\" });\n lifecycleLogger.info(\"log spool enabled from env\", {\n topic: LOG_PERSIST_TOPIC,\n data: { serviceId, processRole, serviceValue, spoolRoot },\n });\n\n return true;\n}\n\nexport async function shutdownLogSpoolFromEnv(): Promise<void> {\n await shutdownLogSpoolWriter();\n}\n\nexport function getLogSpoolStats(): ReturnType<typeof getLogSpoolWriterStats> {\n return getLogSpoolWriterStats();\n}\n\nexport function validateLogSpoolPreloadEnv(env: NodeJS.ProcessEnv = process.env): void {\n if (!logSpoolEnabledFromEnv(env)) {\n return;\n }\n\n const missing: string[] = [];\n if (env.LOG_PERSIST_SERVICE?.trim() == null || env.LOG_PERSIST_SERVICE.trim() === \"\") {\n missing.push(\"LOG_PERSIST_SERVICE\");\n }\n const runtimeDir = env.LOG_PERSIST_REGISTRY_DIR?.trim() || env.RUNTIME_DATA_DIR?.trim();\n if (runtimeDir == null || runtimeDir === \"\") {\n missing.push(\"LOG_PERSIST_REGISTRY_DIR or RUNTIME_DATA_DIR\");\n }\n\n if (missing.length > 0) {\n throw new Error(`[LogSpool] preload env incomplete: ${missing.join(\", \")}`);\n }\n\n for (const role of env[LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV]?.split(\",\") ?? []) {\n const trimmed = role.trim();\n if (trimmed === \"\") {\n continue;\n }\n assertValidLogSpoolExtraProcessRole(trimmed);\n }\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,KA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,CAAC,IAAI,CAAC,CAAA,CAAE,CAAC;IAC/E;AAEA,IAAA,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,iCAAiC,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE;AACzE,QAAA,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE;AAC3B,QAAA,IAAI,OAAO,KAAK,EAAE,EAAE;YAChB;QACJ;QACA,mCAAmC,CAAC,OAAO,CAAC;IAChD;AACJ;;;;"}
|
|
@@ -384,6 +384,9 @@ function buildListTargetDraft(input) {
|
|
|
384
384
|
};
|
|
385
385
|
}
|
|
386
386
|
|
|
387
|
+
/** Shared log topic for Node domain APIs and {@link BaseNodeRuntime}. */
|
|
388
|
+
const LOG_TOPIC_NODE = "node";
|
|
389
|
+
|
|
387
390
|
var NodeStatus;
|
|
388
391
|
(function (NodeStatus) {
|
|
389
392
|
/** Registered, not yet in worker loop. */
|
|
@@ -403,7 +406,6 @@ var CategoryNode;
|
|
|
403
406
|
})(CategoryNode || (CategoryNode = {}));
|
|
404
407
|
|
|
405
408
|
const NODE_STATUS_FIELD = "details->>status";
|
|
406
|
-
const LOG_TOPIC_NODE = "node";
|
|
407
409
|
const nodeIdSchema$1 = z.string().trim().min(1);
|
|
408
410
|
const traceIdSchema$2 = z.string().trim().min(1).optional();
|
|
409
411
|
// ─── Zod schemas ─────────────────────────────────────────────────────────────
|
|
@@ -3284,5 +3286,5 @@ function summarizeTaskQueue(tasks, taskType, statuses) {
|
|
|
3284
3286
|
return tasks.filter((task) => task.value === taskType && statuses.includes(task.details.status)).length;
|
|
3285
3287
|
}
|
|
3286
3288
|
|
|
3287
|
-
export { getApiSchema as $, ApiMethod as A, createActiveServiceLifecycle as B, CategoryConfig as C, DEFAULT_SYSTEM_REGISTRY_SEED_SLOTS as D, EMPTY_REGISTRY_SLOT_RUNTIME_STATE as E, createClaimedRegistrySlotRuntimeState as F, createStorageProviderRegistry as G, createUploadTracker as H, decodeLogBatch as I, decodeLogBatchList as J, defaultL3ServiceDetails as K, LINK_MANIFEST_VERSION as L, deleteParcel as M, NodeStatus as N, deleteParcelSchema as O, POST_TASK_DEFAULT_MAX_ATTEMPTS as P, evaluateBusyNodeLiveness as Q, ResultCode as R, ServiceLifecycleStatus as S, TARGET_SYSTEM_REGISTRY_KEY as T, fetchBinaryWithRetry as U, fetchWithRetry as V, fieldDefinitionSchema as W, flattenLogBatch as X, flattenLogBatches as Y, formatNetworkError as Z, getApi as _, CategoryExtraction as a, releaseSystemRegistrySlotsByServiceId as a$, getConfig as a0, getConfigSchema as a1, getExtraction as a2, getExtractionSchema as a3, getParcel as a4, getParcelSchema as a5, getScanRemoteRepoValues as a6, getScanRemoteRepoValuesSchema as a7, getService as a8, getServiceSchema as a9, patchStopNode as aA, patchStopNodeSchema as aB, patchTaskProgress as aC, patchTaskProgressSchema as aD, postApi as aE, postApiSchema as aF, postExtraction as aG, postExtractionSchema as aH, postLinkCreate as aI, postParcel as aJ, postParcelSchema as aK, postRegisterNode as aL, postRegisterNodeSchema as aM, postService as aN, postServiceInstance as aO, postServiceSchema as aP, postSystemRegistryConfig as aQ, postSystemRegistryConfigSchema as aR, postTask as aS, postTaskSchema as aT, postTaskWithRetry as aU, publishParcel as aV, registerProviderChunkResolver as aW, registerService as aX, registerServiceAtStartup as aY, registrySlotRuntimePatchFromGuardResult as aZ, releaseSystemRegistrySlots as a_, getTargetSystemRegistry as aa, getValueAtPath as ab, installChunkFetchRegistry as ac, isHttpUrl as ad, isLocalFilesystemPath as ae, isLogBatchList as af, isLogEntry as ag, isOpaqueChunkUrl as ah, isRetryableHttpStatus as ai, linkTargetDraftBuildInputSchema as aj, parcelDetailsSchema as ak, parseLogBatchMeta as al, parseProviderPrefixedUrl as am, parseServiceSlot as an, parseServiceSlots as ao, patchChangeNodeStatus as ap, patchChangeNodeStatusSchema as aq, patchChangeTaskStatus as ar, patchChangeTaskStatusSchema as as, patchClaimTask as at, patchClaimTaskSchema as au, patchExtractionObjects as av, patchExtractionObjectsSchema as aw, patchNodeHeartBeat as ax, patchNodeHeartBeatSchema as ay, patchServiceRuntime as az, CategoryLink as b, requestHasBody as b0, resetSystemRegistryConfig as b1, resetSystemRegistryConfigSchema as b2, resolveActiveRegistryServiceId as b3, resolveFetchUrl as b4, restoreParcel as b5, restoreParcelById as b6, runRegistrySlotGuardCheck as b7, sanitizeFileName as b8, sanitizeParcelFileName as b9, scanExtractionList as ba, scanExtractionListSchema as bb, schemaDefinitionSchema as bc, serviceDetailsSchema as bd, serviceLifecycleSchema as be, serviceNodeSnapshotSchema as bf, serviceRuntimeSchema as bg, sha256Hex as bh, summarizeTaskQueue as bi, systemRegistrySeedSlotSchema as bj, unregisterService as bk, unregisterServiceAtShutdown as bl, getErrorMessage as bm,
|
|
3288
|
-
//# sourceMappingURL=task-queue-
|
|
3289
|
+
export { getApiSchema as $, ApiMethod as A, createActiveServiceLifecycle as B, CategoryConfig as C, DEFAULT_SYSTEM_REGISTRY_SEED_SLOTS as D, EMPTY_REGISTRY_SLOT_RUNTIME_STATE as E, createClaimedRegistrySlotRuntimeState as F, createStorageProviderRegistry as G, createUploadTracker as H, decodeLogBatch as I, decodeLogBatchList as J, defaultL3ServiceDetails as K, LINK_MANIFEST_VERSION as L, deleteParcel as M, NodeStatus as N, deleteParcelSchema as O, POST_TASK_DEFAULT_MAX_ATTEMPTS as P, evaluateBusyNodeLiveness as Q, ResultCode as R, ServiceLifecycleStatus as S, TARGET_SYSTEM_REGISTRY_KEY as T, fetchBinaryWithRetry as U, fetchWithRetry as V, fieldDefinitionSchema as W, flattenLogBatch as X, flattenLogBatches as Y, formatNetworkError as Z, getApi as _, CategoryExtraction as a, releaseSystemRegistrySlotsByServiceId as a$, getConfig as a0, getConfigSchema as a1, getExtraction as a2, getExtractionSchema as a3, getParcel as a4, getParcelSchema as a5, getScanRemoteRepoValues as a6, getScanRemoteRepoValuesSchema as a7, getService as a8, getServiceSchema as a9, patchStopNode as aA, patchStopNodeSchema as aB, patchTaskProgress as aC, patchTaskProgressSchema as aD, postApi as aE, postApiSchema as aF, postExtraction as aG, postExtractionSchema as aH, postLinkCreate as aI, postParcel as aJ, postParcelSchema as aK, postRegisterNode as aL, postRegisterNodeSchema as aM, postService as aN, postServiceInstance as aO, postServiceSchema as aP, postSystemRegistryConfig as aQ, postSystemRegistryConfigSchema as aR, postTask as aS, postTaskSchema as aT, postTaskWithRetry as aU, publishParcel as aV, registerProviderChunkResolver as aW, registerService as aX, registerServiceAtStartup as aY, registrySlotRuntimePatchFromGuardResult as aZ, releaseSystemRegistrySlots as a_, getTargetSystemRegistry as aa, getValueAtPath as ab, installChunkFetchRegistry as ac, isHttpUrl as ad, isLocalFilesystemPath as ae, isLogBatchList as af, isLogEntry as ag, isOpaqueChunkUrl as ah, isRetryableHttpStatus as ai, linkTargetDraftBuildInputSchema as aj, parcelDetailsSchema as ak, parseLogBatchMeta as al, parseProviderPrefixedUrl as am, parseServiceSlot as an, parseServiceSlots as ao, patchChangeNodeStatus as ap, patchChangeNodeStatusSchema as aq, patchChangeTaskStatus as ar, patchChangeTaskStatusSchema as as, patchClaimTask as at, patchClaimTaskSchema as au, patchExtractionObjects as av, patchExtractionObjectsSchema as aw, patchNodeHeartBeat as ax, patchNodeHeartBeatSchema as ay, patchServiceRuntime as az, CategoryLink as b, requestHasBody as b0, resetSystemRegistryConfig as b1, resetSystemRegistryConfigSchema as b2, resolveActiveRegistryServiceId as b3, resolveFetchUrl as b4, restoreParcel as b5, restoreParcelById as b6, runRegistrySlotGuardCheck as b7, sanitizeFileName as b8, sanitizeParcelFileName as b9, scanExtractionList as ba, scanExtractionListSchema as bb, schemaDefinitionSchema as bc, serviceDetailsSchema as bd, serviceLifecycleSchema as be, serviceNodeSnapshotSchema as bf, serviceRuntimeSchema as bg, sha256Hex as bh, summarizeTaskQueue as bi, systemRegistrySeedSlotSchema as bj, unregisterService as bk, unregisterServiceAtShutdown as bl, getErrorMessage as bm, LOG_TOPIC_NODE as bn, LOG_TOPIC_TASK as bo, CRITICAL_UNKNOWN_TASK_TRACE_ID as bp, toError as bq, createTaskRow as br, CategoryNode as c, CategoryParcel as d, CategoryRepo as e, CategoryService as f, CategoryTask as g, LIST_MANIFEST_VERSION as h, ParcelManager as i, PostLinkValidator as j, ServiceRegistryError as k, ServiceSlotStatus as l, TASK_REPO_USAGE as m, TaskStatus as n, TaskStatusAction as o, apiDetailsSchema as p, appendSystemRegistrySlots as q, assertRegistrySlotAvailable as r, assertRegistrySlotOwner as s, buildEmptyServiceSlots as t, buildLinkTargetDraft as u, buildListTargetDraft as v, buildSystemRegistryConfigDetails as w, claimServiceRegistrySlot as x, classifyNetworkError as y, countTasksByType as z };
|
|
3290
|
+
//# sourceMappingURL=task-queue-qSnsfiIg.js.map
|