@lunora/config 1.0.0-alpha.172 → 1.0.0-alpha.174

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/index.d.mts CHANGED
@@ -250,6 +250,15 @@ declare const DEV_STATE_DIR = ".lunora";
250
250
  declare const DEV_STATE_FILE: string;
251
251
  /** Log file a backgrounded dev server's output is captured to, relative to the project root. */
252
252
  declare const DEV_LOG_FILE: string;
253
+ /**
254
+ * Where `lunora dev` writes the binding manifest by default, relative to the
255
+ * project root.
256
+ *
257
+ * A fixed path so a supervisor can read it without being told one, and next to
258
+ * the state record because the two are read together: this says what the Worker
259
+ * needs and where it will serve, `dev.json` says whether it is serving yet.
260
+ */
261
+ declare const DEV_BINDINGS_FILE: string;
253
262
  /**
254
263
  * Marker env `lunora dev --background` sets on the detached server process
255
264
  * (the daemon `lunora dev` or `vite dev`), so it records itself as
@@ -281,6 +290,27 @@ interface DevServerState {
281
290
  mode: DevServerMode;
282
291
  /** PID of the process to signal for shutdown (the orchestrating CLI or the Vite process). */
283
292
  pid: number;
293
+ /**
294
+ * ISO-8601 stamp marking when the server at {@link DevServerState.url} was
295
+ * first observed accepting requests — absent until then.
296
+ *
297
+ * The rest of this record exists as soon as the server is STARTING: `url` is
298
+ * the origin it intends to serve on and `pid` is a process that exists, both
299
+ * written before anything is listening. That is enough to find and stop a
300
+ * server, and not enough for a task runner deciding when to start the next
301
+ * thing — which is what this field is for. Poll it rather than sleeping.
302
+ *
303
+ * Deliberately a claim about `url` and nothing else. `lunora dev` observes it
304
+ * by probing; `@lunora/vite` observes it from the listen callback, since its
305
+ * record is only written once Vite has resolved that URL. Both are honest
306
+ * about the one origin this record advertises — neither says anything about a
307
+ * sidecar on another port.
308
+ *
309
+ * Absent forever is a legitimate outcome: a server that never binds, or one
310
+ * slower than the probe was willing to wait. Treat missing as "not ready
311
+ * yet", never as "will never be ready".
312
+ */
313
+ readyAt?: string;
284
314
  /** ISO-8601 stamp written at startup, purely informational (drives `status` uptime). */
285
315
  startedAt?: string;
286
316
  /** The embedded studio server's URL, when it runs. */
@@ -325,8 +355,22 @@ declare const writeDevServerState: (projectRoot: string, state: DevServerState)
325
355
  * Merge `patch` into the existing state record, when one exists. Used by the
326
356
  * CLI to stamp `background`/`logFile` onto the record the Vite plugin wrote.
327
357
  * Returns the merged record, or `undefined` when there was nothing to update.
358
+ *
359
+ * Pass `expectedPid` to patch only while the record still belongs to that
360
+ * process — the counterpart to {@link clearDevServerState}'s guard, and needed
361
+ * by any patch that can land LATE. A readiness stamp is the case in point: this
362
+ * process's server can answer after a newer one has replaced the record, and an
363
+ * unguarded merge would mark that newer server ready on the old one's behalf.
364
+ */
365
+ declare const updateDevServerState: (projectRoot: string, patch: Partial<DevServerState>, options?: {
366
+ expectedPid?: number;
367
+ }) => DevServerState | undefined;
368
+ /**
369
+ * Whether a record reports a server that is accepting requests, as opposed to
370
+ * one that has merely started. Lives here so the CLI's `status`, its JSON
371
+ * output, and any future reader cannot each invent their own answer.
328
372
  */
329
- declare const updateDevServerState: (projectRoot: string, patch: Partial<DevServerState>) => DevServerState | undefined;
373
+ declare const isDevServerReady: (state: Pick<DevServerState, "readyAt"> | undefined) => boolean;
330
374
  /**
331
375
  * Remove `.lunora/dev.json`. Idempotent and never throws. When `expectedPid`
332
376
  * is given, the file is only removed while it still records that PID — so a
@@ -1213,4 +1257,4 @@ declare const badgeWidth: (_spec: BadgeSpec) => number;
1213
1257
  declare const paintBadge: (spec: BadgeSpec) => string;
1214
1258
  /** Dim continuation text (a step's chosen answer, shown under the question). */
1215
1259
  declare const paintAnswer: (text: string) => string;
1216
- export { ACCENT, AGENT_MODE_ENV, AGENT_RULES_DIR, AGENT_RULES_HINT, AGENT_RULES_HINT_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentDetection, type AgentRulesStatus, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, BADGES, BADGE_COLUMN_WIDTH, type BadgeName, type BadgeSpec, CODEGEN_ENV, type ClaimDevServerStateResult, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEFAULT_DEPLOY_TARGET, DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, type DeployDriver, type DestructiveEdit, type DetectedFramework, type DevSecretsFillPlan, type DevServerMode, type DevServerState, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type FillDevSecretsResult, type FrameworkClass, type FrameworkDetection, type HookLogger, type HookSpawnDescriptor, type HookSpawner, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNA_ART, LUNA_BUNNY, LUNA_NAME, LUNA_SIGNOFF, LUNORA_CONFIG_FILE, LUNORA_EVENT_SOURCE, LUNORA_IGNORED_PATHS, LUNORA_SKILL_NAMES, type LevelBadgeName, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LunoraFormattedLine, type LunoraLineLevel, type LunoraProjectConfig, LunoraReporter, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type PackageManager, type PackageManagerProbe, type ParseSchemaResult, type PostCodegenHookResult, ROOT_SKILL_NAME, type RemotePreference, STEP_BADGE_NAMES, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, type StepBadgeName, addArgsFor, applyAdditiveEdit, applyLintIgnores, badgeLead, badgeWidth, buildPackageSecretsBlock, claimAgentRulesHint, claimDevServerState, classifyEdit, clearDevServerState, createConfirm, deployTargetIds, detectAgentRules, detectAiAgent, detectFramework, detectInstalledManagers, detectLintTools, detectPackageManager, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, escapeRegExp, execArgsFor, fillDevSecrets, formatLunoraEvent, generateSecretValue, installArgsFor, interpretRemote, isCodegenDisabled, isInteractive, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, padBadge, paintAnswer, paintBadge, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, promptMultiSelect, promptSelect, promptText, promptYesNo, readDevServerState, readLinkedProject, readLiveDevServerState, readProjectDependencyNames, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, requiredSecrets, resolveDeployDriver, resolveProjectTarget, resolveTargetOrThrow, runPostCodegenHook, runScriptArgsFor, runScriptCommand, secretsForPackages, streamContainerLogs, updateDevServerState, upsertDevVariableLine, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
1260
+ export { ACCENT, AGENT_MODE_ENV, AGENT_RULES_DIR, AGENT_RULES_HINT, AGENT_RULES_HINT_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentDetection, type AgentRulesStatus, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, BADGES, BADGE_COLUMN_WIDTH, type BadgeName, type BadgeSpec, CODEGEN_ENV, type ClaimDevServerStateResult, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEFAULT_DEPLOY_TARGET, DEV_BINDINGS_FILE, DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, type DeployDriver, type DestructiveEdit, type DetectedFramework, type DevSecretsFillPlan, type DevServerMode, type DevServerState, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type FillDevSecretsResult, type FrameworkClass, type FrameworkDetection, type HookLogger, type HookSpawnDescriptor, type HookSpawner, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNA_ART, LUNA_BUNNY, LUNA_NAME, LUNA_SIGNOFF, LUNORA_CONFIG_FILE, LUNORA_EVENT_SOURCE, LUNORA_IGNORED_PATHS, LUNORA_SKILL_NAMES, type LevelBadgeName, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LunoraFormattedLine, type LunoraLineLevel, type LunoraProjectConfig, LunoraReporter, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type PackageManager, type PackageManagerProbe, type ParseSchemaResult, type PostCodegenHookResult, ROOT_SKILL_NAME, type RemotePreference, STEP_BADGE_NAMES, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, type StepBadgeName, addArgsFor, applyAdditiveEdit, applyLintIgnores, badgeLead, badgeWidth, buildPackageSecretsBlock, claimAgentRulesHint, claimDevServerState, classifyEdit, clearDevServerState, createConfirm, deployTargetIds, detectAgentRules, detectAiAgent, detectFramework, detectInstalledManagers, detectLintTools, detectPackageManager, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, escapeRegExp, execArgsFor, fillDevSecrets, formatLunoraEvent, generateSecretValue, installArgsFor, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, padBadge, paintAnswer, paintBadge, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, promptMultiSelect, promptSelect, promptText, promptYesNo, readDevServerState, readLinkedProject, readLiveDevServerState, readProjectDependencyNames, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, requiredSecrets, resolveDeployDriver, resolveProjectTarget, resolveTargetOrThrow, runPostCodegenHook, runScriptArgsFor, runScriptCommand, secretsForPackages, streamContainerLogs, updateDevServerState, upsertDevVariableLine, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
package/dist/index.d.ts CHANGED
@@ -250,6 +250,15 @@ declare const DEV_STATE_DIR = ".lunora";
250
250
  declare const DEV_STATE_FILE: string;
251
251
  /** Log file a backgrounded dev server's output is captured to, relative to the project root. */
252
252
  declare const DEV_LOG_FILE: string;
253
+ /**
254
+ * Where `lunora dev` writes the binding manifest by default, relative to the
255
+ * project root.
256
+ *
257
+ * A fixed path so a supervisor can read it without being told one, and next to
258
+ * the state record because the two are read together: this says what the Worker
259
+ * needs and where it will serve, `dev.json` says whether it is serving yet.
260
+ */
261
+ declare const DEV_BINDINGS_FILE: string;
253
262
  /**
254
263
  * Marker env `lunora dev --background` sets on the detached server process
255
264
  * (the daemon `lunora dev` or `vite dev`), so it records itself as
@@ -281,6 +290,27 @@ interface DevServerState {
281
290
  mode: DevServerMode;
282
291
  /** PID of the process to signal for shutdown (the orchestrating CLI or the Vite process). */
283
292
  pid: number;
293
+ /**
294
+ * ISO-8601 stamp marking when the server at {@link DevServerState.url} was
295
+ * first observed accepting requests — absent until then.
296
+ *
297
+ * The rest of this record exists as soon as the server is STARTING: `url` is
298
+ * the origin it intends to serve on and `pid` is a process that exists, both
299
+ * written before anything is listening. That is enough to find and stop a
300
+ * server, and not enough for a task runner deciding when to start the next
301
+ * thing — which is what this field is for. Poll it rather than sleeping.
302
+ *
303
+ * Deliberately a claim about `url` and nothing else. `lunora dev` observes it
304
+ * by probing; `@lunora/vite` observes it from the listen callback, since its
305
+ * record is only written once Vite has resolved that URL. Both are honest
306
+ * about the one origin this record advertises — neither says anything about a
307
+ * sidecar on another port.
308
+ *
309
+ * Absent forever is a legitimate outcome: a server that never binds, or one
310
+ * slower than the probe was willing to wait. Treat missing as "not ready
311
+ * yet", never as "will never be ready".
312
+ */
313
+ readyAt?: string;
284
314
  /** ISO-8601 stamp written at startup, purely informational (drives `status` uptime). */
285
315
  startedAt?: string;
286
316
  /** The embedded studio server's URL, when it runs. */
@@ -325,8 +355,22 @@ declare const writeDevServerState: (projectRoot: string, state: DevServerState)
325
355
  * Merge `patch` into the existing state record, when one exists. Used by the
326
356
  * CLI to stamp `background`/`logFile` onto the record the Vite plugin wrote.
327
357
  * Returns the merged record, or `undefined` when there was nothing to update.
358
+ *
359
+ * Pass `expectedPid` to patch only while the record still belongs to that
360
+ * process — the counterpart to {@link clearDevServerState}'s guard, and needed
361
+ * by any patch that can land LATE. A readiness stamp is the case in point: this
362
+ * process's server can answer after a newer one has replaced the record, and an
363
+ * unguarded merge would mark that newer server ready on the old one's behalf.
364
+ */
365
+ declare const updateDevServerState: (projectRoot: string, patch: Partial<DevServerState>, options?: {
366
+ expectedPid?: number;
367
+ }) => DevServerState | undefined;
368
+ /**
369
+ * Whether a record reports a server that is accepting requests, as opposed to
370
+ * one that has merely started. Lives here so the CLI's `status`, its JSON
371
+ * output, and any future reader cannot each invent their own answer.
328
372
  */
329
- declare const updateDevServerState: (projectRoot: string, patch: Partial<DevServerState>) => DevServerState | undefined;
373
+ declare const isDevServerReady: (state: Pick<DevServerState, "readyAt"> | undefined) => boolean;
330
374
  /**
331
375
  * Remove `.lunora/dev.json`. Idempotent and never throws. When `expectedPid`
332
376
  * is given, the file is only removed while it still records that PID — so a
@@ -1213,4 +1257,4 @@ declare const badgeWidth: (_spec: BadgeSpec) => number;
1213
1257
  declare const paintBadge: (spec: BadgeSpec) => string;
1214
1258
  /** Dim continuation text (a step's chosen answer, shown under the question). */
1215
1259
  declare const paintAnswer: (text: string) => string;
1216
- export { ACCENT, AGENT_MODE_ENV, AGENT_RULES_DIR, AGENT_RULES_HINT, AGENT_RULES_HINT_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentDetection, type AgentRulesStatus, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, BADGES, BADGE_COLUMN_WIDTH, type BadgeName, type BadgeSpec, CODEGEN_ENV, type ClaimDevServerStateResult, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEFAULT_DEPLOY_TARGET, DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, type DeployDriver, type DestructiveEdit, type DetectedFramework, type DevSecretsFillPlan, type DevServerMode, type DevServerState, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type FillDevSecretsResult, type FrameworkClass, type FrameworkDetection, type HookLogger, type HookSpawnDescriptor, type HookSpawner, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNA_ART, LUNA_BUNNY, LUNA_NAME, LUNA_SIGNOFF, LUNORA_CONFIG_FILE, LUNORA_EVENT_SOURCE, LUNORA_IGNORED_PATHS, LUNORA_SKILL_NAMES, type LevelBadgeName, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LunoraFormattedLine, type LunoraLineLevel, type LunoraProjectConfig, LunoraReporter, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type PackageManager, type PackageManagerProbe, type ParseSchemaResult, type PostCodegenHookResult, ROOT_SKILL_NAME, type RemotePreference, STEP_BADGE_NAMES, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, type StepBadgeName, addArgsFor, applyAdditiveEdit, applyLintIgnores, badgeLead, badgeWidth, buildPackageSecretsBlock, claimAgentRulesHint, claimDevServerState, classifyEdit, clearDevServerState, createConfirm, deployTargetIds, detectAgentRules, detectAiAgent, detectFramework, detectInstalledManagers, detectLintTools, detectPackageManager, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, escapeRegExp, execArgsFor, fillDevSecrets, formatLunoraEvent, generateSecretValue, installArgsFor, interpretRemote, isCodegenDisabled, isInteractive, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, padBadge, paintAnswer, paintBadge, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, promptMultiSelect, promptSelect, promptText, promptYesNo, readDevServerState, readLinkedProject, readLiveDevServerState, readProjectDependencyNames, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, requiredSecrets, resolveDeployDriver, resolveProjectTarget, resolveTargetOrThrow, runPostCodegenHook, runScriptArgsFor, runScriptCommand, secretsForPackages, streamContainerLogs, updateDevServerState, upsertDevVariableLine, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
1260
+ export { ACCENT, AGENT_MODE_ENV, AGENT_RULES_DIR, AGENT_RULES_HINT, AGENT_RULES_HINT_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentDetection, type AgentRulesStatus, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, BADGES, BADGE_COLUMN_WIDTH, type BadgeName, type BadgeSpec, CODEGEN_ENV, type ClaimDevServerStateResult, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEFAULT_DEPLOY_TARGET, DEV_BINDINGS_FILE, DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, type DeployDriver, type DestructiveEdit, type DetectedFramework, type DevSecretsFillPlan, type DevServerMode, type DevServerState, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type FillDevSecretsResult, type FrameworkClass, type FrameworkDetection, type HookLogger, type HookSpawnDescriptor, type HookSpawner, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNA_ART, LUNA_BUNNY, LUNA_NAME, LUNA_SIGNOFF, LUNORA_CONFIG_FILE, LUNORA_EVENT_SOURCE, LUNORA_IGNORED_PATHS, LUNORA_SKILL_NAMES, type LevelBadgeName, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LunoraFormattedLine, type LunoraLineLevel, type LunoraProjectConfig, LunoraReporter, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type PackageManager, type PackageManagerProbe, type ParseSchemaResult, type PostCodegenHookResult, ROOT_SKILL_NAME, type RemotePreference, STEP_BADGE_NAMES, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, type StepBadgeName, addArgsFor, applyAdditiveEdit, applyLintIgnores, badgeLead, badgeWidth, buildPackageSecretsBlock, claimAgentRulesHint, claimDevServerState, classifyEdit, clearDevServerState, createConfirm, deployTargetIds, detectAgentRules, detectAiAgent, detectFramework, detectInstalledManagers, detectLintTools, detectPackageManager, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, escapeRegExp, execArgsFor, fillDevSecrets, formatLunoraEvent, generateSecretValue, installArgsFor, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, padBadge, paintAnswer, paintBadge, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, promptMultiSelect, promptSelect, promptText, promptYesNo, readDevServerState, readLinkedProject, readLiveDevServerState, readProjectDependencyNames, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, requiredSecrets, resolveDeployDriver, resolveProjectTarget, resolveTargetOrThrow, runPostCodegenHook, runScriptArgsFor, runScriptCommand, secretsForPackages, streamContainerLogs, updateDevServerState, upsertDevVariableLine, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as i}from"./packem_shared/discoverAgentInfo-CTdCSfYM.mjs";import{AGENT_RULES_DIR as s,AGENT_RULES_HINT as p,AGENT_RULES_HINT_ENV as n,LUNORA_SKILL_NAMES as l,ROOT_SKILL_NAME as _,claimAgentRulesHint as c,detectAgentRules as d}from"./packem_shared/AGENT_RULES_DIR-3-Sx1gHU.mjs";import{CODEGEN_ENV as A,isCodegenDisabled as D}from"./packem_shared/CODEGEN_ENV-ZsCxV1kP.mjs";import{discoverContainerInfo as f}from"./packem_shared/discoverContainerInfo-EhZtEBQs.mjs";import{streamContainerLogs as N}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as T,readProjectDependencyNames as R}from"./packem_shared/detectFramework-DOn4PtpP.mjs";import{DEV_DAEMON_ENV as x,DEV_HANDOFF_ENV as I,DEV_LOG_FILE as V,DEV_LOG_FILE_ENV as P,DEV_STATE_DIR as F,DEV_STATE_FILE as u,claimDevServerState as O,clearDevServerState as C,isProcessAlive as G,isRecordedProcessCurrent as U,readDevServerState as b,readLiveDevServerState as M,updateDevServerState as y,writeDevServerState as k}from"./packem_shared/DEV_DAEMON_ENV-e1mJUd1-.mjs";import{DEV_VARS_EXAMPLE_FILE as w,DEV_VARS_FILE as H,DEV_VARS_KEY_PATTERN as K,escapeRegExp as j,parseDevVariableEntries as h,removeDevVariableLine as Y,upsertDevVariableLine as W}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEFAULT_DEPLOY_TARGET as q,deployTargetIds as X,resolveDeployDriver as z}from"./packem_shared/DEFAULT_DEPLOY_TARGET-dS2wApDX.mjs";import{inferLunoraBindings as Z,packageNamesFromBindings as $}from"./packem_shared/inferLunoraBindings-KST9XCEe.mjs";import{LINKED_PROJECT_DIR as re,LINKED_PROJECT_FILE as oe,readLinkedProject as te,writeLinkedProject as ae}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as Ee,applyLintIgnores as se,detectLintTools as pe}from"./packem_shared/LUNORA_IGNORED_PATHS-BGbVUqw_.mjs";import{LUNORA_EVENT_SOURCE as le,formatLunoraEvent as _e}from"./packem_shared/LUNORA_EVENT_SOURCE-DYdcDU9G.mjs";import{default as de}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as Ae,detectInstalledManagers as De,detectPackageManager as Se,execArgsFor as fe,installArgsFor as Le,runScriptArgsFor as Ne,runScriptCommand as ve}from"./packem_shared/addArgsFor-B4D4zvM0.mjs";import{PACKAGE_SECRETS_REGISTRY as Re,secretsForPackages as ge}from"./packem_shared/PACKAGE_SECRETS_REGISTRY-BgmvEPA-.mjs";import{runPostCodegenHook as Ie}from"./packem_shared/runPostCodegenHook-BF3XTBFz.mjs";import{LUNORA_CONFIG_FILE as Pe,interpretRemote as Fe,readProjectRemotePreference as ue,readProjectTarget as Oe,resolveProjectTarget as Ce,resolveTargetOrThrow as Ge}from"./packem_shared/LUNORA_CONFIG_FILE-GOH3iIA4.mjs";import{createConfirm as be,isInteractive as Me,promptMultiSelect as ye,promptSelect as ke,promptText as Be,promptYesNo as we}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{buildPackageSecretsBlock as Ke,ensureDevVariables as je,ensureDevVarsExample as he,fillDevSecrets as Ye,generateSecretValue as We,isMintableSecretKey as Je,isPlaceholderValue as qe,planDevSecretsFill as Xe,planDevVariablesAugment as ze,planDevVariablesScaffold as Qe,requiredSecrets as Ze,writeDevVariablesFileAtomically as $e}from"./packem_shared/buildPackageSecretsBlock-J7bP1P-6.mjs";import{applyAdditiveEdit as rr,classifyEdit as or}from"./packem_shared/applyAdditiveEdit-DPhNZsf2.mjs";import{parseSchema as ar}from"./packem_shared/parseSchema-B4nFDPzZ.mjs";import{classifyPolicyEdit as Er,scaffoldPolicyFile as sr,wireRlsIntoProcedure as pr}from"./packem_shared/classifyPolicyEdit-BfSiVpv-.mjs";import{discoverSchemaInfo as lr}from"./packem_shared/discoverSchemaInfo-Bg2CUZXG.mjs";import{ACCENT as cr,BADGES as dr,BADGE_COLUMN_WIDTH as mr,LUNA_ART as Ar,LUNA_BUNNY as Dr,LUNA_NAME as Sr,LUNA_SIGNOFF as fr,STEP_BADGE_NAMES as Lr,badgeLead as Nr,badgeWidth as vr,padBadge as Tr,paintAnswer as Rr,paintBadge as gr}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{discoverWorkflowInfo as Ir}from"./packem_shared/discoverWorkflowInfo-BsPvlo6O.mjs";export{cr as ACCENT,o as AGENT_MODE_ENV,s as AGENT_RULES_DIR,p as AGENT_RULES_HINT,n as AGENT_RULES_HINT_ENV,dr as BADGES,mr as BADGE_COLUMN_WIDTH,A as CODEGEN_ENV,q as DEFAULT_DEPLOY_TARGET,x as DEV_DAEMON_ENV,I as DEV_HANDOFF_ENV,V as DEV_LOG_FILE,P as DEV_LOG_FILE_ENV,F as DEV_STATE_DIR,u as DEV_STATE_FILE,w as DEV_VARS_EXAMPLE_FILE,H as DEV_VARS_FILE,K as DEV_VARS_KEY_PATTERN,re as LINKED_PROJECT_DIR,oe as LINKED_PROJECT_FILE,Ar as LUNA_ART,Dr as LUNA_BUNNY,Sr as LUNA_NAME,fr as LUNA_SIGNOFF,Pe as LUNORA_CONFIG_FILE,le as LUNORA_EVENT_SOURCE,Ee as LUNORA_IGNORED_PATHS,l as LUNORA_SKILL_NAMES,de as LunoraReporter,Re as PACKAGE_SECRETS_REGISTRY,_ as ROOT_SKILL_NAME,Lr as STEP_BADGE_NAMES,Ae as addArgsFor,rr as applyAdditiveEdit,se as applyLintIgnores,Nr as badgeLead,vr as badgeWidth,Ke as buildPackageSecretsBlock,c as claimAgentRulesHint,O as claimDevServerState,or as classifyEdit,Er as classifyPolicyEdit,C as clearDevServerState,be as createConfirm,X as deployTargetIds,d as detectAgentRules,t as detectAiAgent,T as detectFramework,De as detectInstalledManagers,pe as detectLintTools,Se as detectPackageManager,i as discoverAgentInfo,f as discoverContainerInfo,lr as discoverSchemaInfo,Ir as discoverWorkflowInfo,je as ensureDevVariables,he as ensureDevVarsExample,j as escapeRegExp,fe as execArgsFor,Ye as fillDevSecrets,_e as formatLunoraEvent,We as generateSecretValue,Z as inferLunoraBindings,Le as installArgsFor,Fe as interpretRemote,D as isCodegenDisabled,Me as isInteractive,Je as isMintableSecretKey,qe as isPlaceholderValue,G as isProcessAlive,U as isRecordedProcessCurrent,$ as packageNamesFromBindings,Tr as padBadge,Rr as paintAnswer,gr as paintBadge,h as parseDevVariableEntries,ar as parseSchema,Xe as planDevSecretsFill,ze as planDevVariablesAugment,Qe as planDevVariablesScaffold,ye as promptMultiSelect,ke as promptSelect,Be as promptText,we as promptYesNo,b as readDevServerState,te as readLinkedProject,M as readLiveDevServerState,R as readProjectDependencyNames,ue as readProjectRemotePreference,Oe as readProjectTarget,Y as removeDevVariableLine,Ze as requiredSecrets,z as resolveDeployDriver,Ce as resolveProjectTarget,Ge as resolveTargetOrThrow,Ie as runPostCodegenHook,Ne as runScriptArgsFor,ve as runScriptCommand,sr as scaffoldPolicyFile,ge as secretsForPackages,N as streamContainerLogs,y as updateDevServerState,W as upsertDevVariableLine,pr as wireRlsIntoProcedure,k as writeDevServerState,$e as writeDevVariablesFileAtomically,ae as writeLinkedProject};
1
+ import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-CTdCSfYM.mjs";import{AGENT_RULES_DIR as s,AGENT_RULES_HINT as p,AGENT_RULES_HINT_ENV as n,LUNORA_SKILL_NAMES as _,ROOT_SKILL_NAME as l,claimAgentRulesHint as c,detectAgentRules as d}from"./packem_shared/AGENT_RULES_DIR-3-Sx1gHU.mjs";import{CODEGEN_ENV as A,isCodegenDisabled as D}from"./packem_shared/CODEGEN_ENV-ZsCxV1kP.mjs";import{discoverContainerInfo as f}from"./packem_shared/discoverContainerInfo-EhZtEBQs.mjs";import{streamContainerLogs as N}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as I,readProjectDependencyNames as R}from"./packem_shared/detectFramework-DOn4PtpP.mjs";import{DEV_BINDINGS_FILE as g,DEV_DAEMON_ENV as x,DEV_HANDOFF_ENV as V,DEV_LOG_FILE as P,DEV_LOG_FILE_ENV as F,DEV_STATE_DIR as u,DEV_STATE_FILE as O,claimDevServerState as C,clearDevServerState as G,isDevServerReady as U,isProcessAlive as b,isRecordedProcessCurrent as y,readDevServerState as M,readLiveDevServerState as k,updateDevServerState as B,writeDevServerState as w}from"./packem_shared/DEV_BINDINGS_FILE-pyOiNLP4.mjs";import{DEV_VARS_EXAMPLE_FILE as K,DEV_VARS_FILE as j,DEV_VARS_KEY_PATTERN as h,escapeRegExp as Y,parseDevVariableEntries as W,removeDevVariableLine as J,upsertDevVariableLine as q}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEFAULT_DEPLOY_TARGET as z,deployTargetIds as Q,resolveDeployDriver as Z}from"./packem_shared/DEFAULT_DEPLOY_TARGET-dS2wApDX.mjs";import{inferLunoraBindings as ee,packageNamesFromBindings as re}from"./packem_shared/inferLunoraBindings-KST9XCEe.mjs";import{LINKED_PROJECT_DIR as te,LINKED_PROJECT_FILE as ae,readLinkedProject as Ee,writeLinkedProject as ie}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as pe,applyLintIgnores as ne,detectLintTools as _e}from"./packem_shared/LUNORA_IGNORED_PATHS-BGbVUqw_.mjs";import{LUNORA_EVENT_SOURCE as ce,formatLunoraEvent as de}from"./packem_shared/LUNORA_EVENT_SOURCE-DYdcDU9G.mjs";import{default as Ae}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as Se,detectInstalledManagers as fe,detectPackageManager as Le,execArgsFor as Ne,installArgsFor as ve,runScriptArgsFor as Ie,runScriptCommand as Re}from"./packem_shared/addArgsFor-B4D4zvM0.mjs";import{PACKAGE_SECRETS_REGISTRY as ge,secretsForPackages as xe}from"./packem_shared/PACKAGE_SECRETS_REGISTRY-BgmvEPA-.mjs";import{runPostCodegenHook as Pe}from"./packem_shared/runPostCodegenHook-BF3XTBFz.mjs";import{LUNORA_CONFIG_FILE as ue,interpretRemote as Oe,readProjectRemotePreference as Ce,readProjectTarget as Ge,resolveProjectTarget as Ue,resolveTargetOrThrow as be}from"./packem_shared/LUNORA_CONFIG_FILE-GOH3iIA4.mjs";import{createConfirm as Me,isInteractive as ke,promptMultiSelect as Be,promptSelect as we,promptText as He,promptYesNo as Ke}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{buildPackageSecretsBlock as he,ensureDevVariables as Ye,ensureDevVarsExample as We,fillDevSecrets as Je,generateSecretValue as qe,isMintableSecretKey as Xe,isPlaceholderValue as ze,planDevSecretsFill as Qe,planDevVariablesAugment as Ze,planDevVariablesScaffold as $e,requiredSecrets as er,writeDevVariablesFileAtomically as rr}from"./packem_shared/buildPackageSecretsBlock-J7bP1P-6.mjs";import{applyAdditiveEdit as tr,classifyEdit as ar}from"./packem_shared/applyAdditiveEdit-DPhNZsf2.mjs";import{parseSchema as ir}from"./packem_shared/parseSchema-B4nFDPzZ.mjs";import{classifyPolicyEdit as pr,scaffoldPolicyFile as nr,wireRlsIntoProcedure as _r}from"./packem_shared/classifyPolicyEdit-BfSiVpv-.mjs";import{discoverSchemaInfo as cr}from"./packem_shared/discoverSchemaInfo-Bg2CUZXG.mjs";import{ACCENT as mr,BADGES as Ar,BADGE_COLUMN_WIDTH as Dr,LUNA_ART as Sr,LUNA_BUNNY as fr,LUNA_NAME as Lr,LUNA_SIGNOFF as Nr,STEP_BADGE_NAMES as vr,badgeLead as Ir,badgeWidth as Rr,padBadge as Tr,paintAnswer as gr,paintBadge as xr}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{discoverWorkflowInfo as Pr}from"./packem_shared/discoverWorkflowInfo-BsPvlo6O.mjs";export{mr as ACCENT,o as AGENT_MODE_ENV,s as AGENT_RULES_DIR,p as AGENT_RULES_HINT,n as AGENT_RULES_HINT_ENV,Ar as BADGES,Dr as BADGE_COLUMN_WIDTH,A as CODEGEN_ENV,z as DEFAULT_DEPLOY_TARGET,g as DEV_BINDINGS_FILE,x as DEV_DAEMON_ENV,V as DEV_HANDOFF_ENV,P as DEV_LOG_FILE,F as DEV_LOG_FILE_ENV,u as DEV_STATE_DIR,O as DEV_STATE_FILE,K as DEV_VARS_EXAMPLE_FILE,j as DEV_VARS_FILE,h as DEV_VARS_KEY_PATTERN,te as LINKED_PROJECT_DIR,ae as LINKED_PROJECT_FILE,Sr as LUNA_ART,fr as LUNA_BUNNY,Lr as LUNA_NAME,Nr as LUNA_SIGNOFF,ue as LUNORA_CONFIG_FILE,ce as LUNORA_EVENT_SOURCE,pe as LUNORA_IGNORED_PATHS,_ as LUNORA_SKILL_NAMES,Ae as LunoraReporter,ge as PACKAGE_SECRETS_REGISTRY,l as ROOT_SKILL_NAME,vr as STEP_BADGE_NAMES,Se as addArgsFor,tr as applyAdditiveEdit,ne as applyLintIgnores,Ir as badgeLead,Rr as badgeWidth,he as buildPackageSecretsBlock,c as claimAgentRulesHint,C as claimDevServerState,ar as classifyEdit,pr as classifyPolicyEdit,G as clearDevServerState,Me as createConfirm,Q as deployTargetIds,d as detectAgentRules,t as detectAiAgent,I as detectFramework,fe as detectInstalledManagers,_e as detectLintTools,Le as detectPackageManager,E as discoverAgentInfo,f as discoverContainerInfo,cr as discoverSchemaInfo,Pr as discoverWorkflowInfo,Ye as ensureDevVariables,We as ensureDevVarsExample,Y as escapeRegExp,Ne as execArgsFor,Je as fillDevSecrets,de as formatLunoraEvent,qe as generateSecretValue,ee as inferLunoraBindings,ve as installArgsFor,Oe as interpretRemote,D as isCodegenDisabled,U as isDevServerReady,ke as isInteractive,Xe as isMintableSecretKey,ze as isPlaceholderValue,b as isProcessAlive,y as isRecordedProcessCurrent,re as packageNamesFromBindings,Tr as padBadge,gr as paintAnswer,xr as paintBadge,W as parseDevVariableEntries,ir as parseSchema,Qe as planDevSecretsFill,Ze as planDevVariablesAugment,$e as planDevVariablesScaffold,Be as promptMultiSelect,we as promptSelect,He as promptText,Ke as promptYesNo,M as readDevServerState,Ee as readLinkedProject,k as readLiveDevServerState,R as readProjectDependencyNames,Ce as readProjectRemotePreference,Ge as readProjectTarget,J as removeDevVariableLine,er as requiredSecrets,Z as resolveDeployDriver,Ue as resolveProjectTarget,be as resolveTargetOrThrow,Pe as runPostCodegenHook,Ie as runScriptArgsFor,Re as runScriptCommand,nr as scaffoldPolicyFile,xe as secretsForPackages,N as streamContainerLogs,B as updateDevServerState,q as upsertDevVariableLine,_r as wireRlsIntoProcedure,w as writeDevServerState,rr as writeDevVariablesFileAtomically,ie as writeLinkedProject};
@@ -0,0 +1,4 @@
1
+ import{mkdirSync as _,writeFileSync as E,rmSync as N,existsSync as D,readFileSync as l}from"node:fs";import{join as n}from"node:path";const u=".lunora",v=n(u,"dev.json"),h=n(u,"dev.log"),k=n(u,"dev-bindings.json"),T="LUNORA_DEV_DAEMON",x="LUNORA_DEV_LOG_FILE",C="LUNORA_DEV_HANDOFF_PID",m=r=>r!==null&&typeof r=="object",d=(r,e)=>{const t=r[e];return typeof t=="string"&&t.length>0?t:void 0},p=r=>{if(!Number.isInteger(r)||r<=0)return!1;try{return process.kill(r,0),!0}catch{return!1}},y=1e4,g=100,A=r=>{if(process.platform==="linux")try{const e=l(`/proc/${String(r)}/stat`,"utf8"),t=e.slice(e.lastIndexOf(")")+2).split(" "),i=Number(t[19]),s=l("/proc/stat","utf8").split(`
2
+ `).find(a=>a.startsWith("btime ")),o=Number(s?.slice(6));return!Number.isFinite(i)||!Number.isFinite(o)?void 0:o*1e3+i/g*1e3}catch{return}},b=r=>{if(!p(r.pid))return!1;const e=r.startedAt===void 0?Number.NaN:Date.parse(r.startedAt);if(Number.isNaN(e))return!0;const t=A(r.pid);return t===void 0||t<=e+y},f=r=>{const e=n(r,v);if(!D(e))return;let t;try{t=JSON.parse(l(e,"utf8"))}catch{return}if(!m(t)||typeof t.pid!="number")return;const i=d(t,"url");if(i!==void 0)return{background:t.background===!0,logFile:d(t,"logFile"),mode:t.mode==="vite"?"vite":"cli",pid:t.pid,readyAt:d(t,"readyAt"),startedAt:d(t,"startedAt"),studioUrl:d(t,"studioUrl"),url:i}},c=(r,e)=>{try{_(n(r,u),{recursive:!0});const t=n(r,v);return E(t,`${JSON.stringify(e,void 0,2)}
3
+ `,"utf8"),t}catch{return}},M=(r,e,t)=>{const i=f(r);if(i===void 0||t?.expectedPid!==void 0&&i.pid!==t.expectedPid)return;const s={...i,...e};return c(r,s),s},U=r=>r?.readyAt!==void 0,O=(r,e)=>{try{if(e!==void 0){const t=f(r);if(t!==void 0&&t.pid!==e)return}N(n(r,v),{force:!0})}catch{}},F=r=>{const e=f(r);if(e!==void 0){if(b(e))return e;O(r,e.pid)}},I=(r,e,t)=>{const i=F(r);if(i!==void 0)return t!==void 0&&i.pid===t?{ok:c(r,e)!==void 0}:i.pid!==e.pid?{existing:i,ok:!1}:{ok:c(r,e)!==void 0}},P=(r,e,t)=>{const i=n(r,v),s=`${JSON.stringify(e,void 0,2)}
4
+ `;for(let o=0;o<2;o+=1)try{return _(n(r,u),{recursive:!0}),E(i,s,{encoding:"utf8",flag:"wx"}),{ok:!0}}catch(a){if(a.code!=="EEXIST")return{ok:c(r,e)!==void 0};const S=I(r,e,t?.supersedePid);if(S!==void 0)return S}return{ok:c(r,e)!==void 0}};export{k as DEV_BINDINGS_FILE,T as DEV_DAEMON_ENV,C as DEV_HANDOFF_ENV,h as DEV_LOG_FILE,x as DEV_LOG_FILE_ENV,u as DEV_STATE_DIR,v as DEV_STATE_FILE,P as claimDevServerState,O as clearDevServerState,U as isDevServerReady,p as isProcessAlive,b as isRecordedProcessCurrent,f as readDevServerState,F as readLiveDevServerState,M as updateDevServerState,c as writeDevServerState};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/config",
3
- "version": "1.0.0-alpha.172",
3
+ "version": "1.0.0-alpha.174",
4
4
  "description": "Internal shared CLI + Vite config layer for Lunora: wrangler.jsonc validation, binding inference, and .dev.vars scaffolding",
5
5
  "keywords": [
6
6
  "bindings",
@@ -54,10 +54,10 @@
54
54
  "access": "public"
55
55
  },
56
56
  "dependencies": {
57
- "@lunora/codegen": "1.0.0-alpha.139",
58
- "@lunora/container": "1.0.0-alpha.36",
59
- "@lunora/errors": "1.0.0-alpha.25",
60
- "@lunora/seed": "1.0.0-alpha.92",
57
+ "@lunora/codegen": "1.0.0-alpha.141",
58
+ "@lunora/container": "1.0.0-alpha.37",
59
+ "@lunora/errors": "1.0.0-alpha.26",
60
+ "@lunora/seed": "1.0.0-alpha.93",
61
61
  "@visulima/colorize": "2.1.1",
62
62
  "@visulima/find-ai-runner": "1.0.1",
63
63
  "@visulima/package": "5.0.12",
@@ -1,4 +0,0 @@
1
- import{mkdirSync as _,writeFileSync as E,rmSync as N,existsSync as m,readFileSync as l}from"node:fs";import{join as n}from"node:path";const d=".lunora",u=n(d,"dev.json"),V=n(d,"dev.log"),k="LUNORA_DEV_DAEMON",T="LUNORA_DEV_LOG_FILE",C="LUNORA_DEV_HANDOFF_PID",D=r=>r!==null&&typeof r=="object",c=(r,e)=>{const t=r[e];return typeof t=="string"&&t.length>0?t:void 0},p=r=>{if(!Number.isInteger(r)||r<=0)return!1;try{return process.kill(r,0),!0}catch{return!1}},g=1e4,y=100,O=r=>{if(process.platform==="linux")try{const e=l(`/proc/${String(r)}/stat`,"utf8"),t=e.slice(e.lastIndexOf(")")+2).split(" "),i=Number(t[19]),v=l("/proc/stat","utf8").split(`
2
- `).find(a=>a.startsWith("btime ")),s=Number(v?.slice(6));return!Number.isFinite(i)||!Number.isFinite(s)?void 0:s*1e3+i/y*1e3}catch{return}},b=r=>{if(!p(r.pid))return!1;const e=r.startedAt===void 0?Number.NaN:Date.parse(r.startedAt);if(Number.isNaN(e))return!0;const t=O(r.pid);return t===void 0||t<=e+g},f=r=>{const e=n(r,u);if(!m(e))return;let t;try{t=JSON.parse(l(e,"utf8"))}catch{return}if(!D(t)||typeof t.pid!="number")return;const i=c(t,"url");if(i!==void 0)return{background:t.background===!0,logFile:c(t,"logFile"),mode:t.mode==="vite"?"vite":"cli",pid:t.pid,startedAt:c(t,"startedAt"),studioUrl:c(t,"studioUrl"),url:i}},o=(r,e)=>{try{_(n(r,d),{recursive:!0});const t=n(r,u);return E(t,`${JSON.stringify(e,void 0,2)}
3
- `,"utf8"),t}catch{return}},M=(r,e)=>{const t=f(r);if(t===void 0)return;const i={...t,...e};return o(r,i),i},A=(r,e)=>{try{if(e!==void 0){const t=f(r);if(t!==void 0&&t.pid!==e)return}N(n(r,u),{force:!0})}catch{}},F=r=>{const e=f(r);if(e!==void 0){if(b(e))return e;A(r,e.pid)}},L=(r,e,t)=>{const i=F(r);if(i!==void 0)return t!==void 0&&i.pid===t?{ok:o(r,e)!==void 0}:i.pid!==e.pid?{existing:i,ok:!1}:{ok:o(r,e)!==void 0}},x=(r,e,t)=>{const i=n(r,u),v=`${JSON.stringify(e,void 0,2)}
4
- `;for(let s=0;s<2;s+=1)try{return _(n(r,d),{recursive:!0}),E(i,v,{encoding:"utf8",flag:"wx"}),{ok:!0}}catch(a){if(a.code!=="EEXIST")return{ok:o(r,e)!==void 0};const S=L(r,e,t?.supersedePid);if(S!==void 0)return S}return{ok:o(r,e)!==void 0}};export{k as DEV_DAEMON_ENV,C as DEV_HANDOFF_ENV,V as DEV_LOG_FILE,T as DEV_LOG_FILE_ENV,d as DEV_STATE_DIR,u as DEV_STATE_FILE,x as claimDevServerState,A as clearDevServerState,p as isProcessAlive,b as isRecordedProcessCurrent,f as readDevServerState,F as readLiveDevServerState,M as updateDevServerState,o as writeDevServerState};