@lunora/config 1.0.0-alpha.295 → 1.0.0-alpha.297

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/cloudflare/index.d.mts +35 -3
  2. package/dist/cloudflare/index.d.ts +35 -3
  3. package/dist/cloudflare/index.mjs +1 -1
  4. package/dist/index.d.mts +24 -3
  5. package/dist/index.d.ts +24 -3
  6. package/dist/index.mjs +1 -1
  7. package/dist/packem_shared/DEFAULT_OBSERVABILITY-bN6UkTMx.mjs +1 -0
  8. package/dist/packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs +4 -0
  9. package/dist/packem_shared/{REQUIRED_COMPATIBILITY_DATE-DFsH8i4Z.mjs → REQUIRED_COMPATIBILITY_DATE-Cosq9TDj.mjs} +1 -1
  10. package/dist/packem_shared/{UNEXPORTED_CLASS_MARKER-BMNpympM.mjs → UNEXPORTED_CLASS_MARKER-C8AFIY8C.mjs} +1 -1
  11. package/dist/packem_shared/{assertWranglerSatisfiesSchema-DBsJ8xZA.mjs → assertWranglerSatisfiesSchema-CfrY1Lal.mjs} +1 -1
  12. package/dist/packem_shared/collectExportGaps-BEkTtsyv.mjs +2 -0
  13. package/dist/packem_shared/infer-bindings-B-BFynp2.mjs +1 -0
  14. package/dist/packem_shared/{infer-bindings.d-Duw2Bq4_.d.mts → infer-bindings.d-BH0tk-TR.d.mts} +14 -14
  15. package/dist/packem_shared/{infer-bindings.d-Duw2Bq4_.d.ts → infer-bindings.d-BH0tk-TR.d.ts} +14 -14
  16. package/dist/packem_shared/inferLunoraBindings-CzvNvl9y.mjs +1 -0
  17. package/dist/packem_shared/{reconcileBindingsSafely-BDZqwxAJ.mjs → reconcileBindingsSafely-BU5PpS1F.mjs} +1 -1
  18. package/dist/packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs +1 -0
  19. package/dist/packem_shared/{validate-bindings-Djec3UWf.mjs → validate-bindings-DFAcr5wA.mjs} +1 -1
  20. package/dist/packem_shared/withTailConsumer-BZqzeKYh.mjs +1 -0
  21. package/package.json +4 -4
  22. package/dist/packem_shared/DEV_BINDINGS_FILE-pyOiNLP4.mjs +0 -4
  23. package/dist/packem_shared/collectExportGaps-BOeuCzWm.mjs +0 -2
  24. package/dist/packem_shared/infer-bindings-D5S20KYQ.mjs +0 -1
  25. package/dist/packem_shared/inferLunoraBindings-DLCakLqW.mjs +0 -1
  26. package/dist/packem_shared/withTailConsumer-Dz7FDSBy.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-Duw2Bq4_.mjs";
1
+ import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-BH0tk-TR.mjs";
2
2
  import { WranglerVariableIR } from '@lunora/codegen';
3
3
  /** Apply one structural jsonc edit and return the rewritten text (a no-op edit returns the input). */
4
4
  declare const applyModify: (text: string, path: ReadonlyArray<number | string>, value: unknown) => string;
@@ -759,8 +759,40 @@ interface WranglerObservability {
759
759
  enabled?: boolean;
760
760
  };
761
761
  logs?: WranglerObservabilityLogs;
762
+ /** Strip query strings from request URLs in logs and traces (wrangler's default is `false`). */
763
+ redact_query_string?: boolean;
762
764
  traces?: WranglerObservabilityTraces;
763
765
  }
766
+ /**
767
+ * The `observability` block Lunora writes when a project has none — by
768
+ * `lunora dev`'s binding reconcile and by `lunora init`'s scaffold. Logs on,
769
+ * every request sampled: the right default while an app is small, and what
770
+ * `lunora doctor`'s `observability-full-sampling` advisory then flags once
771
+ * Workers Observability is billed. One constant so the writers and the doctor
772
+ * cannot drift apart.
773
+ */
774
+ declare const DEFAULT_OBSERVABILITY: Readonly<{
775
+ enabled: true;
776
+ head_sampling_rate: 1;
777
+ }>;
778
+ /** One signal's effective sampling, as {@link resolveObservabilitySampling} resolves it. */
779
+ interface ObservabilitySignalSampling {
780
+ enabled: boolean;
781
+ /** Fraction of requests sampled, 0–1. */
782
+ headSamplingRate: number;
783
+ }
784
+ /**
785
+ * The effective logs / traces sampling an `observability` block deploys with,
786
+ * defaults applied. An absent block is {@link DEFAULT_OBSERVABILITY}, which is
787
+ * what Lunora reconciles it to. Inside a present block, logs are on unless the
788
+ * block (or its `logs` sub-block) turns them off; traces are opt-in
789
+ * (`traces.enabled: true`); and an unset rate is wrangler's own default of 1.
790
+ * `logs.*` overrides the top-level switch and rate.
791
+ */
792
+ declare const resolveObservabilitySampling: (block: WranglerObservability | undefined) => {
793
+ logs: ObservabilitySignalSampling;
794
+ traces: ObservabilitySignalSampling;
795
+ };
764
796
  /** A wrangler `containers[]` entry (parsed from untrusted JSONC). */
765
797
  interface WranglerContainerEntry {
766
798
  class_name?: string;
@@ -1137,7 +1169,7 @@ declare const validateWranglerConfig: (wranglerInput: WranglerConfig | undefined
1137
1169
  * `{ valid, errors, warnings }`.
1138
1170
  */
1139
1171
  declare const validateWrangler: typeof validateWranglerConfig;
1140
- export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_VERSION, type BindingManifest, type BindingRequirement, CLOUDFLARE_DRIVER, type ExportGap, GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG, 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 ReconcileProject, type RemoteBindingPlan, type RemoteEnableInputs, type RemoteWranglerShape, type ServiceDevConfigs, type TailConsumer, UNEXPORTED_CLASS_MARKER, WORKERS_CACHE_MIN_DATE, WRANGLER_FILES, type WranglerCacheShape, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerObservability, type WranglerObservabilityLogs, type WranglerObservabilityTraces, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry,
1172
+ export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_VERSION, type BindingManifest, type BindingRequirement, CLOUDFLARE_DRIVER, DEFAULT_OBSERVABILITY, type ExportGap, GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG, type ManifestConfigShape, type MaterializeOptions, type MaterializeResult, type ObservabilitySignalSampling, REMOTE_ELIGIBLE_KEYS, REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, type ReadWranglerResult, type ReconcileBindingsResult, type ReconcileCompatibilityDateResult, type ReconcileResult as ReconcileCronsResult, type ReconcileProject, type RemoteBindingPlan, type RemoteEnableInputs, type RemoteWranglerShape, type ServiceDevConfigs, type TailConsumer, UNEXPORTED_CLASS_MARKER, WORKERS_CACHE_MIN_DATE, WRANGLER_FILES, type WranglerCacheShape, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerObservability, type WranglerObservabilityLogs, type WranglerObservabilityTraces, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry,
1141
1173
  /**
1142
1174
  * `@lunora/config/cloudflare` — the wrangler layer.
1143
1175
  *
@@ -1153,4 +1185,4 @@ export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_V
1153
1185
  * Plan 114 §5.3 (D6): a package carrying real provider code isolates it behind a
1154
1186
  * subpath rather than relocating wholesale.
1155
1187
  */
1156
- applyModify, assertWranglerSatisfiesSchema, buildBindingManifest, collectExportGaps, collectWranglerSecretVariables, describePreservedCrons, findWranglerFile, injectRemoteFlags, isCacheEnabled, isRemoteEnvEnabled, materializeRemoteWranglerConfig, materializeServiceDevConfigs, mergeWranglerEnvironment, planRemoteBindings, readWranglerJsonc, reconcileBindingsSafely, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, reconcileWranglerExtras, resolveRemoteEnabled, scanWranglerVariablesForSecrets, validateWrangler, validateWranglerConfig, validateWranglerProject, withTailConsumer, wranglerToAlchemy };
1188
+ applyModify, assertWranglerSatisfiesSchema, buildBindingManifest, collectExportGaps, collectWranglerSecretVariables, describePreservedCrons, findWranglerFile, injectRemoteFlags, isCacheEnabled, isRemoteEnvEnabled, materializeRemoteWranglerConfig, materializeServiceDevConfigs, mergeWranglerEnvironment, planRemoteBindings, readWranglerJsonc, reconcileBindingsSafely, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, reconcileWranglerExtras, resolveObservabilitySampling, resolveRemoteEnabled, scanWranglerVariablesForSecrets, validateWrangler, validateWranglerConfig, validateWranglerProject, withTailConsumer, wranglerToAlchemy };
@@ -1,4 +1,4 @@
1
- import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-Duw2Bq4_.js";
1
+ import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-BH0tk-TR.js";
2
2
  import { WranglerVariableIR } from '@lunora/codegen';
3
3
  /** Apply one structural jsonc edit and return the rewritten text (a no-op edit returns the input). */
4
4
  declare const applyModify: (text: string, path: ReadonlyArray<number | string>, value: unknown) => string;
@@ -759,8 +759,40 @@ interface WranglerObservability {
759
759
  enabled?: boolean;
760
760
  };
761
761
  logs?: WranglerObservabilityLogs;
762
+ /** Strip query strings from request URLs in logs and traces (wrangler's default is `false`). */
763
+ redact_query_string?: boolean;
762
764
  traces?: WranglerObservabilityTraces;
763
765
  }
766
+ /**
767
+ * The `observability` block Lunora writes when a project has none — by
768
+ * `lunora dev`'s binding reconcile and by `lunora init`'s scaffold. Logs on,
769
+ * every request sampled: the right default while an app is small, and what
770
+ * `lunora doctor`'s `observability-full-sampling` advisory then flags once
771
+ * Workers Observability is billed. One constant so the writers and the doctor
772
+ * cannot drift apart.
773
+ */
774
+ declare const DEFAULT_OBSERVABILITY: Readonly<{
775
+ enabled: true;
776
+ head_sampling_rate: 1;
777
+ }>;
778
+ /** One signal's effective sampling, as {@link resolveObservabilitySampling} resolves it. */
779
+ interface ObservabilitySignalSampling {
780
+ enabled: boolean;
781
+ /** Fraction of requests sampled, 0–1. */
782
+ headSamplingRate: number;
783
+ }
784
+ /**
785
+ * The effective logs / traces sampling an `observability` block deploys with,
786
+ * defaults applied. An absent block is {@link DEFAULT_OBSERVABILITY}, which is
787
+ * what Lunora reconciles it to. Inside a present block, logs are on unless the
788
+ * block (or its `logs` sub-block) turns them off; traces are opt-in
789
+ * (`traces.enabled: true`); and an unset rate is wrangler's own default of 1.
790
+ * `logs.*` overrides the top-level switch and rate.
791
+ */
792
+ declare const resolveObservabilitySampling: (block: WranglerObservability | undefined) => {
793
+ logs: ObservabilitySignalSampling;
794
+ traces: ObservabilitySignalSampling;
795
+ };
764
796
  /** A wrangler `containers[]` entry (parsed from untrusted JSONC). */
765
797
  interface WranglerContainerEntry {
766
798
  class_name?: string;
@@ -1137,7 +1169,7 @@ declare const validateWranglerConfig: (wranglerInput: WranglerConfig | undefined
1137
1169
  * `{ valid, errors, warnings }`.
1138
1170
  */
1139
1171
  declare const validateWrangler: typeof validateWranglerConfig;
1140
- export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_VERSION, type BindingManifest, type BindingRequirement, CLOUDFLARE_DRIVER, type ExportGap, GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG, 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 ReconcileProject, type RemoteBindingPlan, type RemoteEnableInputs, type RemoteWranglerShape, type ServiceDevConfigs, type TailConsumer, UNEXPORTED_CLASS_MARKER, WORKERS_CACHE_MIN_DATE, WRANGLER_FILES, type WranglerCacheShape, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerObservability, type WranglerObservabilityLogs, type WranglerObservabilityTraces, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry,
1172
+ export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_VERSION, type BindingManifest, type BindingRequirement, CLOUDFLARE_DRIVER, DEFAULT_OBSERVABILITY, type ExportGap, GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG, type ManifestConfigShape, type MaterializeOptions, type MaterializeResult, type ObservabilitySignalSampling, REMOTE_ELIGIBLE_KEYS, REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, type ReadWranglerResult, type ReconcileBindingsResult, type ReconcileCompatibilityDateResult, type ReconcileResult as ReconcileCronsResult, type ReconcileProject, type RemoteBindingPlan, type RemoteEnableInputs, type RemoteWranglerShape, type ServiceDevConfigs, type TailConsumer, UNEXPORTED_CLASS_MARKER, WORKERS_CACHE_MIN_DATE, WRANGLER_FILES, type WranglerCacheShape, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerObservability, type WranglerObservabilityLogs, type WranglerObservabilityTraces, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry,
1141
1173
  /**
1142
1174
  * `@lunora/config/cloudflare` — the wrangler layer.
1143
1175
  *
@@ -1153,4 +1185,4 @@ export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_V
1153
1185
  * Plan 114 §5.3 (D6): a package carrying real provider code isolates it behind a
1154
1186
  * subpath rather than relocating wholesale.
1155
1187
  */
1156
- applyModify, assertWranglerSatisfiesSchema, buildBindingManifest, collectExportGaps, collectWranglerSecretVariables, describePreservedCrons, findWranglerFile, injectRemoteFlags, isCacheEnabled, isRemoteEnvEnabled, materializeRemoteWranglerConfig, materializeServiceDevConfigs, mergeWranglerEnvironment, planRemoteBindings, readWranglerJsonc, reconcileBindingsSafely, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, reconcileWranglerExtras, resolveRemoteEnabled, scanWranglerVariablesForSecrets, validateWrangler, validateWranglerConfig, validateWranglerProject, withTailConsumer, wranglerToAlchemy };
1188
+ applyModify, assertWranglerSatisfiesSchema, buildBindingManifest, collectExportGaps, collectWranglerSecretVariables, describePreservedCrons, findWranglerFile, injectRemoteFlags, isCacheEnabled, isRemoteEnvEnabled, materializeRemoteWranglerConfig, materializeServiceDevConfigs, mergeWranglerEnvironment, planRemoteBindings, readWranglerJsonc, reconcileBindingsSafely, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, reconcileWranglerExtras, resolveObservabilitySampling, resolveRemoteEnabled, scanWranglerVariablesForSecrets, validateWrangler, validateWranglerConfig, validateWranglerProject, withTailConsumer, wranglerToAlchemy };
@@ -1 +1 @@
1
- import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{assertWranglerSatisfiesSchema as n}from"../packem_shared/assertWranglerSatisfiesSchema-DBsJ8xZA.mjs";import{BINDING_MANIFEST_VERSION as l,buildBindingManifest as i}from"../packem_shared/BINDING_MANIFEST_VERSION-CPGD7sr_.mjs";import{default as E}from"../packem_shared/CLOUDFLARE_DRIVER-Ci3VIqnk.mjs";import{default as s}from"../packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs";import{collectExportGaps as p,reconcileWranglerBindings as g}from"../packem_shared/collectExportGaps-BOeuCzWm.mjs";import{reconcileWranglerCompatibilityDate as x}from"../packem_shared/reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{describePreservedCrons as _,reconcileWranglerCrons as C}from"../packem_shared/describePreservedCrons-7gaDLxWx.mjs";import{reconcileBindingsSafely as W,reconcileWranglerExtras as L}from"../packem_shared/reconcileBindingsSafely-BDZqwxAJ.mjs";import{REMOTE_ELIGIBLE_KEYS as A,injectRemoteFlags as T,isRemoteEnvEnabled as D,materializeRemoteWranglerConfig as v,planRemoteBindings as B,resolveRemoteEnabled as F}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-DioKi8jL.mjs";import{materializeServiceDevConfigs as G}from"../packem_shared/materializeServiceDevConfigs-VcqRp-kv.mjs";import{withTailConsumer as N}from"../packem_shared/withTailConsumer-Dz7FDSBy.mjs";import{WORKERS_CACHE_MIN_DATE as y,isCacheEnabled as P}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{mergeWranglerEnvironment as h}from"../packem_shared/mergeWranglerEnvironment-KtP_NGVx.mjs";import{WRANGLER_FILES as V,findWranglerFile as K,readWranglerJsonc as Y}from"../packem_shared/WRANGLER_FILES-UNW-xY5u.mjs";import{UNEXPORTED_CLASS_MARKER as w,validateWranglerProject as z}from"../packem_shared/UNEXPORTED_CLASS_MARKER-BMNpympM.mjs";import{collectWranglerSecretVariables as Q,scanWranglerVariablesForSecrets as J}from"../packem_shared/collectWranglerSecretVariables-D-usPfT8.mjs";import{wranglerToAlchemy as k}from"../packem_shared/wranglerToAlchemy-Bpfy1abZ.mjs";import{REQUIRED_COMPATIBILITY_DATE as Z,REQUIRED_FLAG as $,validateWrangler as ee,validateWranglerConfig as re}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-DFsH8i4Z.mjs";export{l as BINDING_MANIFEST_VERSION,E as CLOUDFLARE_DRIVER,s as GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG,A as REMOTE_ELIGIBLE_KEYS,Z as REQUIRED_COMPATIBILITY_DATE,$ as REQUIRED_FLAG,w as UNEXPORTED_CLASS_MARKER,y as WORKERS_CACHE_MIN_DATE,V as WRANGLER_FILES,o as applyModify,n as assertWranglerSatisfiesSchema,i as buildBindingManifest,p as collectExportGaps,Q as collectWranglerSecretVariables,_ as describePreservedCrons,K as findWranglerFile,T as injectRemoteFlags,P as isCacheEnabled,D as isRemoteEnvEnabled,v as materializeRemoteWranglerConfig,G as materializeServiceDevConfigs,h as mergeWranglerEnvironment,B as planRemoteBindings,Y as readWranglerJsonc,W as reconcileBindingsSafely,g as reconcileWranglerBindings,x as reconcileWranglerCompatibilityDate,C as reconcileWranglerCrons,L as reconcileWranglerExtras,F as resolveRemoteEnabled,J as scanWranglerVariablesForSecrets,ee as validateWrangler,re as validateWranglerConfig,z as validateWranglerProject,N as withTailConsumer,k as wranglerToAlchemy};
1
+ import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{assertWranglerSatisfiesSchema as l}from"../packem_shared/assertWranglerSatisfiesSchema-CfrY1Lal.mjs";import{BINDING_MANIFEST_VERSION as n,buildBindingManifest as i}from"../packem_shared/BINDING_MANIFEST_VERSION-CPGD7sr_.mjs";import{default as E}from"../packem_shared/CLOUDFLARE_DRIVER-Ci3VIqnk.mjs";import{default as s}from"../packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs";import{collectExportGaps as c,reconcileWranglerBindings as g}from"../packem_shared/collectExportGaps-BEkTtsyv.mjs";import{reconcileWranglerCompatibilityDate as x}from"../packem_shared/reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{describePreservedCrons as d,reconcileWranglerCrons as I}from"../packem_shared/describePreservedCrons-7gaDLxWx.mjs";import{reconcileBindingsSafely as L,reconcileWranglerExtras as S}from"../packem_shared/reconcileBindingsSafely-BU5PpS1F.mjs";import{REMOTE_ELIGIBLE_KEYS as A,injectRemoteFlags as T,isRemoteEnvEnabled as v,materializeRemoteWranglerConfig as B,planRemoteBindings as D,resolveRemoteEnabled as b}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-DioKi8jL.mjs";import{materializeServiceDevConfigs as O}from"../packem_shared/materializeServiceDevConfigs-VcqRp-kv.mjs";import{withTailConsumer as M}from"../packem_shared/withTailConsumer-BZqzeKYh.mjs";import{WORKERS_CACHE_MIN_DATE as y,isCacheEnabled as U}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{DEFAULT_OBSERVABILITY as V,resolveObservabilitySampling as h}from"../packem_shared/DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import{mergeWranglerEnvironment as Y}from"../packem_shared/mergeWranglerEnvironment-KtP_NGVx.mjs";import{WRANGLER_FILES as j,findWranglerFile as w,readWranglerJsonc as z}from"../packem_shared/WRANGLER_FILES-UNW-xY5u.mjs";import{UNEXPORTED_CLASS_MARKER as Q,validateWranglerProject as J}from"../packem_shared/UNEXPORTED_CLASS_MARKER-C8AFIY8C.mjs";import{collectWranglerSecretVariables as k,scanWranglerVariablesForSecrets as q}from"../packem_shared/collectWranglerSecretVariables-D-usPfT8.mjs";import{wranglerToAlchemy as $}from"../packem_shared/wranglerToAlchemy-Bpfy1abZ.mjs";import{REQUIRED_COMPATIBILITY_DATE as re,REQUIRED_FLAG as oe,validateWrangler as ae,validateWranglerConfig as le}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-Cosq9TDj.mjs";export{n as BINDING_MANIFEST_VERSION,E as CLOUDFLARE_DRIVER,V as DEFAULT_OBSERVABILITY,s as GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG,A as REMOTE_ELIGIBLE_KEYS,re as REQUIRED_COMPATIBILITY_DATE,oe as REQUIRED_FLAG,Q as UNEXPORTED_CLASS_MARKER,y as WORKERS_CACHE_MIN_DATE,j as WRANGLER_FILES,o as applyModify,l as assertWranglerSatisfiesSchema,i as buildBindingManifest,c as collectExportGaps,k as collectWranglerSecretVariables,d as describePreservedCrons,w as findWranglerFile,T as injectRemoteFlags,U as isCacheEnabled,v as isRemoteEnvEnabled,B as materializeRemoteWranglerConfig,O as materializeServiceDevConfigs,Y as mergeWranglerEnvironment,D as planRemoteBindings,z as readWranglerJsonc,L as reconcileBindingsSafely,g as reconcileWranglerBindings,x as reconcileWranglerCompatibilityDate,I as reconcileWranglerCrons,S as reconcileWranglerExtras,h as resolveObservabilitySampling,b as resolveRemoteEnabled,q as scanWranglerVariablesForSecrets,ae as validateWrangler,le as validateWranglerConfig,J as validateWranglerProject,M as withTailConsumer,$ as wranglerToAlchemy};
package/dist/index.d.mts CHANGED
@@ -2,8 +2,8 @@ import { AgentIR, ContainerIR, WorkflowIR, CodegenResult } from '@lunora/codegen
2
2
  export type { AgentIR, ContainerIR, WorkflowIR } from '@lunora/codegen';
3
3
  import { ChildProcess } from 'node:child_process';
4
4
  import { Writable } from 'node:stream';
5
- import { T as ToolchainCommand, D as DeployDriver, P as ProjectionPurpose } from "./packem_shared/infer-bindings.d-Duw2Bq4_.mjs";
6
- 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 j as ProjectedConfig, type S as SchemaInfo, type k as SecretRequest, type l as TailRequest, m as discoverSchemaInfo, n as inferLunoraBindings, p as packageNamesFromBindings } from "./packem_shared/infer-bindings.d-Duw2Bq4_.mjs";
5
+ import { T as ToolchainCommand, D as DeployDriver, P as ProjectionPurpose } from "./packem_shared/infer-bindings.d-BH0tk-TR.mjs";
6
+ 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 j as ProjectedConfig, type S as SchemaInfo, type k as SecretRequest, type l as TailRequest, m as discoverSchemaInfo, n as inferLunoraBindings, p as packageNamesFromBindings } from "./packem_shared/infer-bindings.d-BH0tk-TR.mjs";
7
7
  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";
8
8
  interface DiscoverAgentInfoResult {
9
9
  /** Discovered agent definitions; `[]` when none are declared or parsing failed. */
@@ -405,6 +405,13 @@ interface DevServerState {
405
405
  startedAt?: string;
406
406
  /** The embedded studio server's URL, when it runs. */
407
407
  studioUrl?: string;
408
+ /**
409
+ * The public quick-tunnel URL `lunora dev --tunnel` was assigned, once
410
+ * cloudflared reports it — absent without `--tunnel`, before the URL
411
+ * arrives, and after the tunnel closes. Lets a `--background` start and
412
+ * `lunora dev status` show a URL that otherwise only reaches the log.
413
+ */
414
+ tunnelUrl?: string;
408
415
  /** The primary URL serving the worker/app. */
409
416
  url: string;
410
417
  }
@@ -1069,6 +1076,20 @@ type MultiSelectOption<T extends string> = SelectOption<T>;
1069
1076
  declare const promptMultiSelect: <T extends string>(message: string, options: ReadonlyArray<MultiSelectOption<T>>, settings?: {
1070
1077
  defaults?: ReadonlyArray<T>;
1071
1078
  }) => Promise<T[]>;
1079
+ /**
1080
+ * The project's Lunora source directory (the plugin's `schemaDir`), read the way
1081
+ * `@lunora/vite` sees it: the `schemaDir` string literal passed to the `lunora()`
1082
+ * call in `vite.config.*`, else `"lunora"`. The CLI commands that scan the
1083
+ * project (`dev`, `deploy`, `doctor`, `env`, `codegen`) resolve it here, so a
1084
+ * project that moved its functions to `backend/` gets its `ctx.*` reads and
1085
+ * schema facts read from `backend/` instead of from a directory that does not
1086
+ * exist.
1087
+ *
1088
+ * Parsed, never evaluated: a CLI command must not run the project's build
1089
+ * config. A computed `schemaDir`, or a plugin reached any other way, is not seen
1090
+ * and falls back to the default — the same answer as before this was read.
1091
+ */
1092
+ declare const resolveSchemaDirectory: (projectRoot: string) => string;
1072
1093
  /** Core (always-scaffolded) secrets followed by the package-specific ones for the detected capabilities. */
1073
1094
  declare const requiredSecrets: (packageNames: ReadonlyArray<string>) => SecretEntry[];
1074
1095
  /**
@@ -1425,4 +1446,4 @@ declare const badgeWidth: (_spec: BadgeSpec) => number;
1425
1446
  declare const paintBadge: (spec: BadgeSpec) => string;
1426
1447
  /** Dim continuation text (a step's chosen answer, shown under the question). */
1427
1448
  declare const paintAnswer: (text: string) => string;
1428
- 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 CelldDevSession, type CelldDevSessionOptions, type CelldLineOrigin, 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, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, type DeployDriver, type DestructiveEdit, type DetectedFramework, type DevProcess, type DevProcessOptions, type DevProcessSpawner, type DevSecretsFillPlan, type DevServerMode, type DevServerState, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type FillDevSecretsResult, type FindingLogger, 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, LUNORA_TAG, 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, type ProjectionPurpose, ROOT_SKILL_NAME, type RemotePreference, STEP_BADGE_NAMES, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, type StepBadgeName, type ToolchainCommand, type ToolchainInvocation, acceptsConnection, addArgsFor, advisoryLine, applyAdditiveEdit, applyLintIgnores, badgeLead, badgeWidth, blockingFindingsMessage, buildPackageSecretsBlock, claimAgentRulesHint, claimDevServerState, classifyEdit, clearDevServerState, createConfirm, deployTargetIds, detectAgentRules, detectAiAgent, detectFramework, detectInstalledManagers, detectLintTools, detectPackageManager, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, ensureDevWorkerEnv, escapeRegExp, execArgsFor, fillDevSecrets, formatLunoraEvent, generateSecretValue, installArgsFor, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, isRunnableTarget, lunoraLine, padBadge, paintAnswer, paintBadge, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, planToolchainInvocation, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readDevServerState, readLinkedProject, readLiveDevServerState, readProjectDependencyNames, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, reportCodegenFindings, requiredSecrets, resolveDeployDriver, resolveProjectTarget, resolveTargetOrThrow, runPostCodegenHook, runScriptArgsFor, runScriptCommand, runnableTargetIds, secretsForPackages, startCelldDevSession, startDevProcess, streamContainerLogs, targetRunsOwnDevServer, toolchainExecArgs, updateDevServerState, upsertDevVariableLine, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
1449
+ 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 CelldDevSession, type CelldDevSessionOptions, type CelldLineOrigin, 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, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, type DeployDriver, type DestructiveEdit, type DetectedFramework, type DevProcess, type DevProcessOptions, type DevProcessSpawner, type DevSecretsFillPlan, type DevServerMode, type DevServerState, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type FillDevSecretsResult, type FindingLogger, 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, LUNORA_TAG, 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, type ProjectionPurpose, ROOT_SKILL_NAME, type RemotePreference, STEP_BADGE_NAMES, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, type StepBadgeName, type ToolchainCommand, type ToolchainInvocation, acceptsConnection, addArgsFor, advisoryLine, applyAdditiveEdit, applyLintIgnores, badgeLead, badgeWidth, blockingFindingsMessage, buildPackageSecretsBlock, claimAgentRulesHint, claimDevServerState, classifyEdit, clearDevServerState, createConfirm, deployTargetIds, detectAgentRules, detectAiAgent, detectFramework, detectInstalledManagers, detectLintTools, detectPackageManager, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, ensureDevWorkerEnv, escapeRegExp, execArgsFor, fillDevSecrets, formatLunoraEvent, generateSecretValue, installArgsFor, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, isRunnableTarget, lunoraLine, padBadge, paintAnswer, paintBadge, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, planToolchainInvocation, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readDevServerState, readLinkedProject, readLiveDevServerState, readProjectDependencyNames, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, reportCodegenFindings, requiredSecrets, resolveDeployDriver, resolveProjectTarget, resolveSchemaDirectory, resolveTargetOrThrow, runPostCodegenHook, runScriptArgsFor, runScriptCommand, runnableTargetIds, secretsForPackages, startCelldDevSession, startDevProcess, streamContainerLogs, targetRunsOwnDevServer, toolchainExecArgs, updateDevServerState, upsertDevVariableLine, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import { AgentIR, ContainerIR, WorkflowIR, CodegenResult } from '@lunora/codegen
2
2
  export type { AgentIR, ContainerIR, WorkflowIR } from '@lunora/codegen';
3
3
  import { ChildProcess } from 'node:child_process';
4
4
  import { Writable } from 'node:stream';
5
- import { T as ToolchainCommand, D as DeployDriver, P as ProjectionPurpose } from "./packem_shared/infer-bindings.d-Duw2Bq4_.js";
6
- 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 j as ProjectedConfig, type S as SchemaInfo, type k as SecretRequest, type l as TailRequest, m as discoverSchemaInfo, n as inferLunoraBindings, p as packageNamesFromBindings } from "./packem_shared/infer-bindings.d-Duw2Bq4_.js";
5
+ import { T as ToolchainCommand, D as DeployDriver, P as ProjectionPurpose } from "./packem_shared/infer-bindings.d-BH0tk-TR.js";
6
+ 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 j as ProjectedConfig, type S as SchemaInfo, type k as SecretRequest, type l as TailRequest, m as discoverSchemaInfo, n as inferLunoraBindings, p as packageNamesFromBindings } from "./packem_shared/infer-bindings.d-BH0tk-TR.js";
7
7
  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";
8
8
  interface DiscoverAgentInfoResult {
9
9
  /** Discovered agent definitions; `[]` when none are declared or parsing failed. */
@@ -405,6 +405,13 @@ interface DevServerState {
405
405
  startedAt?: string;
406
406
  /** The embedded studio server's URL, when it runs. */
407
407
  studioUrl?: string;
408
+ /**
409
+ * The public quick-tunnel URL `lunora dev --tunnel` was assigned, once
410
+ * cloudflared reports it — absent without `--tunnel`, before the URL
411
+ * arrives, and after the tunnel closes. Lets a `--background` start and
412
+ * `lunora dev status` show a URL that otherwise only reaches the log.
413
+ */
414
+ tunnelUrl?: string;
408
415
  /** The primary URL serving the worker/app. */
409
416
  url: string;
410
417
  }
@@ -1069,6 +1076,20 @@ type MultiSelectOption<T extends string> = SelectOption<T>;
1069
1076
  declare const promptMultiSelect: <T extends string>(message: string, options: ReadonlyArray<MultiSelectOption<T>>, settings?: {
1070
1077
  defaults?: ReadonlyArray<T>;
1071
1078
  }) => Promise<T[]>;
1079
+ /**
1080
+ * The project's Lunora source directory (the plugin's `schemaDir`), read the way
1081
+ * `@lunora/vite` sees it: the `schemaDir` string literal passed to the `lunora()`
1082
+ * call in `vite.config.*`, else `"lunora"`. The CLI commands that scan the
1083
+ * project (`dev`, `deploy`, `doctor`, `env`, `codegen`) resolve it here, so a
1084
+ * project that moved its functions to `backend/` gets its `ctx.*` reads and
1085
+ * schema facts read from `backend/` instead of from a directory that does not
1086
+ * exist.
1087
+ *
1088
+ * Parsed, never evaluated: a CLI command must not run the project's build
1089
+ * config. A computed `schemaDir`, or a plugin reached any other way, is not seen
1090
+ * and falls back to the default — the same answer as before this was read.
1091
+ */
1092
+ declare const resolveSchemaDirectory: (projectRoot: string) => string;
1072
1093
  /** Core (always-scaffolded) secrets followed by the package-specific ones for the detected capabilities. */
1073
1094
  declare const requiredSecrets: (packageNames: ReadonlyArray<string>) => SecretEntry[];
1074
1095
  /**
@@ -1425,4 +1446,4 @@ declare const badgeWidth: (_spec: BadgeSpec) => number;
1425
1446
  declare const paintBadge: (spec: BadgeSpec) => string;
1426
1447
  /** Dim continuation text (a step's chosen answer, shown under the question). */
1427
1448
  declare const paintAnswer: (text: string) => string;
1428
- 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 CelldDevSession, type CelldDevSessionOptions, type CelldLineOrigin, 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, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, type DeployDriver, type DestructiveEdit, type DetectedFramework, type DevProcess, type DevProcessOptions, type DevProcessSpawner, type DevSecretsFillPlan, type DevServerMode, type DevServerState, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type FillDevSecretsResult, type FindingLogger, 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, LUNORA_TAG, 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, type ProjectionPurpose, ROOT_SKILL_NAME, type RemotePreference, STEP_BADGE_NAMES, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, type StepBadgeName, type ToolchainCommand, type ToolchainInvocation, acceptsConnection, addArgsFor, advisoryLine, applyAdditiveEdit, applyLintIgnores, badgeLead, badgeWidth, blockingFindingsMessage, buildPackageSecretsBlock, claimAgentRulesHint, claimDevServerState, classifyEdit, clearDevServerState, createConfirm, deployTargetIds, detectAgentRules, detectAiAgent, detectFramework, detectInstalledManagers, detectLintTools, detectPackageManager, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, ensureDevWorkerEnv, escapeRegExp, execArgsFor, fillDevSecrets, formatLunoraEvent, generateSecretValue, installArgsFor, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, isRunnableTarget, lunoraLine, padBadge, paintAnswer, paintBadge, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, planToolchainInvocation, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readDevServerState, readLinkedProject, readLiveDevServerState, readProjectDependencyNames, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, reportCodegenFindings, requiredSecrets, resolveDeployDriver, resolveProjectTarget, resolveTargetOrThrow, runPostCodegenHook, runScriptArgsFor, runScriptCommand, runnableTargetIds, secretsForPackages, startCelldDevSession, startDevProcess, streamContainerLogs, targetRunsOwnDevServer, toolchainExecArgs, updateDevServerState, upsertDevVariableLine, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
1449
+ 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 CelldDevSession, type CelldDevSessionOptions, type CelldLineOrigin, 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, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, type DeployDriver, type DestructiveEdit, type DetectedFramework, type DevProcess, type DevProcessOptions, type DevProcessSpawner, type DevSecretsFillPlan, type DevServerMode, type DevServerState, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type FillDevSecretsResult, type FindingLogger, 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, LUNORA_TAG, 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, type ProjectionPurpose, ROOT_SKILL_NAME, type RemotePreference, STEP_BADGE_NAMES, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, type StepBadgeName, type ToolchainCommand, type ToolchainInvocation, acceptsConnection, addArgsFor, advisoryLine, applyAdditiveEdit, applyLintIgnores, badgeLead, badgeWidth, blockingFindingsMessage, buildPackageSecretsBlock, claimAgentRulesHint, claimDevServerState, classifyEdit, clearDevServerState, createConfirm, deployTargetIds, detectAgentRules, detectAiAgent, detectFramework, detectInstalledManagers, detectLintTools, detectPackageManager, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, ensureDevWorkerEnv, escapeRegExp, execArgsFor, fillDevSecrets, formatLunoraEvent, generateSecretValue, installArgsFor, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, isRunnableTarget, lunoraLine, padBadge, paintAnswer, paintBadge, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, planToolchainInvocation, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readDevServerState, readLinkedProject, readLiveDevServerState, readProjectDependencyNames, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, reportCodegenFindings, requiredSecrets, resolveDeployDriver, resolveProjectTarget, resolveSchemaDirectory, resolveTargetOrThrow, runPostCodegenHook, runScriptArgsFor, runScriptCommand, runnableTargetIds, secretsForPackages, startCelldDevSession, startDevProcess, streamContainerLogs, targetRunsOwnDevServer, toolchainExecArgs, 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 s}from"./packem_shared/discoverAgentInfo-CTdCSfYM.mjs";import{AGENT_RULES_DIR as i,AGENT_RULES_HINT as n,AGENT_RULES_HINT_ENV as l,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{startCelldDevSession as m}from"./packem_shared/startCelldDevSession-BLFsd6jG.mjs";import{CODEGEN_ENV as S,isCodegenDisabled as f}from"./packem_shared/CODEGEN_ENV-ZsCxV1kP.mjs";import{discoverContainerInfo as L}from"./packem_shared/discoverContainerInfo-EhZtEBQs.mjs";import{streamContainerLogs as R}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as T,projectUsesUmbrella as x,readProjectDependencyNames as V}from"./packem_shared/detectFramework-CUiVEHDQ.mjs";import{acceptsConnection as P,startDevProcess as u}from"./packem_shared/acceptsConnection-DHhUYGjT.mjs";import{DEV_BINDINGS_FILE as F,DEV_DAEMON_ENV as C,DEV_HANDOFF_ENV as U,DEV_LOG_FILE as G,DEV_LOG_FILE_ENV as b,DEV_STATE_DIR as M,DEV_STATE_FILE as y,claimDevServerState as k,clearDevServerState as B,isDevServerReady as K,isProcessAlive as w,isRecordedProcessCurrent as h,readDevServerState as j,readLiveDevServerState as H,updateDevServerState as W,writeDevServerState as Y}from"./packem_shared/DEV_BINDINGS_FILE-pyOiNLP4.mjs";import{DEV_VARS_EXAMPLE_FILE as q,DEV_VARS_FILE as X,DEV_VARS_KEY_PATTERN as z,escapeRegExp as Q,parseDevVariableEntries as Z,removeDevVariableLine as $,upsertDevVariableLine as ee}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEV_WORKER_ENV_VALUE as oe,DEV_WORKER_ENV_VAR as te,ensureDevWorkerEnv as ae}from"./packem_shared/DEV_WORKER_ENV_VALUE-DwGANZVw.mjs";import{DEFAULT_DEPLOY_TARGET as Ee,deployTargetIds as ie,isRunnableTarget as ne,planToolchainInvocation as le,resolveDeployDriver as pe,runnableTargetIds as _e,targetRunsOwnDevServer as ce}from"./packem_shared/DEFAULT_DEPLOY_TARGET-CfoV0tDu.mjs";import{i as De,p as me}from"./packem_shared/infer-bindings-D5S20KYQ.mjs";import{LINKED_PROJECT_DIR as Se,LINKED_PROJECT_FILE as fe,readLinkedProject as ve,writeLinkedProject as Le}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as Re,applyLintIgnores as ge,detectLintTools as Te}from"./packem_shared/LUNORA_IGNORED_PATHS-B0-PPvRp.mjs";import{LUNORA_TAG as Ve,advisoryLine as Ie,blockingFindingsMessage as Pe,lunoraLine as ue,reportCodegenFindings as Oe}from"./packem_shared/LUNORA_TAG-CiQM3BkI.mjs";import{LUNORA_EVENT_SOURCE as Ce,formatLunoraEvent as Ue}from"./packem_shared/LUNORA_EVENT_SOURCE-DYdcDU9G.mjs";import{default as be}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as ye,detectInstalledManagers as ke,detectPackageManager as Be,execArgsFor as Ke,installArgsFor as we,runScriptArgsFor as he,runScriptCommand as je,toolchainExecArgs as He}from"./packem_shared/addArgsFor-CYZKhNIo.mjs";import{P as Ye,s as Je}from"./packem_shared/package-secrets-registry-DvtTiK4b.mjs";import{runPostCodegenHook as Xe}from"./packem_shared/runPostCodegenHook-B0T1q2YI.mjs";import{interpretRemote as Qe,readProjectRemotePreference as Ze,readProjectTarget as $e,resolveProjectTarget as er,resolveTargetOrThrow as rr}from"./packem_shared/interpretRemote-C9yJC_ZK.mjs";import{createConfirm as tr,isInteractive as ar,promptMultiSelect as sr,promptSelect as Er,promptText as ir,promptYesNo as nr}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{buildPackageSecretsBlock as pr,ensureDevVariables as _r,ensureDevVarsExample as cr,fillDevSecrets as dr,generateSecretValue as Dr,isMintableSecretKey as mr,isPlaceholderValue as Ar,planDevSecretsFill as Sr,planDevVariablesAugment as fr,planDevVariablesScaffold as vr,requiredSecrets as Lr,writeDevVariablesFileAtomically as Nr}from"./packem_shared/buildPackageSecretsBlock-yv9mjKEW.mjs";import{applyAdditiveEdit as gr,classifyEdit as Tr}from"./packem_shared/applyAdditiveEdit-CH0VhMJ2.mjs";import{parseSchema as Vr}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as Pr,resolveServerModule as ur,scaffoldPolicyFile as Or,wireRlsIntoProcedure as Fr}from"./packem_shared/classifyPolicyEdit-D8NwrHxR.mjs";import{discoverSchemaInfo as Ur}from"./packem_shared/discoverSchemaInfo-BguahM6z.mjs";import{ACCENT as br,BADGES as Mr,BADGE_COLUMN_WIDTH as yr,LUNA_ART as kr,LUNA_BUNNY as Br,LUNA_NAME as Kr,LUNA_SIGNOFF as wr,STEP_BADGE_NAMES as hr,badgeLead as jr,badgeWidth as Hr,padBadge as Wr,paintAnswer as Yr,paintBadge as Jr}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{COMPOSED_WORKER_ENTRY as Xr,GENERATED_CLASS_MODULES as zr}from"./packem_shared/COMPOSED_WORKER_ENTRY-C69wqbSP.mjs";import{discoverWorkflowInfo as Zr}from"./packem_shared/discoverWorkflowInfo-BsPvlo6O.mjs";export{br as ACCENT,o as AGENT_MODE_ENV,i as AGENT_RULES_DIR,n as AGENT_RULES_HINT,l as AGENT_RULES_HINT_ENV,Mr as BADGES,yr as BADGE_COLUMN_WIDTH,S as CODEGEN_ENV,Xr as COMPOSED_WORKER_ENTRY,Ee as DEFAULT_DEPLOY_TARGET,F as DEV_BINDINGS_FILE,C as DEV_DAEMON_ENV,U as DEV_HANDOFF_ENV,G as DEV_LOG_FILE,b as DEV_LOG_FILE_ENV,M as DEV_STATE_DIR,y as DEV_STATE_FILE,q as DEV_VARS_EXAMPLE_FILE,X as DEV_VARS_FILE,z as DEV_VARS_KEY_PATTERN,oe as DEV_WORKER_ENV_VALUE,te as DEV_WORKER_ENV_VAR,zr as GENERATED_CLASS_MODULES,Se as LINKED_PROJECT_DIR,fe as LINKED_PROJECT_FILE,kr as LUNA_ART,Br as LUNA_BUNNY,Kr as LUNA_NAME,wr as LUNA_SIGNOFF,Ce as LUNORA_EVENT_SOURCE,Re as LUNORA_IGNORED_PATHS,p as LUNORA_SKILL_NAMES,Ve as LUNORA_TAG,be as LunoraReporter,Ye as PACKAGE_SECRETS_REGISTRY,_ as ROOT_SKILL_NAME,hr as STEP_BADGE_NAMES,P as acceptsConnection,ye as addArgsFor,Ie as advisoryLine,gr as applyAdditiveEdit,ge as applyLintIgnores,jr as badgeLead,Hr as badgeWidth,Pe as blockingFindingsMessage,pr as buildPackageSecretsBlock,c as claimAgentRulesHint,k as claimDevServerState,Tr as classifyEdit,Pr as classifyPolicyEdit,B as clearDevServerState,tr as createConfirm,ie as deployTargetIds,d as detectAgentRules,t as detectAiAgent,T as detectFramework,ke as detectInstalledManagers,Te as detectLintTools,Be as detectPackageManager,s as discoverAgentInfo,L as discoverContainerInfo,Ur as discoverSchemaInfo,Zr as discoverWorkflowInfo,_r as ensureDevVariables,cr as ensureDevVarsExample,ae as ensureDevWorkerEnv,Q as escapeRegExp,Ke as execArgsFor,dr as fillDevSecrets,Ue as formatLunoraEvent,Dr as generateSecretValue,De as inferLunoraBindings,we as installArgsFor,Qe as interpretRemote,f as isCodegenDisabled,K as isDevServerReady,ar as isInteractive,mr as isMintableSecretKey,Ar as isPlaceholderValue,w as isProcessAlive,h as isRecordedProcessCurrent,ne as isRunnableTarget,ue as lunoraLine,me as packageNamesFromBindings,Wr as padBadge,Yr as paintAnswer,Jr as paintBadge,Z as parseDevVariableEntries,Vr as parseSchema,Sr as planDevSecretsFill,fr as planDevVariablesAugment,vr as planDevVariablesScaffold,le as planToolchainInvocation,x as projectUsesUmbrella,sr as promptMultiSelect,Er as promptSelect,ir as promptText,nr as promptYesNo,j as readDevServerState,ve as readLinkedProject,H as readLiveDevServerState,V as readProjectDependencyNames,Ze as readProjectRemotePreference,$e as readProjectTarget,$ as removeDevVariableLine,Oe as reportCodegenFindings,Lr as requiredSecrets,pe as resolveDeployDriver,er as resolveProjectTarget,ur as resolveServerModule,rr as resolveTargetOrThrow,Xe as runPostCodegenHook,he as runScriptArgsFor,je as runScriptCommand,_e as runnableTargetIds,Or as scaffoldPolicyFile,Je as secretsForPackages,m as startCelldDevSession,u as startDevProcess,R as streamContainerLogs,ce as targetRunsOwnDevServer,He as toolchainExecArgs,W as updateDevServerState,ee as upsertDevVariableLine,Fr as wireRlsIntoProcedure,Y as writeDevServerState,Nr as writeDevVariablesFileAtomically,Le as writeLinkedProject};
1
+ import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as s}from"./packem_shared/discoverAgentInfo-CTdCSfYM.mjs";import{AGENT_RULES_DIR as E,AGENT_RULES_HINT as n,AGENT_RULES_HINT_ENV as l,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{startCelldDevSession as D}from"./packem_shared/startCelldDevSession-BLFsd6jG.mjs";import{CODEGEN_ENV as S,isCodegenDisabled as f}from"./packem_shared/CODEGEN_ENV-ZsCxV1kP.mjs";import{discoverContainerInfo as L}from"./packem_shared/discoverContainerInfo-EhZtEBQs.mjs";import{streamContainerLogs as R}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as T,projectUsesUmbrella as x,readProjectDependencyNames as V}from"./packem_shared/detectFramework-CUiVEHDQ.mjs";import{acceptsConnection as u,startDevProcess as P}from"./packem_shared/acceptsConnection-DHhUYGjT.mjs";import{DEV_BINDINGS_FILE as F,DEV_DAEMON_ENV as C,DEV_HANDOFF_ENV as U,DEV_LOG_FILE as G,DEV_LOG_FILE_ENV as b,DEV_STATE_DIR as M,DEV_STATE_FILE as y,claimDevServerState as k,clearDevServerState as B,isDevServerReady as K,isProcessAlive as w,isRecordedProcessCurrent as h,readDevServerState as j,readLiveDevServerState as H,updateDevServerState as W,writeDevServerState as Y}from"./packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs";import{DEV_VARS_EXAMPLE_FILE as q,DEV_VARS_FILE as X,DEV_VARS_KEY_PATTERN as z,escapeRegExp as Q,parseDevVariableEntries as Z,removeDevVariableLine as $,upsertDevVariableLine as ee}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEV_WORKER_ENV_VALUE as oe,DEV_WORKER_ENV_VAR as te,ensureDevWorkerEnv as ae}from"./packem_shared/DEV_WORKER_ENV_VALUE-DwGANZVw.mjs";import{DEFAULT_DEPLOY_TARGET as ie,deployTargetIds as Ee,isRunnableTarget as ne,planToolchainInvocation as le,resolveDeployDriver as pe,runnableTargetIds as _e,targetRunsOwnDevServer as ce}from"./packem_shared/DEFAULT_DEPLOY_TARGET-CfoV0tDu.mjs";import{i as me,p as De}from"./packem_shared/infer-bindings-B-BFynp2.mjs";import{LINKED_PROJECT_DIR as Se,LINKED_PROJECT_FILE as fe,readLinkedProject as ve,writeLinkedProject as Le}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as Re,applyLintIgnores as ge,detectLintTools as Te}from"./packem_shared/LUNORA_IGNORED_PATHS-B0-PPvRp.mjs";import{LUNORA_TAG as Ve,advisoryLine as Ie,blockingFindingsMessage as ue,lunoraLine as Pe,reportCodegenFindings as Oe}from"./packem_shared/LUNORA_TAG-CiQM3BkI.mjs";import{LUNORA_EVENT_SOURCE as Ce,formatLunoraEvent as Ue}from"./packem_shared/LUNORA_EVENT_SOURCE-DYdcDU9G.mjs";import{default as be}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as ye,detectInstalledManagers as ke,detectPackageManager as Be,execArgsFor as Ke,installArgsFor as we,runScriptArgsFor as he,runScriptCommand as je,toolchainExecArgs as He}from"./packem_shared/addArgsFor-CYZKhNIo.mjs";import{P as Ye,s as Je}from"./packem_shared/package-secrets-registry-DvtTiK4b.mjs";import{runPostCodegenHook as Xe}from"./packem_shared/runPostCodegenHook-B0T1q2YI.mjs";import{interpretRemote as Qe,readProjectRemotePreference as Ze,readProjectTarget as $e,resolveProjectTarget as er,resolveTargetOrThrow as rr}from"./packem_shared/interpretRemote-C9yJC_ZK.mjs";import{createConfirm as tr,isInteractive as ar,promptMultiSelect as sr,promptSelect as ir,promptText as Er,promptYesNo as nr}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{default as pr}from"./packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs";import{buildPackageSecretsBlock as cr,ensureDevVariables as dr,ensureDevVarsExample as mr,fillDevSecrets as Dr,generateSecretValue as Ar,isMintableSecretKey as Sr,isPlaceholderValue as fr,planDevSecretsFill as vr,planDevVariablesAugment as Lr,planDevVariablesScaffold as Nr,requiredSecrets as Rr,writeDevVariablesFileAtomically as gr}from"./packem_shared/buildPackageSecretsBlock-yv9mjKEW.mjs";import{applyAdditiveEdit as xr,classifyEdit as Vr}from"./packem_shared/applyAdditiveEdit-CH0VhMJ2.mjs";import{parseSchema as ur}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as Or,resolveServerModule as Fr,scaffoldPolicyFile as Cr,wireRlsIntoProcedure as Ur}from"./packem_shared/classifyPolicyEdit-D8NwrHxR.mjs";import{discoverSchemaInfo as br}from"./packem_shared/discoverSchemaInfo-BguahM6z.mjs";import{ACCENT as yr,BADGES as kr,BADGE_COLUMN_WIDTH as Br,LUNA_ART as Kr,LUNA_BUNNY as wr,LUNA_NAME as hr,LUNA_SIGNOFF as jr,STEP_BADGE_NAMES as Hr,badgeLead as Wr,badgeWidth as Yr,padBadge as Jr,paintAnswer as qr,paintBadge as Xr}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{COMPOSED_WORKER_ENTRY as Qr,GENERATED_CLASS_MODULES as Zr}from"./packem_shared/COMPOSED_WORKER_ENTRY-C69wqbSP.mjs";import{discoverWorkflowInfo as eo}from"./packem_shared/discoverWorkflowInfo-BsPvlo6O.mjs";export{yr as ACCENT,o as AGENT_MODE_ENV,E as AGENT_RULES_DIR,n as AGENT_RULES_HINT,l as AGENT_RULES_HINT_ENV,kr as BADGES,Br as BADGE_COLUMN_WIDTH,S as CODEGEN_ENV,Qr as COMPOSED_WORKER_ENTRY,ie as DEFAULT_DEPLOY_TARGET,F as DEV_BINDINGS_FILE,C as DEV_DAEMON_ENV,U as DEV_HANDOFF_ENV,G as DEV_LOG_FILE,b as DEV_LOG_FILE_ENV,M as DEV_STATE_DIR,y as DEV_STATE_FILE,q as DEV_VARS_EXAMPLE_FILE,X as DEV_VARS_FILE,z as DEV_VARS_KEY_PATTERN,oe as DEV_WORKER_ENV_VALUE,te as DEV_WORKER_ENV_VAR,Zr as GENERATED_CLASS_MODULES,Se as LINKED_PROJECT_DIR,fe as LINKED_PROJECT_FILE,Kr as LUNA_ART,wr as LUNA_BUNNY,hr as LUNA_NAME,jr as LUNA_SIGNOFF,Ce as LUNORA_EVENT_SOURCE,Re as LUNORA_IGNORED_PATHS,p as LUNORA_SKILL_NAMES,Ve as LUNORA_TAG,be as LunoraReporter,Ye as PACKAGE_SECRETS_REGISTRY,_ as ROOT_SKILL_NAME,Hr as STEP_BADGE_NAMES,u as acceptsConnection,ye as addArgsFor,Ie as advisoryLine,xr as applyAdditiveEdit,ge as applyLintIgnores,Wr as badgeLead,Yr as badgeWidth,ue as blockingFindingsMessage,cr as buildPackageSecretsBlock,c as claimAgentRulesHint,k as claimDevServerState,Vr as classifyEdit,Or as classifyPolicyEdit,B as clearDevServerState,tr as createConfirm,Ee as deployTargetIds,d as detectAgentRules,t as detectAiAgent,T as detectFramework,ke as detectInstalledManagers,Te as detectLintTools,Be as detectPackageManager,s as discoverAgentInfo,L as discoverContainerInfo,br as discoverSchemaInfo,eo as discoverWorkflowInfo,dr as ensureDevVariables,mr as ensureDevVarsExample,ae as ensureDevWorkerEnv,Q as escapeRegExp,Ke as execArgsFor,Dr as fillDevSecrets,Ue as formatLunoraEvent,Ar as generateSecretValue,me as inferLunoraBindings,we as installArgsFor,Qe as interpretRemote,f as isCodegenDisabled,K as isDevServerReady,ar as isInteractive,Sr as isMintableSecretKey,fr as isPlaceholderValue,w as isProcessAlive,h as isRecordedProcessCurrent,ne as isRunnableTarget,Pe as lunoraLine,De as packageNamesFromBindings,Jr as padBadge,qr as paintAnswer,Xr as paintBadge,Z as parseDevVariableEntries,ur as parseSchema,vr as planDevSecretsFill,Lr as planDevVariablesAugment,Nr as planDevVariablesScaffold,le as planToolchainInvocation,x as projectUsesUmbrella,sr as promptMultiSelect,ir as promptSelect,Er as promptText,nr as promptYesNo,j as readDevServerState,ve as readLinkedProject,H as readLiveDevServerState,V as readProjectDependencyNames,Ze as readProjectRemotePreference,$e as readProjectTarget,$ as removeDevVariableLine,Oe as reportCodegenFindings,Rr as requiredSecrets,pe as resolveDeployDriver,er as resolveProjectTarget,pr as resolveSchemaDirectory,Fr as resolveServerModule,rr as resolveTargetOrThrow,Xe as runPostCodegenHook,he as runScriptArgsFor,je as runScriptCommand,_e as runnableTargetIds,Cr as scaffoldPolicyFile,Je as secretsForPackages,D as startCelldDevSession,P as startDevProcess,R as streamContainerLogs,ce as targetRunsOwnDevServer,He as toolchainExecArgs,W as updateDevServerState,ee as upsertDevVariableLine,Ur as wireRlsIntoProcedure,Y as writeDevServerState,gr as writeDevVariablesFileAtomically,Le as writeLinkedProject};
@@ -0,0 +1 @@
1
+ const a=Object.freeze({enabled:!0,head_sampling_rate:1}),t=1,n=l=>{const e=l??a;return{logs:{enabled:e.logs?.enabled??e.enabled??a.enabled,headSamplingRate:e.logs?.head_sampling_rate??e.head_sampling_rate??t},traces:{enabled:e.traces?.enabled===!0,headSamplingRate:e.traces?.head_sampling_rate??t}}};export{a as DEFAULT_OBSERVABILITY,n as resolveObservabilitySampling};
@@ -0,0 +1,4 @@
1
+ import{mkdirSync as _,writeFileSync as E,rmSync as N,existsSync as D,readFileSync as a}from"node:fs";import{join as n}from"node:path";const u=".lunora",v=n(u,"dev.json"),h=n(u,"dev.log"),k=n(u,"dev-bindings.json"),T="LUNORA_DEV_DAEMON",U="LUNORA_DEV_LOG_FILE",x="LUNORA_DEV_HANDOFF_PID",m=r=>r!==null&&typeof r=="object",o=(r,e)=>{const t=r[e];return typeof t=="string"&&t.length>0?t:void 0},p=r=>{if(!Number.isInteger(r)||r<=0)return!1;try{return process.kill(r,0),!0}catch{return!1}},y=1e4,g=100,A=r=>{if(process.platform==="linux")try{const e=a(`/proc/${String(r)}/stat`,"utf8"),t=e.slice(e.lastIndexOf(")")+2).split(" "),i=Number(t[19]),s=a("/proc/stat","utf8").split(`
2
+ `).find(l=>l.startsWith("btime ")),d=Number(s?.slice(6));return!Number.isFinite(i)||!Number.isFinite(d)?void 0:d*1e3+i/g*1e3}catch{return}},b=r=>{if(!p(r.pid))return!1;const e=r.startedAt===void 0?Number.NaN:Date.parse(r.startedAt);if(Number.isNaN(e))return!0;const t=A(r.pid);return t===void 0||t<=e+y},f=r=>{const e=n(r,v);if(!D(e))return;let t;try{t=JSON.parse(a(e,"utf8"))}catch{return}if(!m(t)||typeof t.pid!="number")return;const i=o(t,"url");if(i!==void 0)return{background:t.background===!0,logFile:o(t,"logFile"),mode:t.mode==="vite"?"vite":"cli",pid:t.pid,readyAt:o(t,"readyAt"),startedAt:o(t,"startedAt"),studioUrl:o(t,"studioUrl"),tunnelUrl:o(t,"tunnelUrl"),url:i}},c=(r,e)=>{try{_(n(r,u),{recursive:!0});const t=n(r,v);return E(t,`${JSON.stringify(e,void 0,2)}
3
+ `,"utf8"),t}catch{return}},C=(r,e,t)=>{const i=f(r);if(i===void 0||t?.expectedPid!==void 0&&i.pid!==t.expectedPid)return;const s={...i,...e};return c(r,s),s},M=r=>r?.readyAt!==void 0,O=(r,e)=>{try{if(e!==void 0){const t=f(r);if(t!==void 0&&t.pid!==e)return}N(n(r,v),{force:!0})}catch{}},F=r=>{const e=f(r);if(e!==void 0){if(b(e))return e;O(r,e.pid)}},I=(r,e,t)=>{const i=F(r);if(i!==void 0)return t!==void 0&&i.pid===t?{ok:c(r,e)!==void 0}:i.pid!==e.pid?{existing:i,ok:!1}:{ok:c(r,{...e,tunnelUrl:e.tunnelUrl??i.tunnelUrl})!==void 0}},P=(r,e,t)=>{const i=n(r,v),s=`${JSON.stringify(e,void 0,2)}
4
+ `;for(let d=0;d<2;d+=1)try{return _(n(r,u),{recursive:!0}),E(i,s,{encoding:"utf8",flag:"wx"}),{ok:!0}}catch(l){if(l.code!=="EEXIST")return{ok:c(r,e)!==void 0};const S=I(r,e,t?.supersedePid);if(S!==void 0)return S}return{ok:c(r,e)!==void 0}};export{k as DEV_BINDINGS_FILE,T as DEV_DAEMON_ENV,x as DEV_HANDOFF_ENV,h as DEV_LOG_FILE,U as DEV_LOG_FILE_ENV,u as DEV_STATE_DIR,v as DEV_STATE_FILE,P as claimDevServerState,O as clearDevServerState,M as isDevServerReady,p as isProcessAlive,b as isRecordedProcessCurrent,f as readDevServerState,F as readLiveDevServerState,C as updateDevServerState,c as writeDevServerState};
@@ -1 +1 @@
1
- import{o as m,v as h,a as E,b as p,c as D,d as y,e as l,f as I,g as O,H as R,h as S,R as $,S as j,i as A,j as k,W as L,k as w}from"./validate-bindings-Djec3UWf.mjs";import{validateTailConsumers as B,validateSendEmail as T,validateSecretsRequired as N,validateLogpush as C,validateLimits as U,validatePlacement as P,validateObservability as G,validateAssets as K,validateCache as V,validateExports as W,validateCorsVariables as x,validateSchedulerOrigin as F}from"./withTailConsumer-Dz7FDSBy.mjs";import{isCacheEnabled as H,WORKERS_CACHE_MIN_DATE as _}from"./WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{mergeWranglerEnvironment as M}from"./mergeWranglerEnvironment-KtP_NGVx.mjs";const Y=i=>typeof i=="object"&&i!==null&&!Array.isArray(i),f=i=>Array.isArray(i)?i.flatMap((a,n)=>Y(a)?[[n,a]]:[]):[],g=i=>typeof i.binding=="string"?i.binding:"",q=(i,a,n)=>{for(const[e,s]of f(i.kv_namespaces))typeof s.id=="string"&&s.id!==""||n.push(`kv_namespaces[${String(e)}] ("${g(s)}") is not created yet and the schema pins data to "${a}" — create it with \`wrangler kv namespace create <name> --jurisdiction=${a}\`; a namespace's jurisdiction cannot be changed afterwards`)},Q=(i,a,n)=>{for(const[e,s]of f(i.r2_buckets)){const r=s.jurisdiction;if(r===a)continue;const t=typeof r=="string"?`names the "${r}" jurisdiction`:"names no jurisdiction";n.push(`r2_buckets[${String(e)}] ("${g(s)}") ${t}, but the schema pins data to "${a}" — create the bucket with \`wrangler r2 bucket create <name> --jurisdiction=${a}\` and set "jurisdiction": "${a}" on the binding`)}},J=(i,a,n)=>{const e=a?.jurisdiction;e!==void 0&&(q(i,e,n),Q(i,e,n))},b="2026-04-07",de="web_socket_auto_reply_to_close",u="2026-10-01",v="durable_object_io_tasks_prevent_eviction",z="durable_object_io_tasks_do_not_prevent_eviction",X=/^\d{4}-\d{2}-\d{2}$/,Z=(i,a,n)=>{i>=u||a.includes(v)||a.includes(z)||n.push(`compatibility_date "${i}" predates "${u}", so pending I/O (waitUntil, cross-Durable-Object RPC, service-binding calls, timers) does not keep a Durable Object alive once its last client disconnects — live-query refreshes and durable streams can be cut off mid-flight. Set compatibility_date >= "${u}" or add the "${v}" compatibility flag`)},ee=(i,a,n)=>{const{error:e,merged:s,unverifiedKeys:r}=M(i,a);return e!==void 0?{error:e,wrangler:s}:(r.length>0&&n.push(`env.${String(a)} overrides ${r.join(", ")}, which this validator doesn't have a verified inheritance rule for — validated against the TOP-LEVEL value only. Double-check ${r.length===1?"it":"them"} by hand for "${String(a)}".`),{wrangler:s})},te=(i,a,n)=>{const e=[],s=[];if(!i||typeof i!="object")return e.push("wrangler config is not a valid object"),{errors:e,valid:!1,warnings:s};const{error:r,wrangler:t}=ee(i,n,s);if(r!==void 0)return e.push(r),{errors:e,valid:!1,warnings:s};m(t.durable_objects?.bindings).find(o=>o.name==="SHARD"&&o.class_name==="ShardDO")||e.push('durable_objects.bindings must include { "name": "SHARD", "class_name": "ShardDO" } — your dev server auto-reconciles this on startup, or add the binding manually'),h(t,e);const d=t.compatibility_date??"",c=X.test(d);d&&!c?e.push(`compatibility_date must be in YYYY-MM-DD format (got "${d}")`):d<b&&e.push(`compatibility_date must be >= "${b}" (got "${d||"<missing>"}")`),H(t)&&c&&d<_&&e.push(`cache.enabled requires compatibility_date >= "${_}" (got "${d||"<missing>"}")`),c&&Z(d,t.compatibility_flags??[],s),E(t,a,e),J(t,a,s),p(t,e),D(t,a?.vectorIndexNames??[],e),B(t,e),y(t,e,s),l(t.workflows,"workflows",L,e),I(t,e),O(t,e),l(t.secrets_store_secrets,"secrets_store_secrets",w,e);for(const o of R)S(t,o,e,s);for(const o of $)l(t[o.key],o.key,o,e);for(const o of j)A(t,o,e);return k(t,e),T(t,e,s),N(t,e),C(t,e),U(t,e),P(t,e),G(t,e,s),K(t,e),V(t,e),W(t,e),x(t,e),F(t,n,s),{errors:e,valid:e.length===0,warnings:s}},ce=te;export{b as REQUIRED_COMPATIBILITY_DATE,de as REQUIRED_FLAG,ce as validateWrangler,te as validateWranglerConfig};
1
+ import{o as m,v as h,a as E,b as p,c as D,d as y,e as l,f as I,g as O,H as R,h as S,R as $,S as j,i as A,j as k,W as L,k as w}from"./validate-bindings-DFAcr5wA.mjs";import{validateTailConsumers as B,validateSendEmail as T,validateSecretsRequired as N,validateLogpush as C,validateLimits as U,validatePlacement as P,validateObservability as G,validateAssets as K,validateCache as V,validateExports as W,validateCorsVariables as x,validateSchedulerOrigin as F}from"./withTailConsumer-BZqzeKYh.mjs";import{isCacheEnabled as H,WORKERS_CACHE_MIN_DATE as _}from"./WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{mergeWranglerEnvironment as M}from"./mergeWranglerEnvironment-KtP_NGVx.mjs";const Y=i=>typeof i=="object"&&i!==null&&!Array.isArray(i),f=i=>Array.isArray(i)?i.flatMap((a,n)=>Y(a)?[[n,a]]:[]):[],g=i=>typeof i.binding=="string"?i.binding:"",q=(i,a,n)=>{for(const[e,s]of f(i.kv_namespaces))typeof s.id=="string"&&s.id!==""||n.push(`kv_namespaces[${String(e)}] ("${g(s)}") is not created yet and the schema pins data to "${a}" — create it with \`wrangler kv namespace create <name> --jurisdiction=${a}\`; a namespace's jurisdiction cannot be changed afterwards`)},Q=(i,a,n)=>{for(const[e,s]of f(i.r2_buckets)){const r=s.jurisdiction;if(r===a)continue;const t=typeof r=="string"?`names the "${r}" jurisdiction`:"names no jurisdiction";n.push(`r2_buckets[${String(e)}] ("${g(s)}") ${t}, but the schema pins data to "${a}" — create the bucket with \`wrangler r2 bucket create <name> --jurisdiction=${a}\` and set "jurisdiction": "${a}" on the binding`)}},J=(i,a,n)=>{const e=a?.jurisdiction;e!==void 0&&(q(i,e,n),Q(i,e,n))},b="2026-04-07",de="web_socket_auto_reply_to_close",u="2026-10-01",v="durable_object_io_tasks_prevent_eviction",z="durable_object_io_tasks_do_not_prevent_eviction",X=/^\d{4}-\d{2}-\d{2}$/,Z=(i,a,n)=>{i>=u||a.includes(v)||a.includes(z)||n.push(`compatibility_date "${i}" predates "${u}", so pending I/O (waitUntil, cross-Durable-Object RPC, service-binding calls, timers) does not keep a Durable Object alive once its last client disconnects — live-query refreshes and durable streams can be cut off mid-flight. Set compatibility_date >= "${u}" or add the "${v}" compatibility flag`)},ee=(i,a,n)=>{const{error:e,merged:s,unverifiedKeys:r}=M(i,a);return e!==void 0?{error:e,wrangler:s}:(r.length>0&&n.push(`env.${String(a)} overrides ${r.join(", ")}, which this validator doesn't have a verified inheritance rule for — validated against the TOP-LEVEL value only. Double-check ${r.length===1?"it":"them"} by hand for "${String(a)}".`),{wrangler:s})},te=(i,a,n)=>{const e=[],s=[];if(!i||typeof i!="object")return e.push("wrangler config is not a valid object"),{errors:e,valid:!1,warnings:s};const{error:r,wrangler:t}=ee(i,n,s);if(r!==void 0)return e.push(r),{errors:e,valid:!1,warnings:s};m(t.durable_objects?.bindings).find(o=>o.name==="SHARD"&&o.class_name==="ShardDO")||e.push('durable_objects.bindings must include { "name": "SHARD", "class_name": "ShardDO" } — your dev server auto-reconciles this on startup, or add the binding manually'),h(t,e);const d=t.compatibility_date??"",c=X.test(d);d&&!c?e.push(`compatibility_date must be in YYYY-MM-DD format (got "${d}")`):d<b&&e.push(`compatibility_date must be >= "${b}" (got "${d||"<missing>"}")`),H(t)&&c&&d<_&&e.push(`cache.enabled requires compatibility_date >= "${_}" (got "${d||"<missing>"}")`),c&&Z(d,t.compatibility_flags??[],s),E(t,a,e),J(t,a,s),p(t,e),D(t,a?.vectorIndexNames??[],e),B(t,e),y(t,e,s),l(t.workflows,"workflows",L,e),I(t,e),O(t,e),l(t.secrets_store_secrets,"secrets_store_secrets",w,e);for(const o of R)S(t,o,e,s);for(const o of $)l(t[o.key],o.key,o,e);for(const o of j)A(t,o,e);return k(t,e),T(t,e,s),N(t,e),C(t,e),U(t,e),P(t,e),G(t,e,s),K(t,e),V(t,e),W(t,e),x(t,e),F(t,n,s),{errors:e,valid:e.length===0,warnings:s}},ce=te;export{b as REQUIRED_COMPATIBILITY_DATE,de as REQUIRED_FLAG,ce as validateWrangler,te as validateWranglerConfig};
@@ -1 +1 @@
1
- import{existsSync as d}from"node:fs";import{dirname as u,join as h}from"node:path";import{discoverSchemaInfo as v}from"./discoverSchemaInfo-BguahM6z.mjs";import{COMPOSED_ENTRY_DURABLE_OBJECTS as y,GENERATED_CLASS_MODULES as w,isFrameworkDurableObject as E}from"./COMPOSED_WORKER_ENTRY-C69wqbSP.mjs";import{o as $}from"./validate-bindings-Djec3UWf.mjs";import{l as k,r as x,s as j}from"./worker-entry-checks-9Vdz4d2f.mjs";import{mergeWranglerEnvironment as D}from"./mergeWranglerEnvironment-KtP_NGVx.mjs";import{findWranglerFile as A,readWranglerJsonc as R}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{validateWranglerConfig as W}from"./REQUIRED_COMPATIBILITY_DATE-DFsH8i4Z.mjs";const b=r=>Array.isArray(r)?r:[],_=(r,s,o)=>Object.entries(r?.images??{}).flatMap(([t,n])=>{const e=n?.dockerfile;return typeof e!="string"||d(e.startsWith("/")?e:h(s,e))?[]:[`containers images["${t}"] dockerfile "${e}" does not exist (resolved relative to ${o}); create the Dockerfile`]}),S=(r,s,o)=>{const t=[];for(const n of b(r)){const e=n?.image;typeof e=="string"&&(e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.includes("Dockerfile"))&&!d(e.startsWith("/")?e:h(s,e))&&t.push(`containers image "${e}" does not exist (resolved relative to ${o}); create the Dockerfile or point image at a registry reference`),t.push(..._(n,s,o))}return t},N=(r,s)=>{const o=r?.vectorIndexNames??[],t=[];if(o.length>0&&t.push({message:e=>`schema declares vector index(es) ${o.map(i=>`"${i}"`).join(", ")} but nothing chains .vectors(...) onto defineApp() (composed in: ${e}) — \`ctx.vectors\` is then a throwing stub and buildWorkerOptions rejects EVERY request, /_lunora/health included. Add \`.vectors((env) => ({ ${String(o[0])}: env.<BINDING> }))\` to the chain.`,method:"vectors"}),r?.hasD1GlobalTable&&t.push({message:e=>`schema declares .global() table(s) but nothing chains .global(...) onto defineApp() (composed in: ${e}) — 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"}),r?.hasHyperdriveGlobalTable&&t.push({message:e=>`schema declares .global({ backend: "hyperdrive" }) table(s) but nothing chains .hyperdriveGlobal(...) onto defineApp() (composed in: ${e}) — 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 n=j(s,new Set(t.map(e=>e.method)));return n===void 0?[]:t.filter(e=>!n.chained.has(e.method)).map(e=>e.message(n.site))},O="does not export it",P=(r,s)=>{if(s!=="composed")return`Re-export it from the module that defines it (\`export { ${r} } from "./…";\`), or add it to the app builder's own export (\`export const { ${r} } = app;\`).`;const o=`it exports ${y.join(", ")}, SchedulerDO when its binding is declared, and every class codegen emits from your ${w.map(t=>`${t}.ts`).join(" / ")} declarations`;return E(r)?`\`@lunora/vite\` generates that entry — ${o}, and ${r} is not among them. Class-A composition does not carry ${r}, 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: ${o}. Declare "${r}" in one of those and re-run \`lunora codegen\`, or drop the binding.`},C=(r,s)=>{const o=s.exports;if(o===void 0)return[];const t=[];for(const e of $(r.durable_objects?.bindings))typeof e.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&t.push({className:e.class_name,label:"durable_objects.bindings"});for(const e of b(r.workflows))typeof e?.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&t.push({className:e.class_name,label:"workflows"});for(const[e,i]of Object.entries(r.exports??{}))i?.type==="workflow"&&t.push({className:e,label:"workflows"});return t.filter(e=>!o.has(e.className)).map(e=>`${e.label} declares class "${e.className}" but the ${s.kind==="composed"?"composed class-A worker entry":"worker entry"} (${s.path}) ${O} — wrangler refuses to bundle a Worker whose ${e.label==="workflows"?"Workflow":"Durable Object"} classes are not exported. ${P(e.className,s.kind)}`)},I=r=>r?.origin!=="absent"?[]:[`main is set but no readable file is there (looked in ${r.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.`],H=r=>{const s=r.schemaDir??"lunora",o=A(r.projectRoot);if(!o){const l=`wrangler.jsonc not found in ${r.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[l],report:{errors:[l],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:t}=R(o);if(t===void 0){const l=`failed to parse ${o} as JSONC.`;return{problems:[l],report:{errors:[l],valid:!1,warnings:[]},wranglerPath:o}}const{error:n,merged:e}=D(t,r.environment);if(n!==void 0)return{problems:[n],report:{errors:[n],valid:!1,warnings:[]},wranglerPath:o};const{error:i,info:p}=v(r.projectRoot,s),a=W(t,p,r.environment);i!==void 0&&a.warnings.push(`schema parse failed in ${s}/schema.ts: ${i}`);const m=u(o),f=k(e.main,r.projectRoot,o),g=x(f,r.projectRoot,s);a.errors.push(...S(e.containers??[],m,o)),a.warnings.push(...I(f)),g!==void 0&&a.errors.push(...C(e,g)),a.errors.push(...N(p,r.projectRoot));const c=e.assets?.directory;if(typeof c=="string"&&c.length>0){const l=c.startsWith("/")?c:h(m,c);d(l)||a.warnings.push(`assets.directory "${c}" does not exist yet — it is created by the client build; run the build before deploy`)}return a.valid=a.errors.length===0,{problems:a.errors,report:a,wranglerPath:o}};export{O as UNEXPORTED_CLASS_MARKER,H as validateWranglerProject};
1
+ import{existsSync as d}from"node:fs";import{dirname as u,join as h}from"node:path";import{discoverSchemaInfo as v}from"./discoverSchemaInfo-BguahM6z.mjs";import{COMPOSED_ENTRY_DURABLE_OBJECTS as y,GENERATED_CLASS_MODULES as w,isFrameworkDurableObject as E}from"./COMPOSED_WORKER_ENTRY-C69wqbSP.mjs";import{o as $}from"./validate-bindings-DFAcr5wA.mjs";import{l as k,r as x,s as j}from"./worker-entry-checks-9Vdz4d2f.mjs";import{mergeWranglerEnvironment as D}from"./mergeWranglerEnvironment-KtP_NGVx.mjs";import{findWranglerFile as A,readWranglerJsonc as R}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{validateWranglerConfig as W}from"./REQUIRED_COMPATIBILITY_DATE-Cosq9TDj.mjs";const b=r=>Array.isArray(r)?r:[],_=(r,s,o)=>Object.entries(r?.images??{}).flatMap(([t,n])=>{const e=n?.dockerfile;return typeof e!="string"||d(e.startsWith("/")?e:h(s,e))?[]:[`containers images["${t}"] dockerfile "${e}" does not exist (resolved relative to ${o}); create the Dockerfile`]}),S=(r,s,o)=>{const t=[];for(const n of b(r)){const e=n?.image;typeof e=="string"&&(e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.includes("Dockerfile"))&&!d(e.startsWith("/")?e:h(s,e))&&t.push(`containers image "${e}" does not exist (resolved relative to ${o}); create the Dockerfile or point image at a registry reference`),t.push(..._(n,s,o))}return t},N=(r,s)=>{const o=r?.vectorIndexNames??[],t=[];if(o.length>0&&t.push({message:e=>`schema declares vector index(es) ${o.map(i=>`"${i}"`).join(", ")} but nothing chains .vectors(...) onto defineApp() (composed in: ${e}) — \`ctx.vectors\` is then a throwing stub and buildWorkerOptions rejects EVERY request, /_lunora/health included. Add \`.vectors((env) => ({ ${String(o[0])}: env.<BINDING> }))\` to the chain.`,method:"vectors"}),r?.hasD1GlobalTable&&t.push({message:e=>`schema declares .global() table(s) but nothing chains .global(...) onto defineApp() (composed in: ${e}) — 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"}),r?.hasHyperdriveGlobalTable&&t.push({message:e=>`schema declares .global({ backend: "hyperdrive" }) table(s) but nothing chains .hyperdriveGlobal(...) onto defineApp() (composed in: ${e}) — 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 n=j(s,new Set(t.map(e=>e.method)));return n===void 0?[]:t.filter(e=>!n.chained.has(e.method)).map(e=>e.message(n.site))},O="does not export it",P=(r,s)=>{if(s!=="composed")return`Re-export it from the module that defines it (\`export { ${r} } from "./…";\`), or add it to the app builder's own export (\`export const { ${r} } = app;\`).`;const o=`it exports ${y.join(", ")}, SchedulerDO when its binding is declared, and every class codegen emits from your ${w.map(t=>`${t}.ts`).join(" / ")} declarations`;return E(r)?`\`@lunora/vite\` generates that entry — ${o}, and ${r} is not among them. Class-A composition does not carry ${r}, 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: ${o}. Declare "${r}" in one of those and re-run \`lunora codegen\`, or drop the binding.`},C=(r,s)=>{const o=s.exports;if(o===void 0)return[];const t=[];for(const e of $(r.durable_objects?.bindings))typeof e.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&t.push({className:e.class_name,label:"durable_objects.bindings"});for(const e of b(r.workflows))typeof e?.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&t.push({className:e.class_name,label:"workflows"});for(const[e,i]of Object.entries(r.exports??{}))i?.type==="workflow"&&t.push({className:e,label:"workflows"});return t.filter(e=>!o.has(e.className)).map(e=>`${e.label} declares class "${e.className}" but the ${s.kind==="composed"?"composed class-A worker entry":"worker entry"} (${s.path}) ${O} — wrangler refuses to bundle a Worker whose ${e.label==="workflows"?"Workflow":"Durable Object"} classes are not exported. ${P(e.className,s.kind)}`)},I=r=>r?.origin!=="absent"?[]:[`main is set but no readable file is there (looked in ${r.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.`],H=r=>{const s=r.schemaDir??"lunora",o=A(r.projectRoot);if(!o){const l=`wrangler.jsonc not found in ${r.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[l],report:{errors:[l],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:t}=R(o);if(t===void 0){const l=`failed to parse ${o} as JSONC.`;return{problems:[l],report:{errors:[l],valid:!1,warnings:[]},wranglerPath:o}}const{error:n,merged:e}=D(t,r.environment);if(n!==void 0)return{problems:[n],report:{errors:[n],valid:!1,warnings:[]},wranglerPath:o};const{error:i,info:p}=v(r.projectRoot,s),a=W(t,p,r.environment);i!==void 0&&a.warnings.push(`schema parse failed in ${s}/schema.ts: ${i}`);const m=u(o),f=k(e.main,r.projectRoot,o),g=x(f,r.projectRoot,s);a.errors.push(...S(e.containers??[],m,o)),a.warnings.push(...I(f)),g!==void 0&&a.errors.push(...C(e,g)),a.errors.push(...N(p,r.projectRoot));const c=e.assets?.directory;if(typeof c=="string"&&c.length>0){const l=c.startsWith("/")?c:h(m,c);d(l)||a.warnings.push(`assets.directory "${c}" does not exist yet — it is created by the client build; run the build before deploy`)}return a.valid=a.errors.length===0,{problems:a.errors,report:a,wranglerPath:o}};export{O as UNEXPORTED_CLASS_MARKER,H as validateWranglerProject};
@@ -1,3 +1,3 @@
1
- import{LunoraError as n}from"@lunora/errors";import{lunoraLine as i}from"./LUNORA_TAG-CiQM3BkI.mjs";import{validateWranglerProject as l}from"./UNEXPORTED_CLASS_MARKER-BMNpympM.mjs";const m=(e,a,t)=>{const r=l({projectRoot:e.projectRoot,schemaDir:e.schemaDir});if(!r.wranglerPath)throw new n("INTERNAL",["[lunora] wrangler.jsonc not found.",` searched in: ${e.projectRoot}`," create a wrangler.jsonc declaring at least the SHARD durable object binding."].join(`
1
+ import{LunoraError as n}from"@lunora/errors";import{lunoraLine as i}from"./LUNORA_TAG-CiQM3BkI.mjs";import{validateWranglerProject as l}from"./UNEXPORTED_CLASS_MARKER-C8AFIY8C.mjs";const m=(e,a,t)=>{const r=l({projectRoot:e.projectRoot,schemaDir:e.schemaDir});if(!r.wranglerPath)throw new n("INTERNAL",["[lunora] wrangler.jsonc not found.",` searched in: ${e.projectRoot}`," create a wrangler.jsonc declaring at least the SHARD durable object binding."].join(`
2
2
  `));for(const o of r.report.warnings)a(i(`wrangler validator: ${o}`));if(r.problems.length>0)throw new n("INTERNAL",["[lunora] wrangler configuration is missing bindings required by your schema.",` file: ${r.wranglerPath}`,"",...r.problems.map(o=>` - ${o}`),"",` ${t}`].join(`
3
3
  `))};export{m as assertWranglerSatisfiesSchema};
@@ -0,0 +1,2 @@
1
+ import{readFileSync as F,writeFileSync as V}from"node:fs";import{createRequire as X}from"node:module";import{join as Q}from"node:path";import{containerBuildTag as z}from"@lunora/container";import{applyModify as S}from"./applyModify-DKP2l6S9.mjs";import{a as Z,r as W}from"./lunora-manifest-v90ZUbVp.mjs";import{parseTree as ee,findNodeAtLocation as ne}from"jsonc-parser";import{r as se,a as te,b as oe,c as ie}from"./reconcile-services-3dn35zgy.mjs";import{a as re,p as ae}from"./infer-bindings-B-BFynp2.mjs";import{DEV_VARS_FILE as de,parseDevVariableEntries as ce}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{requiredSecrets as le}from"./buildPackageSecretsBlock-yv9mjKEW.mjs";import{w as ue,n as ge,s as Y,o as B,p as C,q as me}from"./validate-bindings-DFAcr5wA.mjs";import{s as pe}from"./worker-entry-checks-9Vdz4d2f.mjs";import{DEFAULT_OBSERVABILITY as fe}from"./DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import{findWranglerFile as be,readWranglerJsonc as he}from"./WRANGLER_FILES-UNW-xY5u.mjs";const we=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],R=e=>Object.fromEntries(we.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),P="queueTuning",ve=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,_e=/^[\t ]*,/u,ye=(e,n)=>{const s=ee(e),t=s===void 0?void 0:ne(s,[...n])?.parent;if(t?.type==="property"){const i=t.offset+t.length,o=e.lastIndexOf(`
2
+ `,t.offset-1)+1,d=ve.exec(e.slice(i));if(d!==null&&e.slice(o,t.offset).trim()===""){const a=t.parent?.children??[],b=a.indexOf(t),c=b===a.length-1&&b>0?a[b-1]:void 0,l=c===void 0?void 0:_e.exec(e.slice(c.offset+c.length))??void 0;return(l===void 0||c===void 0?e.slice(0,o):e.slice(0,c.offset+c.length)+e.slice(c.offset+c.length+l[0].length,o))+e.slice(i+d[0].length)}}return S(e,n,void 0)},G=(e,n,s,t,i,o=new Set)=>{const d=s.join("."),a={},b=[],c=[];let l=e;return{entries:n.map((u,w)=>{const g=t(u);if(g===void 0||u.queue===void 0)return u;const p=Object.fromEntries(Object.entries(R(g)).filter(([f])=>!o.has(f))),h=Object.entries(i[u.queue]??{}).filter(([f])=>!Object.hasOwn(p,f)),v=Object.entries(p).filter(([f,y])=>u[f]!==y),x=h.filter(([f,y])=>u[f]===y).map(([f])=>f),N=Object.fromEntries(Object.entries({...u,...p}).filter(([f])=>!x.includes(f)));for(const[f,y]of v)l=S(l,[...s,w,f],y);for(const f of x)l=ye(l,[...s,w,f]);for(const[f,y]of h){const k=u[f];k!==void 0&&k!==y&&c.push(`${d}/${u.queue}: ${f} is no longer declared by defineQueue, but it was changed by hand to ${JSON.stringify(k)} from the declared ${JSON.stringify(y)}, so it was kept. Delete it from wrangler.jsonc if it should go.`)}return(v.length>0||x.length>0)&&b.push(`${d}/${u.queue} (${[...v.map(([f])=>f),...x.map(f=>`removed ${f}`)].join(", ")})`),Object.keys(p).length>0&&(a[u.queue]=p),N}),owned:a,text:l,updated:b,warnings:c}},Se=(e,n,s,t)=>{const i=n.queues??{},o=i.producers??[],d=i.consumers??[],a=new Set(o.map(g=>g.binding)),b=new Set(d.map(g=>g.queue)),c=s.filter(g=>!a.has(g.bindingName)),l=s.filter(g=>!b.has(g.name)),m=G(e,d,["queues","consumers"],g=>s.find(p=>p.name===g.queue),t);let u=m.text;const w={...m.owned};if(c.length>0||l.length>0){const g=[...o,...c.map(h=>({binding:h.bindingName,queue:h.name}))],p=[...m.entries,...l.map(h=>({queue:h.name,...h.mode==="pull"?{type:"http_pull"}:{},...R(h)}))];for(const h of l){const v=R(h);Object.keys(v).length>0&&(w[h.name]=v)}u=S(u,["queues"],{consumers:p,producers:g})}return{added:[...c.map(g=>`queues.producers/${g.bindingName}`),...l.map(g=>`queues.consumers/${g.name}`)],owned:w,text:u,updated:m.updated,warnings:m.warnings}},xe=(e,n,s,t,i)=>{const o=n.env?.[t],d=o?.queues?.consumers??[],a=o?.queues?.producers??[],b=u=>{const w=a.find(g=>g.queue===u.queue)?.binding;return w!==void 0?s.find(g=>g.bindingName===w):s.find(g=>g.name===u.queue&&!a.some(p=>p.binding===g.bindingName))},c=G(e,d,["env",t,"queues","consumers"],b,i,new Set(["dead_letter_queue"])),l=d.filter(u=>u.queue!==void 0&&b(u)===void 0).map(u=>`env.${t}.queues.consumers/${String(u.queue)}: no defineQueue export matches it — this block declares no producer mapping one of their bindings to "${String(u.queue)}", and no export is named that — so it was not retuned. A consumer for a queue another worker produces is skipped the same way.`),m=d.flatMap(u=>{const w=b(u)?.tuning.deadLetterQueue;return w===void 0||u.dead_letter_queue!==void 0?[]:[`env.${t}.queues.consumers/${String(u.queue)}: defineQueue declares deadLetterQueue "${w}", but this consumer has no dead_letter_queue, so its exhausted messages are dropped. Queue names differ per environment, so reconcile does not write it here; add it by hand.`]});return{added:[],owned:c.owned,text:c.text,updated:c.updated,warnings:[...c.warnings,...m,...l]}},Ne=(e,n)=>{if(e?.lunoraIsForeign===!0)return n.push(`${e.path}: \`lunora\` is not an object, so the queue tuning ownership record cannot be read or written — an option removed from defineQueue stays deployed.`),{};const s=e?.lunora?.[P],t=i=>typeof i=="object"&&i!==null&&!Array.isArray(i);return s===void 0?{}:!t(s)||!Object.values(s).every(i=>t(i)&&Object.values(i).every(o=>t(o)))?(n.push(`${e?.path??"package.json"}: \`lunora.${P}\` is not a map of scope → queue → fields, so it is ignored — an option removed from defineQueue stays deployed until the next pass records it again.`),{}):s},Oe=(e,n,s)=>{const t=Object.fromEntries(Object.entries({...n,...s}).filter(([,i])=>Object.keys(i).length>0));Z(e,P,Object.keys(t).length===0?void 0:t)},I="PIPELINES",j="ARTIFACTS",ke=(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===I),i=e.usesArtifacts?n?.artifacts??[]:[],o=i.some(a=>a.binding===j)?[]:i.flatMap(a=>a.binding===void 0?[]:[a.binding]);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 "${I}" pipelines binding exists; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding: "${I}", stream }) — codegen resolves this one name, and the pipeline resource can't be auto-provisioned.`],[e.usesArtifacts&&i.length===0,re(e.jurisdiction)],[o.length>0,`ctx.artifacts is used and ${o.map(a=>`"${a}"`).join(", ")} ${o.length===1?"is":"are"} bound, but none is named "${j}"; make sure \`.artifacts()\` on defineApp points ctx.artifacts at it — otherwise it reads env.${j} and throws.`],[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)},Ee=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.usesX402,"@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),D=(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.`),$e=(e,n)=>{const s=new Set([...e.workflows,...e.agents].map(o=>o.className));if(s.size===0)return[];const t=Object.entries(n.exports??{}).flatMap(([o,d])=>d?.type==="workflow"?[o]:[]),i=(n.workflows??[]).flatMap(o=>o.class_name===void 0||o.script_name!==void 0?[]:[o.class_name]);return[...new Set([...t,...i])].filter(o=>!s.has(o)).map(o=>`wrangler.jsonc declares workflow "${o}" but no defineWorkflow/defineAgent export generates that class — a leftover from a rename will fail the deploy (wrangler rejects a class the worker does not export). Remove it if it is not hand-wired.`)},Ae=(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:o}=i;return o===void 0||s.has(o)?[]:[`wrangler.jsonc subscribes queues.consumers[] to "${o}" 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:o}=i;return o===void 0||t.has(o)?[]:[`wrangler.jsonc declares queues.producers[] binding "${o}" but no defineQueue export declares it — a leftover from a rename. Remove it if it is not hand-wired.`]})]},qe=(e,n)=>[...$e(e,n),...Ae(e,n)],U=[{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"}],Ce=()=>U.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),Ie=e=>{let n;try{n=F(Q(e,de),"utf8")}catch{return!1}const s=new Map(ce(n).map(t=>[t.key,t.value]));return U.some(({keys:t})=>t.every(i=>(s.get(i)??"")!==""))},je=(e,n)=>{const s=n?.secrets?.required;if(!Array.isArray(s))return[];const t=new Set(s),i=le(ae(e)).map(o=>o.key).filter(o=>!t.has(o));return i.length===0?[]:[`wrangler.jsonc declares secrets.required without ${i.join(", ")}, which this app needs — wrangler dev loads only the listed keys from .dev.vars, so add ${i.length===1?"it":"them"} to secrets.required.`]},T=(e,n,s)=>{const t=new Set(e.durableObjects.map(a=>a.className)),i=[],o=(s?.r2_buckets?.length??0)>0,d=(s?.d1_databases?.some(a=>a.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!o&&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")&&!d&&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(...D("container","containers",e.containers),...D("workflow","workflows",e.workflows),...D("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.usesPayments&&!Ie(n)&&i.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${Ce()}.`),i.push(...Ee(e),...ke(e,s),...je(e,s)),s!==void 0&&i.push(...qe(e,s)),i},H="<replace-with-d1-create-id>",De=e=>[["container","containers",e.containers],["workflow","workflows",e.workflows],["agent","agents",e.agents]].flatMap(([s,t,i])=>i.filter(o=>!o.exported).map(({className:o,exportName:d})=>({className:o,exportName:d,kind:s,module:t}))),Te=e=>{const n=new Set(B(e).map(t=>t.tag));let s=1;for(;n.has(`v${String(s)}`);)s+=1;return`v${String(s)}`},Be=e=>{const n=new Set;for(const s of B(e)){for(const t of C(s.deleted_classes))n.delete(t);for(const{from:t,to:i}of B(s.renamed_classes))t!==void 0&&n.delete(t),i!==void 0&&n.add(i);for(const t of[...C(s.new_classes),...C(s.new_sqlite_classes)])n.add(t)}return n},Re=(e,n,s)=>{const t=n.durable_objects?.bindings??[],i=new Set(t.map(l=>l.name)),o=s.filter(l=>!i.has(l.binding));let d=e;const a=[];if(o.length>0){const l=[...t,...o.map(m=>({class_name:m.className,name:m.binding}))];d=S(d,["durable_objects","bindings"],l),a.push(...o.map(m=>`${m.binding}/${m.className}`))}const b=n.migrations??[],c=s.map(l=>l.className).filter(l=>!Be(b).has(l));if(c.length>0){const l=[...b,{new_sqlite_classes:c,tag:Te(b)}];d=S(d,["migrations"],l)}return{added:a,text:d}},Pe=(e,n)=>{const s=n.d1_databases??[];if(s.some(o=>o.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:H,database_name:t}];return{added:["DB (D1)"],text:S(e,["d1_databases"],i)}},Le={ai:{binding:"AI",label:"AI (Workers AI)"},analytics:{binding:"ANALYTICS_SQL",label:"ANALYTICS_SQL (Analytics SQL)"},browser:{binding:"BROWSER",label:"BROWSER (Browser Rendering)"},images:{binding:"IMAGES",label:"IMAGES (Cloudflare Images)"}},$=(e,n,s)=>{const{binding:t,label:i}=Le[s],o=n[s]?.binding;return typeof o=="string"&&o.length>0?{added:[],text:e}:{added:[i],text:S(e,[s],{binding:t})}},Me=(e,n)=>e.usesAnalyticsSql&&pe(n,new Set(["analyticsSql"]))?.chained.has("analyticsSql")!==!0,We=new Set(["ratelimits","send_email"]),Ke=["durable_objects","logfwdr","unsafe"],Fe=new Set(["data_blobs","text_blobs","vars","wasm_modules"]),M=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),L=(e,n,s)=>M(e)&&e[n]===s,Qe=(e,n,s)=>{if(Fe.has(e))return M(n)&&Object.hasOwn(n,s);const t=We.has(e)?"name":"binding";return Array.isArray(n)?n.some(i=>L(i,t,s)):L(n,"binding",s)},Ye=(e,n)=>{const s=e,t=Object.entries(s).find(([o,d])=>o!=="env"&&Qe(o,d,n));if(t!==void 0)return t[0];for(const o of Ke){const d=s[o];if(M(d)&&Array.isArray(d.bindings)&&d.bindings.some(a=>L(a,"name",n)))return`${o}.bindings`}if(e.queues?.producers?.some(o=>o.binding===n)===!0)return"queues.producers";const i=e.secrets?.required;if(Array.isArray(i)&&i.includes(n))return"secrets.required"},K=(e,n,s,t,i)=>{if((n[s]?.length??0)>0)return{added:[],text:e};const o=Ye(n,t.binding);return o!==void 0?{added:[],text:e,warnings:[`${s}: not adding ${JSON.stringify(t)} — the name "${t.binding}" is already bound by \`${o}\` in wrangler.jsonc. Add a ${s} entry under another binding name and point the matching \`defineApp()\` override at it.`]}:{added:[i],text:S(e,[s],[t])}},Ge=(e,n)=>{const s=n.worker_loaders??[];return s.some(t=>t.binding==="LOADER")?{added:[],text:e}:{added:["LOADER (Worker Loader)"],text:S(e,["worker_loaders"],[...s,{binding:"LOADER"}])}},Ue=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},He=e=>{const{image:n}=e;return n.kind==="dockerfile"?n.dockerfilePath:n.kind==="registry"?n.reference:z(e.exportName)},J=e=>{const n={};for(const[s,t]of Object.entries(e.images??{}))n[s]=t.kind==="registry"?{image:t.reference}:{build_context:t.buildContext,dockerfile:t.dockerfilePath,...e.buildArgs===void 0?{}:{build_vars:e.buildArgs}};return{class_name:e.className,scheduling_policy:"durable_object",...Object.keys(n).length>0?{images:n}:{},...e.name===void 0?{}:{name:e.name}}},Je=e=>{if(e.schedulingPolicy==="durable_object")return J(e);const{image:n}=e,s={class_name:e.className,image:He(e)};return n.kind==="dockerfile"&&(s.image_build_context=n.buildContext),e.buildArgs!==void 0&&n.kind!=="registry"&&(s.image_vars=e.buildArgs),e.instanceType!==void 0&&(s.instance_type=Ue(e.instanceType)),e.maxInstances!==void 0&&(s.max_instances=e.maxInstances),e.name!==void 0&&(s.name=e.name),e.rollout?.stepPercentage!==void 0&&(s.rollout_step_percentage=e.rollout.stepPercentage),e.rollout?.gracePeriodSeconds!==void 0&&(s.rollout_active_grace_period=e.rollout.gracePeriodSeconds),s},Ve=(e,n,s)=>{const t=n.containers??[],i=new Set(t.map(c=>c.class_name)),o=s.filter(c=>!i.has(c.className));let d=o.length===0?e:S(e,["containers"],[...t,...o.map(c=>Je(c))]);const a=[],b=[];for(const[c,l]of t.entries()){const m=s.find(g=>g.className===l.class_name);if(m===void 0)continue;const u=m.schedulingPolicy??"default";if((l.scheduling_policy??"default")!==u){b.push(`containers/${m.className} has scheduling_policy "${l.scheduling_policy??"default"}" in wrangler.jsonc but defineContainer "${m.exportName}" declares "${u}" — the policy is immutable, so replace the entry (and its container application) by hand.`);continue}const w=m.schedulingPolicy==="durable_object"?J(m).images:void 0;w!==void 0&&JSON.stringify(l.images)!==JSON.stringify(w)&&(d=S(d,["containers",c,"images"],w),a.push(`containers/${m.className}.images`))}return{added:o.map(c=>`containers/${c.className}`),text:d,updated:a,warnings:b}},Xe=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=S(e,["observability"],{...fe});return{added:["observability"],text:s}},ze=[{minimum:[4,142],name:"wrangler"},{minimum:[1,61],name:"@cloudflare/vite-plugin"}],Ze=(e,n)=>{try{const s=X(Q(e,"package.json")).resolve(`${n}/package.json`),[t=0,i=0]=String(JSON.parse(F(s,"utf8")).version).split(".").map(Number);return[t,i]}catch{return}},en=e=>{const n=ze.flatMap(({minimum:s,name:t})=>{const i=Ze(e,t);return i!==void 0&&(i[0]<s[0]||i[0]===s[0]&&i[1]<s[1])?[`${t} ${i.join(".")} (needs >= ${s.join(".")})`]:[]});return n.length===0?void 0:`workflows are declared in wrangler \`exports\`, which ${n.join(" and ")} cannot run — reconcile left workflows[] untouched. Upgrade (\`pnpm add -D wrangler@^4.143.1 @cloudflare/vite-plugin@^1.62.1\`) and re-run.`},nn=e=>Object.entries(e.env??{}).flatMap(([n,s])=>Array.isArray(s?.workflows)?[`env.${n}.workflows declares workflow bindings, but Lunora now declares workflows in \`exports\` and resolves them on ctx.exports — move them to that environment's own \`exports\` by hand.`]:[]),sn=(e,n,s)=>{let t=e;const i=[],o=[];for(const d of s){const a=n[d.className];if(a?.type==="workflow")for(const{of:b,path:c}of me){const l=b(d),m=Y(a,c),u=`exports/${d.className}.${c.join(".")}`;if(l===void 0){m!==void 0&&o.push(`${u} is set in wrangler.jsonc but defineWorkflow "${d.exportName}" does not declare it — reconcile leaves it in place. Remove it by hand if it was dropped from the definition.`);continue}JSON.stringify(m)!==JSON.stringify(l)&&(t=S(t,["exports",d.className,...c],l),i.push(u))}}return{text:t,updated:i,warnings:o}},tn=(e,n,s,t,i)=>{if(i!==void 0)return{added:[],text:e,warnings:[i]};const o=[...s.map(p=>({settings:ue(p),workflow:p})),...t.map(p=>({settings:{},workflow:p}))],d=new Set(o.map(({workflow:p})=>p.className)),a=n.workflows??[],b=a.filter(p=>p.script_name===void 0&&p.class_name!==void 0&&d.has(p.class_name)),c=n.exports??{},l=[],m=[],u=[];let w=e;for(const{settings:p,workflow:h}of o){if(c[h.className]!==void 0&&c[h.className]!==null)continue;const v=b.find(f=>f.class_name===h.className),x=Object.fromEntries(ge.flatMap(f=>{const y=Y(v,[f]);return y===void 0?[]:[[f,y]]})),N=v?.name??h.name;v?.name!==void 0&&v.name!==h.name&&u.push(`workflows/${h.className} is deployed as "${v.name}" but declared as "${h.name}" — its export keeps "${v.name}" so running instances survive. Change the declaration to match, or rename deliberately (it starts a new, empty workflow).`),w=S(w,["exports",h.className],{type:"workflow",...x,...p,name:N}),(v===void 0?l:m).push(`exports/${h.className}`)}if(b.length>0){const p=a.filter(h=>!b.includes(h));w=S(w,["workflows"],p.length===0?void 0:p),m.push(...b.map(h=>`workflows/${String(h.class_name)} → exports`))}u.push(...nn(n));const g=sn(w,c,s);return{added:l,text:g.text,updated:[...m,...g.updated],warnings:[...u,...g.warnings]}},_n=(e,n,s)=>{const t=be(e),i=De(n);if(!t)return{added:[],changed:!1,exportGaps:i,reason:"wrangler.jsonc not found",updated:[],warnings:T(n,e)};const{parsed:o,text:d}=he(t);if(o===void 0)return{added:[],changed:!1,exportGaps:i,reason:`failed to parse ${t} as JSONC`,updated:[],warnings:T(n,e),wranglerPath:t};const a=T(n,e,o);if(s!==void 0){const r=o.env?.[s]!==void 0;a.push(r?`auto-provisioned bindings are written to the top level of wrangler.jsonc only (queue consumers "env.${s}" already declares are retuned, nothing is added) — "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 b=n.containers.filter(r=>r.exported),c=n.agents.filter(r=>r.exported&&r.voice===!0&&r.voiceBindingName!==void 0&&r.voiceClassName!==void 0),l=[...n.durableObjects,...b.map(r=>({binding:r.bindingName,className:r.className})),...c.map(r=>({binding:r.voiceBindingName,className:r.voiceClassName}))],m=n.workflows.filter(r=>r.exported),u=n.agents.filter(r=>r.exported),w=W(e),g=Ne(w,a),p={},h=se(w);let v;const x=[{enabled:!0,run:r=>Re(r,o,l)},{enabled:n.needsD1,run:r=>Pe(r,o)},{enabled:n.usesAi,run:r=>$(r,o,"ai")},{enabled:n.usesAiSearch,run:r=>K(r,o,"ai_search_namespaces",{binding:"AI_SEARCH",namespace:"default"},"AI_SEARCH (AI Search namespace)")},{enabled:Me(n,e),run:r=>$(r,o,"analytics")},{enabled:n.usesBrowser,run:r=>$(r,o,"browser")},{enabled:n.usesImages,run:r=>$(r,o,"images")},{enabled:n.usesAnalytics,run:r=>K(r,o,"analytics_engine_datasets",{binding:"ANALYTICS",dataset:"ANALYTICS"},"ANALYTICS (Analytics Engine)")},{enabled:n.usesWorkerLoader,run:r=>Ge(r,o)},{enabled:!0,run:r=>Xe(r,o)},{enabled:b.length>0,run:r=>Ve(r,o,b)},{enabled:m.length>0||u.length>0,run:r=>tn(r,o,m,u,en(e))},{enabled:n.queues.length>0,run:r=>{const _=Se(r,o,n.queues,g.queues??{});return p.queues=_.owned,_}},{enabled:n.services!==void 0&&(n.services.length>0||Object.keys(h).length>0),run:r=>{const _=te(r,o,n.services??[],h);return v=_.owned,_}},...s===void 0||o.env?.[s]===void 0?[]:[{enabled:n.queues.length>0,run:r=>{const _=`env.${s}.queues`,E=xe(r,o,n.queues,s,g[_]??{});return p[_]=E.owned,E}}]];let N=d;const f=[],y=[];for(const r of x){if(!r.enabled)continue;const _=r.run(N);N=_.text,f.push(..._.added),y.push(..._.updated??[]),a.push(..._.warnings??[])}const k=r=>{if(w===void 0)return;const _=v,E=[...Object.keys(p).length>0?[{consequence:"an option removed from defineQueue stays deployed",key:"queueTuning",label:"queue tuning",write:O=>{Oe(O,g,p)}}]:[],..._===void 0?[]:[{consequence:"a service removed from lunora.config stays bound",key:"services",label:"service bindings",write:O=>{ie(O,_)}}]];for(const O of E)try{O.write(W(e)??w)}catch(q){a.push(`${r?"wrangler.jsonc was updated, but ":""}recording the ${O.label} reconcile owns in ${w.path} (lunora.${O.key}) failed: ${q instanceof Error?q.message:String(q)}. Until it is recorded, ${O.consequence}.`)}};let A;if(n.services!==void 0){const r=oe(e,n.services,h);a.push(...r.warnings),v={...v,...r.owned},A=r.added.length>0||r.updated.length>0?{added:r.added,path:r.path,updated:r.updated}:void 0}return f.includes("DB (D1)")&&a.push(`wrote a DB binding with a placeholder database_id ("${H}") — run \`wrangler d1 create <name>\` and replace it before deploying.`),N===d?(k(!1),{added:f,changed:!1,devConfig:A,exportGaps:i,reason:"bindings already in sync",updated:y,warnings:a,wranglerPath:t}):(V(t,N,"utf8"),k(!0),{added:f,changed:!0,devConfig:A,exportGaps:i,updated:y,warnings:a,wranglerPath:t})};export{De as collectExportGaps,_n as reconcileWranglerBindings};
@@ -0,0 +1 @@
1
+ import{existsSync as _,statSync as w,readFileSync as j,readdirSync as B}from"node:fs";import{discoverFlags as P,FLAGS_FILENAME as F,discoverQueues as L,QUEUES_FILENAME as k,CAPABILITY_PROBES as I,readServiceBindings as G,mayReadCapabilityContext as U,foldCapabilitySignals as x,capabilitiesUsedBy as K,sourceCapabilitySignals as W}from"@lunora/codegen";import{init as Y}from"es-module-lexer";import{Project as q}from"ts-morph";import{discoverAgentInfo as M}from"./discoverAgentInfo-CTdCSfYM.mjs";import{discoverContainerInfo as H}from"./discoverContainerInfo-EhZtEBQs.mjs";import{escapeRegExp as X}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{d as R}from"./discover-info-Vj9d4qYt.mjs";import{relative as J,sep as Q,isAbsolute as V,join as S}from"node:path";import{discoverSchemaInfo as z}from"./discoverSchemaInfo-BguahM6z.mjs";import{resolveWorkerEntry as Z,COMPOSED_ENTRY_DURABLE_OBJECTS as ee,GENERATED_MODULE_DURABLE_OBJECTS as se,GENERATED_DIRECTORY as C,DURABLE_OBJECT_BINDINGS as te,detectExportedDurableObjects as re,detectClassExports as A}from"./COMPOSED_WORKER_ENTRY-C69wqbSP.mjs";import{discoverWorkflowInfo as ne}from"./discoverWorkflowInfo-BsPvlo6O.mjs";const oe="https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/artifacts/namespaces",ae=e=>{const s='add an "artifacts" binding ({ binding: "ARTIFACTS", namespace }) — codegen reads env.ARTIFACTS unless `.artifacts()` on defineApp points ctx.artifacts at another binding';return e===void 0?`ctx.artifacts is used; ${s}. The namespace is created by the first repo create() if it does not exist yet.`:e==="fedramp"?'ctx.artifacts is used, but the schema pins data to "fedramp" and Artifacts namespaces exist only in "eu" or "us" — codegen refuses this combination.':`ctx.artifacts is used and the schema pins data to "${e}"; create the namespace in that jurisdiction BEFORE the first repo, with POST ${oe} and body { "namespace": "<name>", "jurisdiction": "${e}" }, then ${s}. A namespace's jurisdiction cannot be changed, and one created implicitly by the first repo create() is unrestricted.`},ie=(e,s)=>{const{error:r,value:t}=R(e,s,F,P);return r===void 0?{flags:t}:{error:r}},ce=(e,s)=>{const r=J(s,e);return r!==""&&r!==".."&&!r.startsWith(`..${Q}`)&&!V(r)},de=(e,s)=>{const{error:r,value:t}=R(e,s,k,L);return r===void 0?{queues:t??[]}:{error:r,queues:[]}},le=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),ue=new Set([".git",".lunora-cache",".wrangler","dist",C,"node_modules"]),pe=["lunora","src"],me=/\benv\s*\.\s*DB\b/,he=/\benv\s*\.\s*AI\b/,D=["ai","aiSearch","analytics","analyticsSql","artifacts","browser","hyperdrive","images","kv","mail","notify","payments","pipelines","r2sql","scheduler","storage","x402"],$=e=>`uses${e.charAt(0).toUpperCase()}${e.slice(1)}`,N=[["usesAuth","@lunora/auth"],["usesCimdWorkers","@lunora/auth/cimd/workers"],["usesX402Charge","@lunora/x402/charge"]],T=[...D.map(e=>[$(e),I[e].moduleSpecifier]),...N].toSorted(([e],[s])=>e.localeCompare(s)),fe=["@lunora/agent","@lunora/agent/sandbox"],ge=new RegExp(String.raw`["'\x60](?:${[...T.map(([,e])=>e),...fe].map(e=>X(e)).join("|")})["'\x60]`,"u"),o=e=>{const{contextProperty:s,moduleSpecifier:r}=I[e];return s===void 0?`${r} is imported`:`${r} is imported or ctx.${s} is read`},Se="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",Ee=()=>{let e;return()=>(e??=new q({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}),e)},be=(e,s,r)=>{const t=r(),n=t.createSourceFile(`/scan/${s.slice(s.lastIndexOf("/")+1)}`,e,{overwrite:!0}),i=W(n);return t.removeSourceFile(n),i},O=(e,s)=>{let r;try{r=B(e,{withFileTypes:!0})}catch{return}for(const t of r){if(t.isDirectory()){ue.has(t.name)||O(S(e,t.name),s);continue}const n=t.name.lastIndexOf(".");n!==-1&&le.has(t.name.slice(n))&&s.push(S(e,t.name))}},ve=(e,s)=>{const{info:r}=z(e,s);return{jurisdiction:r?.jurisdiction,needsD1:r?.hasD1GlobalTable??!1}},Ae=(e,s,r)=>{const t=Ee(),n=S(e,r),i=[],h=[];let c=!1,u=!1;for(const d of s){const l=S(e,d);if(!_(l)||!w(l).isDirectory())continue;const v=[];O(l,v);for(const m of v){const a=j(m,"utf8"),y=ce(m,n);c||=he.test(a),u||=me.test(a),(ge.test(a)||y&&U(a))&&(y?i:h).push(be(a,m,t))}}const f=x(i),g=x([f,...h]),E=new Set([...g.valueImports,...g.dynamicImports]),p=K({contextReads:f.contextReads,valueImports:E});return{...Object.fromEntries([...D.map(d=>[$(d),p.has(d)]),...N.map(([d,l])=>[d,E.has(l)])]),needsD1:u,usesAi:p.has("ai")||c,usesBrowser:p.has("browser")||f.sandboxTools.usesSandboxBrowser,usesWorkerLoader:f.sandboxTools.usesSandboxLoader}},ye=(e,s,r)=>[...e.map(t=>t.exported?`${t.bindingName}/${t.className} (container "${t.exportName}" declared and exported)`:`hint: container "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...s.map(t=>t.exported?`exports.${t.className} (workflow "${t.exportName}" declared and exported)`:`hint: workflow "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...r.map(t=>t.exported?`exports.${t.className} (agent "${t.exportName}" declared and exported)`:`hint: agent "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],xe=(e,s,r)=>[[e.usesAi,`AI (${o("ai")}, or env.AI is 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: ${o("scheduler")}, but no SchedulerDO is exported by the worker entry`],[e.usesStorage,`hint: ${o("storage")}; add an r2_buckets binding (bucket binding names are user-defined)`],[e.usesMail,`hint: ${o("mail")}; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)`],[e.usesPayments,`hint: ${o("payments")}; set the provider secrets in .dev.vars — ${Se}`],[e.usesBrowser,`browser (${o("browser")}, or a sandbox browserTool imported in lunora/) — self-describing { binding: BROWSER }`],[e.usesImages,`images (${o("images")}) — self-describing { binding: IMAGES }`],[e.usesAnalytics,`analytics_engine_datasets (${o("analytics")}) — self-describing { binding: ANALYTICS, dataset }`],[e.usesWorkerLoader,"worker_loaders (jsCodeTool imported in lunora/) — self-describing { binding: LOADER }"],[e.usesAiSearch,`ai_search_namespaces (${o("aiSearch")}) — self-describing { binding: AI_SEARCH, namespace: "default" }; remote-only, so \`lunora dev\` reaches the deployed AI Search service`],[e.usesAnalyticsSql,`analytics (${o("analyticsSql")}) — self-describing { binding: ANALYTICS_SQL }; needs wrangler >= 4.145.0, and is remote-only, so \`lunora dev\` queries the account's live analytics`],[e.usesKv,`hint: ${o("kv")}; add a kv_namespaces binding ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned`],[e.usesHyperdrive,`hint: ${o("hyperdrive")}; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned`],[e.usesPipelines,`hint: ${o("pipelines")}; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, stream }) — the pipeline resource can't be auto-provisioned`],[e.usesArtifacts,`hint: ${ae(r.jurisdiction)}`],[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.usesX402,`hint: ${o("x402")} (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(([n])=>n).map(([,n])=>n),_e=(e,s,r,t=[],n=[],i=[])=>{const h=new Set(e.map(u=>u.className)),c=e.map(u=>`${u.binding}/${u.className} (exported by worker entry)`);return s.needsD1&&c.push("DB (.global() table declared)"),c.push(...ye(t,n,i),...xe(r,h,s)),c},Fe=async e=>{await Y;const s=e.schemaDir??"lunora",r=e.scanDirs??pe,t=Ae(e.projectRoot,r,s),n=Z(e.projectRoot);let i;n.composed?i=[...ee,...Object.entries(se).filter(([a])=>_(S(e.projectRoot,s,C,`${a}.ts`))).map(([,a])=>a)].map(a=>({binding:te[a],className:a})):i=n.path===void 0?[]:re(n.path);const h=ve(e.projectRoot,s),c={...h,needsD1:t.needsD1||h.needsD1},u=A(n,H(e.projectRoot,s).containers,"containers"),f=A(n,ne(e.projectRoot,s).workflows,"workflows"),g=A(n,M(e.projectRoot,s).agents,"agents"),E=[...de(e.projectRoot,s).queues],{flags:p}=ie(e.projectRoot,s),b=p?.provider==="flagship"&&p.mode==="binding"?p.bindingName:void 0,d=_e(i,c,t,u,f,g);b!==void 0&&d.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${b}", app_id }) — the app_id can't be auto-provisioned`);const l=G(e.projectRoot),v=l.error===void 0?l.services:void 0;return l.error!==void 0&&d.push(`hint: lunora.config \`services\` not reconciled — ${l.error}`),d.push(...l.services.map(m=>`${m.binding} → ${m.worker} (lunora.config services.${m.name})`)),{...t,agents:g,containers:u,durableObjects:i,flagshipBinding:b,...c.jurisdiction===void 0?{}:{jurisdiction:c.jurisdiction},needsD1:c.needsD1,queues:E,services:v,signals:d,usesFlags:p!==void 0,workflows:f}},Le=e=>T.filter(([s])=>e[s]).map(([,s])=>s);export{ae as a,Fe as i,Le as p};
@@ -344,11 +344,11 @@ interface InferredBindings {
344
344
  signals: string[];
345
345
  /** `@lunora/ai` is imported, `ctx.ai` read, or `env.AI` used → needs the `ai` Workers AI binding. */
346
346
  usesAi: boolean;
347
- /** `ctx.aiSearch` is used → self-describing `ai_search_namespaces` binding (`AI_SEARCH` on namespace `default`; auto-writeable). */
347
+ /** `@lunora/bindings/ai-search` is value-imported or `ctx.aiSearch` read → self-describing `ai_search_namespaces` binding (`AI_SEARCH` on namespace `default`; auto-writeable). */
348
348
  usesAiSearch: boolean;
349
349
  /** `@lunora/bindings/analytics` is imported or `ctx.analytics` read → self-describing `analytics_engine_datasets` binding (auto-writeable). */
350
350
  usesAnalytics: boolean;
351
- /** `ctx.analyticsSql` is used → self-describing `analytics` binding (`{ binding: ANALYTICS_SQL }`; auto-writeable, wrangler >= 4.145.0). */
351
+ /** `@lunora/bindings/analytics-sql` is value-imported or `ctx.analyticsSql` read → self-describing `analytics` binding (`{ binding: ANALYTICS_SQL }`; auto-writeable, wrangler >= 4.145.0). */
352
352
  usesAnalyticsSql: boolean;
353
353
  /**
354
354
  * `ctx.artifacts` is read or `@lunora/bindings/artifacts` value-imported.
@@ -371,26 +371,26 @@ interface InferredBindings {
371
371
  usesImages: boolean;
372
372
  /** `@lunora/bindings/kv` is imported or `ctx.kv` read (namespace binding name + id are user-defined; hint-only). */
373
373
  usesKv: boolean;
374
- /** `@lunora/mail` is imported (Resend API key must be set in `.dev.vars`; no binding). */
374
+ /** `@lunora/mail` is imported (Resend API key must be set in `.dev.vars`; no binding). No `ctx.mail` helper exists, so only the import counts. */
375
375
  usesMail: boolean;
376
- /** `@lunora/notify` is imported (Web Push needs VAPID/FCM secrets in `.dev.vars`; no binding). */
376
+ /** `@lunora/notify` is imported or `ctx.notify` read (Web Push needs VAPID/FCM secrets in `.dev.vars`; no binding). */
377
377
  usesNotify: boolean;
378
- /** `@lunora/payment` is imported (provider secrets must be set in `.dev.vars`; no binding). */
379
- usesPayment: boolean;
380
- /** `ctx.pipelines` is used (binding needs an un-mintable remote pipeline name; hint-only). */
378
+ /** `@lunora/payment` is imported or `ctx.payments` read (provider secrets must be set in `.dev.vars`; no binding). */
379
+ usesPayments: boolean;
380
+ /** `@lunora/bindings/pipelines` is value-imported or `ctx.pipelines` read (binding needs an un-mintable remote pipeline name; hint-only). */
381
381
  usesPipelines: boolean;
382
- /** `ctx.r2sql` is used (needs the `R2_SQL_*` secrets in `.dev.vars`; no binding). */
382
+ /** `@lunora/bindings/r2sql` is value-imported or `ctx.r2sql` read (needs the `R2_SQL_*` secrets in `.dev.vars`; no binding). */
383
383
  usesR2sql: boolean;
384
- /** `@lunora/scheduler` is imported. */
384
+ /** `@lunora/scheduler` is imported or `ctx.scheduler` read. */
385
385
  usesScheduler: boolean;
386
- /** `@lunora/storage` is imported (R2 bucket binding name is user-defined). */
386
+ /** `@lunora/storage` is imported or `ctx.storage` read under `lunora/` (R2 bucket binding name is user-defined). */
387
387
  usesStorage: boolean;
388
388
  /** `jsCodeTool` is imported from `@lunora/agent` in `lunora/` → self-describing `worker_loaders` binding (`LOADER`). */
389
389
  usesWorkerLoader: boolean;
390
+ /** `@lunora/x402/pay` is imported or `ctx.x402` read — the agent-wallet pay rail signs from a Secrets Store binding paired with a spend policy (ActionCtx-only; hint-only). */
391
+ usesX402: boolean;
390
392
  /** `@lunora/x402/charge` is imported — the charge rail settles USDC to a recipient address (a public `[vars]` entry, user-named; hint-only). */
391
393
  usesX402Charge: boolean;
392
- /** `@lunora/x402/pay` is imported — the agent-wallet pay rail signs from a Secrets Store binding paired with a spend policy (ActionCtx-only; hint-only). */
393
- usesX402Pay: boolean;
394
394
  /** Workflows declared in `lunora/workflows.ts` (exported or not — see {@link InferredWorkflow.exported}). */
395
395
  workflows: InferredWorkflow[];
396
396
  }
@@ -414,8 +414,8 @@ declare const inferLunoraBindings: (options: InferOptions) => Promise<InferredBi
414
414
  *
415
415
  * This is the canonical bridge between binding inference and the package-aware
416
416
  * `.dev.vars.example` scaffolding in `scaffold-dev-variables.ts`. The result is
417
- * a stable, predictable slice of {@link CAPABILITY_SOURCES} source values,
418
- * filtered to the flags that are `true` in `bindings` — in flag-name order.
417
+ * a stable, predictable slice of {@link FLAG_PACKAGES}' packages, filtered to
418
+ * the flags that are `true` in `bindings` — in flag-name order.
419
419
  */
420
420
  declare const packageNamesFromBindings: (bindings: InferredBindings) => string[];
421
421
  export { COMPOSED_WORKER_ENTRY as C, DeployDriver as D, GeneratedClassModule as G, InferredBindings as I, ProjectionPurpose as P, SchemaInfo as S, ToolchainCommand 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, ProjectedConfig as j, SecretRequest as k, TailRequest as l, discoverSchemaInfo as m, inferLunoraBindings as n, packageNamesFromBindings as p };
@@ -344,11 +344,11 @@ interface InferredBindings {
344
344
  signals: string[];
345
345
  /** `@lunora/ai` is imported, `ctx.ai` read, or `env.AI` used → needs the `ai` Workers AI binding. */
346
346
  usesAi: boolean;
347
- /** `ctx.aiSearch` is used → self-describing `ai_search_namespaces` binding (`AI_SEARCH` on namespace `default`; auto-writeable). */
347
+ /** `@lunora/bindings/ai-search` is value-imported or `ctx.aiSearch` read → self-describing `ai_search_namespaces` binding (`AI_SEARCH` on namespace `default`; auto-writeable). */
348
348
  usesAiSearch: boolean;
349
349
  /** `@lunora/bindings/analytics` is imported or `ctx.analytics` read → self-describing `analytics_engine_datasets` binding (auto-writeable). */
350
350
  usesAnalytics: boolean;
351
- /** `ctx.analyticsSql` is used → self-describing `analytics` binding (`{ binding: ANALYTICS_SQL }`; auto-writeable, wrangler >= 4.145.0). */
351
+ /** `@lunora/bindings/analytics-sql` is value-imported or `ctx.analyticsSql` read → self-describing `analytics` binding (`{ binding: ANALYTICS_SQL }`; auto-writeable, wrangler >= 4.145.0). */
352
352
  usesAnalyticsSql: boolean;
353
353
  /**
354
354
  * `ctx.artifacts` is read or `@lunora/bindings/artifacts` value-imported.
@@ -371,26 +371,26 @@ interface InferredBindings {
371
371
  usesImages: boolean;
372
372
  /** `@lunora/bindings/kv` is imported or `ctx.kv` read (namespace binding name + id are user-defined; hint-only). */
373
373
  usesKv: boolean;
374
- /** `@lunora/mail` is imported (Resend API key must be set in `.dev.vars`; no binding). */
374
+ /** `@lunora/mail` is imported (Resend API key must be set in `.dev.vars`; no binding). No `ctx.mail` helper exists, so only the import counts. */
375
375
  usesMail: boolean;
376
- /** `@lunora/notify` is imported (Web Push needs VAPID/FCM secrets in `.dev.vars`; no binding). */
376
+ /** `@lunora/notify` is imported or `ctx.notify` read (Web Push needs VAPID/FCM secrets in `.dev.vars`; no binding). */
377
377
  usesNotify: boolean;
378
- /** `@lunora/payment` is imported (provider secrets must be set in `.dev.vars`; no binding). */
379
- usesPayment: boolean;
380
- /** `ctx.pipelines` is used (binding needs an un-mintable remote pipeline name; hint-only). */
378
+ /** `@lunora/payment` is imported or `ctx.payments` read (provider secrets must be set in `.dev.vars`; no binding). */
379
+ usesPayments: boolean;
380
+ /** `@lunora/bindings/pipelines` is value-imported or `ctx.pipelines` read (binding needs an un-mintable remote pipeline name; hint-only). */
381
381
  usesPipelines: boolean;
382
- /** `ctx.r2sql` is used (needs the `R2_SQL_*` secrets in `.dev.vars`; no binding). */
382
+ /** `@lunora/bindings/r2sql` is value-imported or `ctx.r2sql` read (needs the `R2_SQL_*` secrets in `.dev.vars`; no binding). */
383
383
  usesR2sql: boolean;
384
- /** `@lunora/scheduler` is imported. */
384
+ /** `@lunora/scheduler` is imported or `ctx.scheduler` read. */
385
385
  usesScheduler: boolean;
386
- /** `@lunora/storage` is imported (R2 bucket binding name is user-defined). */
386
+ /** `@lunora/storage` is imported or `ctx.storage` read under `lunora/` (R2 bucket binding name is user-defined). */
387
387
  usesStorage: boolean;
388
388
  /** `jsCodeTool` is imported from `@lunora/agent` in `lunora/` → self-describing `worker_loaders` binding (`LOADER`). */
389
389
  usesWorkerLoader: boolean;
390
+ /** `@lunora/x402/pay` is imported or `ctx.x402` read — the agent-wallet pay rail signs from a Secrets Store binding paired with a spend policy (ActionCtx-only; hint-only). */
391
+ usesX402: boolean;
390
392
  /** `@lunora/x402/charge` is imported — the charge rail settles USDC to a recipient address (a public `[vars]` entry, user-named; hint-only). */
391
393
  usesX402Charge: boolean;
392
- /** `@lunora/x402/pay` is imported — the agent-wallet pay rail signs from a Secrets Store binding paired with a spend policy (ActionCtx-only; hint-only). */
393
- usesX402Pay: boolean;
394
394
  /** Workflows declared in `lunora/workflows.ts` (exported or not — see {@link InferredWorkflow.exported}). */
395
395
  workflows: InferredWorkflow[];
396
396
  }
@@ -414,8 +414,8 @@ declare const inferLunoraBindings: (options: InferOptions) => Promise<InferredBi
414
414
  *
415
415
  * This is the canonical bridge between binding inference and the package-aware
416
416
  * `.dev.vars.example` scaffolding in `scaffold-dev-variables.ts`. The result is
417
- * a stable, predictable slice of {@link CAPABILITY_SOURCES} source values,
418
- * filtered to the flags that are `true` in `bindings` — in flag-name order.
417
+ * a stable, predictable slice of {@link FLAG_PACKAGES}' packages, filtered to
418
+ * the flags that are `true` in `bindings` — in flag-name order.
419
419
  */
420
420
  declare const packageNamesFromBindings: (bindings: InferredBindings) => string[];
421
421
  export { COMPOSED_WORKER_ENTRY as C, DeployDriver as D, GeneratedClassModule as G, InferredBindings as I, ProjectionPurpose as P, SchemaInfo as S, ToolchainCommand 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, ProjectedConfig as j, SecretRequest as k, TailRequest as l, discoverSchemaInfo as m, inferLunoraBindings as n, packageNamesFromBindings as p };
@@ -0,0 +1 @@
1
+ import"./discoverAgentInfo-CTdCSfYM.mjs";import{i as s,p as e}from"./infer-bindings-B-BFynp2.mjs";import"./discoverContainerInfo-EhZtEBQs.mjs";import"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import"./discoverSchemaInfo-BguahM6z.mjs";import"./COMPOSED_WORKER_ENTRY-C69wqbSP.mjs";import"./discoverWorkflowInfo-BsPvlo6O.mjs";export{s as inferLunoraBindings,e as packageNamesFromBindings};
@@ -1 +1 @@
1
- import{i as p}from"./infer-bindings-D5S20KYQ.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-CiQM3BkI.mjs";import{reconcileWranglerBindings as $}from"./collectExportGaps-BOeuCzWm.mjs";import{reconcileWranglerCompatibilityDate as g}from"./reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{reconcileWranglerCrons as m,describePreservedCrons as w}from"./describePreservedCrons-7gaDLxWx.mjs";const j=async(i,t,a)=>{try{const n=await p({projectRoot:i.projectRoot,schemaDir:i.schemaDir}),e=$(i.projectRoot,n),o=e.wranglerPath??"wrangler.jsonc";if(e.added.length>0&&t.info?.(`${r} inferred bindings → ${e.added.join(", ")} (written to ${o})`),e.updated.length>0&&t.info?.(`${r} updated bindings → ${e.updated.join(", ")} (written to ${o})`),e.devConfig!==void 0){const{added:s,path:d,updated:f}=e.devConfig;t.info?.(`${r} dev sidecar bindings → ${[...s,...f].join(", ")} (written to ${d})`)}for(const s of e.warnings)t.warn(`${r} ${s}`);e.exportGaps.length>0&&a?.(e.exportGaps)}catch(n){const e=n instanceof Error?n.message:String(n);t.warn(`${r} binding inference skipped: ${e}`)}},c=new Map,u=(i,t,a)=>{try{const n=m(i,t);n.changed&&a.info?.(`${r} synced ${t.length.toFixed(0)} cron trigger(s) into ${n.wranglerPath??"wrangler.jsonc"}`);for(const s of n.warnings)a.warn(`${r} ${s}`);const e=n.preserved.join("\0"),o=w(n.preserved);o!==void 0&&(n.changed||c.get(i)!==e)&&a.info?.(`${r} ${o}`),c.set(i,e)}catch(n){const e=n instanceof Error?n.message:String(n);a.warn(`${r} cron trigger sync skipped: ${e}`)}try{const n=g(i);n.changed&&a.info?.(`${r} bumped compatibility_date to ${n.date??"unknown"} (Workers Cache enabled) → ${n.wranglerPath??"wrangler.jsonc"}`)}catch(n){const e=n instanceof Error?n.message:String(n);a.warn(`${r} compatibility date sync skipped: ${e}`)}};export{j as reconcileBindingsSafely,u as reconcileWranglerExtras};
1
+ import{i as p}from"./infer-bindings-B-BFynp2.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-CiQM3BkI.mjs";import{reconcileWranglerBindings as $}from"./collectExportGaps-BEkTtsyv.mjs";import{reconcileWranglerCompatibilityDate as g}from"./reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{reconcileWranglerCrons as m,describePreservedCrons as w}from"./describePreservedCrons-7gaDLxWx.mjs";const j=async(i,t,a)=>{try{const n=await p({projectRoot:i.projectRoot,schemaDir:i.schemaDir}),e=$(i.projectRoot,n),o=e.wranglerPath??"wrangler.jsonc";if(e.added.length>0&&t.info?.(`${r} inferred bindings → ${e.added.join(", ")} (written to ${o})`),e.updated.length>0&&t.info?.(`${r} updated bindings → ${e.updated.join(", ")} (written to ${o})`),e.devConfig!==void 0){const{added:s,path:d,updated:f}=e.devConfig;t.info?.(`${r} dev sidecar bindings → ${[...s,...f].join(", ")} (written to ${d})`)}for(const s of e.warnings)t.warn(`${r} ${s}`);e.exportGaps.length>0&&a?.(e.exportGaps)}catch(n){const e=n instanceof Error?n.message:String(n);t.warn(`${r} binding inference skipped: ${e}`)}},c=new Map,u=(i,t,a)=>{try{const n=m(i,t);n.changed&&a.info?.(`${r} synced ${t.length.toFixed(0)} cron trigger(s) into ${n.wranglerPath??"wrangler.jsonc"}`);for(const s of n.warnings)a.warn(`${r} ${s}`);const e=n.preserved.join("\0"),o=w(n.preserved);o!==void 0&&(n.changed||c.get(i)!==e)&&a.info?.(`${r} ${o}`),c.set(i,e)}catch(n){const e=n instanceof Error?n.message:String(n);a.warn(`${r} cron trigger sync skipped: ${e}`)}try{const n=g(i);n.changed&&a.info?.(`${r} bumped compatibility_date to ${n.date??"unknown"} (Workers Cache enabled) → ${n.wranglerPath??"wrangler.jsonc"}`)}catch(n){const e=n instanceof Error?n.message:String(n);a.warn(`${r} compatibility date sync skipped: ${e}`)}};export{j as reconcileBindingsSafely,u as reconcileWranglerExtras};
@@ -0,0 +1 @@
1
+ import{existsSync as p,readFileSync as m}from"node:fs";import{join as f,basename as d}from"node:path";import{Project as S,SyntaxKind as I,Node as t}from"ts-morph";const n="lunora",v=["vite.config.js","vite.config.mjs","vite.config.ts","vite.config.cjs","vite.config.mts","vite.config.cts"],y="@lunora/vite",l="lunora",N=u=>{const i=v.map(e=>f(u,e)).find(e=>p(e));if(i===void 0)return n;let r;try{r=m(i,"utf8")}catch{return n}const s=new S({compilerOptions:{allowJs:!0},skipFileDependencyResolution:!0,skipLoadingLibFiles:!0,useInMemoryFileSystem:!0}).createSourceFile(d(i),r),g=new Set(s.getImportDeclarations().filter(e=>e.getModuleSpecifierValue()===y).flatMap(e=>e.getNamedImports()).filter(e=>e.getName()===l).map(e=>e.getAliasNode()?.getText()??l));for(const e of s.getDescendantsOfKind(I.CallExpression)){const[c]=e.getArguments();if(!g.has(e.getExpression().getText())||!t.isObjectLiteralExpression(c))continue;const a=c.getProperty("schemaDir"),o=t.isPropertyAssignment(a)?a.getInitializer():void 0;if(t.isStringLiteral(o)||t.isNoSubstitutionTemplateLiteral(o))return o.getLiteralValue()}return n};export{N as default};
@@ -1 +1 @@
1
- const l=[{of:e=>e.schedules===void 0?void 0:[...e.schedules],path:["schedules"]},{of:e=>e.limits?.steps,path:["limits","steps"]},{of:e=>e.defaultRetention?.successRetention,path:["default_retention","success_retention"]},{of:e=>e.defaultRetention?.errorRetention,path:["default_retention","error_retention"]}],N=[...new Set(l.map(({path:e})=>e[0]))],m=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),f=(e,n)=>{let a=e;for(const s of n)a=m(a)?a[s]:void 0;return a},O=e=>{const n={};for(const{of:a,path:s}of l){const t=a(e);if(t===void 0)continue;const[i,o]=s;n[i]=o===void 0?t:{...n[i],[o]:t}}return n},D=(e,n,a)=>{if(n.length===0)return;const s=e.vectorize??[],t=new Set(s.filter(Boolean).map(i=>i?.index_name));for(const i of n)t.has(i)||a.push(`schema declares vector index "${i}"; wrangler "vectorize" must include a binding with index_name "${i}"`)},$=new Set(["basic","dev","lite","standard","standard-1","standard-2","standard-3","standard-4"]),k={disk_mb:2e4,memory_mib:12288,vcpu:4},p=1,w=(e,n,a)=>{const s=e.instance_type;if(s===void 0)return;if(typeof s=="string"){$.has(s)||a.push(`${n} has unknown instance_type "${s}" — expected lite, basic, standard-1..4, or a custom { vcpu, memory_mib, disk_mb } object`);return}for(const[o,r]of Object.entries(k)){const d=s[o];d!==void 0&&(typeof d!="number"||d<=0||d>r)&&a.push(`${n} custom instance_type ${o} must be a positive number ≤ ${String(r)} (got ${String(d)})`)}const{memory_mib:t,vcpu:i}=s;typeof i=="number"&&i>0&&i<p&&a.push(`${n} custom instance_type needs ≥ ${String(p)} vCPU (got ${String(i)}) — use the named "lite" or "basic" instance type below 1 vCPU`),typeof i=="number"&&typeof t=="number"&&t<i*3072&&a.push(`${n} custom instance_type needs ≥ 3 GiB (3072 MiB) memory per vCPU (got ${String(t)} MiB for ${String(i)} vCPU)`)},S=(e,n,a)=>{for(const s of["image","instance_type","max_instances"])e[s]!==void 0&&a.push(`${n} sets "${s}", which the durable_object scheduling policy does not take — the Durable Object picks image and size at start`);for(const[s,t]of Object.entries(e.images??{}))[t?.dockerfile,t?.image].filter(o=>typeof o=="string"&&o.length>0).length!==1&&a.push(`${n} images["${s}"] must set exactly one of "dockerfile" or "image"`)},j=(e,n,a)=>{const{boundClasses:s,classKinds:t,errors:i,warnings:o}=a;if(!e||typeof e!="object"||typeof e.class_name!="string"||e.class_name.length===0){i.push(`${n} must have a non-empty "class_name" naming its container-enabled Durable Object class`);return}const r=e.scheduling_policy==="durable_object";e.scheduling_policy!==void 0&&e.scheduling_policy!=="default"&&!r&&i.push(`${n} ("${e.class_name}") has unknown scheduling_policy "${e.scheduling_policy}" — expected "default" or "durable_object"`),r?S(e,`${n} ("${e.class_name}")`,i):(typeof e.image!="string"||e.image.length===0)&&i.push(`${n} ("${e.class_name}") must have an "image" — a Dockerfile path or a registry reference`),s.has(e.class_name)||i.push(`${n} 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 d=t.get(e.class_name);d!=="sqlite"&&i.push(d==="classic"?`${n} class "${e.class_name}" is registered via "new_classes" but containers require SQLite-backed DOs — move it to "new_sqlite_classes"`:`${n} class "${e.class_name}" is missing from migrations — add a migration entry with "new_sqlite_classes": ["${e.class_name}"]`),w(e,`${n} ("${e.class_name}")`,i),e.max_instances===void 0&&!r&&o.push(`${n} ("${e.class_name}") declares no max_instances — set a cap so a traffic spike can't fan out unbounded container spend`)},c=e=>typeof e=="string"&&e.length>0,g=e=>Array.isArray(e)?e.filter(n=>n!==null&&typeof n=="object"):[],b=e=>Array.isArray(e)?e.filter(n=>c(n)):[],_=e=>{const n=new Map;for(const a of g(e)){for(const s of b(a.new_classes))n.set(s,"classic");for(const s of b(a.new_sqlite_classes))n.set(s,"sqlite");for(const s of g(a.renamed_classes))if(c(s.from)&&c(s.to)){const t=n.get(s.from)??"sqlite";n.delete(s.from),n.set(s.to,t)}for(const s of b(a.deleted_classes))n.delete(s)}return n},M=e=>new Set(_(e).keys()),U=(e,n)=>{const a=M(e.migrations);for(const s of g(e.durable_objects?.bindings))s.script_name===void 0&&c(s.class_name)&&!a.has(s.class_name)&&n.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`)},B=(e,n,a)=>{if(e.containers===void 0)return;if(!Array.isArray(e.containers)){n.push("containers must be an array of { class_name, image, ... } entries");return}const s=e.containers;if(s.length===0)return;const t=new Set(g(e.durable_objects?.bindings).map(o=>o.class_name)),i=_(e.migrations);for(const[o,r]of s.entries())j(r,`containers[${String(o)}]`,{boundClasses:t,classKinds:i,errors:n,warnings:a});e.observability?.enabled!==!0&&a.push('containers are configured but observability is not enabled — container logs will not be captured (add { "observability": { "enabled": true } })')},u=e=>e,h=(e,n,a,s)=>{if(e!==void 0){if(!Array.isArray(e)){s.push(a.arrayMessage);return}for(const[t,i]of u(e).entries()){const o=`${n}[${String(t)}]`;if(!i||typeof i!="object"){s.push(a.objectMessage(o));continue}for(const r of a.fields)c(i[r.field])||s.push(r.message(o))}}},L={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. MY_WORKFLOW)`},{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`},E=(e,n)=>e===void 0||n&&c(e)||Array.isArray(e)&&e.length>0&&e.every(s=>c(s))?void 0:"schedules must be a non-empty array of cron expression strings",A=e=>{if(e!==void 0)return m(e)?e.steps===void 0||Number.isInteger(e.steps)&&e.steps>0?void 0:"limits.steps must be a positive integer":"limits must be an object"},x=e=>e===void 0?[]:m(e)?["success_retention","error_retention"].filter(n=>e[n]!==void 0&&!c(e[n])).map(n=>`default_retention.${n} must be a duration string (e.g. "7 days")`):["default_retention must be an object"],y=(e,n,a,s)=>{const t=[E(e.schedules,a),A(e.limits),...x(e.default_retention)];for(const i of t)i!==void 0&&s.push(`${n}.${i}`)},q=(e,n)=>l.map(({path:a})=>a).filter(a=>{const s=f(e,a),t=f(n,a),i=typeof t=="string"&&a[0]==="schedules"?[t]:t;return s!==void 0&&t!==void 0&&JSON.stringify(s)!==JSON.stringify(i)}).map(a=>a.join(".")),R=(e,n,a,s)=>{const t=`exports["${e}"]`,i=String(n.name);for(const o of a){if(!m(o)||o.name!==n.name)continue;const r=`workflows entry "${String(o.binding)}"`;if(o.script_name!==void 0){s.push(`${r} binds workflow "${i}" in another Worker, but ${t} declares a workflow with that name here — workflow names are unique per account`);continue}o.class_name!==e&&s.push(`${r} and ${t} both declare workflow "${i}" but name different classes ("${String(o.class_name)}" vs "${e}")`);for(const d of q(o,n))s.push(`${r} and ${t} set ${d} to different values for workflow "${i}" — set it in one place`)}},T=(e,n)=>{const a=Array.isArray(e.workflows)?u(e.workflows):[];for(const[t,i]of a.entries())m(i)&&y(i,`workflows[${String(t)}]`,!1,n);const s=m(e.exports)?Object.entries(e.exports):[];for(const[t,i]of s)!m(i)||i.type!=="workflow"||(c(i.name)?(y(i,`exports["${t}"]`,!0,n),R(t,i,a,n)):n.push(`exports["${t}"] is a workflow export and must have a non-empty "name" naming the deployed workflow`))},I={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`},C={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`},F=(e,n)=>{if(e.queues!==void 0){if(typeof e.queues!="object"||Array.isArray(e.queues)){n.push("queues must be a { producers, consumers } object");return}h(e.queues.producers,"queues.producers",I,n),h(e.queues.consumers,"queues.consumers",C,n)}},W={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:n=>`${n} must have a non-empty "${e}"`})),objectMessage:e=>`${e} must be a { binding, store_id, secret_name } object`},P=[{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,n)=>`${e} ("${n}") 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,n)=>`${e} ("${n}") 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,n)=>`${e} ("${n}") 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,n)=>`${e} ("${n}") 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,n)=>`${e} ("${n}") has no "dataset" — it defaults to the binding name; set it explicitly to avoid drift`,key:"analytics_engine_datasets"}],G=(e,n,a,s)=>{const t=e[n.key];if(t!==void 0){if(!Array.isArray(t)){a.push(n.arrayMessage);return}for(const[i,o]of u(t).entries()){const r=`${n.key}[${String(i)}]`;if(!o||typeof o!="object"||!c(o.binding)){a.push(n.bindingMessage(r));continue}(typeof n.hintField=="string"?[n.hintField]:n.hintField).some(v=>c(o[v]))||s.push(n.hintMessage(r,o.binding))}}},K=[{key:"analytics",message:'analytics must be an object with a non-empty "binding" (e.g. { "binding": "ANALYTICS_SQL" })'},{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" })'},{key:"media",message:'media must be an object with a non-empty "binding" (e.g. { "binding": "MEDIA" })'},{key:"stream",message:'stream must be an object with a non-empty "binding" (e.g. { "binding": "STREAM" })'}],Q=(e,n,a)=>{const s=e[n.key];s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)||!c(s.binding))&&a.push(n.message)},V=[{arrayMessage:"ai_search_namespaces must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the AI Search binding`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the AI Search namespace (every account has "default")`}],key:"ai_search_namespaces",objectMessage:e=>`${e} must be a { binding, namespace } object`},{arrayMessage:"ai_search must be an array of { binding, instance_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the AI Search binding`},{field:"instance_name",message:e=>`${e} must have a non-empty "instance_name" naming an existing AI Search instance`}],key:"ai_search",objectMessage:e=>`${e} must be a { binding, instance_name } object`},{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`},{arrayMessage:"vpc_services must be an array of { binding, service_id } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the VPC Service binding`},{field:"service_id",message:e=>`${e} must have a non-empty "service_id" (create one with \`wrangler vpc service create\`)`}],key:"vpc_services",objectMessage:e=>`${e} must be a { binding, service_id } object`},{arrayMessage:"artifacts must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Artifacts binding`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the Artifacts namespace`}],key:"artifacts",objectMessage:e=>`${e} must be a { binding, namespace } object`}],z=(e,n,a)=>{n?.hasD1GlobalTable&&!g(e.d1_databases).some(s=>s.binding==="DB")&&a.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'),n?.hasHyperdriveGlobalTable&&g(e.hyperdrive).length===0&&a.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)')},H=(e,n)=>{const{d1_databases:a}=e;if(a!==void 0){if(!Array.isArray(a)){n.push("d1_databases must be an array of { binding, database_id | database_name } entries");return}for(const[s,t]of u(a).entries()){const i=`d1_databases[${String(s)}]`;if(!t||typeof t!="object"){n.push(`${i} must be a { binding, database_id | database_name } object`);continue}c(t.binding)||n.push(`${i} must have a non-empty "binding" naming the D1 binding`),!c(t.database_id)&&!c(t.database_name)&&n.push(`${i} must have a "database_id" or a "database_name" — run \`wrangler d1 create\` and set one, or the binding can't resolve`)}}},Y=(e,n)=>{const{vpc_networks:a}=e;if(a!==void 0){if(!Array.isArray(a)){n.push("vpc_networks must be an array of { binding, tunnel_id | network_id } entries");return}for(const[s,t]of u(a).entries()){const i=`vpc_networks[${String(s)}]`;if(!t||typeof t!="object"){n.push(`${i} must be a { binding, tunnel_id | network_id } object`);continue}c(t.binding)||n.push(`${i} must have a non-empty "binding" naming the VPC Network binding`),c(t.tunnel_id)===c(t.network_id)&&n.push(`${i} must set exactly one of "tunnel_id" (a Cloudflare Tunnel) or "network_id" ("cf1:network" for Cloudflare Mesh)`)}}};export{P as H,V as R,K as S,L as W,z as a,H as b,D as c,B as d,h as e,T as f,F as g,G as h,Q as i,Y as j,W as k,m as l,c as m,N as n,g as o,b as p,l as q,f as s,U as v,O as w};
1
+ import{CUSTOM_INSTANCE_TYPE_LIMITS as f,CUSTOM_INSTANCE_MIN_MEMORY_MIB_PER_VCPU as y}from"@lunora/container";const g=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),d=e=>typeof e=="string"&&e.length>0,h=[{of:e=>e.schedules===void 0?void 0:[...e.schedules],path:["schedules"]},{of:e=>e.limits?.steps,path:["limits","steps"]},{of:e=>e.defaultRetention?.successRetention,path:["default_retention","success_retention"]},{of:e=>e.defaultRetention?.errorRetention,path:["default_retention","error_retention"]}],U=[...new Set(h.map(({path:e})=>e[0]))],_=(e,n)=>{let a=e;for(const s of n)a=g(a)?a[s]:void 0;return a},B=e=>{const n={};for(const{of:a,path:s}of h){const t=a(e);if(t===void 0)continue;const[i,o]=s;n[i]=o===void 0?t:{...n[i],[o]:t}}return n},L=(e,n,a)=>{if(n.length===0)return;const s=e.vectorize??[],t=new Set(s.filter(Boolean).map(i=>i?.index_name));for(const i of n)t.has(i)||a.push(`schema declares vector index "${i}"; wrangler "vectorize" must include a binding with index_name "${i}"`)},M=new Set(["basic","dev","lite","standard","standard-1","standard-2","standard-3","standard-4"]),S={disk_mb:f.diskMb,memory_mib:f.memoryMib,vcpu:{...f.vcpu,hint:'use the named "lite" or "basic" instance type below 1 vCPU'}},j=(e,n,a)=>{const s=e.instance_type;if(s===void 0)return;if(typeof s=="string"){M.has(s)||a.push(`${n} has unknown instance_type "${s}" — expected lite, basic, standard-1..4, or a custom { vcpu, memory_mib, disk_mb } object`);return}for(const[o,{hint:r,max:c,min:u}]of Object.entries(S)){const m=s[o];if(m!==void 0&&(typeof m!="number"||Number.isNaN(m)||m<u||m>c)){const w=r!==void 0&&typeof m=="number"&&m<u?` — ${r}`:"";a.push(`${n} custom instance_type ${o} must be a number in ${String(u)}–${String(c)} (got ${String(m)})${w}`)}}const{memory_mib:t,vcpu:i}=s;typeof i=="number"&&typeof t=="number"&&t<i*y&&a.push(`${n} custom instance_type needs ≥ 3 GiB (${String(y)} MiB) memory per vCPU (got ${String(t)} MiB for ${String(i)} vCPU)`)},E=(e,n,a)=>{for(const s of["image","instance_type","max_instances"])e[s]!==void 0&&a.push(`${n} sets "${s}", which the durable_object scheduling policy does not take — the Durable Object picks image and size at start`);for(const[s,t]of Object.entries(e.images??{}))[t?.dockerfile,t?.image].filter(o=>typeof o=="string"&&o.length>0).length!==1&&a.push(`${n} images["${s}"] must set exactly one of "dockerfile" or "image"`)},A=(e,n,a)=>{const{boundClasses:s,classKinds:t,errors:i,warnings:o}=a;if(!e||typeof e!="object"||typeof e.class_name!="string"||e.class_name.length===0){i.push(`${n} must have a non-empty "class_name" naming its container-enabled Durable Object class`);return}const r=e.scheduling_policy==="durable_object";e.scheduling_policy!==void 0&&e.scheduling_policy!=="default"&&!r&&i.push(`${n} ("${e.class_name}") has unknown scheduling_policy "${e.scheduling_policy}" — expected "default" or "durable_object"`),r?E(e,`${n} ("${e.class_name}")`,i):(typeof e.image!="string"||e.image.length===0)&&i.push(`${n} ("${e.class_name}") must have an "image" — a Dockerfile path or a registry reference`),s.has(e.class_name)||i.push(`${n} 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 c=t.get(e.class_name);c!=="sqlite"&&i.push(c==="classic"?`${n} class "${e.class_name}" is registered via "new_classes" but containers require SQLite-backed DOs — move it to "new_sqlite_classes"`:`${n} class "${e.class_name}" is missing from migrations — add a migration entry with "new_sqlite_classes": ["${e.class_name}"]`),j(e,`${n} ("${e.class_name}")`,i),e.max_instances===void 0&&!r&&o.push(`${n} ("${e.class_name}") declares no max_instances — set a cap so a traffic spike can't fan out unbounded container spend`)},b=e=>Array.isArray(e)?e.filter(n=>n!==null&&typeof n=="object"):[],p=e=>Array.isArray(e)?e.filter(n=>d(n)):[],k=e=>{const n=new Map;for(const a of b(e)){for(const s of p(a.new_classes))n.set(s,"classic");for(const s of p(a.new_sqlite_classes))n.set(s,"sqlite");for(const s of b(a.renamed_classes))if(d(s.from)&&d(s.to)){const t=n.get(s.from)??"sqlite";n.delete(s.from),n.set(s.to,t)}for(const s of p(a.deleted_classes))n.delete(s)}return n},x=e=>new Set(k(e).keys()),F=(e,n)=>{const a=x(e.migrations);for(const s of b(e.durable_objects?.bindings))s.script_name===void 0&&d(s.class_name)&&!a.has(s.class_name)&&n.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`)},P=(e,n,a)=>{if(e.containers===void 0)return;if(!Array.isArray(e.containers)){n.push("containers must be an array of { class_name, image, ... } entries");return}const s=e.containers;if(s.length===0)return;const t=new Set(b(e.durable_objects?.bindings).map(o=>o.class_name)),i=k(e.migrations);for(const[o,r]of s.entries())A(r,`containers[${String(o)}]`,{boundClasses:t,classKinds:i,errors:n,warnings:a});e.observability?.enabled!==!0&&a.push('containers are configured but observability is not enabled — container logs will not be captured (add { "observability": { "enabled": true } })')},l=e=>e,v=(e,n,a,s)=>{if(e!==void 0){if(!Array.isArray(e)){s.push(a.arrayMessage);return}for(const[t,i]of l(e).entries()){const o=`${n}[${String(t)}]`;if(!i||typeof i!="object"){s.push(a.objectMessage(o));continue}for(const r of a.fields)d(i[r.field])||s.push(r.message(o))}}},W={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. MY_WORKFLOW)`},{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`},I=(e,n)=>e===void 0||n&&d(e)||Array.isArray(e)&&e.length>0&&e.every(s=>d(s))?void 0:"schedules must be a non-empty array of cron expression strings",R=e=>{if(e!==void 0)return g(e)?e.steps===void 0||Number.isInteger(e.steps)&&e.steps>0?void 0:"limits.steps must be a positive integer":"limits must be an object"},q=e=>e===void 0?[]:g(e)?["success_retention","error_retention"].filter(n=>e[n]!==void 0&&!d(e[n])).map(n=>`default_retention.${n} must be a duration string (e.g. "7 days")`):["default_retention must be an object"],$=(e,n,a,s)=>{const t=[I(e.schedules,a),R(e.limits),...q(e.default_retention)];for(const i of t)i!==void 0&&s.push(`${n}.${i}`)},N=(e,n)=>h.map(({path:a})=>a).filter(a=>{const s=_(e,a),t=_(n,a),i=typeof t=="string"&&a[0]==="schedules"?[t]:t;return s!==void 0&&t!==void 0&&JSON.stringify(s)!==JSON.stringify(i)}).map(a=>a.join(".")),O=(e,n,a,s)=>{const t=`exports["${e}"]`,i=String(n.name);for(const o of a){if(!g(o)||o.name!==n.name)continue;const r=`workflows entry "${String(o.binding)}"`;if(o.script_name!==void 0){s.push(`${r} binds workflow "${i}" in another Worker, but ${t} declares a workflow with that name here — workflow names are unique per account`);continue}o.class_name!==e&&s.push(`${r} and ${t} both declare workflow "${i}" but name different classes ("${String(o.class_name)}" vs "${e}")`);for(const c of N(o,n))s.push(`${r} and ${t} set ${c} to different values for workflow "${i}" — set it in one place`)}},G=(e,n)=>{const a=Array.isArray(e.workflows)?l(e.workflows):[];for(const[t,i]of a.entries())g(i)&&$(i,`workflows[${String(t)}]`,!1,n);const s=g(e.exports)?Object.entries(e.exports):[];for(const[t,i]of s)!g(i)||i.type!=="workflow"||(d(i.name)?($(i,`exports["${t}"]`,!0,n),O(t,i,a,n)):n.push(`exports["${t}"] is a workflow export and must have a non-empty "name" naming the deployed workflow`))},C={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`},T={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`},K=(e,n)=>{if(e.queues!==void 0){if(typeof e.queues!="object"||Array.isArray(e.queues)){n.push("queues must be a { producers, consumers } object");return}v(e.queues.producers,"queues.producers",C,n),v(e.queues.consumers,"queues.consumers",T,n)}},Q={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:n=>`${n} must have a non-empty "${e}"`})),objectMessage:e=>`${e} must be a { binding, store_id, secret_name } object`},V=[{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,n)=>`${e} ("${n}") 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,n)=>`${e} ("${n}") 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,n)=>`${e} ("${n}") 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,n)=>`${e} ("${n}") 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,n)=>`${e} ("${n}") has no "dataset" — it defaults to the binding name; set it explicitly to avoid drift`,key:"analytics_engine_datasets"}],Y=(e,n,a,s)=>{const t=e[n.key];if(t!==void 0){if(!Array.isArray(t)){a.push(n.arrayMessage);return}for(const[i,o]of l(t).entries()){const r=`${n.key}[${String(i)}]`;if(!o||typeof o!="object"||!d(o.binding)){a.push(n.bindingMessage(r));continue}(typeof n.hintField=="string"?[n.hintField]:n.hintField).some(u=>d(o[u]))||s.push(n.hintMessage(r,o.binding))}}},z=[{key:"analytics",message:'analytics must be an object with a non-empty "binding" (e.g. { "binding": "ANALYTICS_SQL" })'},{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" })'},{key:"media",message:'media must be an object with a non-empty "binding" (e.g. { "binding": "MEDIA" })'},{key:"stream",message:'stream must be an object with a non-empty "binding" (e.g. { "binding": "STREAM" })'}],H=(e,n,a)=>{const s=e[n.key];s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)||!d(s.binding))&&a.push(n.message)},J=[{arrayMessage:"ai_search_namespaces must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the AI Search binding`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the AI Search namespace (every account has "default")`}],key:"ai_search_namespaces",objectMessage:e=>`${e} must be a { binding, namespace } object`},{arrayMessage:"ai_search must be an array of { binding, instance_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the AI Search binding`},{field:"instance_name",message:e=>`${e} must have a non-empty "instance_name" naming an existing AI Search instance`}],key:"ai_search",objectMessage:e=>`${e} must be a { binding, instance_name } object`},{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`},{arrayMessage:"vpc_services must be an array of { binding, service_id } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the VPC Service binding`},{field:"service_id",message:e=>`${e} must have a non-empty "service_id" (create one with \`wrangler vpc service create\`)`}],key:"vpc_services",objectMessage:e=>`${e} must be a { binding, service_id } object`},{arrayMessage:"artifacts must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Artifacts binding`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the Artifacts namespace`}],key:"artifacts",objectMessage:e=>`${e} must be a { binding, namespace } object`}],X=(e,n,a)=>{n?.hasD1GlobalTable&&!b(e.d1_databases).some(s=>s.binding==="DB")&&a.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'),n?.hasHyperdriveGlobalTable&&b(e.hyperdrive).length===0&&a.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)')},Z=(e,n)=>{const{d1_databases:a}=e;if(a!==void 0){if(!Array.isArray(a)){n.push("d1_databases must be an array of { binding, database_id | database_name } entries");return}for(const[s,t]of l(a).entries()){const i=`d1_databases[${String(s)}]`;if(!t||typeof t!="object"){n.push(`${i} must be a { binding, database_id | database_name } object`);continue}d(t.binding)||n.push(`${i} must have a non-empty "binding" naming the D1 binding`),!d(t.database_id)&&!d(t.database_name)&&n.push(`${i} must have a "database_id" or a "database_name" — run \`wrangler d1 create\` and set one, or the binding can't resolve`)}}},ee=(e,n)=>{const{vpc_networks:a}=e;if(a!==void 0){if(!Array.isArray(a)){n.push("vpc_networks must be an array of { binding, tunnel_id | network_id } entries");return}for(const[s,t]of l(a).entries()){const i=`vpc_networks[${String(s)}]`;if(!t||typeof t!="object"){n.push(`${i} must be a { binding, tunnel_id | network_id } object`);continue}d(t.binding)||n.push(`${i} must have a non-empty "binding" naming the VPC Network binding`),d(t.tunnel_id)===d(t.network_id)&&n.push(`${i} must set exactly one of "tunnel_id" (a Cloudflare Tunnel) or "network_id" ("cf1:network" for Cloudflare Mesh)`)}}};export{V as H,J as R,z as S,W,X as a,Z as b,L as c,P as d,v as e,G as f,K as g,Y as h,H as i,ee as j,Q as k,g as l,d as m,U as n,b as o,p,h as q,_ as s,F as v,B as w};
@@ -0,0 +1 @@
1
+ import{l as u,m as f,o as v}from"./validate-bindings-DFAcr5wA.mjs";const _=new Set(["1","enabled","on","true","yes"]),A=s=>typeof s=="string"&&_.has(s.trim().toLowerCase()),b=(s,t,e,n)=>{s!==void 0&&typeof s!="boolean"&&e.push(`${t} must be a boolean${n===void 0?"":` (${n})`}`)},O=(s,t,e)=>{s!==void 0&&(typeof s!="number"||Number.isNaN(s)||s<0||s>1)&&e.push(`${t} must be a number in [0, 1] (the fraction of requests sampled)`)},$=(s,t,e)=>{const n=s.send_email;if(n===void 0)return;if(!Array.isArray(n)){t.push("send_email must be an array of { name, destination_address? } entries");return}const i=n;for(const[o,a]of i.entries())(!a||typeof a!="object"||typeof a.name!="string"||a.name.length===0)&&e.push(`send_email[${String(o)}] has no non-empty "name" naming the send-email binding — set one before deploying`)},N=(s,t)=>{b(s.logpush,"logpush",t,'set "logpush": true to enable Cloudflare Logpush')},k=(s,t)=>{const e=s.secrets;if(e===void 0)return;const n=typeof e=="object"&&e!==null&&!Array.isArray(e)?e.required:void 0;(!Array.isArray(n)||n.some(i=>typeof i!="string"||i===""))&&t.push('secrets must be an object whose "required" is an array of secret names (e.g. { "required": ["API_KEY"] })')},m=3e5,I=(s,t)=>{const{limits:e}=s;if(e===void 0)return;if(typeof e!="object"||Array.isArray(e)){t.push('limits must be an object (e.g. { "cpu_ms": 30000 })');return}const n=e.cpu_ms;if(n!==void 0){if(typeof n!="number"||!Number.isFinite(n)||!Number.isInteger(n)||n<=0){t.push("limits.cpu_ms must be a positive integer number of milliseconds");return}n>m&&t.push(`limits.cpu_ms must be at most ${String(m)} (Cloudflare's per-invocation ceiling)`)}},p=new Set(["off","smart","targeted"]),C=(s,t)=>{const{placement:e}=s;if(e===void 0)return;if(typeof e!="object"||e===null||Array.isArray(e)){t.push('placement must be an object (e.g. { "mode": "smart" })');return}const{mode:n}=e;n!==void 0&&(typeof n!="string"||!p.has(n))&&t.push(`placement.mode must be one of ${[...p].map(i=>`"${i}"`).join(", ")}`)},c={kind:"boolean"},h={kind:"samplingRate"},y={destinations:{kind:"destinations"},enabled:c,head_sampling_rate:h,persist:c},S={...y,invocation_logs:{hint:'set "invocation_logs": true to keep per-invocation summaries',kind:"boolean"}},L={enabled:c,head_sampling_rate:h,issues:{kind:"level",level:{enabled:c}},logs:{kind:"level",level:S},redact_query_string:c,traces:{kind:"level",level:y}},E=(s,t,e,n)=>{switch(s.kind){case"boolean":{b(t,e,n,s.hint);break}case"destinations":{t!==void 0&&(!Array.isArray(t)||t.some(i=>!f(i)))&&n.push(`${e} must be an array of destination names configured in the Cloudflare dashboard`);break}case"samplingRate":{O(t,e,n);break}}},g=(s,t,e,n,i)=>{for(const[o,a]of Object.entries(s)){const r=Object.hasOwn(t,o)?t[o]:void 0,l=`${e}.${o}`;r===void 0?i.push(`${l} is not a documented wrangler key (expected one of ${Object.keys(t).join(", ")}) — a typo is silently ignored by wrangler`):r.kind!=="level"?E(r,a,l,n):u(a)?g(a,r.level,l,n,i):a!==void 0&&n.push(`${l} must be an object`)}},w=(s,t,e)=>{const{observability:n}=s;if(n!==void 0){if(!u(n)){t.push('observability must be an object (e.g. { "enabled": true, "head_sampling_rate": 1 })');return}g(n,L,"observability",t,e)}},x=(s,t)=>{const{cache:e}=s;if(e!==void 0){if(!u(e)){t.push('cache must be an object (e.g. { "enabled": true })');return}b(e.enabled,"cache.enabled",t)}},D=(s,t)=>{const{exports:e}=s;if(e!==void 0){if(typeof e!="object"||e===null||Array.isArray(e)){t.push("exports must be an object keyed by entrypoint name");return}for(const[n,i]of Object.entries(e)){if(typeof i!="object"||i===null){t.push(`exports["${n}"] must be an object`);continue}i.type!==void 0&&typeof i.type!="string"&&t.push(`exports["${n}"].type must be a string`),i.cache!==void 0&&(typeof i.cache!="object"||i.cache===null||Array.isArray(i.cache)?t.push(`exports["${n}"].cache must be an object`):i.cache.enabled!==void 0&&typeof i.cache.enabled!="boolean"&&t.push(`exports["${n}"].cache.enabled must be a boolean`))}}},T=(s,t)=>{const{assets:e}=s;if(e!==void 0){if(typeof e!="object"||Array.isArray(e)){t.push('assets must be an object (e.g. { "directory": "./dist/client", "binding": "ASSETS" })');return}(typeof e.directory!="string"||e.directory.length===0)&&t.push('assets must declare a non-empty "directory" pointing at the built client output (e.g. "./dist/client")'),e.binding!==void 0&&(typeof e.binding!="string"||e.binding.length===0)&&t.push('assets.binding must be a non-empty string (e.g. "ASSETS")'),e.html_handling!==void 0&&typeof e.html_handling!="string"&&t.push("assets.html_handling must be a string"),e.not_found_handling!==void 0&&typeof e.not_found_handling!="string"&&t.push("assets.not_found_handling must be a string")}},B=(s,t)=>{const e=s.tail_consumers;if(e===void 0)return;if(!Array.isArray(e)){t.push("tail_consumers must be an array of { service, environment? } entries");return}const n=e;for(const[i,o]of n.entries())(!o||typeof o!="object"||typeof o.service!="string"||o.service.length===0)&&t.push(`tail_consumers[${String(i)}] must have a non-empty "service" naming the consumer Worker`)},U=(s,t)=>{const e=s.tail_consumers??[];return e.some(i=>!!i&&i?.service===t.service&&i?.environment===t.environment)?s:{...s,tail_consumers:[...e,t]}},G=(s,t)=>{const{vars:e}=s;if(!e||typeof e!="object")return;const n=e.LUNORA_ALLOWED_ORIGINS,i=e.LUNORA_CORS_ALLOW_CREDENTIALS,o=typeof n=="string"&&n.split(",").some(r=>r.trim()==="*"),a=A(i);o&&a&&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')},j=s=>v(s.durable_objects?.bindings).some(t=>t.class_name==="SchedulerDO"&&t.script_name===void 0),d="LUNORA_ORIGIN_URL",P=(s,t,e)=>{if(!j(s)||f(s.vars?.[d]))return;const n=t===void 0?"vars":`env.${t}.vars`,i=t===void 0?"":` --env ${t}`;e.push(`durable_objects.bindings declares the SchedulerDO but ${n}.${d} 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 ${n}.${d} to the worker's public URL, or \`wrangler secret put ${d}${i}\` (ignore this if it is already set as a secret or in the dashboard).`)};export{T as validateAssets,x as validateCache,G as validateCorsVariables,D as validateExports,I as validateLimits,N as validateLogpush,w as validateObservability,C as validatePlacement,P as validateSchedulerOrigin,k as validateSecretsRequired,$ as validateSendEmail,B as validateTailConsumers,U as withTailConsumer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/config",
3
- "version": "1.0.0-alpha.295",
3
+ "version": "1.0.0-alpha.297",
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.252",
58
- "@lunora/container": "1.0.0-alpha.68",
57
+ "@lunora/codegen": "1.0.0-alpha.254",
58
+ "@lunora/container": "1.0.0-alpha.69",
59
59
  "@lunora/errors": "1.0.0-alpha.50",
60
- "@lunora/seed": "1.0.0-alpha.180",
60
+ "@lunora/seed": "1.0.0-alpha.182",
61
61
  "@visulima/colorize": "2.1.1",
62
62
  "@visulima/find-ai-runner": "1.0.2",
63
63
  "@visulima/package": "5.0.20",
@@ -1,4 +0,0 @@
1
- import{mkdirSync as _,writeFileSync as E,rmSync as N,existsSync as D,readFileSync as l}from"node:fs";import{join as n}from"node:path";const u=".lunora",v=n(u,"dev.json"),h=n(u,"dev.log"),k=n(u,"dev-bindings.json"),T="LUNORA_DEV_DAEMON",x="LUNORA_DEV_LOG_FILE",C="LUNORA_DEV_HANDOFF_PID",m=r=>r!==null&&typeof r=="object",d=(r,e)=>{const t=r[e];return typeof t=="string"&&t.length>0?t:void 0},p=r=>{if(!Number.isInteger(r)||r<=0)return!1;try{return process.kill(r,0),!0}catch{return!1}},y=1e4,g=100,A=r=>{if(process.platform==="linux")try{const e=l(`/proc/${String(r)}/stat`,"utf8"),t=e.slice(e.lastIndexOf(")")+2).split(" "),i=Number(t[19]),s=l("/proc/stat","utf8").split(`
2
- `).find(a=>a.startsWith("btime ")),o=Number(s?.slice(6));return!Number.isFinite(i)||!Number.isFinite(o)?void 0:o*1e3+i/g*1e3}catch{return}},b=r=>{if(!p(r.pid))return!1;const e=r.startedAt===void 0?Number.NaN:Date.parse(r.startedAt);if(Number.isNaN(e))return!0;const t=A(r.pid);return t===void 0||t<=e+y},f=r=>{const e=n(r,v);if(!D(e))return;let t;try{t=JSON.parse(l(e,"utf8"))}catch{return}if(!m(t)||typeof t.pid!="number")return;const i=d(t,"url");if(i!==void 0)return{background:t.background===!0,logFile:d(t,"logFile"),mode:t.mode==="vite"?"vite":"cli",pid:t.pid,readyAt:d(t,"readyAt"),startedAt:d(t,"startedAt"),studioUrl:d(t,"studioUrl"),url:i}},c=(r,e)=>{try{_(n(r,u),{recursive:!0});const t=n(r,v);return E(t,`${JSON.stringify(e,void 0,2)}
3
- `,"utf8"),t}catch{return}},M=(r,e,t)=>{const i=f(r);if(i===void 0||t?.expectedPid!==void 0&&i.pid!==t.expectedPid)return;const s={...i,...e};return c(r,s),s},U=r=>r?.readyAt!==void 0,O=(r,e)=>{try{if(e!==void 0){const t=f(r);if(t!==void 0&&t.pid!==e)return}N(n(r,v),{force:!0})}catch{}},F=r=>{const e=f(r);if(e!==void 0){if(b(e))return e;O(r,e.pid)}},I=(r,e,t)=>{const i=F(r);if(i!==void 0)return t!==void 0&&i.pid===t?{ok:c(r,e)!==void 0}:i.pid!==e.pid?{existing:i,ok:!1}:{ok:c(r,e)!==void 0}},P=(r,e,t)=>{const i=n(r,v),s=`${JSON.stringify(e,void 0,2)}
4
- `;for(let o=0;o<2;o+=1)try{return _(n(r,u),{recursive:!0}),E(i,s,{encoding:"utf8",flag:"wx"}),{ok:!0}}catch(a){if(a.code!=="EEXIST")return{ok:c(r,e)!==void 0};const S=I(r,e,t?.supersedePid);if(S!==void 0)return S}return{ok:c(r,e)!==void 0}};export{k as DEV_BINDINGS_FILE,T as DEV_DAEMON_ENV,C as DEV_HANDOFF_ENV,h as DEV_LOG_FILE,x as DEV_LOG_FILE_ENV,u as DEV_STATE_DIR,v as DEV_STATE_FILE,P as claimDevServerState,O as clearDevServerState,U as isDevServerReady,p as isProcessAlive,b as isRecordedProcessCurrent,f as readDevServerState,F as readLiveDevServerState,M as updateDevServerState,c as writeDevServerState};
@@ -1,2 +0,0 @@
1
- import{readFileSync as Q,writeFileSync as V}from"node:fs";import{createRequire as X}from"node:module";import{join as F}from"node:path";import{containerBuildTag as z}from"@lunora/container";import{applyModify as S}from"./applyModify-DKP2l6S9.mjs";import{a as Z,r as W}from"./lunora-manifest-v90ZUbVp.mjs";import{parseTree as ee,findNodeAtLocation as ne}from"jsonc-parser";import{r as se,a as te,b as oe,c as ie}from"./reconcile-services-3dn35zgy.mjs";import{a as re,p as ae}from"./infer-bindings-D5S20KYQ.mjs";import{DEV_VARS_FILE as de,parseDevVariableEntries as ce}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{requiredSecrets as le}from"./buildPackageSecretsBlock-yv9mjKEW.mjs";import{w as ue,n as ge,s as Y,o as B,p as C,q as me}from"./validate-bindings-Djec3UWf.mjs";import{s as pe}from"./worker-entry-checks-9Vdz4d2f.mjs";import{findWranglerFile as fe,readWranglerJsonc as be}from"./WRANGLER_FILES-UNW-xY5u.mjs";const he=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],R=e=>Object.fromEntries(he.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),P="queueTuning",we=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,ve=/^[\t ]*,/u,_e=(e,n)=>{const s=ee(e),t=s===void 0?void 0:ne(s,[...n])?.parent;if(t?.type==="property"){const i=t.offset+t.length,o=e.lastIndexOf(`
2
- `,t.offset-1)+1,d=we.exec(e.slice(i));if(d!==null&&e.slice(o,t.offset).trim()===""){const a=t.parent?.children??[],b=a.indexOf(t),c=b===a.length-1&&b>0?a[b-1]:void 0,l=c===void 0?void 0:ve.exec(e.slice(c.offset+c.length))??void 0;return(l===void 0||c===void 0?e.slice(0,o):e.slice(0,c.offset+c.length)+e.slice(c.offset+c.length+l[0].length,o))+e.slice(i+d[0].length)}}return S(e,n,void 0)},G=(e,n,s,t,i,o=new Set)=>{const d=s.join("."),a={},b=[],c=[];let l=e;return{entries:n.map((u,w)=>{const g=t(u);if(g===void 0||u.queue===void 0)return u;const p=Object.fromEntries(Object.entries(R(g)).filter(([f])=>!o.has(f))),h=Object.entries(i[u.queue]??{}).filter(([f])=>!Object.hasOwn(p,f)),v=Object.entries(p).filter(([f,y])=>u[f]!==y),x=h.filter(([f,y])=>u[f]===y).map(([f])=>f),N=Object.fromEntries(Object.entries({...u,...p}).filter(([f])=>!x.includes(f)));for(const[f,y]of v)l=S(l,[...s,w,f],y);for(const f of x)l=_e(l,[...s,w,f]);for(const[f,y]of h){const k=u[f];k!==void 0&&k!==y&&c.push(`${d}/${u.queue}: ${f} is no longer declared by defineQueue, but it was changed by hand to ${JSON.stringify(k)} from the declared ${JSON.stringify(y)}, so it was kept. Delete it from wrangler.jsonc if it should go.`)}return(v.length>0||x.length>0)&&b.push(`${d}/${u.queue} (${[...v.map(([f])=>f),...x.map(f=>`removed ${f}`)].join(", ")})`),Object.keys(p).length>0&&(a[u.queue]=p),N}),owned:a,text:l,updated:b,warnings:c}},ye=(e,n,s,t)=>{const i=n.queues??{},o=i.producers??[],d=i.consumers??[],a=new Set(o.map(g=>g.binding)),b=new Set(d.map(g=>g.queue)),c=s.filter(g=>!a.has(g.bindingName)),l=s.filter(g=>!b.has(g.name)),m=G(e,d,["queues","consumers"],g=>s.find(p=>p.name===g.queue),t);let u=m.text;const w={...m.owned};if(c.length>0||l.length>0){const g=[...o,...c.map(h=>({binding:h.bindingName,queue:h.name}))],p=[...m.entries,...l.map(h=>({queue:h.name,...h.mode==="pull"?{type:"http_pull"}:{},...R(h)}))];for(const h of l){const v=R(h);Object.keys(v).length>0&&(w[h.name]=v)}u=S(u,["queues"],{consumers:p,producers:g})}return{added:[...c.map(g=>`queues.producers/${g.bindingName}`),...l.map(g=>`queues.consumers/${g.name}`)],owned:w,text:u,updated:m.updated,warnings:m.warnings}},Se=(e,n,s,t,i)=>{const o=n.env?.[t],d=o?.queues?.consumers??[],a=o?.queues?.producers??[],b=u=>{const w=a.find(g=>g.queue===u.queue)?.binding;return w!==void 0?s.find(g=>g.bindingName===w):s.find(g=>g.name===u.queue&&!a.some(p=>p.binding===g.bindingName))},c=G(e,d,["env",t,"queues","consumers"],b,i,new Set(["dead_letter_queue"])),l=d.filter(u=>u.queue!==void 0&&b(u)===void 0).map(u=>`env.${t}.queues.consumers/${String(u.queue)}: no defineQueue export matches it — this block declares no producer mapping one of their bindings to "${String(u.queue)}", and no export is named that — so it was not retuned. A consumer for a queue another worker produces is skipped the same way.`),m=d.flatMap(u=>{const w=b(u)?.tuning.deadLetterQueue;return w===void 0||u.dead_letter_queue!==void 0?[]:[`env.${t}.queues.consumers/${String(u.queue)}: defineQueue declares deadLetterQueue "${w}", but this consumer has no dead_letter_queue, so its exhausted messages are dropped. Queue names differ per environment, so reconcile does not write it here; add it by hand.`]});return{added:[],owned:c.owned,text:c.text,updated:c.updated,warnings:[...c.warnings,...m,...l]}},xe=(e,n)=>{if(e?.lunoraIsForeign===!0)return n.push(`${e.path}: \`lunora\` is not an object, so the queue tuning ownership record cannot be read or written — an option removed from defineQueue stays deployed.`),{};const s=e?.lunora?.[P],t=i=>typeof i=="object"&&i!==null&&!Array.isArray(i);return s===void 0?{}:!t(s)||!Object.values(s).every(i=>t(i)&&Object.values(i).every(o=>t(o)))?(n.push(`${e?.path??"package.json"}: \`lunora.${P}\` is not a map of scope → queue → fields, so it is ignored — an option removed from defineQueue stays deployed until the next pass records it again.`),{}):s},Ne=(e,n,s)=>{const t=Object.fromEntries(Object.entries({...n,...s}).filter(([,i])=>Object.keys(i).length>0));Z(e,P,Object.keys(t).length===0?void 0:t)},j="PIPELINES",I="ARTIFACTS",Oe=(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===j),i=e.usesArtifacts?n?.artifacts??[]:[],o=i.some(a=>a.binding===I)?[]:i.flatMap(a=>a.binding===void 0?[]:[a.binding]);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 "${j}" pipelines binding exists; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding: "${j}", stream }) — codegen resolves this one name, and the pipeline resource can't be auto-provisioned.`],[e.usesArtifacts&&i.length===0,re(e.jurisdiction)],[o.length>0,`ctx.artifacts is used and ${o.map(a=>`"${a}"`).join(", ")} ${o.length===1?"is":"are"} bound, but none is named "${I}"; make sure \`.artifacts()\` on defineApp points ctx.artifacts at it — otherwise it reads env.${I} and throws.`],[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)},ke=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),D=(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.`),Ee=(e,n)=>{const s=new Set([...e.workflows,...e.agents].map(o=>o.className));if(s.size===0)return[];const t=Object.entries(n.exports??{}).flatMap(([o,d])=>d?.type==="workflow"?[o]:[]),i=(n.workflows??[]).flatMap(o=>o.class_name===void 0||o.script_name!==void 0?[]:[o.class_name]);return[...new Set([...t,...i])].filter(o=>!s.has(o)).map(o=>`wrangler.jsonc declares workflow "${o}" but no defineWorkflow/defineAgent export generates that class — a leftover from a rename will fail the deploy (wrangler rejects a class the worker does not export). Remove it if it is not hand-wired.`)},$e=(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:o}=i;return o===void 0||s.has(o)?[]:[`wrangler.jsonc subscribes queues.consumers[] to "${o}" 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:o}=i;return o===void 0||t.has(o)?[]:[`wrangler.jsonc declares queues.producers[] binding "${o}" but no defineQueue export declares it — a leftover from a rename. Remove it if it is not hand-wired.`]})]},Ae=(e,n)=>[...Ee(e,n),...$e(e,n)],H=[{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"}],qe=()=>H.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),Ce=e=>{let n;try{n=Q(F(e,de),"utf8")}catch{return!1}const s=new Map(ce(n).map(t=>[t.key,t.value]));return H.some(({keys:t})=>t.every(i=>(s.get(i)??"")!==""))},je=(e,n)=>{const s=n?.secrets?.required;if(!Array.isArray(s))return[];const t=new Set(s),i=le(ae(e)).map(o=>o.key).filter(o=>!t.has(o));return i.length===0?[]:[`wrangler.jsonc declares secrets.required without ${i.join(", ")}, which this app needs — wrangler dev loads only the listed keys from .dev.vars, so add ${i.length===1?"it":"them"} to secrets.required.`]},T=(e,n,s)=>{const t=new Set(e.durableObjects.map(a=>a.className)),i=[],o=(s?.r2_buckets?.length??0)>0,d=(s?.d1_databases?.some(a=>a.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!o&&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")&&!d&&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(...D("container","containers",e.containers),...D("workflow","workflows",e.workflows),...D("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&&!Ce(n)&&i.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${qe()}.`),i.push(...ke(e),...Oe(e,s),...je(e,s)),s!==void 0&&i.push(...Ae(e,s)),i},U="<replace-with-d1-create-id>",Ie=e=>[["container","containers",e.containers],["workflow","workflows",e.workflows],["agent","agents",e.agents]].flatMap(([s,t,i])=>i.filter(o=>!o.exported).map(({className:o,exportName:d})=>({className:o,exportName:d,kind:s,module:t}))),De=e=>{const n=new Set(B(e).map(t=>t.tag));let s=1;for(;n.has(`v${String(s)}`);)s+=1;return`v${String(s)}`},Te=e=>{const n=new Set;for(const s of B(e)){for(const t of C(s.deleted_classes))n.delete(t);for(const{from:t,to:i}of B(s.renamed_classes))t!==void 0&&n.delete(t),i!==void 0&&n.add(i);for(const t of[...C(s.new_classes),...C(s.new_sqlite_classes)])n.add(t)}return n},Be=(e,n,s)=>{const t=n.durable_objects?.bindings??[],i=new Set(t.map(l=>l.name)),o=s.filter(l=>!i.has(l.binding));let d=e;const a=[];if(o.length>0){const l=[...t,...o.map(m=>({class_name:m.className,name:m.binding}))];d=S(d,["durable_objects","bindings"],l),a.push(...o.map(m=>`${m.binding}/${m.className}`))}const b=n.migrations??[],c=s.map(l=>l.className).filter(l=>!Te(b).has(l));if(c.length>0){const l=[...b,{new_sqlite_classes:c,tag:De(b)}];d=S(d,["migrations"],l)}return{added:a,text:d}},Re=(e,n)=>{const s=n.d1_databases??[];if(s.some(o=>o.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:U,database_name:t}];return{added:["DB (D1)"],text:S(e,["d1_databases"],i)}},Pe={ai:{binding:"AI",label:"AI (Workers AI)"},analytics:{binding:"ANALYTICS_SQL",label:"ANALYTICS_SQL (Analytics SQL)"},browser:{binding:"BROWSER",label:"BROWSER (Browser Rendering)"},images:{binding:"IMAGES",label:"IMAGES (Cloudflare Images)"}},$=(e,n,s)=>{const{binding:t,label:i}=Pe[s],o=n[s]?.binding;return typeof o=="string"&&o.length>0?{added:[],text:e}:{added:[i],text:S(e,[s],{binding:t})}},Le=(e,n)=>e.usesAnalyticsSql&&pe(n,new Set(["analyticsSql"]))?.chained.has("analyticsSql")!==!0,Me=new Set(["ratelimits","send_email"]),We=["durable_objects","logfwdr","unsafe"],Ke=new Set(["data_blobs","text_blobs","vars","wasm_modules"]),M=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),L=(e,n,s)=>M(e)&&e[n]===s,Qe=(e,n,s)=>{if(Ke.has(e))return M(n)&&Object.hasOwn(n,s);const t=Me.has(e)?"name":"binding";return Array.isArray(n)?n.some(i=>L(i,t,s)):L(n,"binding",s)},Fe=(e,n)=>{const s=e,t=Object.entries(s).find(([o,d])=>o!=="env"&&Qe(o,d,n));if(t!==void 0)return t[0];for(const o of We){const d=s[o];if(M(d)&&Array.isArray(d.bindings)&&d.bindings.some(a=>L(a,"name",n)))return`${o}.bindings`}if(e.queues?.producers?.some(o=>o.binding===n)===!0)return"queues.producers";const i=e.secrets?.required;if(Array.isArray(i)&&i.includes(n))return"secrets.required"},K=(e,n,s,t,i)=>{if((n[s]?.length??0)>0)return{added:[],text:e};const o=Fe(n,t.binding);return o!==void 0?{added:[],text:e,warnings:[`${s}: not adding ${JSON.stringify(t)} — the name "${t.binding}" is already bound by \`${o}\` in wrangler.jsonc. Add a ${s} entry under another binding name and point the matching \`defineApp()\` override at it.`]}:{added:[i],text:S(e,[s],[t])}},Ye=(e,n)=>{const s=n.worker_loaders??[];return s.some(t=>t.binding==="LOADER")?{added:[],text:e}:{added:["LOADER (Worker Loader)"],text:S(e,["worker_loaders"],[...s,{binding:"LOADER"}])}},Ge=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},He=e=>{const{image:n}=e;return n.kind==="dockerfile"?n.dockerfilePath:n.kind==="registry"?n.reference:z(e.exportName)},J=e=>{const n={};for(const[s,t]of Object.entries(e.images??{}))n[s]=t.kind==="registry"?{image:t.reference}:{build_context:t.buildContext,dockerfile:t.dockerfilePath,...e.buildArgs===void 0?{}:{build_vars:e.buildArgs}};return{class_name:e.className,scheduling_policy:"durable_object",...Object.keys(n).length>0?{images:n}:{},...e.name===void 0?{}:{name:e.name}}},Ue=e=>{if(e.schedulingPolicy==="durable_object")return J(e);const{image:n}=e,s={class_name:e.className,image:He(e)};return n.kind==="dockerfile"&&(s.image_build_context=n.buildContext),e.buildArgs!==void 0&&n.kind!=="registry"&&(s.image_vars=e.buildArgs),e.instanceType!==void 0&&(s.instance_type=Ge(e.instanceType)),e.maxInstances!==void 0&&(s.max_instances=e.maxInstances),e.name!==void 0&&(s.name=e.name),e.rollout?.stepPercentage!==void 0&&(s.rollout_step_percentage=e.rollout.stepPercentage),e.rollout?.gracePeriodSeconds!==void 0&&(s.rollout_active_grace_period=e.rollout.gracePeriodSeconds),s},Je=(e,n,s)=>{const t=n.containers??[],i=new Set(t.map(c=>c.class_name)),o=s.filter(c=>!i.has(c.className));let d=o.length===0?e:S(e,["containers"],[...t,...o.map(c=>Ue(c))]);const a=[],b=[];for(const[c,l]of t.entries()){const m=s.find(g=>g.className===l.class_name);if(m===void 0)continue;const u=m.schedulingPolicy??"default";if((l.scheduling_policy??"default")!==u){b.push(`containers/${m.className} has scheduling_policy "${l.scheduling_policy??"default"}" in wrangler.jsonc but defineContainer "${m.exportName}" declares "${u}" — the policy is immutable, so replace the entry (and its container application) by hand.`);continue}const w=m.schedulingPolicy==="durable_object"?J(m).images:void 0;w!==void 0&&JSON.stringify(l.images)!==JSON.stringify(w)&&(d=S(d,["containers",c,"images"],w),a.push(`containers/${m.className}.images`))}return{added:o.map(c=>`containers/${c.className}`),text:d,updated:a,warnings:b}},Ve=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=S(e,["observability"],{enabled:!0,head_sampling_rate:1});return{added:["observability"],text:s}},Xe=[{minimum:[4,142],name:"wrangler"},{minimum:[1,61],name:"@cloudflare/vite-plugin"}],ze=(e,n)=>{try{const s=X(F(e,"package.json")).resolve(`${n}/package.json`),[t=0,i=0]=String(JSON.parse(Q(s,"utf8")).version).split(".").map(Number);return[t,i]}catch{return}},Ze=e=>{const n=Xe.flatMap(({minimum:s,name:t})=>{const i=ze(e,t);return i!==void 0&&(i[0]<s[0]||i[0]===s[0]&&i[1]<s[1])?[`${t} ${i.join(".")} (needs >= ${s.join(".")})`]:[]});return n.length===0?void 0:`workflows are declared in wrangler \`exports\`, which ${n.join(" and ")} cannot run — reconcile left workflows[] untouched. Upgrade (\`pnpm add -D wrangler@^4.143.1 @cloudflare/vite-plugin@^1.62.1\`) and re-run.`},en=e=>Object.entries(e.env??{}).flatMap(([n,s])=>Array.isArray(s?.workflows)?[`env.${n}.workflows declares workflow bindings, but Lunora now declares workflows in \`exports\` and resolves them on ctx.exports — move them to that environment's own \`exports\` by hand.`]:[]),nn=(e,n,s)=>{let t=e;const i=[],o=[];for(const d of s){const a=n[d.className];if(a?.type==="workflow")for(const{of:b,path:c}of me){const l=b(d),m=Y(a,c),u=`exports/${d.className}.${c.join(".")}`;if(l===void 0){m!==void 0&&o.push(`${u} is set in wrangler.jsonc but defineWorkflow "${d.exportName}" does not declare it — reconcile leaves it in place. Remove it by hand if it was dropped from the definition.`);continue}JSON.stringify(m)!==JSON.stringify(l)&&(t=S(t,["exports",d.className,...c],l),i.push(u))}}return{text:t,updated:i,warnings:o}},sn=(e,n,s,t,i)=>{if(i!==void 0)return{added:[],text:e,warnings:[i]};const o=[...s.map(p=>({settings:ue(p),workflow:p})),...t.map(p=>({settings:{},workflow:p}))],d=new Set(o.map(({workflow:p})=>p.className)),a=n.workflows??[],b=a.filter(p=>p.script_name===void 0&&p.class_name!==void 0&&d.has(p.class_name)),c=n.exports??{},l=[],m=[],u=[];let w=e;for(const{settings:p,workflow:h}of o){if(c[h.className]!==void 0&&c[h.className]!==null)continue;const v=b.find(f=>f.class_name===h.className),x=Object.fromEntries(ge.flatMap(f=>{const y=Y(v,[f]);return y===void 0?[]:[[f,y]]})),N=v?.name??h.name;v?.name!==void 0&&v.name!==h.name&&u.push(`workflows/${h.className} is deployed as "${v.name}" but declared as "${h.name}" — its export keeps "${v.name}" so running instances survive. Change the declaration to match, or rename deliberately (it starts a new, empty workflow).`),w=S(w,["exports",h.className],{type:"workflow",...x,...p,name:N}),(v===void 0?l:m).push(`exports/${h.className}`)}if(b.length>0){const p=a.filter(h=>!b.includes(h));w=S(w,["workflows"],p.length===0?void 0:p),m.push(...b.map(h=>`workflows/${String(h.class_name)} → exports`))}u.push(...en(n));const g=nn(w,c,s);return{added:l,text:g.text,updated:[...m,...g.updated],warnings:[...u,...g.warnings]}},wn=(e,n,s)=>{const t=fe(e),i=Ie(n);if(!t)return{added:[],changed:!1,exportGaps:i,reason:"wrangler.jsonc not found",updated:[],warnings:T(n,e)};const{parsed:o,text:d}=be(t);if(o===void 0)return{added:[],changed:!1,exportGaps:i,reason:`failed to parse ${t} as JSONC`,updated:[],warnings:T(n,e),wranglerPath:t};const a=T(n,e,o);if(s!==void 0){const r=o.env?.[s]!==void 0;a.push(r?`auto-provisioned bindings are written to the top level of wrangler.jsonc only (queue consumers "env.${s}" already declares are retuned, nothing is added) — "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 b=n.containers.filter(r=>r.exported),c=n.agents.filter(r=>r.exported&&r.voice===!0&&r.voiceBindingName!==void 0&&r.voiceClassName!==void 0),l=[...n.durableObjects,...b.map(r=>({binding:r.bindingName,className:r.className})),...c.map(r=>({binding:r.voiceBindingName,className:r.voiceClassName}))],m=n.workflows.filter(r=>r.exported),u=n.agents.filter(r=>r.exported),w=W(e),g=xe(w,a),p={},h=se(w);let v;const x=[{enabled:!0,run:r=>Be(r,o,l)},{enabled:n.needsD1,run:r=>Re(r,o)},{enabled:n.usesAi,run:r=>$(r,o,"ai")},{enabled:n.usesAiSearch,run:r=>K(r,o,"ai_search_namespaces",{binding:"AI_SEARCH",namespace:"default"},"AI_SEARCH (AI Search namespace)")},{enabled:Le(n,e),run:r=>$(r,o,"analytics")},{enabled:n.usesBrowser,run:r=>$(r,o,"browser")},{enabled:n.usesImages,run:r=>$(r,o,"images")},{enabled:n.usesAnalytics,run:r=>K(r,o,"analytics_engine_datasets",{binding:"ANALYTICS",dataset:"ANALYTICS"},"ANALYTICS (Analytics Engine)")},{enabled:n.usesWorkerLoader,run:r=>Ye(r,o)},{enabled:!0,run:r=>Ve(r,o)},{enabled:b.length>0,run:r=>Je(r,o,b)},{enabled:m.length>0||u.length>0,run:r=>sn(r,o,m,u,Ze(e))},{enabled:n.queues.length>0,run:r=>{const _=ye(r,o,n.queues,g.queues??{});return p.queues=_.owned,_}},{enabled:n.services!==void 0&&(n.services.length>0||Object.keys(h).length>0),run:r=>{const _=te(r,o,n.services??[],h);return v=_.owned,_}},...s===void 0||o.env?.[s]===void 0?[]:[{enabled:n.queues.length>0,run:r=>{const _=`env.${s}.queues`,E=Se(r,o,n.queues,s,g[_]??{});return p[_]=E.owned,E}}]];let N=d;const f=[],y=[];for(const r of x){if(!r.enabled)continue;const _=r.run(N);N=_.text,f.push(..._.added),y.push(..._.updated??[]),a.push(..._.warnings??[])}const k=r=>{if(w===void 0)return;const _=v,E=[...Object.keys(p).length>0?[{consequence:"an option removed from defineQueue stays deployed",key:"queueTuning",label:"queue tuning",write:O=>{Ne(O,g,p)}}]:[],..._===void 0?[]:[{consequence:"a service removed from lunora.config stays bound",key:"services",label:"service bindings",write:O=>{ie(O,_)}}]];for(const O of E)try{O.write(W(e)??w)}catch(q){a.push(`${r?"wrangler.jsonc was updated, but ":""}recording the ${O.label} reconcile owns in ${w.path} (lunora.${O.key}) failed: ${q instanceof Error?q.message:String(q)}. Until it is recorded, ${O.consequence}.`)}};let A;if(n.services!==void 0){const r=oe(e,n.services,h);a.push(...r.warnings),v={...v,...r.owned},A=r.added.length>0||r.updated.length>0?{added:r.added,path:r.path,updated:r.updated}:void 0}return f.includes("DB (D1)")&&a.push(`wrote a DB binding with a placeholder database_id ("${U}") — run \`wrangler d1 create <name>\` and replace it before deploying.`),N===d?(k(!1),{added:f,changed:!1,devConfig:A,exportGaps:i,reason:"bindings already in sync",updated:y,warnings:a,wranglerPath:t}):(V(t,N,"utf8"),k(!0),{added:f,changed:!0,devConfig:A,exportGaps:i,updated:y,warnings:a,wranglerPath:t})};export{Ie as collectExportGaps,wn as reconcileWranglerBindings};
@@ -1 +0,0 @@
1
- import{existsSync as x,statSync as R,readFileSync as N,readdirSync as k}from"node:fs";import{discoverFlags as $,FLAGS_FILENAME as F,discoverQueues as Y,QUEUES_FILENAME as M,CAPABILITY_PROBES as G,readServiceBindings as U,sourceCapabilitySignals as q}from"@lunora/codegen";import{parse as w,init as W}from"es-module-lexer";import{Project as K}from"ts-morph";import{discoverAgentInfo as X}from"./discoverAgentInfo-CTdCSfYM.mjs";import{discoverContainerInfo as H}from"./discoverContainerInfo-EhZtEBQs.mjs";import{d as C}from"./discover-info-Vj9d4qYt.mjs";import{escapeRegExp as J}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{discoverSchemaInfo as Q}from"./discoverSchemaInfo-BguahM6z.mjs";import{resolveWorkerEntry as V,COMPOSED_ENTRY_DURABLE_OBJECTS as z,GENERATED_MODULE_DURABLE_OBJECTS as Z,GENERATED_DIRECTORY as D,DURABLE_OBJECT_BINDINGS as ee,detectExportedDurableObjects as se,detectClassExports as v}from"./COMPOSED_WORKER_ENTRY-C69wqbSP.mjs";import{discoverWorkflowInfo as te}from"./discoverWorkflowInfo-BsPvlo6O.mjs";import{join as p}from"node:path";const re="https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/artifacts/namespaces",ne=e=>{const s='add an "artifacts" binding ({ binding: "ARTIFACTS", namespace }) — codegen reads env.ARTIFACTS unless `.artifacts()` on defineApp points ctx.artifacts at another binding';return e===void 0?`ctx.artifacts is used; ${s}. The namespace is created by the first repo create() if it does not exist yet.`:e==="fedramp"?'ctx.artifacts is used, but the schema pins data to "fedramp" and Artifacts namespaces exist only in "eu" or "us" — codegen refuses this combination.':`ctx.artifacts is used and the schema pins data to "${e}"; create the namespace in that jurisdiction BEFORE the first repo, with POST ${re} and body { "namespace": "<name>", "jurisdiction": "${e}" }, then ${s}. A namespace's jurisdiction cannot be changed, and one created implicitly by the first repo create() is unrestricted.`},oe=(e,s)=>{const{error:r,value:t}=C(e,s,F,$);return r===void 0?{flags:t}:{error:r}},ae=/^\s*import\s+type\b/,ie=new Set(["@lunora/agent","@lunora/agent/sandbox"]),A=["browserTool","jsCodeTool"],_=Object.fromEntries(A.map(e=>{const s=J(e);return[e,{fallback:new RegExp(String.raw`import\s+\{[^}]*\b${s}\b[^}]*\}\s+from\s+["']@lunora\/agent(?:\/sandbox)?["']`,"u"),name:new RegExp(String.raw`\b${s}\b`,"u"),typeSpecifier:new RegExp(String.raw`\btype\s+${s}\b`,"u")}]})),ce=e=>{const s=e.indexOf("{");if(s===-1)return"";const r=e.indexOf("}",s+1);return r===-1?e.slice(s+1):e.slice(s+1,r)},de=(e,s)=>{if(ae.test(e))return!1;const r=ce(e);return _[s].name.test(r)&&!_[s].typeSpecifier.test(r)},ue=e=>{let s;try{const[r]=w(e);s=r.filter(t=>t.n!==void 0&&ie.has(t.n)).map(t=>e.slice(t.ss,t.se))}catch{s=void 0}return Object.fromEntries(A.map(r=>[r,s===void 0?_[r].fallback.test(e):s.some(t=>de(t,r))]))},le=(e,s)=>{const{error:r,value:t}=C(e,s,M,Y);return r===void 0?{queues:t??[]}:{error:r,queues:[]}},pe=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),me=new Set([".git",".lunora-cache",".wrangler","dist",D,"node_modules"]),fe=["lunora","src"],he=/\benv\s*\.\s*DB\b/,ge=/\benv\s*\.\s*AI\b/,be={ai:"usesAi",aiSearch:"usesAiSearch",analytics:"usesAnalytics",analyticsSql:"usesAnalyticsSql",artifacts:"usesArtifacts",browser:"usesBrowser",hyperdrive:"usesHyperdrive",images:"usesImages",kv:"usesKv",mail:"usesMail",notify:"usesNotify",payments:"usesPayment",pipelines:"usesPipelines",r2sql:"usesR2sql",scheduler:"usesScheduler",storage:"usesStorage",x402:"usesX402Pay"},Se={usesAuth:"@lunora/auth",usesCimdWorkers:"@lunora/auth/cimd/workers",usesX402Charge:"@lunora/x402/charge"},Ee=e=>{const s=G.find(r=>r.key===e);if(s===void 0)throw new Error(`@lunora/config: codegen has no "${e}" capability`);return s},b=Object.fromEntries([...Object.entries(be).map(([e,s])=>{const{contextProperty:r,moduleSpecifier:t}=Ee(e);return[s,{contextProperty:r,dynamicImport:!1,source:t}]}),...Object.entries(Se).map(([e,s])=>[e,{dynamicImport:!0,source:s}])]),m=Object.keys(b).toSorted((e,s)=>e.localeCompare(s)),ye=new Set(m.map(e=>b[e].source)),Ae=/\bctx\b/u,Ie=new RegExp(String.raw`\b(?:${m.flatMap(e=>b[e].contextProperty??[]).join("|")})\b`,"u"),ve="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",P=[...m,"needsD1","usesWorkerLoader"],_e=()=>{const e={};for(const s of P)e[s]=!1;return e},j=Object.freeze(_e()),xe=(e,s)=>{const r={};for(const t of P)r[t]=e[t]||s[t];return r},Te=/\bimport\s*\(\s*["']([^"'\n]+)["']\s*\)/gu,Oe=e=>{let s;try{[s]=w(e)}catch{return}const r=new Set,t=new Set;for(const n of s)n.n!==void 0&&(n.d===-1?t:r).add(n.n);return{dynamicImports:r,staticImports:t}},Re=()=>{let e;return()=>(e??=new K({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}),e)},Ne={contextReads:new Set,valueImports:new Set},we=(e,s,r,t,n)=>{if(!(r===void 0||[...r.staticImports].some(d=>ye.has(d))||t&&Ae.test(e)&&Ie.test(e)))return Ne;const i=n(),o=i.createSourceFile(`/scan/${s.slice(s.lastIndexOf("/")+1)}`,e,{overwrite:!0}),c=q(o);return i.removeSourceFile(o),c},Ce=(e,s,r,t)=>{const n=Oe(e),{contextReads:a,valueImports:i}=we(e,s,n,r,t),o=n?.dynamicImports??new Set([...e.matchAll(Te)].map(d=>d[1])),c={...j,needsD1:he.test(e)};for(const d of m){const{contextProperty:f,dynamicImport:S,source:h}=b[d];c[d]=i.has(h)||r&&f!==void 0&&a.has(f)||S&&o.has(h)}return c.usesAi||=ge.test(e),c},T=(e,s)=>{let r;try{r=k(e,{withFileTypes:!0})}catch{return}for(const t of r){if(t.isDirectory()){me.has(t.name)||T(p(e,t.name),s);continue}const n=t.name.lastIndexOf(".");n!==-1&&pe.has(t.name.slice(n))&&s.push(p(e,t.name))}},De=(e,s)=>{const{info:r}=Q(e,s);return{jurisdiction:r?.jurisdiction,needsD1:r?.hasD1GlobalTable??!1}},Pe=(e,s,r)=>{const t=Re(),n=`${p(e,r)}/`;let a=j;for(const i of s){const o=p(e,i);if(!x(o)||!R(o).isDirectory())continue;const c=[];T(o,c);for(const d of c)a=xe(a,Ce(N(d,"utf8"),d,d.startsWith(n),t))}return a},je=(e,s)=>{const r=p(e,s),t=Object.fromEntries(A.map(a=>[a,!1]));if(!x(r)||!R(r).isDirectory())return t;const n=[];T(r,n);for(const a of n){const i=ue(N(a,"utf8"));for(const o of A)t[o]||=i[o]}return t},Le=(e,s,r)=>[...e.map(t=>t.exported?`${t.bindingName}/${t.className} (container "${t.exportName}" declared and exported)`:`hint: container "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...s.map(t=>t.exported?`exports.${t.className} (workflow "${t.exportName}" declared and exported)`:`hint: workflow "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...r.map(t=>t.exported?`exports.${t.className} (agent "${t.exportName}" declared and exported)`:`hint: agent "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],Be=(e,s,r)=>[[e.usesAi,"AI (@lunora/ai imported, ctx.ai read 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 — ${ve}`],[e.usesBrowser,"browser (@lunora/browser imported or ctx.browser read) — self-describing { binding: BROWSER }"],[e.usesImages,"images (@lunora/bindings/images imported or ctx.images read) — self-describing { binding: IMAGES }"],[e.usesAnalytics,"analytics_engine_datasets (@lunora/bindings/analytics imported or ctx.analytics read) — self-describing { binding: ANALYTICS, dataset }"],[e.usesWorkerLoader,"worker_loaders (jsCodeTool imported in lunora/) — self-describing { binding: LOADER }"],[e.usesAiSearch,'ai_search_namespaces (ctx.aiSearch used) — self-describing { binding: AI_SEARCH, namespace: "default" }; remote-only, so `lunora dev` reaches the deployed AI Search service'],[e.usesAnalyticsSql,"analytics (ctx.analyticsSql used) — self-describing { binding: ANALYTICS_SQL }; needs wrangler >= 4.145.0, and is remote-only, so `lunora dev` queries the account's live analytics"],[e.usesKv,"hint: @lunora/bindings/kv is imported or ctx.kv is read; 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 or ctx.sql is read; 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, stream }) — the pipeline resource can't be auto-provisioned"],[e.usesArtifacts,`hint: ${ne(r.jurisdiction)}`],[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(([n])=>n).map(([,n])=>n),ke=(e,s,r,t=[],n=[],a=[])=>{const i=new Set(e.map(c=>c.className)),o=e.map(c=>`${c.binding}/${c.className} (exported by worker entry)`);return s.needsD1&&o.push("DB (.global() table declared)"),o.push(...Le(t,n,a),...Be(r,i,s)),o},Qe=async e=>{await W;const s=e.schemaDir??"lunora",r=e.scanDirs??fe,t=Pe(e.projectRoot,r,s),n=je(e.projectRoot,s),a={...t,usesBrowser:t.usesBrowser||n.browserTool,usesWorkerLoader:n.jsCodeTool},i=V(e.projectRoot);let o;i.composed?o=[...z,...Object.entries(Z).filter(([l])=>x(p(e.projectRoot,s,D,`${l}.ts`))).map(([,l])=>l)].map(l=>({binding:ee[l],className:l})):o=i.path===void 0?[]:se(i.path);const c=De(e.projectRoot,s),d={...c,needsD1:a.needsD1||c.needsD1},f=v(i,H(e.projectRoot,s).containers,"containers"),S=v(i,te(e.projectRoot,s).workflows,"workflows"),h=v(i,X(e.projectRoot,s).agents,"agents"),L=[...le(e.projectRoot,s).queues],{flags:E}=oe(e.projectRoot,s),I=E?.provider==="flagship"&&E.mode==="binding"?E.bindingName:void 0,O={};for(const u of m)O[u]=a[u];const y=ke(o,d,a,f,S,h);I!==void 0&&y.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${I}", app_id }) — the app_id can't be auto-provisioned`);const g=U(e.projectRoot),B=g.error===void 0?g.services:void 0;return g.error!==void 0&&y.push(`hint: lunora.config \`services\` not reconciled — ${g.error}`),y.push(...g.services.map(u=>`${u.binding} → ${u.worker} (lunora.config services.${u.name})`)),{agents:h,containers:f,durableObjects:o,flagshipBinding:I,...d.jurisdiction===void 0?{}:{jurisdiction:d.jurisdiction},needsD1:d.needsD1,queues:L,services:B,signals:y,usesFlags:E!==void 0,usesWorkerLoader:a.usesWorkerLoader,workflows:S,...O}},Ve=e=>{const s=[];for(const r of m)e[r]&&s.push(b[r].source);return s};export{ne as a,Qe as i,Ve as p};
@@ -1 +0,0 @@
1
- import"./discoverAgentInfo-CTdCSfYM.mjs";import{i as t,p as s}from"./infer-bindings-D5S20KYQ.mjs";import"./discoverContainerInfo-EhZtEBQs.mjs";import"./discoverSchemaInfo-BguahM6z.mjs";import"./COMPOSED_WORKER_ENTRY-C69wqbSP.mjs";import"./discoverWorkflowInfo-BsPvlo6O.mjs";export{t as inferLunoraBindings,s as packageNamesFromBindings};
@@ -1 +0,0 @@
1
- import{l,m as y,o as g}from"./validate-bindings-Djec3UWf.mjs";const v=new Set(["1","enabled","on","true","yes"]),_=s=>typeof s=="string"&&v.has(s.trim().toLowerCase()),L=(s,t,e)=>{const i=s.send_email;if(i===void 0)return;if(!Array.isArray(i)){t.push("send_email must be an array of { name, destination_address? } entries");return}const n=i;for(const[o,a]of n.entries())(!a||typeof a!="object"||typeof a.name!="string"||a.name.length===0)&&e.push(`send_email[${String(o)}] has no non-empty "name" naming the send-email binding — set one before deploying`)},$=(s,t)=>{s.logpush!==void 0&&typeof s.logpush!="boolean"&&t.push('logpush must be a boolean (set "logpush": true to enable Cloudflare Logpush)')},R=(s,t)=>{const e=s.secrets;if(e===void 0)return;const i=typeof e=="object"&&e!==null&&!Array.isArray(e)?e.required:void 0;(!Array.isArray(i)||i.some(n=>typeof n!="string"||n===""))&&t.push('secrets must be an object whose "required" is an array of secret names (e.g. { "required": ["API_KEY"] })')},d=3e5,I=(s,t)=>{const{limits:e}=s;if(e===void 0)return;if(typeof e!="object"||Array.isArray(e)){t.push('limits must be an object (e.g. { "cpu_ms": 30000 })');return}const i=e.cpu_ms;if(i!==void 0){if(typeof i!="number"||!Number.isFinite(i)||!Number.isInteger(i)||i<=0){t.push("limits.cpu_ms must be a positive integer number of milliseconds");return}i>d&&t.push(`limits.cpu_ms must be at most ${String(d)} (Cloudflare's per-invocation ceiling)`)}},b=new Set(["off","smart","targeted"]),N=(s,t)=>{const{placement:e}=s;if(e===void 0)return;if(typeof e!="object"||e===null||Array.isArray(e)){t.push('placement must be an object (e.g. { "mode": "smart" })');return}const{mode:i}=e;i!==void 0&&(typeof i!="string"||!b.has(i))&&t.push(`placement.mode must be one of ${[...b].map(n=>`"${n}"`).join(", ")}`)},A=new Set(["enabled","head_sampling_rate","issues","logs","traces"]),m=new Set(["destinations","enabled","head_sampling_rate","persist"]),S=new Set([...m,"invocation_logs"]),E=new Set(["enabled"]),u=(s,t,e,{warnings:i})=>{for(const n of Object.keys(s))t.has(n)||i.push(`${e}.${n} is not a documented wrangler key (expected one of ${[...t].join(", ")}) — a typo is silently ignored by wrangler`)},c=(s,t,{errors:e})=>{s!==void 0&&typeof s!="boolean"&&e.push(`${t} must be a boolean`)},f=(s,t,{errors:e})=>{s!==void 0&&(typeof s!="number"||Number.isNaN(s)||s<0||s>1)&&e.push(`${t} must be a number in [0, 1] (the fraction of requests sampled)`)},p=(s,t,e,i)=>{if(s===void 0)return;if(!l(s)){i.errors.push(`${t} must be an object`);return}u(s,e,t,i),c(s.enabled,`${t}.enabled`,i),c(s.persist,`${t}.persist`,i),f(s.head_sampling_rate,`${t}.head_sampling_rate`,i);const{destinations:n}=s;return n!==void 0&&(!Array.isArray(n)||n.some(o=>typeof o!="string"||o.length===0))&&i.errors.push(`${t}.destinations must be an array of destination names configured in the Cloudflare dashboard`),s},w=(s,t,e)=>{const{observability:i}=s;if(i===void 0)return;if(!l(i)){t.push('observability must be an object (e.g. { "enabled": true, "head_sampling_rate": 1 })');return}const n={errors:t,warnings:e};u(i,A,"observability",n),c(i.enabled,"observability.enabled",n),f(i.head_sampling_rate,"observability.head_sampling_rate",n);const o=p(i.logs,"observability.logs",S,n);o?.invocation_logs!==void 0&&typeof o.invocation_logs!="boolean"&&t.push('observability.logs.invocation_logs must be a boolean (set "invocation_logs": true to keep per-invocation summaries)'),p(i.traces,"observability.traces",m,n);const{issues:a}=i;a!==void 0&&(l(a)?(u(a,E,"observability.issues",n),c(a.enabled,"observability.issues.enabled",n)):t.push("observability.issues must be an object"))},C=(s,t)=>{const{cache:e}=s;if(e!==void 0){if(typeof e!="object"||e===null||Array.isArray(e)){t.push('cache must be an object (e.g. { "enabled": true })');return}e.enabled!==void 0&&typeof e.enabled!="boolean"&&t.push("cache.enabled must be a boolean (true or false)")}},x=(s,t)=>{const{exports:e}=s;if(e!==void 0){if(typeof e!="object"||e===null||Array.isArray(e)){t.push("exports must be an object keyed by entrypoint name");return}for(const[i,n]of Object.entries(e)){if(typeof n!="object"||n===null){t.push(`exports["${i}"] must be an object`);continue}n.type!==void 0&&typeof n.type!="string"&&t.push(`exports["${i}"].type must be a string`),n.cache!==void 0&&(typeof n.cache!="object"||n.cache===null||Array.isArray(n.cache)?t.push(`exports["${i}"].cache must be an object`):n.cache.enabled!==void 0&&typeof n.cache.enabled!="boolean"&&t.push(`exports["${i}"].cache.enabled must be a boolean`))}}},T=(s,t)=>{const{assets:e}=s;if(e!==void 0){if(typeof e!="object"||Array.isArray(e)){t.push('assets must be an object (e.g. { "directory": "./dist/client", "binding": "ASSETS" })');return}(typeof e.directory!="string"||e.directory.length===0)&&t.push('assets must declare a non-empty "directory" pointing at the built client output (e.g. "./dist/client")'),e.binding!==void 0&&(typeof e.binding!="string"||e.binding.length===0)&&t.push('assets.binding must be a non-empty string (e.g. "ASSETS")'),e.html_handling!==void 0&&typeof e.html_handling!="string"&&t.push("assets.html_handling must be a string"),e.not_found_handling!==void 0&&typeof e.not_found_handling!="string"&&t.push("assets.not_found_handling must be a string")}},U=(s,t)=>{const e=s.tail_consumers;if(e===void 0)return;if(!Array.isArray(e)){t.push("tail_consumers must be an array of { service, environment? } entries");return}const i=e;for(const[n,o]of i.entries())(!o||typeof o!="object"||typeof o.service!="string"||o.service.length===0)&&t.push(`tail_consumers[${String(n)}] must have a non-empty "service" naming the consumer Worker`)},B=(s,t)=>{const e=s.tail_consumers??[];return e.some(n=>!!n&&n?.service===t.service&&n?.environment===t.environment)?s:{...s,tail_consumers:[...e,t]}},D=(s,t)=>{const{vars:e}=s;if(!e||typeof e!="object")return;const i=e.LUNORA_ALLOWED_ORIGINS,n=e.LUNORA_CORS_ALLOW_CREDENTIALS,o=typeof i=="string"&&i.split(",").some(h=>h.trim()==="*"),a=_(n);o&&a&&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')},O=s=>g(s.durable_objects?.bindings).some(t=>t.class_name==="SchedulerDO"&&t.script_name===void 0),r="LUNORA_ORIGIN_URL",Y=(s,t,e)=>{if(!O(s)||y(s.vars?.[r]))return;const i=t===void 0?"vars":`env.${t}.vars`,n=t===void 0?"":` --env ${t}`;e.push(`durable_objects.bindings declares the SchedulerDO but ${i}.${r} 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}.${r} to the worker's public URL, or \`wrangler secret put ${r}${n}\` (ignore this if it is already set as a secret or in the dashboard).`)};export{T as validateAssets,C as validateCache,D as validateCorsVariables,x as validateExports,I as validateLimits,$ as validateLogpush,w as validateObservability,N as validatePlacement,Y as validateSchedulerOrigin,R as validateSecretsRequired,L as validateSendEmail,U as validateTailConsumers,B as withTailConsumer};