@lunora/config 1.0.0-alpha.374 → 1.0.0-alpha.375

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 (30) hide show
  1. package/dist/cloudflare/index.d.mts +64 -13
  2. package/dist/cloudflare/index.d.ts +64 -13
  3. package/dist/cloudflare/index.mjs +1 -1
  4. package/dist/index.d.mts +2 -2
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.mjs +1 -1
  7. package/dist/packem_shared/HYPERDRIVE_PLACEHOLDER_ID-DZn1Fk4-.mjs +2 -0
  8. package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-CWip0s4I.mjs +1 -0
  9. package/dist/packem_shared/{REQUIRED_COMPATIBILITY_DATE-OLQlG0oj.mjs → REQUIRED_COMPATIBILITY_DATE-D4UcOP_t.mjs} +1 -1
  10. package/dist/packem_shared/{UNEXPORTED_CLASS_MARKER-DwJCN8fX.mjs → UNEXPORTED_CLASS_MARKER-mdcw5KDY.mjs} +1 -1
  11. package/dist/packem_shared/{assertWranglerSatisfiesSchema-D4FA4jKB.mjs → assertWranglerSatisfiesSchema-B4DcaiJY.mjs} +1 -1
  12. package/dist/packem_shared/describeWithheld-BAaWBzKD.mjs +1 -0
  13. package/dist/packem_shared/{infer-bindings.d-eFzcOnRh.d.mts → infer-bindings.d-Dp1zxdUZ.d.mts} +6 -5
  14. package/dist/packem_shared/{infer-bindings.d-eFzcOnRh.d.ts → infer-bindings.d-Dp1zxdUZ.d.ts} +6 -5
  15. package/dist/packem_shared/inferLunoraBindings-CH8xwMCn.mjs +1 -0
  16. package/dist/packem_shared/materializeServiceDevConfigs-CEopS6Al.mjs +1 -0
  17. package/dist/packem_shared/mergeWranglerEnvironment-D5ekKj5x.mjs +1 -0
  18. package/dist/packem_shared/reconcileBindingsSafely-D9H8UIvK.mjs +1 -0
  19. package/dist/packem_shared/startLocalHyperdrive-6eD6Qtqf.mjs +3 -0
  20. package/dist/packem_shared/{validate-bindings-CvNBF3U4.mjs → validate-bindings-PVHSAU6M.mjs} +1 -1
  21. package/dist/packem_shared/{withTailConsumer-DngzpJMK.mjs → withTailConsumer-CF3pk_Ov.mjs} +1 -1
  22. package/package.json +14 -2
  23. package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-PLeh_74E.mjs +0 -1
  24. package/dist/packem_shared/collectExportGaps-BPuhGH2J.mjs +0 -2
  25. package/dist/packem_shared/describeWithheldWorkersAi-IIxe3TuI.mjs +0 -1
  26. package/dist/packem_shared/infer-bindings-C1NFOdMi.mjs +0 -1
  27. package/dist/packem_shared/inferLunoraBindings-Gp_7yyIo.mjs +0 -1
  28. package/dist/packem_shared/materializeServiceDevConfigs-DLUHefD-.mjs +0 -1
  29. package/dist/packem_shared/mergeWranglerEnvironment-DXiB-HcS.mjs +0 -1
  30. package/dist/packem_shared/reconcileBindingsSafely-BEwmwy0q.mjs +0 -1
@@ -1,5 +1,5 @@
1
1
  import { D as DeployDriver } from "../packem_shared/deploy-driver.d-Cl96-c1l.mjs";
2
- import { d as GeneratedClassModule, f as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-eFzcOnRh.mjs";
2
+ import { d as GeneratedClassModule, f as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-Dp1zxdUZ.mjs";
3
3
  import { WranglerQueueProducerIR, WranglerVariableIR } from '@lunora/codegen';
4
4
  /** Apply one structural jsonc edit and return the rewritten text (a no-op edit returns the input). */
5
5
  declare const applyModify: (text: string, path: ReadonlyArray<number | string>, value: unknown) => string;
@@ -332,15 +332,64 @@ interface CloudflareCredentialProbe {
332
332
  declare const hasCloudflareCredentials: (probe?: CloudflareCredentialProbe) => boolean;
333
333
  /** Which kind of temp config a file is, in its name. */
334
334
  type DevConfigKind = "dev" | "service";
335
+ /** A remote-only binding a logged-out dev session leaves out: which kind it is, and the name the app gave it. */
336
+ interface WithheldBinding {
337
+ binding: string;
338
+ kind: "ai" | "artifacts";
339
+ }
340
+ /** The slice of a worker config the rule reads. */
341
+ interface RemoteOnlyBindings {
342
+ ai?: {
343
+ binding?: string;
344
+ } | null;
345
+ artifacts?: ReadonlyArray<{
346
+ binding?: string;
347
+ } | null | undefined> | null;
348
+ }
335
349
  /**
336
- * The binding name to withhold from a logged-out dev session, or `undefined` to keep
337
- * it. The credential probe runs only when an `ai` binding is declared at all.
350
+ * The bindings to withhold from a logged-out dev session. Workers AI and Artifacts have no
351
+ * local simulator, so each opens a remote proxy session at boot that fails without a login and
352
+ * takes the dev server down. The credential probe runs only when one of them is declared.
338
353
  */
339
- declare const withheldWorkersAi: (ai: {
340
- binding?: string;
341
- } | null | undefined, hasCredentials: () => boolean) => string | undefined;
342
- /** The one dev warning for a withheld Workers AI binding, shared by `lunora dev` and `@lunora/vite`. */
343
- declare const describeWithheldWorkersAi: (binding: string) => string;
354
+ declare const withheldBindings: (config: RemoteOnlyBindings | undefined, hasCredentials: () => boolean) => WithheldBinding[];
355
+ /** The one dev warning for a withheld binding, shared by `lunora dev` and `@lunora/vite`. */
356
+ declare const describeWithheld: ({ binding, kind }: WithheldBinding) => string;
357
+ /** The slice of PGlite this module drives, so a test can stand in for the WASM engine. */
358
+ interface PgliteRuntime {
359
+ createServer: (dataDirectory: string) => Promise<{
360
+ connectionString: string;
361
+ stop: () => Promise<void>;
362
+ }>;
363
+ }
364
+ interface StartLocalHyperdriveOptions {
365
+ /** Defaults to `process.env`; the connection strings are written here and removed again by `stop`. */
366
+ env?: NodeJS.ProcessEnv;
367
+ /** Injection seam; defaults to the real PGlite. Resolves `undefined` when it is not installed. */
368
+ load?: () => Promise<PgliteRuntime | undefined>;
369
+ /** Called once with a line to show the developer when the database could not be started. */
370
+ onWarning?: (message: string) => void;
371
+ projectRoot: string;
372
+ /** The wrangler config the session actually runs (the Cloudflare plugin's `configPath`); defaults to the project's own. */
373
+ wranglerConfigPath?: string;
374
+ }
375
+ interface LocalHyperdrive {
376
+ /** The bindings served by PGlite. */
377
+ bindings: string[];
378
+ stop: () => Promise<void>;
379
+ }
380
+ /**
381
+ * Start a PGlite for every Hyperdrive binding with no local database, and point
382
+ * wrangler at it through its environment variable. Resolves `undefined` when
383
+ * there is nothing to serve, or when PGlite is not installed (after saying how
384
+ * to install it).
385
+ */
386
+ declare const startLocalHyperdrive: (options: StartLocalHyperdriveOptions) => Promise<LocalHyperdrive | undefined>;
387
+ /**
388
+ * The `id` reconcile writes on a Hyperdrive binding it adds, and the one the `hyperdrive`
389
+ * registry item ships: wrangler requires a string, and `lunora dev` serves the binding from an
390
+ * embedded Postgres whatever it is. `lunora deploy` swaps in a real id.
391
+ */
392
+ declare const HYPERDRIVE_PLACEHOLDER_ID = "<replace-with-hyperdrive-create-id>";
344
393
  /**
345
394
  * A container/workflow that is declared (so codegen emits its class) but the
346
395
  * worker entry never re-exports — the one wiring step the generators can't always
@@ -627,6 +676,7 @@ type RemoteEligibleKey = keyof typeof REMOTE_ELIGIBLE_KEYS;
627
676
  /** One binding object as it appears in any eligible section. */
628
677
  interface BindingEntry {
629
678
  binding?: string;
679
+ id?: unknown;
630
680
  remote?: boolean;
631
681
  }
632
682
  /** One binding entry we mark remote, with enough provenance to log + edit it. */
@@ -651,6 +701,7 @@ interface RemoteWranglerShape {
651
701
  ai_search?: ReadonlyArray<BindingEntry | null | undefined>;
652
702
  ai_search_namespaces?: ReadonlyArray<BindingEntry | null | undefined>;
653
703
  analytics?: BindingEntry | null;
704
+ artifacts?: ReadonlyArray<BindingEntry | null | undefined>;
654
705
  d1_databases?: ReadonlyArray<BindingEntry | null | undefined>;
655
706
  kv_namespaces?: ReadonlyArray<BindingEntry | null | undefined>;
656
707
  queues?: {
@@ -692,7 +743,7 @@ interface MaterializeDevResult {
692
743
  /** The bindings flipped to remote, for the dev banner. */
693
744
  remoteBindings: RemoteBindingPlan[];
694
745
  /** The `ai` binding name left out for lack of Cloudflare credentials, for the dev warning. */
695
- withheld: string[];
746
+ withheld: WithheldBinding[];
696
747
  }
697
748
  /**
698
749
  * Write the temp wrangler config a dev session runs with: the user's file with any
@@ -743,8 +794,8 @@ interface ServiceDevConfigs {
743
794
  /** Unlinks every copy written. Idempotent, never throws — a no-op when none was. */
744
795
  cleanup: () => void;
745
796
  configPaths: string[];
746
- /** The `ai` binding names left out of a service copy for lack of Cloudflare credentials, for the dev warning. */
747
- withheld: string[];
797
+ /** The remote-only bindings (`ai`, `artifacts`) left out of a service copy for lack of Cloudflare credentials, for the dev warning. */
798
+ withheld: WithheldBinding[];
748
799
  }
749
800
  interface ServiceMaterializeOptions {
750
801
  /** Whether wrangler can authenticate; defaults to a probe of `projectRoot`. */
@@ -1234,7 +1285,7 @@ declare const validateWranglerConfig: (wranglerInput: WranglerConfig | undefined
1234
1285
  * `{ valid, errors, warnings }`.
1235
1286
  */
1236
1287
  declare const validateWrangler: typeof validateWranglerConfig;
1237
- export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_VERSION, type BindingManifest, type BindingRequirement, CLOUDFLARE_CLI_CONFIG_WARNING_ENV, CLOUDFLARE_DRIVER, CLOUDFLARE_TOOLCHAIN_VERSIONS, type CloudflareCliConfigFinding, type CloudflareCredentialProbe, DEFAULT_OBSERVABILITY, type DevConfigKind, type ExportGap, GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG, type ManifestConfigShape, type MaterializeDevOptions, type MaterializeDevResult, 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 WranglerCodegenInputs, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerObservability, type WranglerObservabilityLogs, type WranglerObservabilityTraces, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry,
1288
+ export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_VERSION, type BindingManifest, type BindingRequirement, CLOUDFLARE_CLI_CONFIG_WARNING_ENV, CLOUDFLARE_DRIVER, CLOUDFLARE_TOOLCHAIN_VERSIONS, type CloudflareCliConfigFinding, type CloudflareCredentialProbe, DEFAULT_OBSERVABILITY, type DevConfigKind, type ExportGap, GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG, HYPERDRIVE_PLACEHOLDER_ID, type LocalHyperdrive, type ManifestConfigShape, type MaterializeDevOptions, type MaterializeDevResult, 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 WithheldBinding, type WranglerCacheShape, type WranglerCodegenInputs, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerObservability, type WranglerObservabilityLogs, type WranglerObservabilityTraces, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry,
1238
1289
  /**
1239
1290
  * `@lunora/config/cloudflare` — the wrangler layer.
1240
1291
  *
@@ -1250,4 +1301,4 @@ export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_V
1250
1301
  * Plan 114 §5.3 (D6): a package carrying real provider code isolates it behind a
1251
1302
  * subpath rather than relocating wholesale.
1252
1303
  */
1253
- applyModify, assertWranglerSatisfiesSchema, buildBindingManifest, collectExportGaps, describePreservedCrons, describeWithheldWorkersAi, detectCloudflareCliConfig, findWranglerFile, hasCloudflareCredentials, injectRemoteFlags, isCacheEnabled, isRemoteEnvEnabled, materializeDevWranglerConfig, materializeServiceDevConfigs, mergeWranglerEnvironment, planRemoteBindings, readWranglerJsonc, reconcileBindingsSafely, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, reconcileWranglerExtras, resolveObservabilitySampling, resolveRemoteEnabled, scanWranglerVariablesForSecrets, validateWrangler, validateWranglerConfig, validateWranglerProject, warnCloudflareCliConfigOnce, withTailConsumer, withheldWorkersAi, wranglerCodegenInputs, wranglerToAlchemy };
1304
+ applyModify, assertWranglerSatisfiesSchema, buildBindingManifest, collectExportGaps, describePreservedCrons, describeWithheld, detectCloudflareCliConfig, findWranglerFile, hasCloudflareCredentials, injectRemoteFlags, isCacheEnabled, isRemoteEnvEnabled, materializeDevWranglerConfig, materializeServiceDevConfigs, mergeWranglerEnvironment, planRemoteBindings, readWranglerJsonc, reconcileBindingsSafely, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, reconcileWranglerExtras, resolveObservabilitySampling, resolveRemoteEnabled, scanWranglerVariablesForSecrets, startLocalHyperdrive, validateWrangler, validateWranglerConfig, validateWranglerProject, warnCloudflareCliConfigOnce, withTailConsumer, withheldBindings, wranglerCodegenInputs, wranglerToAlchemy };
@@ -1,5 +1,5 @@
1
1
  import { D as DeployDriver } from "../packem_shared/deploy-driver.d-Cl96-c1l.js";
2
- import { d as GeneratedClassModule, f as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-eFzcOnRh.js";
2
+ import { d as GeneratedClassModule, f as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-Dp1zxdUZ.js";
3
3
  import { WranglerQueueProducerIR, WranglerVariableIR } from '@lunora/codegen';
4
4
  /** Apply one structural jsonc edit and return the rewritten text (a no-op edit returns the input). */
5
5
  declare const applyModify: (text: string, path: ReadonlyArray<number | string>, value: unknown) => string;
@@ -332,15 +332,64 @@ interface CloudflareCredentialProbe {
332
332
  declare const hasCloudflareCredentials: (probe?: CloudflareCredentialProbe) => boolean;
333
333
  /** Which kind of temp config a file is, in its name. */
334
334
  type DevConfigKind = "dev" | "service";
335
+ /** A remote-only binding a logged-out dev session leaves out: which kind it is, and the name the app gave it. */
336
+ interface WithheldBinding {
337
+ binding: string;
338
+ kind: "ai" | "artifacts";
339
+ }
340
+ /** The slice of a worker config the rule reads. */
341
+ interface RemoteOnlyBindings {
342
+ ai?: {
343
+ binding?: string;
344
+ } | null;
345
+ artifacts?: ReadonlyArray<{
346
+ binding?: string;
347
+ } | null | undefined> | null;
348
+ }
335
349
  /**
336
- * The binding name to withhold from a logged-out dev session, or `undefined` to keep
337
- * it. The credential probe runs only when an `ai` binding is declared at all.
350
+ * The bindings to withhold from a logged-out dev session. Workers AI and Artifacts have no
351
+ * local simulator, so each opens a remote proxy session at boot that fails without a login and
352
+ * takes the dev server down. The credential probe runs only when one of them is declared.
338
353
  */
339
- declare const withheldWorkersAi: (ai: {
340
- binding?: string;
341
- } | null | undefined, hasCredentials: () => boolean) => string | undefined;
342
- /** The one dev warning for a withheld Workers AI binding, shared by `lunora dev` and `@lunora/vite`. */
343
- declare const describeWithheldWorkersAi: (binding: string) => string;
354
+ declare const withheldBindings: (config: RemoteOnlyBindings | undefined, hasCredentials: () => boolean) => WithheldBinding[];
355
+ /** The one dev warning for a withheld binding, shared by `lunora dev` and `@lunora/vite`. */
356
+ declare const describeWithheld: ({ binding, kind }: WithheldBinding) => string;
357
+ /** The slice of PGlite this module drives, so a test can stand in for the WASM engine. */
358
+ interface PgliteRuntime {
359
+ createServer: (dataDirectory: string) => Promise<{
360
+ connectionString: string;
361
+ stop: () => Promise<void>;
362
+ }>;
363
+ }
364
+ interface StartLocalHyperdriveOptions {
365
+ /** Defaults to `process.env`; the connection strings are written here and removed again by `stop`. */
366
+ env?: NodeJS.ProcessEnv;
367
+ /** Injection seam; defaults to the real PGlite. Resolves `undefined` when it is not installed. */
368
+ load?: () => Promise<PgliteRuntime | undefined>;
369
+ /** Called once with a line to show the developer when the database could not be started. */
370
+ onWarning?: (message: string) => void;
371
+ projectRoot: string;
372
+ /** The wrangler config the session actually runs (the Cloudflare plugin's `configPath`); defaults to the project's own. */
373
+ wranglerConfigPath?: string;
374
+ }
375
+ interface LocalHyperdrive {
376
+ /** The bindings served by PGlite. */
377
+ bindings: string[];
378
+ stop: () => Promise<void>;
379
+ }
380
+ /**
381
+ * Start a PGlite for every Hyperdrive binding with no local database, and point
382
+ * wrangler at it through its environment variable. Resolves `undefined` when
383
+ * there is nothing to serve, or when PGlite is not installed (after saying how
384
+ * to install it).
385
+ */
386
+ declare const startLocalHyperdrive: (options: StartLocalHyperdriveOptions) => Promise<LocalHyperdrive | undefined>;
387
+ /**
388
+ * The `id` reconcile writes on a Hyperdrive binding it adds, and the one the `hyperdrive`
389
+ * registry item ships: wrangler requires a string, and `lunora dev` serves the binding from an
390
+ * embedded Postgres whatever it is. `lunora deploy` swaps in a real id.
391
+ */
392
+ declare const HYPERDRIVE_PLACEHOLDER_ID = "<replace-with-hyperdrive-create-id>";
344
393
  /**
345
394
  * A container/workflow that is declared (so codegen emits its class) but the
346
395
  * worker entry never re-exports — the one wiring step the generators can't always
@@ -627,6 +676,7 @@ type RemoteEligibleKey = keyof typeof REMOTE_ELIGIBLE_KEYS;
627
676
  /** One binding object as it appears in any eligible section. */
628
677
  interface BindingEntry {
629
678
  binding?: string;
679
+ id?: unknown;
630
680
  remote?: boolean;
631
681
  }
632
682
  /** One binding entry we mark remote, with enough provenance to log + edit it. */
@@ -651,6 +701,7 @@ interface RemoteWranglerShape {
651
701
  ai_search?: ReadonlyArray<BindingEntry | null | undefined>;
652
702
  ai_search_namespaces?: ReadonlyArray<BindingEntry | null | undefined>;
653
703
  analytics?: BindingEntry | null;
704
+ artifacts?: ReadonlyArray<BindingEntry | null | undefined>;
654
705
  d1_databases?: ReadonlyArray<BindingEntry | null | undefined>;
655
706
  kv_namespaces?: ReadonlyArray<BindingEntry | null | undefined>;
656
707
  queues?: {
@@ -692,7 +743,7 @@ interface MaterializeDevResult {
692
743
  /** The bindings flipped to remote, for the dev banner. */
693
744
  remoteBindings: RemoteBindingPlan[];
694
745
  /** The `ai` binding name left out for lack of Cloudflare credentials, for the dev warning. */
695
- withheld: string[];
746
+ withheld: WithheldBinding[];
696
747
  }
697
748
  /**
698
749
  * Write the temp wrangler config a dev session runs with: the user's file with any
@@ -743,8 +794,8 @@ interface ServiceDevConfigs {
743
794
  /** Unlinks every copy written. Idempotent, never throws — a no-op when none was. */
744
795
  cleanup: () => void;
745
796
  configPaths: string[];
746
- /** The `ai` binding names left out of a service copy for lack of Cloudflare credentials, for the dev warning. */
747
- withheld: string[];
797
+ /** The remote-only bindings (`ai`, `artifacts`) left out of a service copy for lack of Cloudflare credentials, for the dev warning. */
798
+ withheld: WithheldBinding[];
748
799
  }
749
800
  interface ServiceMaterializeOptions {
750
801
  /** Whether wrangler can authenticate; defaults to a probe of `projectRoot`. */
@@ -1234,7 +1285,7 @@ declare const validateWranglerConfig: (wranglerInput: WranglerConfig | undefined
1234
1285
  * `{ valid, errors, warnings }`.
1235
1286
  */
1236
1287
  declare const validateWrangler: typeof validateWranglerConfig;
1237
- export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_VERSION, type BindingManifest, type BindingRequirement, CLOUDFLARE_CLI_CONFIG_WARNING_ENV, CLOUDFLARE_DRIVER, CLOUDFLARE_TOOLCHAIN_VERSIONS, type CloudflareCliConfigFinding, type CloudflareCredentialProbe, DEFAULT_OBSERVABILITY, type DevConfigKind, type ExportGap, GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG, type ManifestConfigShape, type MaterializeDevOptions, type MaterializeDevResult, 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 WranglerCodegenInputs, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerObservability, type WranglerObservabilityLogs, type WranglerObservabilityTraces, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry,
1288
+ export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_VERSION, type BindingManifest, type BindingRequirement, CLOUDFLARE_CLI_CONFIG_WARNING_ENV, CLOUDFLARE_DRIVER, CLOUDFLARE_TOOLCHAIN_VERSIONS, type CloudflareCliConfigFinding, type CloudflareCredentialProbe, DEFAULT_OBSERVABILITY, type DevConfigKind, type ExportGap, GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG, HYPERDRIVE_PLACEHOLDER_ID, type LocalHyperdrive, type ManifestConfigShape, type MaterializeDevOptions, type MaterializeDevResult, 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 WithheldBinding, type WranglerCacheShape, type WranglerCodegenInputs, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerObservability, type WranglerObservabilityLogs, type WranglerObservabilityTraces, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry,
1238
1289
  /**
1239
1290
  * `@lunora/config/cloudflare` — the wrangler layer.
1240
1291
  *
@@ -1250,4 +1301,4 @@ export { type AlchemyTranslation, type AssertWranglerOptions, BINDING_MANIFEST_V
1250
1301
  * Plan 114 §5.3 (D6): a package carrying real provider code isolates it behind a
1251
1302
  * subpath rather than relocating wholesale.
1252
1303
  */
1253
- applyModify, assertWranglerSatisfiesSchema, buildBindingManifest, collectExportGaps, describePreservedCrons, describeWithheldWorkersAi, detectCloudflareCliConfig, findWranglerFile, hasCloudflareCredentials, injectRemoteFlags, isCacheEnabled, isRemoteEnvEnabled, materializeDevWranglerConfig, materializeServiceDevConfigs, mergeWranglerEnvironment, planRemoteBindings, readWranglerJsonc, reconcileBindingsSafely, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, reconcileWranglerExtras, resolveObservabilitySampling, resolveRemoteEnabled, scanWranglerVariablesForSecrets, validateWrangler, validateWranglerConfig, validateWranglerProject, warnCloudflareCliConfigOnce, withTailConsumer, withheldWorkersAi, wranglerCodegenInputs, wranglerToAlchemy };
1304
+ applyModify, assertWranglerSatisfiesSchema, buildBindingManifest, collectExportGaps, describePreservedCrons, describeWithheld, detectCloudflareCliConfig, findWranglerFile, hasCloudflareCredentials, injectRemoteFlags, isCacheEnabled, isRemoteEnvEnabled, materializeDevWranglerConfig, materializeServiceDevConfigs, mergeWranglerEnvironment, planRemoteBindings, readWranglerJsonc, reconcileBindingsSafely, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, reconcileWranglerExtras, resolveObservabilitySampling, resolveRemoteEnabled, scanWranglerVariablesForSecrets, startLocalHyperdrive, validateWrangler, validateWranglerConfig, validateWranglerProject, warnCloudflareCliConfigOnce, withTailConsumer, withheldBindings, wranglerCodegenInputs, wranglerToAlchemy };
@@ -1 +1 @@
1
- import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{assertWranglerSatisfiesSchema as l}from"../packem_shared/assertWranglerSatisfiesSchema-D4FA4jKB.mjs";import{BINDING_MANIFEST_VERSION as i,buildBindingManifest as n}from"../packem_shared/BINDING_MANIFEST_VERSION-CfXEYG8e.mjs";import{CLOUDFLARE_CLI_CONFIG_WARNING_ENV as m,detectCloudflareCliConfig as E,warnCloudflareCliConfigOnce as s}from"../packem_shared/CLOUDFLARE_CLI_CONFIG_WARNING_ENV-BKMrOuXV.mjs";import{default as C}from"../packem_shared/CLOUDFLARE_DRIVER-CULavrYO.mjs";import{default as g}from"../packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs";import{hasCloudflareCredentials as R}from"../packem_shared/hasCloudflareCredentials-byvHpEiD.mjs";import{describeWithheldWorkersAi as _,withheldWorkersAi as I}from"../packem_shared/describeWithheldWorkersAi-IIxe3TuI.mjs";import{collectExportGaps as A,reconcileWranglerBindings as W}from"../packem_shared/collectExportGaps-BPuhGH2J.mjs";import{reconcileWranglerCompatibilityDate as O}from"../packem_shared/reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{describePreservedCrons as D,reconcileWranglerCrons as F}from"../packem_shared/describePreservedCrons-C5KPuPy3.mjs";import{reconcileBindingsSafely as v,reconcileWranglerExtras as B}from"../packem_shared/reconcileBindingsSafely-BEwmwy0q.mjs";import{REMOTE_ELIGIBLE_KEYS as h,injectRemoteFlags as u,isRemoteEnvEnabled as G,materializeDevWranglerConfig as U,planRemoteBindings as M,resolveRemoteEnabled as y}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-PLeh_74E.mjs";import{materializeServiceDevConfigs as w}from"../packem_shared/materializeServiceDevConfigs-DLUHefD-.mjs";import{default as Y}from"../packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DV5E_f_q.mjs";import{withTailConsumer as K}from"../packem_shared/withTailConsumer-DngzpJMK.mjs";import{WORKERS_CACHE_MIN_DATE as k,isCacheEnabled as z}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{wranglerCodegenInputs as J}from"../packem_shared/wranglerCodegenInputs-CbisphsH.mjs";import{DEFAULT_OBSERVABILITY as q,resolveObservabilitySampling as Z}from"../packem_shared/DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import{mergeWranglerEnvironment as ee}from"../packem_shared/mergeWranglerEnvironment-DXiB-HcS.mjs";import{WRANGLER_FILES as oe,findWranglerFile as ae,readWranglerJsonc as le}from"../packem_shared/WRANGLER_FILES-UNW-xY5u.mjs";import{UNEXPORTED_CLASS_MARKER as ie,validateWranglerProject as ne}from"../packem_shared/UNEXPORTED_CLASS_MARKER-DwJCN8fX.mjs";import{scanWranglerVariablesForSecrets as me}from"../packem_shared/scanWranglerVariablesForSecrets-BFTVje1q.mjs";import{wranglerToAlchemy as se}from"../packem_shared/wranglerToAlchemy-CBO2ucRm.mjs";import{REQUIRED_COMPATIBILITY_DATE as Ce,REQUIRED_FLAG as de,validateWrangler as ge,validateWranglerConfig as xe}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-OLQlG0oj.mjs";export{i as BINDING_MANIFEST_VERSION,m as CLOUDFLARE_CLI_CONFIG_WARNING_ENV,C as CLOUDFLARE_DRIVER,Y as CLOUDFLARE_TOOLCHAIN_VERSIONS,q as DEFAULT_OBSERVABILITY,g as GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG,h as REMOTE_ELIGIBLE_KEYS,Ce as REQUIRED_COMPATIBILITY_DATE,de as REQUIRED_FLAG,ie as UNEXPORTED_CLASS_MARKER,k as WORKERS_CACHE_MIN_DATE,oe as WRANGLER_FILES,o as applyModify,l as assertWranglerSatisfiesSchema,n as buildBindingManifest,A as collectExportGaps,D as describePreservedCrons,_ as describeWithheldWorkersAi,E as detectCloudflareCliConfig,ae as findWranglerFile,R as hasCloudflareCredentials,u as injectRemoteFlags,z as isCacheEnabled,G as isRemoteEnvEnabled,U as materializeDevWranglerConfig,w as materializeServiceDevConfigs,ee as mergeWranglerEnvironment,M as planRemoteBindings,le as readWranglerJsonc,v as reconcileBindingsSafely,W as reconcileWranglerBindings,O as reconcileWranglerCompatibilityDate,F as reconcileWranglerCrons,B as reconcileWranglerExtras,Z as resolveObservabilitySampling,y as resolveRemoteEnabled,me as scanWranglerVariablesForSecrets,ge as validateWrangler,xe as validateWranglerConfig,ne as validateWranglerProject,s as warnCloudflareCliConfigOnce,K as withTailConsumer,I as withheldWorkersAi,J as wranglerCodegenInputs,se as wranglerToAlchemy};
1
+ import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{assertWranglerSatisfiesSchema as t}from"../packem_shared/assertWranglerSatisfiesSchema-B4DcaiJY.mjs";import{BINDING_MANIFEST_VERSION as n,buildBindingManifest as i}from"../packem_shared/BINDING_MANIFEST_VERSION-CfXEYG8e.mjs";import{CLOUDFLARE_CLI_CONFIG_WARNING_ENV as E,detectCloudflareCliConfig as m,warnCloudflareCliConfigOnce as p}from"../packem_shared/CLOUDFLARE_CLI_CONFIG_WARNING_ENV-BKMrOuXV.mjs";import{default as C}from"../packem_shared/CLOUDFLARE_DRIVER-CULavrYO.mjs";import{default as g}from"../packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs";import{hasCloudflareCredentials as x}from"../packem_shared/hasCloudflareCredentials-byvHpEiD.mjs";import{describeWithheld as c,withheldBindings as I}from"../packem_shared/describeWithheld-BAaWBzKD.mjs";import{startLocalHyperdrive as A}from"../packem_shared/startLocalHyperdrive-6eD6Qtqf.mjs";import{HYPERDRIVE_PLACEHOLDER_ID as O,collectExportGaps as S,reconcileWranglerBindings as W}from"../packem_shared/HYPERDRIVE_PLACEHOLDER_ID-DZn1Fk4-.mjs";import{reconcileWranglerCompatibilityDate as v}from"../packem_shared/reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{describePreservedCrons as N,reconcileWranglerCrons as B}from"../packem_shared/describePreservedCrons-C5KPuPy3.mjs";import{reconcileBindingsSafely as h,reconcileWranglerExtras as u}from"../packem_shared/reconcileBindingsSafely-D9H8UIvK.mjs";import{REMOTE_ELIGIBLE_KEYS as U,injectRemoteFlags as y,isRemoteEnvEnabled as M,materializeDevWranglerConfig as P,planRemoteBindings as V,resolveRemoteEnabled as H}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-CWip0s4I.mjs";import{materializeServiceDevConfigs as Y}from"../packem_shared/materializeServiceDevConfigs-CEopS6Al.mjs";import{default as j}from"../packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DV5E_f_q.mjs";import{withTailConsumer as Q}from"../packem_shared/withTailConsumer-CF3pk_Ov.mjs";import{WORKERS_CACHE_MIN_DATE as X,isCacheEnabled as k}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{wranglerCodegenInputs as Z}from"../packem_shared/wranglerCodegenInputs-CbisphsH.mjs";import{DEFAULT_OBSERVABILITY as ee,resolveObservabilitySampling as re}from"../packem_shared/DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import{mergeWranglerEnvironment as ae}from"../packem_shared/mergeWranglerEnvironment-D5ekKj5x.mjs";import{WRANGLER_FILES as le,findWranglerFile as ne,readWranglerJsonc as ie}from"../packem_shared/WRANGLER_FILES-UNW-xY5u.mjs";import{UNEXPORTED_CLASS_MARKER as Ee,validateWranglerProject as me}from"../packem_shared/UNEXPORTED_CLASS_MARKER-mdcw5KDY.mjs";import{scanWranglerVariablesForSecrets as se}from"../packem_shared/scanWranglerVariablesForSecrets-BFTVje1q.mjs";import{wranglerToAlchemy as de}from"../packem_shared/wranglerToAlchemy-CBO2ucRm.mjs";import{REQUIRED_COMPATIBILITY_DATE as Re,REQUIRED_FLAG as xe,validateWrangler as _e,validateWranglerConfig as ce}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-D4UcOP_t.mjs";export{n as BINDING_MANIFEST_VERSION,E as CLOUDFLARE_CLI_CONFIG_WARNING_ENV,C as CLOUDFLARE_DRIVER,j as CLOUDFLARE_TOOLCHAIN_VERSIONS,ee as DEFAULT_OBSERVABILITY,g as GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG,O as HYPERDRIVE_PLACEHOLDER_ID,U as REMOTE_ELIGIBLE_KEYS,Re as REQUIRED_COMPATIBILITY_DATE,xe as REQUIRED_FLAG,Ee as UNEXPORTED_CLASS_MARKER,X as WORKERS_CACHE_MIN_DATE,le as WRANGLER_FILES,o as applyModify,t as assertWranglerSatisfiesSchema,i as buildBindingManifest,S as collectExportGaps,N as describePreservedCrons,c as describeWithheld,m as detectCloudflareCliConfig,ne as findWranglerFile,x as hasCloudflareCredentials,y as injectRemoteFlags,k as isCacheEnabled,M as isRemoteEnvEnabled,P as materializeDevWranglerConfig,Y as materializeServiceDevConfigs,ae as mergeWranglerEnvironment,V as planRemoteBindings,ie as readWranglerJsonc,h as reconcileBindingsSafely,W as reconcileWranglerBindings,v as reconcileWranglerCompatibilityDate,B as reconcileWranglerCrons,u as reconcileWranglerExtras,re as resolveObservabilitySampling,H as resolveRemoteEnabled,se as scanWranglerVariablesForSecrets,A as startLocalHyperdrive,_e as validateWrangler,ce as validateWranglerConfig,me as validateWranglerProject,p as warnCloudflareCliConfigOnce,Q as withTailConsumer,I as withheldBindings,Z as wranglerCodegenInputs,de 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
  export { A as ACCENT, a as AGENT_RULES_DIR, b as AGENT_RULES_HINT, c as AGENT_RULES_HINT_ENV, type d as AgentRulesStatus, B as BADGES, e as BADGE_COLUMN_WIDTH, type f as BadgeName, type g as BadgeSpec, D as DEFAULT_DEPLOY_TARGET, L as LUNA_ART, h as LUNA_BUNNY, i as LUNA_NAME, j as LUNA_SIGNOFF, k as LUNORA_SKILL_NAMES, l as LUNORA_TAG, type m as LevelBadgeName, n as LunoraReporter, type P as PackageManager, type o as PackageManagerProbe, R as ROOT_SKILL_NAME, S as STEP_BADGE_NAMES, type p as StepBadgeName, type T as ToolchainInvocation, q as addArgsFor, r as advisoryLine, s as badgeLead, t as badgeWidth, u as claimAgentRulesHint, v as deployTargetIds, w as detectAgentRules, x as detectInstalledManagers, y as detectPackageManager, z as execArgsFor, C as installArgsFor, E as isRunnableTarget, F as lunoraLine, G as padBadge, H as paintAnswer, I as paintBadge, J as planToolchainInvocation, K as readProjectDependencies, M as readProjectDependencyNames, N as readProjectManifest, O as resolveDeployDriver, Q as runScriptArgsFor, U as runScriptCommand, V as runnableTargetIds, W as targetRunsOwnDevServer, X as toolchainExecArgs } from "./packem_shared/index.d-DkNi7r6E.mjs";
4
4
  import { ChildProcess } from 'node:child_process';
5
- import { D as DiscoveryCache } from "./packem_shared/infer-bindings.d-eFzcOnRh.mjs";
6
- export { C as COMPOSED_WORKER_ENTRY, a as DURABLE_OBJECT_BINDINGS, type b as DiscoverSchemaInfoResult, G as GENERATED_CLASS_MODULES, c as GENERATED_MODULE_DURABLE_OBJECTS, type d as GeneratedClassModule, type I as InferOptions, type e as InferredAgent, type f as InferredBindings, type g as InferredContainer, type h as InferredWorkflow, M as MERGED_DURABLE_OBJECTS_MODULE, type S as SchemaInfo, i as createDiscoveryCache, j as discoverSchemaInfo, k as inferLunoraBindings, l as isMergedProject, m as isMergedRoleModule, s as secretSourcesFromBindings } from "./packem_shared/infer-bindings.d-eFzcOnRh.mjs";
5
+ import { D as DiscoveryCache } from "./packem_shared/infer-bindings.d-Dp1zxdUZ.mjs";
6
+ export { C as COMPOSED_WORKER_ENTRY, a as DURABLE_OBJECT_BINDINGS, type b as DiscoverSchemaInfoResult, G as GENERATED_CLASS_MODULES, c as GENERATED_MODULE_DURABLE_OBJECTS, type d as GeneratedClassModule, type I as InferOptions, type e as InferredAgent, type f as InferredBindings, type g as InferredContainer, type h as InferredWorkflow, M as MERGED_DURABLE_OBJECTS_MODULE, type S as SchemaInfo, i as createDiscoveryCache, j as discoverSchemaInfo, k as inferLunoraBindings, l as isMergedProject, m as isMergedRoleModule, s as secretSourcesFromBindings } from "./packem_shared/infer-bindings.d-Dp1zxdUZ.mjs";
7
7
  import { Writable } from 'node:stream';
8
8
  export type { D as DeployDriver, a as DeployRequest, b as DevRequest, c as DriverToolchain, P as ProjectedConfig, d as ProjectionPurpose, S as SecretRequest, T as TailRequest, e as ToolchainCommand } from "./packem_shared/deploy-driver.d-Cl96-c1l.mjs";
9
9
  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";
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
  export { A as ACCENT, a as AGENT_RULES_DIR, b as AGENT_RULES_HINT, c as AGENT_RULES_HINT_ENV, type d as AgentRulesStatus, B as BADGES, e as BADGE_COLUMN_WIDTH, type f as BadgeName, type g as BadgeSpec, D as DEFAULT_DEPLOY_TARGET, L as LUNA_ART, h as LUNA_BUNNY, i as LUNA_NAME, j as LUNA_SIGNOFF, k as LUNORA_SKILL_NAMES, l as LUNORA_TAG, type m as LevelBadgeName, n as LunoraReporter, type P as PackageManager, type o as PackageManagerProbe, R as ROOT_SKILL_NAME, S as STEP_BADGE_NAMES, type p as StepBadgeName, type T as ToolchainInvocation, q as addArgsFor, r as advisoryLine, s as badgeLead, t as badgeWidth, u as claimAgentRulesHint, v as deployTargetIds, w as detectAgentRules, x as detectInstalledManagers, y as detectPackageManager, z as execArgsFor, C as installArgsFor, E as isRunnableTarget, F as lunoraLine, G as padBadge, H as paintAnswer, I as paintBadge, J as planToolchainInvocation, K as readProjectDependencies, M as readProjectDependencyNames, N as readProjectManifest, O as resolveDeployDriver, Q as runScriptArgsFor, U as runScriptCommand, V as runnableTargetIds, W as targetRunsOwnDevServer, X as toolchainExecArgs } from "./packem_shared/index.d-Cmx4jMFV.js";
4
4
  import { ChildProcess } from 'node:child_process';
5
- import { D as DiscoveryCache } from "./packem_shared/infer-bindings.d-eFzcOnRh.js";
6
- export { C as COMPOSED_WORKER_ENTRY, a as DURABLE_OBJECT_BINDINGS, type b as DiscoverSchemaInfoResult, G as GENERATED_CLASS_MODULES, c as GENERATED_MODULE_DURABLE_OBJECTS, type d as GeneratedClassModule, type I as InferOptions, type e as InferredAgent, type f as InferredBindings, type g as InferredContainer, type h as InferredWorkflow, M as MERGED_DURABLE_OBJECTS_MODULE, type S as SchemaInfo, i as createDiscoveryCache, j as discoverSchemaInfo, k as inferLunoraBindings, l as isMergedProject, m as isMergedRoleModule, s as secretSourcesFromBindings } from "./packem_shared/infer-bindings.d-eFzcOnRh.js";
5
+ import { D as DiscoveryCache } from "./packem_shared/infer-bindings.d-Dp1zxdUZ.js";
6
+ export { C as COMPOSED_WORKER_ENTRY, a as DURABLE_OBJECT_BINDINGS, type b as DiscoverSchemaInfoResult, G as GENERATED_CLASS_MODULES, c as GENERATED_MODULE_DURABLE_OBJECTS, type d as GeneratedClassModule, type I as InferOptions, type e as InferredAgent, type f as InferredBindings, type g as InferredContainer, type h as InferredWorkflow, M as MERGED_DURABLE_OBJECTS_MODULE, type S as SchemaInfo, i as createDiscoveryCache, j as discoverSchemaInfo, k as inferLunoraBindings, l as isMergedProject, m as isMergedRoleModule, s as secretSourcesFromBindings } from "./packem_shared/infer-bindings.d-Dp1zxdUZ.js";
7
7
  import { Writable } from 'node:stream';
8
8
  export type { D as DeployDriver, a as DeployRequest, b as DevRequest, c as DriverToolchain, P as ProjectedConfig, d as ProjectionPurpose, S as SecretRequest, T as TailRequest, e as ToolchainCommand } from "./packem_shared/deploy-driver.d-Cl96-c1l.js";
9
9
  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";
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-pqFMJBtJ.mjs";import{AGENT_RULES_DIR as i,AGENT_RULES_HINT as n,AGENT_RULES_HINT_ENV as _,LUNORA_SKILL_NAMES as c,ROOT_SKILL_NAME as l,claimAgentRulesHint as p,detectAgentRules as d}from"./packem_shared/AGENT_RULES_DIR-HrrbNZPy.mjs";import{startCelldDevSession as m}from"./packem_shared/startCelldDevSession-BLFsd6jG.mjs";import{CODEGEN_ENV as S,LAZY_FUNCTIONS_ENV as f,isCodegenDisabled as L,isLazyFunctionsEnabled as v,resolveLazyFunctions as N}from"./packem_shared/CODEGEN_ENV-CkUo3_GU.mjs";import{discoverContainerInfo as T}from"./packem_shared/discoverContainerInfo-DzXr7Vm3.mjs";import{streamContainerLogs as x}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as I,projectUsesUmbrella as O}from"./packem_shared/detectFramework-Dfpvu6rD.mjs";import{acceptsConnection as P,startDevProcess as F}from"./packem_shared/acceptsConnection-DHhUYGjT.mjs";import{DEV_BINDINGS_FILE as U,DEV_DAEMON_ENV as M,DEV_HANDOFF_ENV as G,DEV_LOG_FILE as b,DEV_LOG_FILE_ENV as y,DEV_STATE_DIR as B,DEV_STATE_FILE as k,claimDevServerState as j,clearDevServerState as K,isDevServerReady as h,isProcessAlive as w,isRecordedProcessCurrent as H,readDevServerState as W,readLiveDevServerState as Y,updateDevServerState as J,writeDevServerState as z}from"./packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs";import{DEV_VARS_EXAMPLE_FILE as X,DEV_VARS_FILE as Z,DEV_VARS_KEY_PATTERN as Q,escapeRegExp as $,parseDevVariableEntries as ee,removeDevVariableLine as re,upsertDevVariableLine as oe}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEV_WORKER_ENV_VALUE as ae,DEV_WORKER_ENV_VAR as se,ensureDevWorkerEnv as Ee}from"./packem_shared/DEV_WORKER_ENV_VALUE-2XFXmRrP.mjs";import{createDiscoveryCache as ne}from"./packem_shared/createDiscoveryCache-npJI4uej.mjs";import{DEFAULT_DEPLOY_TARGET as ce,deployTargetIds as le,isRunnableTarget as pe,planToolchainInvocation as de,resolveDeployDriver as De,runnableTargetIds as me,targetRunsOwnDevServer as Ae}from"./packem_shared/DEFAULT_DEPLOY_TARGET-rR7buNQw.mjs";import{i as fe,s as Le}from"./packem_shared/infer-bindings-C1NFOdMi.mjs";import{LINKED_PROJECT_DIR as Ne,LINKED_PROJECT_FILE as Re,readLinkedProject as Te,writeLinkedProject as ge}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as Ve,applyLintIgnores as Ie,detectLintTools as Oe}from"./packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs";import{blockingFindingsMessage as Pe,reportCodegenFindings as Fe}from"./packem_shared/blockingFindingsMessage-BVbijPdn.mjs";import{LUNORA_EVENT_SOURCE as Ue,formatLunoraEvent as Me}from"./packem_shared/LUNORA_EVENT_SOURCE-B9ZVohjO.mjs";import{LUNORA_TAG as be,advisoryLine as ye,lunoraLine as Be}from"./packem_shared/LUNORA_TAG-DQTGPqcJ.mjs";import{default as je}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as he,detectInstalledManagers as we,detectPackageManager as He,execArgsFor as We,installArgsFor as Ye,runScriptArgsFor as Je,runScriptCommand as ze,toolchainExecArgs as qe}from"./packem_shared/addArgsFor-CYZKhNIo.mjs";import{P as Ze,s as Qe}from"./packem_shared/package-secrets-registry-BeheNwsP.mjs";import{runPostCodegenHook as er}from"./packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs";import{interpretRemote as or,readProjectRemotePreference as tr,readProjectTarget as ar,resolveProjectTarget as sr,resolveTargetOrThrow as Er}from"./packem_shared/interpretRemote-CcmGeGZ_.mjs";import{readProjectDependencies as nr,readProjectDependencyNames as _r,readProjectManifest as cr}from"./packem_shared/readProjectDependencies-l3uhUKjo.mjs";import{createConfirm as pr,isInteractive as dr,promptMultiSelect as Dr,promptSelect as mr,promptText as Ar,promptYesNo as Sr}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{default as Lr}from"./packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs";import{buildPackageSecretsBlock as Nr,ensureDevVariables as Rr,ensureDevVarsExample as Tr,fillDevSecrets as gr,generateSecretValue as xr,isMintableSecretKey as Vr,isPlaceholderValue as Ir,planDevSecretsFill as Or,planDevVariablesAugment as ur,planDevVariablesScaffold as Pr,requiredSecrets as Fr,writeDevVariablesFileAtomically as Cr}from"./packem_shared/buildPackageSecretsBlock-BWV_VxqV.mjs";import{applyAdditiveEdit as Mr,classifyEdit as Gr}from"./packem_shared/applyAdditiveEdit-CH0VhMJ2.mjs";import{parseSchema as yr}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as kr,resolveServerModule as jr,scaffoldPolicyFile as Kr,wireRlsIntoProcedure as hr}from"./packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs";import{discoverSchemaInfo as Hr}from"./packem_shared/discoverSchemaInfo-BBRlXZop.mjs";import{ACCENT as Yr,BADGES as Jr,BADGE_COLUMN_WIDTH as zr,LUNA_ART as qr,LUNA_BUNNY as Xr,LUNA_NAME as Zr,LUNA_SIGNOFF as Qr,STEP_BADGE_NAMES as $r,badgeLead as eo,badgeWidth as ro,padBadge as oo,paintAnswer as to,paintBadge as ao}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{COMPOSED_WORKER_ENTRY as Eo,DURABLE_OBJECT_BINDINGS as io,GENERATED_CLASS_MODULES as no,GENERATED_MODULE_DURABLE_OBJECTS as _o,MERGED_DURABLE_OBJECTS_MODULE as co,isMergedProject as lo,isMergedRoleModule as po}from"./packem_shared/COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{discoverWorkflowInfo as mo}from"./packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs";export{Yr as ACCENT,o as AGENT_MODE_ENV,i as AGENT_RULES_DIR,n as AGENT_RULES_HINT,_ as AGENT_RULES_HINT_ENV,Jr as BADGES,zr as BADGE_COLUMN_WIDTH,S as CODEGEN_ENV,Eo as COMPOSED_WORKER_ENTRY,ce as DEFAULT_DEPLOY_TARGET,U as DEV_BINDINGS_FILE,M as DEV_DAEMON_ENV,G as DEV_HANDOFF_ENV,b as DEV_LOG_FILE,y as DEV_LOG_FILE_ENV,B as DEV_STATE_DIR,k as DEV_STATE_FILE,X as DEV_VARS_EXAMPLE_FILE,Z as DEV_VARS_FILE,Q as DEV_VARS_KEY_PATTERN,ae as DEV_WORKER_ENV_VALUE,se as DEV_WORKER_ENV_VAR,io as DURABLE_OBJECT_BINDINGS,no as GENERATED_CLASS_MODULES,_o as GENERATED_MODULE_DURABLE_OBJECTS,f as LAZY_FUNCTIONS_ENV,Ne as LINKED_PROJECT_DIR,Re as LINKED_PROJECT_FILE,qr as LUNA_ART,Xr as LUNA_BUNNY,Zr as LUNA_NAME,Qr as LUNA_SIGNOFF,Ue as LUNORA_EVENT_SOURCE,Ve as LUNORA_IGNORED_PATHS,c as LUNORA_SKILL_NAMES,be as LUNORA_TAG,je as LunoraReporter,co as MERGED_DURABLE_OBJECTS_MODULE,Ze as PACKAGE_SECRETS_REGISTRY,l as ROOT_SKILL_NAME,$r as STEP_BADGE_NAMES,P as acceptsConnection,he as addArgsFor,ye as advisoryLine,Mr as applyAdditiveEdit,Ie as applyLintIgnores,eo as badgeLead,ro as badgeWidth,Pe as blockingFindingsMessage,Nr as buildPackageSecretsBlock,p as claimAgentRulesHint,j as claimDevServerState,Gr as classifyEdit,kr as classifyPolicyEdit,K as clearDevServerState,pr as createConfirm,ne as createDiscoveryCache,le as deployTargetIds,d as detectAgentRules,t as detectAiAgent,I as detectFramework,we as detectInstalledManagers,Oe as detectLintTools,He as detectPackageManager,s as discoverAgentInfo,T as discoverContainerInfo,Hr as discoverSchemaInfo,mo as discoverWorkflowInfo,Rr as ensureDevVariables,Tr as ensureDevVarsExample,Ee as ensureDevWorkerEnv,$ as escapeRegExp,We as execArgsFor,gr as fillDevSecrets,Me as formatLunoraEvent,xr as generateSecretValue,fe as inferLunoraBindings,Ye as installArgsFor,or as interpretRemote,L as isCodegenDisabled,h as isDevServerReady,dr as isInteractive,v as isLazyFunctionsEnabled,lo as isMergedProject,po as isMergedRoleModule,Vr as isMintableSecretKey,Ir as isPlaceholderValue,w as isProcessAlive,H as isRecordedProcessCurrent,pe as isRunnableTarget,Be as lunoraLine,oo as padBadge,to as paintAnswer,ao as paintBadge,ee as parseDevVariableEntries,yr as parseSchema,Or as planDevSecretsFill,ur as planDevVariablesAugment,Pr as planDevVariablesScaffold,de as planToolchainInvocation,O as projectUsesUmbrella,Dr as promptMultiSelect,mr as promptSelect,Ar as promptText,Sr as promptYesNo,W as readDevServerState,Te as readLinkedProject,Y as readLiveDevServerState,nr as readProjectDependencies,_r as readProjectDependencyNames,cr as readProjectManifest,tr as readProjectRemotePreference,ar as readProjectTarget,re as removeDevVariableLine,Fe as reportCodegenFindings,Fr as requiredSecrets,De as resolveDeployDriver,N as resolveLazyFunctions,sr as resolveProjectTarget,Lr as resolveSchemaDirectory,jr as resolveServerModule,Er as resolveTargetOrThrow,er as runPostCodegenHook,Je as runScriptArgsFor,ze as runScriptCommand,me as runnableTargetIds,Kr as scaffoldPolicyFile,Le as secretSourcesFromBindings,Qe as secretsForPackages,m as startCelldDevSession,F as startDevProcess,x as streamContainerLogs,Ae as targetRunsOwnDevServer,qe as toolchainExecArgs,J as updateDevServerState,oe as upsertDevVariableLine,hr as wireRlsIntoProcedure,z as writeDevServerState,Cr as writeDevVariablesFileAtomically,ge as writeLinkedProject};
1
+ import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-pqFMJBtJ.mjs";import{AGENT_RULES_DIR as i,AGENT_RULES_HINT as n,AGENT_RULES_HINT_ENV as _,LUNORA_SKILL_NAMES as c,ROOT_SKILL_NAME as l,claimAgentRulesHint as p,detectAgentRules as d}from"./packem_shared/AGENT_RULES_DIR-HrrbNZPy.mjs";import{startCelldDevSession as m}from"./packem_shared/startCelldDevSession-BLFsd6jG.mjs";import{CODEGEN_ENV as S,LAZY_FUNCTIONS_ENV as f,isCodegenDisabled as L,isLazyFunctionsEnabled as v,resolveLazyFunctions as N}from"./packem_shared/CODEGEN_ENV-CkUo3_GU.mjs";import{discoverContainerInfo as T}from"./packem_shared/discoverContainerInfo-DzXr7Vm3.mjs";import{streamContainerLogs as x}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as I,projectUsesUmbrella as O}from"./packem_shared/detectFramework-Dfpvu6rD.mjs";import{acceptsConnection as P,startDevProcess as F}from"./packem_shared/acceptsConnection-DHhUYGjT.mjs";import{DEV_BINDINGS_FILE as U,DEV_DAEMON_ENV as M,DEV_HANDOFF_ENV as G,DEV_LOG_FILE as b,DEV_LOG_FILE_ENV as y,DEV_STATE_DIR as B,DEV_STATE_FILE as k,claimDevServerState as j,clearDevServerState as K,isDevServerReady as h,isProcessAlive as w,isRecordedProcessCurrent as H,readDevServerState as W,readLiveDevServerState as Y,updateDevServerState as J,writeDevServerState as z}from"./packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs";import{DEV_VARS_EXAMPLE_FILE as X,DEV_VARS_FILE as Z,DEV_VARS_KEY_PATTERN as Q,escapeRegExp as $,parseDevVariableEntries as ee,removeDevVariableLine as re,upsertDevVariableLine as oe}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEV_WORKER_ENV_VALUE as ae,DEV_WORKER_ENV_VAR as Ee,ensureDevWorkerEnv as se}from"./packem_shared/DEV_WORKER_ENV_VALUE-2XFXmRrP.mjs";import{createDiscoveryCache as ne}from"./packem_shared/createDiscoveryCache-npJI4uej.mjs";import{DEFAULT_DEPLOY_TARGET as ce,deployTargetIds as le,isRunnableTarget as pe,planToolchainInvocation as de,resolveDeployDriver as De,runnableTargetIds as me,targetRunsOwnDevServer as Ae}from"./packem_shared/DEFAULT_DEPLOY_TARGET-rR7buNQw.mjs";import{inferLunoraBindings as fe,secretSourcesFromBindings as Le}from"./packem_shared/inferLunoraBindings-CH8xwMCn.mjs";import{LINKED_PROJECT_DIR as Ne,LINKED_PROJECT_FILE as Re,readLinkedProject as Te,writeLinkedProject as ge}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as Ve,applyLintIgnores as Ie,detectLintTools as Oe}from"./packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs";import{blockingFindingsMessage as Pe,reportCodegenFindings as Fe}from"./packem_shared/blockingFindingsMessage-BVbijPdn.mjs";import{LUNORA_EVENT_SOURCE as Ue,formatLunoraEvent as Me}from"./packem_shared/LUNORA_EVENT_SOURCE-B9ZVohjO.mjs";import{LUNORA_TAG as be,advisoryLine as ye,lunoraLine as Be}from"./packem_shared/LUNORA_TAG-DQTGPqcJ.mjs";import{default as je}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as he,detectInstalledManagers as we,detectPackageManager as He,execArgsFor as We,installArgsFor as Ye,runScriptArgsFor as Je,runScriptCommand as ze,toolchainExecArgs as qe}from"./packem_shared/addArgsFor-CYZKhNIo.mjs";import{P as Ze,s as Qe}from"./packem_shared/package-secrets-registry-BeheNwsP.mjs";import{runPostCodegenHook as er}from"./packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs";import{interpretRemote as or,readProjectRemotePreference as tr,readProjectTarget as ar,resolveProjectTarget as Er,resolveTargetOrThrow as sr}from"./packem_shared/interpretRemote-CcmGeGZ_.mjs";import{readProjectDependencies as nr,readProjectDependencyNames as _r,readProjectManifest as cr}from"./packem_shared/readProjectDependencies-l3uhUKjo.mjs";import{createConfirm as pr,isInteractive as dr,promptMultiSelect as Dr,promptSelect as mr,promptText as Ar,promptYesNo as Sr}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{default as Lr}from"./packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs";import{buildPackageSecretsBlock as Nr,ensureDevVariables as Rr,ensureDevVarsExample as Tr,fillDevSecrets as gr,generateSecretValue as xr,isMintableSecretKey as Vr,isPlaceholderValue as Ir,planDevSecretsFill as Or,planDevVariablesAugment as ur,planDevVariablesScaffold as Pr,requiredSecrets as Fr,writeDevVariablesFileAtomically as Cr}from"./packem_shared/buildPackageSecretsBlock-BWV_VxqV.mjs";import{applyAdditiveEdit as Mr,classifyEdit as Gr}from"./packem_shared/applyAdditiveEdit-CH0VhMJ2.mjs";import{parseSchema as yr}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as kr,resolveServerModule as jr,scaffoldPolicyFile as Kr,wireRlsIntoProcedure as hr}from"./packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs";import{discoverSchemaInfo as Hr}from"./packem_shared/discoverSchemaInfo-BBRlXZop.mjs";import{ACCENT as Yr,BADGES as Jr,BADGE_COLUMN_WIDTH as zr,LUNA_ART as qr,LUNA_BUNNY as Xr,LUNA_NAME as Zr,LUNA_SIGNOFF as Qr,STEP_BADGE_NAMES as $r,badgeLead as eo,badgeWidth as ro,padBadge as oo,paintAnswer as to,paintBadge as ao}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{COMPOSED_WORKER_ENTRY as so,DURABLE_OBJECT_BINDINGS as io,GENERATED_CLASS_MODULES as no,GENERATED_MODULE_DURABLE_OBJECTS as _o,MERGED_DURABLE_OBJECTS_MODULE as co,isMergedProject as lo,isMergedRoleModule as po}from"./packem_shared/COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{discoverWorkflowInfo as mo}from"./packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs";export{Yr as ACCENT,o as AGENT_MODE_ENV,i as AGENT_RULES_DIR,n as AGENT_RULES_HINT,_ as AGENT_RULES_HINT_ENV,Jr as BADGES,zr as BADGE_COLUMN_WIDTH,S as CODEGEN_ENV,so as COMPOSED_WORKER_ENTRY,ce as DEFAULT_DEPLOY_TARGET,U as DEV_BINDINGS_FILE,M as DEV_DAEMON_ENV,G as DEV_HANDOFF_ENV,b as DEV_LOG_FILE,y as DEV_LOG_FILE_ENV,B as DEV_STATE_DIR,k as DEV_STATE_FILE,X as DEV_VARS_EXAMPLE_FILE,Z as DEV_VARS_FILE,Q as DEV_VARS_KEY_PATTERN,ae as DEV_WORKER_ENV_VALUE,Ee as DEV_WORKER_ENV_VAR,io as DURABLE_OBJECT_BINDINGS,no as GENERATED_CLASS_MODULES,_o as GENERATED_MODULE_DURABLE_OBJECTS,f as LAZY_FUNCTIONS_ENV,Ne as LINKED_PROJECT_DIR,Re as LINKED_PROJECT_FILE,qr as LUNA_ART,Xr as LUNA_BUNNY,Zr as LUNA_NAME,Qr as LUNA_SIGNOFF,Ue as LUNORA_EVENT_SOURCE,Ve as LUNORA_IGNORED_PATHS,c as LUNORA_SKILL_NAMES,be as LUNORA_TAG,je as LunoraReporter,co as MERGED_DURABLE_OBJECTS_MODULE,Ze as PACKAGE_SECRETS_REGISTRY,l as ROOT_SKILL_NAME,$r as STEP_BADGE_NAMES,P as acceptsConnection,he as addArgsFor,ye as advisoryLine,Mr as applyAdditiveEdit,Ie as applyLintIgnores,eo as badgeLead,ro as badgeWidth,Pe as blockingFindingsMessage,Nr as buildPackageSecretsBlock,p as claimAgentRulesHint,j as claimDevServerState,Gr as classifyEdit,kr as classifyPolicyEdit,K as clearDevServerState,pr as createConfirm,ne as createDiscoveryCache,le as deployTargetIds,d as detectAgentRules,t as detectAiAgent,I as detectFramework,we as detectInstalledManagers,Oe as detectLintTools,He as detectPackageManager,E as discoverAgentInfo,T as discoverContainerInfo,Hr as discoverSchemaInfo,mo as discoverWorkflowInfo,Rr as ensureDevVariables,Tr as ensureDevVarsExample,se as ensureDevWorkerEnv,$ as escapeRegExp,We as execArgsFor,gr as fillDevSecrets,Me as formatLunoraEvent,xr as generateSecretValue,fe as inferLunoraBindings,Ye as installArgsFor,or as interpretRemote,L as isCodegenDisabled,h as isDevServerReady,dr as isInteractive,v as isLazyFunctionsEnabled,lo as isMergedProject,po as isMergedRoleModule,Vr as isMintableSecretKey,Ir as isPlaceholderValue,w as isProcessAlive,H as isRecordedProcessCurrent,pe as isRunnableTarget,Be as lunoraLine,oo as padBadge,to as paintAnswer,ao as paintBadge,ee as parseDevVariableEntries,yr as parseSchema,Or as planDevSecretsFill,ur as planDevVariablesAugment,Pr as planDevVariablesScaffold,de as planToolchainInvocation,O as projectUsesUmbrella,Dr as promptMultiSelect,mr as promptSelect,Ar as promptText,Sr as promptYesNo,W as readDevServerState,Te as readLinkedProject,Y as readLiveDevServerState,nr as readProjectDependencies,_r as readProjectDependencyNames,cr as readProjectManifest,tr as readProjectRemotePreference,ar as readProjectTarget,re as removeDevVariableLine,Fe as reportCodegenFindings,Fr as requiredSecrets,De as resolveDeployDriver,N as resolveLazyFunctions,Er as resolveProjectTarget,Lr as resolveSchemaDirectory,jr as resolveServerModule,sr as resolveTargetOrThrow,er as runPostCodegenHook,Je as runScriptArgsFor,ze as runScriptCommand,me as runnableTargetIds,Kr as scaffoldPolicyFile,Le as secretSourcesFromBindings,Qe as secretsForPackages,m as startCelldDevSession,F as startDevProcess,x as streamContainerLogs,Ae as targetRunsOwnDevServer,qe as toolchainExecArgs,J as updateDevServerState,oe as upsertDevVariableLine,hr as wireRlsIntoProcedure,z as writeDevServerState,Cr as writeDevVariablesFileAtomically,ge as writeLinkedProject};
@@ -0,0 +1,2 @@
1
+ import{readFileSync as ee,writeFileSync as ne}from"node:fs";import{createRequire as se}from"node:module";import{join as V}from"node:path";import{containerBuildTag as te}from"@lunora/container";import{readJsonSync as ie}from"@visulima/fs";import{applyModify as w}from"./applyModify-DKP2l6S9.mjs";import{a as oe,r as Y}from"./lunora-manifest-DuH_Cmyu.mjs";import{parseTree as ae,findNodeAtLocation as re}from"jsonc-parser";import{r as de,a as ce,b as le,c as ue}from"./reconcile-services-DFqH4eMQ.mjs";import{DEV_VARS_FILE as ge,parseDevVariableEntries as me}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{secretSourcesFromBindings as pe}from"./inferLunoraBindings-CH8xwMCn.mjs";import{requiredSecrets as fe}from"./buildPackageSecretsBlock-BWV_VxqV.mjs";import{w as be,m as he,s as U,o as P,n as T,p as ve}from"./validate-bindings-PVHSAU6M.mjs";import{s as we}from"./worker-entry-checks-AIASCYl7.mjs";import{DEFAULT_OBSERVABILITY as _e}from"./DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import{findWranglerFile as ye,readWranglerJsonc as Se}from"./WRANGLER_FILES-UNW-xY5u.mjs";const Ee=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxConcurrency","max_concurrency"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],B=e=>Object.fromEntries(Ee.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),L="queueTuning",xe=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,Ae=/^[\t ]*,/u,Oe=(e,n)=>{const s=ae(e),t=s===void 0?void 0:re(s,[...n])?.parent;if(t?.type==="property"){const o=t.offset+t.length,i=e.lastIndexOf(`
2
+ `,t.offset-1)+1,a=xe.exec(e.slice(o));if(a!==null&&e.slice(i,t.offset).trim()===""){const m=t.parent?.children??[],u=m.indexOf(t),d=u===m.length-1&&u>0?m[u-1]:void 0,c=d===void 0?void 0:Ae.exec(e.slice(d.offset+d.length))??void 0;return(c===void 0||d===void 0?e.slice(0,i):e.slice(0,d.offset+d.length)+e.slice(d.offset+d.length+c[0].length,i))+e.slice(o+a[0].length)}}return w(e,n,void 0)},G=(e,n,s,t,o,i=new Set)=>{const a=s.join("."),m={},u=[],d=[];let c=e;return{entries:n.map((l,v)=>{const g=t(l);if(g===void 0||l.queue===void 0)return l;const b=Object.fromEntries(Object.entries(B(g)).filter(([f])=>!i.has(f))),h=Object.entries(o[l.queue]??{}).filter(([f])=>!Object.hasOwn(b,f)),_=Object.entries(b).filter(([f,y])=>l[f]!==y),E=h.filter(([f,y])=>l[f]===y).map(([f])=>f),O=Object.fromEntries(Object.entries({...l,...b}).filter(([f])=>!E.includes(f)));for(const[f,y]of _)c=w(c,[...s,v,f],y);for(const f of E)c=Oe(c,[...s,v,f]);for(const[f,y]of h){const A=l[f];A!==void 0&&A!==y&&d.push(`${a}/${l.queue}: ${f} is no longer declared by defineQueue, but it was changed by hand to ${JSON.stringify(A)} from the declared ${JSON.stringify(y)}, so it was kept. Delete it from wrangler.jsonc if it should go.`)}return(_.length>0||E.length>0)&&u.push(`${a}/${l.queue} (${[..._.map(([f])=>f),...E.map(f=>`removed ${f}`)].join(", ")})`),Object.keys(b).length>0&&(m[l.queue]=b),O}),owned:m,text:c,updated:u,warnings:d}},Ne=(e,n,s,t)=>{const o=n.queues??{},i=o.producers??[],a=o.consumers??[],m=new Set(i.map(g=>g?.binding)),u=new Set(a.map(g=>g.queue)),d=s.filter(g=>!m.has(g.bindingName)),c=s.filter(g=>!u.has(g.name)),p=G(e,a,["queues","consumers"],g=>s.find(b=>b.name===g.queue),t);let l=p.text;const v={...p.owned};if(d.length>0||c.length>0){const g=[...i,...d.map(h=>({binding:h.bindingName,queue:h.name}))],b=[...p.entries,...c.map(h=>({queue:h.name,...h.mode==="pull"?{type:"http_pull"}:{},...B(h)}))];for(const h of c){const _=B(h);Object.keys(_).length>0&&(v[h.name]=_)}l=w(l,["queues"],{consumers:b,producers:g})}return{added:[...d.map(g=>`queues.producers/${g.bindingName}`),...c.map(g=>`queues.consumers/${g.name}`)],owned:v,text:l,updated:p.updated,warnings:p.warnings}},ke=(e,n,s,t,o)=>{const i=n.env?.[t],a=i?.queues?.consumers??[],m=i?.queues?.producers??[],u=l=>{const v=m.find(g=>g?.queue===l.queue)?.binding;return v!==void 0?s.find(g=>g.bindingName===v):s.find(g=>g.name===l.queue&&!m.some(b=>b?.binding===g.bindingName))},d=G(e,a,["env",t,"queues","consumers"],u,o,new Set(["dead_letter_queue"])),c=a.filter(l=>l.queue!==void 0&&u(l)===void 0).map(l=>`env.${t}.queues.consumers/${String(l.queue)}: no defineQueue export matches it — this block declares no producer mapping one of their bindings to "${String(l.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.`),p=a.flatMap(l=>{const v=u(l)?.tuning.deadLetterQueue;return v===void 0||l.dead_letter_queue!==void 0?[]:[`env.${t}.queues.consumers/${String(l.queue)}: defineQueue declares deadLetterQueue "${v}", 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:d.owned,text:d.text,updated:d.updated,warnings:[...d.warnings,...p,...c]}},$e=(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?.[L],t=o=>typeof o=="object"&&o!==null&&!Array.isArray(o);return s===void 0?{}:!t(s)||!Object.values(s).every(o=>t(o)&&Object.values(o).every(i=>t(i)))?(n.push(`${e?.path??"package.json"}: \`lunora.${L}\` 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},Ce=(e,n,s)=>{const t=Object.fromEntries(Object.entries({...n,...s}).filter(([,o])=>Object.keys(o).length>0));oe(e,L,Object.keys(t).length===0?void 0:t)},Ie="https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/artifacts/namespaces",Te=e=>{const n='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; ${n}. The namespace is created by the first repo create() if it does not exist yet.`:`ctx.artifacts is used and the schema pins data to "${e}"; create the namespace in that jurisdiction BEFORE the first repo, with POST ${Ie} and body { "namespace": "<name>", "jurisdiction": "${e}" }, then ${n}. A namespace's jurisdiction cannot be changed, and one created implicitly by the first repo create() is unrestricted. With CLOUDFLARE_API_TOKEN set, \`lunora deploy\` creates a missing namespace in that jurisdiction for a binding you have added.`},j="PIPELINES",R="ARTIFACTS",je=(e,n,s)=>{const t=n!==void 0&&(s===void 0||s==="cloudflare"),o=e.flagshipBinding!==void 0&&!(n?.flagship??[]).some(d=>d.binding===e.flagshipBinding),i=e.usesPipelines&&!(n?.pipelines??[]).some(d=>d.binding===j),a=e.usesArtifacts?n?.artifacts??[]:[],m=a.some(d=>d.binding===R)?[]:a.flatMap(d=>d.binding===void 0?[]:[d.binding]);return[[e.usesKv&&(n?.kv_namespaces?.length??0)===0&&(!t||e.jurisdiction!==void 0),e.jurisdiction===void 0?'ctx.kv is used but no kv_namespaces binding exists; add one ({ binding: "KV" }) — wrangler creates the namespace on the first deploy.':`ctx.kv is used and the schema pins data to "${e.jurisdiction}"; run \`wrangler kv namespace create <name> --jurisdiction ${e.jurisdiction}\` and add a kv_namespaces entry ({ binding: "KV", id }) — a namespace wrangler creates on deploy is unrestricted.`],[e.usesHyperdrive&&(n?.hyperdrive?.length??0)===0&&!t,'@lunora/hyperdrive is used but no hyperdrive binding exists; add one ({ binding: "HYPERDRIVE", id }) — on a Cloudflare target `lunora deploy` creates the Hyperdrive config from a connection string.'],[e.usesArtifacts&&a.length===0&&(!t||e.jurisdiction!==void 0),Te(e.jurisdiction)],[i,`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.`],[m.length>0,`ctx.artifacts is used and ${m.map(d=>`"${d}"`).join(", ")} ${m.length===1?"is":"are"} bound, but none is named "${R}"; make sure \`.artifacts()\` on defineApp points ctx.artifacts at it — otherwise it reads env.${R} and throws.`],[o,`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(([d])=>d).map(([,d])=>d)},Re=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),q=(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.`),qe=(e,n)=>{const s=new Set([...e.workflows,...e.agents].map(i=>i.className));if(s.size===0)return[];const t=Object.entries(n.exports??{}).flatMap(([i,a])=>a?.type==="workflow"?[i]:[]),o=(n.workflows??[]).flatMap(i=>i.class_name===void 0||i.script_name!==void 0?[]:[i.class_name]);return[...new Set([...t,...o])].filter(i=>!s.has(i)).map(i=>`wrangler.jsonc declares workflow "${i}" 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.`)},De=(e,n)=>{if(e.queues.length===0)return[];const s=new Set(e.queues.map(o=>o.name)),t=new Set(e.queues.map(o=>o.bindingName));return[...(n.queues?.consumers??[]).flatMap(o=>{const{queue:i}=o;return i===void 0||s.has(i)?[]:[`wrangler.jsonc subscribes queues.consumers[] to "${i}" 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(o=>{const i=o?.binding;return i===void 0||t.has(i)?[]:[`wrangler.jsonc declares queues.producers[] binding "${i}" but no defineQueue export declares it — a leftover from a rename. Remove it if it is not hand-wired.`]})]},Pe=(e,n)=>[...qe(e,n),...De(e,n)],J=[{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"}],Be=()=>J.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),Le=e=>{let n;try{n=ee(V(e,ge),"utf8")}catch{return!1}const s=new Map(me(n).map(t=>[t.key,t.value]));return J.some(({keys:t})=>t.every(o=>(s.get(o)??"")!==""))},We=(e,n)=>{const s=n?.secrets?.required;if(!Array.isArray(s))return[];const t=new Set(s),o=fe(pe(e)).map(i=>i.key).filter(i=>!t.has(i));return o.length===0?[]:[`wrangler.jsonc declares secrets.required without ${o.join(", ")}, which this app needs — wrangler dev loads only the listed keys from .dev.vars, so add ${o.length===1?"it":"them"} to secrets.required.`]},D=(e,n,s,t)=>{const o=new Set(e.durableObjects.map(u=>u.className)),i=[],a=(s?.r2_buckets?.length??0)>0,m=(s?.d1_databases?.some(u=>u.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!a&&i.push("@lunora/storage is used but R2 bucket bindings have user-defined names; add an r2_buckets entry and pass env.<BINDING> to createStorage()."),e.usesAuth&&!o.has("SessionDO")&&!m&&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&&!o.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(...q("container","containers",e.containers),...q("workflow","workflows",e.workflows),...q("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&&!Le(n)&&i.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${Be()}.`),i.push(...Re(e),...je(e,s,t),...We(e,s)),s!==void 0&&i.push(...Pe(e,s)),i},X="<replace-with-d1-create-id>",Me="<replace-with-hyperdrive-create-id>",Ke=e=>[["container","containers",e.containers],["workflow","workflows",e.workflows],["agent","agents",e.agents]].flatMap(([s,t,o])=>o.filter(i=>!i.exported).map(({className:i,exportName:a})=>({className:i,exportName:a,kind:s,module:t}))),Fe=e=>{const n=new Set(P(e).map(t=>t.tag));let s=1;for(;n.has(`v${String(s)}`);)s+=1;return`v${String(s)}`},He=e=>{const n=new Set;for(const s of P(e)){for(const t of T(s.deleted_classes))n.delete(t);for(const{from:t,to:o}of P(s.renamed_classes))t!==void 0&&n.delete(t),o!==void 0&&n.add(o);for(const t of[...T(s.new_classes),...T(s.new_sqlite_classes)])n.add(t)}return n},Ye=(e,n,s)=>{const t=n.durable_objects?.bindings??[],o=new Set(t.map(c=>c.name)),i=s.filter(c=>!o.has(c.binding));let a=e;const m=[];if(i.length>0){const c=[...t,...i.map(p=>({class_name:p.className,name:p.binding}))];a=w(a,["durable_objects","bindings"],c),m.push(...i.map(p=>`${p.binding}/${p.className}`))}const u=n.migrations??[],d=s.map(c=>c.className).filter(c=>!He(u).has(c));if(d.length>0){const c=[...u,{new_sqlite_classes:d,tag:Fe(u)}];a=w(a,["migrations"],c)}return{added:m,text:a}},Qe=(e,n)=>{const s=n.d1_databases??[];if(s.some(i=>i.binding==="DB"))return{added:[],text:e};const t=typeof n.name=="string"&&n.name.length>0?n.name:"lunora",o=[...s,{binding:"DB",database_id:X,database_name:t}];return{added:["DB (D1)"],text:w(e,["d1_databases"],o)}},Ve={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)"}},k=(e,n,s)=>{const{binding:t,label:o}=Ve[s],i=n[s]?.binding;return typeof i=="string"&&i.length>0?{added:[],text:e}:{added:[o],text:w(e,[s],{binding:t})}},Ue=(e,n)=>e.usesAnalyticsSql&&we(n,new Set(["analyticsSql"]))?.chained.has("analyticsSql")!==!0,Ge=new Set(["ratelimits","send_email"]),Je=["durable_objects","logfwdr","unsafe"],Xe=new Set(["data_blobs","text_blobs","vars","wasm_modules"]),M=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),W=(e,n,s)=>M(e)&&e[n]===s,ze=(e,n,s)=>{if(Xe.has(e))return M(n)&&Object.hasOwn(n,s);const t=Ge.has(e)?"name":"binding";return Array.isArray(n)?n.some(o=>W(o,t,s)):W(n,"binding",s)},$=(e,n)=>{const s=e,t=Object.entries(s).find(([i,a])=>i!=="env"&&ze(i,a,n));if(t!==void 0)return t[0];for(const i of Je){const a=s[i];if(M(a)&&Array.isArray(a.bindings)&&a.bindings.some(m=>W(m,"name",n)))return`${i}.bindings`}if(e.queues?.producers?.some(i=>i?.binding===n)===!0)return"queues.producers";const o=e.secrets?.required;if(Array.isArray(o)&&o.includes(n))return"secrets.required"},K=(e,n,s)=>`${e}: not adding "${n}" — the name is already bound by \`${s}\` in wrangler.jsonc. Add a ${e} entry under another binding name and point the matching \`defineApp()\` override at it.`,F=e=>e===void 0||e==="cloudflare",Ze=(e,n,s)=>{if(!F(s)||(n.hyperdrive?.length??0)>0)return{added:[],text:e};const t=$(n,"HYPERDRIVE");return t!==void 0?{added:[],text:e,warnings:[K("hyperdrive","HYPERDRIVE",t)]}:{added:["HYPERDRIVE (Hyperdrive, created on deploy)"],text:w(e,["hyperdrive"],[{binding:"HYPERDRIVE",id:Me}])}},en=(e,n,s,t)=>{if(!F(t)||s!==void 0||(n.kv_namespaces?.length??0)>0)return{added:[],text:e};const o=$(n,"KV");return o!==void 0?{added:[],text:e,warnings:[K("kv_namespaces","KV",o)]}:{added:["KV (Workers KV, created on deploy)"],text:w(e,["kv_namespaces"],[{binding:"KV"}])}},nn=(e,n,s,t)=>{if(!F(t)||s!==void 0||(n.artifacts?.length??0)>0)return{added:[],text:e};const o=$(n,"ARTIFACTS");if(o!==void 0)return{added:[],text:e,warnings:[K("artifacts","ARTIFACTS",o)]};const i=typeof n.name=="string"&&n.name.length>0?n.name:"lunora";return{added:["ARTIFACTS (Cloudflare Artifacts)"],text:w(e,["artifacts"],[{binding:"ARTIFACTS",namespace:i}])}},Q=(e,n,s,t,o)=>{if((n[s]?.length??0)>0)return{added:[],text:e};const i=$(n,t.binding);return i!==void 0?{added:[],text:e,warnings:[`${s}: not adding ${JSON.stringify(t)} — the name "${t.binding}" is already bound by \`${i}\` in wrangler.jsonc. Add a ${s} entry under another binding name and point the matching \`defineApp()\` override at it.`]}:{added:[o],text:w(e,[s],[t])}},sn=(e,n)=>{const s=n.worker_loaders??[];return s.some(t=>t.binding==="LOADER")?{added:[],text:e}:{added:["LOADER (Worker Loader)"],text:w(e,["worker_loaders"],[...s,{binding:"LOADER"}])}},tn=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},on=e=>{const{image:n}=e;return n.kind==="dockerfile"?n.dockerfilePath:n.kind==="registry"?n.reference:te(e.exportName)},z=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}}},an=e=>{if(e.schedulingPolicy==="durable_object")return z(e);const{image:n}=e,s={class_name:e.className,image:on(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=tn(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},rn=(e,n,s)=>{const t=n.containers??[],o=new Set(t.map(d=>d.class_name)),i=s.filter(d=>!o.has(d.className));let a=i.length===0?e:w(e,["containers"],[...t,...i.map(d=>an(d))]);const m=[],u=[];for(const[d,c]of t.entries()){const p=s.find(g=>g.className===c.class_name);if(p===void 0)continue;const l=p.schedulingPolicy??"default";if((c.scheduling_policy??"default")!==l){u.push(`containers/${p.className} has scheduling_policy "${c.scheduling_policy??"default"}" in wrangler.jsonc but defineContainer "${p.exportName}" declares "${l}" — the policy is immutable, so replace the entry (and its container application) by hand.`);continue}const v=p.schedulingPolicy==="durable_object"?z(p).images:void 0;v!==void 0&&JSON.stringify(c.images)!==JSON.stringify(v)&&(a=w(a,["containers",d,"images"],v),m.push(`containers/${p.className}.images`))}return{added:i.map(d=>`containers/${d.className}`),text:a,updated:m,warnings:u}},dn=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=w(e,["observability"],{..._e});return{added:["observability"],text:s}},cn=(e,n)=>n.upload_source_maps!==void 0?{added:[],text:e}:{added:["upload_source_maps"],text:w(e,["upload_source_maps"],!0)},Z=[{minimum:[4,142],name:"wrangler"},{minimum:[1,61],name:"@cloudflare/vite-plugin"}],ln=Z.map(({minimum:e,name:n})=>`${n}@^${e.join(".")}.0`).join(" "),un=(e,n)=>{try{const s=se(V(e,"package.json")).resolve(`${n}/package.json`),[t=0,o=0]=String(ie(s).version).split(".").map(Number);return[t,o]}catch{return}},gn=e=>{const n=Z.flatMap(({minimum:s,name:t})=>{const o=un(e,t);return o!==void 0&&(o[0]<s[0]||o[0]===s[0]&&o[1]<s[1])?[`${t} ${o.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 ${ln}\`) and re-run.`},mn=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.`]:[]),pn=(e,n,s)=>{let t=e;const o=[],i=[];for(const a of s){const m=n[a.className];if(m?.type==="workflow")for(const{of:u,path:d}of ve){const c=u(a),p=U(m,d),l=`exports/${a.className}.${d.join(".")}`;if(c===void 0){p!==void 0&&i.push(`${l} is set in wrangler.jsonc but defineWorkflow "${a.exportName}" does not declare it — reconcile leaves it in place. Remove it by hand if it was dropped from the definition.`);continue}JSON.stringify(p)!==JSON.stringify(c)&&(t=w(t,["exports",a.className,...d],c),o.push(l))}}return{text:t,updated:o,warnings:i}},fn=(e,n,s,t,o)=>{if(o!==void 0)return{added:[],text:e,warnings:[o]};const i=[...s.map(b=>({settings:be(b),workflow:b})),...t.map(b=>({settings:{},workflow:b}))],a=new Set(i.map(({workflow:b})=>b.className)),m=n.workflows??[],u=m.filter(b=>b.script_name===void 0&&b.class_name!==void 0&&a.has(b.class_name)),d=n.exports??{},c=[],p=[],l=[];let v=e;for(const{settings:b,workflow:h}of i){if(d[h.className]!==void 0&&d[h.className]!==null)continue;const _=u.find(f=>f.class_name===h.className),E=Object.fromEntries(he.flatMap(f=>{const y=U(_,[f]);return y===void 0?[]:[[f,y]]})),O=_?.name??h.name;_?.name!==void 0&&_.name!==h.name&&l.push(`workflows/${h.className} is deployed as "${_.name}" but declared as "${h.name}" — its export keeps "${_.name}" so running instances survive. Change the declaration to match, or rename deliberately (it starts a new, empty workflow).`),v=w(v,["exports",h.className],{type:"workflow",...E,...b,name:O}),(_===void 0?c:p).push(`exports/${h.className}`)}if(u.length>0){const b=m.filter(h=>!u.includes(h));v=w(v,["workflows"],b.length===0?void 0:b),p.push(...u.map(h=>`workflows/${String(h.class_name)} → exports`))}l.push(...mn(n));const g=pn(v,d,s);return{added:c,text:g.text,updated:[...p,...g.updated],warnings:[...l,...g.warnings]}},Tn=(e,n,{environment:s,target:t}={})=>{const o=ye(e),i=Ke(n);if(!o)return{added:[],changed:!1,exportGaps:i,reason:"wrangler.jsonc not found",updated:[],warnings:D(n,e)};const{parsed:a,text:m}=Se(o);if(a===void 0)return{added:[],changed:!1,exportGaps:i,reason:`failed to parse ${o} as JSONC`,updated:[],warnings:D(n,e),wranglerPath:o};const u=D(n,e,a,t);if(s!==void 0){const r=a.env?.[s]!==void 0;u.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 d=n.containers.filter(r=>r.exported),c=n.agents.filter(r=>r.exported&&r.voice===!0&&r.voiceBindingName!==void 0&&r.voiceClassName!==void 0),p=[...n.durableObjects,...d.map(r=>({binding:r.bindingName,className:r.className})),...c.map(r=>({binding:r.voiceBindingName,className:r.voiceClassName}))],l=n.workflows.filter(r=>r.exported),v=n.agents.filter(r=>r.exported),g=Y(e),b=$e(g,u),h={},_=de(g);let E;const O=[{enabled:!0,run:r=>Ye(r,a,p)},{enabled:n.needsD1,run:r=>Qe(r,a)},{enabled:n.usesKv,run:r=>en(r,a,n.jurisdiction,t)},{enabled:n.usesHyperdrive,run:r=>Ze(r,a,t)},{enabled:n.usesArtifacts,run:r=>nn(r,a,n.jurisdiction,t)},{enabled:n.usesAi,run:r=>k(r,a,"ai")},{enabled:n.usesAiSearch,run:r=>Q(r,a,"ai_search_namespaces",{binding:"AI_SEARCH",namespace:"default"},"AI_SEARCH (AI Search namespace)")},{enabled:Ue(n,e),run:r=>k(r,a,"analytics")},{enabled:n.usesBrowser,run:r=>k(r,a,"browser")},{enabled:n.usesImages,run:r=>k(r,a,"images")},{enabled:n.usesAnalytics,run:r=>Q(r,a,"analytics_engine_datasets",{binding:"ANALYTICS",dataset:"ANALYTICS"},"ANALYTICS (Analytics Engine)")},{enabled:n.usesWorkerLoader,run:r=>sn(r,a)},{enabled:!0,run:r=>dn(r,a)},{enabled:t===void 0||t==="cloudflare",run:r=>cn(r,a)},{enabled:d.length>0,run:r=>rn(r,a,d)},{enabled:l.length>0||v.length>0,run:r=>fn(r,a,l,v,gn(e))},{enabled:n.queues.length>0,run:r=>{const S=Ne(r,a,n.queues,b.queues??{});return h.queues=S.owned,S}},{enabled:n.services!==void 0&&(n.services.length>0||Object.keys(_).length>0),run:r=>{const S=ce(r,a,n.services??[],_);return E=S.owned,S}},...s===void 0||a.env?.[s]===void 0?[]:[{enabled:n.queues.length>0,run:r=>{const S=`env.${s}.queues`,N=ke(r,a,n.queues,s,b[S]??{});return h[S]=N.owned,N}}]];let f=m;const y=[],A=[];for(const r of O){if(!r.enabled)continue;const S=r.run(f);f=S.text,y.push(...S.added),A.push(...S.updated??[]),u.push(...S.warnings??[])}const H=r=>{if(g===void 0)return;const S=E,N=[...Object.keys(h).length>0?[{consequence:"an option removed from defineQueue stays deployed",key:"queueTuning",label:"queue tuning",write:x=>{Ce(x,b,h)}}]:[],...S===void 0?[]:[{consequence:"a service removed from lunora.config stays bound",key:"services",label:"service bindings",write:x=>{ue(x,S)}}]];for(const x of N)try{x.write(Y(e)??g)}catch(I){u.push(`${r?"wrangler.jsonc was updated, but ":""}recording the ${x.label} reconcile owns in ${g.path} (lunora.${x.key}) failed: ${I instanceof Error?I.message:String(I)}. Until it is recorded, ${x.consequence}.`)}};let C;if(n.services!==void 0){const r=le(e,n.services,_);u.push(...r.warnings),E={...E,...r.owned},C=r.added.length>0||r.updated.length>0?{added:r.added,path:r.path,updated:r.updated}:void 0}return y.includes("DB (D1)")&&u.push(`wrote a DB binding with a placeholder database_id ("${X}") — run \`wrangler d1 create <name>\` and replace it before deploying.`),f===m?(H(!1),{added:y,changed:!1,devConfig:C,exportGaps:i,reason:"bindings already in sync",updated:A,warnings:u,wranglerPath:o}):(ne(o,f,"utf8"),H(!0),{added:y,changed:!0,devConfig:C,exportGaps:i,updated:A,warnings:u,wranglerPath:o})};export{Me as HYPERDRIVE_PLACEHOLDER_ID,Ke as collectExportGaps,Tn as reconcileWranglerBindings};
@@ -0,0 +1 @@
1
+ import{applyModify as g}from"./applyModify-DKP2l6S9.mjs";import{hasCloudflareCredentials as v}from"./hasCloudflareCredentials-byvHpEiD.mjs";import{withheldBindings as y,writeDevConfig as E,noopCleanup as R}from"./describeWithheld-BAaWBzKD.mjs";import{r as S}from"./lunora-manifest-DuH_Cmyu.mjs";import{o as _}from"./reconcile-services-DFqH4eMQ.mjs";import{findWranglerFile as j,readWranglerJsonc as w}from"./WRANGLER_FILES-UNW-xY5u.mjs";const p={ai:{label:"AI",shape:"object"},ai_search:{label:"AI Search",shape:"array"},ai_search_namespaces:{label:"AI Search namespace",shape:"array"},analytics:{label:"Analytics SQL",shape:"object"},d1_databases:{label:"D1",shape:"array"},kv_namespaces:{label:"KV",shape:"array"},queues:{label:"Queue",shape:"producers"},r2_buckets:{label:"R2",shape:"array"},services:{label:"Service",shape:"array"},vectorize:{label:"Vectorize",shape:"array"}},C=Object.keys(p),m=(e,r)=>typeof e.binding=="string"?e.binding:r,u=(e,r,t,n)=>{const i=[];for(const[s,o]of r.entries())o!=null&&(e==="kv_namespaces"&&(typeof o.id!="string"||o.id==="")||i.push({binding:m(o,`#${String(s)}`),kind:t,path:[...n,s],section:e}));return i},h=(e,r)=>p[e].shape===r,I=(e,r)=>{const{label:t}=p[e];if(h(e,"array"))return u(e,r[e]??[],t,[]);if(h(e,"object")){const n=r[e];return n==null?[]:[{binding:m(n,e),kind:t,path:[],section:e}]}return u(e,r.queues?.producers??[],t,["producers"])},B=e=>C.flatMap(r=>I(r,e)),L=(e,r)=>{let t=e;for(const n of r)t=g(t,[n.section,...n.path,"remote"],!0);return t},W=e=>{const r=a=>({cleanup:R,reason:a,remoteBindings:[],withheld:[]}),t=j(e.projectRoot);if(!t)return r("wrangler.jsonc not found");const{parsed:n,text:i}=w(t);if(n===void 0)return r(`failed to parse ${t} as JSONC`);const s=_(S(e.projectRoot)),o=e.remote?B(n).filter(a=>a.section!=="services"||!s.has(a.binding)):[],l=y(n,e.hasCredentials??(()=>v({projectRoot:e.projectRoot}))),c=l.some(({kind:a})=>a==="ai")?o.filter(a=>a.section!=="ai"):o;if(c.length===0&&l.length===0)return r(e.remote?"no remote-eligible bindings to proxy":void 0);let d=i;for(const{kind:a}of l)d=g(d,[a],void 0);const b=c.length>0?L(d,c):d,f=E(e.projectRoot,"dev",b);return{cleanup:f.cleanup,configPath:f.configPath,remoteBindings:c,withheld:l}},k=e=>{if(e===void 0)return!1;const r=e.trim().toLowerCase();return r==="1"||r==="true"},D=e=>e.flag===!0||k(e.envValue)?!0:e.configPreference??!1;export{p as REMOTE_ELIGIBLE_KEYS,L as injectRemoteFlags,k as isRemoteEnvEnabled,W as materializeDevWranglerConfig,B as planRemoteBindings,D as resolveRemoteEnabled};
@@ -1 +1 @@
1
- import{MERGED_DURABLE_OBJECT as _}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{o as E,v as h,a as p,b as D,c as O,d as R,e as l,g as y,h as I,H as S,i as $,R as j,S as A,j as k,k as L,W as w,l as B}from"./validate-bindings-CvNBF3U4.mjs";import{validateTailConsumers as T,validateSendEmail as C,validateSecretsRequired as N,validateLogpush as U,validateLimits as G,validatePlacement as P,validateObservability as K,validateAssets as V,validateCache as W,validateExports as M,validateCorsVariables as x,validateSchedulerOrigin as F}from"./withTailConsumer-DngzpJMK.mjs";import{isCacheEnabled as H,WORKERS_CACHE_MIN_DATE as b}from"./WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{mergeWranglerEnvironment as Y}from"./mergeWranglerEnvironment-DXiB-HcS.mjs";const q=i=>typeof i=="object"&&i!==null&&!Array.isArray(i),g=i=>Array.isArray(i)?i.flatMap((a,n)=>q(a)?[[n,a]]:[]):[],m=i=>typeof i.binding=="string"?i.binding:"",J=(i,a,n)=>{for(const[e,s]of g(i.kv_namespaces))typeof s.id=="string"&&s.id!==""||n.push(`kv_namespaces[${String(e)}] ("${m(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 g(i.r2_buckets)){const o=s.jurisdiction;if(o===a)continue;const t=typeof o=="string"?`names the "${o}" jurisdiction`:"names no jurisdiction";n.push(`r2_buckets[${String(e)}] ("${m(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`)}},z=(i,a,n)=>{const e=a?.jurisdiction;e!==void 0&&(J(i,e,n),Q(i,e,n))},v="2026-04-07",le="web_socket_auto_reply_to_close",u="2026-10-01",f="durable_object_io_tasks_prevent_eviction",X="durable_object_io_tasks_do_not_prevent_eviction",Z=/^\d{4}-\d{2}-\d{2}$/,ee=(i,a,n)=>{i>=u||a.includes(f)||a.includes(X)||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 "${f}" compatibility flag`)},te=(i,a,n)=>{const{error:e,merged:s,unverifiedKeys:o}=Y(i,a);return e!==void 0?{error:e,wrangler:s}:(o.length>0&&n.push(`env.${String(a)} overrides ${o.join(", ")}, which this validator doesn't have a verified inheritance rule for — validated against the TOP-LEVEL value only. Double-check ${o.length===1?"it":"them"} by hand for "${String(a)}".`),{wrangler:s})},ie=(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:o,wrangler:t}=te(i,n,s);if(o!==void 0)return e.push(o),{errors:e,valid:!1,warnings:s};E(t.durable_objects?.bindings).find(r=>r.name==="SHARD"&&(r.class_name==="ShardDO"||r.class_name===_))||e.push(`durable_objects.bindings must include { "name": "SHARD", "class_name": "ShardDO" } (or "${_}" when the app merges its Durable Objects) — your dev server auto-reconciles this on startup, or add the binding manually`),h(t,e);const d=t.compatibility_date??"",c=Z.test(d);d&&!c?e.push(`compatibility_date must be in YYYY-MM-DD format (got "${d}")`):d<v&&e.push(`compatibility_date must be >= "${v}" (got "${d||"<missing>"}")`),H(t)&&c&&d<b&&e.push(`cache.enabled requires compatibility_date >= "${b}" (got "${d||"<missing>"}")`),c&&ee(d,t.compatibility_flags??[],s),p(t,a,e),z(t,a,s),D(t,e),O(t,a?.vectorIndexNames??[],e),T(t,e),R(t,e,s),l(t.workflows,"workflows",w,e),y(t,e),I(t,e),l(t.secrets_store_secrets,"secrets_store_secrets",B,e);for(const r of S)$(t,r,e,s);for(const r of j)l(t[r.key],r.key,r,e);for(const r of A)k(t,r,e);return L(t,e),C(t,e,s),N(t,e),U(t,e),G(t,e),P(t,e),K(t,e,s),V(t,e),W(t,e),M(t,e),x(t,e),F(t,n,s),{errors:e,valid:e.length===0,warnings:s}},ue=ie;export{v as REQUIRED_COMPATIBILITY_DATE,le as REQUIRED_FLAG,ue as validateWrangler,ie as validateWranglerConfig};
1
+ import{MERGED_DURABLE_OBJECT as _}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{o as E,v as h,a as p,b as D,c as O,d as R,e as l,g as y,h as I,H as S,i as $,R as j,S as A,j as k,k as L,W as w,l as B}from"./validate-bindings-PVHSAU6M.mjs";import{validateTailConsumers as T,validateSendEmail as C,validateSecretsRequired as N,validateLogpush as U,validateLimits as G,validatePlacement as P,validateObservability as K,validateAssets as V,validateCache as W,validateExports as M,validateCorsVariables as x,validateSchedulerOrigin as F}from"./withTailConsumer-CF3pk_Ov.mjs";import{isCacheEnabled as H,WORKERS_CACHE_MIN_DATE as b}from"./WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{mergeWranglerEnvironment as Y}from"./mergeWranglerEnvironment-D5ekKj5x.mjs";const q=i=>typeof i=="object"&&i!==null&&!Array.isArray(i),g=i=>Array.isArray(i)?i.flatMap((a,n)=>q(a)?[[n,a]]:[]):[],m=i=>typeof i.binding=="string"?i.binding:"",J=(i,a,n)=>{for(const[e,s]of g(i.kv_namespaces))typeof s.id=="string"&&s.id!==""||n.push(`kv_namespaces[${String(e)}] ("${m(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 g(i.r2_buckets)){const o=s.jurisdiction;if(o===a)continue;const t=typeof o=="string"?`names the "${o}" jurisdiction`:"names no jurisdiction";n.push(`r2_buckets[${String(e)}] ("${m(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`)}},z=(i,a,n)=>{const e=a?.jurisdiction;e!==void 0&&(J(i,e,n),Q(i,e,n))},v="2026-04-07",le="web_socket_auto_reply_to_close",u="2026-10-01",f="durable_object_io_tasks_prevent_eviction",X="durable_object_io_tasks_do_not_prevent_eviction",Z=/^\d{4}-\d{2}-\d{2}$/,ee=(i,a,n)=>{i>=u||a.includes(f)||a.includes(X)||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 "${f}" compatibility flag`)},te=(i,a,n)=>{const{error:e,merged:s,unverifiedKeys:o}=Y(i,a);return e!==void 0?{error:e,wrangler:s}:(o.length>0&&n.push(`env.${String(a)} overrides ${o.join(", ")}, which this validator doesn't have a verified inheritance rule for — validated against the TOP-LEVEL value only. Double-check ${o.length===1?"it":"them"} by hand for "${String(a)}".`),{wrangler:s})},ie=(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:o,wrangler:t}=te(i,n,s);if(o!==void 0)return e.push(o),{errors:e,valid:!1,warnings:s};E(t.durable_objects?.bindings).find(r=>r.name==="SHARD"&&(r.class_name==="ShardDO"||r.class_name===_))||e.push(`durable_objects.bindings must include { "name": "SHARD", "class_name": "ShardDO" } (or "${_}" when the app merges its Durable Objects) — your dev server auto-reconciles this on startup, or add the binding manually`),h(t,e);const d=t.compatibility_date??"",c=Z.test(d);d&&!c?e.push(`compatibility_date must be in YYYY-MM-DD format (got "${d}")`):d<v&&e.push(`compatibility_date must be >= "${v}" (got "${d||"<missing>"}")`),H(t)&&c&&d<b&&e.push(`cache.enabled requires compatibility_date >= "${b}" (got "${d||"<missing>"}")`),c&&ee(d,t.compatibility_flags??[],s),p(t,a,e),z(t,a,s),D(t,e),O(t,a?.vectorIndexNames??[],e),T(t,e),R(t,e,s),l(t.workflows,"workflows",w,e),y(t,e),I(t,e),l(t.secrets_store_secrets,"secrets_store_secrets",B,e);for(const r of S)$(t,r,e,s);for(const r of j)l(t[r.key],r.key,r,e);for(const r of A)k(t,r,e);return L(t,e),C(t,e,s),N(t,e),U(t,e),G(t,e),P(t,e),K(t,e,s),V(t,e),W(t,e),M(t,e),x(t,e),F(t,n,s),{errors:e,valid:e.length===0,warnings:s}},ue=ie;export{v as REQUIRED_COMPATIBILITY_DATE,le as REQUIRED_FLAG,ue as validateWrangler,ie as validateWranglerConfig};
@@ -1 +1 @@
1
- import{existsSync as h}from"node:fs";import{dirname as y,join as p}from"node:path";import{discoverSchemaInfo as E}from"./discoverSchemaInfo-BBRlXZop.mjs";import{MERGED_DURABLE_OBJECT as i,GENERATED_DIRECTORY as w,MERGED_ROLE_DURABLE_OBJECTS as u,COMPOSED_ENTRY_DURABLE_OBJECTS as $,GENERATED_CLASS_MODULES as k,isFrameworkDurableObject as D}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{o as R,f as j}from"./validate-bindings-CvNBF3U4.mjs";import{validateSchedulerOrigin as x}from"./withTailConsumer-DngzpJMK.mjs";import{l as O,r as _,s as A}from"./worker-entry-checks-AIASCYl7.mjs";import{mergeWranglerEnvironment as S}from"./mergeWranglerEnvironment-DXiB-HcS.mjs";import{findWranglerFile as W,readWranglerJsonc as C}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{validateWranglerConfig as T}from"./REQUIRED_COMPATIBILITY_DATE-OLQlG0oj.mjs";const v=r=>Array.isArray(r)?r:[],L=(r,o,t)=>Object.entries(r?.images??{}).flatMap(([s,n])=>{const e=n?.dockerfile;return typeof e!="string"||h(e.startsWith("/")?e:p(o,e))?[]:[`containers images["${s}"] dockerfile "${e}" does not exist (resolved relative to ${t}); create the Dockerfile`]}),I=(r,o,t)=>{const s=[];for(const n of v(r)){const e=n?.image;typeof e=="string"&&(e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.includes("Dockerfile"))&&!h(e.startsWith("/")?e:p(o,e))&&s.push(`containers image "${e}" does not exist (resolved relative to ${t}); create the Dockerfile or point image at a registry reference`),s.push(...L(n,o,t))}return s},P=(r,o)=>{const t=r?.vectorIndexNames??[],s=[];if(t.length>0&&s.push({message:e=>`schema declares vector index(es) ${t.map(l=>`"${l}"`).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(t[0])}: env.<BINDING> }))\` to the chain.`,method:"vectors"}),r?.hasD1GlobalTable&&s.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&&s.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"}),s.length===0)return[];const n=A(o,new Set(s.map(e=>e.method)));return n===void 0?[]:s.filter(e=>!n.chained.has(e.method)).map(e=>e.message(n.site))},G="does not export it",B=(r,o)=>{if(o.exports?.has(i)===!0&&u.has(r))return`This app merges its Durable Objects (\`durableObjects.merge\` in lunora.config), so ${i} hosts ${r}: bind only \`SHARD\` to "${i}" and drop the SCHEDULER / SHARD_REGISTRY bindings. Do that only if this Worker has never been deployed — a deployed ${r} namespace keeps its data, which the merged class cannot reach; turn \`durableObjects.merge\` off to keep it.`;if(r===i)return`${i} is the merged class (\`durableObjects.merge\` in lunora.config), and merging cannot be undone once deployed: the shard data lives in ${i}. Turn \`durableObjects.merge\` back on. Only a Worker that has never been deployed may rebind SHARD to "ShardDO".`;if(o.kind!=="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 t=`it exports ${$.join(", ")}, SchedulerDO when its binding is declared, and every class codegen emits from your ${k.map(s=>`${s}.ts`).join(" / ")} declarations`;return D(r)?`\`@lunora/vite\` generates that entry — ${t}, 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: ${t}. Declare "${r}" in one of those and re-run \`lunora codegen\`, or drop the binding.`},M=(r,o)=>{const t=o.exports;if(t===void 0)return[];const s=[];for(const e of R(r.durable_objects?.bindings))typeof e.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&s.push({className:e.class_name,label:"durable_objects.bindings"});for(const e of v(r.workflows))typeof e?.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&s.push({className:e.class_name,label:"workflows"});for(const[e,l]of Object.entries(r.exports??{}))l?.type==="workflow"&&s.push({className:e,label:"workflows"});return s.filter(e=>!t.has(e.className)).map(e=>`${e.label} declares class "${e.className}" but the ${o.kind==="composed"?"composed class-A worker entry":"worker entry"} (${o.path}) ${G} — wrangler refuses to bundle a Worker whose ${e.label==="workflows"?"Workflow":"Durable Object"} classes are not exported. ${B(e.className,o)}`)},N=r=>[...j(r.migrations)].filter(o=>u.has(o)).map(o=>`migrations create class "${o}", which this app hosts in ${i} because it merges its Durable Objects (\`durableObjects.merge\`). Before the first deploy, replace "${o}" with "${i}" in new_sqlite_classes; a Worker already deployed with "${o}" keeps its data there and cannot merge — turn \`durableObjects.merge\` off.`),U=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.`],Z=r=>{const o=r.schemaDir??"lunora",t=W(r.projectRoot);if(!t){const c=`wrangler.jsonc not found in ${r.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[c],report:{errors:[c],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:s}=C(t);if(s===void 0){const c=`failed to parse ${t} as JSONC.`;return{problems:[c],report:{errors:[c],valid:!1,warnings:[]},wranglerPath:t}}const{error:n,merged:e}=S(s,r.environment);if(n!==void 0)return{problems:[n],report:{errors:[n],valid:!1,warnings:[]},wranglerPath:t};const{error:l,info:f}=E(r.projectRoot,o),a=T(s,f,r.environment);l!==void 0&&a.warnings.push(`schema parse failed in ${o}/schema.ts: ${l}`);const g=y(t),b=O(e.main,r.projectRoot,t),m=_(b,r.projectRoot,o);a.errors.push(...I(e.containers??[],g,t)),a.warnings.push(...U(b)),m!==void 0&&a.errors.push(...M(e,m)),m?.exports?.has(i)===!0&&(a.errors.push(...N(e)),h(p(r.projectRoot,o,w,"scheduler.ts"))&&x(e,r.environment,a.warnings,"the merged LunoraDO hosts the scheduler")),a.errors.push(...P(f,r.projectRoot));const d=e.assets?.directory;if(typeof d=="string"&&d.length>0){const c=d.startsWith("/")?d:p(g,d);h(c)||a.warnings.push(`assets.directory "${d}" 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:t}};export{G as UNEXPORTED_CLASS_MARKER,Z as validateWranglerProject};
1
+ import{existsSync as h}from"node:fs";import{dirname as y,join as p}from"node:path";import{discoverSchemaInfo as E}from"./discoverSchemaInfo-BBRlXZop.mjs";import{MERGED_DURABLE_OBJECT as i,GENERATED_DIRECTORY as w,MERGED_ROLE_DURABLE_OBJECTS as u,COMPOSED_ENTRY_DURABLE_OBJECTS as $,GENERATED_CLASS_MODULES as k,isFrameworkDurableObject as D}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{o as R,f as j}from"./validate-bindings-PVHSAU6M.mjs";import{validateSchedulerOrigin as x}from"./withTailConsumer-CF3pk_Ov.mjs";import{l as O,r as _,s as A}from"./worker-entry-checks-AIASCYl7.mjs";import{mergeWranglerEnvironment as S}from"./mergeWranglerEnvironment-D5ekKj5x.mjs";import{findWranglerFile as W,readWranglerJsonc as C}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{validateWranglerConfig as T}from"./REQUIRED_COMPATIBILITY_DATE-D4UcOP_t.mjs";const v=r=>Array.isArray(r)?r:[],L=(r,o,t)=>Object.entries(r?.images??{}).flatMap(([s,n])=>{const e=n?.dockerfile;return typeof e!="string"||h(e.startsWith("/")?e:p(o,e))?[]:[`containers images["${s}"] dockerfile "${e}" does not exist (resolved relative to ${t}); create the Dockerfile`]}),I=(r,o,t)=>{const s=[];for(const n of v(r)){const e=n?.image;typeof e=="string"&&(e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.includes("Dockerfile"))&&!h(e.startsWith("/")?e:p(o,e))&&s.push(`containers image "${e}" does not exist (resolved relative to ${t}); create the Dockerfile or point image at a registry reference`),s.push(...L(n,o,t))}return s},P=(r,o)=>{const t=r?.vectorIndexNames??[],s=[];if(t.length>0&&s.push({message:e=>`schema declares vector index(es) ${t.map(l=>`"${l}"`).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(t[0])}: env.<BINDING> }))\` to the chain.`,method:"vectors"}),r?.hasD1GlobalTable&&s.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&&s.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"}),s.length===0)return[];const n=A(o,new Set(s.map(e=>e.method)));return n===void 0?[]:s.filter(e=>!n.chained.has(e.method)).map(e=>e.message(n.site))},G="does not export it",B=(r,o)=>{if(o.exports?.has(i)===!0&&u.has(r))return`This app merges its Durable Objects (\`durableObjects.merge\` in lunora.config), so ${i} hosts ${r}: bind only \`SHARD\` to "${i}" and drop the SCHEDULER / SHARD_REGISTRY bindings. Do that only if this Worker has never been deployed — a deployed ${r} namespace keeps its data, which the merged class cannot reach; turn \`durableObjects.merge\` off to keep it.`;if(r===i)return`${i} is the merged class (\`durableObjects.merge\` in lunora.config), and merging cannot be undone once deployed: the shard data lives in ${i}. Turn \`durableObjects.merge\` back on. Only a Worker that has never been deployed may rebind SHARD to "ShardDO".`;if(o.kind!=="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 t=`it exports ${$.join(", ")}, SchedulerDO when its binding is declared, and every class codegen emits from your ${k.map(s=>`${s}.ts`).join(" / ")} declarations`;return D(r)?`\`@lunora/vite\` generates that entry — ${t}, 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: ${t}. Declare "${r}" in one of those and re-run \`lunora codegen\`, or drop the binding.`},M=(r,o)=>{const t=o.exports;if(t===void 0)return[];const s=[];for(const e of R(r.durable_objects?.bindings))typeof e.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&s.push({className:e.class_name,label:"durable_objects.bindings"});for(const e of v(r.workflows))typeof e?.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&s.push({className:e.class_name,label:"workflows"});for(const[e,l]of Object.entries(r.exports??{}))l?.type==="workflow"&&s.push({className:e,label:"workflows"});return s.filter(e=>!t.has(e.className)).map(e=>`${e.label} declares class "${e.className}" but the ${o.kind==="composed"?"composed class-A worker entry":"worker entry"} (${o.path}) ${G} — wrangler refuses to bundle a Worker whose ${e.label==="workflows"?"Workflow":"Durable Object"} classes are not exported. ${B(e.className,o)}`)},N=r=>[...j(r.migrations)].filter(o=>u.has(o)).map(o=>`migrations create class "${o}", which this app hosts in ${i} because it merges its Durable Objects (\`durableObjects.merge\`). Before the first deploy, replace "${o}" with "${i}" in new_sqlite_classes; a Worker already deployed with "${o}" keeps its data there and cannot merge — turn \`durableObjects.merge\` off.`),U=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.`],Z=r=>{const o=r.schemaDir??"lunora",t=W(r.projectRoot);if(!t){const c=`wrangler.jsonc not found in ${r.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[c],report:{errors:[c],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:s}=C(t);if(s===void 0){const c=`failed to parse ${t} as JSONC.`;return{problems:[c],report:{errors:[c],valid:!1,warnings:[]},wranglerPath:t}}const{error:n,merged:e}=S(s,r.environment);if(n!==void 0)return{problems:[n],report:{errors:[n],valid:!1,warnings:[]},wranglerPath:t};const{error:l,info:f}=E(r.projectRoot,o),a=T(s,f,r.environment);l!==void 0&&a.warnings.push(`schema parse failed in ${o}/schema.ts: ${l}`);const g=y(t),b=O(e.main,r.projectRoot,t),m=_(b,r.projectRoot,o);a.errors.push(...I(e.containers??[],g,t)),a.warnings.push(...U(b)),m!==void 0&&a.errors.push(...M(e,m)),m?.exports?.has(i)===!0&&(a.errors.push(...N(e)),h(p(r.projectRoot,o,w,"scheduler.ts"))&&x(e,r.environment,a.warnings,"the merged LunoraDO hosts the scheduler")),a.errors.push(...P(f,r.projectRoot));const d=e.assets?.directory;if(typeof d=="string"&&d.length>0){const c=d.startsWith("/")?d:p(g,d);h(c)||a.warnings.push(`assets.directory "${d}" 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:t}};export{G as UNEXPORTED_CLASS_MARKER,Z as validateWranglerProject};
@@ -1,3 +1,3 @@
1
- import{LunoraError as n}from"@lunora/errors";import{lunoraLine as i}from"./LUNORA_TAG-DQTGPqcJ.mjs";import{validateWranglerProject as l}from"./UNEXPORTED_CLASS_MARKER-DwJCN8fX.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-DQTGPqcJ.mjs";import{validateWranglerProject as l}from"./UNEXPORTED_CLASS_MARKER-mdcw5KDY.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 @@
1
+ import{rmSync as l,readdirSync as c,writeFileSync as u}from"node:fs";import{join as a}from"node:path";const d=/^\.wrangler\.lunora-(?:dev|service)\.(\d+)\.\d+\.jsonc$/;let s=0;const f=n=>(s+=1,`.wrangler.lunora-${n}.${String(process.pid)}.${String(s)}.jsonc`),g=n=>{try{return process.kill(n,0),!0}catch(r){return r.code==="EPERM"}},p=n=>{let r;try{r=c(n)}catch{return}for(const t of r){const e=d.exec(t);if(!(e===null||Number(e[1])===process.pid||g(Number(e[1]))))try{l(a(n,t),{force:!0})}catch{}}},w=()=>{},m=n=>{let r=!1;return()=>{if(!r){r=!0;try{l(n,{force:!0})}catch{}}}},y=(n,r,t)=>{p(n);const e=a(n,f(r));return u(e,t,"utf8"),{cleanup:m(e),configPath:e}},v=(n,r)=>{const t=n?.ai,e=n?.artifacts,i=(Array.isArray(e)?e:[]).flatMap(o=>typeof o?.binding=="string"?[o.binding]:[]);return t==null&&i.length===0?[]:r()?[]:[...t==null?[]:[{binding:typeof t.binding=="string"?t.binding:"AI",kind:"ai"}],...i.map(o=>({binding:o,kind:"artifacts"}))]},C=({binding:n,kind:r})=>r==="ai"?`Workers AI is off in this dev session (${n} binding left out): no Cloudflare login found, and Workers AI only runs remotely. \`@cf/…\` models will throw; AI SDK models and \`LUNORA_AI_PROXY_URL\` slugs still work. Run \`wrangler login\` or set CLOUDFLARE_API_TOKEN to turn it on.`:`Artifacts is off in this dev session (${n} binding left out): no Cloudflare login found, and Artifacts only runs remotely. \`ctx.artifacts\` will throw. Run \`wrangler login\` or set CLOUDFLARE_API_TOKEN to turn it on.`;export{d as STALE_DEV_CONFIG,m as createCleanup,C as describeWithheld,f as devConfigBasename,w as noopCleanup,p as sweepStaleDevConfigs,v as withheldBindings,y as writeDevConfig};
@@ -211,9 +211,10 @@ interface InferredBindings {
211
211
  usesAnalyticsSql: boolean;
212
212
  /**
213
213
  * `ctx.artifacts` is read or `@lunora/bindings/artifacts` value-imported.
214
- * Hint-only: the first repo `create()` against a missing namespace creates it
215
- * UNRESTRICTED, and a namespace's jurisdiction can never change after that,
216
- * so Lunora never writes the binding for you.
214
+ * Reconcile writes the binding with the Worker's name as its namespace. The first repo
215
+ * `create()` against a missing namespace creates it UNRESTRICTED and the jurisdiction can
216
+ * never change after that, so `lunora deploy` creates a pinned schema's namespace in its
217
+ * jurisdiction, and stops when it can't.
217
218
  */
218
219
  usesArtifacts: boolean;
219
220
  /** `@lunora/auth` is imported (sessions may be D1- or `SessionDO`-backed). */
@@ -224,11 +225,11 @@ interface InferredBindings {
224
225
  usesCimdWorkers: boolean;
225
226
  /** `lunora/flags.ts` declares a feature-flag provider (any OpenFeature provider — Flagship or custom). */
226
227
  usesFlags: boolean;
227
- /** `@lunora/hyperdrive` is imported or `ctx.sql` read (binding needs an un-mintable remote `id`; hint-only). */
228
+ /** `@lunora/hyperdrive` is imported or `ctx.sql` read (reconcile writes `{ binding: "HYPERDRIVE" }` with a placeholder `id`; `lunora deploy` swaps in the created config's). */
228
229
  usesHyperdrive: boolean;
229
230
  /** `@lunora/bindings/images` is imported or `ctx.images` read → self-describing `images` binding (auto-writeable). */
230
231
  usesImages: boolean;
231
- /** `@lunora/bindings/kv` is imported or `ctx.kv` read (namespace binding name + id are user-defined; hint-only). */
232
+ /** `@lunora/bindings/kv` is imported or `ctx.kv` read (reconcile writes `{ binding: "KV" }` without an id and wrangler creates the namespace on deploy, unless the schema pins a jurisdiction). */
232
233
  usesKv: boolean;
233
234
  /** `@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. */
234
235
  usesMail: boolean;
@@ -211,9 +211,10 @@ interface InferredBindings {
211
211
  usesAnalyticsSql: boolean;
212
212
  /**
213
213
  * `ctx.artifacts` is read or `@lunora/bindings/artifacts` value-imported.
214
- * Hint-only: the first repo `create()` against a missing namespace creates it
215
- * UNRESTRICTED, and a namespace's jurisdiction can never change after that,
216
- * so Lunora never writes the binding for you.
214
+ * Reconcile writes the binding with the Worker's name as its namespace. The first repo
215
+ * `create()` against a missing namespace creates it UNRESTRICTED and the jurisdiction can
216
+ * never change after that, so `lunora deploy` creates a pinned schema's namespace in its
217
+ * jurisdiction, and stops when it can't.
217
218
  */
218
219
  usesArtifacts: boolean;
219
220
  /** `@lunora/auth` is imported (sessions may be D1- or `SessionDO`-backed). */
@@ -224,11 +225,11 @@ interface InferredBindings {
224
225
  usesCimdWorkers: boolean;
225
226
  /** `lunora/flags.ts` declares a feature-flag provider (any OpenFeature provider — Flagship or custom). */
226
227
  usesFlags: boolean;
227
- /** `@lunora/hyperdrive` is imported or `ctx.sql` read (binding needs an un-mintable remote `id`; hint-only). */
228
+ /** `@lunora/hyperdrive` is imported or `ctx.sql` read (reconcile writes `{ binding: "HYPERDRIVE" }` with a placeholder `id`; `lunora deploy` swaps in the created config's). */
228
229
  usesHyperdrive: boolean;
229
230
  /** `@lunora/bindings/images` is imported or `ctx.images` read → self-describing `images` binding (auto-writeable). */
230
231
  usesImages: boolean;
231
- /** `@lunora/bindings/kv` is imported or `ctx.kv` read (namespace binding name + id are user-defined; hint-only). */
232
+ /** `@lunora/bindings/kv` is imported or `ctx.kv` read (reconcile writes `{ binding: "KV" }` without an id and wrangler creates the namespace on deploy, unless the schema pins a jurisdiction). */
232
233
  usesKv: boolean;
233
234
  /** `@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. */
234
235
  usesMail: boolean;
@@ -0,0 +1 @@
1
+ import{existsSync as T,statSync as P,readFileSync as F,readdirSync as k}from"node:fs";import{discoverFlags as L,FLAGS_FILENAME as B,discoverQueues as G,CAPABILITY_PROBES as C,readServiceBindings as W,discoverNotifyChannels as Y,NOTIFY_FILENAME as K,mayReadCapabilityContext as q,foldCapabilitySignals as $,capabilitiesUsedBy as M,sourceCapabilitySignals as U}from"@lunora/codegen";import{init as H}from"es-module-lexer";import{Project as V}from"ts-morph";import{discoverAgentInfo as X}from"./discoverAgentInfo-pqFMJBtJ.mjs";import{discoverContainerInfo as Q}from"./discoverContainerInfo-DzXr7Vm3.mjs";import{escapeRegExp as J}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{d as _}from"./discover-info-DC2MrAIM.mjs";import{relative as z,sep as Z,isAbsolute as ee,join as y}from"node:path";import{P as se}from"./package-secrets-registry-BeheNwsP.mjs";import{discoverSchemaInfo as te}from"./discoverSchemaInfo-BBRlXZop.mjs";import{resolveWorkerEntry as re,composedEntryDurableObjects as oe,GENERATED_DIRECTORY as R,DURABLE_OBJECT_BINDINGS as ne,detectExportedDurableObjects as ae,detectClassExports as x,isMergedProject as ie}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{discoverWorkflowInfo as ce}from"./discoverWorkflowInfo-zW7Tt0Tn.mjs";const de=(e,s)=>{const{error:r,value:t}=_(e,s,B,L);return r===void 0?{flags:t}:{error:r}},ue=(e,s)=>{const r=z(s,e);return r!==""&&r!==".."&&!r.startsWith(`..${Z}`)&&!ee(r)},le=(e,s)=>{const{error:r,value:t}=_(e,s,void 0,G);return r===void 0?{queues:t??[]}:{error:r,queues:[]}},me=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),pe=new Set([".git",".lunora-cache",".wrangler","dist",R,"node_modules"]),he=["lunora","src"],fe=/\benv\s*\.\s*DB\b/,ge=/\benv\s*\.\s*AI\b/,D=["ai","aiSearch","analytics","analyticsSql","artifacts","browser","hyperdrive","images","kv","mail","notify","payments","pipelines","r2sql","scheduler","storage","x402"],w=e=>`uses${e.charAt(0).toUpperCase()}${e.slice(1)}`,N=[["usesAuth","@lunora/auth"],["usesCimdWorkers","@lunora/auth/cimd/workers"],["usesX402Charge","@lunora/x402/charge"],["usesPaymentAutumn","@lunora/payment/autumn"],["usesPaymentCreem","@lunora/payment/creem"],["usesPaymentDodopayments","@lunora/payment/dodopayments"],["usesPaymentPolar","@lunora/payment/polar"],["usesPaymentStripe","@lunora/payment/stripe"]],j=[...D.map(e=>[w(e),C[e].moduleSpecifier]),...N].toSorted(([e],[s])=>e.localeCompare(s)),ye=[["usesNotifyFcm","@lunora/notify:fcm"],["usesNotifyWebPush","@lunora/notify:webPush"]],be=["@lunora/agent","@lunora/agent/sandbox"],Se=new RegExp(String.raw`["'\x60](?:${[...j.map(([,e])=>e),...be].map(e=>J(e)).join("|")})["'\x60]`,"u"),n=e=>{const{contextProperty:s,moduleSpecifier:r}=C[e];return s===void 0?`${r} is imported`:`${r} is imported or ctx.${s} is read`},ve="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",Ee=()=>{let e;return()=>(e??=new V({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}),e)},Ae=(e,s,r)=>{const t=r(),o=t.createSourceFile(`/scan/${s.slice(s.lastIndexOf("/")+1)}`,e,{overwrite:!0}),a=U(o);return t.removeSourceFile(o),a},O=(e,s)=>{let r;try{r=k(e,{withFileTypes:!0})}catch{return}for(const t of r){if(t.isDirectory()){pe.has(t.name)||O(y(e,t.name),s);continue}const o=t.name.lastIndexOf(".");o!==-1&&me.has(t.name.slice(o))&&s.push(y(e,t.name))}},xe=(e,s,r)=>{const{info:t}=te(e,s,r);return{jurisdiction:t?.jurisdiction,needsD1:t?.hasD1GlobalTable??!1}},Re=(e,s,r)=>{const t=Ee(),o=y(e,r),a=[],d=[];let u=!1,i=!1;for(const l of s){const p=y(e,l);if(!T(p)||!P(p).isDirectory())continue;const f=[];O(p,f);for(const m of f){const c=F(m,"utf8"),A=ue(m,o);u||=ge.test(c),i||=fe.test(c),(Se.test(c)||A&&q(c))&&(A?a:d).push(Ae(c,m,t))}}const h=$(a),b=$([h,...d]),S=new Set([...b.valueImports,...b.dynamicImports]),v=M({contextReads:h.contextReads,valueImports:S});return{...Object.fromEntries([...D.map(l=>[w(l),v.has(l)]),...N.map(([l,p])=>[l,S.has(p)])]),needsD1:i,usesAi:v.has("ai")||u,usesBrowser:v.has("browser")||h.sandboxTools.usesSandboxBrowser,usesWorkerLoader:h.sandboxTools.usesSandboxLoader}},_e=(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"\``)],Ie=(e,s,r)=>[[e.usesAi,`AI (${n("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: ${n("scheduler")}, but no SchedulerDO is exported by the worker entry`],[e.usesStorage,`hint: ${n("storage")}; add an r2_buckets binding (bucket binding names are user-defined)`],[e.usesMail,`hint: ${n("mail")}; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)`],[e.usesPayments,`hint: ${n("payments")}; set the provider secrets in .dev.vars — ${ve}`],[e.usesBrowser,`browser (${n("browser")}, or a sandbox browserTool imported in lunora/) — self-describing { binding: BROWSER }`],[e.usesImages,`images (${n("images")}) — self-describing { binding: IMAGES }`],[e.usesAnalytics,`analytics_engine_datasets (${n("analytics")}) — self-describing { binding: ANALYTICS, dataset }`],[e.usesWorkerLoader,"worker_loaders (jsCodeTool imported in lunora/) — self-describing { binding: LOADER }"],[e.usesAiSearch,`ai_search_namespaces (${n("aiSearch")}) — self-describing { binding: AI_SEARCH, namespace: "default" }; remote-only, so \`lunora dev\` reaches the deployed AI Search service`],[e.usesAnalyticsSql,`analytics (${n("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,r.jurisdiction===void 0?`kv_namespaces (${n("kv")}) — { binding: KV } with no id; wrangler creates the namespace on the first deploy`:`hint: ${n("kv")} and the schema pins "${r.jurisdiction}"; create the namespace with --jurisdiction ${r.jurisdiction} and add a kv_namespaces binding ({ binding, id })`],[e.usesHyperdrive,`hyperdrive (${n("hyperdrive")}) — { binding: HYPERDRIVE } with a placeholder id; dev uses an embedded Postgres and \`lunora deploy\` creates the config`],[e.usesPipelines,`hint: ${n("pipelines")}; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, stream }) — the pipeline resource can't be auto-provisioned`],[e.usesArtifacts,r.jurisdiction===void 0?`artifacts (${n("artifacts")}) — { binding: ARTIFACTS, namespace }`:`hint: ${n("artifacts")}; the schema pins data to "${r.jurisdiction}", so create the namespace in that jurisdiction first and add { binding: ARTIFACTS, namespace } yourself — \`lunora deploy\` then checks it (a first create() in dev would make it unrestricted)`],[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: ${n("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(([o])=>o).map(([,o])=>o),$e=(e,s,r,t=[],o=[],a=[])=>{const d=new Set(e.map(i=>i.className)),u=e.map(i=>`${i.binding}/${i.className} (exported by worker entry)`);return s.needsD1&&u.push("DB (.global() table declared)"),u.push(..._e(t,o,a),...Ie(r,d,s)),u},We=async e=>{await H;const s=e.schemaDir??"lunora",r=e.scanDirs??he,t=()=>Re(e.projectRoot,r,s),o=e.cache===void 0?t():e.cache.memo(`capabilities:${e.projectRoot}:${s}:${r.join(",")}`,t),a=re(e.projectRoot);let d;a.composed?d=oe(y(e.projectRoot,s,R)).map(I=>({binding:ne[I],className:I})):d=a.path===void 0?[]:ae(a.path);const u=xe(e.projectRoot,s,e.cache),i={...u,needsD1:o.needsD1||u.needsD1},h=x(a,Q(e.projectRoot,s,e.cache).containers,"containers"),b=x(a,ce(e.projectRoot,s).workflows,"workflows"),S=x(a,X(e.projectRoot,s).agents,"agents"),v=[...le(e.projectRoot,s).queues],{flags:E}=de(e.projectRoot,s),l=_(e.projectRoot,s,K,Y),p=l.error===void 0?l.value:{hasFcm:!0,hasWebPush:!0},f=E?.provider==="flagship"&&E.mode==="binding"?E.bindingName:void 0,m=$e(d,i,o,h,b,S);!a.composed&&ie(y(e.projectRoot,s,R))&&!d.some(g=>g.className==="LunoraDO")&&m.push("hint: durableObjects.merge is set, but the worker entry exports no LunoraDO — export one built with mergeDurableObjects, or the classes stay separate"),f!==void 0&&m.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${f}", app_id }) — the app_id can't be auto-provisioned`);const c=W(e.projectRoot),A=c.error===void 0?c.services:void 0;return c.error!==void 0&&m.push(`hint: lunora.config \`services\` not reconciled — ${c.error}`),m.push(...c.services.map(g=>`${g.binding} → ${g.worker} (lunora.config services.${g.name})`)),{...o,agents:S,containers:h,durableObjects:d,flagshipBinding:f,...i.jurisdiction===void 0?{}:{jurisdiction:i.jurisdiction},needsD1:i.needsD1,queues:v,services:A,signals:m,usesFlags:E!==void 0,usesNotifyFcm:p?.hasFcm??!1,usesNotifyWebPush:p?.hasWebPush??!1,workflows:b}},Ye=e=>[...j,...ye].filter(([s,r])=>e[s]&&se[r]!==void 0).map(([,s])=>s);export{We as inferLunoraBindings,Ye as secretSourcesFromBindings};
@@ -0,0 +1 @@
1
+ import{isAbsolute as p,dirname as m,resolve as h}from"node:path";import{applyModify as l}from"./applyModify-DKP2l6S9.mjs";import{hasCloudflareCredentials as u}from"./hasCloudflareCredentials-byvHpEiD.mjs";import{withheldBindings as g,writeDevConfig as w}from"./describeWithheld-BAaWBzKD.mjs";import{readWranglerJsonc as v}from"./WRANGLER_FILES-UNW-xY5u.mjs";const C=(e,n)=>{const{parsed:t,text:c}=v(e),o=t?.build,r=g(t,n.hasCredentials??(()=>u({projectRoot:n.projectRoot}))),s=typeof o?.command=="string"&&o.command!==""&&!(typeof o.cwd=="string"&&p(o.cwd));if(!s&&r.length===0)return{configPath:e,withheld:r};const d=m(e);let i=c;for(const{kind:f}of r)i=l(i,[f],void 0);s&&(i=l(i,["build","cwd"],h(d,typeof o.cwd=="string"?o.cwd:".")));const a=w(d,"service",i);return{cleanup:a.cleanup,configPath:a.configPath,withheld:r}},x=(e,n)=>{const t=e.map(o=>C(o,n)),c=t.flatMap(o=>o.cleanup===void 0?[]:[o.cleanup]);return{cleanup:()=>{for(const o of c)o()},configPaths:t.map(o=>o.configPath),withheld:t.flatMap(o=>o.withheld)}};export{x as materializeServiceDevConfigs};
@@ -0,0 +1 @@
1
+ const c=["ai_search","ai_search_namespaces","analytics","artifacts","containers","d1_databases","durable_objects","hyperdrive","k2","kv_namespaces","queues","r2_buckets","secrets","secrets_store_secrets","services","tail_consumers","vars","vectorize","workflows"],i=["assets","compatibility_date","compatibility_flags","exports","logpush","main","migrations","observability","placement"],m=(s,n)=>{if(n===void 0)return{merged:s,unverifiedKeys:[]};const t=s.env?.[n];if(t===void 0){const e=Object.keys(s.env??{}).toSorted((v,f)=>v.localeCompare(f)),l=e.length>0?` (declared: ${e.join(", ")}).`:" (no environments are declared).";return{error:`--env "${n}" names no environment declared in wrangler.jsonc's "env" block${l}`,merged:s,unverifiedKeys:[]}}const r={...s},o=Object.keys(t).filter(e=>e!=="env");for(const e of o)i.includes(e)&&(r[e]=t[e]);for(const e of c)r[e]=t[e];const a=new Set([...c,...i]),d=o.filter(e=>!a.has(e)).map(String);return{merged:r,unverifiedKeys:d}};export{c as NON_INHERITABLE_KEYS,m as mergeWranglerEnvironment};
@@ -0,0 +1 @@
1
+ import{inferLunoraBindings as g}from"./inferLunoraBindings-CH8xwMCn.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-DQTGPqcJ.mjs";import{reconcileWranglerBindings as p}from"./HYPERDRIVE_PLACEHOLDER_ID-DZn1Fk4-.mjs";import{reconcileWranglerCompatibilityDate as $}from"./reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{reconcileWranglerCrons as m,describePreservedCrons as w}from"./describePreservedCrons-C5KPuPy3.mjs";const j=async(i,t,a)=>{try{const n=await g({projectRoot:i.projectRoot,schemaDir:i.schemaDir}),e=p(i.projectRoot,n,{target:i.target}),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=$(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,3 @@
1
+ import{createHash as O,randomUUID as v}from"node:crypto";import{mkdirSync as _,rmSync as y,readFileSync as N,writeFileSync as I,linkSync as w,renameSync as R}from"node:fs";import{findWranglerFile as C,readWranglerJsonc as k}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{join as $}from"node:path";const E=["CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_","WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_"],p=e=>`${E[0]}${e}`,D="pnpm add -D @electric-sql/pglite @electric-sql/pglite-socket",m="postgres://postgres:postgres@127.0.0.1:1/postgres",A=(e,t,r)=>typeof t.localConnectionString=="string"&&t.localConnectionString!==""||E.some(o=>{const n=r[`${o}${e}`]??"";return n!==""&&n!==m}),H=(e,t,r=t.CLOUDFLARE_ENV,o)=>{const n=o??C(e),i=n===void 0?void 0:k(n).parsed,c=r===void 0||r===""?void 0:i?.env?.[r];return((c===void 0?i?.hyperdrive:c.hyperdrive)??[]).flatMap(a=>typeof a?.binding=="string"&&a.binding!==""&&!A(a.binding,a,t)?[a.binding]:[])},T=async({PGlite:e,PGLiteSocketServer:t,vector:r},o)=>{const n=await e.create({dataDir:o,...r===void 0?{}:{extensions:{vector:r}}});let i;try{i=new t({db:n,host:"127.0.0.1",maxConnections:16,port:0}),await i.start()}catch(a){throw await Promise.allSettled([i?.stop(),n.close()]),a}const[c="127.0.0.1",g="5432"]=i.getServerConn().split(":");return{connectionString:`postgres://postgres:postgres@${c}:${g}/postgres`,stop:async()=>{try{await i.stop()}finally{await n.close()}}}},P=/[^\w-]/gu,F=e=>{const t=e.replaceAll(P,"_");return t===e?e:`${t}-${O("sha256").update(e).digest("hex").slice(0,8)}`},q=e=>{try{return process.kill(e,0),!0}catch(t){return t.code==="EPERM"}},x=e=>{try{const t=JSON.parse(N($(e,"package.json"),"utf8")),r=new Set([...Object.keys(t.dependencies??{}),...Object.keys(t.devDependencies??{})]);return r.has("mysql2")&&!r.has("pg")&&!r.has("postgres")}catch{return!1}},f=new Set,G=()=>{for(const e of f)y(e,{force:!0});f.clear()};let h=!1;const U=()=>{h||(h=!0,process.once("exit",G))},S=e=>{try{const[t="",r=""]=N(e,"utf8").split(`
2
+ `),o=Number.parseInt(t,10);return Number.isInteger(o)?{kind:"pid",pid:o,token:r}:{kind:"garbage",pid:-1,token:""}}catch(t){return{kind:t.code==="ENOENT"?"gone":"unreadable",pid:-1,token:""}}},L=e=>e.kind==="pid"&&e.pid!==process.pid&&q(e.pid),j=(e,t)=>{try{w(e,t)}catch(r){if(r.code!=="EEXIST")throw r;return}return f.add(t),U(),{release:()=>{f.delete(t)&&y(t,{force:!0})}}},W=(e,t)=>{const r=`${e}.stale.${v()}`;try{R(e,r)}catch{return}const o=S(r);try{if(o.token!==t.token&&L(o)){try{w(r,e)}catch{}return{holder:o.pid}}return}finally{y(r,{force:!0})}},M=e=>{const t=`${e}.${String(process.pid)}.${v()}`;I(t,`${String(process.pid)}
3
+ ${v()}`,"utf8");try{for(let r=0;r<3;r+=1){const o=j(t,e);if(o!==void 0)return o;if(f.has(e))return{holder:process.pid};const n=S(e);if(n.kind==="unreadable"||L(n))return{holder:n.pid};const i=n.kind==="gone"?void 0:W(e,n);if(i!==void 0)return i}return{holder:S(e).pid}}finally{y(t,{force:!0})}},V=/@electric-sql\/pglite/u,B=async()=>{try{const[{PGlite:e},{PGLiteSocketServer:t}]=await Promise.all([import("@electric-sql/pglite"),import("@electric-sql/pglite-socket")]),r=await import("@electric-sql/pglite-pgvector").then(o=>o.vector,()=>{});return{createServer:async o=>T({PGlite:e,PGLiteSocketServer:t,vector:r},o)}}catch(e){const{code:t,message:r}=e;if((t==="ERR_MODULE_NOT_FOUND"||t==="MODULE_NOT_FOUND")&&V.test(r??""))return;throw e}},Q=async e=>{try{return{runtime:await e()}}catch(t){return{failure:t instanceof Error?t.message:String(t)}}},J=async(e,t,r)=>{try{const o=await e.createServer(t);return{connectionString:o.connectionString,stop:async()=>{try{await o.stop()}finally{r.release()}}}}catch(o){throw r.release(),o}},X=(e,t)=>`Hyperdrive binding ${e.map(r=>`"${r}"`).join(", ")}: the embedded Postgres is installed but failed to load (${t}), so \`ctx.sql\` will fail to connect in dev. Set ${p(e[0]??"<BINDING>")} to use a database of your own.`,Y=(e,t)=>{const r=e.map(n=>`"${n}"`).join(", "),o=p(e[0]??"<BINDING>");return t?`Hyperdrive binding ${r}: this project's SQL driver is mysql2, and the embedded database speaks PostgreSQL, so \`ctx.sql\` will fail to connect in dev. Set ${o} to a local MySQL connection string.`:`Hyperdrive binding ${r} has no local database, so \`ctx.sql\` will fail to connect in dev. Run \`${D}\` for an embedded Postgres, or set ${o}.`},te=async e=>{const t=e.env??process.env,r=H(e.projectRoot,t,void 0,e.wranglerConfigPath);if(r.length===0)return;const o=new Map,n=s=>{t[p(s)]=m,o.set(s,m)},i=[],c=async()=>{const s=i.splice(0),l=[...o];o.clear();for(const[d,u]of l)t[p(d)]===u&&Reflect.deleteProperty(t,p(d));await Promise.allSettled(s.map(async d=>d.stop()))},g=x(e.projectRoot),{failure:a,runtime:b}=g?{failure:void 0,runtime:void 0}:await Q(e.load??B);if(b===void 0){e.onWarning?.(a===void 0?Y(r,g):X(r,a));for(const s of r)n(s);return{bindings:[],stop:c}}try{for(const s of r){const l=$(e.projectRoot,".wrangler","state","lunora-pglite",F(s));_(l,{recursive:!0});const d=M(`${l}.lock`);if("holder"in d){e.onWarning?.(`Hyperdrive binding "${s}": another process (pid ${String(d.holder)}) has its embedded Postgres open, so \`ctx.sql\` will fail to connect here. Stop it, or set ${p(s)} to use a database of your own.`),n(s);continue}const u=await J(b,l,d);i.push({binding:s,stop:u.stop}),t[p(s)]=u.connectionString,o.set(s,u.connectionString)}}catch(s){e.onWarning?.(`Could not start the embedded Postgres for Hyperdrive: ${s instanceof Error?s.message:String(s)}`),await c();for(const l of r)n(l);return{bindings:[],stop:c}}return{bindings:i.map(({binding:s})=>s),stop:c}};export{H as bindingsNeedingDatabase,G as releaseHeldLocks,T as serveDatabase,te as startLocalHyperdrive};
@@ -1 +1 @@
1
- import{CUSTOM_INSTANCE_TYPE_LIMITS as f,CUSTOM_INSTANCE_MIN_MEMORY_MIB_PER_VCPU as y}from"@lunora/container";import{i as g,a as d}from"./guards-Buu_E7mP.mjs";const 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"]}],B=[...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},L=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},F=(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:b}]of Object.entries(S)){const m=s[o];if(m!==void 0&&(typeof m!="number"||Number.isNaN(m)||m<b||m>c)){const w=r!==void 0&&typeof m=="number"&&m<b?` — ${r}`:"";a.push(`${n} custom instance_type ${o} must be a number in ${String(b)}–${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`)},u=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 u(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 u(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()),P=(e,n)=>{const a=x(e.migrations);for(const s of u(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`)},W=(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(u(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))}}},G={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"},N=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),...N(e.default_retention)];for(const i of t)i!==void 0&&s.push(`${n}.${i}`)},q=(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 q(o,n))s.push(`${r} and ${t} set ${c} to different values for workflow "${i}" — set it in one place`)}},K=(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`},Q=(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)}},V={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`},Y=[{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"}],z=(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(b=>d(o[b]))||s.push(n.hintMessage(r,o.binding))}}},H=[{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" })'}],J=(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)},X=[{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&&!u(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&&u(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)')},ee=(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`)}}},ne=(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{Y as H,X as R,H as S,G as W,Z as a,ee as b,F as c,W as d,v as e,x as f,K as g,Q as h,z as i,J as j,ne as k,V as l,B as m,p as n,u as o,h as p,_ as s,P as v,L as w};
1
+ import{CUSTOM_INSTANCE_TYPE_LIMITS as f,CUSTOM_INSTANCE_MIN_MEMORY_MIB_PER_VCPU as y}from"@lunora/container";import{i as g,a as d}from"./guards-Buu_E7mP.mjs";const 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"]}],B=[...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},L=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},F=(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}"`)},w=new Set(["basic","dev","lite","standard","standard-1","standard-2","standard-3","standard-4"]),M={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"){w.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:b}]of Object.entries(M)){const m=s[o];if(m!==void 0&&(typeof m!="number"||Number.isNaN(m)||m<b||m>c)){const S=r!==void 0&&typeof m=="number"&&m<b?` — ${r}`:"";a.push(`${n} custom instance_type ${o} must be a number in ${String(b)}–${String(c)} (got ${String(m)})${S}`)}}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`)},u=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 u(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 u(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()),P=(e,n)=>{const a=x(e.migrations);for(const s of u(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`)},W=(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(u(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))}}},G={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"},N=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),...N(e.default_retention)];for(const i of t)i!==void 0&&s.push(`${n}.${i}`)},q=(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 q(o,n))s.push(`${r} and ${t} set ${c} to different values for workflow "${i}" — set it in one place`)}},K=(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`},Q=(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)}},V={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`},Y=[{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`,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"}],z=(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}if(!("hintField"in n))continue;(typeof n.hintField=="string"?[n.hintField]:n.hintField).some(b=>d(o[b]))||s.push(n.hintMessage(r,o.binding))}}},H=[{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" })'}],J=(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)},X=[{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&&!u(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&&u(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)')},ee=(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`)}}},ne=(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{Y as H,X as R,H as S,G as W,Z as a,ee as b,F as c,W as d,v as e,x as f,K as g,Q as h,z as i,J as j,ne as k,V as l,B as m,p as n,u as o,h as p,_ as s,P as v,L as w};
@@ -1 +1 @@
1
- import{i as u,a as f}from"./guards-Buu_E7mP.mjs";import{o as v}from"./validate-bindings-CvNBF3U4.mjs";const _=new Set(["1","enabled","on","true","yes"]),A=s=>typeof s=="string"&&_.has(s.trim().toLowerCase()),b=(s,t,e,i)=>{s!==void 0&&typeof s!="boolean"&&e.push(`${t} must be a boolean${i===void 0?"":` (${i})`}`)},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)`)},N=(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`)},k=(s,t)=>{b(s.logpush,"logpush",t,'set "logpush": true to enable Cloudflare Logpush')},I=(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"] })')},m=3e5,C=(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>m&&t.push(`limits.cpu_ms must be at most ${String(m)} (Cloudflare's per-invocation ceiling)`)}},p=new Set(["off","smart","targeted"]),w=(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"||!p.has(i))&&t.push(`placement.mode must be one of ${[...p].map(n=>`"${n}"`).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,i)=>{switch(s.kind){case"boolean":{b(t,e,i,s.hint);break}case"destinations":{t!==void 0&&(!Array.isArray(t)||t.some(n=>!f(n)))&&i.push(`${e} must be an array of destination names configured in the Cloudflare dashboard`);break}case"samplingRate":{O(t,e,i);break}}},g=(s,t,e,i,n)=>{for(const[o,a]of Object.entries(s)){const r=Object.hasOwn(t,o)?t[o]:void 0,l=`${e}.${o}`;r===void 0?n.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,i):u(a)?g(a,r.level,l,i,n):a!==void 0&&i.push(`${l} must be an object`)}},x=(s,t,e)=>{const{observability:i}=s;if(i!==void 0){if(!u(i)){t.push('observability must be an object (e.g. { "enabled": true, "head_sampling_rate": 1 })');return}g(i,L,"observability",t,e)}},D=(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)}},T=(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`))}}},B=(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`)},G=(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]}},P=(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(r=>r.trim()==="*"),a=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')},j=s=>v(s.durable_objects?.bindings).some(t=>t.class_name==="SchedulerDO"&&t.script_name===void 0),d="LUNORA_ORIGIN_URL",W=(s,t,e,i=j(s)?"durable_objects.bindings declares the SchedulerDO":void 0)=>{if(i===void 0||f(s.vars?.[d]))return;const n=t===void 0?"vars":`env.${t}.vars`,o=t===void 0?"":` --env ${t}`;e.push(`${i} 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}${o}\` (ignore this if it is already set as a secret or in the dashboard).`)};export{B as validateAssets,D as validateCache,P as validateCorsVariables,T as validateExports,C as validateLimits,k as validateLogpush,x as validateObservability,w as validatePlacement,W as validateSchedulerOrigin,I as validateSecretsRequired,N as validateSendEmail,U as validateTailConsumers,G as withTailConsumer};
1
+ import{i as u,a as f}from"./guards-Buu_E7mP.mjs";import{o as v}from"./validate-bindings-PVHSAU6M.mjs";const _=new Set(["1","enabled","on","true","yes"]),A=s=>typeof s=="string"&&_.has(s.trim().toLowerCase()),b=(s,t,e,i)=>{s!==void 0&&typeof s!="boolean"&&e.push(`${t} must be a boolean${i===void 0?"":` (${i})`}`)},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)`)},N=(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`)},k=(s,t)=>{b(s.logpush,"logpush",t,'set "logpush": true to enable Cloudflare Logpush')},I=(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"] })')},m=3e5,C=(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>m&&t.push(`limits.cpu_ms must be at most ${String(m)} (Cloudflare's per-invocation ceiling)`)}},p=new Set(["off","smart","targeted"]),w=(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"||!p.has(i))&&t.push(`placement.mode must be one of ${[...p].map(n=>`"${n}"`).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,i)=>{switch(s.kind){case"boolean":{b(t,e,i,s.hint);break}case"destinations":{t!==void 0&&(!Array.isArray(t)||t.some(n=>!f(n)))&&i.push(`${e} must be an array of destination names configured in the Cloudflare dashboard`);break}case"samplingRate":{O(t,e,i);break}}},g=(s,t,e,i,n)=>{for(const[o,a]of Object.entries(s)){const r=Object.hasOwn(t,o)?t[o]:void 0,l=`${e}.${o}`;r===void 0?n.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,i):u(a)?g(a,r.level,l,i,n):a!==void 0&&i.push(`${l} must be an object`)}},x=(s,t,e)=>{const{observability:i}=s;if(i!==void 0){if(!u(i)){t.push('observability must be an object (e.g. { "enabled": true, "head_sampling_rate": 1 })');return}g(i,L,"observability",t,e)}},D=(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)}},T=(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`))}}},B=(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`)},G=(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]}},P=(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(r=>r.trim()==="*"),a=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')},j=s=>v(s.durable_objects?.bindings).some(t=>t.class_name==="SchedulerDO"&&t.script_name===void 0),d="LUNORA_ORIGIN_URL",W=(s,t,e,i=j(s)?"durable_objects.bindings declares the SchedulerDO":void 0)=>{if(i===void 0||f(s.vars?.[d]))return;const n=t===void 0?"vars":`env.${t}.vars`,o=t===void 0?"":` --env ${t}`;e.push(`${i} 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}${o}\` (ignore this if it is already set as a secret or in the dashboard).`)};export{B as validateAssets,D as validateCache,P as validateCorsVariables,T as validateExports,C as validateLimits,k as validateLogpush,x as validateObservability,w as validatePlacement,W as validateSchedulerOrigin,I as validateSecretsRequired,N as validateSendEmail,U as validateTailConsumers,G as withTailConsumer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/config",
3
- "version": "1.0.0-alpha.374",
3
+ "version": "1.0.0-alpha.375",
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",
@@ -61,7 +61,7 @@
61
61
  "@lunora/codegen": "1.0.0-alpha.326",
62
62
  "@lunora/container": "1.0.0-alpha.82",
63
63
  "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
64
- "@lunora/seed": "1.0.0-alpha.236",
64
+ "@lunora/seed": "1.0.0-alpha.237",
65
65
  "@visulima/colorize": "2.1.1",
66
66
  "@visulima/find-ai-runner": "1.0.2",
67
67
  "@visulima/fs": "6.0.29",
@@ -73,9 +73,21 @@
73
73
  "ts-morph": "^28.0.0"
74
74
  },
75
75
  "peerDependencies": {
76
+ "@electric-sql/pglite": "^0.5.8",
77
+ "@electric-sql/pglite-pgvector": "^0.0.9",
78
+ "@electric-sql/pglite-socket": "^0.2.11",
76
79
  "@lunora/studio": ">=1.0.0-alpha.50 <2.0.0-0"
77
80
  },
78
81
  "peerDependenciesMeta": {
82
+ "@electric-sql/pglite": {
83
+ "optional": true
84
+ },
85
+ "@electric-sql/pglite-pgvector": {
86
+ "optional": true
87
+ },
88
+ "@electric-sql/pglite-socket": {
89
+ "optional": true
90
+ },
79
91
  "@lunora/studio": {
80
92
  "optional": true
81
93
  }
@@ -1 +0,0 @@
1
- import{applyModify as m}from"./applyModify-DKP2l6S9.mjs";import{hasCloudflareCredentials as y}from"./hasCloudflareCredentials-byvHpEiD.mjs";import{withheldWorkersAi as E,writeDevConfig as R,noopCleanup as S}from"./describeWithheldWorkersAi-IIxe3TuI.mjs";import{r as j}from"./lunora-manifest-DuH_Cmyu.mjs";import{o as w}from"./reconcile-services-DFqH4eMQ.mjs";import{findWranglerFile as _,readWranglerJsonc as C}from"./WRANGLER_FILES-UNW-xY5u.mjs";const h={ai:{label:"AI",shape:"object"},ai_search:{label:"AI Search",shape:"array"},ai_search_namespaces:{label:"AI Search namespace",shape:"array"},analytics:{label:"Analytics SQL",shape:"object"},d1_databases:{label:"D1",shape:"array"},kv_namespaces:{label:"KV",shape:"array"},queues:{label:"Queue",shape:"producers"},r2_buckets:{label:"R2",shape:"array"},services:{label:"Service",shape:"array"},vectorize:{label:"Vectorize",shape:"array"}},I=Object.keys(h),b=(e,r)=>typeof e.binding=="string"?e.binding:r,f=(e,r,t,n)=>{const i=[];for(const[s,a]of r.entries())a!=null&&i.push({binding:b(a,`#${String(s)}`),kind:t,path:[...n,s],section:e});return i},g=(e,r)=>h[e].shape===r,A=(e,r)=>{const{label:t}=h[e];if(g(e,"array"))return f(e,r[e]??[],t,[]);if(g(e,"object")){const n=r[e];return n==null?[]:[{binding:b(n,e),kind:t,path:[],section:e}]}return f(e,r.queues?.producers??[],t,["producers"])},B=e=>I.flatMap(r=>A(r,e)),L=(e,r)=>{let t=e;for(const n of r)t=m(t,[n.section,...n.path,"remote"],!0);return t},D=e=>{const r=o=>({cleanup:S,reason:o,remoteBindings:[],withheld:[]}),t=_(e.projectRoot);if(!t)return r("wrangler.jsonc not found");const{parsed:n,text:i}=C(t);if(n===void 0)return r(`failed to parse ${t} as JSONC`);const s=w(j(e.projectRoot)),a=e.remote?B(n).filter(o=>o.section!=="services"||!s.has(o.binding)):[],c=E(n.ai,e.hasCredentials??(()=>y({projectRoot:e.projectRoot}))),d=c===void 0?[]:[c],l=c===void 0?a:a.filter(o=>o.section!=="ai");if(l.length===0&&d.length===0)return r(e.remote?"no remote-eligible bindings to proxy":void 0);const p=d.length>0?m(i,["ai"],void 0):i,v=l.length>0?L(p,l):p,u=R(e.projectRoot,"dev",v);return{cleanup:u.cleanup,configPath:u.configPath,remoteBindings:l,withheld:d}},k=e=>{if(e===void 0)return!1;const r=e.trim().toLowerCase();return r==="1"||r==="true"},K=e=>e.flag===!0||k(e.envValue)?!0:e.configPreference??!1;export{h as REMOTE_ELIGIBLE_KEYS,L as injectRemoteFlags,k as isRemoteEnvEnabled,D as materializeDevWranglerConfig,B as planRemoteBindings,K as resolveRemoteEnabled};
@@ -1,2 +0,0 @@
1
- import{readFileSync as X,writeFileSync as z}from"node:fs";import{createRequire as Z}from"node:module";import{join as Q}from"node:path";import{containerBuildTag as ee}from"@lunora/container";import{readJsonSync as ne}from"@visulima/fs";import{applyModify as S}from"./applyModify-DKP2l6S9.mjs";import{a as se,r as K}from"./lunora-manifest-DuH_Cmyu.mjs";import{parseTree as te,findNodeAtLocation as oe}from"jsonc-parser";import{r as ie,a as re,b as ae,c as de}from"./reconcile-services-DFqH4eMQ.mjs";import{a as ce,s as le}from"./infer-bindings-C1NFOdMi.mjs";import{DEV_VARS_FILE as ue,parseDevVariableEntries as ge}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{requiredSecrets as me}from"./buildPackageSecretsBlock-BWV_VxqV.mjs";import{w as pe,m as fe,s as Y,o as B,n as C,p as be}from"./validate-bindings-CvNBF3U4.mjs";import{s as he}from"./worker-entry-checks-AIASCYl7.mjs";import{DEFAULT_OBSERVABILITY as we}from"./DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import{findWranglerFile as ve,readWranglerJsonc as _e}from"./WRANGLER_FILES-UNW-xY5u.mjs";const ye=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxConcurrency","max_concurrency"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],R=e=>Object.fromEntries(ye.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),P="queueTuning",Se=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,xe=/^[\t ]*,/u,Ne=(e,n)=>{const s=te(e),t=s===void 0?void 0:oe(s,[...n])?.parent;if(t?.type==="property"){const o=t.offset+t.length,i=e.lastIndexOf(`
2
- `,t.offset-1)+1,r=Se.exec(e.slice(o));if(r!==null&&e.slice(i,t.offset).trim()===""){const d=t.parent?.children??[],m=d.indexOf(t),c=m===d.length-1&&m>0?d[m-1]:void 0,l=c===void 0?void 0:xe.exec(e.slice(c.offset+c.length))??void 0;return(l===void 0||c===void 0?e.slice(0,i):e.slice(0,c.offset+c.length)+e.slice(c.offset+c.length+l[0].length,i))+e.slice(o+r[0].length)}}return S(e,n,void 0)},G=(e,n,s,t,o,i=new Set)=>{const r=s.join("."),d={},m=[],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 b=Object.fromEntries(Object.entries(R(g)).filter(([f])=>!i.has(f))),h=Object.entries(o[u.queue]??{}).filter(([f])=>!Object.hasOwn(b,f)),v=Object.entries(b).filter(([f,_])=>u[f]!==_),x=h.filter(([f,_])=>u[f]===_).map(([f])=>f),E=Object.fromEntries(Object.entries({...u,...b}).filter(([f])=>!x.includes(f)));for(const[f,_]of v)l=S(l,[...s,w,f],_);for(const f of x)l=Ne(l,[...s,w,f]);for(const[f,_]of h){const O=u[f];O!==void 0&&O!==_&&c.push(`${r}/${u.queue}: ${f} is no longer declared by defineQueue, but it was changed by hand to ${JSON.stringify(O)} from the declared ${JSON.stringify(_)}, so it was kept. Delete it from wrangler.jsonc if it should go.`)}return(v.length>0||x.length>0)&&m.push(`${r}/${u.queue} (${[...v.map(([f])=>f),...x.map(f=>`removed ${f}`)].join(", ")})`),Object.keys(b).length>0&&(d[u.queue]=b),E}),owned:d,text:l,updated:m,warnings:c}},Oe=(e,n,s,t)=>{const o=n.queues??{},i=o.producers??[],r=o.consumers??[],d=new Set(i.map(g=>g?.binding)),m=new Set(r.map(g=>g.queue)),c=s.filter(g=>!d.has(g.bindingName)),l=s.filter(g=>!m.has(g.name)),p=G(e,r,["queues","consumers"],g=>s.find(b=>b.name===g.queue),t);let u=p.text;const w={...p.owned};if(c.length>0||l.length>0){const g=[...i,...c.map(h=>({binding:h.bindingName,queue:h.name}))],b=[...p.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:b,producers:g})}return{added:[...c.map(g=>`queues.producers/${g.bindingName}`),...l.map(g=>`queues.consumers/${g.name}`)],owned:w,text:u,updated:p.updated,warnings:p.warnings}},Ee=(e,n,s,t,o)=>{const i=n.env?.[t],r=i?.queues?.consumers??[],d=i?.queues?.producers??[],m=u=>{const w=d.find(g=>g?.queue===u.queue)?.binding;return w!==void 0?s.find(g=>g.bindingName===w):s.find(g=>g.name===u.queue&&!d.some(b=>b?.binding===g.bindingName))},c=G(e,r,["env",t,"queues","consumers"],m,o,new Set(["dead_letter_queue"])),l=r.filter(u=>u.queue!==void 0&&m(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.`),p=r.flatMap(u=>{const w=m(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,...p,...l]}},ke=(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=o=>typeof o=="object"&&o!==null&&!Array.isArray(o);return s===void 0?{}:!t(s)||!Object.values(s).every(o=>t(o)&&Object.values(o).every(i=>t(i)))?(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},$e=(e,n,s)=>{const t=Object.fromEntries(Object.entries({...n,...s}).filter(([,o])=>Object.keys(o).length>0));se(e,P,Object.keys(t).length===0?void 0:t)},j="PIPELINES",I="ARTIFACTS",Ae=(e,n)=>{const s=e.flagshipBinding!==void 0&&!(n?.flagship??[]).some(d=>d.binding===e.flagshipBinding),t=e.usesPipelines&&!(n?.pipelines??[]).some(d=>d.binding===j),o=e.usesArtifacts?n?.artifacts??[]:[],i=o.some(d=>d.binding===I)?[]:o.flatMap(d=>d.binding===void 0?[]:[d.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&&o.length===0,ce(e.jurisdiction)],[i.length>0,`ctx.artifacts is used and ${i.map(d=>`"${d}"`).join(", ")} ${i.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(([d])=>d).map(([,d])=>d)},qe=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.`),Ce=(e,n)=>{const s=new Set([...e.workflows,...e.agents].map(i=>i.className));if(s.size===0)return[];const t=Object.entries(n.exports??{}).flatMap(([i,r])=>r?.type==="workflow"?[i]:[]),o=(n.workflows??[]).flatMap(i=>i.class_name===void 0||i.script_name!==void 0?[]:[i.class_name]);return[...new Set([...t,...o])].filter(i=>!s.has(i)).map(i=>`wrangler.jsonc declares workflow "${i}" 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.`)},je=(e,n)=>{if(e.queues.length===0)return[];const s=new Set(e.queues.map(o=>o.name)),t=new Set(e.queues.map(o=>o.bindingName));return[...(n.queues?.consumers??[]).flatMap(o=>{const{queue:i}=o;return i===void 0||s.has(i)?[]:[`wrangler.jsonc subscribes queues.consumers[] to "${i}" 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(o=>{const i=o?.binding;return i===void 0||t.has(i)?[]:[`wrangler.jsonc declares queues.producers[] binding "${i}" but no defineQueue export declares it — a leftover from a rename. Remove it if it is not hand-wired.`]})]},Ie=(e,n)=>[...Ce(e,n),...je(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"}],De=()=>U.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),Te=e=>{let n;try{n=X(Q(e,ue),"utf8")}catch{return!1}const s=new Map(ge(n).map(t=>[t.key,t.value]));return U.some(({keys:t})=>t.every(o=>(s.get(o)??"")!==""))},Be=(e,n)=>{const s=n?.secrets?.required;if(!Array.isArray(s))return[];const t=new Set(s),o=me(le(e)).map(i=>i.key).filter(i=>!t.has(i));return o.length===0?[]:[`wrangler.jsonc declares secrets.required without ${o.join(", ")}, which this app needs — wrangler dev loads only the listed keys from .dev.vars, so add ${o.length===1?"it":"them"} to secrets.required.`]},T=(e,n,s)=>{const t=new Set(e.durableObjects.map(d=>d.className)),o=[],i=(s?.r2_buckets?.length??0)>0,r=(s?.d1_databases?.some(d=>d.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!i&&o.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")&&!r&&o.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")&&o.push("@lunora/scheduler is used but the worker entry exports no SchedulerDO; export it so the SCHEDULER binding can be provisioned."),o.push(...D("container","containers",e.containers),...D("workflow","workflows",e.workflows),...D("agent","agents",e.agents)),e.containers.length>0&&s?.observability?.enabled===!1&&o.push("containers are declared but observability is explicitly disabled in wrangler.jsonc — container logs will not be captured."),e.usesPayments&&!Te(n)&&o.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${De()}.`),o.push(...qe(e),...Ae(e,s),...Be(e,s)),s!==void 0&&o.push(...Ie(e,s)),o},H="<replace-with-d1-create-id>",Re=e=>[["container","containers",e.containers],["workflow","workflows",e.workflows],["agent","agents",e.agents]].flatMap(([s,t,o])=>o.filter(i=>!i.exported).map(({className:i,exportName:r})=>({className:i,exportName:r,kind:s,module:t}))),Pe=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)}`},Le=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:o}of B(s.renamed_classes))t!==void 0&&n.delete(t),o!==void 0&&n.add(o);for(const t of[...C(s.new_classes),...C(s.new_sqlite_classes)])n.add(t)}return n},Me=(e,n,s)=>{const t=n.durable_objects?.bindings??[],o=new Set(t.map(l=>l.name)),i=s.filter(l=>!o.has(l.binding));let r=e;const d=[];if(i.length>0){const l=[...t,...i.map(p=>({class_name:p.className,name:p.binding}))];r=S(r,["durable_objects","bindings"],l),d.push(...i.map(p=>`${p.binding}/${p.className}`))}const m=n.migrations??[],c=s.map(l=>l.className).filter(l=>!Le(m).has(l));if(c.length>0){const l=[...m,{new_sqlite_classes:c,tag:Pe(m)}];r=S(r,["migrations"],l)}return{added:d,text:r}},We=(e,n)=>{const s=n.d1_databases??[];if(s.some(i=>i.binding==="DB"))return{added:[],text:e};const t=typeof n.name=="string"&&n.name.length>0?n.name:"lunora",o=[...s,{binding:"DB",database_id:H,database_name:t}];return{added:["DB (D1)"],text:S(e,["d1_databases"],o)}},Ke={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:o}=Ke[s],i=n[s]?.binding;return typeof i=="string"&&i.length>0?{added:[],text:e}:{added:[o],text:S(e,[s],{binding:t})}},Fe=(e,n)=>e.usesAnalyticsSql&&he(n,new Set(["analyticsSql"]))?.chained.has("analyticsSql")!==!0,Qe=new Set(["ratelimits","send_email"]),Ye=["durable_objects","logfwdr","unsafe"],Ge=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,Ue=(e,n,s)=>{if(Ge.has(e))return M(n)&&Object.hasOwn(n,s);const t=Qe.has(e)?"name":"binding";return Array.isArray(n)?n.some(o=>L(o,t,s)):L(n,"binding",s)},He=(e,n)=>{const s=e,t=Object.entries(s).find(([i,r])=>i!=="env"&&Ue(i,r,n));if(t!==void 0)return t[0];for(const i of Ye){const r=s[i];if(M(r)&&Array.isArray(r.bindings)&&r.bindings.some(d=>L(d,"name",n)))return`${i}.bindings`}if(e.queues?.producers?.some(i=>i?.binding===n)===!0)return"queues.producers";const o=e.secrets?.required;if(Array.isArray(o)&&o.includes(n))return"secrets.required"},F=(e,n,s,t,o)=>{if((n[s]?.length??0)>0)return{added:[],text:e};const i=He(n,t.binding);return i!==void 0?{added:[],text:e,warnings:[`${s}: not adding ${JSON.stringify(t)} — the name "${t.binding}" is already bound by \`${i}\` in wrangler.jsonc. Add a ${s} entry under another binding name and point the matching \`defineApp()\` override at it.`]}:{added:[o],text:S(e,[s],[t])}},Je=(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"}])}},Ve=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},Xe=e=>{const{image:n}=e;return n.kind==="dockerfile"?n.dockerfilePath:n.kind==="registry"?n.reference:ee(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}}},ze=e=>{if(e.schedulingPolicy==="durable_object")return J(e);const{image:n}=e,s={class_name:e.className,image:Xe(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=Ve(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},Ze=(e,n,s)=>{const t=n.containers??[],o=new Set(t.map(c=>c.class_name)),i=s.filter(c=>!o.has(c.className));let r=i.length===0?e:S(e,["containers"],[...t,...i.map(c=>ze(c))]);const d=[],m=[];for(const[c,l]of t.entries()){const p=s.find(g=>g.className===l.class_name);if(p===void 0)continue;const u=p.schedulingPolicy??"default";if((l.scheduling_policy??"default")!==u){m.push(`containers/${p.className} has scheduling_policy "${l.scheduling_policy??"default"}" in wrangler.jsonc but defineContainer "${p.exportName}" declares "${u}" — the policy is immutable, so replace the entry (and its container application) by hand.`);continue}const w=p.schedulingPolicy==="durable_object"?J(p).images:void 0;w!==void 0&&JSON.stringify(l.images)!==JSON.stringify(w)&&(r=S(r,["containers",c,"images"],w),d.push(`containers/${p.className}.images`))}return{added:i.map(c=>`containers/${c.className}`),text:r,updated:d,warnings:m}},en=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=S(e,["observability"],{...we});return{added:["observability"],text:s}},nn=(e,n)=>n.upload_source_maps!==void 0?{added:[],text:e}:{added:["upload_source_maps"],text:S(e,["upload_source_maps"],!0)},V=[{minimum:[4,142],name:"wrangler"},{minimum:[1,61],name:"@cloudflare/vite-plugin"}],sn=V.map(({minimum:e,name:n})=>`${n}@^${e.join(".")}.0`).join(" "),tn=(e,n)=>{try{const s=Z(Q(e,"package.json")).resolve(`${n}/package.json`),[t=0,o=0]=String(ne(s).version).split(".").map(Number);return[t,o]}catch{return}},on=e=>{const n=V.flatMap(({minimum:s,name:t})=>{const o=tn(e,t);return o!==void 0&&(o[0]<s[0]||o[0]===s[0]&&o[1]<s[1])?[`${t} ${o.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 ${sn}\`) and re-run.`},rn=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.`]:[]),an=(e,n,s)=>{let t=e;const o=[],i=[];for(const r of s){const d=n[r.className];if(d?.type==="workflow")for(const{of:m,path:c}of be){const l=m(r),p=Y(d,c),u=`exports/${r.className}.${c.join(".")}`;if(l===void 0){p!==void 0&&i.push(`${u} is set in wrangler.jsonc but defineWorkflow "${r.exportName}" does not declare it — reconcile leaves it in place. Remove it by hand if it was dropped from the definition.`);continue}JSON.stringify(p)!==JSON.stringify(l)&&(t=S(t,["exports",r.className,...c],l),o.push(u))}}return{text:t,updated:o,warnings:i}},dn=(e,n,s,t,o)=>{if(o!==void 0)return{added:[],text:e,warnings:[o]};const i=[...s.map(b=>({settings:pe(b),workflow:b})),...t.map(b=>({settings:{},workflow:b}))],r=new Set(i.map(({workflow:b})=>b.className)),d=n.workflows??[],m=d.filter(b=>b.script_name===void 0&&b.class_name!==void 0&&r.has(b.class_name)),c=n.exports??{},l=[],p=[],u=[];let w=e;for(const{settings:b,workflow:h}of i){if(c[h.className]!==void 0&&c[h.className]!==null)continue;const v=m.find(f=>f.class_name===h.className),x=Object.fromEntries(fe.flatMap(f=>{const _=Y(v,[f]);return _===void 0?[]:[[f,_]]})),E=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,...b,name:E}),(v===void 0?l:p).push(`exports/${h.className}`)}if(m.length>0){const b=d.filter(h=>!m.includes(h));w=S(w,["workflows"],b.length===0?void 0:b),p.push(...m.map(h=>`workflows/${String(h.class_name)} → exports`))}u.push(...rn(n));const g=an(w,c,s);return{added:l,text:g.text,updated:[...p,...g.updated],warnings:[...u,...g.warnings]}},On=(e,n,{environment:s,target:t}={})=>{const o=ve(e),i=Re(n);if(!o)return{added:[],changed:!1,exportGaps:i,reason:"wrangler.jsonc not found",updated:[],warnings:T(n,e)};const{parsed:r,text:d}=_e(o);if(r===void 0)return{added:[],changed:!1,exportGaps:i,reason:`failed to parse ${o} as JSONC`,updated:[],warnings:T(n,e),wranglerPath:o};const m=T(n,e,r);if(s!==void 0){const a=r.env?.[s]!==void 0;m.push(a?`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 c=n.containers.filter(a=>a.exported),l=n.agents.filter(a=>a.exported&&a.voice===!0&&a.voiceBindingName!==void 0&&a.voiceClassName!==void 0),p=[...n.durableObjects,...c.map(a=>({binding:a.bindingName,className:a.className})),...l.map(a=>({binding:a.voiceBindingName,className:a.voiceClassName}))],u=n.workflows.filter(a=>a.exported),w=n.agents.filter(a=>a.exported),g=K(e),b=ke(g,m),h={},v=ie(g);let x;const E=[{enabled:!0,run:a=>Me(a,r,p)},{enabled:n.needsD1,run:a=>We(a,r)},{enabled:n.usesAi,run:a=>$(a,r,"ai")},{enabled:n.usesAiSearch,run:a=>F(a,r,"ai_search_namespaces",{binding:"AI_SEARCH",namespace:"default"},"AI_SEARCH (AI Search namespace)")},{enabled:Fe(n,e),run:a=>$(a,r,"analytics")},{enabled:n.usesBrowser,run:a=>$(a,r,"browser")},{enabled:n.usesImages,run:a=>$(a,r,"images")},{enabled:n.usesAnalytics,run:a=>F(a,r,"analytics_engine_datasets",{binding:"ANALYTICS",dataset:"ANALYTICS"},"ANALYTICS (Analytics Engine)")},{enabled:n.usesWorkerLoader,run:a=>Je(a,r)},{enabled:!0,run:a=>en(a,r)},{enabled:t===void 0||t==="cloudflare",run:a=>nn(a,r)},{enabled:c.length>0,run:a=>Ze(a,r,c)},{enabled:u.length>0||w.length>0,run:a=>dn(a,r,u,w,on(e))},{enabled:n.queues.length>0,run:a=>{const y=Oe(a,r,n.queues,b.queues??{});return h.queues=y.owned,y}},{enabled:n.services!==void 0&&(n.services.length>0||Object.keys(v).length>0),run:a=>{const y=re(a,r,n.services??[],v);return x=y.owned,y}},...s===void 0||r.env?.[s]===void 0?[]:[{enabled:n.queues.length>0,run:a=>{const y=`env.${s}.queues`,k=Ee(a,r,n.queues,s,b[y]??{});return h[y]=k.owned,k}}]];let f=d;const _=[],O=[];for(const a of E){if(!a.enabled)continue;const y=a.run(f);f=y.text,_.push(...y.added),O.push(...y.updated??[]),m.push(...y.warnings??[])}const W=a=>{if(g===void 0)return;const y=x,k=[...Object.keys(h).length>0?[{consequence:"an option removed from defineQueue stays deployed",key:"queueTuning",label:"queue tuning",write:N=>{$e(N,b,h)}}]:[],...y===void 0?[]:[{consequence:"a service removed from lunora.config stays bound",key:"services",label:"service bindings",write:N=>{de(N,y)}}]];for(const N of k)try{N.write(K(e)??g)}catch(q){m.push(`${a?"wrangler.jsonc was updated, but ":""}recording the ${N.label} reconcile owns in ${g.path} (lunora.${N.key}) failed: ${q instanceof Error?q.message:String(q)}. Until it is recorded, ${N.consequence}.`)}};let A;if(n.services!==void 0){const a=ae(e,n.services,v);m.push(...a.warnings),x={...x,...a.owned},A=a.added.length>0||a.updated.length>0?{added:a.added,path:a.path,updated:a.updated}:void 0}return _.includes("DB (D1)")&&m.push(`wrote a DB binding with a placeholder database_id ("${H}") — run \`wrangler d1 create <name>\` and replace it before deploying.`),f===d?(W(!1),{added:_,changed:!1,devConfig:A,exportGaps:i,reason:"bindings already in sync",updated:O,warnings:m,wranglerPath:o}):(z(o,f,"utf8"),W(!0),{added:_,changed:!0,devConfig:A,exportGaps:i,updated:O,warnings:m,wranglerPath:o})};export{Re as collectExportGaps,On as reconcileWranglerBindings};
@@ -1 +0,0 @@
1
- import{rmSync as s,readdirSync as c,writeFileSync as l}from"node:fs";import{join as i}from"node:path";const u=/^\.wrangler\.lunora-(?:dev|service)\.(\d+)\.\d+\.jsonc$/;let t=0;const a=e=>(t+=1,`.wrangler.lunora-${e}.${String(process.pid)}.${String(t)}.jsonc`),d=e=>{try{return process.kill(e,0),!0}catch(r){return r.code==="EPERM"}},f=e=>{let r;try{r=c(e)}catch{return}for(const o of r){const n=u.exec(o);if(!(n===null||Number(n[1])===process.pid||d(Number(n[1]))))try{s(i(e,o),{force:!0})}catch{}}},h=()=>{},g=e=>{let r=!1;return()=>{if(!r){r=!0;try{s(e,{force:!0})}catch{}}}},A=(e,r,o)=>{f(e);const n=i(e,a(r));return l(n,o,"utf8"),{cleanup:g(n),configPath:n}},w=(e,r)=>{if(!(e==null||r()))return typeof e.binding=="string"?e.binding:"AI"},v=e=>`Workers AI is off in this dev session (${e} binding left out): no Cloudflare login found, and Workers AI only runs remotely. \`@cf/…\` models will throw; AI SDK models and \`LUNORA_AI_PROXY_URL\` slugs still work. Run \`wrangler login\` or set CLOUDFLARE_API_TOKEN to turn it on.`;export{u as STALE_DEV_CONFIG,g as createCleanup,v as describeWithheldWorkersAi,a as devConfigBasename,h as noopCleanup,f as sweepStaleDevConfigs,w as withheldWorkersAi,A as writeDevConfig};
@@ -1 +0,0 @@
1
- import{existsSync as P,statSync as j,readFileSync as F,readdirSync as B}from"node:fs";import{discoverFlags as L,FLAGS_FILENAME as k,discoverQueues as G,CAPABILITY_PROBES as N,readServiceBindings as W,discoverNotifyChannels as Y,NOTIFY_FILENAME as K,mayReadCapabilityContext as q,foldCapabilitySignals as C,capabilitiesUsedBy as M,sourceCapabilitySignals as U}from"@lunora/codegen";import{init as H}from"es-module-lexer";import{Project as X}from"ts-morph";import{discoverAgentInfo as Q}from"./discoverAgentInfo-pqFMJBtJ.mjs";import{discoverContainerInfo as V}from"./discoverContainerInfo-DzXr7Vm3.mjs";import{escapeRegExp as J}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{d as _}from"./discover-info-DC2MrAIM.mjs";import{relative as z,sep as Z,isAbsolute as ee,join as b}from"node:path";import{P as se}from"./package-secrets-registry-BeheNwsP.mjs";import{discoverSchemaInfo as te}from"./discoverSchemaInfo-BBRlXZop.mjs";import{resolveWorkerEntry as re,composedEntryDurableObjects as ne,GENERATED_DIRECTORY as I,DURABLE_OBJECT_BINDINGS as oe,detectExportedDurableObjects as ae,detectClassExports as x,isMergedProject as ie}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{discoverWorkflowInfo as ce}from"./discoverWorkflowInfo-zW7Tt0Tn.mjs";const de="https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/artifacts/namespaces",ue=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.`:`ctx.artifacts is used and the schema pins data to "${e}"; create the namespace in that jurisdiction BEFORE the first repo, with POST ${de} 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.`},le=(e,s)=>{const{error:r,value:t}=_(e,s,k,L);return r===void 0?{flags:t}:{error:r}},me=(e,s)=>{const r=z(s,e);return r!==""&&r!==".."&&!r.startsWith(`..${Z}`)&&!ee(r)},pe=(e,s)=>{const{error:r,value:t}=_(e,s,void 0,G);return r===void 0?{queues:t??[]}:{error:r,queues:[]}},he=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),fe=new Set([".git",".lunora-cache",".wrangler","dist",I,"node_modules"]),ge=["lunora","src"],be=/\benv\s*\.\s*DB\b/,ye=/\benv\s*\.\s*AI\b/,$=["ai","aiSearch","analytics","analyticsSql","artifacts","browser","hyperdrive","images","kv","mail","notify","payments","pipelines","r2sql","scheduler","storage","x402"],D=e=>`uses${e.charAt(0).toUpperCase()}${e.slice(1)}`,T=[["usesAuth","@lunora/auth"],["usesCimdWorkers","@lunora/auth/cimd/workers"],["usesX402Charge","@lunora/x402/charge"],["usesPaymentAutumn","@lunora/payment/autumn"],["usesPaymentCreem","@lunora/payment/creem"],["usesPaymentDodopayments","@lunora/payment/dodopayments"],["usesPaymentPolar","@lunora/payment/polar"],["usesPaymentStripe","@lunora/payment/stripe"]],O=[...$.map(e=>[D(e),N[e].moduleSpecifier]),...T].toSorted(([e],[s])=>e.localeCompare(s)),Se=[["usesNotifyFcm","@lunora/notify:fcm"],["usesNotifyWebPush","@lunora/notify:webPush"]],ve=["@lunora/agent","@lunora/agent/sandbox"],Ee=new RegExp(String.raw`["'\x60](?:${[...O.map(([,e])=>e),...ve].map(e=>J(e)).join("|")})["'\x60]`,"u"),a=e=>{const{contextProperty:s,moduleSpecifier:r}=N[e];return s===void 0?`${r} is imported`:`${r} is imported or ctx.${s} is read`},Ae="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",xe=()=>{let e;return()=>(e??=new X({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}),e)},Ie=(e,s,r)=>{const t=r(),n=t.createSourceFile(`/scan/${s.slice(s.lastIndexOf("/")+1)}`,e,{overwrite:!0}),o=U(n);return t.removeSourceFile(n),o},w=(e,s)=>{let r;try{r=B(e,{withFileTypes:!0})}catch{return}for(const t of r){if(t.isDirectory()){fe.has(t.name)||w(b(e,t.name),s);continue}const n=t.name.lastIndexOf(".");n!==-1&&he.has(t.name.slice(n))&&s.push(b(e,t.name))}},_e=(e,s,r)=>{const{info:t}=te(e,s,r);return{jurisdiction:t?.jurisdiction,needsD1:t?.hasD1GlobalTable??!1}},Re=(e,s,r)=>{const t=xe(),n=b(e,r),o=[],d=[];let u=!1,i=!1;for(const l of s){const p=b(e,l);if(!P(p)||!j(p).isDirectory())continue;const f=[];w(p,f);for(const m of f){const c=F(m,"utf8"),A=me(m,n);u||=ye.test(c),i||=be.test(c),(Ee.test(c)||A&&q(c))&&(A?o:d).push(Ie(c,m,t))}}const h=C(o),y=C([h,...d]),S=new Set([...y.valueImports,...y.dynamicImports]),v=M({contextReads:h.contextReads,valueImports:S});return{...Object.fromEntries([...$.map(l=>[D(l),v.has(l)]),...T.map(([l,p])=>[l,S.has(p)])]),needsD1:i,usesAi:v.has("ai")||u,usesBrowser:v.has("browser")||h.sandboxTools.usesSandboxBrowser,usesWorkerLoader:h.sandboxTools.usesSandboxLoader}},Ce=(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"\``)],Ne=(e,s,r)=>[[e.usesAi,`AI (${a("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: ${a("scheduler")}, but no SchedulerDO is exported by the worker entry`],[e.usesStorage,`hint: ${a("storage")}; add an r2_buckets binding (bucket binding names are user-defined)`],[e.usesMail,`hint: ${a("mail")}; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)`],[e.usesPayments,`hint: ${a("payments")}; set the provider secrets in .dev.vars — ${Ae}`],[e.usesBrowser,`browser (${a("browser")}, or a sandbox browserTool imported in lunora/) — self-describing { binding: BROWSER }`],[e.usesImages,`images (${a("images")}) — self-describing { binding: IMAGES }`],[e.usesAnalytics,`analytics_engine_datasets (${a("analytics")}) — self-describing { binding: ANALYTICS, dataset }`],[e.usesWorkerLoader,"worker_loaders (jsCodeTool imported in lunora/) — self-describing { binding: LOADER }"],[e.usesAiSearch,`ai_search_namespaces (${a("aiSearch")}) — self-describing { binding: AI_SEARCH, namespace: "default" }; remote-only, so \`lunora dev\` reaches the deployed AI Search service`],[e.usesAnalyticsSql,`analytics (${a("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: ${a("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: ${a("hyperdrive")}; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned`],[e.usesPipelines,`hint: ${a("pipelines")}; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, stream }) — the pipeline resource can't be auto-provisioned`],[e.usesArtifacts,`hint: ${ue(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: ${a("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=[],o=[])=>{const d=new Set(e.map(i=>i.className)),u=e.map(i=>`${i.binding}/${i.className} (exported by worker entry)`);return s.needsD1&&u.push("DB (.global() table declared)"),u.push(...Ce(t,n,o),...Ne(r,d,s)),u},Ke=async e=>{await H;const s=e.schemaDir??"lunora",r=e.scanDirs??ge,t=()=>Re(e.projectRoot,r,s),n=e.cache===void 0?t():e.cache.memo(`capabilities:${e.projectRoot}:${s}:${r.join(",")}`,t),o=re(e.projectRoot);let d;o.composed?d=ne(b(e.projectRoot,s,I)).map(R=>({binding:oe[R],className:R})):d=o.path===void 0?[]:ae(o.path);const u=_e(e.projectRoot,s,e.cache),i={...u,needsD1:n.needsD1||u.needsD1},h=x(o,V(e.projectRoot,s,e.cache).containers,"containers"),y=x(o,ce(e.projectRoot,s).workflows,"workflows"),S=x(o,Q(e.projectRoot,s).agents,"agents"),v=[...pe(e.projectRoot,s).queues],{flags:E}=le(e.projectRoot,s),l=_(e.projectRoot,s,K,Y),p=l.error===void 0?l.value:{hasFcm:!0,hasWebPush:!0},f=E?.provider==="flagship"&&E.mode==="binding"?E.bindingName:void 0,m=$e(d,i,n,h,y,S);!o.composed&&ie(b(e.projectRoot,s,I))&&!d.some(g=>g.className==="LunoraDO")&&m.push("hint: durableObjects.merge is set, but the worker entry exports no LunoraDO — export one built with mergeDurableObjects, or the classes stay separate"),f!==void 0&&m.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${f}", app_id }) — the app_id can't be auto-provisioned`);const c=W(e.projectRoot),A=c.error===void 0?c.services:void 0;return c.error!==void 0&&m.push(`hint: lunora.config \`services\` not reconciled — ${c.error}`),m.push(...c.services.map(g=>`${g.binding} → ${g.worker} (lunora.config services.${g.name})`)),{...n,agents:S,containers:h,durableObjects:d,flagshipBinding:f,...i.jurisdiction===void 0?{}:{jurisdiction:i.jurisdiction},needsD1:i.needsD1,queues:v,services:A,signals:m,usesFlags:E!==void 0,usesNotifyFcm:p?.hasFcm??!1,usesNotifyWebPush:p?.hasWebPush??!1,workflows:y}},qe=e=>[...O,...Se].filter(([s,r])=>e[s]&&se[r]!==void 0).map(([,s])=>s);export{ue as a,Ke as i,qe as s};
@@ -1 +0,0 @@
1
- import"./discoverAgentInfo-pqFMJBtJ.mjs";import{i as c,s as d}from"./infer-bindings-C1NFOdMi.mjs";import"./discoverContainerInfo-DzXr7Vm3.mjs";import"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import"./discover-info-DC2MrAIM.mjs";import"./package-secrets-registry-BeheNwsP.mjs";import"./discoverSchemaInfo-BBRlXZop.mjs";import"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import"./discoverWorkflowInfo-zW7Tt0Tn.mjs";export{c as inferLunoraBindings,d as secretSourcesFromBindings};
@@ -1 +0,0 @@
1
- import{isAbsolute as f,dirname as p,resolve as m}from"node:path";import{applyModify as l}from"./applyModify-DKP2l6S9.mjs";import{hasCloudflareCredentials as h}from"./hasCloudflareCredentials-byvHpEiD.mjs";import{withheldWorkersAi as u,writeDevConfig as v}from"./describeWithheldWorkersAi-IIxe3TuI.mjs";import{readWranglerJsonc as w}from"./WRANGLER_FILES-UNW-xY5u.mjs";const g=(t,r)=>{const{parsed:e,text:n}=w(t),o=e?.build,c=u(e?.ai,r.hasCredentials??(()=>h({projectRoot:r.projectRoot}))),d=typeof o?.command=="string"&&o.command!==""&&!(typeof o.cwd=="string"&&f(o.cwd));if(!d&&c===void 0)return{configPath:t};const s=p(t);let i=n;c!==void 0&&(i=l(i,["ai"],void 0)),d&&(i=l(i,["build","cwd"],m(s,typeof o.cwd=="string"?o.cwd:".")));const a=v(s,"service",i);return{cleanup:a.cleanup,configPath:a.configPath,withheld:c}},j=(t,r)=>{const e=t.map(o=>g(o,r)),n=e.flatMap(o=>o.cleanup===void 0?[]:[o.cleanup]);return{cleanup:()=>{for(const o of n)o()},configPaths:e.map(o=>o.configPath),withheld:e.flatMap(o=>o.withheld===void 0?[]:[o.withheld])}};export{j as materializeServiceDevConfigs};
@@ -1 +0,0 @@
1
- const c=["ai_search","ai_search_namespaces","analytics","artifacts","containers","d1_databases","durable_objects","k2","kv_namespaces","queues","r2_buckets","secrets","secrets_store_secrets","services","tail_consumers","vars","vectorize","workflows"],i=["assets","compatibility_date","compatibility_flags","exports","logpush","main","migrations","observability","placement"],m=(s,n)=>{if(n===void 0)return{merged:s,unverifiedKeys:[]};const t=s.env?.[n];if(t===void 0){const e=Object.keys(s.env??{}).toSorted((v,f)=>v.localeCompare(f)),l=e.length>0?` (declared: ${e.join(", ")}).`:" (no environments are declared).";return{error:`--env "${n}" names no environment declared in wrangler.jsonc's "env" block${l}`,merged:s,unverifiedKeys:[]}}const o={...s},r=Object.keys(t).filter(e=>e!=="env");for(const e of r)i.includes(e)&&(o[e]=t[e]);for(const e of c)o[e]=t[e];const a=new Set([...c,...i]),d=r.filter(e=>!a.has(e)).map(String);return{merged:o,unverifiedKeys:d}};export{c as NON_INHERITABLE_KEYS,m as mergeWranglerEnvironment};
@@ -1 +0,0 @@
1
- import{i as g}from"./infer-bindings-C1NFOdMi.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-DQTGPqcJ.mjs";import{reconcileWranglerBindings as p}from"./collectExportGaps-BPuhGH2J.mjs";import{reconcileWranglerCompatibilityDate as $}from"./reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{reconcileWranglerCrons as m,describePreservedCrons as w}from"./describePreservedCrons-C5KPuPy3.mjs";const j=async(i,t,a)=>{try{const n=await g({projectRoot:i.projectRoot,schemaDir:i.schemaDir}),e=p(i.projectRoot,n,{target:i.target}),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=$(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};