@lunora/config 1.0.0-alpha.210 → 1.0.0-alpha.211

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.
@@ -1,4 +1,4 @@
1
- import { D as DeployDriver, I as InferredBindings, S as SchemaInfo } from "../packem_shared/schema-info.d-DMU-BYCS.mjs";
1
+ import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/schema-info.d-DvKkJ7HJ.mjs";
2
2
  import { WranglerVariableIR } from '@lunora/codegen';
3
3
  /**
4
4
  * Translate a `wrangler.jsonc` into an [Alchemy](https://alchemy.run) program.
@@ -22,7 +22,7 @@ import { WranglerVariableIR } from '@lunora/codegen';
22
22
  * `wrangler`, `miniflare`, `esbuild`, `execa`, `find-process`, `glob`, `open`,
23
23
  * `proper-lockfile`, `signal-exit`. `@lunora/config` is imported by
24
24
  * `@lunora/vite`, so importing Alchemy here would push that tree into every
25
- * project that merely wanted to read `lunora.json`, and into any bundle
25
+ * project that merely wanted to read `lunora.config.*`, and into any bundle
26
26
  * targeting workerd — where none of it survives.
27
27
  *
28
28
  * Emitting text keeps this module pure and dependency-free. Alchemy is invoked
@@ -241,7 +241,7 @@ interface ExportGap {
241
241
  /** Which declaration is unexported. */
242
242
  kind: "agent" | "container" | "workflow";
243
243
  /** The `_generated/{module}` to re-export from, e.g. `workflows`. */
244
- module: "agents" | "containers" | "workflows";
244
+ module: GeneratedClassModule;
245
245
  }
246
246
  interface ReconcileBindingsResult {
247
247
  /** Short labels for each binding written (e.g. `"SCHEDULER/SchedulerDO"`). */
@@ -549,7 +549,7 @@ declare const isRemoteEnvEnabled: (value: string | undefined) => boolean;
549
549
  /** The three inputs that can switch remote-binding dev on, in precedence order. */
550
550
  interface RemoteEnableInputs {
551
551
  /**
552
- * The `remote` preference from `lunora.json` (the lowest-priority signal).
552
+ * The `remote` preference from `lunora.config.*` (the lowest-priority signal).
553
553
  * `undefined` means "no project preference"; an explicit `false` here loses
554
554
  * to neither the flag nor the env when those are absent — it just stays off.
555
555
  */
@@ -564,7 +564,7 @@ interface RemoteEnableInputs {
564
564
  *
565
565
  * 1. an explicit `--remote` flag (highest — a deliberate per-invocation choice),
566
566
  * 2. then `LUNORA_REMOTE` in the environment,
567
- * 3. then the `remote` key in `lunora.json` (lowest — a project default).
567
+ * 3. then the `remote` key in `lunora.config.*` (lowest — a project default).
568
568
  *
569
569
  * The flag and env are one-directional (they can only turn remote *on*); only
570
570
  * the config preference carries a meaningful `false`, and it applies solely when
@@ -889,6 +889,16 @@ interface WranglerProjectValidationResult {
889
889
  report: WranglerValidationReport;
890
890
  wranglerPath: string | undefined;
891
891
  }
892
+ /**
893
+ * The phrase every unexported-class error carries.
894
+ *
895
+ * Exported because it is a CONTRACT, not prose: `lunora doctor` picks these
896
+ * errors out of the report by substring to raise its own finding, and the
897
+ * validator's report is a flat `string[]`. Until the report entries carry a
898
+ * code, a copy-edit here would silently disable that check — so the copy-edit
899
+ * has to go through this constant.
900
+ */
901
+ declare const UNEXPORTED_CLASS_MARKER = "does not export it";
892
902
  /**
893
903
  * File-system aware variant: reads `wrangler.jsonc`/`wrangler.json` from
894
904
  * the given project root, discovers the schema (if any), and delegates to
@@ -944,4 +954,4 @@ type BindingRequirement, CLOUDFLARE_DRIVER, type ExportGap,
944
954
  * Plan 114 §5.3 (D6): a package carrying real provider code isolates it behind a
945
955
  * subpath rather than relocating wholesale.
946
956
  */
947
- type ManifestConfigShape, type MaterializeOptions, type MaterializeResult, REMOTE_ELIGIBLE_KEYS, REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, type ReadWranglerResult, type ReconcileBindingsResult, type ReconcileCompatibilityDateResult, type ReconcileResult as ReconcileCronsResult, type RemoteBindingPlan, type RemoteEnableInputs, type RemoteWranglerShape, type TailConsumer, WORKERS_CACHE_MIN_DATE, WRANGLER_FILES, type WranglerCacheShape, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry, buildBindingManifest, collectExportGaps, collectWranglerSecretVariables, describePreservedCrons, findWranglerFile, injectRemoteFlags, isCacheEnabled, isRemoteEnvEnabled, materializeRemoteWranglerConfig, mergeWranglerEnvironment, planRemoteBindings, readWranglerJsonc, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, resolveRemoteEnabled, scanWranglerVariablesForSecrets, validateWrangler, validateWranglerConfig, validateWranglerProject, withTailConsumer, wranglerToAlchemy };
957
+ type ManifestConfigShape, type MaterializeOptions, type MaterializeResult, REMOTE_ELIGIBLE_KEYS, REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, type ReadWranglerResult, type ReconcileBindingsResult, type ReconcileCompatibilityDateResult, type ReconcileResult as ReconcileCronsResult, type RemoteBindingPlan, type RemoteEnableInputs, type RemoteWranglerShape, type TailConsumer, UNEXPORTED_CLASS_MARKER, WORKERS_CACHE_MIN_DATE, WRANGLER_FILES, type WranglerCacheShape, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry, buildBindingManifest, collectExportGaps, collectWranglerSecretVariables, describePreservedCrons, findWranglerFile, injectRemoteFlags, isCacheEnabled, isRemoteEnvEnabled, materializeRemoteWranglerConfig, mergeWranglerEnvironment, planRemoteBindings, readWranglerJsonc, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, resolveRemoteEnabled, scanWranglerVariablesForSecrets, validateWrangler, validateWranglerConfig, validateWranglerProject, withTailConsumer, wranglerToAlchemy };
@@ -1,4 +1,4 @@
1
- import { D as DeployDriver, I as InferredBindings, S as SchemaInfo } from "../packem_shared/schema-info.d-DMU-BYCS.js";
1
+ import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/schema-info.d-DvKkJ7HJ.js";
2
2
  import { WranglerVariableIR } from '@lunora/codegen';
3
3
  /**
4
4
  * Translate a `wrangler.jsonc` into an [Alchemy](https://alchemy.run) program.
@@ -22,7 +22,7 @@ import { WranglerVariableIR } from '@lunora/codegen';
22
22
  * `wrangler`, `miniflare`, `esbuild`, `execa`, `find-process`, `glob`, `open`,
23
23
  * `proper-lockfile`, `signal-exit`. `@lunora/config` is imported by
24
24
  * `@lunora/vite`, so importing Alchemy here would push that tree into every
25
- * project that merely wanted to read `lunora.json`, and into any bundle
25
+ * project that merely wanted to read `lunora.config.*`, and into any bundle
26
26
  * targeting workerd — where none of it survives.
27
27
  *
28
28
  * Emitting text keeps this module pure and dependency-free. Alchemy is invoked
@@ -241,7 +241,7 @@ interface ExportGap {
241
241
  /** Which declaration is unexported. */
242
242
  kind: "agent" | "container" | "workflow";
243
243
  /** The `_generated/{module}` to re-export from, e.g. `workflows`. */
244
- module: "agents" | "containers" | "workflows";
244
+ module: GeneratedClassModule;
245
245
  }
246
246
  interface ReconcileBindingsResult {
247
247
  /** Short labels for each binding written (e.g. `"SCHEDULER/SchedulerDO"`). */
@@ -549,7 +549,7 @@ declare const isRemoteEnvEnabled: (value: string | undefined) => boolean;
549
549
  /** The three inputs that can switch remote-binding dev on, in precedence order. */
550
550
  interface RemoteEnableInputs {
551
551
  /**
552
- * The `remote` preference from `lunora.json` (the lowest-priority signal).
552
+ * The `remote` preference from `lunora.config.*` (the lowest-priority signal).
553
553
  * `undefined` means "no project preference"; an explicit `false` here loses
554
554
  * to neither the flag nor the env when those are absent — it just stays off.
555
555
  */
@@ -564,7 +564,7 @@ interface RemoteEnableInputs {
564
564
  *
565
565
  * 1. an explicit `--remote` flag (highest — a deliberate per-invocation choice),
566
566
  * 2. then `LUNORA_REMOTE` in the environment,
567
- * 3. then the `remote` key in `lunora.json` (lowest — a project default).
567
+ * 3. then the `remote` key in `lunora.config.*` (lowest — a project default).
568
568
  *
569
569
  * The flag and env are one-directional (they can only turn remote *on*); only
570
570
  * the config preference carries a meaningful `false`, and it applies solely when
@@ -889,6 +889,16 @@ interface WranglerProjectValidationResult {
889
889
  report: WranglerValidationReport;
890
890
  wranglerPath: string | undefined;
891
891
  }
892
+ /**
893
+ * The phrase every unexported-class error carries.
894
+ *
895
+ * Exported because it is a CONTRACT, not prose: `lunora doctor` picks these
896
+ * errors out of the report by substring to raise its own finding, and the
897
+ * validator's report is a flat `string[]`. Until the report entries carry a
898
+ * code, a copy-edit here would silently disable that check — so the copy-edit
899
+ * has to go through this constant.
900
+ */
901
+ declare const UNEXPORTED_CLASS_MARKER = "does not export it";
892
902
  /**
893
903
  * File-system aware variant: reads `wrangler.jsonc`/`wrangler.json` from
894
904
  * the given project root, discovers the schema (if any), and delegates to
@@ -944,4 +954,4 @@ type BindingRequirement, CLOUDFLARE_DRIVER, type ExportGap,
944
954
  * Plan 114 §5.3 (D6): a package carrying real provider code isolates it behind a
945
955
  * subpath rather than relocating wholesale.
946
956
  */
947
- type ManifestConfigShape, type MaterializeOptions, type MaterializeResult, REMOTE_ELIGIBLE_KEYS, REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, type ReadWranglerResult, type ReconcileBindingsResult, type ReconcileCompatibilityDateResult, type ReconcileResult as ReconcileCronsResult, type RemoteBindingPlan, type RemoteEnableInputs, type RemoteWranglerShape, type TailConsumer, WORKERS_CACHE_MIN_DATE, WRANGLER_FILES, type WranglerCacheShape, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry, buildBindingManifest, collectExportGaps, collectWranglerSecretVariables, describePreservedCrons, findWranglerFile, injectRemoteFlags, isCacheEnabled, isRemoteEnvEnabled, materializeRemoteWranglerConfig, mergeWranglerEnvironment, planRemoteBindings, readWranglerJsonc, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, resolveRemoteEnabled, scanWranglerVariablesForSecrets, validateWrangler, validateWranglerConfig, validateWranglerProject, withTailConsumer, wranglerToAlchemy };
957
+ type ManifestConfigShape, type MaterializeOptions, type MaterializeResult, REMOTE_ELIGIBLE_KEYS, REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, type ReadWranglerResult, type ReconcileBindingsResult, type ReconcileCompatibilityDateResult, type ReconcileResult as ReconcileCronsResult, type RemoteBindingPlan, type RemoteEnableInputs, type RemoteWranglerShape, type TailConsumer, UNEXPORTED_CLASS_MARKER, WORKERS_CACHE_MIN_DATE, WRANGLER_FILES, type WranglerCacheShape, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry, buildBindingManifest, collectExportGaps, collectWranglerSecretVariables, describePreservedCrons, findWranglerFile, injectRemoteFlags, isCacheEnabled, isRemoteEnvEnabled, materializeRemoteWranglerConfig, mergeWranglerEnvironment, planRemoteBindings, readWranglerJsonc, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, resolveRemoteEnabled, scanWranglerVariablesForSecrets, validateWrangler, validateWranglerConfig, validateWranglerProject, withTailConsumer, wranglerToAlchemy };
@@ -1 +1 @@
1
- import{BINDING_MANIFEST_VERSION as o,buildBindingManifest as a}from"../packem_shared/BINDING_MANIFEST_VERSION-B8dwEKLn.mjs";import{default as l}from"../packem_shared/CLOUDFLARE_DRIVER-Ci9oJMYb.mjs";import{collectExportGaps as i,reconcileWranglerBindings as E}from"../packem_shared/collectExportGaps-Bhouyve4.mjs";import{reconcileWranglerCompatibilityDate as g}from"../packem_shared/reconcileWranglerCompatibilityDate-7OO_xaKR.mjs";import{describePreservedCrons as s,reconcileWranglerCrons as R}from"../packem_shared/describePreservedCrons-Bp5s5u0M.mjs";import{REMOTE_ELIGIBLE_KEYS as d,injectRemoteFlags as p,isRemoteEnvEnabled as I,materializeRemoteWranglerConfig as W,planRemoteBindings as x,resolveRemoteEnabled as _}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-D-edJjVY.mjs";import{WORKERS_CACHE_MIN_DATE as A,isCacheEnabled as b}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{WRANGLER_FILES as L,findWranglerFile as T,readWranglerJsonc as v}from"../packem_shared/WRANGLER_FILES-UNW-xY5u.mjs";import{collectWranglerSecretVariables as S,scanWranglerVariablesForSecrets as B}from"../packem_shared/collectWranglerSecretVariables-D-usPfT8.mjs";import{wranglerToAlchemy as G}from"../packem_shared/wranglerToAlchemy-SDoS_XY0.mjs";import{REQUIRED_COMPATIBILITY_DATE as O,REQUIRED_FLAG as V,mergeWranglerEnvironment as h,validateWrangler as u,validateWranglerConfig as P,validateWranglerProject as U,withTailConsumer as j}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-BB5Vt-qE.mjs";export{o as BINDING_MANIFEST_VERSION,l as CLOUDFLARE_DRIVER,d as REMOTE_ELIGIBLE_KEYS,O as REQUIRED_COMPATIBILITY_DATE,V as REQUIRED_FLAG,A as WORKERS_CACHE_MIN_DATE,L as WRANGLER_FILES,a as buildBindingManifest,i as collectExportGaps,S as collectWranglerSecretVariables,s as describePreservedCrons,T as findWranglerFile,p as injectRemoteFlags,b as isCacheEnabled,I as isRemoteEnvEnabled,W as materializeRemoteWranglerConfig,h as mergeWranglerEnvironment,x as planRemoteBindings,v as readWranglerJsonc,E as reconcileWranglerBindings,g as reconcileWranglerCompatibilityDate,R as reconcileWranglerCrons,_ as resolveRemoteEnabled,B as scanWranglerVariablesForSecrets,u as validateWrangler,P as validateWranglerConfig,U as validateWranglerProject,j as withTailConsumer,G as wranglerToAlchemy};
1
+ import{BINDING_MANIFEST_VERSION as o,buildBindingManifest as a}from"../packem_shared/BINDING_MANIFEST_VERSION-B8dwEKLn.mjs";import{default as l}from"../packem_shared/CLOUDFLARE_DRIVER-Ci9oJMYb.mjs";import{collectExportGaps as i,reconcileWranglerBindings as E}from"../packem_shared/collectExportGaps-DfZ-JNZU.mjs";import{reconcileWranglerCompatibilityDate as R}from"../packem_shared/reconcileWranglerCompatibilityDate-7OO_xaKR.mjs";import{describePreservedCrons as c,reconcileWranglerCrons as s}from"../packem_shared/describePreservedCrons-Bp5s5u0M.mjs";import{REMOTE_ELIGIBLE_KEYS as d,injectRemoteFlags as p,isRemoteEnvEnabled as I,materializeRemoteWranglerConfig as W,planRemoteBindings as _,resolveRemoteEnabled as x}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-D-edJjVY.mjs";import{WORKERS_CACHE_MIN_DATE as A,isCacheEnabled as D}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{WRANGLER_FILES as S,findWranglerFile as T,readWranglerJsonc as b}from"../packem_shared/WRANGLER_FILES-UNW-xY5u.mjs";import{collectWranglerSecretVariables as F,scanWranglerVariablesForSecrets as N}from"../packem_shared/collectWranglerSecretVariables-D-usPfT8.mjs";import{wranglerToAlchemy as M}from"../packem_shared/wranglerToAlchemy-SDoS_XY0.mjs";import{REQUIRED_COMPATIBILITY_DATE as G,REQUIRED_FLAG as P,UNEXPORTED_CLASS_MARKER as U,mergeWranglerEnvironment as V,validateWrangler as h,validateWranglerConfig as u,validateWranglerProject as K,withTailConsumer as j}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-D9z4NOVs.mjs";export{o as BINDING_MANIFEST_VERSION,l as CLOUDFLARE_DRIVER,d as REMOTE_ELIGIBLE_KEYS,G as REQUIRED_COMPATIBILITY_DATE,P as REQUIRED_FLAG,U as UNEXPORTED_CLASS_MARKER,A as WORKERS_CACHE_MIN_DATE,S as WRANGLER_FILES,a as buildBindingManifest,i as collectExportGaps,F as collectWranglerSecretVariables,c as describePreservedCrons,T as findWranglerFile,p as injectRemoteFlags,D as isCacheEnabled,I as isRemoteEnvEnabled,W as materializeRemoteWranglerConfig,V as mergeWranglerEnvironment,_ as planRemoteBindings,b as readWranglerJsonc,E as reconcileWranglerBindings,R as reconcileWranglerCompatibilityDate,s as reconcileWranglerCrons,x as resolveRemoteEnabled,N as scanWranglerVariablesForSecrets,h as validateWrangler,u as validateWranglerConfig,K as validateWranglerProject,j as withTailConsumer,M as wranglerToAlchemy};
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { AgentIR, ContainerIR, WorkflowIR } from '@lunora/codegen';
2
2
  export type { AgentIR, ContainerIR, WorkflowIR } from '@lunora/codegen';
3
3
  import { Writable } from 'node:stream';
4
- import { D as DeployDriver } from "./packem_shared/schema-info.d-DMU-BYCS.mjs";
5
- export { C as COMPOSED_WORKER_ENTRY, type a as DeployRequest, type b as DevRequest, type c as DiscoverSchemaInfoResult, type d as DriverToolchain, type e as InferOptions, type f as InferredAgent, type I as InferredBindings, type g as InferredContainer, type h as InferredWorkflow, type S as SchemaInfo, type i as SecretRequest, type T as TailRequest, type j as ToolchainCommand, k as discoverSchemaInfo, l as inferLunoraBindings, p as packageNamesFromBindings } from "./packem_shared/schema-info.d-DMU-BYCS.mjs";
4
+ import { D as DeployDriver } from "./packem_shared/schema-info.d-DvKkJ7HJ.mjs";
5
+ export { C as COMPOSED_WORKER_ENTRY, type a as DeployRequest, type b as DevRequest, type c as DiscoverSchemaInfoResult, type d as DriverToolchain, e as GENERATED_CLASS_MODULES, type G as GeneratedClassModule, type f as InferOptions, type g as InferredAgent, type I as InferredBindings, type h as InferredContainer, type i as InferredWorkflow, type S as SchemaInfo, type j as SecretRequest, type T as TailRequest, type k as ToolchainCommand, l as discoverSchemaInfo, m as inferLunoraBindings, p as packageNamesFromBindings } from "./packem_shared/schema-info.d-DvKkJ7HJ.mjs";
6
6
  export { type A as AdditivePolicyEdit, type D as DestructivePolicyEdit, type P as PolicyEdit, type a as PolicyScaffoldFailureReason, type b as ScaffoldFileResult, type S as ScaffoldPolicyEdit, type c as WireResult, type W as WireRlsEdit, d as classifyPolicyEdit, r as resolveServerModule, s as scaffoldPolicyFile, w as wireRlsIntoProcedure } from "./packem_shared/policy-scaffold.d-D2H4_G01.mjs";
7
7
  interface DiscoverAgentInfoResult {
8
8
  /** Discovered agent definitions; `[]` when none are declared or parsing failed. */
@@ -777,10 +777,8 @@ declare const runPostCodegenHook: (options: {
777
777
  /** See {@link HookSpawnDescriptor.stdoutToStderr}. */
778
778
  stdoutToStderr?: boolean;
779
779
  }) => Promise<PostCodegenHookResult>;
780
- /** The canonical project-config filename probed at the project root. */
781
- declare const LUNORA_CONFIG_FILE = "lunora.json";
782
780
  /**
783
- * The parsed `remote` preference from `lunora.json`:
781
+ * The parsed `remote` preference from `lunora.config.*`:
784
782
  *
785
783
  * - `true` / `false` — the boolean form: enable or explicitly disable remote dev.
786
784
  * - `undefined` — no usable preference (file absent, key absent, or malformed).
@@ -790,11 +788,6 @@ declare const LUNORA_CONFIG_FILE = "lunora.json";
790
788
  * presence) so forward-written configs still turn remote on.
791
789
  */
792
790
  type RemotePreference = boolean | undefined;
793
- /** The structural slice of `lunora.json` Lunora reads. */
794
- interface LunoraProjectConfig {
795
- remote?: unknown;
796
- target?: unknown;
797
- }
798
791
  /**
799
792
  * Interpret a raw `remote` value into a tri-state preference. A boolean passes
800
793
  * through; an object is treated as enabled (the documented-but-not-yet-honored
@@ -808,7 +801,7 @@ declare const interpretRemote: (value: unknown) => RemotePreference;
808
801
  */
809
802
  declare const readProjectRemotePreference: (projectRoot: string) => RemotePreference;
810
803
  /**
811
- * Read the project's deploy `target` from `lunora.json`, or `undefined` when
804
+ * Read the project's deploy `target` from `lunora.config.*`, or `undefined` when
812
805
  * absent.
813
806
  *
814
807
  * Delegates to `@lunora/codegen` rather than re-reading the file here.
@@ -819,7 +812,7 @@ declare const readProjectRemotePreference: (projectRoot: string) => RemotePrefer
819
812
  declare const readProjectTarget: (projectRoot: string) => string | undefined;
820
813
  /**
821
814
  * Resolve the deploy target for a command: an explicit `--target` wins, then
822
- * `lunora.json`, then the registry default.
815
+ * `lunora.config.*`, then the registry default.
823
816
  *
824
817
  * **This is the canonical resolution point, and the reason it is one place.**
825
818
  * Codegen tailors the emitted `ctx.*` surface to a target while deploy picks
@@ -843,7 +836,7 @@ declare const resolveProjectTarget: (projectRoot: string, explicit?: string) =>
843
836
  * Callers that go on to resolve a driver get this for free; the ones that never
844
837
  * look a driver up — codegen, the Vite plugin — need it, because otherwise
845
838
  * nothing in their path ever rejects the name.
846
- * @param projectRoot Directory containing `lunora.json`.
839
+ * @param projectRoot Directory containing `lunora.config.*`.
847
840
  * @param explicit A caller-supplied target, if any.
848
841
  * @throws when the resolved target names no registered driver.
849
842
  * @returns the resolved, registered target id.
@@ -1269,4 +1262,4 @@ declare const badgeWidth: (_spec: BadgeSpec) => number;
1269
1262
  declare const paintBadge: (spec: BadgeSpec) => string;
1270
1263
  /** Dim continuation text (a step's chosen answer, shown under the question). */
1271
1264
  declare const paintAnswer: (text: string) => string;
1272
- 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, isRunnableTarget, padBadge, paintAnswer, paintBadge, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readDevServerState, readLinkedProject, readLiveDevServerState, readProjectDependencyNames, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, requiredSecrets, resolveDeployDriver, resolveProjectTarget, resolveTargetOrThrow, runPostCodegenHook, runScriptArgsFor, runScriptCommand, runnableTargetIds, secretsForPackages, streamContainerLogs, updateDevServerState, upsertDevVariableLine, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
1265
+ 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_EVENT_SOURCE, LUNORA_IGNORED_PATHS, LUNORA_SKILL_NAMES, type LevelBadgeName, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LunoraFormattedLine, type LunoraLineLevel, 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, isRunnableTarget, padBadge, paintAnswer, paintBadge, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readDevServerState, readLinkedProject, readLiveDevServerState, readProjectDependencyNames, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, requiredSecrets, resolveDeployDriver, resolveProjectTarget, resolveTargetOrThrow, runPostCodegenHook, runScriptArgsFor, runScriptCommand, runnableTargetIds, secretsForPackages, streamContainerLogs, updateDevServerState, upsertDevVariableLine, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { AgentIR, ContainerIR, WorkflowIR } from '@lunora/codegen';
2
2
  export type { AgentIR, ContainerIR, WorkflowIR } from '@lunora/codegen';
3
3
  import { Writable } from 'node:stream';
4
- import { D as DeployDriver } from "./packem_shared/schema-info.d-DMU-BYCS.js";
5
- export { C as COMPOSED_WORKER_ENTRY, type a as DeployRequest, type b as DevRequest, type c as DiscoverSchemaInfoResult, type d as DriverToolchain, type e as InferOptions, type f as InferredAgent, type I as InferredBindings, type g as InferredContainer, type h as InferredWorkflow, type S as SchemaInfo, type i as SecretRequest, type T as TailRequest, type j as ToolchainCommand, k as discoverSchemaInfo, l as inferLunoraBindings, p as packageNamesFromBindings } from "./packem_shared/schema-info.d-DMU-BYCS.js";
4
+ import { D as DeployDriver } from "./packem_shared/schema-info.d-DvKkJ7HJ.js";
5
+ export { C as COMPOSED_WORKER_ENTRY, type a as DeployRequest, type b as DevRequest, type c as DiscoverSchemaInfoResult, type d as DriverToolchain, e as GENERATED_CLASS_MODULES, type G as GeneratedClassModule, type f as InferOptions, type g as InferredAgent, type I as InferredBindings, type h as InferredContainer, type i as InferredWorkflow, type S as SchemaInfo, type j as SecretRequest, type T as TailRequest, type k as ToolchainCommand, l as discoverSchemaInfo, m as inferLunoraBindings, p as packageNamesFromBindings } from "./packem_shared/schema-info.d-DvKkJ7HJ.js";
6
6
  export { type A as AdditivePolicyEdit, type D as DestructivePolicyEdit, type P as PolicyEdit, type a as PolicyScaffoldFailureReason, type b as ScaffoldFileResult, type S as ScaffoldPolicyEdit, type c as WireResult, type W as WireRlsEdit, d as classifyPolicyEdit, r as resolveServerModule, s as scaffoldPolicyFile, w as wireRlsIntoProcedure } from "./packem_shared/policy-scaffold.d-D2H4_G01.js";
7
7
  interface DiscoverAgentInfoResult {
8
8
  /** Discovered agent definitions; `[]` when none are declared or parsing failed. */
@@ -777,10 +777,8 @@ declare const runPostCodegenHook: (options: {
777
777
  /** See {@link HookSpawnDescriptor.stdoutToStderr}. */
778
778
  stdoutToStderr?: boolean;
779
779
  }) => Promise<PostCodegenHookResult>;
780
- /** The canonical project-config filename probed at the project root. */
781
- declare const LUNORA_CONFIG_FILE = "lunora.json";
782
780
  /**
783
- * The parsed `remote` preference from `lunora.json`:
781
+ * The parsed `remote` preference from `lunora.config.*`:
784
782
  *
785
783
  * - `true` / `false` — the boolean form: enable or explicitly disable remote dev.
786
784
  * - `undefined` — no usable preference (file absent, key absent, or malformed).
@@ -790,11 +788,6 @@ declare const LUNORA_CONFIG_FILE = "lunora.json";
790
788
  * presence) so forward-written configs still turn remote on.
791
789
  */
792
790
  type RemotePreference = boolean | undefined;
793
- /** The structural slice of `lunora.json` Lunora reads. */
794
- interface LunoraProjectConfig {
795
- remote?: unknown;
796
- target?: unknown;
797
- }
798
791
  /**
799
792
  * Interpret a raw `remote` value into a tri-state preference. A boolean passes
800
793
  * through; an object is treated as enabled (the documented-but-not-yet-honored
@@ -808,7 +801,7 @@ declare const interpretRemote: (value: unknown) => RemotePreference;
808
801
  */
809
802
  declare const readProjectRemotePreference: (projectRoot: string) => RemotePreference;
810
803
  /**
811
- * Read the project's deploy `target` from `lunora.json`, or `undefined` when
804
+ * Read the project's deploy `target` from `lunora.config.*`, or `undefined` when
812
805
  * absent.
813
806
  *
814
807
  * Delegates to `@lunora/codegen` rather than re-reading the file here.
@@ -819,7 +812,7 @@ declare const readProjectRemotePreference: (projectRoot: string) => RemotePrefer
819
812
  declare const readProjectTarget: (projectRoot: string) => string | undefined;
820
813
  /**
821
814
  * Resolve the deploy target for a command: an explicit `--target` wins, then
822
- * `lunora.json`, then the registry default.
815
+ * `lunora.config.*`, then the registry default.
823
816
  *
824
817
  * **This is the canonical resolution point, and the reason it is one place.**
825
818
  * Codegen tailors the emitted `ctx.*` surface to a target while deploy picks
@@ -843,7 +836,7 @@ declare const resolveProjectTarget: (projectRoot: string, explicit?: string) =>
843
836
  * Callers that go on to resolve a driver get this for free; the ones that never
844
837
  * look a driver up — codegen, the Vite plugin — need it, because otherwise
845
838
  * nothing in their path ever rejects the name.
846
- * @param projectRoot Directory containing `lunora.json`.
839
+ * @param projectRoot Directory containing `lunora.config.*`.
847
840
  * @param explicit A caller-supplied target, if any.
848
841
  * @throws when the resolved target names no registered driver.
849
842
  * @returns the resolved, registered target id.
@@ -1269,4 +1262,4 @@ declare const badgeWidth: (_spec: BadgeSpec) => number;
1269
1262
  declare const paintBadge: (spec: BadgeSpec) => string;
1270
1263
  /** Dim continuation text (a step's chosen answer, shown under the question). */
1271
1264
  declare const paintAnswer: (text: string) => string;
1272
- 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, isRunnableTarget, padBadge, paintAnswer, paintBadge, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readDevServerState, readLinkedProject, readLiveDevServerState, readProjectDependencyNames, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, requiredSecrets, resolveDeployDriver, resolveProjectTarget, resolveTargetOrThrow, runPostCodegenHook, runScriptArgsFor, runScriptCommand, runnableTargetIds, secretsForPackages, streamContainerLogs, updateDevServerState, upsertDevVariableLine, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
1265
+ 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_EVENT_SOURCE, LUNORA_IGNORED_PATHS, LUNORA_SKILL_NAMES, type LevelBadgeName, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LunoraFormattedLine, type LunoraLineLevel, 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, isRunnableTarget, padBadge, paintAnswer, paintBadge, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readDevServerState, readLinkedProject, readLiveDevServerState, readProjectDependencyNames, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, requiredSecrets, resolveDeployDriver, resolveProjectTarget, resolveTargetOrThrow, runPostCodegenHook, runScriptArgsFor, runScriptCommand, runnableTargetIds, 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 E}from"./packem_shared/discoverAgentInfo-CTdCSfYM.mjs";import{AGENT_RULES_DIR as i,AGENT_RULES_HINT as l,AGENT_RULES_HINT_ENV as n,LUNORA_SKILL_NAMES as p,ROOT_SKILL_NAME as _,claimAgentRulesHint as c,detectAgentRules as d}from"./packem_shared/AGENT_RULES_DIR-C54Ta_vz.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 L}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as R,projectUsesUmbrella as T,readProjectDependencyNames as I}from"./packem_shared/detectFramework-CUiVEHDQ.mjs";import{DEV_BINDINGS_FILE as x,DEV_DAEMON_ENV as V,DEV_HANDOFF_ENV as P,DEV_LOG_FILE as u,DEV_LOG_FILE_ENV as F,DEV_STATE_DIR as O,DEV_STATE_FILE as C,claimDevServerState as G,clearDevServerState as U,isDevServerReady as b,isProcessAlive as M,isRecordedProcessCurrent as y,readDevServerState as k,readLiveDevServerState as B,updateDevServerState as w,writeDevServerState as K}from"./packem_shared/DEV_BINDINGS_FILE-pyOiNLP4.mjs";import{DEV_VARS_EXAMPLE_FILE as H,DEV_VARS_FILE as Y,DEV_VARS_KEY_PATTERN as h,escapeRegExp as W,parseDevVariableEntries as J,removeDevVariableLine as q,upsertDevVariableLine as X}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEFAULT_DEPLOY_TARGET as Q,deployTargetIds as Z,isRunnableTarget as $,resolveDeployDriver as ee,runnableTargetIds as re}from"./packem_shared/DEFAULT_DEPLOY_TARGET-B-e9mqgX.mjs";import{COMPOSED_WORKER_ENTRY as te,inferLunoraBindings as ae,packageNamesFromBindings as Ee}from"./packem_shared/COMPOSED_WORKER_ENTRY-DySw1a7-.mjs";import{LINKED_PROJECT_DIR as ie,LINKED_PROJECT_FILE as le,readLinkedProject as ne,writeLinkedProject as pe}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as ce,applyLintIgnores as de,detectLintTools as me}from"./packem_shared/LUNORA_IGNORED_PATHS-BHABA9u-.mjs";import{LUNORA_EVENT_SOURCE as De,formatLunoraEvent as Se}from"./packem_shared/LUNORA_EVENT_SOURCE-DYdcDU9G.mjs";import{default as Ne}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as ve,detectInstalledManagers as Re,detectPackageManager as Te,execArgsFor as Ie,installArgsFor as ge,runScriptArgsFor as xe,runScriptCommand as Ve}from"./packem_shared/addArgsFor-CWb4cPij.mjs";import{P as ue,s as Fe}from"./packem_shared/package-secrets-registry-DvtTiK4b.mjs";import{runPostCodegenHook as Ce}from"./packem_shared/runPostCodegenHook-CVrOTiGB.mjs";import{LUNORA_CONFIG_FILE as Ue,interpretRemote as be,readProjectRemotePreference as Me,readProjectTarget as ye,resolveProjectTarget as ke,resolveTargetOrThrow as Be}from"./packem_shared/LUNORA_CONFIG_FILE-D0F9TWxc.mjs";import{createConfirm as Ke,isInteractive as je,promptMultiSelect as He,promptSelect as Ye,promptText as he,promptYesNo as We}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{buildPackageSecretsBlock as qe,ensureDevVariables as Xe,ensureDevVarsExample as ze,fillDevSecrets as Qe,generateSecretValue as Ze,isMintableSecretKey as $e,isPlaceholderValue as er,planDevSecretsFill as rr,planDevVariablesAugment as or,planDevVariablesScaffold as tr,requiredSecrets as ar,writeDevVariablesFileAtomically as Er}from"./packem_shared/buildPackageSecretsBlock-yv9mjKEW.mjs";import{applyAdditiveEdit as ir,classifyEdit as lr}from"./packem_shared/applyAdditiveEdit-CH0VhMJ2.mjs";import{parseSchema as pr}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as cr,resolveServerModule as dr,scaffoldPolicyFile as mr,wireRlsIntoProcedure as Ar}from"./packem_shared/classifyPolicyEdit-D8NwrHxR.mjs";import{discoverSchemaInfo as Sr}from"./packem_shared/discoverSchemaInfo-DJvevsCm.mjs";import{ACCENT as Nr,BADGES as Lr,BADGE_COLUMN_WIDTH as vr,LUNA_ART as Rr,LUNA_BUNNY as Tr,LUNA_NAME as Ir,LUNA_SIGNOFF as gr,STEP_BADGE_NAMES as xr,badgeLead as Vr,badgeWidth as Pr,padBadge as ur,paintAnswer as Fr,paintBadge as Or}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{discoverWorkflowInfo as Gr}from"./packem_shared/discoverWorkflowInfo-BsPvlo6O.mjs";export{Nr as ACCENT,o as AGENT_MODE_ENV,i as AGENT_RULES_DIR,l as AGENT_RULES_HINT,n as AGENT_RULES_HINT_ENV,Lr as BADGES,vr as BADGE_COLUMN_WIDTH,A as CODEGEN_ENV,te as COMPOSED_WORKER_ENTRY,Q as DEFAULT_DEPLOY_TARGET,x as DEV_BINDINGS_FILE,V as DEV_DAEMON_ENV,P as DEV_HANDOFF_ENV,u as DEV_LOG_FILE,F as DEV_LOG_FILE_ENV,O as DEV_STATE_DIR,C as DEV_STATE_FILE,H as DEV_VARS_EXAMPLE_FILE,Y as DEV_VARS_FILE,h as DEV_VARS_KEY_PATTERN,ie as LINKED_PROJECT_DIR,le as LINKED_PROJECT_FILE,Rr as LUNA_ART,Tr as LUNA_BUNNY,Ir as LUNA_NAME,gr as LUNA_SIGNOFF,Ue as LUNORA_CONFIG_FILE,De as LUNORA_EVENT_SOURCE,ce as LUNORA_IGNORED_PATHS,p as LUNORA_SKILL_NAMES,Ne as LunoraReporter,ue as PACKAGE_SECRETS_REGISTRY,_ as ROOT_SKILL_NAME,xr as STEP_BADGE_NAMES,ve as addArgsFor,ir as applyAdditiveEdit,de as applyLintIgnores,Vr as badgeLead,Pr as badgeWidth,qe as buildPackageSecretsBlock,c as claimAgentRulesHint,G as claimDevServerState,lr as classifyEdit,cr as classifyPolicyEdit,U as clearDevServerState,Ke as createConfirm,Z as deployTargetIds,d as detectAgentRules,t as detectAiAgent,R as detectFramework,Re as detectInstalledManagers,me as detectLintTools,Te as detectPackageManager,E as discoverAgentInfo,f as discoverContainerInfo,Sr as discoverSchemaInfo,Gr as discoverWorkflowInfo,Xe as ensureDevVariables,ze as ensureDevVarsExample,W as escapeRegExp,Ie as execArgsFor,Qe as fillDevSecrets,Se as formatLunoraEvent,Ze as generateSecretValue,ae as inferLunoraBindings,ge as installArgsFor,be as interpretRemote,D as isCodegenDisabled,b as isDevServerReady,je as isInteractive,$e as isMintableSecretKey,er as isPlaceholderValue,M as isProcessAlive,y as isRecordedProcessCurrent,$ as isRunnableTarget,Ee as packageNamesFromBindings,ur as padBadge,Fr as paintAnswer,Or as paintBadge,J as parseDevVariableEntries,pr as parseSchema,rr as planDevSecretsFill,or as planDevVariablesAugment,tr as planDevVariablesScaffold,T as projectUsesUmbrella,He as promptMultiSelect,Ye as promptSelect,he as promptText,We as promptYesNo,k as readDevServerState,ne as readLinkedProject,B as readLiveDevServerState,I as readProjectDependencyNames,Me as readProjectRemotePreference,ye as readProjectTarget,q as removeDevVariableLine,ar as requiredSecrets,ee as resolveDeployDriver,ke as resolveProjectTarget,dr as resolveServerModule,Be as resolveTargetOrThrow,Ce as runPostCodegenHook,xe as runScriptArgsFor,Ve as runScriptCommand,re as runnableTargetIds,mr as scaffoldPolicyFile,Fe as secretsForPackages,L as streamContainerLogs,w as updateDevServerState,X as upsertDevVariableLine,Ar as wireRlsIntoProcedure,K as writeDevServerState,Er as writeDevVariablesFileAtomically,pe 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 i,AGENT_RULES_HINT as l,AGENT_RULES_HINT_ENV as n,LUNORA_SKILL_NAMES as p,ROOT_SKILL_NAME as _,claimAgentRulesHint as c,detectAgentRules as d}from"./packem_shared/AGENT_RULES_DIR-C54Ta_vz.mjs";import{CODEGEN_ENV as m,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 R,projectUsesUmbrella as T,readProjectDependencyNames as g}from"./packem_shared/detectFramework-CUiVEHDQ.mjs";import{DEV_BINDINGS_FILE as x,DEV_DAEMON_ENV as V,DEV_HANDOFF_ENV as P,DEV_LOG_FILE as u,DEV_LOG_FILE_ENV as O,DEV_STATE_DIR as F,DEV_STATE_FILE as C,claimDevServerState as G,clearDevServerState as U,isDevServerReady as b,isProcessAlive as M,isRecordedProcessCurrent as y,readDevServerState as k,readLiveDevServerState as B,updateDevServerState as w,writeDevServerState as K}from"./packem_shared/DEV_BINDINGS_FILE-pyOiNLP4.mjs";import{DEV_VARS_EXAMPLE_FILE as H,DEV_VARS_FILE as Y,DEV_VARS_KEY_PATTERN as h,escapeRegExp as W,parseDevVariableEntries as J,removeDevVariableLine as q,upsertDevVariableLine as X}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEFAULT_DEPLOY_TARGET as Q,deployTargetIds as Z,isRunnableTarget as $,resolveDeployDriver as ee,runnableTargetIds as re}from"./packem_shared/DEFAULT_DEPLOY_TARGET-B-e9mqgX.mjs";import{COMPOSED_WORKER_ENTRY as te,GENERATED_CLASS_MODULES as ae,inferLunoraBindings as Ee,packageNamesFromBindings as se}from"./packem_shared/COMPOSED_WORKER_ENTRY-Bj793dir.mjs";import{LINKED_PROJECT_DIR as le,LINKED_PROJECT_FILE as ne,readLinkedProject as pe,writeLinkedProject as _e}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as de,applyLintIgnores as Se,detectLintTools as me}from"./packem_shared/LUNORA_IGNORED_PATHS-BHABA9u-.mjs";import{LUNORA_EVENT_SOURCE as Ae,formatLunoraEvent as fe}from"./packem_shared/LUNORA_EVENT_SOURCE-DYdcDU9G.mjs";import{default as Ne}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as Re,detectInstalledManagers as Te,detectPackageManager as ge,execArgsFor as Ie,installArgsFor as xe,runScriptArgsFor as Ve,runScriptCommand as Pe}from"./packem_shared/addArgsFor-CWb4cPij.mjs";import{P as Oe,s as Fe}from"./packem_shared/package-secrets-registry-DvtTiK4b.mjs";import{runPostCodegenHook as Ge}from"./packem_shared/runPostCodegenHook-CVrOTiGB.mjs";import{interpretRemote as be,readProjectRemotePreference as Me,readProjectTarget as ye,resolveProjectTarget as ke,resolveTargetOrThrow as Be}from"./packem_shared/interpretRemote-CQ06qpjM.mjs";import{createConfirm as Ke,isInteractive as je,promptMultiSelect as He,promptSelect as Ye,promptText as he,promptYesNo as We}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{buildPackageSecretsBlock as qe,ensureDevVariables as Xe,ensureDevVarsExample as ze,fillDevSecrets as Qe,generateSecretValue as Ze,isMintableSecretKey as $e,isPlaceholderValue as er,planDevSecretsFill as rr,planDevVariablesAugment as or,planDevVariablesScaffold as tr,requiredSecrets as ar,writeDevVariablesFileAtomically as Er}from"./packem_shared/buildPackageSecretsBlock-yv9mjKEW.mjs";import{applyAdditiveEdit as ir,classifyEdit as lr}from"./packem_shared/applyAdditiveEdit-CH0VhMJ2.mjs";import{parseSchema as pr}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as cr,resolveServerModule as dr,scaffoldPolicyFile as Sr,wireRlsIntoProcedure as mr}from"./packem_shared/classifyPolicyEdit-D8NwrHxR.mjs";import{discoverSchemaInfo as Ar}from"./packem_shared/discoverSchemaInfo-DJvevsCm.mjs";import{ACCENT as Lr,BADGES as Nr,BADGE_COLUMN_WIDTH as vr,LUNA_ART as Rr,LUNA_BUNNY as Tr,LUNA_NAME as gr,LUNA_SIGNOFF as Ir,STEP_BADGE_NAMES as xr,badgeLead as Vr,badgeWidth as Pr,padBadge as ur,paintAnswer as Or,paintBadge as Fr}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{discoverWorkflowInfo as Gr}from"./packem_shared/discoverWorkflowInfo-BsPvlo6O.mjs";export{Lr as ACCENT,o as AGENT_MODE_ENV,i as AGENT_RULES_DIR,l as AGENT_RULES_HINT,n as AGENT_RULES_HINT_ENV,Nr as BADGES,vr as BADGE_COLUMN_WIDTH,m as CODEGEN_ENV,te as COMPOSED_WORKER_ENTRY,Q as DEFAULT_DEPLOY_TARGET,x as DEV_BINDINGS_FILE,V as DEV_DAEMON_ENV,P as DEV_HANDOFF_ENV,u as DEV_LOG_FILE,O as DEV_LOG_FILE_ENV,F as DEV_STATE_DIR,C as DEV_STATE_FILE,H as DEV_VARS_EXAMPLE_FILE,Y as DEV_VARS_FILE,h as DEV_VARS_KEY_PATTERN,ae as GENERATED_CLASS_MODULES,le as LINKED_PROJECT_DIR,ne as LINKED_PROJECT_FILE,Rr as LUNA_ART,Tr as LUNA_BUNNY,gr as LUNA_NAME,Ir as LUNA_SIGNOFF,Ae as LUNORA_EVENT_SOURCE,de as LUNORA_IGNORED_PATHS,p as LUNORA_SKILL_NAMES,Ne as LunoraReporter,Oe as PACKAGE_SECRETS_REGISTRY,_ as ROOT_SKILL_NAME,xr as STEP_BADGE_NAMES,Re as addArgsFor,ir as applyAdditiveEdit,Se as applyLintIgnores,Vr as badgeLead,Pr as badgeWidth,qe as buildPackageSecretsBlock,c as claimAgentRulesHint,G as claimDevServerState,lr as classifyEdit,cr as classifyPolicyEdit,U as clearDevServerState,Ke as createConfirm,Z as deployTargetIds,d as detectAgentRules,t as detectAiAgent,R as detectFramework,Te as detectInstalledManagers,me as detectLintTools,ge as detectPackageManager,E as discoverAgentInfo,f as discoverContainerInfo,Ar as discoverSchemaInfo,Gr as discoverWorkflowInfo,Xe as ensureDevVariables,ze as ensureDevVarsExample,W as escapeRegExp,Ie as execArgsFor,Qe as fillDevSecrets,fe as formatLunoraEvent,Ze as generateSecretValue,Ee as inferLunoraBindings,xe as installArgsFor,be as interpretRemote,D as isCodegenDisabled,b as isDevServerReady,je as isInteractive,$e as isMintableSecretKey,er as isPlaceholderValue,M as isProcessAlive,y as isRecordedProcessCurrent,$ as isRunnableTarget,se as packageNamesFromBindings,ur as padBadge,Or as paintAnswer,Fr as paintBadge,J as parseDevVariableEntries,pr as parseSchema,rr as planDevSecretsFill,or as planDevVariablesAugment,tr as planDevVariablesScaffold,T as projectUsesUmbrella,He as promptMultiSelect,Ye as promptSelect,he as promptText,We as promptYesNo,k as readDevServerState,pe as readLinkedProject,B as readLiveDevServerState,g as readProjectDependencyNames,Me as readProjectRemotePreference,ye as readProjectTarget,q as removeDevVariableLine,ar as requiredSecrets,ee as resolveDeployDriver,ke as resolveProjectTarget,dr as resolveServerModule,Be as resolveTargetOrThrow,Ge as runPostCodegenHook,Ve as runScriptArgsFor,Pe as runScriptCommand,re as runnableTargetIds,Sr as scaffoldPolicyFile,Fe as secretsForPackages,N as streamContainerLogs,w as updateDevServerState,X as upsertDevVariableLine,mr as wireRlsIntoProcedure,K as writeDevServerState,Er as writeDevVariablesFileAtomically,_e as writeLinkedProject};
@@ -0,0 +1 @@
1
+ import{existsSync as l,statSync as w,readFileSync as b,readdirSync as j}from"node:fs";import{init as Y,parse as f}from"es-module-lexer";import{discoverAgentInfo as K}from"./discoverAgentInfo-CTdCSfYM.mjs";import{WRANGLER_FILES as W,readWranglerJsonc as M}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{discoverContainerInfo as G}from"./discoverContainerInfo-EhZtEBQs.mjs";import{escapeRegExp as D}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{discoverFlags as X,FLAGS_FILENAME as q,discoverQueues as H,QUEUES_FILENAME as Q}from"@lunora/codegen";import{d as C}from"./discover-info-Vj9d4qYt.mjs";import{discoverSchemaInfo as V}from"./discoverSchemaInfo-DJvevsCm.mjs";import{discoverWorkflowInfo as J}from"./discoverWorkflowInfo-BsPvlo6O.mjs";import{join as c}from"node:path";const z=(e,s)=>{const{error:t,value:r}=C(e,s,q,X);return t===void 0?{flags:r}:{error:t}},Z=(e,s)=>{const{error:t,value:r}=C(e,s,Q,H);return t===void 0?{queues:r??[]}:{error:t,queues:[]}},ee=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),R="_generated",se=new Set([".git",".lunora-cache",".wrangler","dist",R,"node_modules"]),re=["lunora","src"],te=["src/server.ts","src/server/index.ts","src/server/index.tsx","src/index.ts","src/worker.ts"],ne=new Set(["build","coverage","dist",R,"node_modules","out","target"]),oe=new Set([".client",".server"]),ae=/[/\\]/u,ie=e=>{const s=[];for(const t of e.split(ae))t===""||t==="."||(t===".."&&s.length>0&&s.at(-1)!==".."?s.pop():s.push(t));return s},ce=e=>ie(e).slice(0,-1).some(s=>ne.has(s)||s.startsWith(".")&&!oe.has(s)),g={SchedulerDO:"SCHEDULER",SessionDO:"SESSION",ShardDO:"SHARD"},v=Object.keys(g),qe=e=>Object.hasOwn(g,e),ue=/\benv\s*\.\s*DB\b/,le=/\benv\s*\.\s*AI\b/,P=/\bctx\s*\.\s*pipelines\b/,L=/\bctx\s*\.\s*r2sql\b/,B=/^\s*import\s+type\b/,de=new Set(["@lunora/agent","@lunora/agent/sandbox"]),pe=e=>{const s=e.indexOf("{");if(s===-1)return"";const t=e.indexOf("}",s+1);return t===-1?e.slice(s+1):e.slice(s+1,t)},me=/\btype\s+browserTool\b/,be=/\bbrowserTool\b/,fe=/import\s+\{[^}]*\bbrowserTool\b[^}]*\}\s+from\s+["']@lunora\/agent(?:\/sandbox)?["']/,ge=e=>{if(B.test(e))return!1;const s=pe(e);return be.test(s)&&!me.test(s)},Ee=e=>{try{const[s]=f(e);return s.some(t=>t.n!==void 0&&de.has(t.n)&&ge(e.slice(t.ss,t.se)))}catch{return fe.test(e)}},E={usesAi:{pattern:/\bfrom\s+["']@lunora\/ai["']/,source:"@lunora/ai"},usesAnalytics:{pattern:/\bfrom\s+["']@lunora\/bindings\/analytics["']/,source:"@lunora/bindings/analytics"},usesAuth:{pattern:/\bfrom\s+["']@lunora\/auth["']/,source:"@lunora/auth"},usesBrowser:{pattern:/\bfrom\s+["']@lunora\/browser["']/,source:"@lunora/browser"},usesHyperdrive:{pattern:/\bfrom\s+["']@lunora\/hyperdrive["']/,source:"@lunora/hyperdrive"},usesImages:{pattern:/\bfrom\s+["']@lunora\/bindings\/images["']/,source:"@lunora/bindings/images"},usesKv:{pattern:/\bfrom\s+["']@lunora\/bindings\/kv["']/,source:"@lunora/bindings/kv"},usesMail:{pattern:/\bfrom\s+["']@lunora\/mail["']/,source:"@lunora/mail"},usesNotify:{pattern:/\bfrom\s+["']@lunora\/notify["']/,source:"@lunora/notify"},usesPayment:{pattern:/\bfrom\s+["']@lunora\/payment["']/,source:"@lunora/payment"},usesPipelines:{pattern:P,source:"@lunora/bindings/pipelines"},usesR2sql:{pattern:L,source:"@lunora/bindings/r2sql"},usesScheduler:{pattern:/\bfrom\s+["']@lunora\/scheduler["']/,source:"@lunora/scheduler"},usesStorage:{pattern:/\bfrom\s+["']@lunora\/storage["']/,source:"@lunora/storage"},usesX402Charge:{pattern:/\bfrom\s+["']@lunora\/x402\/charge["']/,source:"@lunora/x402/charge"},usesX402Pay:{pattern:/\bfrom\s+["']@lunora\/x402\/pay["']/,source:"@lunora/x402/pay"}},p=Object.keys(E),he="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",k=[...p,"needsD1"],Se=()=>{const e={};for(const s of k)e[s]=!1;return e},d=Object.freeze(Se()),x=(e,s)=>{const t={};for(const r of k)t[r]=e[r]||s[r];return t},_e=e=>{for(const s of p)if(E[s].source===e)return{...d,[s]:!0};return d},Re=e=>{const[s]=f(e);let t=d;for(const r of s){const n=r.n;!n||B.test(e.slice(r.ss,r.se))||(t=x(t,_e(n)))}return t},xe=e=>{const s={...d};for(const t of p)s[t]=E[t].pattern.test(e);return s},ye=e=>{let s;try{s=Re(e)}catch{s=xe(e)}return x(s,{...d,needsD1:ue.test(e),usesAi:le.test(e),usesPipelines:P.test(e),usesR2sql:L.test(e)})},y=(e,s)=>{let t;try{t=j(e,{withFileTypes:!0})}catch{return}for(const r of t){if(r.isDirectory()){se.has(r.name)||y(c(e,r.name),s);continue}const n=r.name.lastIndexOf(".");n!==-1&&ee.has(r.name.slice(n))&&s.push(c(e,r.name))}},Oe="virtual:lunora/worker",Ie=["ShardDO"],He=["agents","containers","scheduler","workflows"],Ae="src/worker.ts",Ne=e=>{for(const s of W){const t=c(e,s);if(!l(t))continue;const{parsed:r}=M(t),n=r?.main;if(n===Oe)return{composed:!0};const a=c(e,Ae);if(l(a))return{composed:!1,path:a};if(typeof n=="string"&&!ce(n)&&l(c(e,n)))return{composed:!1,path:c(e,n)};break}for(const s of te){const t=c(e,s);if(l(t))return{composed:!1,path:t}}return{composed:!1}},Te=/(?:^|[\s,{])type$/u,$=(e,s)=>{const t=s.ls>=0?s.ls:s.s;return Te.test(e.slice(0,t).trimEnd())},F=(e,s)=>{const t=D(s);return new RegExp(String.raw`\bexport\s+type\s+${t}\b`,"u").test(e)||new RegExp(String.raw`\bexport\s+type\s*\{[^}]*\b${t}\b`,"u").test(e)||new RegExp(String.raw`\bexport\s+\{[^}]*\btype\s+${t}\b`,"u").test(e)},ve=e=>{const s=b(e,"utf8");let t;try{const[,r]=f(s);t=new Set(r.filter(n=>!$(s,n)).map(n=>n.n))}catch{t=new Set(v.filter(r=>new RegExp(String.raw`\bexport\b[^\n;]*\b${r}\b`,"u").test(s)&&!F(s,r)))}return v.filter(r=>t.has(r)).map(r=>({binding:g[r],className:r}))},_=(e,s,t)=>{if(s.length===0)return[];if(e.composed)return s.map(o=>({...o,exported:!0}));if(e.path===void 0)return s.map(o=>({...o,exported:!1}));const r=b(e.path,"utf8"),n=new RegExp(String.raw`\bexport\s*\*\s*from\s*["'][^"']*_generated\/${t}(?:\.js)?["']`).test(r);let a;try{const[,o]=f(r);a=new Set(o.filter(i=>!$(r,i)).map(i=>i.n))}catch{a=new Set(s.map(o=>o.className).filter(o=>new RegExp(String.raw`\bexport\b[^\n;]*\b${D(o)}\b`,"u").test(r)&&!F(r,o)))}return s.map(o=>{const i=n||a.has(o.className);return{...o,exported:i}})},we=(e,s)=>V(e,s).info?.hasD1GlobalTable??!1,De=(e,s)=>{let t=d;for(const r of s){const n=c(e,r);if(!l(n)||!w(n).isDirectory())continue;const a=[];y(n,a);for(const o of a)t=x(t,ye(b(o,"utf8")))}return t},Ce=(e,s)=>{const t=c(e,s);if(!l(t)||!w(t).isDirectory())return!1;const r=[];return y(t,r),r.some(n=>Ee(b(n,"utf8")))},Pe=(e,s,t)=>[...e.map(r=>r.exported?`${r.bindingName}/${r.className} (container "${r.exportName}" declared and exported)`:`hint: container "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...s.map(r=>r.exported?`${r.bindingName}/${r.className} (workflow "${r.exportName}" declared and exported)`:`hint: workflow "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...t.map(r=>r.exported?`${r.bindingName}/${r.className} (agent "${r.exportName}" declared and exported)`:`hint: agent "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],Le=(e,s)=>[[e.usesAi,"AI (@lunora/ai imported or env.AI used)"],[e.usesAuth&&!s.has("SessionDO"),"hint: @lunora/auth is imported; its tables are D1-backed by default. For DO-backed auth (what @better-auth/scim needs), pass `namespace` to .auth() and export the generated auth DO class"],[e.usesScheduler&&!s.has("SchedulerDO"),"hint: @lunora/scheduler is imported but no SchedulerDO is exported by the worker entry"],[e.usesStorage,"hint: @lunora/storage is imported; add an r2_buckets binding (bucket binding names are user-defined)"],[e.usesMail,"hint: @lunora/mail is imported; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)"],[e.usesPayment,`hint: @lunora/payment is imported; set the provider secrets in .dev.vars — ${he}`],[e.usesBrowser,"browser (@lunora/browser imported) — self-describing { binding: BROWSER }"],[e.usesImages,"images (@lunora/bindings/images imported) — self-describing { binding: IMAGES }"],[e.usesAnalytics,"analytics_engine_datasets (@lunora/bindings/analytics imported) — self-describing { binding: ANALYTICS, dataset }"],[e.usesKv,"hint: @lunora/bindings/kv is imported; add a kv_namespaces binding ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned"],[e.usesHyperdrive,"hint: @lunora/hyperdrive is imported; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned"],[e.usesPipelines,"hint: ctx.pipelines is used; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, pipeline }) — the pipeline resource can't be auto-provisioned"],[e.usesX402Charge,"hint: @lunora/x402/charge is imported; set the recipient wallet address as a [vars] entry (the var name is yours to choose) and pass it to the charge config — the x402 facilitator settles USDC to that address"],[e.usesX402Pay,"hint: @lunora/x402/pay is imported (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding for the agent wallet key (name it to match signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars, so the key can't be auto-provisioned"]].filter(([r])=>r).map(([,r])=>r),Be=(e,s,t,r=[],n=[],a=[])=>{const o=new Set(e.map(u=>u.className)),i=e.map(u=>`${u.binding}/${u.className} (exported by worker entry)`);return s&&i.push("DB (.global() table declared)"),i.push(...Pe(r,n,a),...Le(t,o)),i},Qe=async e=>{await Y;const s=e.schemaDir??"lunora",t=e.scanDirs??re,r=De(e.projectRoot,t),n={...r,usesBrowser:r.usesBrowser||Ce(e.projectRoot,s)},a=Ne(e.projectRoot);let o;a.composed?o=[...Ie,...l(c(e.projectRoot,s,R,"scheduler.ts"))?["SchedulerDO"]:[]].map(T=>({binding:g[T],className:T})):o=a.path===void 0?[]:ve(a.path);const i=n.needsD1||we(e.projectRoot,s),u=_(a,G(e.projectRoot,s).containers,"containers"),O=_(a,J(e.projectRoot,s).workflows,"workflows"),I=_(a,K(e.projectRoot,s).agents,"agents"),U=[...Z(e.projectRoot,s).queues],{flags:m}=z(e.projectRoot,s),h=m?.provider==="flagship"&&m.mode==="binding"?m.bindingName:void 0,A={};for(const S of p)A[S]=n[S];const N=Be(o,i,n,u,O,I);return h!==void 0&&N.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${h}", app_id }) — the app_id can't be auto-provisioned`),{agents:I,containers:u,durableObjects:o,flagshipBinding:h,needsD1:i,queues:U,signals:N,usesFlags:m!==void 0,workflows:O,...A}},Ve=e=>{const s=[];for(const t of p)e[t]&&s.push(E[t].source);return s};export{Ie as COMPOSED_ENTRY_DURABLE_OBJECTS,Ae as COMPOSED_WORKER_ENTRY,He as GENERATED_CLASS_MODULES,R as GENERATED_DIRECTORY,Oe as LUNORA_WORKER_VIRTUAL_ID,ne as NON_SOURCE_DIRECTORIES,oe as SOURCE_DOT_DIRECTORIES,te as WORKER_ENTRY_FALLBACKS,Qe as inferLunoraBindings,qe as isFrameworkDurableObject,ce as isGeneratedOutput,Ve as packageNamesFromBindings,Ne as resolveWorkerEntry};
@@ -0,0 +1 @@
1
+ import{existsSync as f,readFileSync as B,readdirSync as X}from"node:fs";import{join as g,dirname as R,extname as w,basename as U}from"node:path";import{COMPOSED_WORKER_ENTRY as J,LUNORA_WORKER_VIRTUAL_ID as E,isGeneratedOutput as Z,WORKER_ENTRY_FALLBACKS as ee,GENERATED_DIRECTORY as te,COMPOSED_ENTRY_DURABLE_OBJECTS as W,GENERATED_CLASS_MODULES as F,SOURCE_DOT_DIRECTORIES as se,NON_SOURCE_DIRECTORIES as ne,isFrameworkDurableObject as ie}from"./COMPOSED_WORKER_ENTRY-Bj793dir.mjs";import{discoverSchemaInfo as ae}from"./discoverSchemaInfo-DJvevsCm.mjs";import{Project as oe,Node as m}from"ts-morph";import{isCacheEnabled as re,WORKERS_CACHE_MIN_DATE as k}from"./WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{findWranglerFile as ce,readWranglerJsonc as de}from"./WRANGLER_FILES-UNW-xY5u.mjs";const le=new Set(["1","enabled","on","true","yes"]),ue=e=>typeof e=="string"&&le.has(e.trim().toLowerCase()),$=[".ts",".tsx",".mts",".cts"],S=new Set($),me=new Set([".cjs",".js",".mjs"]),A="default",N={".cjs":[".cts"],".js":[".ts",".tsx"],".mjs":[".mts"]},ge=250,pe=(e,t,n)=>{const s=g(t,J);if(f(s))return{origin:"declared",path:s};if(e===E)return{origin:"composed"};const i=()=>{const r=ee.map(c=>g(t,c)).find(c=>f(c));return r===void 0?void 0:{origin:"probed",path:r}};if(typeof e!="string"||e.length===0||Z(e))return i();const a=g(R(n),e),o=w(a);if(!(!S.has(o)&&!me.has(o)))return f(a)?{origin:"declared",path:a}:{origin:"absent",path:a}},P=(e,t)=>{if(m.isIdentifier(e)){t.add(e.getText());return}if(m.isObjectBindingPattern(e)||m.isArrayBindingPattern(e))for(const n of e.getElements())m.isBindingElement(n)&&P(n.getNameNode(),t)},fe=(e,t)=>{const n=[];for(const s of e.getExportDeclarations())if(!s.isTypeOnly()){if(s.isNamespaceExport()){const i=s.getNamespaceExport();i===void 0?n.push(s.getModuleSpecifierValue()??""):t.add(i.getName());continue}for(const i of s.getNamedExports())i.isTypeOnly()||t.add(i.getAliasNode()?.getText()??i.getName())}return n},be=(e,t)=>{for(const n of e.getVariableStatements().filter(s=>s.getExportKeyword()!==void 0))for(const s of n.getDeclarations())P(s.getNameNode(),t);for(const n of[...e.getClasses(),...e.getFunctions(),...e.getEnums()]){if(n.getExportKeyword()===void 0)continue;const s=n.isDefaultExport()?A:n.getName();s!==void 0&&t.add(s)}e.getExportAssignments().length>0&&t.add(A)},q=(e,t)=>{const n=new oe({compilerOptions:{allowJs:!0},skipFileDependencyResolution:!0,skipLoadingLibFiles:!0,useInMemoryFileSystem:!0}),s=n.createSourceFile(e,t,{overwrite:!0});return n.getProgram().compilerObject.getSyntacticDiagnostics(s.compilerNode).length>0?void 0:s},he=(e,t)=>{if(!t.startsWith("./")&&!t.startsWith("../"))return;const n=g(R(e),t),s=w(n),i=S.has(s)||N[s]!==void 0,a=i?n.slice(0,-s.length):n;return[...S.has(s)?[n]:[],...(N[s]??[]).map(r=>`${a}${r}`),...i?[]:$.map(r=>`${n}${r}`),...i||s.length===0?$.map(r=>g(a,`index${r}`)):[]].find(r=>f(r))},G=e=>{const t=new Set,n=new Set([e]),s=[e];for(;s.length>0;){if(n.size-1>ge)return;const i=s.pop();let a;try{a=B(i,"utf8")}catch{return}const o=q(U(i),a);if(o===void 0)return;const r=fe(o,t);be(o,t);for(const c of r){const d=he(i,c);if(d===void 0)return;n.has(d)||(n.add(d),s.push(d))}}return t},ye=(e,t)=>{const n={exports:void 0,kind:"composed",path:E},s=g(e,t,te);if(!f(s))return n;const i=new Set(W);for(const a of F){const o=g(s,`${a}.ts`);if(!f(o))continue;const r=G(o);if(r===void 0)return n;for(const c of r)i.add(c)}return{exports:i,kind:"composed",path:E}},ve=(e,t,n)=>{if(e===void 0||e.origin==="absent")return;if(e.origin==="composed")return ye(t,n);const s=G(e.path);if(!(e.origin==="probed"&&s!==void 0&&!s.has(A)))return{exports:s,kind:"authored",path:e.path}},_e=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),Ee=2e3,D="defineTable",x="defineApp",$e=e=>{const t=[],n=[];let s;try{s=X(e,{withFileTypes:!0})}catch{return{files:t,subdirectories:n}}for(const i of s)i.isDirectory()?i.name.startsWith(".")&&!se.has(i.name)||ne.has(i.name)||n.push(g(e,i.name)):_e.has(w(i.name))&&t.push(g(e,i.name));return{files:t,subdirectories:n}},K=(e,t)=>{const n=new Set;for(const s of e.getImportDeclarations())for(const i of s.getNamedImports())!i.isTypeOnly()&&i.getName()===t&&n.add(i.getAliasNode()?.getText()??i.getName());return n},Se=(e,t)=>{let n=!1;return e.forEachDescendant((s,i)=>{if(!m.isCallExpression(s))return;const a=s.getExpression();m.isIdentifier(a)&&t.has(a.getText())&&(n=!0,i.stop())}),n},Ae=e=>{let t=e;for(;m.isCallExpression(t)||m.isPropertyAccessExpression(t);)t=t.getExpression();return t},Re=(e,t)=>{const n=Ae(e);return m.isIdentifier(n)&&t.has(n.getText())},Y={global:/\.\s*global\s*\(/u,hyperdriveGlobal:/\.\s*hyperdriveGlobal\s*\(/u,vectors:/\.\s*vectors\s*\(/u},we=e=>Object.hasOwn(Y,e),je=(e,t)=>{const n=new Set,s=new Set([D,...K(e,D)]);return e.forEachDescendant(i=>{if(!m.isCallExpression(i))return;const a=i.getExpression();if(!m.isPropertyAccessExpression(a)||Re(a,s))return;const o=a.getName();we(o)&&t.has(o)&&n.add(o)}),n},Oe=(e,t)=>{let n;try{n=B(e,"utf8")}catch{return}const s=new Set([...t].filter(a=>Y[a].test(n)));if(s.size===0&&!n.includes(x))return;const i=q(U(e),n);return i===void 0?{chained:s,composes:!1}:{chained:je(i,s),composes:Se(i,K(i,x))}},ke=(e,t)=>{const n=[e],s=new Set;let i=0,a;const o=r=>{if(i+=1,i>Ee)return!1;const c=Oe(r,t);for(const d of c?.chained??[])s.add(d);return c?.composes&&(a??=r),!0};for(;n.length>0;){const r=n.pop(),{files:c,subdirectories:d}=$e(r);n.push(...d);for(const l of c){if(!o(l))return;if(a!==void 0&&s.size===t.size)return{chained:s,site:a}}}return a===void 0?void 0:{chained:s,site:a}},I="2026-04-07",Et="web_socket_auto_reply_to_close",M=/^\d{4}-\d{2}-\d{2}$/,T=["containers","d1_databases","durable_objects","kv_namespaces","queues","r2_buckets","secrets_store_secrets","services","tail_consumers","vars","vectorize","workflows"],C=["assets","compatibility_date","exports","logpush","main","migrations","observability","placement"],H=(e,t)=>{if(t===void 0)return{merged:e,unverifiedKeys:[]};const n=e.env?.[t];if(n===void 0){const r=Object.keys(e.env??{}).toSorted((d,l)=>d.localeCompare(l)),c=r.length>0?` (declared: ${r.join(", ")}).`:" (no environments are declared).";return{error:`--env "${t}" names no environment declared in wrangler.jsonc's "env" block${c}`,merged:e,unverifiedKeys:[]}}const s={...e},i=Object.keys(n).filter(r=>r!=="env");for(const r of i)C.includes(r)&&(s[r]=n[r]);for(const r of T)s[r]=n[r];const a=new Set([...T,...C]),o=i.filter(r=>!a.has(r)).map(String);return{merged:s,unverifiedKeys:o}},Ne=(e,t,n)=>{if(t.length===0)return;const s=e.vectorize??[],i=new Set(s.filter(Boolean).map(a=>a?.index_name));for(const a of t)i.has(a)||n.push(`schema declares vector index "${a}"; wrangler "vectorize" must include a binding with index_name "${a}"`)},De=new Set(["basic","dev","lite","standard","standard-1","standard-2","standard-3","standard-4"]),xe={disk_mb:2e4,memory_mib:12288,vcpu:4},Ie=(e,t,n)=>{const s=e.instance_type;if(s===void 0)return;if(typeof s=="string"){De.has(s)||n.push(`${t} has unknown instance_type "${s}" — expected lite, basic, standard-1..4, or a custom { vcpu, memory_mib, disk_mb } object`);return}for(const[r,c]of Object.entries(xe)){const d=s[r];d!==void 0&&(typeof d!="number"||d<=0||d>c)&&n.push(`${t} custom instance_type ${r} must be a positive number ≤ ${String(c)} (got ${String(d)})`)}const{disk_mb:i,memory_mib:a,vcpu:o}=s;if(typeof o=="number"&&typeof a=="number"&&a<o*3072&&n.push(`${t} custom instance_type needs ≥ 3 GiB (3072 MiB) memory per vCPU (got ${String(a)} MiB for ${String(o)} vCPU)`),typeof a=="number"&&typeof i=="number"){const r=Math.floor(a/1024*2e3);i>r&&n.push(`${t} custom instance_type allows ≤ 2 GB disk per GiB memory (≤ ${String(r)} MB for ${String(a)} MiB memory; got ${String(i)} MB)`)}},Me=(e,t,n)=>{const{boundClasses:s,classKinds:i,errors:a,warnings:o}=n;if(!e||typeof e!="object"||typeof e.class_name!="string"||e.class_name.length===0){a.push(`${t} must have a non-empty "class_name" naming its container-enabled Durable Object class`);return}(typeof e.image!="string"||e.image.length===0)&&a.push(`${t} ("${e.class_name}") must have an "image" — a Dockerfile path or a registry reference`),s.has(e.class_name)||a.push(`${t} class "${e.class_name}" has no matching durable_objects binding — your dev server auto-reconciles this on startup; add { "name": "...", "class_name": "${e.class_name}" } to fix it by hand`);const r=i.get(e.class_name);r!=="sqlite"&&a.push(r==="classic"?`${t} class "${e.class_name}" is registered via "new_classes" but containers require SQLite-backed DOs — move it to "new_sqlite_classes"`:`${t} class "${e.class_name}" is missing from migrations — add a migration entry with "new_sqlite_classes": ["${e.class_name}"]`),Ie(e,`${t} ("${e.class_name}")`,a),e.max_instances===void 0&&o.push(`${t} ("${e.class_name}") declares no max_instances — set a cap so a traffic spike can't fan out unbounded container spend`)},u=e=>typeof e=="string"&&e.length>0,p=e=>Array.isArray(e)?e.filter(t=>t!==null&&typeof t=="object"):[],_=e=>Array.isArray(e)?e.filter(t=>u(t)):[],V=e=>{const t=new Map;for(const n of p(e)){for(const s of _(n.new_classes))t.set(s,"classic");for(const s of _(n.new_sqlite_classes))t.set(s,"sqlite");for(const s of p(n.renamed_classes))if(u(s.from)&&u(s.to)){const i=t.get(s.from)??"sqlite";t.delete(s.from),t.set(s.to,i)}for(const s of _(n.deleted_classes))t.delete(s)}return t},Te=e=>new Set(V(e).keys()),Ce=(e,t)=>{const n=Te(e.migrations);for(const s of p(e.durable_objects?.bindings))s.script_name===void 0&&u(s.class_name)&&!n.has(s.class_name)&&t.push(`durable_objects.bindings declares class "${s.class_name}" but it is missing from migrations — add a migration entry with "new_sqlite_classes": ["${s.class_name}"] (or "new_classes" for a non-SQLite-backed class), or let the dev server auto-reconcile it on the next start`)},Le=(e,t,n)=>{if(e.containers===void 0)return;if(!Array.isArray(e.containers)){t.push("containers must be an array of { class_name, image, ... } entries");return}const s=e.containers;if(s.length===0)return;const i=new Set(p(e.durable_objects?.bindings).map(o=>o.class_name)),a=V(e.migrations);for(const[o,r]of s.entries())Me(r,`containers[${String(o)}]`,{boundClasses:i,classKinds:a,errors:t,warnings:n});e.observability?.enabled!==!0&&n.push('containers are configured but observability is not enabled — container logs will not be captured (add { "observability": { "enabled": true } })')},j=e=>e,y=(e,t,n,s)=>{if(e!==void 0){if(!Array.isArray(e)){s.push(n.arrayMessage);return}for(const[i,a]of j(e).entries()){const o=`${t}[${String(i)}]`;if(!a||typeof a!="object"){s.push(n.objectMessage(o));continue}for(const r of n.fields)u(a[r.field])||s.push(r.message(o))}}},Be={arrayMessage:"workflows must be an array of { name, binding, class_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Workflow binding (e.g. WORKFLOW_ORDER_PIPELINE)`},{field:"class_name",message:e=>`${e} must have a non-empty "class_name" naming the exported WorkflowEntrypoint class`},{field:"name",message:e=>`${e} must have a non-empty "name" naming the deployed workflow`}],objectMessage:e=>`${e} must be a { name, binding, class_name } object`},Ue={arrayMessage:"queues.producers must be an array of { binding, queue } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Queue producer (e.g. QUEUE_EMAIL)`},{field:"queue",message:e=>`${e} must have a non-empty "queue" naming the deployed queue`}],objectMessage:e=>`${e} must be a { binding, queue } object`},We={arrayMessage:"queues.consumers must be an array of { queue } entries",fields:[{field:"queue",message:e=>`${e} must have a non-empty "queue" naming the consumed queue`}],objectMessage:e=>`${e} must be a { queue } object`},Fe=(e,t)=>{if(e.queues!==void 0){if(typeof e.queues!="object"||Array.isArray(e.queues)){t.push("queues must be a { producers, consumers } object");return}y(e.queues.producers,"queues.producers",Ue,t),y(e.queues.consumers,"queues.consumers",We,t)}},Pe={arrayMessage:"secrets_store_secrets must be an array of { binding, store_id, secret_name } entries",fields:["binding","store_id","secret_name"].map(e=>({field:e,message:t=>`${t} must have a non-empty "${e}"`})),objectMessage:e=>`${e} must be a { binding, store_id, secret_name } object`},qe=[{arrayMessage:"kv_namespaces must be an array of { binding, id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the KV namespace binding`,hintField:"id",hintMessage:(e,t)=>`${e} ("${t}") has no "id" — run \`wrangler kv namespace create\` and set the namespace id, or the binding can't resolve`,key:"kv_namespaces"},{arrayMessage:"flagship must be an array of { binding, app_id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Flagship binding`,hintField:"app_id",hintMessage:(e,t)=>`${e} ("${t}") has no "app_id" — create a Flagship app and set its id, or the binding can't resolve`,key:"flagship"},{arrayMessage:"hyperdrive must be an array of { binding, id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Hyperdrive binding`,hintField:"id",hintMessage:(e,t)=>`${e} ("${t}") has no "id" — run \`wrangler hyperdrive create\` and set the id, or the binding can't connect`,key:"hyperdrive"},{arrayMessage:"pipelines must be an array of { binding, stream } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Pipelines binding`,hintField:["stream","pipeline"],hintMessage:(e,t)=>`${e} ("${t}") has no "stream" — run \`wrangler pipelines create <name>\` and set the stream name, or the binding can't resolve`,key:"pipelines"},{arrayMessage:"analytics_engine_datasets must be an array of { binding, dataset } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Analytics Engine binding`,hintField:"dataset",hintMessage:(e,t)=>`${e} ("${t}") has no "dataset" — it defaults to the binding name; set it explicitly to avoid drift`,key:"analytics_engine_datasets"}],Ge=(e,t,n,s)=>{const i=e[t.key];if(i!==void 0){if(!Array.isArray(i)){n.push(t.arrayMessage);return}for(const[a,o]of j(i).entries()){const r=`${t.key}[${String(a)}]`;if(!o||typeof o!="object"||!u(o.binding)){n.push(t.bindingMessage(r));continue}(typeof t.hintField=="string"?[t.hintField]:t.hintField).some(d=>u(o[d]))||s.push(t.hintMessage(r,o.binding))}}},Ke=[{key:"browser",message:'browser must be an object with a non-empty "binding" (e.g. { "binding": "BROWSER" })'},{key:"images",message:'images must be an object with a non-empty "binding" (e.g. { "binding": "IMAGES" })'}],Ye=(e,t,n)=>{const s=e[t.key];s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)||!u(s.binding))&&n.push(t.message)},He=[{arrayMessage:"services must be an array of { binding, service, entrypoint? } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the service binding`},{field:"service",message:e=>`${e} must have a non-empty "service" naming the target Worker`}],key:"services",objectMessage:e=>`${e} must be a { binding, service, entrypoint? } object`},{arrayMessage:"dispatch_namespaces must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding"`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the dispatch namespace`}],key:"dispatch_namespaces",objectMessage:e=>`${e} must be a { binding, namespace } object`},{arrayMessage:"mtls_certificates must be an array of { binding, certificate_id } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding"`},{field:"certificate_id",message:e=>`${e} must have a non-empty "certificate_id" (upload via \`wrangler mtls-certificate upload\`)`}],key:"mtls_certificates",objectMessage:e=>`${e} must be a { binding, certificate_id } object`},{arrayMessage:"r2_buckets must be an array of { binding, bucket_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the R2 bucket binding`},{field:"bucket_name",message:e=>`${e} must have a non-empty "bucket_name" naming the deployed bucket`}],key:"r2_buckets",objectMessage:e=>`${e} must be a { binding, bucket_name } object`}],Ve=(e,t,n)=>{t?.hasD1GlobalTable&&!p(e.d1_databases).some(s=>s.binding==="DB")&&n.push('schema declares .global() tables; d1_databases must include a binding named "DB" — your dev server auto-reconciles this on startup, or add the binding manually'),t?.hasHyperdriveGlobalTable&&p(e.hyperdrive).length===0&&n.push('schema declares .global({ backend: "hyperdrive" }) tables; wrangler must declare a hyperdrive binding for `.hyperdriveGlobal({ exec })` to read — run `wrangler hyperdrive create <name> --connection-string=...` and add `"hyperdrive": [{ "binding": "HYPERDRIVE", "id": "<id>" }]` (any binding name works; your `exec` selector picks it)')},Qe=(e,t)=>{const{d1_databases:n}=e;if(n!==void 0){if(!Array.isArray(n)){t.push("d1_databases must be an array of { binding, database_id | database_name } entries");return}for(const[s,i]of j(n).entries()){const a=`d1_databases[${String(s)}]`;if(!i||typeof i!="object"){t.push(`${a} must be a { binding, database_id | database_name } object`);continue}u(i.binding)||t.push(`${a} must have a non-empty "binding" naming the D1 binding`),!u(i.database_id)&&!u(i.database_name)&&t.push(`${a} must have a "database_id" or a "database_name" — run \`wrangler d1 create\` and set one, or the binding can't resolve`)}}},ze=(e,t,n)=>{const s=e.send_email;if(s===void 0)return;if(!Array.isArray(s)){t.push("send_email must be an array of { name, destination_address? } entries");return}const i=s;for(const[a,o]of i.entries())(!o||typeof o!="object"||typeof o.name!="string"||o.name.length===0)&&n.push(`send_email[${String(a)}] has no non-empty "name" naming the send-email binding — set one before deploying`)},Xe=(e,t)=>{e.logpush!==void 0&&typeof e.logpush!="boolean"&&t.push('logpush must be a boolean (set "logpush": true to enable Cloudflare Logpush)')},L=new Set(["off","smart","targeted"]),Je=(e,t)=>{const{placement:n}=e;if(n===void 0)return;if(typeof n!="object"||n===null||Array.isArray(n)){t.push('placement must be an object (e.g. { "mode": "smart" })');return}const{mode:s}=n;s!==void 0&&(typeof s!="string"||!L.has(s))&&t.push(`placement.mode must be one of ${[...L].map(i=>`"${i}"`).join(", ")}`)},Ze=(e,t)=>{const{observability:n}=e;if(n===void 0)return;if(typeof n!="object"||Array.isArray(n)){t.push('observability must be an object (e.g. { "enabled": true, "head_sampling_rate": 1 })');return}const s=(i,a)=>{i!==void 0&&(typeof i!="number"||Number.isNaN(i)||i<0||i>1)&&t.push(`${a} must be a number in [0, 1] (the fraction of requests sampled)`)};s(n.head_sampling_rate,"observability.head_sampling_rate"),n.logs!==void 0&&(typeof n.logs!="object"||Array.isArray(n.logs)?t.push("observability.logs must be an object"):s(n.logs.head_sampling_rate,"observability.logs.head_sampling_rate"))},et=(e,t)=>{const{cache:n}=e;if(n!==void 0){if(typeof n!="object"||n===null||Array.isArray(n)){t.push('cache must be an object (e.g. { "enabled": true })');return}n.enabled!==void 0&&typeof n.enabled!="boolean"&&t.push("cache.enabled must be a boolean (true or false)")}},tt=(e,t)=>{const{exports:n}=e;if(n!==void 0){if(typeof n!="object"||n===null||Array.isArray(n)){t.push("exports must be an object keyed by entrypoint name");return}for(const[s,i]of Object.entries(n)){if(typeof i!="object"||i===null){t.push(`exports["${s}"] must be an object`);continue}i.type!==void 0&&typeof i.type!="string"&&t.push(`exports["${s}"].type must be a string`),i.cache!==void 0&&(typeof i.cache!="object"||i.cache===null||Array.isArray(i.cache)?t.push(`exports["${s}"].cache must be an object`):i.cache.enabled!==void 0&&typeof i.cache.enabled!="boolean"&&t.push(`exports["${s}"].cache.enabled must be a boolean`))}}},st=(e,t)=>{const{assets:n}=e;if(n!==void 0){if(typeof n!="object"||Array.isArray(n)){t.push('assets must be an object (e.g. { "directory": "./dist/client", "binding": "ASSETS" })');return}(typeof n.directory!="string"||n.directory.length===0)&&t.push('assets must declare a non-empty "directory" pointing at the built client output (e.g. "./dist/client")'),n.binding!==void 0&&(typeof n.binding!="string"||n.binding.length===0)&&t.push('assets.binding must be a non-empty string (e.g. "ASSETS")'),n.html_handling!==void 0&&typeof n.html_handling!="string"&&t.push("assets.html_handling must be a string"),n.not_found_handling!==void 0&&typeof n.not_found_handling!="string"&&t.push("assets.not_found_handling must be a string")}},nt=(e,t)=>{const n=e.tail_consumers;if(n===void 0)return;if(!Array.isArray(n)){t.push("tail_consumers must be an array of { service, environment? } entries");return}const s=n;for(const[i,a]of s.entries())(!a||typeof a!="object"||typeof a.service!="string"||a.service.length===0)&&t.push(`tail_consumers[${String(i)}] must have a non-empty "service" naming the consumer Worker`)},$t=(e,t)=>{const n=e.tail_consumers??[];return n.some(i=>!!i&&i?.service===t.service&&i?.environment===t.environment)?e:{...e,tail_consumers:[...n,t]}},it=(e,t)=>{const{vars:n}=e;if(!n||typeof n!="object")return;const s=n.LUNORA_ALLOWED_ORIGINS,i=n.LUNORA_CORS_ALLOW_CREDENTIALS,a=typeof s=="string"&&s.split(",").some(r=>r.trim()==="*"),o=ue(i);a&&o&&t.push('vars.LUNORA_ALLOWED_ORIGINS includes a "*" wildcard while vars.LUNORA_CORS_ALLOW_CREDENTIALS is on — browsers reject this combination and it defeats the allowlist; name explicit origins or drop credentials')},at=e=>p(e.durable_objects?.bindings).some(t=>t.class_name==="SchedulerDO"&&t.script_name===void 0),v="LUNORA_ORIGIN_URL",ot=(e,t,n)=>{if(!at(e)||u(e.vars?.[v]))return;const s=t===void 0?"vars":`env.${t}.vars`,i=t===void 0?"":` --env ${t}`;n.push(`durable_objects.bindings declares the SchedulerDO but ${s}.${v} is unset — the DO reads its dispatch origin from its own env and refuses to schedule without it, so every ctx.scheduler.runAfter/runAt fails with ORIGIN_NOT_CONFIGURED. Set ${s}.${v} to the worker's public URL, or \`wrangler secret put ${v}${i}\` (ignore this if it is already set as a secret or in the dashboard).`)},rt=(e,t,n)=>{const{error:s,merged:i,unverifiedKeys:a}=H(e,t);return s!==void 0?{error:s,wrangler:i}:(a.length>0&&n.push(`env.${String(t)} overrides ${a.join(", ")}, which this validator doesn't have a verified inheritance rule for — validated against the TOP-LEVEL value only. Double-check ${a.length===1?"it":"them"} by hand for "${String(t)}".`),{wrangler:i})},Q=(e,t,n)=>{const s=[],i=[];if(!e||typeof e!="object")return s.push("wrangler config is not a valid object"),{errors:s,valid:!1,warnings:i};const{error:a,wrangler:o}=rt(e,n,i);if(a!==void 0)return s.push(a),{errors:s,valid:!1,warnings:i};p(o.durable_objects?.bindings).find(l=>l.name==="SHARD"&&l.class_name==="ShardDO")||s.push('durable_objects.bindings must include { "name": "SHARD", "class_name": "ShardDO" } — your dev server auto-reconciles this on startup, or add the binding manually'),Ce(o,s);const d=o.compatibility_date??"";d&&!M.test(d)?s.push(`compatibility_date must be in YYYY-MM-DD format (got "${d}")`):d<I&&s.push(`compatibility_date must be >= "${I}" (got "${d||"<missing>"}")`),re(o)&&M.test(d)&&d<k&&s.push(`cache.enabled requires compatibility_date >= "${k}" (got "${d||"<missing>"}")`),Ve(o,t,s),Qe(o,s),Ne(o,t?.vectorIndexNames??[],s),nt(o,s),Le(o,s,i),y(o.workflows,"workflows",Be,s),Fe(o,s),y(o.secrets_store_secrets,"secrets_store_secrets",Pe,s);for(const l of qe)Ge(o,l,s,i);for(const l of He)y(o[l.key],l.key,l,s);for(const l of Ke)Ye(o,l,s);return ze(o,s,i),Xe(o,s),Je(o,s),Ze(o,s),st(o,s),et(o,s),tt(o,s),it(o,s),ot(o,n,i),{errors:s,valid:s.length===0,warnings:i}},St=Q,z=e=>Array.isArray(e)?e:[],ct=(e,t,n)=>{const s=[];for(const i of z(e)){const a=i?.image;typeof a!="string"||!(a.startsWith("./")||a.startsWith("../")||a.startsWith("/")||a.includes("Dockerfile"))||f(a.startsWith("/")?a:g(t,a))||s.push(`containers image "${a}" does not exist (resolved relative to ${n}); create the Dockerfile or point image at a registry reference`)}return s},dt=(e,t)=>{const n=e?.vectorIndexNames??[],s=[];if(n.length>0&&s.push({message:a=>`schema declares vector index(es) ${n.map(o=>`"${o}"`).join(", ")} but nothing chains .vectors(...) onto defineApp() (composed in: ${a}) — \`ctx.vectors\` is then a throwing stub and buildWorkerOptions rejects EVERY request, /_lunora/health included. Add \`.vectors((env) => ({ ${String(n[0])}: env.<BINDING> }))\` to the chain.`,method:"vectors"}),e?.hasD1GlobalTable&&s.push({message:a=>`schema declares .global() table(s) but nothing chains .global(...) onto defineApp() (composed in: ${a}) — the shard then has no global writer, so every read or write of a global table throws INTERNAL ("requires a globalDb writer"). Add \`.global({ d1: (env) => env.DB })\` to the chain.`,method:"global"}),e?.hasHyperdriveGlobalTable&&s.push({message:a=>`schema declares .global({ backend: "hyperdrive" }) table(s) but nothing chains .hyperdriveGlobal(...) onto defineApp() (composed in: ${a}) — the shard then has no global writer, so every read or write of those tables throws INTERNAL. Add \`.hyperdriveGlobal({ engine: "postgres", exec: (env) => buildPgExec(fromPostgresJs(postgres(env.HYPERDRIVE.connectionString))) })\` to the chain (\`buildPgExec\` from \`@lunora/hyperdrive/global\`, \`fromPostgresJs\` from \`@lunora/hyperdrive\`).`,method:"hyperdriveGlobal"}),s.length===0)return[];const i=ke(t,new Set(s.map(a=>a.method)));return i===void 0?[]:s.filter(a=>!i.chained.has(a.method)).map(a=>a.message(i.site))},lt="does not export it",ut=(e,t)=>{if(t!=="composed")return`Re-export it from the module that defines it (\`export { ${e} } from "./…";\`), or add it to the app builder's own export (\`export const { ${e} } = app;\`).`;const n=`it exports ${W.join(", ")}, SchedulerDO when its binding is declared, and every class codegen emits from your ${F.map(s=>`${s}.ts`).join(" / ")} declarations`;return ie(e)?`\`@lunora/vite\` generates that entry — ${n}, and ${e} is not among them. Class-A composition does not carry ${e}, so drop the binding; a project that needs it has to own its worker entry (add \`src/worker.ts\`, which \`lunora deploy\` bundles in place of \`main\`, and compose \`defineApp()\` there).`:`\`@lunora/vite\` generates that entry, so there is no file to add a re-export to: ${n}. Declare "${e}" in one of those and re-run \`lunora codegen\`, or drop the binding.`},mt=(e,t)=>{const n=t.exports;if(n===void 0)return[];const s=[];for(const a of p(e.durable_objects?.bindings))typeof a.class_name=="string"&&a.class_name.length>0&&a.script_name===void 0&&s.push({className:a.class_name,label:"durable_objects.bindings"});for(const a of z(e.workflows))typeof a?.class_name=="string"&&a.class_name.length>0&&a.script_name===void 0&&s.push({className:a.class_name,label:"workflows"});return s.filter(a=>!n.has(a.className)).map(a=>`${a.label} declares class "${a.className}" but the ${t.kind==="composed"?"composed class-A worker entry":"worker entry"} (${t.path}) ${lt} — wrangler refuses to bundle a Worker whose ${a.label==="workflows"?"Workflow":"Durable Object"} classes are not exported. ${ut(a.className,t.kind)}`)},gt=e=>e?.origin!=="absent"?[]:[`main is set but no readable file is there (looked in ${e.path}) — wrangler cannot resolve the worker entry, so a deploy will fail there. Point main at the entry that composes your app, or remove it to fall back to the conventional locations.`],At=e=>{const t=e.schemaDir??"lunora",n=ce(e.projectRoot);if(!n){const b=`wrangler.jsonc not found in ${e.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[b],report:{errors:[b],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:s}=de(n);if(s===void 0){const b=`failed to parse ${n} as JSONC.`;return{problems:[b],report:{errors:[b],valid:!1,warnings:[]},wranglerPath:n}}const{error:i,merged:a}=H(s,e.environment);if(i!==void 0)return{problems:[i],report:{errors:[i],valid:!1,warnings:[]},wranglerPath:n};const{error:o,info:r}=ae(e.projectRoot,t),c=Q(s,r,e.environment);o!==void 0&&c.warnings.push(`schema parse failed in ${t}/schema.ts: ${o}`);const d=R(n),l=pe(a.main,e.projectRoot,n),O=ve(l,e.projectRoot,t);c.errors.push(...ct(a.containers??[],d,n)),c.warnings.push(...gt(l)),O!==void 0&&c.errors.push(...mt(a,O)),c.errors.push(...dt(r,e.projectRoot));const h=a.assets?.directory;if(typeof h=="string"&&h.length>0){const b=h.startsWith("/")?h:g(d,h);f(b)||c.warnings.push(`assets.directory "${h}" does not exist yet — it is created by the client build; run the build before deploy`)}return c.valid=c.errors.length===0,{problems:c.errors,report:c,wranglerPath:n}};export{I as REQUIRED_COMPATIBILITY_DATE,Et as REQUIRED_FLAG,lt as UNEXPORTED_CLASS_MARKER,H as mergeWranglerEnvironment,p as objectBindingEntries,_ as stringEntries,St as validateWrangler,Q as validateWranglerConfig,At as validateWranglerProject,$t as withTailConsumer};
@@ -1 +1 @@
1
- import{writeFileSync as B,readFileSync as C}from"node:fs";import{join as A}from"node:path";import{containerBuildTag as P}from"@lunora/container";import{DEV_VARS_FILE as O,parseDevVariableEntries as I}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{a as b}from"./jsonc-edit-BZgQIdAH.mjs";import{findWranglerFile as $,readWranglerJsonc as R}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{objectBindingEntries as S,stringEntries as v}from"./REQUIRED_COMPATIBILITY_DATE-BB5Vt-qE.mjs";const k="<replace-with-d1-create-id>",M=e=>[["container","containers",e.containers],["workflow","workflows",e.workflows],["agent","agents",e.agents]].flatMap(([s,t,i])=>i.filter(a=>!a.exported).map(({className:a,exportName:c})=>({className:a,exportName:c,kind:s,module:t}))),w="PIPELINES",T=(e,n)=>{const s=e.flagshipBinding!==void 0&&!(n?.flagship??[]).some(a=>a.binding===e.flagshipBinding),t=e.usesPipelines&&!(n?.pipelines??[]).some(a=>a.binding===w);return[[e.usesKv&&(n?.kv_namespaces?.length??0)===0,"@lunora/bindings/kv is used but no kv_namespaces binding exists; add a kv_namespaces entry ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned."],[e.usesHyperdrive&&(n?.hyperdrive?.length??0)===0,"@lunora/hyperdrive is used but no hyperdrive binding exists; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned."],[t,`ctx.pipelines is used but no "${w}" pipelines binding exists; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding: "${w}", pipeline }) — codegen resolves this one name, and the pipeline resource can't be auto-provisioned.`],[s,`lunora/flags.ts uses Flagship in binding mode but no flagship binding "${e.flagshipBinding??""}" exists; add a flagship entry ({ binding: "${e.flagshipBinding??""}", app_id }) — the app_id can't be auto-provisioned.`]].filter(([a])=>a).map(([,a])=>a)},W=e=>[[e.usesX402Charge,"@lunora/x402/charge is used; set the recipient wallet address as a [vars] entry (the var name is your choice) and pass it to the charge config — the x402 facilitator settles USDC to that address."],[e.usesX402Pay,"@lunora/x402/pay is used (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding holding the agent wallet key (binding name == signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars."]].filter(([s])=>s).map(([,s])=>s),_=(e,n,s)=>s.filter(t=>!t.exported).map(t=>`${e} "${t.exportName}" is declared but ${t.className} is not exported by the worker entry; add \`export * from "./lunora/_generated/${n}"\` so its binding can be provisioned.`),K=(e,n)=>{const s=new Set([...e.workflows,...e.agents].map(t=>t.className));return s.size===0?[]:(n.workflows??[]).flatMap(t=>{const i=t.class_name;return i===void 0||s.has(i)?[]:[`wrangler.jsonc declares workflows[] entry "${i}" but no defineWorkflow/defineAgent export generates that class — a leftover from a rename will fail the deploy (wrangler rejects a class_name the worker does not export). Remove it if it is not hand-wired.`]})},L=(e,n)=>{if(e.queues.length===0)return[];const s=new Set(e.queues.map(i=>i.name)),t=new Set(e.queues.map(i=>i.bindingName));return[...(n.queues?.consumers??[]).flatMap(i=>{const{queue:a}=i;return a===void 0||s.has(a)?[]:[`wrangler.jsonc subscribes queues.consumers[] to "${a}" but no defineQueue export declares that queue — a leftover from a rename keeps delivering batches this worker has no handler for (they retry to exhaustion, then drop or dead-letter). Remove it if it is not hand-wired.`]}),...(n.queues?.producers??[]).flatMap(i=>{const{binding:a}=i;return a===void 0||t.has(a)?[]:[`wrangler.jsonc declares queues.producers[] binding "${a}" but no defineQueue export declares it — a leftover from a rename. Remove it if it is not hand-wired.`]})]},j=(e,n)=>[...K(e,n),...L(e,n)],D=[{keys:["STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET"],label:"Stripe"},{keys:["POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"],label:"Polar"},{keys:["CREEM_API_KEY","CREEM_WEBHOOK_SECRET"],label:"Creem"},{keys:["AUTUMN_SECRET_KEY","AUTUMN_WEBHOOK_SECRET"],label:"Autumn"},{keys:["DODO_PAYMENTS_API_KEY","DODO_PAYMENTS_WEBHOOK_KEY"],label:"Dodo Payments"}],Y=()=>D.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),q=e=>{let n;try{n=C(A(e,O),"utf8")}catch{return!1}const s=new Map(I(n).map(t=>[t.key,t.value]));return D.some(({keys:t})=>t.every(i=>(s.get(i)??"")!==""))},x=(e,n,s)=>{const t=new Set(e.durableObjects.map(d=>d.className)),i=[],a=(s?.r2_buckets?.length??0)>0,c=(s?.d1_databases?.some(d=>d.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!a&&i.push("@lunora/storage is used but R2 bucket bindings have user-defined names; add an r2_buckets entry and pass env.<BINDING> to createStorage()."),e.usesAuth&&!t.has("SessionDO")&&!c&&i.push("@lunora/auth is used but the worker entry exports no SessionDO; sessions are D1-backed, or export SessionDO to enable DO-backed sessions."),e.usesScheduler&&!t.has("SchedulerDO")&&i.push("@lunora/scheduler is used but the worker entry exports no SchedulerDO; export it so the SCHEDULER binding can be provisioned."),i.push(..._("container","containers",e.containers),..._("workflow","workflows",e.workflows),..._("agent","agents",e.agents)),e.containers.length>0&&s?.observability?.enabled===!1&&i.push("containers are declared but observability is explicitly disabled in wrangler.jsonc — container logs will not be captured."),e.usesPayment&&!q(n)&&i.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${Y()}.`),i.push(...W(e),...T(e,s)),s!==void 0&&i.push(...j(e,s)),i},H=e=>{const n=new Set(S(e).map(t=>t.tag));let s=1;for(;n.has(`v${String(s)}`);)s+=1;return`v${String(s)}`},F=e=>{const n=new Set;for(const s of S(e)){for(const t of v(s.deleted_classes))n.delete(t);for(const{from:t,to:i}of S(s.renamed_classes))t!==void 0&&n.delete(t),i!==void 0&&n.add(i);for(const t of[...v(s.new_classes),...v(s.new_sqlite_classes)])n.add(t)}return n},G=(e,n,s)=>{const t=n.durable_objects?.bindings??[],i=new Set(t.map(u=>u.name)),a=s.filter(u=>!i.has(u.binding));let c=e;const d=[];if(a.length>0){const u=[...t,...a.map(p=>({class_name:p.className,name:p.binding}))];c=b(c,["durable_objects","bindings"],u),d.push(...a.map(p=>`${p.binding}/${p.className}`))}const g=n.migrations??[],l=s.map(u=>u.className).filter(u=>!F(g).has(u));if(l.length>0){const u=[...g,{new_sqlite_classes:l,tag:H(g)}];c=b(c,["migrations"],u)}return{added:d,text:c}},Q=(e,n)=>{const s=n.d1_databases??[];if(s.some(a=>a.binding==="DB"))return{added:[],text:e};const t=typeof n.name=="string"&&n.name.length>0?n.name:"lunora",i=[...s,{binding:"DB",database_id:k,database_name:t}];return{added:["DB (D1)"],text:b(e,["d1_databases"],i)}},y=(e,n,s,t,i)=>{const a=n[s]?.binding;return typeof a=="string"&&a.length>0?{added:[],text:e}:{added:[i],text:b(e,[s],{binding:t})}},U=(e,n)=>(n.analytics_engine_datasets?.length??0)>0?{added:[],text:e}:{added:["ANALYTICS (Analytics Engine)"],text:b(e,["analytics_engine_datasets"],[{binding:"ANALYTICS",dataset:"ANALYTICS"}])},z=e=>{if(typeof e=="string")return e;const n={};return e.diskMb!==void 0&&(n.disk_mb=e.diskMb),e.memoryMib!==void 0&&(n.memory_mib=e.memoryMib),e.vcpu!==void 0&&(n.vcpu=e.vcpu),n},V=e=>e.image.kind==="dockerfile"?e.image.dockerfilePath:e.image.kind==="registry"?e.image.reference:P(e.exportName),X=e=>{const n={class_name:e.className,image:V(e)};return e.image.kind==="dockerfile"&&(n.image_build_context=e.image.buildContext),e.buildArgs!==void 0&&e.image.kind!=="registry"&&(n.image_vars=e.buildArgs),e.instanceType!==void 0&&(n.instance_type=z(e.instanceType)),e.maxInstances!==void 0&&(n.max_instances=e.maxInstances),e.name!==void 0&&(n.name=e.name),e.rollout?.stepPercentage!==void 0&&(n.rollout_step_percentage=e.rollout.stepPercentage),e.rollout?.gracePeriodSeconds!==void 0&&(n.rollout_active_grace_period=e.rollout.gracePeriodSeconds),n},J=(e,n,s)=>{const t=n.containers??[],i=new Set(t.map(d=>d.class_name)),a=s.filter(d=>!i.has(d.className));if(a.length===0)return{added:[],text:e};const c=b(e,["containers"],[...t,...a.map(d=>X(d))]);return{added:a.map(d=>`containers/${d.className}`),text:c}},Z=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=b(e,["observability"],{enabled:!0,head_sampling_rate:1});return{added:["observability"],text:s}},N=e=>({binding:e.bindingName,class_name:e.className,name:e.name}),ee=(e,n,s,t=[])=>{const i=n.workflows??[],a=new Set(i.map(l=>l.class_name)),c=s.filter(l=>!a.has(l.className)),d=t.filter(l=>!a.has(l.className));if(c.length===0&&d.length===0)return{added:[],text:e};const g=b(e,["workflows"],[...i,...c.map(l=>N(l)),...d.map(l=>N(l))]);return{added:[...c.map(l=>`workflows/${l.className}`),...d.map(l=>`workflows/${l.className}`)],text:g}},ne=(e,n,s)=>{const t=n.queues??{},i=t.producers??[],a=t.consumers??[],c=new Set(i.map(r=>r.binding)),d=new Set(a.map(r=>r.queue)),g=s.filter(r=>!c.has(r.bindingName)),l=s.filter(r=>!d.has(r.name));if(g.length===0&&l.length===0)return{added:[],text:e};const u=[...i,...g.map(r=>({binding:r.bindingName,queue:r.name}))],p=[...a,...l.map(r=>{const m={queue:r.name};return r.mode==="pull"&&(m.type="http_pull"),r.tuning.maxBatchSize!==void 0&&(m.max_batch_size=r.tuning.maxBatchSize),r.tuning.maxBatchTimeout!==void 0&&(m.max_batch_timeout=r.tuning.maxBatchTimeout),r.tuning.maxRetries!==void 0&&(m.max_retries=r.tuning.maxRetries),r.tuning.deadLetterQueue!==void 0&&(m.dead_letter_queue=r.tuning.deadLetterQueue),r.tuning.retryDelay!==void 0&&(m.retry_delay=r.tuning.retryDelay),m})],h=b(e,["queues"],{consumers:p,producers:u});return{added:[...g.map(r=>`queues.producers/${r.bindingName}`),...l.map(r=>`queues.consumers/${r.name}`)],text:h}},le=(e,n,s)=>{const t=$(e),i=M(n);if(!t)return{added:[],changed:!1,exportGaps:i,reason:"wrangler.jsonc not found",warnings:x(n,e)};const{parsed:a,text:c}=R(t);if(a===void 0)return{added:[],changed:!1,exportGaps:i,reason:`failed to parse ${t} as JSONC`,warnings:x(n,e),wranglerPath:t};const d=x(n,e,a);if(s!==void 0){const o=a.env?.[s]!==void 0;d.push(o?`auto-provisioned bindings are written to the top level of wrangler.jsonc only — "env.${s}" has its own (non-inheritable) bindings and must be reconciled by hand; \`lunora deploy --env ${s}\` now validates them, so a gap here will be reported at deploy time.`:`--env "${s}" was requested but wrangler.jsonc declares no "env.${s}" block — auto-provisioned bindings are written to the top level only and will not apply to that environment.`)}const g=n.containers.filter(o=>o.exported),l=n.agents.filter(o=>o.exported&&o.voice===!0&&o.voiceBindingName!==void 0&&o.voiceClassName!==void 0),u=[...n.durableObjects,...g.map(o=>({binding:o.bindingName,className:o.className})),...l.map(o=>({binding:o.voiceBindingName,className:o.voiceClassName}))],p=n.workflows.filter(o=>o.exported),h=n.agents.filter(o=>o.exported),r=[{enabled:!0,run:o=>G(o,a,u)},{enabled:n.needsD1,run:o=>Q(o,a)},{enabled:n.usesAi,run:o=>y(o,a,"ai","AI","AI (Workers AI)")},{enabled:n.usesBrowser,run:o=>y(o,a,"browser","BROWSER","BROWSER (Browser Rendering)")},{enabled:n.usesImages,run:o=>y(o,a,"images","IMAGES","IMAGES (Cloudflare Images)")},{enabled:n.usesAnalytics,run:o=>U(o,a)},{enabled:!0,run:o=>Z(o,a)},{enabled:g.length>0,run:o=>J(o,a,g)},{enabled:p.length>0||h.length>0,run:o=>ee(o,a,p,h)},{enabled:n.queues.length>0,run:o=>ne(o,a,n.queues)}];let m=c;const f=[];for(const o of r){if(!o.enabled)continue;const E=o.run(m);m=E.text,f.push(...E.added)}return f.includes("DB (D1)")&&d.push(`wrote a DB binding with a placeholder database_id ("${k}") — run \`wrangler d1 create <name>\` and replace it before deploying.`),m===c?{added:[],changed:!1,exportGaps:i,reason:"bindings already in sync",warnings:d,wranglerPath:t}:(B(t,m,"utf8"),{added:f,changed:!0,exportGaps:i,warnings:d,wranglerPath:t})};export{M as collectExportGaps,le as reconcileWranglerBindings};
1
+ import{writeFileSync as B,readFileSync as C}from"node:fs";import{join as A}from"node:path";import{containerBuildTag as P}from"@lunora/container";import{DEV_VARS_FILE as O,parseDevVariableEntries as I}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{a as b}from"./jsonc-edit-BZgQIdAH.mjs";import{findWranglerFile as $,readWranglerJsonc as R}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{objectBindingEntries as S,stringEntries as v}from"./REQUIRED_COMPATIBILITY_DATE-D9z4NOVs.mjs";const k="<replace-with-d1-create-id>",M=e=>[["container","containers",e.containers],["workflow","workflows",e.workflows],["agent","agents",e.agents]].flatMap(([s,t,i])=>i.filter(a=>!a.exported).map(({className:a,exportName:c})=>({className:a,exportName:c,kind:s,module:t}))),w="PIPELINES",T=(e,n)=>{const s=e.flagshipBinding!==void 0&&!(n?.flagship??[]).some(a=>a.binding===e.flagshipBinding),t=e.usesPipelines&&!(n?.pipelines??[]).some(a=>a.binding===w);return[[e.usesKv&&(n?.kv_namespaces?.length??0)===0,"@lunora/bindings/kv is used but no kv_namespaces binding exists; add a kv_namespaces entry ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned."],[e.usesHyperdrive&&(n?.hyperdrive?.length??0)===0,"@lunora/hyperdrive is used but no hyperdrive binding exists; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned."],[t,`ctx.pipelines is used but no "${w}" pipelines binding exists; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding: "${w}", pipeline }) — codegen resolves this one name, and the pipeline resource can't be auto-provisioned.`],[s,`lunora/flags.ts uses Flagship in binding mode but no flagship binding "${e.flagshipBinding??""}" exists; add a flagship entry ({ binding: "${e.flagshipBinding??""}", app_id }) — the app_id can't be auto-provisioned.`]].filter(([a])=>a).map(([,a])=>a)},W=e=>[[e.usesX402Charge,"@lunora/x402/charge is used; set the recipient wallet address as a [vars] entry (the var name is your choice) and pass it to the charge config — the x402 facilitator settles USDC to that address."],[e.usesX402Pay,"@lunora/x402/pay is used (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding holding the agent wallet key (binding name == signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars."]].filter(([s])=>s).map(([,s])=>s),_=(e,n,s)=>s.filter(t=>!t.exported).map(t=>`${e} "${t.exportName}" is declared but ${t.className} is not exported by the worker entry; add \`export * from "./lunora/_generated/${n}"\` so its binding can be provisioned.`),K=(e,n)=>{const s=new Set([...e.workflows,...e.agents].map(t=>t.className));return s.size===0?[]:(n.workflows??[]).flatMap(t=>{const i=t.class_name;return i===void 0||s.has(i)?[]:[`wrangler.jsonc declares workflows[] entry "${i}" but no defineWorkflow/defineAgent export generates that class — a leftover from a rename will fail the deploy (wrangler rejects a class_name the worker does not export). Remove it if it is not hand-wired.`]})},L=(e,n)=>{if(e.queues.length===0)return[];const s=new Set(e.queues.map(i=>i.name)),t=new Set(e.queues.map(i=>i.bindingName));return[...(n.queues?.consumers??[]).flatMap(i=>{const{queue:a}=i;return a===void 0||s.has(a)?[]:[`wrangler.jsonc subscribes queues.consumers[] to "${a}" but no defineQueue export declares that queue — a leftover from a rename keeps delivering batches this worker has no handler for (they retry to exhaustion, then drop or dead-letter). Remove it if it is not hand-wired.`]}),...(n.queues?.producers??[]).flatMap(i=>{const{binding:a}=i;return a===void 0||t.has(a)?[]:[`wrangler.jsonc declares queues.producers[] binding "${a}" but no defineQueue export declares it — a leftover from a rename. Remove it if it is not hand-wired.`]})]},j=(e,n)=>[...K(e,n),...L(e,n)],D=[{keys:["STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET"],label:"Stripe"},{keys:["POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"],label:"Polar"},{keys:["CREEM_API_KEY","CREEM_WEBHOOK_SECRET"],label:"Creem"},{keys:["AUTUMN_SECRET_KEY","AUTUMN_WEBHOOK_SECRET"],label:"Autumn"},{keys:["DODO_PAYMENTS_API_KEY","DODO_PAYMENTS_WEBHOOK_KEY"],label:"Dodo Payments"}],Y=()=>D.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),q=e=>{let n;try{n=C(A(e,O),"utf8")}catch{return!1}const s=new Map(I(n).map(t=>[t.key,t.value]));return D.some(({keys:t})=>t.every(i=>(s.get(i)??"")!==""))},x=(e,n,s)=>{const t=new Set(e.durableObjects.map(d=>d.className)),i=[],a=(s?.r2_buckets?.length??0)>0,c=(s?.d1_databases?.some(d=>d.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!a&&i.push("@lunora/storage is used but R2 bucket bindings have user-defined names; add an r2_buckets entry and pass env.<BINDING> to createStorage()."),e.usesAuth&&!t.has("SessionDO")&&!c&&i.push("@lunora/auth is used but the worker entry exports no SessionDO; sessions are D1-backed, or export SessionDO to enable DO-backed sessions."),e.usesScheduler&&!t.has("SchedulerDO")&&i.push("@lunora/scheduler is used but the worker entry exports no SchedulerDO; export it so the SCHEDULER binding can be provisioned."),i.push(..._("container","containers",e.containers),..._("workflow","workflows",e.workflows),..._("agent","agents",e.agents)),e.containers.length>0&&s?.observability?.enabled===!1&&i.push("containers are declared but observability is explicitly disabled in wrangler.jsonc — container logs will not be captured."),e.usesPayment&&!q(n)&&i.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${Y()}.`),i.push(...W(e),...T(e,s)),s!==void 0&&i.push(...j(e,s)),i},H=e=>{const n=new Set(S(e).map(t=>t.tag));let s=1;for(;n.has(`v${String(s)}`);)s+=1;return`v${String(s)}`},F=e=>{const n=new Set;for(const s of S(e)){for(const t of v(s.deleted_classes))n.delete(t);for(const{from:t,to:i}of S(s.renamed_classes))t!==void 0&&n.delete(t),i!==void 0&&n.add(i);for(const t of[...v(s.new_classes),...v(s.new_sqlite_classes)])n.add(t)}return n},G=(e,n,s)=>{const t=n.durable_objects?.bindings??[],i=new Set(t.map(u=>u.name)),a=s.filter(u=>!i.has(u.binding));let c=e;const d=[];if(a.length>0){const u=[...t,...a.map(p=>({class_name:p.className,name:p.binding}))];c=b(c,["durable_objects","bindings"],u),d.push(...a.map(p=>`${p.binding}/${p.className}`))}const g=n.migrations??[],l=s.map(u=>u.className).filter(u=>!F(g).has(u));if(l.length>0){const u=[...g,{new_sqlite_classes:l,tag:H(g)}];c=b(c,["migrations"],u)}return{added:d,text:c}},Q=(e,n)=>{const s=n.d1_databases??[];if(s.some(a=>a.binding==="DB"))return{added:[],text:e};const t=typeof n.name=="string"&&n.name.length>0?n.name:"lunora",i=[...s,{binding:"DB",database_id:k,database_name:t}];return{added:["DB (D1)"],text:b(e,["d1_databases"],i)}},y=(e,n,s,t,i)=>{const a=n[s]?.binding;return typeof a=="string"&&a.length>0?{added:[],text:e}:{added:[i],text:b(e,[s],{binding:t})}},U=(e,n)=>(n.analytics_engine_datasets?.length??0)>0?{added:[],text:e}:{added:["ANALYTICS (Analytics Engine)"],text:b(e,["analytics_engine_datasets"],[{binding:"ANALYTICS",dataset:"ANALYTICS"}])},z=e=>{if(typeof e=="string")return e;const n={};return e.diskMb!==void 0&&(n.disk_mb=e.diskMb),e.memoryMib!==void 0&&(n.memory_mib=e.memoryMib),e.vcpu!==void 0&&(n.vcpu=e.vcpu),n},V=e=>e.image.kind==="dockerfile"?e.image.dockerfilePath:e.image.kind==="registry"?e.image.reference:P(e.exportName),X=e=>{const n={class_name:e.className,image:V(e)};return e.image.kind==="dockerfile"&&(n.image_build_context=e.image.buildContext),e.buildArgs!==void 0&&e.image.kind!=="registry"&&(n.image_vars=e.buildArgs),e.instanceType!==void 0&&(n.instance_type=z(e.instanceType)),e.maxInstances!==void 0&&(n.max_instances=e.maxInstances),e.name!==void 0&&(n.name=e.name),e.rollout?.stepPercentage!==void 0&&(n.rollout_step_percentage=e.rollout.stepPercentage),e.rollout?.gracePeriodSeconds!==void 0&&(n.rollout_active_grace_period=e.rollout.gracePeriodSeconds),n},J=(e,n,s)=>{const t=n.containers??[],i=new Set(t.map(d=>d.class_name)),a=s.filter(d=>!i.has(d.className));if(a.length===0)return{added:[],text:e};const c=b(e,["containers"],[...t,...a.map(d=>X(d))]);return{added:a.map(d=>`containers/${d.className}`),text:c}},Z=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=b(e,["observability"],{enabled:!0,head_sampling_rate:1});return{added:["observability"],text:s}},N=e=>({binding:e.bindingName,class_name:e.className,name:e.name}),ee=(e,n,s,t=[])=>{const i=n.workflows??[],a=new Set(i.map(l=>l.class_name)),c=s.filter(l=>!a.has(l.className)),d=t.filter(l=>!a.has(l.className));if(c.length===0&&d.length===0)return{added:[],text:e};const g=b(e,["workflows"],[...i,...c.map(l=>N(l)),...d.map(l=>N(l))]);return{added:[...c.map(l=>`workflows/${l.className}`),...d.map(l=>`workflows/${l.className}`)],text:g}},ne=(e,n,s)=>{const t=n.queues??{},i=t.producers??[],a=t.consumers??[],c=new Set(i.map(r=>r.binding)),d=new Set(a.map(r=>r.queue)),g=s.filter(r=>!c.has(r.bindingName)),l=s.filter(r=>!d.has(r.name));if(g.length===0&&l.length===0)return{added:[],text:e};const u=[...i,...g.map(r=>({binding:r.bindingName,queue:r.name}))],p=[...a,...l.map(r=>{const m={queue:r.name};return r.mode==="pull"&&(m.type="http_pull"),r.tuning.maxBatchSize!==void 0&&(m.max_batch_size=r.tuning.maxBatchSize),r.tuning.maxBatchTimeout!==void 0&&(m.max_batch_timeout=r.tuning.maxBatchTimeout),r.tuning.maxRetries!==void 0&&(m.max_retries=r.tuning.maxRetries),r.tuning.deadLetterQueue!==void 0&&(m.dead_letter_queue=r.tuning.deadLetterQueue),r.tuning.retryDelay!==void 0&&(m.retry_delay=r.tuning.retryDelay),m})],h=b(e,["queues"],{consumers:p,producers:u});return{added:[...g.map(r=>`queues.producers/${r.bindingName}`),...l.map(r=>`queues.consumers/${r.name}`)],text:h}},le=(e,n,s)=>{const t=$(e),i=M(n);if(!t)return{added:[],changed:!1,exportGaps:i,reason:"wrangler.jsonc not found",warnings:x(n,e)};const{parsed:a,text:c}=R(t);if(a===void 0)return{added:[],changed:!1,exportGaps:i,reason:`failed to parse ${t} as JSONC`,warnings:x(n,e),wranglerPath:t};const d=x(n,e,a);if(s!==void 0){const o=a.env?.[s]!==void 0;d.push(o?`auto-provisioned bindings are written to the top level of wrangler.jsonc only — "env.${s}" has its own (non-inheritable) bindings and must be reconciled by hand; \`lunora deploy --env ${s}\` now validates them, so a gap here will be reported at deploy time.`:`--env "${s}" was requested but wrangler.jsonc declares no "env.${s}" block — auto-provisioned bindings are written to the top level only and will not apply to that environment.`)}const g=n.containers.filter(o=>o.exported),l=n.agents.filter(o=>o.exported&&o.voice===!0&&o.voiceBindingName!==void 0&&o.voiceClassName!==void 0),u=[...n.durableObjects,...g.map(o=>({binding:o.bindingName,className:o.className})),...l.map(o=>({binding:o.voiceBindingName,className:o.voiceClassName}))],p=n.workflows.filter(o=>o.exported),h=n.agents.filter(o=>o.exported),r=[{enabled:!0,run:o=>G(o,a,u)},{enabled:n.needsD1,run:o=>Q(o,a)},{enabled:n.usesAi,run:o=>y(o,a,"ai","AI","AI (Workers AI)")},{enabled:n.usesBrowser,run:o=>y(o,a,"browser","BROWSER","BROWSER (Browser Rendering)")},{enabled:n.usesImages,run:o=>y(o,a,"images","IMAGES","IMAGES (Cloudflare Images)")},{enabled:n.usesAnalytics,run:o=>U(o,a)},{enabled:!0,run:o=>Z(o,a)},{enabled:g.length>0,run:o=>J(o,a,g)},{enabled:p.length>0||h.length>0,run:o=>ee(o,a,p,h)},{enabled:n.queues.length>0,run:o=>ne(o,a,n.queues)}];let m=c;const f=[];for(const o of r){if(!o.enabled)continue;const E=o.run(m);m=E.text,f.push(...E.added)}return f.includes("DB (D1)")&&d.push(`wrote a DB binding with a placeholder database_id ("${k}") — run \`wrangler d1 create <name>\` and replace it before deploying.`),m===c?{added:[],changed:!1,exportGaps:i,reason:"bindings already in sync",warnings:d,wranglerPath:t}:(B(t,m,"utf8"),{added:f,changed:!0,exportGaps:i,warnings:d,wranglerPath:t})};export{M as collectExportGaps,le as reconcileWranglerBindings};
@@ -0,0 +1 @@
1
+ import{readProjectConfigLiterals as o,readProjectTarget as n}from"@lunora/codegen";import{DEFAULT_DEPLOY_TARGET as c,resolveDeployDriver as a}from"./DEFAULT_DEPLOY_TARGET-B-e9mqgX.mjs";const s=e=>{if(typeof e=="boolean")return e;if(e!==null&&typeof e=="object")return!0},g=e=>s(o(e).remote),i=e=>n(e),T=(e,r)=>r??i(e)??c,j=(e,r)=>{const t=T(e,r);return a(t),t};export{s as interpretRemote,g as readProjectRemotePreference,i as readProjectTarget,T as resolveProjectTarget,j as resolveTargetOrThrow};
@@ -227,6 +227,29 @@ interface InferOptions {
227
227
  /** Lunora source directory holding `schema.ts`. Defaults to `lunora`. */
228
228
  schemaDir?: string;
229
229
  }
230
+ /**
231
+ * The `_generated/` modules that hold a generated Durable Object / Workflow
232
+ * class — one per class kind a project can declare. wrangler validates every
233
+ * `class_name` against the worker's exports, so this is the set a worker entry
234
+ * re-exports (and the set the composed class-A entry star-re-exports for the
235
+ * kinds the project has).
236
+ *
237
+ * Owned here because four places need it and they must not drift:
238
+ * `@lunora/vite` emits one star re-export per entry, the wrangler validator
239
+ * DECIDES the composed entry's exports from it, `reconcile-bindings` types its
240
+ * export-gap `module` field on it, and this module's own `detectClassExports`
241
+ * probes the same names.
242
+ *
243
+ * `scheduler` carries no `define*` declarations of its own — codegen writes it
244
+ * off `hasScheduler` purely so the composed class-A entry has a `SchedulerDO`
245
+ * to forward. Its presence is therefore the ONLY signal the plugin and the
246
+ * validator need, and it is the same signal that decides whether the builder
247
+ * has a `.scheduler()` method at all. `@lunora/vite` depends on `@lunora/config`, so config
248
+ * owning it is the direction the dependency graph allows.
249
+ */
250
+ declare const GENERATED_CLASS_MODULES: readonly ["agents", "containers", "scheduler", "workflows"];
251
+ /** One {@link GENERATED_CLASS_MODULES} entry. */
252
+ type GeneratedClassModule = (typeof GENERATED_CLASS_MODULES)[number];
230
253
  /**
231
254
  * The class-B composed entry. `lunora deploy` passes this file to wrangler as
232
255
  * the positional script whenever it exists, overriding `wrangler.main` — so it
@@ -305,4 +328,4 @@ interface DiscoverSchemaInfoResult {
305
328
  * parse failure is a warning (validator) or simply ignorable (inference).
306
329
  */
307
330
  declare const discoverSchemaInfo: (projectRoot: string, schemaDirectory: string) => DiscoverSchemaInfoResult;
308
- export { COMPOSED_WORKER_ENTRY as C, DeployDriver as D, InferredBindings as I, SchemaInfo as S, TailRequest as T, DeployRequest as a, DevRequest as b, DiscoverSchemaInfoResult as c, DriverToolchain as d, InferOptions as e, InferredAgent as f, InferredContainer as g, InferredWorkflow as h, SecretRequest as i, ToolchainCommand as j, discoverSchemaInfo as k, inferLunoraBindings as l, packageNamesFromBindings as p };
331
+ export { COMPOSED_WORKER_ENTRY as C, DeployDriver as D, GeneratedClassModule as G, InferredBindings as I, SchemaInfo as S, TailRequest as T, DeployRequest as a, DevRequest as b, DiscoverSchemaInfoResult as c, DriverToolchain as d, GENERATED_CLASS_MODULES as e, InferOptions as f, InferredAgent as g, InferredContainer as h, InferredWorkflow as i, SecretRequest as j, ToolchainCommand as k, discoverSchemaInfo as l, inferLunoraBindings as m, packageNamesFromBindings as p };
@@ -227,6 +227,29 @@ interface InferOptions {
227
227
  /** Lunora source directory holding `schema.ts`. Defaults to `lunora`. */
228
228
  schemaDir?: string;
229
229
  }
230
+ /**
231
+ * The `_generated/` modules that hold a generated Durable Object / Workflow
232
+ * class — one per class kind a project can declare. wrangler validates every
233
+ * `class_name` against the worker's exports, so this is the set a worker entry
234
+ * re-exports (and the set the composed class-A entry star-re-exports for the
235
+ * kinds the project has).
236
+ *
237
+ * Owned here because four places need it and they must not drift:
238
+ * `@lunora/vite` emits one star re-export per entry, the wrangler validator
239
+ * DECIDES the composed entry's exports from it, `reconcile-bindings` types its
240
+ * export-gap `module` field on it, and this module's own `detectClassExports`
241
+ * probes the same names.
242
+ *
243
+ * `scheduler` carries no `define*` declarations of its own — codegen writes it
244
+ * off `hasScheduler` purely so the composed class-A entry has a `SchedulerDO`
245
+ * to forward. Its presence is therefore the ONLY signal the plugin and the
246
+ * validator need, and it is the same signal that decides whether the builder
247
+ * has a `.scheduler()` method at all. `@lunora/vite` depends on `@lunora/config`, so config
248
+ * owning it is the direction the dependency graph allows.
249
+ */
250
+ declare const GENERATED_CLASS_MODULES: readonly ["agents", "containers", "scheduler", "workflows"];
251
+ /** One {@link GENERATED_CLASS_MODULES} entry. */
252
+ type GeneratedClassModule = (typeof GENERATED_CLASS_MODULES)[number];
230
253
  /**
231
254
  * The class-B composed entry. `lunora deploy` passes this file to wrangler as
232
255
  * the positional script whenever it exists, overriding `wrangler.main` — so it
@@ -305,4 +328,4 @@ interface DiscoverSchemaInfoResult {
305
328
  * parse failure is a warning (validator) or simply ignorable (inference).
306
329
  */
307
330
  declare const discoverSchemaInfo: (projectRoot: string, schemaDirectory: string) => DiscoverSchemaInfoResult;
308
- export { COMPOSED_WORKER_ENTRY as C, DeployDriver as D, InferredBindings as I, SchemaInfo as S, TailRequest as T, DeployRequest as a, DevRequest as b, DiscoverSchemaInfoResult as c, DriverToolchain as d, InferOptions as e, InferredAgent as f, InferredContainer as g, InferredWorkflow as h, SecretRequest as i, ToolchainCommand as j, discoverSchemaInfo as k, inferLunoraBindings as l, packageNamesFromBindings as p };
331
+ export { COMPOSED_WORKER_ENTRY as C, DeployDriver as D, GeneratedClassModule as G, InferredBindings as I, SchemaInfo as S, TailRequest as T, DeployRequest as a, DevRequest as b, DiscoverSchemaInfoResult as c, DriverToolchain as d, GENERATED_CLASS_MODULES as e, InferOptions as f, InferredAgent as g, InferredContainer as h, InferredWorkflow as i, SecretRequest as j, ToolchainCommand as k, discoverSchemaInfo as l, inferLunoraBindings as m, packageNamesFromBindings as p };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/config",
3
- "version": "1.0.0-alpha.210",
3
+ "version": "1.0.0-alpha.211",
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.173",
57
+ "@lunora/codegen": "1.0.0-alpha.174",
58
58
  "@lunora/container": "1.0.0-alpha.48",
59
59
  "@lunora/errors": "1.0.0-alpha.35",
60
- "@lunora/seed": "1.0.0-alpha.121",
60
+ "@lunora/seed": "1.0.0-alpha.122",
61
61
  "@visulima/colorize": "2.1.1",
62
62
  "@visulima/find-ai-runner": "1.0.2",
63
63
  "@visulima/package": "5.0.20",
@@ -1 +0,0 @@
1
- import{existsSync as l,statSync as v,readFileSync as f,readdirSync as F}from"node:fs";import{init as U,parse as g}from"es-module-lexer";import{discoverAgentInfo as Y}from"./discoverAgentInfo-CTdCSfYM.mjs";import{WRANGLER_FILES as j,readWranglerJsonc as K}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{discoverContainerInfo as W}from"./discoverContainerInfo-EhZtEBQs.mjs";import{escapeRegExp as w}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{discoverFlags as M,FLAGS_FILENAME as X,discoverQueues as q,QUEUES_FILENAME as G}from"@lunora/codegen";import{d as T}from"./discover-info-Vj9d4qYt.mjs";import{discoverSchemaInfo as H}from"./discoverSchemaInfo-DJvevsCm.mjs";import{discoverWorkflowInfo as Q}from"./discoverWorkflowInfo-BsPvlo6O.mjs";import{join as c}from"node:path";const V=(e,s)=>{const{error:t,value:r}=T(e,s,X,M);return t===void 0?{flags:r}:{error:t}},J=(e,s)=>{const{error:t,value:r}=T(e,s,G,q);return t===void 0?{queues:r??[]}:{error:t,queues:[]}},z=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),Z=new Set([".git",".lunora-cache",".wrangler","_generated","dist","node_modules"]),ee=["lunora","src"],se=["src/server/index.ts","src/server/index.tsx","src/index.ts","src/worker.ts"],_={SchedulerDO:"SCHEDULER",SessionDO:"SESSION",ShardDO:"SHARD"},O=Object.keys(_),re=/\benv\s*\.\s*DB\b/,te=/\benv\s*\.\s*AI\b/,D=/\bctx\s*\.\s*pipelines\b/,C=/\bctx\s*\.\s*r2sql\b/,P=/^\s*import\s+type\b/,ne=new Set(["@lunora/agent","@lunora/agent/sandbox"]),oe=e=>{const s=e.indexOf("{");if(s===-1)return"";const t=e.indexOf("}",s+1);return t===-1?e.slice(s+1):e.slice(s+1,t)},ae=/\btype\s+browserTool\b/,ie=/\bbrowserTool\b/,ce=/import\s+\{[^}]*\bbrowserTool\b[^}]*\}\s+from\s+["']@lunora\/agent(?:\/sandbox)?["']/,ue=e=>{if(P.test(e))return!1;const s=oe(e);return ie.test(s)&&!ae.test(s)},le=e=>{try{const[s]=g(e);return s.some(t=>t.n!==void 0&&ne.has(t.n)&&ue(e.slice(t.ss,t.se)))}catch{return ce.test(e)}},h={usesAi:{pattern:/\bfrom\s+["']@lunora\/ai["']/,source:"@lunora/ai"},usesAnalytics:{pattern:/\bfrom\s+["']@lunora\/bindings\/analytics["']/,source:"@lunora/bindings/analytics"},usesAuth:{pattern:/\bfrom\s+["']@lunora\/auth["']/,source:"@lunora/auth"},usesBrowser:{pattern:/\bfrom\s+["']@lunora\/browser["']/,source:"@lunora/browser"},usesHyperdrive:{pattern:/\bfrom\s+["']@lunora\/hyperdrive["']/,source:"@lunora/hyperdrive"},usesImages:{pattern:/\bfrom\s+["']@lunora\/bindings\/images["']/,source:"@lunora/bindings/images"},usesKv:{pattern:/\bfrom\s+["']@lunora\/bindings\/kv["']/,source:"@lunora/bindings/kv"},usesMail:{pattern:/\bfrom\s+["']@lunora\/mail["']/,source:"@lunora/mail"},usesNotify:{pattern:/\bfrom\s+["']@lunora\/notify["']/,source:"@lunora/notify"},usesPayment:{pattern:/\bfrom\s+["']@lunora\/payment["']/,source:"@lunora/payment"},usesPipelines:{pattern:D,source:"@lunora/bindings/pipelines"},usesR2sql:{pattern:C,source:"@lunora/bindings/r2sql"},usesScheduler:{pattern:/\bfrom\s+["']@lunora\/scheduler["']/,source:"@lunora/scheduler"},usesStorage:{pattern:/\bfrom\s+["']@lunora\/storage["']/,source:"@lunora/storage"},usesX402Charge:{pattern:/\bfrom\s+["']@lunora\/x402\/charge["']/,source:"@lunora/x402/charge"},usesX402Pay:{pattern:/\bfrom\s+["']@lunora\/x402\/pay["']/,source:"@lunora/x402/pay"}},m=Object.keys(h),de="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",L=[...m,"needsD1"],pe=()=>{const e={};for(const s of L)e[s]=!1;return e},d=Object.freeze(pe()),x=(e,s)=>{const t={};for(const r of L)t[r]=e[r]||s[r];return t},me=e=>{for(const s of m)if(h[s].source===e)return{...d,[s]:!0};return d},be=e=>{const[s]=g(e);let t=d;for(const r of s){const n=r.n;!n||P.test(e.slice(r.ss,r.se))||(t=x(t,me(n)))}return t},fe=e=>{const s={...d};for(const t of m)s[t]=h[t].pattern.test(e);return s},ge=e=>{let s;try{s=be(e)}catch{s=fe(e)}return x(s,{...d,needsD1:re.test(e),usesAi:te.test(e),usesPipelines:D.test(e),usesR2sql:C.test(e)})},y=(e,s)=>{let t;try{t=F(e,{withFileTypes:!0})}catch{return}for(const r of t){if(r.isDirectory()){Z.has(r.name)||y(c(e,r.name),s);continue}const n=r.name.lastIndexOf(".");n!==-1&&z.has(r.name.slice(n))&&s.push(c(e,r.name))}},he="virtual:lunora/worker",Ee=["ShardDO"],Se="src/worker.ts",_e=e=>{for(const s of j){const t=c(e,s);if(!l(t))continue;const{parsed:r}=K(t),n=r?.main;if(n===he)return{composed:!0};const a=c(e,Se);if(l(a))return{composed:!1,path:a};if(typeof n=="string"&&l(c(e,n)))return{composed:!1,path:c(e,n)};break}for(const s of se){const t=c(e,s);if(l(t))return{composed:!1,path:t}}return{composed:!1}},xe=/(?:^|[\s,{])type$/u,B=(e,s)=>{const t=s.ls>=0?s.ls:s.s;return xe.test(e.slice(0,t).trimEnd())},k=(e,s)=>{const t=w(s);return new RegExp(String.raw`\bexport\s+type\s+${t}\b`,"u").test(e)||new RegExp(String.raw`\bexport\s+type\s*\{[^}]*\b${t}\b`,"u").test(e)||new RegExp(String.raw`\bexport\s+\{[^}]*\btype\s+${t}\b`,"u").test(e)},ye=e=>{const s=f(e,"utf8");let t;try{const[,r]=g(s);t=new Set(r.filter(n=>!B(s,n)).map(n=>n.n))}catch{t=new Set(O.filter(r=>new RegExp(String.raw`\bexport\b[^\n;]*\b${r}\b`,"u").test(s)&&!k(s,r)))}return O.filter(r=>t.has(r)).map(r=>({binding:_[r],className:r}))},S=(e,s,t)=>{if(s.length===0)return[];if(e.composed)return s.map(o=>({...o,exported:!0}));if(e.path===void 0)return s.map(o=>({...o,exported:!1}));const r=f(e.path,"utf8"),n=new RegExp(String.raw`\bexport\s*\*\s*from\s*["'][^"']*_generated\/${t}(?:\.js)?["']`).test(r);let a;try{const[,o]=g(r);a=new Set(o.filter(i=>!B(r,i)).map(i=>i.n))}catch{a=new Set(s.map(o=>o.className).filter(o=>new RegExp(String.raw`\bexport\b[^\n;]*\b${w(o)}\b`,"u").test(r)&&!k(r,o)))}return s.map(o=>{const i=n||a.has(o.className);return{...o,exported:i}})},Re=(e,s)=>H(e,s).info?.hasD1GlobalTable??!1,Ie=(e,s)=>{let t=d;for(const r of s){const n=c(e,r);if(!l(n)||!v(n).isDirectory())continue;const a=[];y(n,a);for(const o of a)t=x(t,ge(f(o,"utf8")))}return t},Ae=(e,s)=>{const t=c(e,s);if(!l(t)||!v(t).isDirectory())return!1;const r=[];return y(t,r),r.some(n=>le(f(n,"utf8")))},Ne=(e,s,t)=>[...e.map(r=>r.exported?`${r.bindingName}/${r.className} (container "${r.exportName}" declared and exported)`:`hint: container "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...s.map(r=>r.exported?`${r.bindingName}/${r.className} (workflow "${r.exportName}" declared and exported)`:`hint: workflow "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...t.map(r=>r.exported?`${r.bindingName}/${r.className} (agent "${r.exportName}" declared and exported)`:`hint: agent "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],Oe=(e,s)=>[[e.usesAi,"AI (@lunora/ai imported or env.AI used)"],[e.usesAuth&&!s.has("SessionDO"),"hint: @lunora/auth is imported; its tables are D1-backed by default. For DO-backed auth (what @better-auth/scim needs), pass `namespace` to .auth() and export the generated auth DO class"],[e.usesScheduler&&!s.has("SchedulerDO"),"hint: @lunora/scheduler is imported but no SchedulerDO is exported by the worker entry"],[e.usesStorage,"hint: @lunora/storage is imported; add an r2_buckets binding (bucket binding names are user-defined)"],[e.usesMail,"hint: @lunora/mail is imported; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)"],[e.usesPayment,`hint: @lunora/payment is imported; set the provider secrets in .dev.vars — ${de}`],[e.usesBrowser,"browser (@lunora/browser imported) — self-describing { binding: BROWSER }"],[e.usesImages,"images (@lunora/bindings/images imported) — self-describing { binding: IMAGES }"],[e.usesAnalytics,"analytics_engine_datasets (@lunora/bindings/analytics imported) — self-describing { binding: ANALYTICS, dataset }"],[e.usesKv,"hint: @lunora/bindings/kv is imported; add a kv_namespaces binding ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned"],[e.usesHyperdrive,"hint: @lunora/hyperdrive is imported; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned"],[e.usesPipelines,"hint: ctx.pipelines is used; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, pipeline }) — the pipeline resource can't be auto-provisioned"],[e.usesX402Charge,"hint: @lunora/x402/charge is imported; set the recipient wallet address as a [vars] entry (the var name is yours to choose) and pass it to the charge config — the x402 facilitator settles USDC to that address"],[e.usesX402Pay,"hint: @lunora/x402/pay is imported (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding for the agent wallet key (name it to match signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars, so the key can't be auto-provisioned"]].filter(([r])=>r).map(([,r])=>r),ve=(e,s,t,r=[],n=[],a=[])=>{const o=new Set(e.map(u=>u.className)),i=e.map(u=>`${u.binding}/${u.className} (exported by worker entry)`);return s&&i.push("DB (.global() table declared)"),i.push(...Ne(r,n,a),...Oe(t,o)),i},Ye=async e=>{await U;const s=e.schemaDir??"lunora",t=e.scanDirs??ee,r=Ie(e.projectRoot,t),n={...r,usesBrowser:r.usesBrowser||Ae(e.projectRoot,s)},a=_e(e.projectRoot);let o;a.composed?o=Ee.map(p=>({binding:_[p],className:p})):o=a.path===void 0?[]:ye(a.path);const i=n.needsD1||Re(e.projectRoot,s),u=S(a,W(e.projectRoot,s).containers,"containers"),R=S(a,Q(e.projectRoot,s).workflows,"workflows"),I=S(a,Y(e.projectRoot,s).agents,"agents"),$=[...J(e.projectRoot,s).queues],{flags:b}=V(e.projectRoot,s),E=b?.provider==="flagship"&&b.mode==="binding"?b.bindingName:void 0,A={};for(const p of m)A[p]=n[p];const N=ve(o,i,n,u,R,I);return E!==void 0&&N.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${E}", app_id }) — the app_id can't be auto-provisioned`),{agents:I,containers:u,durableObjects:o,flagshipBinding:E,needsD1:i,queues:$,signals:N,usesFlags:b!==void 0,workflows:R,...A}},je=e=>{const s=[];for(const t of m)e[t]&&s.push(h[t].source);return s};export{Se as COMPOSED_WORKER_ENTRY,he as LUNORA_WORKER_VIRTUAL_ID,se as WORKER_ENTRY_FALLBACKS,Ye as inferLunoraBindings,je as packageNamesFromBindings,_e as resolveWorkerEntry};
@@ -1 +0,0 @@
1
- import{existsSync as c,readFileSync as i}from"node:fs";import{readProjectTarget as s}from"@lunora/codegen";import{parse as a}from"jsonc-parser";import{DEFAULT_DEPLOY_TARGET as f,resolveDeployDriver as m}from"./DEFAULT_DEPLOY_TARGET-B-e9mqgX.mjs";import{join as p}from"node:path";const l="lunora.json",d=r=>{if(typeof r=="boolean")return r;if(r!==null&&typeof r=="object")return!0},u=r=>{const e=p(r,l);if(!c(e))return;let t;try{t=i(e,"utf8")}catch{return}const n=[],o=a(t,n,{allowTrailingComma:!0});if(!(n.length>0||o===null||typeof o!="object"))return o},h=r=>d(u(r)?.remote),g=r=>s(r),j=(r,e)=>e??g(r)??f,D=(r,e)=>{const t=j(r,e);return m(t),t};export{l as LUNORA_CONFIG_FILE,d as interpretRemote,h as readProjectRemotePreference,g as readProjectTarget,j as resolveProjectTarget,D as resolveTargetOrThrow};
@@ -1 +0,0 @@
1
- import{readFileSync as O,existsSync as h,readdirSync as F}from"node:fs";import{basename as x,join as b,dirname as D,extname as I}from"node:path";import{discoverSchemaInfo as P}from"./discoverSchemaInfo-DJvevsCm.mjs";import{Project as G,Node as u}from"ts-morph";import{COMPOSED_WORKER_ENTRY as K,LUNORA_WORKER_VIRTUAL_ID as Y,WORKER_ENTRY_FALLBACKS as H}from"./COMPOSED_WORKER_ENTRY-DySw1a7-.mjs";import{isCacheEnabled as V,WORKERS_CACHE_MIN_DATE as $}from"./WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{findWranglerFile as Q,readWranglerJsonc as z}from"./WRANGLER_FILES-UNW-xY5u.mjs";const J=new Set(["1","enabled","on","true","yes"]),X=e=>typeof e=="string"&&J.has(e.trim().toLowerCase()),Z=new Set([".cts",".mts",".ts",".tsx"]),ee=(e,s,n)=>{const t=b(s,K);if(h(t))return t;if(e!==Y){if(typeof e=="string"&&e.length>0){const i=b(D(n),e);return h(i)&&Z.has(I(i))?i:void 0}return H.map(i=>b(s,i)).find(i=>h(i))}},M=(e,s)=>{if(u.isIdentifier(e)){s.add(e.getText());return}if(u.isObjectBindingPattern(e)||u.isArrayBindingPattern(e))for(const n of e.getElements())u.isBindingElement(n)&&M(n.getNameNode(),s)},se=(e,s)=>{let n=!1;for(const t of e.getExportDeclarations())if(!t.isTypeOnly()){if(t.isNamespaceExport()){const i=t.getNamespaceExport();i===void 0?n=!0:s.add(i.getName());continue}for(const i of t.getNamedExports())i.isTypeOnly()||s.add(i.getAliasNode()?.getText()??i.getName())}return n},te=(e,s)=>{for(const n of e.getVariableStatements().filter(t=>t.getExportKeyword()!==void 0))for(const t of n.getDeclarations())M(t.getNameNode(),s);for(const n of[...e.getClasses(),...e.getFunctions(),...e.getEnums()]){const t=n.getExportKeyword()!==void 0&&!n.isDefaultExport()?n.getName():void 0;t!==void 0&&s.add(t)}},C=(e,s)=>{const n=new G({compilerOptions:{allowJs:!0},skipFileDependencyResolution:!0,skipLoadingLibFiles:!0,useInMemoryFileSystem:!0}),t=n.createSourceFile(e,s,{overwrite:!0});return n.getProgram().compilerObject.getSyntacticDiagnostics(t.compilerNode).length>0?void 0:t},ne=(e,s,n)=>{const t=ee(e,s,n);if(t===void 0)return;let i;try{i=O(t,"utf8")}catch{return}const a=C(x(t),i);if(a===void 0)return;const o=new Set,r=se(a,o);return r||te(a,o),{exports:r?void 0:o,path:t}},ie=new Set(["_generated","build","coverage","dist","node_modules","out","target"]),ae=new Set([".client",".server"]),oe=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),re=2e3,S="defineTable",A="defineApp",ce=e=>{const s=[],n=[];let t;try{t=F(e,{withFileTypes:!0})}catch{return{files:s,subdirectories:n}}for(const i of t)i.isDirectory()?i.name.startsWith(".")&&!ae.has(i.name)||ie.has(i.name)||n.push(b(e,i.name)):oe.has(I(i.name))&&s.push(b(e,i.name));return{files:s,subdirectories:n}},T=(e,s)=>{const n=new Set;for(const t of e.getImportDeclarations())for(const i of t.getNamedImports())!i.isTypeOnly()&&i.getName()===s&&n.add(i.getAliasNode()?.getText()??i.getName());return n},de=(e,s)=>{let n=!1;return e.forEachDescendant((t,i)=>{if(!u.isCallExpression(t))return;const a=t.getExpression();u.isIdentifier(a)&&s.has(a.getText())&&(n=!0,i.stop())}),n},le=e=>{let s=e;for(;u.isCallExpression(s)||u.isPropertyAccessExpression(s);)s=s.getExpression();return s},me=(e,s)=>{const n=le(e);return u.isIdentifier(n)&&s.has(n.getText())},L={global:/\.\s*global\s*\(/u,hyperdriveGlobal:/\.\s*hyperdriveGlobal\s*\(/u,vectors:/\.\s*vectors\s*\(/u},ue=e=>Object.hasOwn(L,e),ge=(e,s)=>{const n=new Set,t=new Set([S,...T(e,S)]);return e.forEachDescendant(i=>{if(!u.isCallExpression(i))return;const a=i.getExpression();if(!u.isPropertyAccessExpression(a)||me(a,t))return;const o=a.getName();ue(o)&&s.has(o)&&n.add(o)}),n},fe=(e,s)=>{let n;try{n=O(e,"utf8")}catch{return}const t=new Set([...s].filter(a=>L[a].test(n)));if(t.size===0&&!n.includes(A))return;const i=C(x(e),n);return i===void 0?{chained:t,composes:!1}:{chained:ge(i,t),composes:de(i,T(i,A))}},be=(e,s)=>{const n=[e],t=new Set;let i=0,a;const o=r=>{if(i+=1,i>re)return!1;const d=fe(r,s);for(const c of d?.chained??[])t.add(c);return d?.composes&&(a??=r),!0};for(;n.length>0;){const r=n.pop(),{files:d,subdirectories:c}=ce(r);n.push(...c);for(const l of d){if(!o(l))return;if(a!==void 0&&t.size===s.size)return{chained:t,site:a}}}return a===void 0?void 0:{chained:t,site:a}},j="2026-04-07",ns="web_socket_auto_reply_to_close",w=/^\d{4}-\d{2}-\d{2}$/,R=["containers","d1_databases","durable_objects","kv_namespaces","queues","r2_buckets","secrets_store_secrets","services","tail_consumers","vars","vectorize","workflows"],N=["assets","compatibility_date","exports","logpush","main","migrations","observability","placement"],B=(e,s)=>{if(s===void 0)return{merged:e,unverifiedKeys:[]};const n=e.env?.[s];if(n===void 0){const r=Object.keys(e.env??{}).toSorted((c,l)=>c.localeCompare(l)),d=r.length>0?` (declared: ${r.join(", ")}).`:" (no environments are declared).";return{error:`--env "${s}" names no environment declared in wrangler.jsonc's "env" block${d}`,merged:e,unverifiedKeys:[]}}const t={...e},i=Object.keys(n).filter(r=>r!=="env");for(const r of i)N.includes(r)&&(t[r]=n[r]);for(const r of R)t[r]=n[r];const a=new Set([...R,...N]),o=i.filter(r=>!a.has(r)).map(String);return{merged:t,unverifiedKeys:o}},pe=(e,s,n)=>{if(s.length===0)return;const t=e.vectorize??[],i=new Set(t.filter(Boolean).map(a=>a?.index_name));for(const a of s)i.has(a)||n.push(`schema declares vector index "${a}"; wrangler "vectorize" must include a binding with index_name "${a}"`)},he=new Set(["basic","dev","lite","standard","standard-1","standard-2","standard-3","standard-4"]),ye={disk_mb:2e4,memory_mib:12288,vcpu:4},ve=(e,s,n)=>{const t=e.instance_type;if(t===void 0)return;if(typeof t=="string"){he.has(t)||n.push(`${s} has unknown instance_type "${t}" — expected lite, basic, standard-1..4, or a custom { vcpu, memory_mib, disk_mb } object`);return}for(const[r,d]of Object.entries(ye)){const c=t[r];c!==void 0&&(typeof c!="number"||c<=0||c>d)&&n.push(`${s} custom instance_type ${r} must be a positive number ≤ ${String(d)} (got ${String(c)})`)}const{disk_mb:i,memory_mib:a,vcpu:o}=t;if(typeof o=="number"&&typeof a=="number"&&a<o*3072&&n.push(`${s} custom instance_type needs ≥ 3 GiB (3072 MiB) memory per vCPU (got ${String(a)} MiB for ${String(o)} vCPU)`),typeof a=="number"&&typeof i=="number"){const r=Math.floor(a/1024*2e3);i>r&&n.push(`${s} custom instance_type allows ≤ 2 GB disk per GiB memory (≤ ${String(r)} MB for ${String(a)} MiB memory; got ${String(i)} MB)`)}},_e=(e,s,n)=>{const{boundClasses:t,classKinds:i,errors:a,warnings:o}=n;if(!e||typeof e!="object"||typeof e.class_name!="string"||e.class_name.length===0){a.push(`${s} must have a non-empty "class_name" naming its container-enabled Durable Object class`);return}(typeof e.image!="string"||e.image.length===0)&&a.push(`${s} ("${e.class_name}") must have an "image" — a Dockerfile path or a registry reference`),t.has(e.class_name)||a.push(`${s} class "${e.class_name}" has no matching durable_objects binding — your dev server auto-reconciles this on startup; add { "name": "...", "class_name": "${e.class_name}" } to fix it by hand`);const r=i.get(e.class_name);r!=="sqlite"&&a.push(r==="classic"?`${s} class "${e.class_name}" is registered via "new_classes" but containers require SQLite-backed DOs — move it to "new_sqlite_classes"`:`${s} class "${e.class_name}" is missing from migrations — add a migration entry with "new_sqlite_classes": ["${e.class_name}"]`),ve(e,`${s} ("${e.class_name}")`,a),e.max_instances===void 0&&o.push(`${s} ("${e.class_name}") declares no max_instances — set a cap so a traffic spike can't fan out unbounded container spend`)},m=e=>typeof e=="string"&&e.length>0,g=e=>Array.isArray(e)?e.filter(s=>s!==null&&typeof s=="object"):[],_=e=>Array.isArray(e)?e.filter(s=>m(s)):[],U=e=>{const s=new Map;for(const n of g(e)){for(const t of _(n.new_classes))s.set(t,"classic");for(const t of _(n.new_sqlite_classes))s.set(t,"sqlite");for(const t of g(n.renamed_classes))if(m(t.from)&&m(t.to)){const i=s.get(t.from)??"sqlite";s.delete(t.from),s.set(t.to,i)}for(const t of _(n.deleted_classes))s.delete(t)}return s},Ee=e=>new Set(U(e).keys()),$e=(e,s)=>{const n=Ee(e.migrations);for(const t of g(e.durable_objects?.bindings))t.script_name===void 0&&m(t.class_name)&&!n.has(t.class_name)&&s.push(`durable_objects.bindings declares class "${t.class_name}" but it is missing from migrations — add a migration entry with "new_sqlite_classes": ["${t.class_name}"] (or "new_classes" for a non-SQLite-backed class), or let the dev server auto-reconcile it on the next start`)},Se=(e,s,n)=>{if(e.containers===void 0)return;if(!Array.isArray(e.containers)){s.push("containers must be an array of { class_name, image, ... } entries");return}const t=e.containers;if(t.length===0)return;const i=new Set(g(e.durable_objects?.bindings).map(o=>o.class_name)),a=U(e.migrations);for(const[o,r]of t.entries())_e(r,`containers[${String(o)}]`,{boundClasses:i,classKinds:a,errors:s,warnings:n});e.observability?.enabled!==!0&&n.push('containers are configured but observability is not enabled — container logs will not be captured (add { "observability": { "enabled": true } })')},E=e=>e,y=(e,s,n,t)=>{if(e!==void 0){if(!Array.isArray(e)){t.push(n.arrayMessage);return}for(const[i,a]of E(e).entries()){const o=`${s}[${String(i)}]`;if(!a||typeof a!="object"){t.push(n.objectMessage(o));continue}for(const r of n.fields)m(a[r.field])||t.push(r.message(o))}}},Ae={arrayMessage:"workflows must be an array of { name, binding, class_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Workflow binding (e.g. WORKFLOW_ORDER_PIPELINE)`},{field:"class_name",message:e=>`${e} must have a non-empty "class_name" naming the exported WorkflowEntrypoint class`},{field:"name",message:e=>`${e} must have a non-empty "name" naming the deployed workflow`}],objectMessage:e=>`${e} must be a { name, binding, class_name } object`},je={arrayMessage:"queues.producers must be an array of { binding, queue } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Queue producer (e.g. QUEUE_EMAIL)`},{field:"queue",message:e=>`${e} must have a non-empty "queue" naming the deployed queue`}],objectMessage:e=>`${e} must be a { binding, queue } object`},we={arrayMessage:"queues.consumers must be an array of { queue } entries",fields:[{field:"queue",message:e=>`${e} must have a non-empty "queue" naming the consumed queue`}],objectMessage:e=>`${e} must be a { queue } object`},Re=(e,s)=>{if(e.queues!==void 0){if(typeof e.queues!="object"||Array.isArray(e.queues)){s.push("queues must be a { producers, consumers } object");return}y(e.queues.producers,"queues.producers",je,s),y(e.queues.consumers,"queues.consumers",we,s)}},Ne={arrayMessage:"secrets_store_secrets must be an array of { binding, store_id, secret_name } entries",fields:["binding","store_id","secret_name"].map(e=>({field:e,message:s=>`${s} must have a non-empty "${e}"`})),objectMessage:e=>`${e} must be a { binding, store_id, secret_name } object`},ke=[{arrayMessage:"kv_namespaces must be an array of { binding, id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the KV namespace binding`,hintField:"id",hintMessage:(e,s)=>`${e} ("${s}") has no "id" — run \`wrangler kv namespace create\` and set the namespace id, or the binding can't resolve`,key:"kv_namespaces"},{arrayMessage:"flagship must be an array of { binding, app_id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Flagship binding`,hintField:"app_id",hintMessage:(e,s)=>`${e} ("${s}") has no "app_id" — create a Flagship app and set its id, or the binding can't resolve`,key:"flagship"},{arrayMessage:"hyperdrive must be an array of { binding, id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Hyperdrive binding`,hintField:"id",hintMessage:(e,s)=>`${e} ("${s}") has no "id" — run \`wrangler hyperdrive create\` and set the id, or the binding can't connect`,key:"hyperdrive"},{arrayMessage:"pipelines must be an array of { binding, stream } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Pipelines binding`,hintField:["stream","pipeline"],hintMessage:(e,s)=>`${e} ("${s}") has no "stream" — run \`wrangler pipelines create <name>\` and set the stream name, or the binding can't resolve`,key:"pipelines"},{arrayMessage:"analytics_engine_datasets must be an array of { binding, dataset } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Analytics Engine binding`,hintField:"dataset",hintMessage:(e,s)=>`${e} ("${s}") has no "dataset" — it defaults to the binding name; set it explicitly to avoid drift`,key:"analytics_engine_datasets"}],Oe=(e,s,n,t)=>{const i=e[s.key];if(i!==void 0){if(!Array.isArray(i)){n.push(s.arrayMessage);return}for(const[a,o]of E(i).entries()){const r=`${s.key}[${String(a)}]`;if(!o||typeof o!="object"||!m(o.binding)){n.push(s.bindingMessage(r));continue}(typeof s.hintField=="string"?[s.hintField]:s.hintField).some(c=>m(o[c]))||t.push(s.hintMessage(r,o.binding))}}},xe=[{key:"browser",message:'browser must be an object with a non-empty "binding" (e.g. { "binding": "BROWSER" })'},{key:"images",message:'images must be an object with a non-empty "binding" (e.g. { "binding": "IMAGES" })'}],De=(e,s,n)=>{const t=e[s.key];t!==void 0&&(typeof t!="object"||t===null||Array.isArray(t)||!m(t.binding))&&n.push(s.message)},Ie=[{arrayMessage:"services must be an array of { binding, service, entrypoint? } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the service binding`},{field:"service",message:e=>`${e} must have a non-empty "service" naming the target Worker`}],key:"services",objectMessage:e=>`${e} must be a { binding, service, entrypoint? } object`},{arrayMessage:"dispatch_namespaces must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding"`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the dispatch namespace`}],key:"dispatch_namespaces",objectMessage:e=>`${e} must be a { binding, namespace } object`},{arrayMessage:"mtls_certificates must be an array of { binding, certificate_id } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding"`},{field:"certificate_id",message:e=>`${e} must have a non-empty "certificate_id" (upload via \`wrangler mtls-certificate upload\`)`}],key:"mtls_certificates",objectMessage:e=>`${e} must be a { binding, certificate_id } object`},{arrayMessage:"r2_buckets must be an array of { binding, bucket_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the R2 bucket binding`},{field:"bucket_name",message:e=>`${e} must have a non-empty "bucket_name" naming the deployed bucket`}],key:"r2_buckets",objectMessage:e=>`${e} must be a { binding, bucket_name } object`}],Me=(e,s,n)=>{s?.hasD1GlobalTable&&!g(e.d1_databases).some(t=>t.binding==="DB")&&n.push('schema declares .global() tables; d1_databases must include a binding named "DB" — your dev server auto-reconciles this on startup, or add the binding manually'),s?.hasHyperdriveGlobalTable&&g(e.hyperdrive).length===0&&n.push('schema declares .global({ backend: "hyperdrive" }) tables; wrangler must declare a hyperdrive binding for `.hyperdriveGlobal({ exec })` to read — run `wrangler hyperdrive create <name> --connection-string=...` and add `"hyperdrive": [{ "binding": "HYPERDRIVE", "id": "<id>" }]` (any binding name works; your `exec` selector picks it)')},Ce=(e,s)=>{const{d1_databases:n}=e;if(n!==void 0){if(!Array.isArray(n)){s.push("d1_databases must be an array of { binding, database_id | database_name } entries");return}for(const[t,i]of E(n).entries()){const a=`d1_databases[${String(t)}]`;if(!i||typeof i!="object"){s.push(`${a} must be a { binding, database_id | database_name } object`);continue}m(i.binding)||s.push(`${a} must have a non-empty "binding" naming the D1 binding`),!m(i.database_id)&&!m(i.database_name)&&s.push(`${a} must have a "database_id" or a "database_name" — run \`wrangler d1 create\` and set one, or the binding can't resolve`)}}},Te=(e,s,n)=>{const t=e.send_email;if(t===void 0)return;if(!Array.isArray(t)){s.push("send_email must be an array of { name, destination_address? } entries");return}const i=t;for(const[a,o]of i.entries())(!o||typeof o!="object"||typeof o.name!="string"||o.name.length===0)&&n.push(`send_email[${String(a)}] has no non-empty "name" naming the send-email binding — set one before deploying`)},Le=(e,s)=>{e.logpush!==void 0&&typeof e.logpush!="boolean"&&s.push('logpush must be a boolean (set "logpush": true to enable Cloudflare Logpush)')},k=new Set(["off","smart","targeted"]),Be=(e,s)=>{const{placement:n}=e;if(n===void 0)return;if(typeof n!="object"||n===null||Array.isArray(n)){s.push('placement must be an object (e.g. { "mode": "smart" })');return}const{mode:t}=n;t!==void 0&&(typeof t!="string"||!k.has(t))&&s.push(`placement.mode must be one of ${[...k].map(i=>`"${i}"`).join(", ")}`)},Ue=(e,s)=>{const{observability:n}=e;if(n===void 0)return;if(typeof n!="object"||Array.isArray(n)){s.push('observability must be an object (e.g. { "enabled": true, "head_sampling_rate": 1 })');return}const t=(i,a)=>{i!==void 0&&(typeof i!="number"||Number.isNaN(i)||i<0||i>1)&&s.push(`${a} must be a number in [0, 1] (the fraction of requests sampled)`)};t(n.head_sampling_rate,"observability.head_sampling_rate"),n.logs!==void 0&&(typeof n.logs!="object"||Array.isArray(n.logs)?s.push("observability.logs must be an object"):t(n.logs.head_sampling_rate,"observability.logs.head_sampling_rate"))},We=(e,s)=>{const{cache:n}=e;if(n!==void 0){if(typeof n!="object"||n===null||Array.isArray(n)){s.push('cache must be an object (e.g. { "enabled": true })');return}n.enabled!==void 0&&typeof n.enabled!="boolean"&&s.push("cache.enabled must be a boolean (true or false)")}},qe=(e,s)=>{const{exports:n}=e;if(n!==void 0){if(typeof n!="object"||n===null||Array.isArray(n)){s.push("exports must be an object keyed by entrypoint name");return}for(const[t,i]of Object.entries(n)){if(typeof i!="object"||i===null){s.push(`exports["${t}"] must be an object`);continue}i.type!==void 0&&typeof i.type!="string"&&s.push(`exports["${t}"].type must be a string`),i.cache!==void 0&&(typeof i.cache!="object"||i.cache===null||Array.isArray(i.cache)?s.push(`exports["${t}"].cache must be an object`):i.cache.enabled!==void 0&&typeof i.cache.enabled!="boolean"&&s.push(`exports["${t}"].cache.enabled must be a boolean`))}}},Fe=(e,s)=>{const{assets:n}=e;if(n!==void 0){if(typeof n!="object"||Array.isArray(n)){s.push('assets must be an object (e.g. { "directory": "./dist/client", "binding": "ASSETS" })');return}(typeof n.directory!="string"||n.directory.length===0)&&s.push('assets must declare a non-empty "directory" pointing at the built client output (e.g. "./dist/client")'),n.binding!==void 0&&(typeof n.binding!="string"||n.binding.length===0)&&s.push('assets.binding must be a non-empty string (e.g. "ASSETS")'),n.html_handling!==void 0&&typeof n.html_handling!="string"&&s.push("assets.html_handling must be a string"),n.not_found_handling!==void 0&&typeof n.not_found_handling!="string"&&s.push("assets.not_found_handling must be a string")}},Pe=(e,s)=>{const n=e.tail_consumers;if(n===void 0)return;if(!Array.isArray(n)){s.push("tail_consumers must be an array of { service, environment? } entries");return}const t=n;for(const[i,a]of t.entries())(!a||typeof a!="object"||typeof a.service!="string"||a.service.length===0)&&s.push(`tail_consumers[${String(i)}] must have a non-empty "service" naming the consumer Worker`)},is=(e,s)=>{const n=e.tail_consumers??[];return n.some(i=>!!i&&i?.service===s.service&&i?.environment===s.environment)?e:{...e,tail_consumers:[...n,s]}},Ge=(e,s)=>{const{vars:n}=e;if(!n||typeof n!="object")return;const t=n.LUNORA_ALLOWED_ORIGINS,i=n.LUNORA_CORS_ALLOW_CREDENTIALS,a=typeof t=="string"&&t.split(",").some(r=>r.trim()==="*"),o=X(i);a&&o&&s.push('vars.LUNORA_ALLOWED_ORIGINS includes a "*" wildcard while vars.LUNORA_CORS_ALLOW_CREDENTIALS is on — browsers reject this combination and it defeats the allowlist; name explicit origins or drop credentials')},v="LUNORA_ORIGIN_URL",Ke=(e,s,n)=>{if(!g(e.durable_objects?.bindings).some(o=>o.class_name==="SchedulerDO"&&o.script_name===void 0)||m(e.vars?.[v]))return;const i=s===void 0?"vars":`env.${s}.vars`,a=s===void 0?"":` --env ${s}`;n.push(`durable_objects.bindings declares the SchedulerDO but ${i}.${v} is unset — the DO reads its dispatch origin from its own env and refuses to schedule without it, so every ctx.scheduler.runAfter/runAt fails with ORIGIN_NOT_CONFIGURED. Set ${i}.${v} to the worker's public URL, or \`wrangler secret put ${v}${a}\` (ignore this if it is already set as a secret or in the dashboard).`)},Ye=(e,s,n)=>{const{error:t,merged:i,unverifiedKeys:a}=B(e,s);return t!==void 0?{error:t,wrangler:i}:(a.length>0&&n.push(`env.${String(s)} overrides ${a.join(", ")}, which this validator doesn't have a verified inheritance rule for — validated against the TOP-LEVEL value only. Double-check ${a.length===1?"it":"them"} by hand for "${String(s)}".`),{wrangler:i})},W=(e,s,n)=>{const t=[],i=[];if(!e||typeof e!="object")return t.push("wrangler config is not a valid object"),{errors:t,valid:!1,warnings:i};const{error:a,wrangler:o}=Ye(e,n,i);if(a!==void 0)return t.push(a),{errors:t,valid:!1,warnings:i};g(o.durable_objects?.bindings).find(l=>l.name==="SHARD"&&l.class_name==="ShardDO")||t.push('durable_objects.bindings must include { "name": "SHARD", "class_name": "ShardDO" } — your dev server auto-reconciles this on startup, or add the binding manually'),$e(o,t);const c=o.compatibility_date??"";c&&!w.test(c)?t.push(`compatibility_date must be in YYYY-MM-DD format (got "${c}")`):c<j&&t.push(`compatibility_date must be >= "${j}" (got "${c||"<missing>"}")`),V(o)&&w.test(c)&&c<$&&t.push(`cache.enabled requires compatibility_date >= "${$}" (got "${c||"<missing>"}")`),Me(o,s,t),Ce(o,t),pe(o,s?.vectorIndexNames??[],t),Pe(o,t),Se(o,t,i),y(o.workflows,"workflows",Ae,t),Re(o,t),y(o.secrets_store_secrets,"secrets_store_secrets",Ne,t);for(const l of ke)Oe(o,l,t,i);for(const l of Ie)y(o[l.key],l.key,l,t);for(const l of xe)De(o,l,t);return Te(o,t,i),Le(o,t),Be(o,t),Ue(o,t),Fe(o,t),We(o,t),qe(o,t),Ge(o,t),Ke(o,n,i),{errors:t,valid:t.length===0,warnings:i}},as=W,q=e=>Array.isArray(e)?e:[],He=(e,s,n)=>{const t=[];for(const i of q(e)){const a=i?.image;typeof a!="string"||!(a.startsWith("./")||a.startsWith("../")||a.startsWith("/")||a.includes("Dockerfile"))||h(a.startsWith("/")?a:b(s,a))||t.push(`containers image "${a}" does not exist (resolved relative to ${n}); create the Dockerfile or point image at a registry reference`)}return t},Ve=(e,s)=>{const n=e?.vectorIndexNames??[],t=[];if(n.length>0&&t.push({message:a=>`schema declares vector index(es) ${n.map(o=>`"${o}"`).join(", ")} but nothing chains .vectors(...) onto defineApp() (composed in: ${a}) — \`ctx.vectors\` is then a throwing stub and buildWorkerOptions rejects EVERY request, /_lunora/health included. Add \`.vectors((env) => ({ ${String(n[0])}: env.<BINDING> }))\` to the chain.`,method:"vectors"}),e?.hasD1GlobalTable&&t.push({message:a=>`schema declares .global() table(s) but nothing chains .global(...) onto defineApp() (composed in: ${a}) — the shard then has no global writer, so every read or write of a global table throws INTERNAL ("requires a globalDb writer"). Add \`.global({ d1: (env) => env.DB })\` to the chain.`,method:"global"}),e?.hasHyperdriveGlobalTable&&t.push({message:a=>`schema declares .global({ backend: "hyperdrive" }) table(s) but nothing chains .hyperdriveGlobal(...) onto defineApp() (composed in: ${a}) — the shard then has no global writer, so every read or write of those tables throws INTERNAL. Add \`.hyperdriveGlobal({ engine: "postgres", exec: (env) => buildPgExec(fromPostgresJs(postgres(env.HYPERDRIVE.connectionString))) })\` to the chain (\`buildPgExec\` from \`@lunora/hyperdrive/global\`, \`fromPostgresJs\` from \`@lunora/hyperdrive\`).`,method:"hyperdriveGlobal"}),t.length===0)return[];const i=be(s,new Set(t.map(a=>a.method)));return i===void 0?[]:t.filter(a=>!i.chained.has(a.method)).map(a=>a.message(i.site))},Qe=(e,s)=>{const n=s.exports;if(n===void 0)return[];const t=[];for(const a of g(e.durable_objects?.bindings))typeof a.class_name=="string"&&a.class_name.length>0&&a.script_name===void 0&&t.push({className:a.class_name,label:"durable_objects.bindings"});for(const a of q(e.workflows))typeof a?.class_name=="string"&&a.class_name.length>0&&a.script_name===void 0&&t.push({className:a.class_name,label:"workflows"});return t.filter(a=>!n.has(a.className)).map(a=>`${a.label} declares class "${a.className}" but the worker entry (${s.path}) does not export it — wrangler refuses to bundle a Worker whose Durable Object classes are not exported. Re-export it from the module that defines it (\`export { ${a.className} } from "./…";\`), or add it to the app builder's own export (\`export const { ${a.className} } = app;\`).`)},os=e=>{const s=e.schemaDir??"lunora",n=Q(e.projectRoot);if(!n){const f=`wrangler.jsonc not found in ${e.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[f],report:{errors:[f],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:t}=z(n);if(t===void 0){const f=`failed to parse ${n} as JSONC.`;return{problems:[f],report:{errors:[f],valid:!1,warnings:[]},wranglerPath:n}}const{error:i,merged:a}=B(t,e.environment);if(i!==void 0)return{problems:[i],report:{errors:[i],valid:!1,warnings:[]},wranglerPath:n};const{error:o,info:r}=P(e.projectRoot,s),d=W(t,r,e.environment);o!==void 0&&d.warnings.push(`schema parse failed in ${s}/schema.ts: ${o}`);const c=D(n),l=ne(a.main,e.projectRoot,n);d.errors.push(...He(a.containers??[],c,n)),l!==void 0&&d.errors.push(...Qe(a,l)),d.errors.push(...Ve(r,e.projectRoot));const p=a.assets?.directory;if(typeof p=="string"&&p.length>0){const f=p.startsWith("/")?p:b(c,p);h(f)||d.warnings.push(`assets.directory "${p}" does not exist yet — it is created by the client build; run the build before deploy`)}return d.valid=d.errors.length===0,{problems:d.errors,report:d,wranglerPath:n}};export{j as REQUIRED_COMPATIBILITY_DATE,ns as REQUIRED_FLAG,B as mergeWranglerEnvironment,g as objectBindingEntries,_ as stringEntries,as as validateWrangler,W as validateWranglerConfig,os as validateWranglerProject,is as withTailConsumer};