@lunora/config 1.0.0-alpha.310 → 1.0.0-alpha.311

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 (45) hide show
  1. package/dist/cloudflare/index.d.mts +2 -1
  2. package/dist/cloudflare/index.d.ts +2 -1
  3. package/dist/cloudflare/index.mjs +1 -1
  4. package/dist/index.d.mts +17 -10
  5. package/dist/index.d.ts +17 -10
  6. package/dist/index.mjs +1 -1
  7. package/dist/packem_shared/COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs +1 -0
  8. package/dist/packem_shared/LUNORA_EVENT_SOURCE-B9ZVohjO.mjs +1 -0
  9. package/dist/packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs +19 -0
  10. package/dist/packem_shared/{POLICY_SCAFFOLD_ENDPOINT-0QiGKazX.mjs → POLICY_SCAFFOLD_ENDPOINT-B8xEUSap.mjs} +1 -1
  11. package/dist/packem_shared/{REMOTE_ELIGIBLE_KEYS-DioKi8jL.mjs → REMOTE_ELIGIBLE_KEYS-DPv7P69m.mjs} +1 -1
  12. package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-CFpBYYW4.mjs +1 -0
  13. package/dist/packem_shared/{STUDIO_PATH-CX_2bua3.mjs → STUDIO_PATH-CysOklfX.mjs} +1 -1
  14. package/dist/packem_shared/UNEXPORTED_CLASS_MARKER-3PuHuOjQ.mjs +1 -0
  15. package/dist/packem_shared/{assertWranglerSatisfiesSchema-BBQ2zkZy.mjs → assertWranglerSatisfiesSchema-6KWXocBC.mjs} +1 -1
  16. package/dist/packem_shared/{classifyPolicyEdit-D8NwrHxR.mjs → classifyPolicyEdit-DJi9Fk8G.mjs} +1 -1
  17. package/dist/packem_shared/collectExportGaps-BVgzeBX5.mjs +2 -0
  18. package/dist/packem_shared/{describePreservedCrons-7gaDLxWx.mjs → describePreservedCrons-C5KPuPy3.mjs} +1 -1
  19. package/dist/packem_shared/detectFramework-Dfpvu6rD.mjs +1 -0
  20. package/dist/packem_shared/infer-bindings-B626aaRY.mjs +1 -0
  21. package/dist/packem_shared/{infer-bindings.d-BH0tk-TR.d.mts → infer-bindings.d-Bu9-5J2O.d.mts} +31 -1
  22. package/dist/packem_shared/{infer-bindings.d-BH0tk-TR.d.ts → infer-bindings.d-Bu9-5J2O.d.ts} +31 -1
  23. package/dist/packem_shared/{inferLunoraBindings-CzvNvl9y.mjs → inferLunoraBindings-DfyuJ0Rt.mjs} +1 -1
  24. package/dist/packem_shared/lunora-manifest-DuH_Cmyu.mjs +6 -0
  25. package/dist/packem_shared/{materializeServiceDevConfigs-VcqRp-kv.mjs → materializeServiceDevConfigs-Dot5AUtE.mjs} +1 -1
  26. package/dist/packem_shared/readProjectDependencies-l3uhUKjo.mjs +1 -0
  27. package/dist/packem_shared/{reconcile-services-3dn35zgy.mjs → reconcile-services-BwMkaWAq.mjs} +1 -1
  28. package/dist/packem_shared/{reconcileBindingsSafely-BRyb_65W.mjs → reconcileBindingsSafely-8AEn4qY2.mjs} +1 -1
  29. package/dist/packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs +1 -0
  30. package/dist/packem_shared/{validate-bindings-DFAcr5wA.mjs → validate-bindings-DKlB-1sF.mjs} +1 -1
  31. package/dist/packem_shared/{withTailConsumer-BZqzeKYh.mjs → withTailConsumer-CV75ggJW.mjs} +1 -1
  32. package/dist/packem_shared/worker-entry-checks-AIASCYl7.mjs +1 -0
  33. package/dist/studio-host/index.mjs +1 -1
  34. package/package.json +3 -2
  35. package/dist/packem_shared/COMPOSED_WORKER_ENTRY-C69wqbSP.mjs +0 -1
  36. package/dist/packem_shared/LUNORA_EVENT_SOURCE-DYdcDU9G.mjs +0 -1
  37. package/dist/packem_shared/LUNORA_IGNORED_PATHS-B0-PPvRp.mjs +0 -19
  38. package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-Bv07Q3v8.mjs +0 -1
  39. package/dist/packem_shared/UNEXPORTED_CLASS_MARKER-s6wTR8W1.mjs +0 -1
  40. package/dist/packem_shared/collectExportGaps-qqrrR5x_.mjs +0 -2
  41. package/dist/packem_shared/detectFramework-CUiVEHDQ.mjs +0 -1
  42. package/dist/packem_shared/infer-bindings-B-BFynp2.mjs +0 -1
  43. package/dist/packem_shared/lunora-manifest-v90ZUbVp.mjs +0 -6
  44. package/dist/packem_shared/runPostCodegenHook-B0T1q2YI.mjs +0 -1
  45. package/dist/packem_shared/worker-entry-checks-9Vdz4d2f.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-BH0tk-TR.mjs";
1
+ import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-Bu9-5J2O.mjs";
2
2
  import { WranglerVariableIR } from '@lunora/codegen';
3
3
  /** Apply one structural jsonc edit and return the rewritten text (a no-op edit returns the input). */
4
4
  declare const applyModify: (text: string, path: ReadonlyArray<number | string>, value: unknown) => string;
@@ -888,6 +888,7 @@ interface WranglerQueueConsumer {
888
888
  type?: string;
889
889
  }
890
890
  interface WranglerConfig {
891
+ account_id?: unknown;
891
892
  ai?: {
892
893
  binding?: unknown;
893
894
  } | null;
@@ -1,4 +1,4 @@
1
- import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-BH0tk-TR.js";
1
+ import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-Bu9-5J2O.js";
2
2
  import { WranglerVariableIR } from '@lunora/codegen';
3
3
  /** Apply one structural jsonc edit and return the rewritten text (a no-op edit returns the input). */
4
4
  declare const applyModify: (text: string, path: ReadonlyArray<number | string>, value: unknown) => string;
@@ -888,6 +888,7 @@ interface WranglerQueueConsumer {
888
888
  type?: string;
889
889
  }
890
890
  interface WranglerConfig {
891
+ account_id?: unknown;
891
892
  ai?: {
892
893
  binding?: unknown;
893
894
  } | null;
@@ -1 +1 @@
1
- import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{assertWranglerSatisfiesSchema as l}from"../packem_shared/assertWranglerSatisfiesSchema-BBQ2zkZy.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 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-Ci3VIqnk.mjs";import{default as C}from"../packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs";import{collectExportGaps as _,reconcileWranglerBindings as x}from"../packem_shared/collectExportGaps-qqrrR5x_.mjs";import{reconcileWranglerCompatibilityDate as d}from"../packem_shared/reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{describePreservedCrons as A,reconcileWranglerCrons as S}from"../packem_shared/describePreservedCrons-7gaDLxWx.mjs";import{reconcileBindingsSafely as O,reconcileWranglerExtras as T}from"../packem_shared/reconcileBindingsSafely-BRyb_65W.mjs";import{REMOTE_ELIGIBLE_KEYS as F,injectRemoteFlags as N,isRemoteEnvEnabled as v,materializeRemoteWranglerConfig as B,planRemoteBindings as b,resolveRemoteEnabled as G}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-DioKi8jL.mjs";import{materializeServiceDevConfigs as u}from"../packem_shared/materializeServiceDevConfigs-VcqRp-kv.mjs";import{default as V}from"../packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DV5E_f_q.mjs";import{withTailConsumer as P}from"../packem_shared/withTailConsumer-BZqzeKYh.mjs";import{WORKERS_CACHE_MIN_DATE as Y,isCacheEnabled as w}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{DEFAULT_OBSERVABILITY as K,resolveObservabilitySampling as j}from"../packem_shared/DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import{mergeWranglerEnvironment as Q}from"../packem_shared/mergeWranglerEnvironment-DXiB-HcS.mjs";import{WRANGLER_FILES as X,findWranglerFile as k,readWranglerJsonc as q}from"../packem_shared/WRANGLER_FILES-UNW-xY5u.mjs";import{UNEXPORTED_CLASS_MARKER as $,validateWranglerProject as ee}from"../packem_shared/UNEXPORTED_CLASS_MARKER-s6wTR8W1.mjs";import{collectWranglerSecretVariables as oe,scanWranglerVariablesForSecrets as ae}from"../packem_shared/collectWranglerSecretVariables-D-usPfT8.mjs";import{wranglerToAlchemy as te}from"../packem_shared/wranglerToAlchemy-CBO2ucRm.mjs";import{REQUIRED_COMPATIBILITY_DATE as ie,REQUIRED_FLAG as fe,validateWrangler as me,validateWranglerConfig as Ee}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-Bv07Q3v8.mjs";export{n as BINDING_MANIFEST_VERSION,m as CLOUDFLARE_CLI_CONFIG_WARNING_ENV,c as CLOUDFLARE_DRIVER,V as CLOUDFLARE_TOOLCHAIN_VERSIONS,K as DEFAULT_OBSERVABILITY,C as GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG,F as REMOTE_ELIGIBLE_KEYS,ie as REQUIRED_COMPATIBILITY_DATE,fe as REQUIRED_FLAG,$ as UNEXPORTED_CLASS_MARKER,Y as WORKERS_CACHE_MIN_DATE,X as WRANGLER_FILES,o as applyModify,l as assertWranglerSatisfiesSchema,i as buildBindingManifest,_ as collectExportGaps,oe as collectWranglerSecretVariables,A as describePreservedCrons,E as detectCloudflareCliConfig,k as findWranglerFile,N as injectRemoteFlags,w as isCacheEnabled,v as isRemoteEnvEnabled,B as materializeRemoteWranglerConfig,u as materializeServiceDevConfigs,Q as mergeWranglerEnvironment,b as planRemoteBindings,q as readWranglerJsonc,O as reconcileBindingsSafely,x as reconcileWranglerBindings,d as reconcileWranglerCompatibilityDate,S as reconcileWranglerCrons,T as reconcileWranglerExtras,j as resolveObservabilitySampling,G as resolveRemoteEnabled,ae as scanWranglerVariablesForSecrets,me as validateWrangler,Ee as validateWranglerConfig,ee as validateWranglerProject,s as warnCloudflareCliConfigOnce,P as withTailConsumer,te as wranglerToAlchemy};
1
+ import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{assertWranglerSatisfiesSchema as l}from"../packem_shared/assertWranglerSatisfiesSchema-6KWXocBC.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 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-Ci3VIqnk.mjs";import{default as C}from"../packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs";import{collectExportGaps as _,reconcileWranglerBindings as x}from"../packem_shared/collectExportGaps-BVgzeBX5.mjs";import{reconcileWranglerCompatibilityDate as d}from"../packem_shared/reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{describePreservedCrons as A,reconcileWranglerCrons as S}from"../packem_shared/describePreservedCrons-C5KPuPy3.mjs";import{reconcileBindingsSafely as O,reconcileWranglerExtras as T}from"../packem_shared/reconcileBindingsSafely-8AEn4qY2.mjs";import{REMOTE_ELIGIBLE_KEYS as F,injectRemoteFlags as N,isRemoteEnvEnabled as v,materializeRemoteWranglerConfig as B,planRemoteBindings as b,resolveRemoteEnabled as G}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-DPv7P69m.mjs";import{materializeServiceDevConfigs as u}from"../packem_shared/materializeServiceDevConfigs-Dot5AUtE.mjs";import{default as V}from"../packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DV5E_f_q.mjs";import{withTailConsumer as P}from"../packem_shared/withTailConsumer-CV75ggJW.mjs";import{WORKERS_CACHE_MIN_DATE as Y,isCacheEnabled as w}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{DEFAULT_OBSERVABILITY as K,resolveObservabilitySampling as j}from"../packem_shared/DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import{mergeWranglerEnvironment as Q}from"../packem_shared/mergeWranglerEnvironment-DXiB-HcS.mjs";import{WRANGLER_FILES as X,findWranglerFile as k,readWranglerJsonc as q}from"../packem_shared/WRANGLER_FILES-UNW-xY5u.mjs";import{UNEXPORTED_CLASS_MARKER as $,validateWranglerProject as ee}from"../packem_shared/UNEXPORTED_CLASS_MARKER-3PuHuOjQ.mjs";import{collectWranglerSecretVariables as oe,scanWranglerVariablesForSecrets as ae}from"../packem_shared/collectWranglerSecretVariables-D-usPfT8.mjs";import{wranglerToAlchemy as te}from"../packem_shared/wranglerToAlchemy-CBO2ucRm.mjs";import{REQUIRED_COMPATIBILITY_DATE as ie,REQUIRED_FLAG as fe,validateWrangler as me,validateWranglerConfig as Ee}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-CFpBYYW4.mjs";export{n as BINDING_MANIFEST_VERSION,m as CLOUDFLARE_CLI_CONFIG_WARNING_ENV,c as CLOUDFLARE_DRIVER,V as CLOUDFLARE_TOOLCHAIN_VERSIONS,K as DEFAULT_OBSERVABILITY,C as GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG,F as REMOTE_ELIGIBLE_KEYS,ie as REQUIRED_COMPATIBILITY_DATE,fe as REQUIRED_FLAG,$ as UNEXPORTED_CLASS_MARKER,Y as WORKERS_CACHE_MIN_DATE,X as WRANGLER_FILES,o as applyModify,l as assertWranglerSatisfiesSchema,i as buildBindingManifest,_ as collectExportGaps,oe as collectWranglerSecretVariables,A as describePreservedCrons,E as detectCloudflareCliConfig,k as findWranglerFile,N as injectRemoteFlags,w as isCacheEnabled,v as isRemoteEnvEnabled,B as materializeRemoteWranglerConfig,u as materializeServiceDevConfigs,Q as mergeWranglerEnvironment,b as planRemoteBindings,q as readWranglerJsonc,O as reconcileBindingsSafely,x as reconcileWranglerBindings,d as reconcileWranglerCompatibilityDate,S as reconcileWranglerCrons,T as reconcileWranglerExtras,j as resolveObservabilitySampling,G as resolveRemoteEnabled,ae as scanWranglerVariablesForSecrets,me as validateWrangler,Ee as validateWranglerConfig,ee as validateWranglerProject,s as warnCloudflareCliConfigOnce,P as withTailConsumer,te as wranglerToAlchemy};
package/dist/index.d.mts CHANGED
@@ -2,8 +2,8 @@ import { AgentIR, ContainerIR, WorkflowIR, CodegenResult } from '@lunora/codegen
2
2
  export type { AgentIR, ContainerIR, WorkflowIR } from '@lunora/codegen';
3
3
  import { ChildProcess } from 'node:child_process';
4
4
  import { Writable } from 'node:stream';
5
- import { T as ToolchainCommand, D as DeployDriver, P as ProjectionPurpose } from "./packem_shared/infer-bindings.d-BH0tk-TR.mjs";
6
- export { C as COMPOSED_WORKER_ENTRY, type a as DeployRequest, type b as DevRequest, type c as DiscoverSchemaInfoResult, type d as DriverToolchain, e as GENERATED_CLASS_MODULES, type G as GeneratedClassModule, type f as InferOptions, type g as InferredAgent, type I as InferredBindings, type h as InferredContainer, type i as InferredWorkflow, type j as ProjectedConfig, type S as SchemaInfo, type k as SecretRequest, type l as TailRequest, m as discoverSchemaInfo, n as inferLunoraBindings, p as packageNamesFromBindings } from "./packem_shared/infer-bindings.d-BH0tk-TR.mjs";
5
+ import { T as ToolchainCommand, D as DeployDriver, P as ProjectionPurpose } from "./packem_shared/infer-bindings.d-Bu9-5J2O.mjs";
6
+ export { C as COMPOSED_WORKER_ENTRY, a as DURABLE_OBJECT_BINDINGS, type b as DeployRequest, type c as DevRequest, type d as DiscoverSchemaInfoResult, type e as DriverToolchain, f as GENERATED_CLASS_MODULES, g as GENERATED_MODULE_DURABLE_OBJECTS, type G as GeneratedClassModule, type h as InferOptions, type i as InferredAgent, type I as InferredBindings, type j as InferredContainer, type k as InferredWorkflow, M as MERGED_DURABLE_OBJECTS_MODULE, type l as ProjectedConfig, type S as SchemaInfo, type m as SecretRequest, type n as TailRequest, o as discoverSchemaInfo, p as inferLunoraBindings, q as isMergedProject, r as isMergedRoleModule, s as packageNamesFromBindings } from "./packem_shared/infer-bindings.d-Bu9-5J2O.mjs";
7
7
  export { type A as AdditivePolicyEdit, type D as DestructivePolicyEdit, type P as PolicyEdit, type a as PolicyScaffoldFailureReason, type b as ScaffoldFileResult, type S as ScaffoldPolicyEdit, type c as WireResult, type W as WireRlsEdit, d as classifyPolicyEdit, r as resolveServerModule, s as scaffoldPolicyFile, w as wireRlsIntoProcedure } from "./packem_shared/policy-scaffold.d-D2H4_G01.mjs";
8
8
  interface DiscoverAgentInfoResult {
9
9
  /** Discovered agent definitions; `[]` when none are declared or parsing failed. */
@@ -305,13 +305,6 @@ interface FrameworkDetection {
305
305
  /** The detected meta-framework, or `"none"` when no known one is present. */
306
306
  framework: DetectedFramework;
307
307
  }
308
- /**
309
- * Read and parse the project `package.json`, returning its merged
310
- * `dependencies` + `devDependencies` name set (empty on any failure). Public
311
- * so sibling consumers (e.g. the CLI's Vite-project detection) share one
312
- * best-effort reader instead of re-parsing `package.json` themselves.
313
- */
314
- declare const readProjectDependencyNames: (root: string) => ReadonlySet<string>;
315
308
  /**
316
309
  * Whether the project depends on the unscoped `lunorash` umbrella rather than
317
310
  * the granular `@lunora/*` packages.
@@ -1012,6 +1005,20 @@ declare const resolveProjectTarget: (projectRoot: string, explicit?: string) =>
1012
1005
  * @returns the resolved, registered target id.
1013
1006
  */
1014
1007
  declare const resolveTargetOrThrow: (projectRoot: string, explicit?: string) => string;
1008
+ /**
1009
+ * The `package.json` at `root` as a plain object, or `undefined` when it is
1010
+ * missing, unreadable, or not a JSON object. Best-effort on purpose: every
1011
+ * caller reads one fact off it (a script, a key, the dependencies) and falls
1012
+ * back to its default rather than failing over a broken manifest.
1013
+ */
1014
+ declare const readProjectManifest: (root: string) => Readonly<Record<string, unknown>> | undefined;
1015
+ /**
1016
+ * The manifest's merged `devDependencies` + `dependencies` map — a runtime
1017
+ * dependency wins a name declared in both — or `{}` when it cannot be read.
1018
+ */
1019
+ declare const readProjectDependencies: (root: string) => Readonly<Record<string, string>>;
1020
+ /** The names {@link readProjectDependencies} reads — empty when the manifest cannot be read. */
1021
+ declare const readProjectDependencyNames: (root: string) => ReadonlySet<string>;
1015
1022
  /**
1016
1023
  * Whether we can interactively prompt — stdin must be a TTY. In CI / piped
1017
1024
  * contexts this is false, and callers should fall back to a non-interactive
@@ -1446,4 +1453,4 @@ declare const badgeWidth: (_spec: BadgeSpec) => number;
1446
1453
  declare const paintBadge: (spec: BadgeSpec) => string;
1447
1454
  /** Dim continuation text (a step's chosen answer, shown under the question). */
1448
1455
  declare const paintAnswer: (text: string) => string;
1449
- export { ACCENT, AGENT_MODE_ENV, AGENT_RULES_DIR, AGENT_RULES_HINT, AGENT_RULES_HINT_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentDetection, type AgentRulesStatus, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, BADGES, BADGE_COLUMN_WIDTH, type BadgeName, type BadgeSpec, CODEGEN_ENV, type CelldDevSession, type CelldDevSessionOptions, type CelldLineOrigin, type ClaimDevServerStateResult, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEFAULT_DEPLOY_TARGET, DEV_BINDINGS_FILE, DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, type DeployDriver, type DestructiveEdit, type DetectedFramework, type DevProcess, type DevProcessOptions, type DevProcessSpawner, type DevSecretsFillPlan, type DevServerMode, type DevServerState, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type FillDevSecretsResult, type FindingLogger, type FrameworkClass, type FrameworkDetection, type HookLogger, type HookSpawnDescriptor, type HookSpawner, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNA_ART, LUNA_BUNNY, LUNA_NAME, LUNA_SIGNOFF, LUNORA_EVENT_SOURCE, LUNORA_IGNORED_PATHS, LUNORA_SKILL_NAMES, LUNORA_TAG, type LevelBadgeName, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LunoraFormattedLine, type LunoraLineLevel, LunoraReporter, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type PackageManager, type PackageManagerProbe, type ParseSchemaResult, type PostCodegenHookResult, type ProjectionPurpose, ROOT_SKILL_NAME, type RemotePreference, STEP_BADGE_NAMES, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, type StepBadgeName, type ToolchainCommand, type ToolchainInvocation, acceptsConnection, addArgsFor, advisoryLine, applyAdditiveEdit, applyLintIgnores, badgeLead, badgeWidth, blockingFindingsMessage, buildPackageSecretsBlock, claimAgentRulesHint, claimDevServerState, classifyEdit, clearDevServerState, createConfirm, deployTargetIds, detectAgentRules, detectAiAgent, detectFramework, detectInstalledManagers, detectLintTools, detectPackageManager, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, ensureDevWorkerEnv, escapeRegExp, execArgsFor, fillDevSecrets, formatLunoraEvent, generateSecretValue, installArgsFor, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, isRunnableTarget, lunoraLine, padBadge, paintAnswer, paintBadge, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, planToolchainInvocation, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readDevServerState, readLinkedProject, readLiveDevServerState, readProjectDependencyNames, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, reportCodegenFindings, requiredSecrets, resolveDeployDriver, resolveProjectTarget, resolveSchemaDirectory, resolveTargetOrThrow, runPostCodegenHook, runScriptArgsFor, runScriptCommand, runnableTargetIds, secretsForPackages, startCelldDevSession, startDevProcess, streamContainerLogs, targetRunsOwnDevServer, toolchainExecArgs, updateDevServerState, upsertDevVariableLine, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
1456
+ export { ACCENT, AGENT_MODE_ENV, AGENT_RULES_DIR, AGENT_RULES_HINT, AGENT_RULES_HINT_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentDetection, type AgentRulesStatus, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, BADGES, BADGE_COLUMN_WIDTH, type BadgeName, type BadgeSpec, CODEGEN_ENV, type CelldDevSession, type CelldDevSessionOptions, type CelldLineOrigin, type ClaimDevServerStateResult, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEFAULT_DEPLOY_TARGET, DEV_BINDINGS_FILE, DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, type DeployDriver, type DestructiveEdit, type DetectedFramework, type DevProcess, type DevProcessOptions, type DevProcessSpawner, type DevSecretsFillPlan, type DevServerMode, type DevServerState, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type FillDevSecretsResult, type FindingLogger, type FrameworkClass, type FrameworkDetection, type HookLogger, type HookSpawnDescriptor, type HookSpawner, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNA_ART, LUNA_BUNNY, LUNA_NAME, LUNA_SIGNOFF, LUNORA_EVENT_SOURCE, LUNORA_IGNORED_PATHS, LUNORA_SKILL_NAMES, LUNORA_TAG, type LevelBadgeName, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LunoraFormattedLine, type LunoraLineLevel, LunoraReporter, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type PackageManager, type PackageManagerProbe, type ParseSchemaResult, type PostCodegenHookResult, type ProjectionPurpose, ROOT_SKILL_NAME, type RemotePreference, STEP_BADGE_NAMES, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, type StepBadgeName, type ToolchainCommand, type ToolchainInvocation, acceptsConnection, addArgsFor, advisoryLine, applyAdditiveEdit, applyLintIgnores, badgeLead, badgeWidth, blockingFindingsMessage, buildPackageSecretsBlock, claimAgentRulesHint, claimDevServerState, classifyEdit, clearDevServerState, createConfirm, deployTargetIds, detectAgentRules, detectAiAgent, detectFramework, detectInstalledManagers, detectLintTools, detectPackageManager, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, ensureDevWorkerEnv, escapeRegExp, execArgsFor, fillDevSecrets, formatLunoraEvent, generateSecretValue, installArgsFor, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, isRunnableTarget, lunoraLine, padBadge, paintAnswer, paintBadge, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, planToolchainInvocation, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readDevServerState, readLinkedProject, readLiveDevServerState, readProjectDependencies, readProjectDependencyNames, readProjectManifest, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, reportCodegenFindings, requiredSecrets, resolveDeployDriver, resolveProjectTarget, resolveSchemaDirectory, resolveTargetOrThrow, runPostCodegenHook, runScriptArgsFor, runScriptCommand, runnableTargetIds, secretsForPackages, startCelldDevSession, startDevProcess, streamContainerLogs, targetRunsOwnDevServer, toolchainExecArgs, updateDevServerState, upsertDevVariableLine, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import { AgentIR, ContainerIR, WorkflowIR, CodegenResult } from '@lunora/codegen
2
2
  export type { AgentIR, ContainerIR, WorkflowIR } from '@lunora/codegen';
3
3
  import { ChildProcess } from 'node:child_process';
4
4
  import { Writable } from 'node:stream';
5
- import { T as ToolchainCommand, D as DeployDriver, P as ProjectionPurpose } from "./packem_shared/infer-bindings.d-BH0tk-TR.js";
6
- export { C as COMPOSED_WORKER_ENTRY, type a as DeployRequest, type b as DevRequest, type c as DiscoverSchemaInfoResult, type d as DriverToolchain, e as GENERATED_CLASS_MODULES, type G as GeneratedClassModule, type f as InferOptions, type g as InferredAgent, type I as InferredBindings, type h as InferredContainer, type i as InferredWorkflow, type j as ProjectedConfig, type S as SchemaInfo, type k as SecretRequest, type l as TailRequest, m as discoverSchemaInfo, n as inferLunoraBindings, p as packageNamesFromBindings } from "./packem_shared/infer-bindings.d-BH0tk-TR.js";
5
+ import { T as ToolchainCommand, D as DeployDriver, P as ProjectionPurpose } from "./packem_shared/infer-bindings.d-Bu9-5J2O.js";
6
+ export { C as COMPOSED_WORKER_ENTRY, a as DURABLE_OBJECT_BINDINGS, type b as DeployRequest, type c as DevRequest, type d as DiscoverSchemaInfoResult, type e as DriverToolchain, f as GENERATED_CLASS_MODULES, g as GENERATED_MODULE_DURABLE_OBJECTS, type G as GeneratedClassModule, type h as InferOptions, type i as InferredAgent, type I as InferredBindings, type j as InferredContainer, type k as InferredWorkflow, M as MERGED_DURABLE_OBJECTS_MODULE, type l as ProjectedConfig, type S as SchemaInfo, type m as SecretRequest, type n as TailRequest, o as discoverSchemaInfo, p as inferLunoraBindings, q as isMergedProject, r as isMergedRoleModule, s as packageNamesFromBindings } from "./packem_shared/infer-bindings.d-Bu9-5J2O.js";
7
7
  export { type A as AdditivePolicyEdit, type D as DestructivePolicyEdit, type P as PolicyEdit, type a as PolicyScaffoldFailureReason, type b as ScaffoldFileResult, type S as ScaffoldPolicyEdit, type c as WireResult, type W as WireRlsEdit, d as classifyPolicyEdit, r as resolveServerModule, s as scaffoldPolicyFile, w as wireRlsIntoProcedure } from "./packem_shared/policy-scaffold.d-D2H4_G01.js";
8
8
  interface DiscoverAgentInfoResult {
9
9
  /** Discovered agent definitions; `[]` when none are declared or parsing failed. */
@@ -305,13 +305,6 @@ interface FrameworkDetection {
305
305
  /** The detected meta-framework, or `"none"` when no known one is present. */
306
306
  framework: DetectedFramework;
307
307
  }
308
- /**
309
- * Read and parse the project `package.json`, returning its merged
310
- * `dependencies` + `devDependencies` name set (empty on any failure). Public
311
- * so sibling consumers (e.g. the CLI's Vite-project detection) share one
312
- * best-effort reader instead of re-parsing `package.json` themselves.
313
- */
314
- declare const readProjectDependencyNames: (root: string) => ReadonlySet<string>;
315
308
  /**
316
309
  * Whether the project depends on the unscoped `lunorash` umbrella rather than
317
310
  * the granular `@lunora/*` packages.
@@ -1012,6 +1005,20 @@ declare const resolveProjectTarget: (projectRoot: string, explicit?: string) =>
1012
1005
  * @returns the resolved, registered target id.
1013
1006
  */
1014
1007
  declare const resolveTargetOrThrow: (projectRoot: string, explicit?: string) => string;
1008
+ /**
1009
+ * The `package.json` at `root` as a plain object, or `undefined` when it is
1010
+ * missing, unreadable, or not a JSON object. Best-effort on purpose: every
1011
+ * caller reads one fact off it (a script, a key, the dependencies) and falls
1012
+ * back to its default rather than failing over a broken manifest.
1013
+ */
1014
+ declare const readProjectManifest: (root: string) => Readonly<Record<string, unknown>> | undefined;
1015
+ /**
1016
+ * The manifest's merged `devDependencies` + `dependencies` map — a runtime
1017
+ * dependency wins a name declared in both — or `{}` when it cannot be read.
1018
+ */
1019
+ declare const readProjectDependencies: (root: string) => Readonly<Record<string, string>>;
1020
+ /** The names {@link readProjectDependencies} reads — empty when the manifest cannot be read. */
1021
+ declare const readProjectDependencyNames: (root: string) => ReadonlySet<string>;
1015
1022
  /**
1016
1023
  * Whether we can interactively prompt — stdin must be a TTY. In CI / piped
1017
1024
  * contexts this is false, and callers should fall back to a non-interactive
@@ -1446,4 +1453,4 @@ declare const badgeWidth: (_spec: BadgeSpec) => number;
1446
1453
  declare const paintBadge: (spec: BadgeSpec) => string;
1447
1454
  /** Dim continuation text (a step's chosen answer, shown under the question). */
1448
1455
  declare const paintAnswer: (text: string) => string;
1449
- export { ACCENT, AGENT_MODE_ENV, AGENT_RULES_DIR, AGENT_RULES_HINT, AGENT_RULES_HINT_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentDetection, type AgentRulesStatus, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, BADGES, BADGE_COLUMN_WIDTH, type BadgeName, type BadgeSpec, CODEGEN_ENV, type CelldDevSession, type CelldDevSessionOptions, type CelldLineOrigin, type ClaimDevServerStateResult, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEFAULT_DEPLOY_TARGET, DEV_BINDINGS_FILE, DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, type DeployDriver, type DestructiveEdit, type DetectedFramework, type DevProcess, type DevProcessOptions, type DevProcessSpawner, type DevSecretsFillPlan, type DevServerMode, type DevServerState, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type FillDevSecretsResult, type FindingLogger, type FrameworkClass, type FrameworkDetection, type HookLogger, type HookSpawnDescriptor, type HookSpawner, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNA_ART, LUNA_BUNNY, LUNA_NAME, LUNA_SIGNOFF, LUNORA_EVENT_SOURCE, LUNORA_IGNORED_PATHS, LUNORA_SKILL_NAMES, LUNORA_TAG, type LevelBadgeName, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LunoraFormattedLine, type LunoraLineLevel, LunoraReporter, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type PackageManager, type PackageManagerProbe, type ParseSchemaResult, type PostCodegenHookResult, type ProjectionPurpose, ROOT_SKILL_NAME, type RemotePreference, STEP_BADGE_NAMES, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, type StepBadgeName, type ToolchainCommand, type ToolchainInvocation, acceptsConnection, addArgsFor, advisoryLine, applyAdditiveEdit, applyLintIgnores, badgeLead, badgeWidth, blockingFindingsMessage, buildPackageSecretsBlock, claimAgentRulesHint, claimDevServerState, classifyEdit, clearDevServerState, createConfirm, deployTargetIds, detectAgentRules, detectAiAgent, detectFramework, detectInstalledManagers, detectLintTools, detectPackageManager, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, ensureDevWorkerEnv, escapeRegExp, execArgsFor, fillDevSecrets, formatLunoraEvent, generateSecretValue, installArgsFor, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, isRunnableTarget, lunoraLine, padBadge, paintAnswer, paintBadge, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, planToolchainInvocation, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readDevServerState, readLinkedProject, readLiveDevServerState, readProjectDependencyNames, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, reportCodegenFindings, requiredSecrets, resolveDeployDriver, resolveProjectTarget, resolveSchemaDirectory, resolveTargetOrThrow, runPostCodegenHook, runScriptArgsFor, runScriptCommand, runnableTargetIds, secretsForPackages, startCelldDevSession, startDevProcess, streamContainerLogs, targetRunsOwnDevServer, toolchainExecArgs, updateDevServerState, upsertDevVariableLine, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
1456
+ export { ACCENT, AGENT_MODE_ENV, AGENT_RULES_DIR, AGENT_RULES_HINT, AGENT_RULES_HINT_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentDetection, type AgentRulesStatus, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, BADGES, BADGE_COLUMN_WIDTH, type BadgeName, type BadgeSpec, CODEGEN_ENV, type CelldDevSession, type CelldDevSessionOptions, type CelldLineOrigin, type ClaimDevServerStateResult, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEFAULT_DEPLOY_TARGET, DEV_BINDINGS_FILE, DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, type DeployDriver, type DestructiveEdit, type DetectedFramework, type DevProcess, type DevProcessOptions, type DevProcessSpawner, type DevSecretsFillPlan, type DevServerMode, type DevServerState, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type FillDevSecretsResult, type FindingLogger, type FrameworkClass, type FrameworkDetection, type HookLogger, type HookSpawnDescriptor, type HookSpawner, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNA_ART, LUNA_BUNNY, LUNA_NAME, LUNA_SIGNOFF, LUNORA_EVENT_SOURCE, LUNORA_IGNORED_PATHS, LUNORA_SKILL_NAMES, LUNORA_TAG, type LevelBadgeName, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LunoraFormattedLine, type LunoraLineLevel, LunoraReporter, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type PackageManager, type PackageManagerProbe, type ParseSchemaResult, type PostCodegenHookResult, type ProjectionPurpose, ROOT_SKILL_NAME, type RemotePreference, STEP_BADGE_NAMES, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, type StepBadgeName, type ToolchainCommand, type ToolchainInvocation, acceptsConnection, addArgsFor, advisoryLine, applyAdditiveEdit, applyLintIgnores, badgeLead, badgeWidth, blockingFindingsMessage, buildPackageSecretsBlock, claimAgentRulesHint, claimDevServerState, classifyEdit, clearDevServerState, createConfirm, deployTargetIds, detectAgentRules, detectAiAgent, detectFramework, detectInstalledManagers, detectLintTools, detectPackageManager, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, ensureDevWorkerEnv, escapeRegExp, execArgsFor, fillDevSecrets, formatLunoraEvent, generateSecretValue, installArgsFor, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, isRunnableTarget, lunoraLine, padBadge, paintAnswer, paintBadge, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, planToolchainInvocation, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readDevServerState, readLinkedProject, readLiveDevServerState, readProjectDependencies, readProjectDependencyNames, readProjectManifest, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, reportCodegenFindings, requiredSecrets, resolveDeployDriver, resolveProjectTarget, resolveSchemaDirectory, resolveTargetOrThrow, runPostCodegenHook, runScriptArgsFor, runScriptCommand, runnableTargetIds, secretsForPackages, startCelldDevSession, startDevProcess, streamContainerLogs, targetRunsOwnDevServer, toolchainExecArgs, updateDevServerState, upsertDevVariableLine, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as s}from"./packem_shared/discoverAgentInfo-CTdCSfYM.mjs";import{AGENT_RULES_DIR as E,AGENT_RULES_HINT as n,AGENT_RULES_HINT_ENV as l,LUNORA_SKILL_NAMES as p,ROOT_SKILL_NAME as _,claimAgentRulesHint as c,detectAgentRules as d}from"./packem_shared/AGENT_RULES_DIR-HrrbNZPy.mjs";import{startCelldDevSession as D}from"./packem_shared/startCelldDevSession-BLFsd6jG.mjs";import{CODEGEN_ENV as S,isCodegenDisabled as f}from"./packem_shared/CODEGEN_ENV-ZsCxV1kP.mjs";import{discoverContainerInfo as L}from"./packem_shared/discoverContainerInfo-EhZtEBQs.mjs";import{streamContainerLogs as R}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as T,projectUsesUmbrella as x,readProjectDependencyNames as V}from"./packem_shared/detectFramework-CUiVEHDQ.mjs";import{acceptsConnection as u,startDevProcess as P}from"./packem_shared/acceptsConnection-DHhUYGjT.mjs";import{DEV_BINDINGS_FILE as F,DEV_DAEMON_ENV as C,DEV_HANDOFF_ENV as U,DEV_LOG_FILE as G,DEV_LOG_FILE_ENV as b,DEV_STATE_DIR as M,DEV_STATE_FILE as y,claimDevServerState as k,clearDevServerState as B,isDevServerReady as K,isProcessAlive as w,isRecordedProcessCurrent as h,readDevServerState as j,readLiveDevServerState as H,updateDevServerState as W,writeDevServerState as Y}from"./packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs";import{DEV_VARS_EXAMPLE_FILE as q,DEV_VARS_FILE as X,DEV_VARS_KEY_PATTERN as z,escapeRegExp as Q,parseDevVariableEntries as Z,removeDevVariableLine as $,upsertDevVariableLine as ee}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEV_WORKER_ENV_VALUE as oe,DEV_WORKER_ENV_VAR as te,ensureDevWorkerEnv as ae}from"./packem_shared/DEV_WORKER_ENV_VALUE-DwGANZVw.mjs";import{DEFAULT_DEPLOY_TARGET as ie,deployTargetIds as Ee,isRunnableTarget as ne,planToolchainInvocation as le,resolveDeployDriver as pe,runnableTargetIds as _e,targetRunsOwnDevServer as ce}from"./packem_shared/DEFAULT_DEPLOY_TARGET-CfoV0tDu.mjs";import{i as me,p as De}from"./packem_shared/infer-bindings-B-BFynp2.mjs";import{LINKED_PROJECT_DIR as Se,LINKED_PROJECT_FILE as fe,readLinkedProject as ve,writeLinkedProject as Le}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as Re,applyLintIgnores as ge,detectLintTools as Te}from"./packem_shared/LUNORA_IGNORED_PATHS-B0-PPvRp.mjs";import{LUNORA_TAG as Ve,advisoryLine as Ie,blockingFindingsMessage as ue,lunoraLine as Pe,reportCodegenFindings as Oe}from"./packem_shared/LUNORA_TAG-CiQM3BkI.mjs";import{LUNORA_EVENT_SOURCE as Ce,formatLunoraEvent as Ue}from"./packem_shared/LUNORA_EVENT_SOURCE-DYdcDU9G.mjs";import{default as be}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as ye,detectInstalledManagers as ke,detectPackageManager as Be,execArgsFor as Ke,installArgsFor as we,runScriptArgsFor as he,runScriptCommand as je,toolchainExecArgs as He}from"./packem_shared/addArgsFor-CYZKhNIo.mjs";import{P as Ye,s as Je}from"./packem_shared/package-secrets-registry-DvtTiK4b.mjs";import{runPostCodegenHook as Xe}from"./packem_shared/runPostCodegenHook-B0T1q2YI.mjs";import{interpretRemote as Qe,readProjectRemotePreference as Ze,readProjectTarget as $e,resolveProjectTarget as er,resolveTargetOrThrow as rr}from"./packem_shared/interpretRemote-C9yJC_ZK.mjs";import{createConfirm as tr,isInteractive as ar,promptMultiSelect as sr,promptSelect as ir,promptText as Er,promptYesNo as nr}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{default as pr}from"./packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs";import{buildPackageSecretsBlock as cr,ensureDevVariables as dr,ensureDevVarsExample as mr,fillDevSecrets as Dr,generateSecretValue as Ar,isMintableSecretKey as Sr,isPlaceholderValue as fr,planDevSecretsFill as vr,planDevVariablesAugment as Lr,planDevVariablesScaffold as Nr,requiredSecrets as Rr,writeDevVariablesFileAtomically as gr}from"./packem_shared/buildPackageSecretsBlock-yv9mjKEW.mjs";import{applyAdditiveEdit as xr,classifyEdit as Vr}from"./packem_shared/applyAdditiveEdit-CH0VhMJ2.mjs";import{parseSchema as ur}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as Or,resolveServerModule as Fr,scaffoldPolicyFile as Cr,wireRlsIntoProcedure as Ur}from"./packem_shared/classifyPolicyEdit-D8NwrHxR.mjs";import{discoverSchemaInfo as br}from"./packem_shared/discoverSchemaInfo-BguahM6z.mjs";import{ACCENT as yr,BADGES as kr,BADGE_COLUMN_WIDTH as Br,LUNA_ART as Kr,LUNA_BUNNY as wr,LUNA_NAME as hr,LUNA_SIGNOFF as jr,STEP_BADGE_NAMES as Hr,badgeLead as Wr,badgeWidth as Yr,padBadge as Jr,paintAnswer as qr,paintBadge as Xr}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{COMPOSED_WORKER_ENTRY as Qr,GENERATED_CLASS_MODULES as Zr}from"./packem_shared/COMPOSED_WORKER_ENTRY-C69wqbSP.mjs";import{discoverWorkflowInfo as eo}from"./packem_shared/discoverWorkflowInfo-BsPvlo6O.mjs";export{yr as ACCENT,o as AGENT_MODE_ENV,E as AGENT_RULES_DIR,n as AGENT_RULES_HINT,l as AGENT_RULES_HINT_ENV,kr as BADGES,Br as BADGE_COLUMN_WIDTH,S as CODEGEN_ENV,Qr as COMPOSED_WORKER_ENTRY,ie as DEFAULT_DEPLOY_TARGET,F as DEV_BINDINGS_FILE,C as DEV_DAEMON_ENV,U as DEV_HANDOFF_ENV,G as DEV_LOG_FILE,b as DEV_LOG_FILE_ENV,M as DEV_STATE_DIR,y as DEV_STATE_FILE,q as DEV_VARS_EXAMPLE_FILE,X as DEV_VARS_FILE,z as DEV_VARS_KEY_PATTERN,oe as DEV_WORKER_ENV_VALUE,te as DEV_WORKER_ENV_VAR,Zr as GENERATED_CLASS_MODULES,Se as LINKED_PROJECT_DIR,fe as LINKED_PROJECT_FILE,Kr as LUNA_ART,wr as LUNA_BUNNY,hr as LUNA_NAME,jr as LUNA_SIGNOFF,Ce as LUNORA_EVENT_SOURCE,Re as LUNORA_IGNORED_PATHS,p as LUNORA_SKILL_NAMES,Ve as LUNORA_TAG,be as LunoraReporter,Ye as PACKAGE_SECRETS_REGISTRY,_ as ROOT_SKILL_NAME,Hr as STEP_BADGE_NAMES,u as acceptsConnection,ye as addArgsFor,Ie as advisoryLine,xr as applyAdditiveEdit,ge as applyLintIgnores,Wr as badgeLead,Yr as badgeWidth,ue as blockingFindingsMessage,cr as buildPackageSecretsBlock,c as claimAgentRulesHint,k as claimDevServerState,Vr as classifyEdit,Or as classifyPolicyEdit,B as clearDevServerState,tr as createConfirm,Ee as deployTargetIds,d as detectAgentRules,t as detectAiAgent,T as detectFramework,ke as detectInstalledManagers,Te as detectLintTools,Be as detectPackageManager,s as discoverAgentInfo,L as discoverContainerInfo,br as discoverSchemaInfo,eo as discoverWorkflowInfo,dr as ensureDevVariables,mr as ensureDevVarsExample,ae as ensureDevWorkerEnv,Q as escapeRegExp,Ke as execArgsFor,Dr as fillDevSecrets,Ue as formatLunoraEvent,Ar as generateSecretValue,me as inferLunoraBindings,we as installArgsFor,Qe as interpretRemote,f as isCodegenDisabled,K as isDevServerReady,ar as isInteractive,Sr as isMintableSecretKey,fr as isPlaceholderValue,w as isProcessAlive,h as isRecordedProcessCurrent,ne as isRunnableTarget,Pe as lunoraLine,De as packageNamesFromBindings,Jr as padBadge,qr as paintAnswer,Xr as paintBadge,Z as parseDevVariableEntries,ur as parseSchema,vr as planDevSecretsFill,Lr as planDevVariablesAugment,Nr as planDevVariablesScaffold,le as planToolchainInvocation,x as projectUsesUmbrella,sr as promptMultiSelect,ir as promptSelect,Er as promptText,nr as promptYesNo,j as readDevServerState,ve as readLinkedProject,H as readLiveDevServerState,V as readProjectDependencyNames,Ze as readProjectRemotePreference,$e as readProjectTarget,$ as removeDevVariableLine,Oe as reportCodegenFindings,Rr as requiredSecrets,pe as resolveDeployDriver,er as resolveProjectTarget,pr as resolveSchemaDirectory,Fr as resolveServerModule,rr as resolveTargetOrThrow,Xe as runPostCodegenHook,he as runScriptArgsFor,je as runScriptCommand,_e as runnableTargetIds,Cr as scaffoldPolicyFile,Je as secretsForPackages,D as startCelldDevSession,P as startDevProcess,R as streamContainerLogs,ce as targetRunsOwnDevServer,He as toolchainExecArgs,W as updateDevServerState,ee as upsertDevVariableLine,Ur as wireRlsIntoProcedure,Y as writeDevServerState,gr as writeDevVariablesFileAtomically,Le as writeLinkedProject};
1
+ import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-CTdCSfYM.mjs";import{AGENT_RULES_DIR as i,AGENT_RULES_HINT as n,AGENT_RULES_HINT_ENV as _,LUNORA_SKILL_NAMES as l,ROOT_SKILL_NAME as p,claimAgentRulesHint as c,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,isCodegenDisabled as f}from"./packem_shared/CODEGEN_ENV-ZsCxV1kP.mjs";import{discoverContainerInfo as R}from"./packem_shared/discoverContainerInfo-EhZtEBQs.mjs";import{streamContainerLogs as N}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as g,projectUsesUmbrella as x}from"./packem_shared/detectFramework-Dfpvu6rD.mjs";import{acceptsConnection as I,startDevProcess as O}from"./packem_shared/acceptsConnection-DHhUYGjT.mjs";import{DEV_BINDINGS_FILE as u,DEV_DAEMON_ENV as C,DEV_HANDOFF_ENV as F,DEV_LOG_FILE as U,DEV_LOG_FILE_ENV as M,DEV_STATE_DIR as G,DEV_STATE_FILE as B,claimDevServerState as b,clearDevServerState as y,isDevServerReady as k,isProcessAlive as j,isRecordedProcessCurrent as K,readDevServerState as w,readLiveDevServerState as h,updateDevServerState as H,writeDevServerState as W}from"./packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs";import{DEV_VARS_EXAMPLE_FILE as J,DEV_VARS_FILE as q,DEV_VARS_KEY_PATTERN as X,escapeRegExp as z,parseDevVariableEntries as Q,removeDevVariableLine as Z,upsertDevVariableLine as $}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEV_WORKER_ENV_VALUE as re,DEV_WORKER_ENV_VAR as oe,ensureDevWorkerEnv as te}from"./packem_shared/DEV_WORKER_ENV_VALUE-DwGANZVw.mjs";import{DEFAULT_DEPLOY_TARGET as Ee,deployTargetIds as se,isRunnableTarget as ie,planToolchainInvocation as ne,resolveDeployDriver as _e,runnableTargetIds as le,targetRunsOwnDevServer as pe}from"./packem_shared/DEFAULT_DEPLOY_TARGET-CfoV0tDu.mjs";import{i as de,p as De}from"./packem_shared/infer-bindings-B626aaRY.mjs";import{LINKED_PROJECT_DIR as Ae,LINKED_PROJECT_FILE as Se,readLinkedProject as fe,writeLinkedProject as Le}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as ve,applyLintIgnores as Ne,detectLintTools as Te}from"./packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs";import{LUNORA_TAG as xe,advisoryLine as Ve,blockingFindingsMessage as Ie,lunoraLine as Oe,reportCodegenFindings as Pe}from"./packem_shared/LUNORA_TAG-CiQM3BkI.mjs";import{LUNORA_EVENT_SOURCE as Ce,formatLunoraEvent as Fe}from"./packem_shared/LUNORA_EVENT_SOURCE-B9ZVohjO.mjs";import{default as Me}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as Be,detectInstalledManagers as be,detectPackageManager as ye,execArgsFor as ke,installArgsFor as je,runScriptArgsFor as Ke,runScriptCommand as we,toolchainExecArgs as he}from"./packem_shared/addArgsFor-CYZKhNIo.mjs";import{P as We,s as Ye}from"./packem_shared/package-secrets-registry-DvtTiK4b.mjs";import{runPostCodegenHook as qe}from"./packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs";import{interpretRemote as ze,readProjectRemotePreference as Qe,readProjectTarget as Ze,resolveProjectTarget as $e,resolveTargetOrThrow as er}from"./packem_shared/interpretRemote-C9yJC_ZK.mjs";import{readProjectDependencies as or,readProjectDependencyNames as tr,readProjectManifest as ar}from"./packem_shared/readProjectDependencies-l3uhUKjo.mjs";import{createConfirm as sr,isInteractive as ir,promptMultiSelect as nr,promptSelect as _r,promptText as lr,promptYesNo as pr}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{default as dr}from"./packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs";import{buildPackageSecretsBlock as mr,ensureDevVariables as Ar,ensureDevVarsExample as Sr,fillDevSecrets as fr,generateSecretValue as Lr,isMintableSecretKey as Rr,isPlaceholderValue as vr,planDevSecretsFill as Nr,planDevVariablesAugment as Tr,planDevVariablesScaffold as gr,requiredSecrets as xr,writeDevVariablesFileAtomically as Vr}from"./packem_shared/buildPackageSecretsBlock-yv9mjKEW.mjs";import{applyAdditiveEdit as Or,classifyEdit as Pr}from"./packem_shared/applyAdditiveEdit-CH0VhMJ2.mjs";import{parseSchema as Cr}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as Ur,resolveServerModule as Mr,scaffoldPolicyFile as Gr,wireRlsIntoProcedure as Br}from"./packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs";import{discoverSchemaInfo as yr}from"./packem_shared/discoverSchemaInfo-BguahM6z.mjs";import{ACCENT as jr,BADGES as Kr,BADGE_COLUMN_WIDTH as wr,LUNA_ART as hr,LUNA_BUNNY as Hr,LUNA_NAME as Wr,LUNA_SIGNOFF as Yr,STEP_BADGE_NAMES as Jr,badgeLead as qr,badgeWidth as Xr,padBadge as zr,paintAnswer as Qr,paintBadge as Zr}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{COMPOSED_WORKER_ENTRY as eo,DURABLE_OBJECT_BINDINGS as ro,GENERATED_CLASS_MODULES as oo,GENERATED_MODULE_DURABLE_OBJECTS as to,MERGED_DURABLE_OBJECTS_MODULE as ao,isMergedProject as Eo,isMergedRoleModule as so}from"./packem_shared/COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{discoverWorkflowInfo as no}from"./packem_shared/discoverWorkflowInfo-BsPvlo6O.mjs";export{jr as ACCENT,o as AGENT_MODE_ENV,i as AGENT_RULES_DIR,n as AGENT_RULES_HINT,_ as AGENT_RULES_HINT_ENV,Kr as BADGES,wr as BADGE_COLUMN_WIDTH,S as CODEGEN_ENV,eo as COMPOSED_WORKER_ENTRY,Ee as DEFAULT_DEPLOY_TARGET,u as DEV_BINDINGS_FILE,C as DEV_DAEMON_ENV,F as DEV_HANDOFF_ENV,U as DEV_LOG_FILE,M as DEV_LOG_FILE_ENV,G as DEV_STATE_DIR,B as DEV_STATE_FILE,J as DEV_VARS_EXAMPLE_FILE,q as DEV_VARS_FILE,X as DEV_VARS_KEY_PATTERN,re as DEV_WORKER_ENV_VALUE,oe as DEV_WORKER_ENV_VAR,ro as DURABLE_OBJECT_BINDINGS,oo as GENERATED_CLASS_MODULES,to as GENERATED_MODULE_DURABLE_OBJECTS,Ae as LINKED_PROJECT_DIR,Se as LINKED_PROJECT_FILE,hr as LUNA_ART,Hr as LUNA_BUNNY,Wr as LUNA_NAME,Yr as LUNA_SIGNOFF,Ce as LUNORA_EVENT_SOURCE,ve as LUNORA_IGNORED_PATHS,l as LUNORA_SKILL_NAMES,xe as LUNORA_TAG,Me as LunoraReporter,ao as MERGED_DURABLE_OBJECTS_MODULE,We as PACKAGE_SECRETS_REGISTRY,p as ROOT_SKILL_NAME,Jr as STEP_BADGE_NAMES,I as acceptsConnection,Be as addArgsFor,Ve as advisoryLine,Or as applyAdditiveEdit,Ne as applyLintIgnores,qr as badgeLead,Xr as badgeWidth,Ie as blockingFindingsMessage,mr as buildPackageSecretsBlock,c as claimAgentRulesHint,b as claimDevServerState,Pr as classifyEdit,Ur as classifyPolicyEdit,y as clearDevServerState,sr as createConfirm,se as deployTargetIds,d as detectAgentRules,t as detectAiAgent,g as detectFramework,be as detectInstalledManagers,Te as detectLintTools,ye as detectPackageManager,E as discoverAgentInfo,R as discoverContainerInfo,yr as discoverSchemaInfo,no as discoverWorkflowInfo,Ar as ensureDevVariables,Sr as ensureDevVarsExample,te as ensureDevWorkerEnv,z as escapeRegExp,ke as execArgsFor,fr as fillDevSecrets,Fe as formatLunoraEvent,Lr as generateSecretValue,de as inferLunoraBindings,je as installArgsFor,ze as interpretRemote,f as isCodegenDisabled,k as isDevServerReady,ir as isInteractive,Eo as isMergedProject,so as isMergedRoleModule,Rr as isMintableSecretKey,vr as isPlaceholderValue,j as isProcessAlive,K as isRecordedProcessCurrent,ie as isRunnableTarget,Oe as lunoraLine,De as packageNamesFromBindings,zr as padBadge,Qr as paintAnswer,Zr as paintBadge,Q as parseDevVariableEntries,Cr as parseSchema,Nr as planDevSecretsFill,Tr as planDevVariablesAugment,gr as planDevVariablesScaffold,ne as planToolchainInvocation,x as projectUsesUmbrella,nr as promptMultiSelect,_r as promptSelect,lr as promptText,pr as promptYesNo,w as readDevServerState,fe as readLinkedProject,h as readLiveDevServerState,or as readProjectDependencies,tr as readProjectDependencyNames,ar as readProjectManifest,Qe as readProjectRemotePreference,Ze as readProjectTarget,Z as removeDevVariableLine,Pe as reportCodegenFindings,xr as requiredSecrets,_e as resolveDeployDriver,$e as resolveProjectTarget,dr as resolveSchemaDirectory,Mr as resolveServerModule,er as resolveTargetOrThrow,qe as runPostCodegenHook,Ke as runScriptArgsFor,we as runScriptCommand,le as runnableTargetIds,Gr as scaffoldPolicyFile,Ye as secretsForPackages,m as startCelldDevSession,O as startDevProcess,N as streamContainerLogs,pe as targetRunsOwnDevServer,he as toolchainExecArgs,H as updateDevServerState,$ as upsertDevVariableLine,Br as wireRlsIntoProcedure,W as writeDevServerState,Vr as writeDevVariablesFileAtomically,Le as writeLinkedProject};
@@ -0,0 +1 @@
1
+ import{existsSync as E,readFileSync as O}from"node:fs";import{parse as S}from"es-module-lexer";import{WRANGLER_FILES as m,readWranglerJsonc as f}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{escapeRegExp as i}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{join as c}from"node:path";const g="_generated",x=["src/server.ts","src/server/index.ts","src/server/index.tsx","src/index.ts","src/worker.ts"],h=new Set(["build","coverage","dist",g,"node_modules","out","target"]),w=new Set([".client",".server"]),A=/[/\\]/u,L=t=>{const e=[];for(const r of t.split(A))r===""||r==="."||(r===".."&&e.length>0&&e.at(-1)!==".."?e.pop():e.push(r));return e},T=t=>L(t).slice(0,-1).some(e=>h.has(e)||e.startsWith(".")&&!w.has(e)),l={LunoraDO:"SHARD",SchedulerDO:"SCHEDULER",SessionDO:"SESSION",ShardDO:"SHARD",ShardRegistryDO:"SHARD_REGISTRY"},R=Object.keys(l),$=t=>Object.hasOwn(l,t),C="virtual:lunora/worker",d=["ShardDO"],J=["agents","containers","scheduler","shardRegistry","workflows"],u={scheduler:"SchedulerDO",shardRegistry:"ShardRegistryDO"},D="LunoraDO",y=new Set([...d,...Object.values(u)]),B="durableObjects",I=t=>E(c(t,`${B}.ts`)),W=t=>Object.hasOwn(u,t),F=t=>I(t)?[D]:[...d,...Object.entries(u).filter(([e])=>E(c(t,`${e}.ts`))).map(([,e])=>e)],N=t=>t.includes(D)?t.filter(e=>!y.has(e)):[...t],U="src/worker.ts",Y=t=>{for(const e of m){const r=c(t,e);if(!E(r))continue;const{parsed:s}=f(r),o=s?.main;if(o===C)return{composed:!0};const a=c(t,U);if(E(a))return{composed:!1,path:a};if(typeof o=="string"&&!T(o)&&E(c(t,o)))return{composed:!1,path:c(t,o)};break}for(const e of x){const r=c(t,e);if(E(r))return{composed:!1,path:r}}return{composed:!1}},M=/(?:^|[\s,{])type$/u,_=(t,e)=>{const r=e.ls>=0?e.ls:e.s;return M.test(t.slice(0,r).trimEnd())},b=(t,e)=>{const r=i(e);return new RegExp(String.raw`\bexport\s+type\s+${r}\b`,"u").test(t)||new RegExp(String.raw`\bexport\s+type\s*\{[^}]*\b${r}\b`,"u").test(t)||new RegExp(String.raw`\bexport\s+\{[^}]*\btype\s+${r}\b`,"u").test(t)},H=t=>{const e=O(t,"utf8");let r;try{const[,s]=S(e);r=new Set(s.filter(o=>!_(e,o)).map(o=>o.n))}catch{r=new Set(R.filter(s=>new RegExp(String.raw`\bexport\b[^\n;]*\b${s}\b`,"u").test(e)&&!b(e,s)))}return N(R.filter(s=>r.has(s))).map(s=>({binding:l[s],className:s}))},K=(t,e,r)=>{if(e.length===0)return[];if(t.composed)return e.map(n=>({...n,exported:!0}));if(t.path===void 0)return e.map(n=>({...n,exported:!1}));const s=O(t.path,"utf8"),o=new RegExp(String.raw`\bexport\s*\*\s*from\s*["'][^"']*_generated\/${r}(?:\.js)?["']`).test(s);let a;try{const[,n]=S(s);a=new Set(n.filter(p=>!_(s,p)).map(p=>p.n))}catch{a=new Set(e.map(n=>n.className).filter(n=>new RegExp(String.raw`\bexport\b[^\n;]*\b${i(n)}\b`,"u").test(s)&&!b(s,n)))}return e.map(n=>{const p=o||a.has(n.className);return{...n,exported:p}})};export{d as COMPOSED_ENTRY_DURABLE_OBJECTS,U as COMPOSED_WORKER_ENTRY,l as DURABLE_OBJECT_BINDINGS,J as GENERATED_CLASS_MODULES,g as GENERATED_DIRECTORY,u as GENERATED_MODULE_DURABLE_OBJECTS,C as LUNORA_WORKER_VIRTUAL_ID,D as MERGED_DURABLE_OBJECT,B as MERGED_DURABLE_OBJECTS_MODULE,y as MERGED_ROLE_DURABLE_OBJECTS,h as NON_SOURCE_DIRECTORIES,w as SOURCE_DOT_DIRECTORIES,x as WORKER_ENTRY_FALLBACKS,N as collapseMergedDurableObjects,F as composedEntryDurableObjects,K as detectClassExports,H as detectExportedDurableObjects,$ as isFrameworkDurableObject,T as isGeneratedOutput,I as isMergedProject,W as isMergedRoleModule,Y as resolveWorkerEntry};
@@ -0,0 +1 @@
1
+ const u=r=>{if(typeof r=="string")return r;if(r instanceof Error)return String(r);try{return JSON.stringify(r)??String(r)}catch{return String(r)}},d=r=>typeof r!="object"||r===null||Array.isArray(r)?"":Object.entries(r).map(([t,n])=>`${t}=${u(n)}`).join(" "),p="lunora",g="__root__",e=r=>typeof r=="string"?r:"",a=r=>Array.isArray(r)?r.filter(t=>typeof t=="string"):[],h=r=>typeof r=="number"&&Number.isFinite(r)?`${String(Math.round(r))}ms`:"?ms",l=r=>r==="error"||r==="fatal"?"error":r==="warn"?"warn":"info",m=r=>{const t=r.trim();if(!t.startsWith("{")||!t.endsWith("}"))return;let n;try{n=JSON.parse(t)}catch{return}if(typeof n!="object"||n===null)return;const o=n;return o.source===p?o:void 0},f=(r,t)=>{const n=e(t.shard);return n===""||n===g?r:`${r}@${n}`},y=(r,t)=>{const n=r.outcome==="error",o=[f(t,r),n?"error":"ok",h(r.durationMs)],i=a(r.tablesRead),s=a(r.tablesWritten);i.length>0&&o.push(`read[${i.join(",")}]`),s.length>0&&o.push(`write[${s.join(",")}]`),r.cacheHit===!0&&o.push("cached");const c=e(r.error);return n&&c!==""&&o.push(c),{kind:"rpc",level:n?"error":"info",text:o.join(" ")}},$=r=>{const t=e(r.container)||"<unknown>",n=e(r.instance),o=e(r.event)||"event",i=n===""||n==="unknown"?"":`#${n.slice(0,8)}`,s=e(r.message),c=[`container:${t}${i}`,o];return s!==""&&c.push(s),{kind:"log",level:r.event==="error"?"error":"info",text:c.join(" ")}},S=r=>{const t=m(r);if(!t)return;const n=e(t.function)||"<unknown>";if(t.type==="log"){const o=[`${f(n,t)} ${e(t.message)}`.trimEnd()],i=d(t.fields);i!==""&&o.push(i);const s=e(t.traceId);return s!==""&&o.push(`trace=${s.slice(0,8)}`),{kind:"log",level:l(e(t.level)),text:o.join(" ")}}if(t.type==="request")return y(t,n);if(t.type==="container")return $(t)};export{p as LUNORA_EVENT_SOURCE,S as formatLunoraEvent};
@@ -0,0 +1,19 @@
1
+ import{existsSync as g,readFileSync as h,writeFileSync as d}from"node:fs";import{join as p,dirname as x}from"node:path";import{parse as v}from"jsonc-parser";import{applyModify as $}from"./applyModify-DKP2l6S9.mjs";import{readProjectDependencyNames as S,readProjectManifest as w}from"./readProjectDependencies-l3uhUKjo.mjs";const c=["lunora/_generated/","lunora/.lunora-schema.json","lunora.advisor.map.json",".lunora/",".wrangler/"],f={biome:{configFiles:["biome.json","biome.jsonc"],packages:["@biomejs/biome"],shadowable:!0},eslint:{configFiles:["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],packages:["eslint"],shadowable:!0},oxlint:{configFiles:[".oxlintrc.json"],packages:["oxlint"],shadowable:!0},prettier:{configFiles:[".prettierrc",".prettierrc.json",".prettierrc.js",".prettierrc.mjs",".prettierrc.cjs","prettier.config.js","prettier.config.mjs","prettier.config.cjs"],packages:["prettier"],shadowable:!1}},L=Object.keys(f),y=(e,n)=>f[n].configFiles.map(t=>p(e,t)).find(t=>g(t)),k=(e,n)=>{let t=e;for(;;){const i=y(t,n);if(i!==void 0)return i;if(g(p(t,".git")))return;const s=x(t);if(s===t)return;t=s}},j=(e,n)=>{const t=y(e,n);if(t!==void 0)return{action:"extend",path:t};const i=g(p(e,".git")),s=f[n].shadowable&&!i?k(x(e),n):void 0,[a=""]=f[n].configFiles;return s===void 0?{action:"create",path:p(e,a)}:{action:"report",path:s}},U=e=>{const n=S(e),t=()=>w(e)?.prettier!==void 0;return L.filter(i=>f[i].packages.some(s=>n.has(s))||y(e,i)!==void 0||i==="prettier"&&t())},O="# Lunora generated + derived artifacts",I=e=>{const n=p(e,".prettierignore"),t=g(n)?h(n,"utf8"):void 0,i=t===void 0?[]:t.split(`
2
+ `).map(o=>o.trim()),s=c.filter(o=>!i.includes(o));if(s.length===0)return{path:n,status:t===void 0?"created":"unchanged",tool:"prettier"};const a=`${O}
3
+ ${s.join(`
4
+ `)}
5
+ `;return t===void 0?(d(n,a,"utf8"),{path:n,status:"created",tool:"prettier"}):(d(n,`${t.endsWith(`
6
+ `)?t:`${t}
7
+ `}
8
+ ${a}`,"utf8"),{path:n,status:"updated",tool:"prettier"})},A=(e,n,t,i)=>{const s=g(e),a=s?h(e,"utf8"):`{}
9
+ `;let r=v(a)??{};for(const l of n)r=r!==null&&typeof r=="object"?r[l]:void 0;const m=Array.isArray(r)?r:[],b=t.filter(l=>!m.includes(l));return b.length===0&&s?{path:e,status:"unchanged",tool:i}:(d(e,$(a,n,[...m,...b]),"utf8"),{path:e,status:s?"updated":"created",tool:i})},F=(e,n)=>`"${e}": [${n.map(t=>`"${t}"`).join(", ")}]`,P=()=>F("files.includes",c.map(e=>`!${e.endsWith("/")?`${e}**`:e}`)),E=e=>{const{action:n,path:t}=j(e,"oxlint");return n==="report"?{path:t,snippet:F("ignorePatterns",c),status:"manual",tool:"oxlint"}:A(t,["ignorePatterns"],c,"oxlint")},T=e=>{const{action:n,path:t}=j(e,"biome");if(n==="report")return{path:t,snippet:P(),status:"manual",tool:"biome"};const i=n==="extend",s=i?h(t,"utf8"):`{}
10
+ `,o=(v(s)??{}).files??{};if(Array.isArray(o.ignore))return A(t,["files","ignore"],c,"biome");const r=Array.isArray(o.includes)?o.includes:[],m=r.length===0?["**"]:r,l=c.map(u=>`!${u.endsWith("/")?`${u}**`:u}`).filter(u=>!r.includes(u));return l.length===0&&i?{path:t,status:"unchanged",tool:"biome"}:(d(t,$(s,["files","includes"],[...m,...l]),"utf8"),{path:t,status:i?"updated":"created",tool:"biome"})},W=()=>`{
11
+ // Lunora generated + derived artifacts.
12
+ ignores: [${c.map(e=>`"${e.endsWith("/")?`${e}**`:e}"`).join(", ")}],
13
+ }`,_=e=>{const{action:n,path:t}=j(e,"eslint"),i=W();if(n!=="create"){const a=h(t,"utf8"),o=c.every(r=>a.includes(r))?"unchanged":"manual";return{path:t,...o==="manual"?{snippet:i}:{},status:o,tool:"eslint"}}const s=p(e,"eslint.config.mjs");return d(s,`// Flat config. Add your own entries alongside the ignores below.
14
+ export default [
15
+ ${i.replaceAll(`
16
+ `,`
17
+ `)},
18
+ ];
19
+ `,"utf8"),{path:s,status:"created",tool:"eslint"}},C={biome:T,eslint:_,oxlint:E,prettier:I},G=(e,n)=>n.map(t=>{try{return C[t](e)}catch(i){return{message:i instanceof Error?i.message:String(i),path:e,status:"failed",tool:t}}});export{c as LUNORA_IGNORED_PATHS,G as applyLintIgnores,U as detectLintTools};
@@ -1 +1 @@
1
- import{existsSync as d,readFileSync as y}from"node:fs";import{join as s,isAbsolute as a,relative as m}from"node:path";import{LunoraError as p}from"@lunora/errors";import{classifyPolicyEdit as k,scaffoldPolicyFile as v,resolveServerModule as l,wireRlsIntoProcedure as b}from"./classifyPolicyEdit-D8NwrHxR.mjs";import{w as c,r as h}from"./write-atomic-9d9xs5ON.mjs";const D="/__lunora/policy-scaffold",u=e=>e==="unknown-procedure"?404:e==="already-wired"||e==="destructive"?409:422,f=(e,o)=>{let r;try{r=h(e)}catch(t){return{body:{error:t instanceof Error?t.message:String(t),ok:!1},status:500}}return{body:{...o,diagnostics:r,ok:!0},status:200}},g=e=>({body:{edit:e,message:"Rewriting an existing policy predicate changes evaluation semantics and must be done by hand. The scaffolder only adds new, deny-by-default rules.",needsManualEdit:!0,ok:!1},status:409}),w=(e,o)=>{const r=v(o,l(e.projectRoot));if(!r.ok)return{body:{error:r.reason,ok:!1},status:u(r.reason)};const t=e.schemaDirectory??"lunora",n=s(e.projectRoot,t,r.fileName);return d(n)?{body:{error:"file-exists",fileName:r.fileName,ok:!1},status:409}:(c(n,r.source),f(e,{fileName:r.fileName}))},R=(e,o,r)=>{if(typeof r!="string"||r.length===0||a(r)||r.includes("\\"))return;const t=s(e,o),n=s(t,`${r}.ts`),i=m(t,n);if(!(i.startsWith("..")||a(i)))return n},N=(e,o)=>{const r=R(e.projectRoot,e.schemaDirectory??"lunora",o.filePath);if(r===void 0||!d(r))return{body:{error:"unknown-procedure",ok:!1},status:404};const t=b(y(r,"utf8"),o,l(e.projectRoot));return t.ok?(c(r,t.text),f(e,{exportName:o.exportName})):{body:{error:t.reason,ok:!1},status:u(t.reason)}},E=e=>{if(e.method!=="POST")return{body:{error:"method-not-allowed",ok:!1},status:405};const{body:o}=e;if(o==null||typeof o!="object"||typeof o.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};const r=o;if(k(r)==="destructive")return g(r);if(r.kind==="scaffoldPolicy")return w(e,r);if(r.kind==="wireRls")return N(e,r);throw new p("INTERNAL",`unhandled additive policy edit kind: ${String(r.kind)}`)};export{D as POLICY_SCAFFOLD_ENDPOINT,E as handlePolicyScaffoldRequest};
1
+ import{existsSync as d,readFileSync as y}from"node:fs";import{join as s,isAbsolute as a,relative as m}from"node:path";import{LunoraError as p}from"@lunora/errors";import{classifyPolicyEdit as k,scaffoldPolicyFile as v,resolveServerModule as l,wireRlsIntoProcedure as b}from"./classifyPolicyEdit-DJi9Fk8G.mjs";import{w as c,r as h}from"./write-atomic-9d9xs5ON.mjs";const D="/__lunora/policy-scaffold",u=e=>e==="unknown-procedure"?404:e==="already-wired"||e==="destructive"?409:422,f=(e,o)=>{let r;try{r=h(e)}catch(t){return{body:{error:t instanceof Error?t.message:String(t),ok:!1},status:500}}return{body:{...o,diagnostics:r,ok:!0},status:200}},g=e=>({body:{edit:e,message:"Rewriting an existing policy predicate changes evaluation semantics and must be done by hand. The scaffolder only adds new, deny-by-default rules.",needsManualEdit:!0,ok:!1},status:409}),w=(e,o)=>{const r=v(o,l(e.projectRoot));if(!r.ok)return{body:{error:r.reason,ok:!1},status:u(r.reason)};const t=e.schemaDirectory??"lunora",n=s(e.projectRoot,t,r.fileName);return d(n)?{body:{error:"file-exists",fileName:r.fileName,ok:!1},status:409}:(c(n,r.source),f(e,{fileName:r.fileName}))},R=(e,o,r)=>{if(typeof r!="string"||r.length===0||a(r)||r.includes("\\"))return;const t=s(e,o),n=s(t,`${r}.ts`),i=m(t,n);if(!(i.startsWith("..")||a(i)))return n},N=(e,o)=>{const r=R(e.projectRoot,e.schemaDirectory??"lunora",o.filePath);if(r===void 0||!d(r))return{body:{error:"unknown-procedure",ok:!1},status:404};const t=b(y(r,"utf8"),o,l(e.projectRoot));return t.ok?(c(r,t.text),f(e,{exportName:o.exportName})):{body:{error:t.reason,ok:!1},status:u(t.reason)}},E=e=>{if(e.method!=="POST")return{body:{error:"method-not-allowed",ok:!1},status:405};const{body:o}=e;if(o==null||typeof o!="object"||typeof o.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};const r=o;if(k(r)==="destructive")return g(r);if(r.kind==="scaffoldPolicy")return w(e,r);if(r.kind==="wireRls")return N(e,r);throw new p("INTERNAL",`unhandled additive policy edit kind: ${String(r.kind)}`)};export{D as POLICY_SCAFFOLD_ENDPOINT,E as handlePolicyScaffoldRequest};
@@ -1 +1 @@
1
- import{writeFileSync as m,rmSync as b}from"node:fs";import{applyModify as g}from"./applyModify-DKP2l6S9.mjs";import{r as h}from"./lunora-manifest-v90ZUbVp.mjs";import{o as y}from"./reconcile-services-3dn35zgy.mjs";import{findWranglerFile as S,readWranglerJsonc as v}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{join as E}from"node:path";const l={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"}},j=Object.keys(l),d=(e,r)=>typeof e.binding=="string"?e.binding:r,u=(e,r,n,a)=>{const s=[];for(const[o,t]of r.entries())t!=null&&s.push({binding:d(t,`#${String(o)}`),kind:n,path:[...a,o],section:e});return s},p=(e,r)=>l[e].shape===r,R=(e,r)=>{const{label:n}=l[e];if(p(e,"array"))return u(e,r[e]??[],n,[]);if(p(e,"object")){const a=r[e];return a==null?[]:[{binding:d(a,e),kind:n,path:[],section:e}]}return u(e,r.queues?.producers??[],n,["producers"])},_=e=>j.flatMap(r=>R(r,e)),B=(e,r)=>{let n=e;for(const a of r)n=g(n,[a.section,...a.path,"remote"],!0);return n},i=()=>{},I=e=>{let r=!1;return()=>{if(!r){r=!0;try{b(e,{force:!0,recursive:!0})}catch{}}}};let f=0;const C=()=>(f+=1,`.wrangler.lunora-remote.${String(process.pid)}.${String(f)}.jsonc`),O=e=>{if(!e.enabled)return{cleanup:i,enabled:!1,remoteBindings:[]};const r=S(e.projectRoot);if(!r)return{cleanup:i,enabled:!0,reason:"wrangler.jsonc not found",remoteBindings:[]};const{parsed:n,text:a}=v(r);if(n===void 0)return{cleanup:i,enabled:!0,reason:`failed to parse ${r} as JSONC`,remoteBindings:[]};const s=y(h(e.projectRoot)),o=_(n).filter(c=>c.section!=="services"||!s.has(c.binding));if(o.length===0)return{cleanup:i,enabled:!0,reason:"no remote-eligible bindings to proxy",remoteBindings:[]};const t=E(e.projectRoot,C());return m(t,B(a,o),"utf8"),{cleanup:I(t),configPath:t,enabled:!0,remoteBindings:o}},L=e=>{if(e===void 0)return!1;const r=e.trim().toLowerCase();return r==="1"||r==="true"},$=e=>e.flag===!0||L(e.envValue)?!0:e.configPreference??!1;export{l as REMOTE_ELIGIBLE_KEYS,I as createCleanup,B as injectRemoteFlags,L as isRemoteEnvEnabled,O as materializeRemoteWranglerConfig,_ as planRemoteBindings,$ as resolveRemoteEnabled};
1
+ import{writeFileSync as m,rmSync as b}from"node:fs";import{applyModify as g}from"./applyModify-DKP2l6S9.mjs";import{r as h}from"./lunora-manifest-DuH_Cmyu.mjs";import{o as y}from"./reconcile-services-BwMkaWAq.mjs";import{findWranglerFile as S,readWranglerJsonc as v}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{join as E}from"node:path";const l={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"}},j=Object.keys(l),d=(e,r)=>typeof e.binding=="string"?e.binding:r,u=(e,r,n,a)=>{const s=[];for(const[o,t]of r.entries())t!=null&&s.push({binding:d(t,`#${String(o)}`),kind:n,path:[...a,o],section:e});return s},p=(e,r)=>l[e].shape===r,R=(e,r)=>{const{label:n}=l[e];if(p(e,"array"))return u(e,r[e]??[],n,[]);if(p(e,"object")){const a=r[e];return a==null?[]:[{binding:d(a,e),kind:n,path:[],section:e}]}return u(e,r.queues?.producers??[],n,["producers"])},_=e=>j.flatMap(r=>R(r,e)),B=(e,r)=>{let n=e;for(const a of r)n=g(n,[a.section,...a.path,"remote"],!0);return n},i=()=>{},I=e=>{let r=!1;return()=>{if(!r){r=!0;try{b(e,{force:!0,recursive:!0})}catch{}}}};let f=0;const C=()=>(f+=1,`.wrangler.lunora-remote.${String(process.pid)}.${String(f)}.jsonc`),O=e=>{if(!e.enabled)return{cleanup:i,enabled:!1,remoteBindings:[]};const r=S(e.projectRoot);if(!r)return{cleanup:i,enabled:!0,reason:"wrangler.jsonc not found",remoteBindings:[]};const{parsed:n,text:a}=v(r);if(n===void 0)return{cleanup:i,enabled:!0,reason:`failed to parse ${r} as JSONC`,remoteBindings:[]};const s=y(h(e.projectRoot)),o=_(n).filter(c=>c.section!=="services"||!s.has(c.binding));if(o.length===0)return{cleanup:i,enabled:!0,reason:"no remote-eligible bindings to proxy",remoteBindings:[]};const t=E(e.projectRoot,C());return m(t,B(a,o),"utf8"),{cleanup:I(t),configPath:t,enabled:!0,remoteBindings:o}},L=e=>{if(e===void 0)return!1;const r=e.trim().toLowerCase();return r==="1"||r==="true"},$=e=>e.flag===!0||L(e.envValue)?!0:e.configPreference??!1;export{l as REMOTE_ELIGIBLE_KEYS,I as createCleanup,B as injectRemoteFlags,L as isRemoteEnvEnabled,O as materializeRemoteWranglerConfig,_ as planRemoteBindings,$ as resolveRemoteEnabled};
@@ -0,0 +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-DKlB-1sF.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-CV75ggJW.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 +1 @@
1
- import{resolveAdminToken as A}from"./parseDevVariable-teAAahVD.mjs";import{sendStudioDocument as I,applyStudioAssetCache as O}from"./applyStudioAssetCache-DHQEJuuv.mjs";import{isStandaloneModulePath as _,studioAssetsStamp as H,loadStudioAssets as N,readStandaloneAsset as C,assetContentType as D}from"./assetContentType-CUb5bpbI.mjs";import{detectAgentRules as E}from"./AGENT_RULES_DIR-HrrbNZPy.mjs";import{handlePolicyScaffoldRequest as v,POLICY_SCAFFOLD_ENDPOINT as L}from"./POLICY_SCAFFOLD_ENDPOINT-0QiGKazX.mjs";import R from"./renderStudioHtml-ByowDtMl.mjs";import{handleSchemaEditRequest as b,SCHEMA_EDIT_ENDPOINT as x}from"./SCHEMA_EDIT_ENDPOINT-Dbt0faMd.mjs";import{handleSeedRequest as k,SEED_ENDPOINT as $}from"./SEED_ENDPOINT-2B56PN_H.mjs";import{serveJsonHandler as g}from"./serveJsonHandler-Dv0EdCb9.mjs";import{transportRejectionReason as j}from"./ALLOW_FORWARDED_ENV-BUndghJx.mjs";const d="/__lunora",M=`${d}/studio.js`,m=`${d}/styles.css`,p=/\/$/,U={[L]:v,[x]:b,[$]:k},q=new Set(["127.0.0.1","::1","localhost"]),X=t=>t!==void 0&&t!==!1&&!q.has(t),y=t=>t===void 0||t==="/"?"":t.replace(p,""),Z=t=>`${y(t)}${d}`,T=(t,n,c)=>{t.statusCode=200,t.setHeader("Content-Type",c),t.end(n)},w=t=>{try{return new URL(t,"http://localhost").pathname}catch{const n=t.indexOf("?");return n===-1?t:t.slice(0,n)}},tt=t=>{const{logger:n,projectRoot:c}=t,u=y(t.base);let l,f,S;const P=(o,s,e)=>{const i=H();if((l===void 0||i!==f)&&(l=N(n),f=i),l===void 0){e.statusCode=501,e.setHeader("Content-Type","text/plain"),e.end("Lunora studio assets not found — install and build @lunora/studio.");return}const a=o===m,r=o.slice(o.lastIndexOf("/")+1);if(O(s,e,r,i))return;if(a){T(e,l.styles,"text/css; charset=utf-8");return}const h=C(r);if(h===void 0){e.statusCode=404,e.setHeader("Content-Type","text/plain"),e.end("Not found");return}T(e,h,D(r))};return(o,s,e)=>{const i=w(o.url??"").replace(p,""),a=u!==""&&i.startsWith(u)?i.slice(u.length):i;if(a!==d&&!a.startsWith(`${d}/`)){e();return}if(t.isNonLoopbackBind||j(o,n)!==void 0){s.statusCode=403,s.setHeader("Content-Type","text/plain"),s.end("Lunora studio is only available on loopback hosts in dev.");return}const r=U[a];if(r!==void 0){g(o,s,r,c,{apiSpec:t.apiSpec,schemaDirectory:t.schemaDirectory});return}if(a===m||_(a)){P(a,o,s);return}S??=R({adminToken:A(c),basePath:d,dataEditable:!0,rulesInstalled:E(c).installed,runAsIdentity:!0,schemaEditable:!0,scriptSrc:M,styleHref:m}),I(s,S)}};export{d as STUDIO_PATH,M as STUDIO_SCRIPT_PATH,m as STUDIO_STYLE_PATH,tt as createStudioMiddleware,X as isNonLoopbackHost,w as requestPathname,Z as studioMountPath};
1
+ import{resolveAdminToken as A}from"./parseDevVariable-teAAahVD.mjs";import{sendStudioDocument as I,applyStudioAssetCache as O}from"./applyStudioAssetCache-DHQEJuuv.mjs";import{isStandaloneModulePath as _,studioAssetsStamp as H,loadStudioAssets as N,readStandaloneAsset as C,assetContentType as D}from"./assetContentType-CUb5bpbI.mjs";import{detectAgentRules as E}from"./AGENT_RULES_DIR-HrrbNZPy.mjs";import{handlePolicyScaffoldRequest as v,POLICY_SCAFFOLD_ENDPOINT as L}from"./POLICY_SCAFFOLD_ENDPOINT-B8xEUSap.mjs";import R from"./renderStudioHtml-ByowDtMl.mjs";import{handleSchemaEditRequest as b,SCHEMA_EDIT_ENDPOINT as x}from"./SCHEMA_EDIT_ENDPOINT-Dbt0faMd.mjs";import{handleSeedRequest as k,SEED_ENDPOINT as $}from"./SEED_ENDPOINT-2B56PN_H.mjs";import{serveJsonHandler as g}from"./serveJsonHandler-Dv0EdCb9.mjs";import{transportRejectionReason as j}from"./ALLOW_FORWARDED_ENV-BUndghJx.mjs";const d="/__lunora",M=`${d}/studio.js`,m=`${d}/styles.css`,p=/\/$/,U={[L]:v,[x]:b,[$]:k},q=new Set(["127.0.0.1","::1","localhost"]),X=t=>t!==void 0&&t!==!1&&!q.has(t),y=t=>t===void 0||t==="/"?"":t.replace(p,""),Z=t=>`${y(t)}${d}`,T=(t,n,c)=>{t.statusCode=200,t.setHeader("Content-Type",c),t.end(n)},w=t=>{try{return new URL(t,"http://localhost").pathname}catch{const n=t.indexOf("?");return n===-1?t:t.slice(0,n)}},tt=t=>{const{logger:n,projectRoot:c}=t,u=y(t.base);let l,f,S;const P=(o,s,e)=>{const i=H();if((l===void 0||i!==f)&&(l=N(n),f=i),l===void 0){e.statusCode=501,e.setHeader("Content-Type","text/plain"),e.end("Lunora studio assets not found — install and build @lunora/studio.");return}const a=o===m,r=o.slice(o.lastIndexOf("/")+1);if(O(s,e,r,i))return;if(a){T(e,l.styles,"text/css; charset=utf-8");return}const h=C(r);if(h===void 0){e.statusCode=404,e.setHeader("Content-Type","text/plain"),e.end("Not found");return}T(e,h,D(r))};return(o,s,e)=>{const i=w(o.url??"").replace(p,""),a=u!==""&&i.startsWith(u)?i.slice(u.length):i;if(a!==d&&!a.startsWith(`${d}/`)){e();return}if(t.isNonLoopbackBind||j(o,n)!==void 0){s.statusCode=403,s.setHeader("Content-Type","text/plain"),s.end("Lunora studio is only available on loopback hosts in dev.");return}const r=U[a];if(r!==void 0){g(o,s,r,c,{apiSpec:t.apiSpec,schemaDirectory:t.schemaDirectory});return}if(a===m||_(a)){P(a,o,s);return}S??=R({adminToken:A(c),basePath:d,dataEditable:!0,rulesInstalled:E(c).installed,runAsIdentity:!0,schemaEditable:!0,scriptSrc:M,styleHref:m}),I(s,S)}};export{d as STUDIO_PATH,M as STUDIO_SCRIPT_PATH,m as STUDIO_STYLE_PATH,tt as createStudioMiddleware,X as isNonLoopbackHost,w as requestPathname,Z as studioMountPath};
@@ -0,0 +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-BguahM6z.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-DKlB-1sF.mjs";import{validateSchedulerOrigin as x}from"./withTailConsumer-CV75ggJW.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-CFpBYYW4.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-CiQM3BkI.mjs";import{validateWranglerProject as l}from"./UNEXPORTED_CLASS_MARKER-s6wTR8W1.mjs";const m=(e,a,t)=>{const r=l({projectRoot:e.projectRoot,schemaDir:e.schemaDir});if(!r.wranglerPath)throw new n("INTERNAL",["[lunora] wrangler.jsonc not found.",` searched in: ${e.projectRoot}`," create a wrangler.jsonc declaring at least the SHARD durable object binding."].join(`
1
+ import{LunoraError as n}from"@lunora/errors";import{lunoraLine as i}from"./LUNORA_TAG-CiQM3BkI.mjs";import{validateWranglerProject as l}from"./UNEXPORTED_CLASS_MARKER-3PuHuOjQ.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};
@@ -1,4 +1,4 @@
1
- import{Project as p,SyntaxKind as o}from"ts-morph";import{projectUsesUmbrella as u}from"./detectFramework-CUiVEHDQ.mjs";const f=new Set(["action","mutation","query","stream"]),l=/^[A-Za-z_$][\w$]*$/u,d=new Set(["@lunora/server","lunorash/server"]),y=e=>u(e)?"lunorash/server":"@lunora/server",m=new Set(["scaffoldPolicy","wireRls"]),$=e=>m.has(e.kind)?"additive":"destructive",v=(e,s)=>{if(typeof e.name!="string"||typeof e.table!="string"||!l.test(e.name)||!l.test(e.table))return{ok:!1,reason:"invalid-identifier"};const r=`${e.name}Policies`,t=`${e.name}Roles`,n=JSON.stringify(e.table),i=`import { definePermission, definePolicies, definePolicy, defineRole } from "${s}";
1
+ import{Project as p,SyntaxKind as o}from"ts-morph";import{projectUsesUmbrella as u}from"./detectFramework-Dfpvu6rD.mjs";const f=new Set(["action","mutation","query","stream"]),l=/^[A-Za-z_$][\w$]*$/u,d=new Set(["@lunora/server","lunorash/server"]),y=e=>u(e)?"lunorash/server":"@lunora/server",m=new Set(["scaffoldPolicy","wireRls"]),$=e=>m.has(e.kind)?"additive":"destructive",v=(e,s)=>{if(typeof e.name!="string"||typeof e.table!="string"||!l.test(e.name)||!l.test(e.table))return{ok:!1,reason:"invalid-identifier"};const r=`${e.name}Policies`,t=`${e.name}Roles`,n=JSON.stringify(e.table),i=`import { definePermission, definePolicies, definePolicy, defineRole } from "${s}";
2
2
 
3
3
  /**
4
4
  * Access rules for the ${e.table} table — scaffolded by the Lunora studio
@@ -0,0 +1,2 @@
1
+ import{readFileSync as V,writeFileSync as X}from"node:fs";import{createRequire as z}from"node:module";import{join as F}from"node:path";import{containerBuildTag as Z}from"@lunora/container";import{readJsonSync as ee}from"@visulima/fs";import{applyModify as S}from"./applyModify-DKP2l6S9.mjs";import{a as ne,r as M}from"./lunora-manifest-DuH_Cmyu.mjs";import{parseTree as se,findNodeAtLocation as te}from"jsonc-parser";import{r as oe,a as ie,b as re,c as ae}from"./reconcile-services-BwMkaWAq.mjs";import{a as de,p as ce}from"./infer-bindings-B626aaRY.mjs";import{DEV_VARS_FILE as le,parseDevVariableEntries as ue}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{requiredSecrets as ge}from"./buildPackageSecretsBlock-yv9mjKEW.mjs";import{w as me,p as pe,s as Q,o as B,q as j,r as fe}from"./validate-bindings-DKlB-1sF.mjs";import{s as be}from"./worker-entry-checks-AIASCYl7.mjs";import{DEFAULT_OBSERVABILITY as he}from"./DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import{findWranglerFile as we,readWranglerJsonc as ve}from"./WRANGLER_FILES-UNW-xY5u.mjs";const _e=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],R=e=>Object.fromEntries(_e.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),P="queueTuning",ye=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,Se=/^[\t ]*,/u,xe=(e,n)=>{const s=se(e),t=s===void 0?void 0:te(s,[...n])?.parent;if(t?.type==="property"){const i=t.offset+t.length,o=e.lastIndexOf(`
2
+ `,t.offset-1)+1,d=ye.exec(e.slice(i));if(d!==null&&e.slice(o,t.offset).trim()===""){const a=t.parent?.children??[],b=a.indexOf(t),c=b===a.length-1&&b>0?a[b-1]:void 0,l=c===void 0?void 0:Se.exec(e.slice(c.offset+c.length))??void 0;return(l===void 0||c===void 0?e.slice(0,o):e.slice(0,c.offset+c.length)+e.slice(c.offset+c.length+l[0].length,o))+e.slice(i+d[0].length)}}return S(e,n,void 0)},Y=(e,n,s,t,i,o=new Set)=>{const d=s.join("."),a={},b=[],c=[];let l=e;return{entries:n.map((u,w)=>{const g=t(u);if(g===void 0||u.queue===void 0)return u;const p=Object.fromEntries(Object.entries(R(g)).filter(([f])=>!o.has(f))),h=Object.entries(i[u.queue]??{}).filter(([f])=>!Object.hasOwn(p,f)),v=Object.entries(p).filter(([f,y])=>u[f]!==y),x=h.filter(([f,y])=>u[f]===y).map(([f])=>f),N=Object.fromEntries(Object.entries({...u,...p}).filter(([f])=>!x.includes(f)));for(const[f,y]of v)l=S(l,[...s,w,f],y);for(const f of x)l=xe(l,[...s,w,f]);for(const[f,y]of h){const E=u[f];E!==void 0&&E!==y&&c.push(`${d}/${u.queue}: ${f} is no longer declared by defineQueue, but it was changed by hand to ${JSON.stringify(E)} from the declared ${JSON.stringify(y)}, so it was kept. Delete it from wrangler.jsonc if it should go.`)}return(v.length>0||x.length>0)&&b.push(`${d}/${u.queue} (${[...v.map(([f])=>f),...x.map(f=>`removed ${f}`)].join(", ")})`),Object.keys(p).length>0&&(a[u.queue]=p),N}),owned:a,text:l,updated:b,warnings:c}},Ne=(e,n,s,t)=>{const i=n.queues??{},o=i.producers??[],d=i.consumers??[],a=new Set(o.map(g=>g.binding)),b=new Set(d.map(g=>g.queue)),c=s.filter(g=>!a.has(g.bindingName)),l=s.filter(g=>!b.has(g.name)),m=Y(e,d,["queues","consumers"],g=>s.find(p=>p.name===g.queue),t);let u=m.text;const w={...m.owned};if(c.length>0||l.length>0){const g=[...o,...c.map(h=>({binding:h.bindingName,queue:h.name}))],p=[...m.entries,...l.map(h=>({queue:h.name,...h.mode==="pull"?{type:"http_pull"}:{},...R(h)}))];for(const h of l){const v=R(h);Object.keys(v).length>0&&(w[h.name]=v)}u=S(u,["queues"],{consumers:p,producers:g})}return{added:[...c.map(g=>`queues.producers/${g.bindingName}`),...l.map(g=>`queues.consumers/${g.name}`)],owned:w,text:u,updated:m.updated,warnings:m.warnings}},Oe=(e,n,s,t,i)=>{const o=n.env?.[t],d=o?.queues?.consumers??[],a=o?.queues?.producers??[],b=u=>{const w=a.find(g=>g.queue===u.queue)?.binding;return w!==void 0?s.find(g=>g.bindingName===w):s.find(g=>g.name===u.queue&&!a.some(p=>p.binding===g.bindingName))},c=Y(e,d,["env",t,"queues","consumers"],b,i,new Set(["dead_letter_queue"])),l=d.filter(u=>u.queue!==void 0&&b(u)===void 0).map(u=>`env.${t}.queues.consumers/${String(u.queue)}: no defineQueue export matches it — this block declares no producer mapping one of their bindings to "${String(u.queue)}", and no export is named that — so it was not retuned. A consumer for a queue another worker produces is skipped the same way.`),m=d.flatMap(u=>{const w=b(u)?.tuning.deadLetterQueue;return w===void 0||u.dead_letter_queue!==void 0?[]:[`env.${t}.queues.consumers/${String(u.queue)}: defineQueue declares deadLetterQueue "${w}", but this consumer has no dead_letter_queue, so its exhausted messages are dropped. Queue names differ per environment, so reconcile does not write it here; add it by hand.`]});return{added:[],owned:c.owned,text:c.text,updated:c.updated,warnings:[...c.warnings,...m,...l]}},Ee=(e,n)=>{if(e?.lunoraIsForeign===!0)return n.push(`${e.path}: \`lunora\` is not an object, so the queue tuning ownership record cannot be read or written — an option removed from defineQueue stays deployed.`),{};const s=e?.lunora?.[P],t=i=>typeof i=="object"&&i!==null&&!Array.isArray(i);return s===void 0?{}:!t(s)||!Object.values(s).every(i=>t(i)&&Object.values(i).every(o=>t(o)))?(n.push(`${e?.path??"package.json"}: \`lunora.${P}\` is not a map of scope → queue → fields, so it is ignored — an option removed from defineQueue stays deployed until the next pass records it again.`),{}):s},ke=(e,n,s)=>{const t=Object.fromEntries(Object.entries({...n,...s}).filter(([,i])=>Object.keys(i).length>0));ne(e,P,Object.keys(t).length===0?void 0:t)},C="PIPELINES",I="ARTIFACTS",$e=(e,n)=>{const s=e.flagshipBinding!==void 0&&!(n?.flagship??[]).some(a=>a.binding===e.flagshipBinding),t=e.usesPipelines&&!(n?.pipelines??[]).some(a=>a.binding===C),i=e.usesArtifacts?n?.artifacts??[]:[],o=i.some(a=>a.binding===I)?[]:i.flatMap(a=>a.binding===void 0?[]:[a.binding]);return[[e.usesKv&&(n?.kv_namespaces?.length??0)===0,"@lunora/bindings/kv is used but no kv_namespaces binding exists; add a kv_namespaces entry ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned."],[e.usesHyperdrive&&(n?.hyperdrive?.length??0)===0,"@lunora/hyperdrive is used but no hyperdrive binding exists; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned."],[t,`ctx.pipelines is used but no "${C}" pipelines binding exists; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding: "${C}", stream }) — codegen resolves this one name, and the pipeline resource can't be auto-provisioned.`],[e.usesArtifacts&&i.length===0,de(e.jurisdiction)],[o.length>0,`ctx.artifacts is used and ${o.map(a=>`"${a}"`).join(", ")} ${o.length===1?"is":"are"} bound, but none is named "${I}"; make sure \`.artifacts()\` on defineApp points ctx.artifacts at it — otherwise it reads env.${I} and throws.`],[s,`lunora/flags.ts uses Flagship in binding mode but no flagship binding "${e.flagshipBinding??""}" exists; add a flagship entry ({ binding: "${e.flagshipBinding??""}", app_id }) — the app_id can't be auto-provisioned.`]].filter(([a])=>a).map(([,a])=>a)},Ae=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.`),qe=(e,n)=>{const s=new Set([...e.workflows,...e.agents].map(o=>o.className));if(s.size===0)return[];const t=Object.entries(n.exports??{}).flatMap(([o,d])=>d?.type==="workflow"?[o]:[]),i=(n.workflows??[]).flatMap(o=>o.class_name===void 0||o.script_name!==void 0?[]:[o.class_name]);return[...new Set([...t,...i])].filter(o=>!s.has(o)).map(o=>`wrangler.jsonc declares workflow "${o}" but no defineWorkflow/defineAgent export generates that class — a leftover from a rename will fail the deploy (wrangler rejects a class the worker does not export). Remove it if it is not hand-wired.`)},je=(e,n)=>{if(e.queues.length===0)return[];const s=new Set(e.queues.map(i=>i.name)),t=new Set(e.queues.map(i=>i.bindingName));return[...(n.queues?.consumers??[]).flatMap(i=>{const{queue:o}=i;return o===void 0||s.has(o)?[]:[`wrangler.jsonc subscribes queues.consumers[] to "${o}" but no defineQueue export declares that queue — a leftover from a rename keeps delivering batches this worker has no handler for (they retry to exhaustion, then drop or dead-letter). Remove it if it is not hand-wired.`]}),...(n.queues?.producers??[]).flatMap(i=>{const{binding:o}=i;return o===void 0||t.has(o)?[]:[`wrangler.jsonc declares queues.producers[] binding "${o}" but no defineQueue export declares it — a leftover from a rename. Remove it if it is not hand-wired.`]})]},Ce=(e,n)=>[...qe(e,n),...je(e,n)],G=[{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"}],Ie=()=>G.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),De=e=>{let n;try{n=V(F(e,le),"utf8")}catch{return!1}const s=new Map(ue(n).map(t=>[t.key,t.value]));return G.some(({keys:t})=>t.every(i=>(s.get(i)??"")!==""))},Te=(e,n)=>{const s=n?.secrets?.required;if(!Array.isArray(s))return[];const t=new Set(s),i=ge(ce(e)).map(o=>o.key).filter(o=>!t.has(o));return i.length===0?[]:[`wrangler.jsonc declares secrets.required without ${i.join(", ")}, which this app needs — wrangler dev loads only the listed keys from .dev.vars, so add ${i.length===1?"it":"them"} to secrets.required.`]},T=(e,n,s)=>{const t=new Set(e.durableObjects.map(a=>a.className)),i=[],o=(s?.r2_buckets?.length??0)>0,d=(s?.d1_databases?.some(a=>a.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!o&&i.push("@lunora/storage is used but R2 bucket bindings have user-defined names; add an r2_buckets entry and pass env.<BINDING> to createStorage()."),e.usesAuth&&!t.has("SessionDO")&&!d&&i.push("@lunora/auth is used but the worker entry exports no SessionDO; sessions are D1-backed, or export SessionDO to enable DO-backed sessions."),e.usesScheduler&&!t.has("SchedulerDO")&&i.push("@lunora/scheduler is used but the worker entry exports no SchedulerDO; export it so the SCHEDULER binding can be provisioned."),i.push(...D("container","containers",e.containers),...D("workflow","workflows",e.workflows),...D("agent","agents",e.agents)),e.containers.length>0&&s?.observability?.enabled===!1&&i.push("containers are declared but observability is explicitly disabled in wrangler.jsonc — container logs will not be captured."),e.usesPayments&&!De(n)&&i.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${Ie()}.`),i.push(...Ae(e),...$e(e,s),...Te(e,s)),s!==void 0&&i.push(...Ce(e,s)),i},U="<replace-with-d1-create-id>",Be=e=>[["container","containers",e.containers],["workflow","workflows",e.workflows],["agent","agents",e.agents]].flatMap(([s,t,i])=>i.filter(o=>!o.exported).map(({className:o,exportName:d})=>({className:o,exportName:d,kind:s,module:t}))),Re=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)}`},Pe=e=>{const n=new Set;for(const s of B(e)){for(const t of j(s.deleted_classes))n.delete(t);for(const{from:t,to:i}of B(s.renamed_classes))t!==void 0&&n.delete(t),i!==void 0&&n.add(i);for(const t of[...j(s.new_classes),...j(s.new_sqlite_classes)])n.add(t)}return n},Le=(e,n,s)=>{const t=n.durable_objects?.bindings??[],i=new Set(t.map(l=>l.name)),o=s.filter(l=>!i.has(l.binding));let d=e;const a=[];if(o.length>0){const l=[...t,...o.map(m=>({class_name:m.className,name:m.binding}))];d=S(d,["durable_objects","bindings"],l),a.push(...o.map(m=>`${m.binding}/${m.className}`))}const b=n.migrations??[],c=s.map(l=>l.className).filter(l=>!Pe(b).has(l));if(c.length>0){const l=[...b,{new_sqlite_classes:c,tag:Re(b)}];d=S(d,["migrations"],l)}return{added:a,text:d}},We=(e,n)=>{const s=n.d1_databases??[];if(s.some(o=>o.binding==="DB"))return{added:[],text:e};const t=typeof n.name=="string"&&n.name.length>0?n.name:"lunora",i=[...s,{binding:"DB",database_id:U,database_name:t}];return{added:["DB (D1)"],text:S(e,["d1_databases"],i)}},Me={ai:{binding:"AI",label:"AI (Workers AI)"},analytics:{binding:"ANALYTICS_SQL",label:"ANALYTICS_SQL (Analytics SQL)"},browser:{binding:"BROWSER",label:"BROWSER (Browser Rendering)"},images:{binding:"IMAGES",label:"IMAGES (Cloudflare Images)"}},$=(e,n,s)=>{const{binding:t,label:i}=Me[s],o=n[s]?.binding;return typeof o=="string"&&o.length>0?{added:[],text:e}:{added:[i],text:S(e,[s],{binding:t})}},Ke=(e,n)=>e.usesAnalyticsSql&&be(n,new Set(["analyticsSql"]))?.chained.has("analyticsSql")!==!0,Fe=new Set(["ratelimits","send_email"]),Qe=["durable_objects","logfwdr","unsafe"],Ye=new Set(["data_blobs","text_blobs","vars","wasm_modules"]),W=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),L=(e,n,s)=>W(e)&&e[n]===s,Ge=(e,n,s)=>{if(Ye.has(e))return W(n)&&Object.hasOwn(n,s);const t=Fe.has(e)?"name":"binding";return Array.isArray(n)?n.some(i=>L(i,t,s)):L(n,"binding",s)},Ue=(e,n)=>{const s=e,t=Object.entries(s).find(([o,d])=>o!=="env"&&Ge(o,d,n));if(t!==void 0)return t[0];for(const o of Qe){const d=s[o];if(W(d)&&Array.isArray(d.bindings)&&d.bindings.some(a=>L(a,"name",n)))return`${o}.bindings`}if(e.queues?.producers?.some(o=>o.binding===n)===!0)return"queues.producers";const i=e.secrets?.required;if(Array.isArray(i)&&i.includes(n))return"secrets.required"},K=(e,n,s,t,i)=>{if((n[s]?.length??0)>0)return{added:[],text:e};const o=Ue(n,t.binding);return o!==void 0?{added:[],text:e,warnings:[`${s}: not adding ${JSON.stringify(t)} — the name "${t.binding}" is already bound by \`${o}\` in wrangler.jsonc. Add a ${s} entry under another binding name and point the matching \`defineApp()\` override at it.`]}:{added:[i],text:S(e,[s],[t])}},He=(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"}])}},Je=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},Ve=e=>{const{image:n}=e;return n.kind==="dockerfile"?n.dockerfilePath:n.kind==="registry"?n.reference:Z(e.exportName)},H=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}}},Xe=e=>{if(e.schedulingPolicy==="durable_object")return H(e);const{image:n}=e,s={class_name:e.className,image:Ve(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=Je(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??[],i=new Set(t.map(c=>c.class_name)),o=s.filter(c=>!i.has(c.className));let d=o.length===0?e:S(e,["containers"],[...t,...o.map(c=>Xe(c))]);const a=[],b=[];for(const[c,l]of t.entries()){const m=s.find(g=>g.className===l.class_name);if(m===void 0)continue;const u=m.schedulingPolicy??"default";if((l.scheduling_policy??"default")!==u){b.push(`containers/${m.className} has scheduling_policy "${l.scheduling_policy??"default"}" in wrangler.jsonc but defineContainer "${m.exportName}" declares "${u}" — the policy is immutable, so replace the entry (and its container application) by hand.`);continue}const w=m.schedulingPolicy==="durable_object"?H(m).images:void 0;w!==void 0&&JSON.stringify(l.images)!==JSON.stringify(w)&&(d=S(d,["containers",c,"images"],w),a.push(`containers/${m.className}.images`))}return{added:o.map(c=>`containers/${c.className}`),text:d,updated:a,warnings:b}},Ze=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=S(e,["observability"],{...he});return{added:["observability"],text:s}},J=[{minimum:[4,142],name:"wrangler"},{minimum:[1,61],name:"@cloudflare/vite-plugin"}],en=J.map(({minimum:e,name:n})=>`${n}@^${e.join(".")}.0`).join(" "),nn=(e,n)=>{try{const s=z(F(e,"package.json")).resolve(`${n}/package.json`),[t=0,i=0]=String(ee(s).version).split(".").map(Number);return[t,i]}catch{return}},sn=e=>{const n=J.flatMap(({minimum:s,name:t})=>{const i=nn(e,t);return i!==void 0&&(i[0]<s[0]||i[0]===s[0]&&i[1]<s[1])?[`${t} ${i.join(".")} (needs >= ${s.join(".")})`]:[]});return n.length===0?void 0:`workflows are declared in wrangler \`exports\`, which ${n.join(" and ")} cannot run — reconcile left workflows[] untouched. Upgrade (\`pnpm add -D ${en}\`) and re-run.`},tn=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.`]:[]),on=(e,n,s)=>{let t=e;const i=[],o=[];for(const d of s){const a=n[d.className];if(a?.type==="workflow")for(const{of:b,path:c}of fe){const l=b(d),m=Q(a,c),u=`exports/${d.className}.${c.join(".")}`;if(l===void 0){m!==void 0&&o.push(`${u} is set in wrangler.jsonc but defineWorkflow "${d.exportName}" does not declare it — reconcile leaves it in place. Remove it by hand if it was dropped from the definition.`);continue}JSON.stringify(m)!==JSON.stringify(l)&&(t=S(t,["exports",d.className,...c],l),i.push(u))}}return{text:t,updated:i,warnings:o}},rn=(e,n,s,t,i)=>{if(i!==void 0)return{added:[],text:e,warnings:[i]};const o=[...s.map(p=>({settings:me(p),workflow:p})),...t.map(p=>({settings:{},workflow:p}))],d=new Set(o.map(({workflow:p})=>p.className)),a=n.workflows??[],b=a.filter(p=>p.script_name===void 0&&p.class_name!==void 0&&d.has(p.class_name)),c=n.exports??{},l=[],m=[],u=[];let w=e;for(const{settings:p,workflow:h}of o){if(c[h.className]!==void 0&&c[h.className]!==null)continue;const v=b.find(f=>f.class_name===h.className),x=Object.fromEntries(pe.flatMap(f=>{const y=Q(v,[f]);return y===void 0?[]:[[f,y]]})),N=v?.name??h.name;v?.name!==void 0&&v.name!==h.name&&u.push(`workflows/${h.className} is deployed as "${v.name}" but declared as "${h.name}" — its export keeps "${v.name}" so running instances survive. Change the declaration to match, or rename deliberately (it starts a new, empty workflow).`),w=S(w,["exports",h.className],{type:"workflow",...x,...p,name:N}),(v===void 0?l:m).push(`exports/${h.className}`)}if(b.length>0){const p=a.filter(h=>!b.includes(h));w=S(w,["workflows"],p.length===0?void 0:p),m.push(...b.map(h=>`workflows/${String(h.class_name)} → exports`))}u.push(...tn(n));const g=on(w,c,s);return{added:l,text:g.text,updated:[...m,...g.updated],warnings:[...u,...g.warnings]}},xn=(e,n,s)=>{const t=we(e),i=Be(n);if(!t)return{added:[],changed:!1,exportGaps:i,reason:"wrangler.jsonc not found",updated:[],warnings:T(n,e)};const{parsed:o,text:d}=ve(t);if(o===void 0)return{added:[],changed:!1,exportGaps:i,reason:`failed to parse ${t} as JSONC`,updated:[],warnings:T(n,e),wranglerPath:t};const a=T(n,e,o);if(s!==void 0){const r=o.env?.[s]!==void 0;a.push(r?`auto-provisioned bindings are written to the top level of wrangler.jsonc only (queue consumers "env.${s}" already declares are retuned, nothing is added) — "env.${s}" has its own (non-inheritable) bindings and must be reconciled by hand; \`lunora deploy --env ${s}\` now validates them, so a gap here will be reported at deploy time.`:`--env "${s}" was requested but wrangler.jsonc declares no "env.${s}" block — auto-provisioned bindings are written to the top level only and will not apply to that environment.`)}const b=n.containers.filter(r=>r.exported),c=n.agents.filter(r=>r.exported&&r.voice===!0&&r.voiceBindingName!==void 0&&r.voiceClassName!==void 0),l=[...n.durableObjects,...b.map(r=>({binding:r.bindingName,className:r.className})),...c.map(r=>({binding:r.voiceBindingName,className:r.voiceClassName}))],m=n.workflows.filter(r=>r.exported),u=n.agents.filter(r=>r.exported),w=M(e),g=Ee(w,a),p={},h=oe(w);let v;const x=[{enabled:!0,run:r=>Le(r,o,l)},{enabled:n.needsD1,run:r=>We(r,o)},{enabled:n.usesAi,run:r=>$(r,o,"ai")},{enabled:n.usesAiSearch,run:r=>K(r,o,"ai_search_namespaces",{binding:"AI_SEARCH",namespace:"default"},"AI_SEARCH (AI Search namespace)")},{enabled:Ke(n,e),run:r=>$(r,o,"analytics")},{enabled:n.usesBrowser,run:r=>$(r,o,"browser")},{enabled:n.usesImages,run:r=>$(r,o,"images")},{enabled:n.usesAnalytics,run:r=>K(r,o,"analytics_engine_datasets",{binding:"ANALYTICS",dataset:"ANALYTICS"},"ANALYTICS (Analytics Engine)")},{enabled:n.usesWorkerLoader,run:r=>He(r,o)},{enabled:!0,run:r=>Ze(r,o)},{enabled:b.length>0,run:r=>ze(r,o,b)},{enabled:m.length>0||u.length>0,run:r=>rn(r,o,m,u,sn(e))},{enabled:n.queues.length>0,run:r=>{const _=Ne(r,o,n.queues,g.queues??{});return p.queues=_.owned,_}},{enabled:n.services!==void 0&&(n.services.length>0||Object.keys(h).length>0),run:r=>{const _=ie(r,o,n.services??[],h);return v=_.owned,_}},...s===void 0||o.env?.[s]===void 0?[]:[{enabled:n.queues.length>0,run:r=>{const _=`env.${s}.queues`,k=Oe(r,o,n.queues,s,g[_]??{});return p[_]=k.owned,k}}]];let N=d;const f=[],y=[];for(const r of x){if(!r.enabled)continue;const _=r.run(N);N=_.text,f.push(..._.added),y.push(..._.updated??[]),a.push(..._.warnings??[])}const E=r=>{if(w===void 0)return;const _=v,k=[...Object.keys(p).length>0?[{consequence:"an option removed from defineQueue stays deployed",key:"queueTuning",label:"queue tuning",write:O=>{ke(O,g,p)}}]:[],..._===void 0?[]:[{consequence:"a service removed from lunora.config stays bound",key:"services",label:"service bindings",write:O=>{ae(O,_)}}]];for(const O of k)try{O.write(M(e)??w)}catch(q){a.push(`${r?"wrangler.jsonc was updated, but ":""}recording the ${O.label} reconcile owns in ${w.path} (lunora.${O.key}) failed: ${q instanceof Error?q.message:String(q)}. Until it is recorded, ${O.consequence}.`)}};let A;if(n.services!==void 0){const r=re(e,n.services,h);a.push(...r.warnings),v={...v,...r.owned},A=r.added.length>0||r.updated.length>0?{added:r.added,path:r.path,updated:r.updated}:void 0}return f.includes("DB (D1)")&&a.push(`wrote a DB binding with a placeholder database_id ("${U}") — run \`wrangler d1 create <name>\` and replace it before deploying.`),N===d?(E(!1),{added:f,changed:!1,devConfig:A,exportGaps:i,reason:"bindings already in sync",updated:y,warnings:a,wranglerPath:t}):(X(t,N,"utf8"),E(!0),{added:f,changed:!0,devConfig:A,exportGaps:i,updated:y,warnings:a,wranglerPath:t})};export{Be as collectExportGaps,xn as reconcileWranglerBindings};
@@ -1 +1 @@
1
- import{writeFileSync as u}from"node:fs";import{modify as y,applyEdits as w}from"jsonc-parser";import{r as m,f as v,a as $}from"./lunora-manifest-v90ZUbVp.mjs";import{findWranglerFile as x,readWranglerJsonc as C}from"./WRANGLER_FILES-UNW-xY5u.mjs";const b=(r,n)=>r.length===n.length&&r.every((e,t)=>e===n[t]),j=(r,n)=>{if(r?.lunoraIsForeign===!0)return n.push(`${r.path}: \`lunora\` is not an object, so the cron ownership record cannot be read or written — a removed cron will keep firing.`),[];const e=r?.lunora?.crons;if(e===void 0)return[];if(!Array.isArray(e))return n.push(`${r?.path??"package.json"}: \`lunora.crons\` is not an array of cron expressions — the crons it recorded are now treated as hand-written and will not be cleared.`),[];const t=e.filter(o=>typeof o=="string");return t.length!==e.length&&n.push(`${r?.path??"package.json"}: \`lunora.crons\` dropped ${String(e.length-t.length)} non-string entry(s) — anything it recorded there is now treated as hand-written and will not be cleared.`),t},k=(r,n)=>{$(r,"crons",n.length===0?void 0:[...n])},W=(r,n)=>{const e=x(r);if(!e)return{changed:!1,preserved:[],reason:"wrangler.jsonc not found",warnings:[]};const{parsed:t,text:o}=C(e);if(t===void 0)return{changed:!1,preserved:[],reason:`failed to parse ${e} as JSONC`,warnings:[],wranglerPath:e};const g=Array.isArray(t.triggers?.crons)?t.triggers.crons.filter(i=>typeof i=="string"):[],c=[...n],s=[],d=m(r),p=j(d,s),a=g.filter(i=>!c.includes(i)&&!p.includes(i)),l=[...c,...a],f=()=>{d!==void 0&&k(d,c)};if(b(g,l))return f(),{changed:!1,preserved:a,reason:"triggers.crons already in sync",warnings:s,wranglerPath:e};const h=y(o,["triggers","crons"],l,{formattingOptions:v(o)});return h.length===0?{changed:!1,preserved:a,reason:"no structural edit produced",warnings:s,wranglerPath:e}:(u(e,w(o,h),"utf8"),f(),{changed:!0,preserved:a,warnings:s,wranglerPath:e})},J=r=>r.length===0?void 0:`kept ${String(r.length)} hand-written cron trigger(s): ${r.join(", ")}`;export{J as describePreservedCrons,W as reconcileWranglerCrons};
1
+ import{writeFileSync as u}from"node:fs";import{modify as y,applyEdits as w}from"jsonc-parser";import{r as m,f as v,a as $}from"./lunora-manifest-DuH_Cmyu.mjs";import{findWranglerFile as x,readWranglerJsonc as C}from"./WRANGLER_FILES-UNW-xY5u.mjs";const b=(r,n)=>r.length===n.length&&r.every((e,t)=>e===n[t]),j=(r,n)=>{if(r?.lunoraIsForeign===!0)return n.push(`${r.path}: \`lunora\` is not an object, so the cron ownership record cannot be read or written — a removed cron will keep firing.`),[];const e=r?.lunora?.crons;if(e===void 0)return[];if(!Array.isArray(e))return n.push(`${r?.path??"package.json"}: \`lunora.crons\` is not an array of cron expressions — the crons it recorded are now treated as hand-written and will not be cleared.`),[];const t=e.filter(o=>typeof o=="string");return t.length!==e.length&&n.push(`${r?.path??"package.json"}: \`lunora.crons\` dropped ${String(e.length-t.length)} non-string entry(s) — anything it recorded there is now treated as hand-written and will not be cleared.`),t},k=(r,n)=>{$(r,"crons",n.length===0?void 0:[...n])},W=(r,n)=>{const e=x(r);if(!e)return{changed:!1,preserved:[],reason:"wrangler.jsonc not found",warnings:[]};const{parsed:t,text:o}=C(e);if(t===void 0)return{changed:!1,preserved:[],reason:`failed to parse ${e} as JSONC`,warnings:[],wranglerPath:e};const g=Array.isArray(t.triggers?.crons)?t.triggers.crons.filter(i=>typeof i=="string"):[],c=[...n],s=[],d=m(r),p=j(d,s),a=g.filter(i=>!c.includes(i)&&!p.includes(i)),l=[...c,...a],f=()=>{d!==void 0&&k(d,c)};if(b(g,l))return f(),{changed:!1,preserved:a,reason:"triggers.crons already in sync",warnings:s,wranglerPath:e};const h=y(o,["triggers","crons"],l,{formattingOptions:v(o)});return h.length===0?{changed:!1,preserved:a,reason:"no structural edit produced",warnings:s,wranglerPath:e}:(u(e,w(o,h),"utf8"),f(),{changed:!0,preserved:a,warnings:s,wranglerPath:e})},J=r=>r.length===0?void 0:`kept ${String(r.length)} hand-written cron trigger(s): ${r.join(", ")}`;export{J as describePreservedCrons,W as reconcileWranglerCrons};
@@ -0,0 +1 @@
1
+ import{readProjectDependencyNames as a}from"./readProjectDependencies-l3uhUKjo.mjs";const n=[{class:"A",dependency:"@tanstack/react-start",framework:"tanstack-start"},{class:"A",dependency:"@tanstack/solid-start",framework:"tanstack-start-solid"},{class:"A",dependency:"@react-router/dev",framework:"react-router"},{class:"A",dependency:"vinext",framework:"vinext"},{class:"A",dependency:"@solidjs/start",framework:"solid-start"},{class:"A",dependency:"solid-start",framework:"solid-start"},{class:"B",dependency:"@sveltejs/kit",framework:"sveltekit"},{class:"B",dependency:"nuxt",framework:"nuxt"},{class:"B",dependency:"astro",framework:"astro"}],t={class:"C",framework:"none"},o=e=>a(e).has("lunorash"),d=e=>{const r=a(e);if(r.size===0)return t;for(const s of n)if(r.has(s.dependency))return{class:s.class,framework:s.framework};return t};export{d as detectFramework,o as projectUsesUmbrella};
@@ -0,0 +1 @@
1
+ import{existsSync as O,statSync as T,readFileSync as j,readdirSync as P}from"node:fs";import{discoverFlags as F,FLAGS_FILENAME as B,discoverQueues as k,QUEUES_FILENAME as L,CAPABILITY_PROBES as _,readServiceBindings as G,mayReadCapabilityContext as K,foldCapabilitySignals as I,capabilitiesUsedBy as U,sourceCapabilitySignals as W}from"@lunora/codegen";import{init as q}from"es-module-lexer";import{Project as Y}from"ts-morph";import{discoverAgentInfo as M}from"./discoverAgentInfo-CTdCSfYM.mjs";import{discoverContainerInfo as H}from"./discoverContainerInfo-EhZtEBQs.mjs";import{escapeRegExp as X}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{d as D}from"./discover-info-Vj9d4qYt.mjs";import{relative as Q,sep as V,isAbsolute as J,join as f}from"node:path";import{discoverSchemaInfo as z}from"./discoverSchemaInfo-BguahM6z.mjs";import{resolveWorkerEntry as Z,composedEntryDurableObjects as ee,GENERATED_DIRECTORY as A,DURABLE_OBJECT_BINDINGS as se,detectExportedDurableObjects as te,detectClassExports as y,isMergedProject as re}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{discoverWorkflowInfo as ne}from"./discoverWorkflowInfo-BsPvlo6O.mjs";const oe="https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/artifacts/namespaces",ae=e=>{const s='add an "artifacts" binding ({ binding: "ARTIFACTS", namespace }) — codegen reads env.ARTIFACTS unless `.artifacts()` on defineApp points ctx.artifacts at another binding';return e===void 0?`ctx.artifacts is used; ${s}. The namespace is created by the first repo create() if it does not exist yet.`:e==="fedramp"?'ctx.artifacts is used, but the schema pins data to "fedramp" and Artifacts namespaces exist only in "eu" or "us" — codegen refuses this combination.':`ctx.artifacts is used and the schema pins data to "${e}"; create the namespace in that jurisdiction BEFORE the first repo, with POST ${oe} and body { "namespace": "<name>", "jurisdiction": "${e}" }, then ${s}. A namespace's jurisdiction cannot be changed, and one created implicitly by the first repo create() is unrestricted.`},ie=(e,s)=>{const{error:r,value:t}=D(e,s,B,F);return r===void 0?{flags:t}:{error:r}},ce=(e,s)=>{const r=Q(s,e);return r!==""&&r!==".."&&!r.startsWith(`..${V}`)&&!J(r)},de=(e,s)=>{const{error:r,value:t}=D(e,s,L,k);return r===void 0?{queues:t??[]}:{error:r,queues:[]}},le=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),ue=new Set([".git",".lunora-cache",".wrangler","dist",A,"node_modules"]),pe=["lunora","src"],me=/\benv\s*\.\s*DB\b/,he=/\benv\s*\.\s*AI\b/,R=["ai","aiSearch","analytics","analyticsSql","artifacts","browser","hyperdrive","images","kv","mail","notify","payments","pipelines","r2sql","scheduler","storage","x402"],$=e=>`uses${e.charAt(0).toUpperCase()}${e.slice(1)}`,C=[["usesAuth","@lunora/auth"],["usesCimdWorkers","@lunora/auth/cimd/workers"],["usesX402Charge","@lunora/x402/charge"]],N=[...R.map(e=>[$(e),_[e].moduleSpecifier]),...C].toSorted(([e],[s])=>e.localeCompare(s)),ge=["@lunora/agent","@lunora/agent/sandbox"],fe=new RegExp(String.raw`["'\x60](?:${[...N.map(([,e])=>e),...ge].map(e=>X(e)).join("|")})["'\x60]`,"u"),o=e=>{const{contextProperty:s,moduleSpecifier:r}=_[e];return s===void 0?`${r} is imported`:`${r} is imported or ctx.${s} is read`},be="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",Se=()=>{let e;return()=>(e??=new Y({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}),e)},ve=(e,s,r)=>{const t=r(),n=t.createSourceFile(`/scan/${s.slice(s.lastIndexOf("/")+1)}`,e,{overwrite:!0}),a=W(n);return t.removeSourceFile(n),a},w=(e,s)=>{let r;try{r=P(e,{withFileTypes:!0})}catch{return}for(const t of r){if(t.isDirectory()){ue.has(t.name)||w(f(e,t.name),s);continue}const n=t.name.lastIndexOf(".");n!==-1&&le.has(t.name.slice(n))&&s.push(f(e,t.name))}},Ee=(e,s)=>{const{info:r}=z(e,s);return{jurisdiction:r?.jurisdiction,needsD1:r?.hasD1GlobalTable??!1}},ye=(e,s,r)=>{const t=Se(),n=f(e,r),a=[],h=[];let c=!1,l=!1;for(const i of s){const d=f(e,i);if(!O(d)||!T(d).isDirectory())continue;const E=[];w(d,E);for(const u of E){const m=j(u,"utf8"),x=ce(u,n);c||=he.test(m),l||=me.test(m),(fe.test(m)||x&&K(m))&&(x?a:h).push(ve(m,u,t))}}const g=I(a),b=I([g,...h]),S=new Set([...b.valueImports,...b.dynamicImports]),p=U({contextReads:g.contextReads,valueImports:S});return{...Object.fromEntries([...R.map(i=>[$(i),p.has(i)]),...C.map(([i,d])=>[i,S.has(d)])]),needsD1:l,usesAi:p.has("ai")||c,usesBrowser:p.has("browser")||g.sandboxTools.usesSandboxBrowser,usesWorkerLoader:g.sandboxTools.usesSandboxLoader}},Ae=(e,s,r)=>[...e.map(t=>t.exported?`${t.bindingName}/${t.className} (container "${t.exportName}" declared and exported)`:`hint: container "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...s.map(t=>t.exported?`exports.${t.className} (workflow "${t.exportName}" declared and exported)`:`hint: workflow "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...r.map(t=>t.exported?`exports.${t.className} (agent "${t.exportName}" declared and exported)`:`hint: agent "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],xe=(e,s,r)=>[[e.usesAi,`AI (${o("ai")}, or env.AI is used)`],[e.usesAuth&&!s.has("SessionDO"),"hint: @lunora/auth is imported; its tables are D1-backed by default. For DO-backed auth (what @better-auth/scim needs), pass `namespace` to .auth() and export the generated auth DO class"],[e.usesScheduler&&!s.has("SchedulerDO"),`hint: ${o("scheduler")}, but no SchedulerDO is exported by the worker entry`],[e.usesStorage,`hint: ${o("storage")}; add an r2_buckets binding (bucket binding names are user-defined)`],[e.usesMail,`hint: ${o("mail")}; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)`],[e.usesPayments,`hint: ${o("payments")}; set the provider secrets in .dev.vars — ${be}`],[e.usesBrowser,`browser (${o("browser")}, or a sandbox browserTool imported in lunora/) — self-describing { binding: BROWSER }`],[e.usesImages,`images (${o("images")}) — self-describing { binding: IMAGES }`],[e.usesAnalytics,`analytics_engine_datasets (${o("analytics")}) — self-describing { binding: ANALYTICS, dataset }`],[e.usesWorkerLoader,"worker_loaders (jsCodeTool imported in lunora/) — self-describing { binding: LOADER }"],[e.usesAiSearch,`ai_search_namespaces (${o("aiSearch")}) — self-describing { binding: AI_SEARCH, namespace: "default" }; remote-only, so \`lunora dev\` reaches the deployed AI Search service`],[e.usesAnalyticsSql,`analytics (${o("analyticsSql")}) — self-describing { binding: ANALYTICS_SQL }; needs wrangler >= 4.145.0, and is remote-only, so \`lunora dev\` queries the account's live analytics`],[e.usesKv,`hint: ${o("kv")}; add a kv_namespaces binding ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned`],[e.usesHyperdrive,`hint: ${o("hyperdrive")}; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned`],[e.usesPipelines,`hint: ${o("pipelines")}; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, stream }) — the pipeline resource can't be auto-provisioned`],[e.usesArtifacts,`hint: ${ae(r.jurisdiction)}`],[e.usesX402Charge,"hint: @lunora/x402/charge is imported; set the recipient wallet address as a [vars] entry (the var name is yours to choose) and pass it to the charge config — the x402 facilitator settles USDC to that address"],[e.usesX402,`hint: ${o("x402")} (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding for the agent wallet key (name it to match signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars, so the key can't be auto-provisioned`]].filter(([n])=>n).map(([,n])=>n),Ie=(e,s,r,t=[],n=[],a=[])=>{const h=new Set(e.map(l=>l.className)),c=e.map(l=>`${l.binding}/${l.className} (exported by worker entry)`);return s.needsD1&&c.push("DB (.global() table declared)"),c.push(...Ae(t,n,a),...xe(r,h,s)),c},Be=async e=>{await q;const s=e.schemaDir??"lunora",r=e.scanDirs??pe,t=ye(e.projectRoot,r,s),n=Z(e.projectRoot);let a;n.composed?a=ee(f(e.projectRoot,s,A)).map(m=>({binding:se[m],className:m})):a=n.path===void 0?[]:te(n.path);const h=Ee(e.projectRoot,s),c={...h,needsD1:t.needsD1||h.needsD1},l=y(n,H(e.projectRoot,s).containers,"containers"),g=y(n,ne(e.projectRoot,s).workflows,"workflows"),b=y(n,M(e.projectRoot,s).agents,"agents"),S=[...de(e.projectRoot,s).queues],{flags:p}=ie(e.projectRoot,s),v=p?.provider==="flagship"&&p.mode==="binding"?p.bindingName:void 0,i=Ie(a,c,t,l,g,b);!n.composed&&re(f(e.projectRoot,s,A))&&!a.some(u=>u.className==="LunoraDO")&&i.push("hint: durableObjects.merge is set, but the worker entry exports no LunoraDO — export one built with mergeDurableObjects, or the classes stay separate"),v!==void 0&&i.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${v}", app_id }) — the app_id can't be auto-provisioned`);const d=G(e.projectRoot),E=d.error===void 0?d.services:void 0;return d.error!==void 0&&i.push(`hint: lunora.config \`services\` not reconciled — ${d.error}`),i.push(...d.services.map(u=>`${u.binding} → ${u.worker} (lunora.config services.${u.name})`)),{...t,agents:b,containers:l,durableObjects:a,flagshipBinding:v,...c.jurisdiction===void 0?{}:{jurisdiction:c.jurisdiction},needsD1:c.needsD1,queues:S,services:E,signals:i,usesFlags:p!==void 0,workflows:g}},ke=e=>N.filter(([s])=>e[s]).map(([,s])=>s);export{ae as a,Be as i,ke as p};
@@ -235,6 +235,18 @@ interface DurableObjectSpec {
235
235
  binding: string;
236
236
  className: string;
237
237
  }
238
+ /**
239
+ * Canonical Durable Object class → binding name. wrangler requires the worker
240
+ * to export a class of this exact name, so detection keys on the class name.
241
+ */
242
+ declare const DURABLE_OBJECT_BINDINGS: {
243
+ readonly LunoraDO: "SHARD";
244
+ readonly SchedulerDO: "SCHEDULER";
245
+ readonly SessionDO: "SESSION";
246
+ readonly ShardDO: "SHARD";
247
+ readonly ShardRegistryDO: "SHARD_REGISTRY";
248
+ };
249
+ type DurableObjectClass = keyof typeof DURABLE_OBJECT_BINDINGS;
238
250
  /**
239
251
  * The `_generated/` modules that hold a generated Durable Object / Workflow
240
252
  * class — one per class kind a project can declare. wrangler validates every
@@ -258,6 +270,24 @@ interface DurableObjectSpec {
258
270
  declare const GENERATED_CLASS_MODULES: readonly ["agents", "containers", "scheduler", "shardRegistry", "workflows"];
259
271
  /** One {@link GENERATED_CLASS_MODULES} entry. */
260
272
  type GeneratedClassModule = (typeof GENERATED_CLASS_MODULES)[number];
273
+ /**
274
+ * The framework Durable Object each class module forwards, for the modules that
275
+ * carry one: codegen writes them off the same signal that gives the builder the
276
+ * matching method, so the module's existence means the composed entry exports
277
+ * the class.
278
+ */
279
+ declare const GENERATED_MODULE_DURABLE_OBJECTS: Partial<Record<GeneratedClassModule, DurableObjectClass>>;
280
+ /** The `_generated/` module codegen writes when `lunora.config` opts in to the merge. */
281
+ declare const MERGED_DURABLE_OBJECTS_MODULE: "durableObjects";
282
+ /**
283
+ * Whether the project merges its Durable Objects: codegen wrote the merge
284
+ * module. The one test the composed entry, binding inference and the export
285
+ * validator all ask — the same "module existence is the signal" rule the
286
+ * scheduler and registry modules follow.
287
+ */
288
+ declare const isMergedProject: (generatedDirectory: string) => boolean;
289
+ /** Whether `module` holds a class the merged class hosts — imported into it, never re-exported. */
290
+ declare const isMergedRoleModule: (module: string) => boolean;
261
291
  /**
262
292
  * The class-B composed entry. `lunora deploy` passes this file to wrangler as
263
293
  * the positional script whenever it exists, overriding `wrangler.main` — so it
@@ -418,4 +448,4 @@ declare const inferLunoraBindings: (options: InferOptions) => Promise<InferredBi
418
448
  * the flags that are `true` in `bindings` — in flag-name order.
419
449
  */
420
450
  declare const packageNamesFromBindings: (bindings: InferredBindings) => string[];
421
- export { COMPOSED_WORKER_ENTRY as C, DeployDriver as D, GeneratedClassModule as G, InferredBindings as I, ProjectionPurpose as P, SchemaInfo as S, ToolchainCommand as T, DeployRequest as a, DevRequest as b, DiscoverSchemaInfoResult as c, DriverToolchain as d, GENERATED_CLASS_MODULES as e, InferOptions as f, InferredAgent as g, InferredContainer as h, InferredWorkflow as i, ProjectedConfig as j, SecretRequest as k, TailRequest as l, discoverSchemaInfo as m, inferLunoraBindings as n, packageNamesFromBindings as p };
451
+ export { COMPOSED_WORKER_ENTRY as C, DeployDriver as D, GeneratedClassModule as G, InferredBindings as I, MERGED_DURABLE_OBJECTS_MODULE as M, ProjectionPurpose as P, SchemaInfo as S, ToolchainCommand as T, DURABLE_OBJECT_BINDINGS as a, DeployRequest as b, DevRequest as c, DiscoverSchemaInfoResult as d, DriverToolchain as e, GENERATED_CLASS_MODULES as f, GENERATED_MODULE_DURABLE_OBJECTS as g, InferOptions as h, InferredAgent as i, InferredContainer as j, InferredWorkflow as k, ProjectedConfig as l, SecretRequest as m, TailRequest as n, discoverSchemaInfo as o, inferLunoraBindings as p, isMergedProject as q, isMergedRoleModule as r, packageNamesFromBindings as s };
@@ -235,6 +235,18 @@ interface DurableObjectSpec {
235
235
  binding: string;
236
236
  className: string;
237
237
  }
238
+ /**
239
+ * Canonical Durable Object class → binding name. wrangler requires the worker
240
+ * to export a class of this exact name, so detection keys on the class name.
241
+ */
242
+ declare const DURABLE_OBJECT_BINDINGS: {
243
+ readonly LunoraDO: "SHARD";
244
+ readonly SchedulerDO: "SCHEDULER";
245
+ readonly SessionDO: "SESSION";
246
+ readonly ShardDO: "SHARD";
247
+ readonly ShardRegistryDO: "SHARD_REGISTRY";
248
+ };
249
+ type DurableObjectClass = keyof typeof DURABLE_OBJECT_BINDINGS;
238
250
  /**
239
251
  * The `_generated/` modules that hold a generated Durable Object / Workflow
240
252
  * class — one per class kind a project can declare. wrangler validates every
@@ -258,6 +270,24 @@ interface DurableObjectSpec {
258
270
  declare const GENERATED_CLASS_MODULES: readonly ["agents", "containers", "scheduler", "shardRegistry", "workflows"];
259
271
  /** One {@link GENERATED_CLASS_MODULES} entry. */
260
272
  type GeneratedClassModule = (typeof GENERATED_CLASS_MODULES)[number];
273
+ /**
274
+ * The framework Durable Object each class module forwards, for the modules that
275
+ * carry one: codegen writes them off the same signal that gives the builder the
276
+ * matching method, so the module's existence means the composed entry exports
277
+ * the class.
278
+ */
279
+ declare const GENERATED_MODULE_DURABLE_OBJECTS: Partial<Record<GeneratedClassModule, DurableObjectClass>>;
280
+ /** The `_generated/` module codegen writes when `lunora.config` opts in to the merge. */
281
+ declare const MERGED_DURABLE_OBJECTS_MODULE: "durableObjects";
282
+ /**
283
+ * Whether the project merges its Durable Objects: codegen wrote the merge
284
+ * module. The one test the composed entry, binding inference and the export
285
+ * validator all ask — the same "module existence is the signal" rule the
286
+ * scheduler and registry modules follow.
287
+ */
288
+ declare const isMergedProject: (generatedDirectory: string) => boolean;
289
+ /** Whether `module` holds a class the merged class hosts — imported into it, never re-exported. */
290
+ declare const isMergedRoleModule: (module: string) => boolean;
261
291
  /**
262
292
  * The class-B composed entry. `lunora deploy` passes this file to wrangler as
263
293
  * the positional script whenever it exists, overriding `wrangler.main` — so it
@@ -418,4 +448,4 @@ declare const inferLunoraBindings: (options: InferOptions) => Promise<InferredBi
418
448
  * the flags that are `true` in `bindings` — in flag-name order.
419
449
  */
420
450
  declare const packageNamesFromBindings: (bindings: InferredBindings) => string[];
421
- export { COMPOSED_WORKER_ENTRY as C, DeployDriver as D, GeneratedClassModule as G, InferredBindings as I, ProjectionPurpose as P, SchemaInfo as S, ToolchainCommand as T, DeployRequest as a, DevRequest as b, DiscoverSchemaInfoResult as c, DriverToolchain as d, GENERATED_CLASS_MODULES as e, InferOptions as f, InferredAgent as g, InferredContainer as h, InferredWorkflow as i, ProjectedConfig as j, SecretRequest as k, TailRequest as l, discoverSchemaInfo as m, inferLunoraBindings as n, packageNamesFromBindings as p };
451
+ export { COMPOSED_WORKER_ENTRY as C, DeployDriver as D, GeneratedClassModule as G, InferredBindings as I, MERGED_DURABLE_OBJECTS_MODULE as M, ProjectionPurpose as P, SchemaInfo as S, ToolchainCommand as T, DURABLE_OBJECT_BINDINGS as a, DeployRequest as b, DevRequest as c, DiscoverSchemaInfoResult as d, DriverToolchain as e, GENERATED_CLASS_MODULES as f, GENERATED_MODULE_DURABLE_OBJECTS as g, InferOptions as h, InferredAgent as i, InferredContainer as j, InferredWorkflow as k, ProjectedConfig as l, SecretRequest as m, TailRequest as n, discoverSchemaInfo as o, inferLunoraBindings as p, isMergedProject as q, isMergedRoleModule as r, packageNamesFromBindings as s };
@@ -1 +1 @@
1
- import"./discoverAgentInfo-CTdCSfYM.mjs";import{i as s,p as e}from"./infer-bindings-B-BFynp2.mjs";import"./discoverContainerInfo-EhZtEBQs.mjs";import"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import"./discoverSchemaInfo-BguahM6z.mjs";import"./COMPOSED_WORKER_ENTRY-C69wqbSP.mjs";import"./discoverWorkflowInfo-BsPvlo6O.mjs";export{s as inferLunoraBindings,e as packageNamesFromBindings};
1
+ import"./discoverAgentInfo-CTdCSfYM.mjs";import{i as s,p as e}from"./infer-bindings-B626aaRY.mjs";import"./discoverContainerInfo-EhZtEBQs.mjs";import"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import"./discoverSchemaInfo-BguahM6z.mjs";import"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import"./discoverWorkflowInfo-BsPvlo6O.mjs";export{s as inferLunoraBindings,e as packageNamesFromBindings};
@@ -0,0 +1,6 @@
1
+ import{readFileSync as b,writeFileSync as v}from"node:fs";import{applyEdits as $,modify as S,parseTree as N,findNodeAtLocation as g}from"jsonc-parser";import{join as h}from"node:path";const A=/^([\t ]+)"/mu,F=n=>{const o=A.exec(n)?.[1]??" ";return{eol:n.includes(`\r
2
+ `)?`\r
3
+ `:`
4
+ `,insertSpaces:!o.startsWith(" "),tabSize:o.length}},I=n=>{const o=h(n,"package.json");try{const t=b(o,"utf8"),{lunora:r}=JSON.parse(t),e=typeof r=="object"&&r!==null&&!Array.isArray(r);return{lunora:e?r:void 0,lunoraIsForeign:r!==void 0&&!e,path:o,text:t}}catch{return}},p=n=>JSON.stringify(n,(o,t)=>typeof t=="object"&&t!==null&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).toSorted(([r],[e])=>r.localeCompare(e))):t),j=(n,o,t)=>{const r=F(n),e=r.insertSpaces===!1?" ":" ".repeat(r.tabSize??4),i=r.eol??`
5
+ `,c=e.repeat(o.length),f=JSON.stringify(t,void 0,e).split(`
6
+ `).join(i+c),l=N(n),a=l===void 0?void 0:g(l,[...o]);if(a!==void 0)return n.slice(0,a.offset)+f+n.slice(a.offset+a.length);let s=l;l!==void 0&&o.length>1&&(s=g(l,o.slice(0,-1)));const y=JSON.stringify(o.at(-1));if(s===void 0&&o.length>1)return j(n,o.slice(0,-1),{[o.at(-1)]:t});if(s?.type!=="object")return $(n,S(n,[...o],t,{formattingOptions:r}));const d=s.children?.at(-1);if(d===void 0){const O=`${i}${c}${y}: ${f}${i}${e.repeat(o.length-1)}`;return`${n.slice(0,s.offset+1)}${O}${n.slice(s.offset+s.length-1)}`}const u=d.offset+d.length;return`${n.slice(0,u)},${i}${c}${y}: ${f}${n.slice(u)}`},K=(n,o,t)=>{const r=Object.keys(n.lunora??{}).every(c=>c===o);if(n.lunoraIsForeign||p(n.lunora?.[o])===p(t))return;const e=t===void 0&&r?["lunora"]:["lunora",o],i=t===void 0?$(n.text,S(n.text,e,void 0,{})):j(n.text,e,t);i!==n.text&&v(n.path,i,"utf8")};export{K as a,p as c,F as f,I as r};
@@ -1 +1 @@
1
- import{writeFileSync as a}from"node:fs";import{isAbsolute as p,dirname as d,resolve as f,join as m}from"node:path";import{applyModify as l}from"./applyModify-DKP2l6S9.mjs";import{createCleanup as u}from"./REMOTE_ELIGIBLE_KEYS-DioKi8jL.mjs";import{readWranglerJsonc as g}from"./WRANGLER_FILES-UNW-xY5u.mjs";let c=0;const v=e=>{const{parsed:t,text:r}=g(e),o=t?.build;if(typeof o?.command!="string"||o.command===""||typeof o.cwd=="string"&&p(o.cwd))return{configPath:e};const i=d(e),s=f(i,typeof o.cwd=="string"?o.cwd:".");c+=1;const n=m(i,`.wrangler.lunora-service.${String(process.pid)}.${String(c)}.jsonc`);return a(n,l(r,["build","cwd"],s),"utf8"),{cleanup:u(n),configPath:n}},j=e=>{const t=e.map(o=>v(o)),r=t.flatMap(o=>o.cleanup===void 0?[]:[o.cleanup]);return{cleanup:()=>{for(const o of r)o()},configPaths:t.map(o=>o.configPath)}};export{j as materializeServiceDevConfigs};
1
+ import{writeFileSync as a}from"node:fs";import{isAbsolute as p,dirname as d,resolve as f,join as m}from"node:path";import{applyModify as l}from"./applyModify-DKP2l6S9.mjs";import{createCleanup as u}from"./REMOTE_ELIGIBLE_KEYS-DPv7P69m.mjs";import{readWranglerJsonc as g}from"./WRANGLER_FILES-UNW-xY5u.mjs";let c=0;const v=e=>{const{parsed:t,text:r}=g(e),o=t?.build;if(typeof o?.command!="string"||o.command===""||typeof o.cwd=="string"&&p(o.cwd))return{configPath:e};const i=d(e),s=f(i,typeof o.cwd=="string"?o.cwd:".");c+=1;const n=m(i,`.wrangler.lunora-service.${String(process.pid)}.${String(c)}.jsonc`);return a(n,l(r,["build","cwd"],s),"utf8"),{cleanup:u(n),configPath:n}},j=e=>{const t=e.map(o=>v(o)),r=t.flatMap(o=>o.cleanup===void 0?[]:[o.cleanup]);return{cleanup:()=>{for(const o of r)o()},configPaths:t.map(o=>o.configPath)}};export{j as materializeServiceDevConfigs};
@@ -0,0 +1 @@
1
+ import{join as o}from"node:path";import{readJsonSync as c}from"@visulima/fs";const r=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),s=e=>{try{const n=c(o(e,"package.json"));return r(n)?n:void 0}catch{return}},t=e=>r(e)?Object.fromEntries(Object.entries(e).filter(n=>typeof n[1]=="string")):{},i=e=>{const n=s(e);return{...t(n?.devDependencies),...t(n?.dependencies)}},p=e=>new Set(Object.keys(i(e)));export{i as readProjectDependencies,p as readProjectDependencyNames,s as readProjectManifest};
@@ -1 +1 @@
1
- import{existsSync as C,writeFileSync as k}from"node:fs";import{applyModify as _}from"./applyModify-DKP2l6S9.mjs";import{c as h,a as A}from"./lunora-manifest-v90ZUbVp.mjs";import{readWranglerJsonc as D}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{join as F}from"node:path";const O="services",$="services",S="wrangler.dev.jsonc",f="dev:services",M=(n,t)=>{const s=t===void 0?n.worker:n.envWorkers[t]??`${n.worker}-${t}`;return{binding:n.binding,...n.entrypoint===void 0?{}:{entrypoint:n.entrypoint},service:s}},g=n=>typeof n?.binding=="string"?n.binding:"",b=(n,t,s,d,p,o)=>{const i=t.join("."),r=new Map(d.map(e=>[e.binding,M(e,o)])),a=s.filter(e=>!p.has(g(e))),w=new Set(a.map(e=>g(e))),c=new Map(s.filter(e=>p.has(g(e))).map(e=>[g(e),e])),u=[...r].filter(([e])=>!w.has(e)),v=[...a,...u.map(([,e])=>e)],m=u.filter(([e])=>!c.has(e)).map(([e,l])=>`${i}/${e} → ${l.service??""}`),y=[...u.filter(([e,l])=>c.has(e)&&h(c.get(e))!==h(l)).map(([e])=>`${i}/${e}`),...[...c.keys()].filter(e=>!r.has(e)).map(e=>`${i}/${e} (removed)`)],x=a.filter(e=>r.has(g(e))&&h(e)!==h(r.get(g(e)))).map(e=>`${i}: the hand-written "${g(e)}" entry is left as is — remove it to let lunora.config \`services\` manage that binding.`),E=m.length>0||y.length>0,j=v.length===0?void 0:v;return{added:m,owned:u.map(([e])=>e).toSorted((e,l)=>e.localeCompare(l)),text:E?_(n,t,j):n,updated:y,warnings:x}},V=n=>{const t=n?.lunora?.[O];return typeof t!="object"||t===null||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).filter(s=>Array.isArray(s[1])&&s[1].every(d=>typeof d=="string")))},G=n=>new Set(V(n)[$]),L=(n,t,s,d)=>{const p=[{current:t.services??[],path:[$]},...Object.entries(t.env??{}).map(([i,r])=>({current:r?.services??[],environment:i,path:["env",i,"services"]}))],o={added:[],owned:{},text:n,updated:[],warnings:[]};for(const{current:i,environment:r,path:a}of p){const w=a.join("."),c=b(o.text,a,i,s,new Set(d[w]),r);o.text=c.text,o.added.push(...c.added),o.updated?.push(...c.updated??[]),o.warnings?.push(...c.warnings??[]),c.owned.length>0&&(o.owned[w]=c.owned)}return o},N=(n,t,s)=>{const d=F(n,S),p={added:[],path:d,updated:[],warnings:[]};if(t.length===0&&s[f]===void 0)return{...p,owned:{}};const{parsed:o,text:i}=C(d)?D(d):{parsed:void 0,text:""};if(o===void 0){const a=s[f];return{...p,owned:a===void 0||a.length===0?{}:{[f]:a}}}const r=b(i,["services"],o.services??[],t,new Set(s[f]),void 0);return r.text!==i&&k(d,r.text,"utf8"),{added:r.added,owned:r.owned.length>0?{[f]:r.owned}:{},path:d,updated:r.updated??[],warnings:(r.warnings??[]).map(a=>`${S} ${a}`)}},J=(n,t)=>{A(n,O,Object.keys(t).length===0?void 0:t)};export{L as a,N as b,J as c,G as o,V as r};
1
+ import{existsSync as C,writeFileSync as k}from"node:fs";import{applyModify as _}from"./applyModify-DKP2l6S9.mjs";import{c as h,a as A}from"./lunora-manifest-DuH_Cmyu.mjs";import{readWranglerJsonc as D}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{join as F}from"node:path";const O="services",$="services",S="wrangler.dev.jsonc",f="dev:services",M=(n,t)=>{const s=t===void 0?n.worker:n.envWorkers[t]??`${n.worker}-${t}`;return{binding:n.binding,...n.entrypoint===void 0?{}:{entrypoint:n.entrypoint},service:s}},g=n=>typeof n?.binding=="string"?n.binding:"",b=(n,t,s,d,p,o)=>{const i=t.join("."),r=new Map(d.map(e=>[e.binding,M(e,o)])),a=s.filter(e=>!p.has(g(e))),w=new Set(a.map(e=>g(e))),c=new Map(s.filter(e=>p.has(g(e))).map(e=>[g(e),e])),u=[...r].filter(([e])=>!w.has(e)),v=[...a,...u.map(([,e])=>e)],m=u.filter(([e])=>!c.has(e)).map(([e,l])=>`${i}/${e} → ${l.service??""}`),y=[...u.filter(([e,l])=>c.has(e)&&h(c.get(e))!==h(l)).map(([e])=>`${i}/${e}`),...[...c.keys()].filter(e=>!r.has(e)).map(e=>`${i}/${e} (removed)`)],x=a.filter(e=>r.has(g(e))&&h(e)!==h(r.get(g(e)))).map(e=>`${i}: the hand-written "${g(e)}" entry is left as is — remove it to let lunora.config \`services\` manage that binding.`),E=m.length>0||y.length>0,j=v.length===0?void 0:v;return{added:m,owned:u.map(([e])=>e).toSorted((e,l)=>e.localeCompare(l)),text:E?_(n,t,j):n,updated:y,warnings:x}},V=n=>{const t=n?.lunora?.[O];return typeof t!="object"||t===null||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).filter(s=>Array.isArray(s[1])&&s[1].every(d=>typeof d=="string")))},G=n=>new Set(V(n)[$]),L=(n,t,s,d)=>{const p=[{current:t.services??[],path:[$]},...Object.entries(t.env??{}).map(([i,r])=>({current:r?.services??[],environment:i,path:["env",i,"services"]}))],o={added:[],owned:{},text:n,updated:[],warnings:[]};for(const{current:i,environment:r,path:a}of p){const w=a.join("."),c=b(o.text,a,i,s,new Set(d[w]),r);o.text=c.text,o.added.push(...c.added),o.updated?.push(...c.updated??[]),o.warnings?.push(...c.warnings??[]),c.owned.length>0&&(o.owned[w]=c.owned)}return o},N=(n,t,s)=>{const d=F(n,S),p={added:[],path:d,updated:[],warnings:[]};if(t.length===0&&s[f]===void 0)return{...p,owned:{}};const{parsed:o,text:i}=C(d)?D(d):{parsed:void 0,text:""};if(o===void 0){const a=s[f];return{...p,owned:a===void 0||a.length===0?{}:{[f]:a}}}const r=b(i,["services"],o.services??[],t,new Set(s[f]),void 0);return r.text!==i&&k(d,r.text,"utf8"),{added:r.added,owned:r.owned.length>0?{[f]:r.owned}:{},path:d,updated:r.updated??[],warnings:(r.warnings??[]).map(a=>`${S} ${a}`)}},J=(n,t)=>{A(n,O,Object.keys(t).length===0?void 0:t)};export{L as a,N as b,J as c,G as o,V as r};
@@ -1 +1 @@
1
- import{i as p}from"./infer-bindings-B-BFynp2.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-CiQM3BkI.mjs";import{reconcileWranglerBindings as $}from"./collectExportGaps-qqrrR5x_.mjs";import{reconcileWranglerCompatibilityDate as g}from"./reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{reconcileWranglerCrons as m,describePreservedCrons as w}from"./describePreservedCrons-7gaDLxWx.mjs";const j=async(i,t,a)=>{try{const n=await p({projectRoot:i.projectRoot,schemaDir:i.schemaDir}),e=$(i.projectRoot,n),o=e.wranglerPath??"wrangler.jsonc";if(e.added.length>0&&t.info?.(`${r} inferred bindings → ${e.added.join(", ")} (written to ${o})`),e.updated.length>0&&t.info?.(`${r} updated bindings → ${e.updated.join(", ")} (written to ${o})`),e.devConfig!==void 0){const{added:s,path:d,updated:f}=e.devConfig;t.info?.(`${r} dev sidecar bindings → ${[...s,...f].join(", ")} (written to ${d})`)}for(const s of e.warnings)t.warn(`${r} ${s}`);e.exportGaps.length>0&&a?.(e.exportGaps)}catch(n){const e=n instanceof Error?n.message:String(n);t.warn(`${r} binding inference skipped: ${e}`)}},c=new Map,u=(i,t,a)=>{try{const n=m(i,t);n.changed&&a.info?.(`${r} synced ${t.length.toFixed(0)} cron trigger(s) into ${n.wranglerPath??"wrangler.jsonc"}`);for(const s of n.warnings)a.warn(`${r} ${s}`);const e=n.preserved.join("\0"),o=w(n.preserved);o!==void 0&&(n.changed||c.get(i)!==e)&&a.info?.(`${r} ${o}`),c.set(i,e)}catch(n){const e=n instanceof Error?n.message:String(n);a.warn(`${r} cron trigger sync skipped: ${e}`)}try{const n=g(i);n.changed&&a.info?.(`${r} bumped compatibility_date to ${n.date??"unknown"} (Workers Cache enabled) → ${n.wranglerPath??"wrangler.jsonc"}`)}catch(n){const e=n instanceof Error?n.message:String(n);a.warn(`${r} compatibility date sync skipped: ${e}`)}};export{j as reconcileBindingsSafely,u as reconcileWranglerExtras};
1
+ import{i as p}from"./infer-bindings-B626aaRY.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-CiQM3BkI.mjs";import{reconcileWranglerBindings as $}from"./collectExportGaps-BVgzeBX5.mjs";import{reconcileWranglerCompatibilityDate as g}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 p({projectRoot:i.projectRoot,schemaDir:i.schemaDir}),e=$(i.projectRoot,n),o=e.wranglerPath??"wrangler.jsonc";if(e.added.length>0&&t.info?.(`${r} inferred bindings → ${e.added.join(", ")} (written to ${o})`),e.updated.length>0&&t.info?.(`${r} updated bindings → ${e.updated.join(", ")} (written to ${o})`),e.devConfig!==void 0){const{added:s,path:d,updated:f}=e.devConfig;t.info?.(`${r} dev sidecar bindings → ${[...s,...f].join(", ")} (written to ${d})`)}for(const s of e.warnings)t.warn(`${r} ${s}`);e.exportGaps.length>0&&a?.(e.exportGaps)}catch(n){const e=n instanceof Error?n.message:String(n);t.warn(`${r} binding inference skipped: ${e}`)}},c=new Map,u=(i,t,a)=>{try{const n=m(i,t);n.changed&&a.info?.(`${r} synced ${t.length.toFixed(0)} cron trigger(s) into ${n.wranglerPath??"wrangler.jsonc"}`);for(const s of n.warnings)a.warn(`${r} ${s}`);const e=n.preserved.join("\0"),o=w(n.preserved);o!==void 0&&(n.changed||c.get(i)!==e)&&a.info?.(`${r} ${o}`),c.set(i,e)}catch(n){const e=n instanceof Error?n.message:String(n);a.warn(`${r} cron trigger sync skipped: ${e}`)}try{const n=g(i);n.changed&&a.info?.(`${r} bumped compatibility_date to ${n.date??"unknown"} (Workers Cache enabled) → ${n.wranglerPath??"wrangler.jsonc"}`)}catch(n){const e=n instanceof Error?n.message:String(n);a.warn(`${r} compatibility date sync skipped: ${e}`)}};export{j as reconcileBindingsSafely,u as reconcileWranglerExtras};
@@ -0,0 +1 @@
1
+ import{spawn as i}from"node:child_process";import{runScriptArgsFor as d,detectPackageManager as u}from"./addArgsFor-CYZKhNIo.mjs";import{readProjectManifest as g}from"./readProjectDependencies-l3uhUKjo.mjs";const s="postcodegen",f=r=>new Promise((e,o)=>{const n=i(r.command,[...r.args],{cwd:r.cwd??process.cwd(),shell:process.platform==="win32",stdio:["inherit",r.stdoutToStderr===!0?2:"inherit","inherit"]});n.on("error",o),n.on("close",c=>{e({code:c??1})})}),l=r=>{const e=g(r)?.scripts,o=typeof e=="object"&&e!==null?e[s]:void 0;return typeof o=="string"&&o!==""},w=async r=>{const{cwd:e,logger:o}=r;if(!l(e))return{ran:!1};const n=t=>(o.error(t),{error:t,ran:!0});let c;try{c=d(u(e),s)}catch(t){return n(`cannot run \`${s}\`: ${t instanceof Error?t.message:String(t)}`)}o.info(`running \`${s}\``);let a;try{a=await(r.spawner??f)({args:c.args,command:c.command,cwd:e,stdoutToStderr:r.stdoutToStderr})}catch(t){return n(`\`${s}\` failed to start: ${t instanceof Error?t.message:String(t)}`)}return a.code!==0?n(`\`${s}\` exited ${String(a.code)}`):{ran:!0}};export{w as runPostCodegenHook};
@@ -1 +1 @@
1
- import{CUSTOM_INSTANCE_TYPE_LIMITS as f,CUSTOM_INSTANCE_MIN_MEMORY_MIB_PER_VCPU as y}from"@lunora/container";const g=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),d=e=>typeof e=="string"&&e.length>0,h=[{of:e=>e.schedules===void 0?void 0:[...e.schedules],path:["schedules"]},{of:e=>e.limits?.steps,path:["limits","steps"]},{of:e=>e.defaultRetention?.successRetention,path:["default_retention","success_retention"]},{of:e=>e.defaultRetention?.errorRetention,path:["default_retention","error_retention"]}],U=[...new Set(h.map(({path:e})=>e[0]))],_=(e,n)=>{let a=e;for(const s of n)a=g(a)?a[s]:void 0;return a},B=e=>{const n={};for(const{of:a,path:s}of h){const t=a(e);if(t===void 0)continue;const[i,o]=s;n[i]=o===void 0?t:{...n[i],[o]:t}}return n},L=(e,n,a)=>{if(n.length===0)return;const s=e.vectorize??[],t=new Set(s.filter(Boolean).map(i=>i?.index_name));for(const i of n)t.has(i)||a.push(`schema declares vector index "${i}"; wrangler "vectorize" must include a binding with index_name "${i}"`)},M=new Set(["basic","dev","lite","standard","standard-1","standard-2","standard-3","standard-4"]),S={disk_mb:f.diskMb,memory_mib:f.memoryMib,vcpu:{...f.vcpu,hint:'use the named "lite" or "basic" instance type below 1 vCPU'}},j=(e,n,a)=>{const s=e.instance_type;if(s===void 0)return;if(typeof s=="string"){M.has(s)||a.push(`${n} has unknown instance_type "${s}" — expected lite, basic, standard-1..4, or a custom { vcpu, memory_mib, disk_mb } object`);return}for(const[o,{hint:r,max:c,min:u}]of Object.entries(S)){const m=s[o];if(m!==void 0&&(typeof m!="number"||Number.isNaN(m)||m<u||m>c)){const w=r!==void 0&&typeof m=="number"&&m<u?` — ${r}`:"";a.push(`${n} custom instance_type ${o} must be a number in ${String(u)}–${String(c)} (got ${String(m)})${w}`)}}const{memory_mib:t,vcpu:i}=s;typeof i=="number"&&typeof t=="number"&&t<i*y&&a.push(`${n} custom instance_type needs ≥ 3 GiB (${String(y)} MiB) memory per vCPU (got ${String(t)} MiB for ${String(i)} vCPU)`)},E=(e,n,a)=>{for(const s of["image","instance_type","max_instances"])e[s]!==void 0&&a.push(`${n} sets "${s}", which the durable_object scheduling policy does not take — the Durable Object picks image and size at start`);for(const[s,t]of Object.entries(e.images??{}))[t?.dockerfile,t?.image].filter(o=>typeof o=="string"&&o.length>0).length!==1&&a.push(`${n} images["${s}"] must set exactly one of "dockerfile" or "image"`)},A=(e,n,a)=>{const{boundClasses:s,classKinds:t,errors:i,warnings:o}=a;if(!e||typeof e!="object"||typeof e.class_name!="string"||e.class_name.length===0){i.push(`${n} must have a non-empty "class_name" naming its container-enabled Durable Object class`);return}const r=e.scheduling_policy==="durable_object";e.scheduling_policy!==void 0&&e.scheduling_policy!=="default"&&!r&&i.push(`${n} ("${e.class_name}") has unknown scheduling_policy "${e.scheduling_policy}" — expected "default" or "durable_object"`),r?E(e,`${n} ("${e.class_name}")`,i):(typeof e.image!="string"||e.image.length===0)&&i.push(`${n} ("${e.class_name}") must have an "image" — a Dockerfile path or a registry reference`),s.has(e.class_name)||i.push(`${n} class "${e.class_name}" has no matching durable_objects binding — your dev server auto-reconciles this on startup; add { "name": "...", "class_name": "${e.class_name}" } to fix it by hand`);const c=t.get(e.class_name);c!=="sqlite"&&i.push(c==="classic"?`${n} class "${e.class_name}" is registered via "new_classes" but containers require SQLite-backed DOs — move it to "new_sqlite_classes"`:`${n} class "${e.class_name}" is missing from migrations — add a migration entry with "new_sqlite_classes": ["${e.class_name}"]`),j(e,`${n} ("${e.class_name}")`,i),e.max_instances===void 0&&!r&&o.push(`${n} ("${e.class_name}") declares no max_instances — set a cap so a traffic spike can't fan out unbounded container spend`)},b=e=>Array.isArray(e)?e.filter(n=>n!==null&&typeof n=="object"):[],p=e=>Array.isArray(e)?e.filter(n=>d(n)):[],k=e=>{const n=new Map;for(const a of b(e)){for(const s of p(a.new_classes))n.set(s,"classic");for(const s of p(a.new_sqlite_classes))n.set(s,"sqlite");for(const s of b(a.renamed_classes))if(d(s.from)&&d(s.to)){const t=n.get(s.from)??"sqlite";n.delete(s.from),n.set(s.to,t)}for(const s of p(a.deleted_classes))n.delete(s)}return n},x=e=>new Set(k(e).keys()),F=(e,n)=>{const a=x(e.migrations);for(const s of b(e.durable_objects?.bindings))s.script_name===void 0&&d(s.class_name)&&!a.has(s.class_name)&&n.push(`durable_objects.bindings declares class "${s.class_name}" but it is missing from migrations — add a migration entry with "new_sqlite_classes": ["${s.class_name}"] (or "new_classes" for a non-SQLite-backed class), or let the dev server auto-reconcile it on the next start`)},P=(e,n,a)=>{if(e.containers===void 0)return;if(!Array.isArray(e.containers)){n.push("containers must be an array of { class_name, image, ... } entries");return}const s=e.containers;if(s.length===0)return;const t=new Set(b(e.durable_objects?.bindings).map(o=>o.class_name)),i=k(e.migrations);for(const[o,r]of s.entries())A(r,`containers[${String(o)}]`,{boundClasses:t,classKinds:i,errors:n,warnings:a});e.observability?.enabled!==!0&&a.push('containers are configured but observability is not enabled — container logs will not be captured (add { "observability": { "enabled": true } })')},l=e=>e,v=(e,n,a,s)=>{if(e!==void 0){if(!Array.isArray(e)){s.push(a.arrayMessage);return}for(const[t,i]of l(e).entries()){const o=`${n}[${String(t)}]`;if(!i||typeof i!="object"){s.push(a.objectMessage(o));continue}for(const r of a.fields)d(i[r.field])||s.push(r.message(o))}}},W={arrayMessage:"workflows must be an array of { name, binding, class_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Workflow binding (e.g. MY_WORKFLOW)`},{field:"class_name",message:e=>`${e} must have a non-empty "class_name" naming the exported WorkflowEntrypoint class`},{field:"name",message:e=>`${e} must have a non-empty "name" naming the deployed workflow`}],objectMessage:e=>`${e} must be a { name, binding, class_name } object`},I=(e,n)=>e===void 0||n&&d(e)||Array.isArray(e)&&e.length>0&&e.every(s=>d(s))?void 0:"schedules must be a non-empty array of cron expression strings",R=e=>{if(e!==void 0)return g(e)?e.steps===void 0||Number.isInteger(e.steps)&&e.steps>0?void 0:"limits.steps must be a positive integer":"limits must be an object"},q=e=>e===void 0?[]:g(e)?["success_retention","error_retention"].filter(n=>e[n]!==void 0&&!d(e[n])).map(n=>`default_retention.${n} must be a duration string (e.g. "7 days")`):["default_retention must be an object"],$=(e,n,a,s)=>{const t=[I(e.schedules,a),R(e.limits),...q(e.default_retention)];for(const i of t)i!==void 0&&s.push(`${n}.${i}`)},N=(e,n)=>h.map(({path:a})=>a).filter(a=>{const s=_(e,a),t=_(n,a),i=typeof t=="string"&&a[0]==="schedules"?[t]:t;return s!==void 0&&t!==void 0&&JSON.stringify(s)!==JSON.stringify(i)}).map(a=>a.join(".")),O=(e,n,a,s)=>{const t=`exports["${e}"]`,i=String(n.name);for(const o of a){if(!g(o)||o.name!==n.name)continue;const r=`workflows entry "${String(o.binding)}"`;if(o.script_name!==void 0){s.push(`${r} binds workflow "${i}" in another Worker, but ${t} declares a workflow with that name here — workflow names are unique per account`);continue}o.class_name!==e&&s.push(`${r} and ${t} both declare workflow "${i}" but name different classes ("${String(o.class_name)}" vs "${e}")`);for(const c of N(o,n))s.push(`${r} and ${t} set ${c} to different values for workflow "${i}" — set it in one place`)}},G=(e,n)=>{const a=Array.isArray(e.workflows)?l(e.workflows):[];for(const[t,i]of a.entries())g(i)&&$(i,`workflows[${String(t)}]`,!1,n);const s=g(e.exports)?Object.entries(e.exports):[];for(const[t,i]of s)!g(i)||i.type!=="workflow"||(d(i.name)?($(i,`exports["${t}"]`,!0,n),O(t,i,a,n)):n.push(`exports["${t}"] is a workflow export and must have a non-empty "name" naming the deployed workflow`))},C={arrayMessage:"queues.producers must be an array of { binding, queue } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Queue producer (e.g. QUEUE_EMAIL)`},{field:"queue",message:e=>`${e} must have a non-empty "queue" naming the deployed queue`}],objectMessage:e=>`${e} must be a { binding, queue } object`},T={arrayMessage:"queues.consumers must be an array of { queue } entries",fields:[{field:"queue",message:e=>`${e} must have a non-empty "queue" naming the consumed queue`}],objectMessage:e=>`${e} must be a { queue } object`},K=(e,n)=>{if(e.queues!==void 0){if(typeof e.queues!="object"||Array.isArray(e.queues)){n.push("queues must be a { producers, consumers } object");return}v(e.queues.producers,"queues.producers",C,n),v(e.queues.consumers,"queues.consumers",T,n)}},Q={arrayMessage:"secrets_store_secrets must be an array of { binding, store_id, secret_name } entries",fields:["binding","store_id","secret_name"].map(e=>({field:e,message:n=>`${n} must have a non-empty "${e}"`})),objectMessage:e=>`${e} must be a { binding, store_id, secret_name } object`},V=[{arrayMessage:"kv_namespaces must be an array of { binding, id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the KV namespace binding`,hintField:"id",hintMessage:(e,n)=>`${e} ("${n}") has no "id" — run \`wrangler kv namespace create\` and set the namespace id, or the binding can't resolve`,key:"kv_namespaces"},{arrayMessage:"flagship must be an array of { binding, app_id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Flagship binding`,hintField:"app_id",hintMessage:(e,n)=>`${e} ("${n}") has no "app_id" — create a Flagship app and set its id, or the binding can't resolve`,key:"flagship"},{arrayMessage:"hyperdrive must be an array of { binding, id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Hyperdrive binding`,hintField:"id",hintMessage:(e,n)=>`${e} ("${n}") has no "id" — run \`wrangler hyperdrive create\` and set the id, or the binding can't connect`,key:"hyperdrive"},{arrayMessage:"pipelines must be an array of { binding, stream } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Pipelines binding`,hintField:["stream","pipeline"],hintMessage:(e,n)=>`${e} ("${n}") has no "stream" — run \`wrangler pipelines create <name>\` and set the stream name, or the binding can't resolve`,key:"pipelines"},{arrayMessage:"analytics_engine_datasets must be an array of { binding, dataset } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Analytics Engine binding`,hintField:"dataset",hintMessage:(e,n)=>`${e} ("${n}") has no "dataset" — it defaults to the binding name; set it explicitly to avoid drift`,key:"analytics_engine_datasets"}],Y=(e,n,a,s)=>{const t=e[n.key];if(t!==void 0){if(!Array.isArray(t)){a.push(n.arrayMessage);return}for(const[i,o]of l(t).entries()){const r=`${n.key}[${String(i)}]`;if(!o||typeof o!="object"||!d(o.binding)){a.push(n.bindingMessage(r));continue}(typeof n.hintField=="string"?[n.hintField]:n.hintField).some(u=>d(o[u]))||s.push(n.hintMessage(r,o.binding))}}},z=[{key:"analytics",message:'analytics must be an object with a non-empty "binding" (e.g. { "binding": "ANALYTICS_SQL" })'},{key:"browser",message:'browser must be an object with a non-empty "binding" (e.g. { "binding": "BROWSER" })'},{key:"images",message:'images must be an object with a non-empty "binding" (e.g. { "binding": "IMAGES" })'},{key:"media",message:'media must be an object with a non-empty "binding" (e.g. { "binding": "MEDIA" })'},{key:"stream",message:'stream must be an object with a non-empty "binding" (e.g. { "binding": "STREAM" })'}],H=(e,n,a)=>{const s=e[n.key];s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)||!d(s.binding))&&a.push(n.message)},J=[{arrayMessage:"ai_search_namespaces must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the AI Search binding`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the AI Search namespace (every account has "default")`}],key:"ai_search_namespaces",objectMessage:e=>`${e} must be a { binding, namespace } object`},{arrayMessage:"ai_search must be an array of { binding, instance_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the AI Search binding`},{field:"instance_name",message:e=>`${e} must have a non-empty "instance_name" naming an existing AI Search instance`}],key:"ai_search",objectMessage:e=>`${e} must be a { binding, instance_name } object`},{arrayMessage:"services must be an array of { binding, service, entrypoint? } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the service binding`},{field:"service",message:e=>`${e} must have a non-empty "service" naming the target Worker`}],key:"services",objectMessage:e=>`${e} must be a { binding, service, entrypoint? } object`},{arrayMessage:"dispatch_namespaces must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding"`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the dispatch namespace`}],key:"dispatch_namespaces",objectMessage:e=>`${e} must be a { binding, namespace } object`},{arrayMessage:"mtls_certificates must be an array of { binding, certificate_id } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding"`},{field:"certificate_id",message:e=>`${e} must have a non-empty "certificate_id" (upload via \`wrangler mtls-certificate upload\`)`}],key:"mtls_certificates",objectMessage:e=>`${e} must be a { binding, certificate_id } object`},{arrayMessage:"r2_buckets must be an array of { binding, bucket_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the R2 bucket binding`},{field:"bucket_name",message:e=>`${e} must have a non-empty "bucket_name" naming the deployed bucket`}],key:"r2_buckets",objectMessage:e=>`${e} must be a { binding, bucket_name } object`},{arrayMessage:"vpc_services must be an array of { binding, service_id } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the VPC Service binding`},{field:"service_id",message:e=>`${e} must have a non-empty "service_id" (create one with \`wrangler vpc service create\`)`}],key:"vpc_services",objectMessage:e=>`${e} must be a { binding, service_id } object`},{arrayMessage:"artifacts must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Artifacts binding`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the Artifacts namespace`}],key:"artifacts",objectMessage:e=>`${e} must be a { binding, namespace } object`}],X=(e,n,a)=>{n?.hasD1GlobalTable&&!b(e.d1_databases).some(s=>s.binding==="DB")&&a.push('schema declares .global() tables; d1_databases must include a binding named "DB" — your dev server auto-reconciles this on startup, or add the binding manually'),n?.hasHyperdriveGlobalTable&&b(e.hyperdrive).length===0&&a.push('schema declares .global({ backend: "hyperdrive" }) tables; wrangler must declare a hyperdrive binding for `.hyperdriveGlobal({ exec })` to read — run `wrangler hyperdrive create <name> --connection-string=...` and add `"hyperdrive": [{ "binding": "HYPERDRIVE", "id": "<id>" }]` (any binding name works; your `exec` selector picks it)')},Z=(e,n)=>{const{d1_databases:a}=e;if(a!==void 0){if(!Array.isArray(a)){n.push("d1_databases must be an array of { binding, database_id | database_name } entries");return}for(const[s,t]of l(a).entries()){const i=`d1_databases[${String(s)}]`;if(!t||typeof t!="object"){n.push(`${i} must be a { binding, database_id | database_name } object`);continue}d(t.binding)||n.push(`${i} must have a non-empty "binding" naming the D1 binding`),!d(t.database_id)&&!d(t.database_name)&&n.push(`${i} must have a "database_id" or a "database_name" — run \`wrangler d1 create\` and set one, or the binding can't resolve`)}}},ee=(e,n)=>{const{vpc_networks:a}=e;if(a!==void 0){if(!Array.isArray(a)){n.push("vpc_networks must be an array of { binding, tunnel_id | network_id } entries");return}for(const[s,t]of l(a).entries()){const i=`vpc_networks[${String(s)}]`;if(!t||typeof t!="object"){n.push(`${i} must be a { binding, tunnel_id | network_id } object`);continue}d(t.binding)||n.push(`${i} must have a non-empty "binding" naming the VPC Network binding`),d(t.tunnel_id)===d(t.network_id)&&n.push(`${i} must set exactly one of "tunnel_id" (a Cloudflare Tunnel) or "network_id" ("cf1:network" for Cloudflare Mesh)`)}}};export{V as H,J as R,z as S,W,X as a,Z as b,L as c,P as d,v as e,G as f,K as g,Y as h,H as i,ee as j,Q as k,g as l,d as m,U as n,b as o,p,h as q,_ as s,F as v,B as w};
1
+ import{CUSTOM_INSTANCE_TYPE_LIMITS as f,CUSTOM_INSTANCE_MIN_MEMORY_MIB_PER_VCPU as y}from"@lunora/container";const g=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),d=e=>typeof e=="string"&&e.length>0,h=[{of:e=>e.schedules===void 0?void 0:[...e.schedules],path:["schedules"]},{of:e=>e.limits?.steps,path:["limits","steps"]},{of:e=>e.defaultRetention?.successRetention,path:["default_retention","success_retention"]},{of:e=>e.defaultRetention?.errorRetention,path:["default_retention","error_retention"]}],U=[...new Set(h.map(({path:e})=>e[0]))],_=(e,n)=>{let a=e;for(const s of n)a=g(a)?a[s]:void 0;return a},B=e=>{const n={};for(const{of:a,path:s}of h){const t=a(e);if(t===void 0)continue;const[i,o]=s;n[i]=o===void 0?t:{...n[i],[o]:t}}return n},L=(e,n,a)=>{if(n.length===0)return;const s=e.vectorize??[],t=new Set(s.filter(Boolean).map(i=>i?.index_name));for(const i of n)t.has(i)||a.push(`schema declares vector index "${i}"; wrangler "vectorize" must include a binding with index_name "${i}"`)},M=new Set(["basic","dev","lite","standard","standard-1","standard-2","standard-3","standard-4"]),S={disk_mb:f.diskMb,memory_mib:f.memoryMib,vcpu:{...f.vcpu,hint:'use the named "lite" or "basic" instance type below 1 vCPU'}},j=(e,n,a)=>{const s=e.instance_type;if(s===void 0)return;if(typeof s=="string"){M.has(s)||a.push(`${n} has unknown instance_type "${s}" — expected lite, basic, standard-1..4, or a custom { vcpu, memory_mib, disk_mb } object`);return}for(const[o,{hint:r,max:c,min:u}]of Object.entries(S)){const m=s[o];if(m!==void 0&&(typeof m!="number"||Number.isNaN(m)||m<u||m>c)){const w=r!==void 0&&typeof m=="number"&&m<u?` — ${r}`:"";a.push(`${n} custom instance_type ${o} must be a number in ${String(u)}–${String(c)} (got ${String(m)})${w}`)}}const{memory_mib:t,vcpu:i}=s;typeof i=="number"&&typeof t=="number"&&t<i*y&&a.push(`${n} custom instance_type needs ≥ 3 GiB (${String(y)} MiB) memory per vCPU (got ${String(t)} MiB for ${String(i)} vCPU)`)},E=(e,n,a)=>{for(const s of["image","instance_type","max_instances"])e[s]!==void 0&&a.push(`${n} sets "${s}", which the durable_object scheduling policy does not take — the Durable Object picks image and size at start`);for(const[s,t]of Object.entries(e.images??{}))[t?.dockerfile,t?.image].filter(o=>typeof o=="string"&&o.length>0).length!==1&&a.push(`${n} images["${s}"] must set exactly one of "dockerfile" or "image"`)},A=(e,n,a)=>{const{boundClasses:s,classKinds:t,errors:i,warnings:o}=a;if(!e||typeof e!="object"||typeof e.class_name!="string"||e.class_name.length===0){i.push(`${n} must have a non-empty "class_name" naming its container-enabled Durable Object class`);return}const r=e.scheduling_policy==="durable_object";e.scheduling_policy!==void 0&&e.scheduling_policy!=="default"&&!r&&i.push(`${n} ("${e.class_name}") has unknown scheduling_policy "${e.scheduling_policy}" — expected "default" or "durable_object"`),r?E(e,`${n} ("${e.class_name}")`,i):(typeof e.image!="string"||e.image.length===0)&&i.push(`${n} ("${e.class_name}") must have an "image" — a Dockerfile path or a registry reference`),s.has(e.class_name)||i.push(`${n} class "${e.class_name}" has no matching durable_objects binding — your dev server auto-reconciles this on startup; add { "name": "...", "class_name": "${e.class_name}" } to fix it by hand`);const c=t.get(e.class_name);c!=="sqlite"&&i.push(c==="classic"?`${n} class "${e.class_name}" is registered via "new_classes" but containers require SQLite-backed DOs — move it to "new_sqlite_classes"`:`${n} class "${e.class_name}" is missing from migrations — add a migration entry with "new_sqlite_classes": ["${e.class_name}"]`),j(e,`${n} ("${e.class_name}")`,i),e.max_instances===void 0&&!r&&o.push(`${n} ("${e.class_name}") declares no max_instances — set a cap so a traffic spike can't fan out unbounded container spend`)},b=e=>Array.isArray(e)?e.filter(n=>n!==null&&typeof n=="object"):[],p=e=>Array.isArray(e)?e.filter(n=>d(n)):[],k=e=>{const n=new Map;for(const a of b(e)){for(const s of p(a.new_classes))n.set(s,"classic");for(const s of p(a.new_sqlite_classes))n.set(s,"sqlite");for(const s of b(a.renamed_classes))if(d(s.from)&&d(s.to)){const t=n.get(s.from)??"sqlite";n.delete(s.from),n.set(s.to,t)}for(const s of p(a.deleted_classes))n.delete(s)}return n},x=e=>new Set(k(e).keys()),F=(e,n)=>{const a=x(e.migrations);for(const s of b(e.durable_objects?.bindings))s.script_name===void 0&&d(s.class_name)&&!a.has(s.class_name)&&n.push(`durable_objects.bindings declares class "${s.class_name}" but it is missing from migrations — add a migration entry with "new_sqlite_classes": ["${s.class_name}"] (or "new_classes" for a non-SQLite-backed class), or let the dev server auto-reconcile it on the next start`)},P=(e,n,a)=>{if(e.containers===void 0)return;if(!Array.isArray(e.containers)){n.push("containers must be an array of { class_name, image, ... } entries");return}const s=e.containers;if(s.length===0)return;const t=new Set(b(e.durable_objects?.bindings).map(o=>o.class_name)),i=k(e.migrations);for(const[o,r]of s.entries())A(r,`containers[${String(o)}]`,{boundClasses:t,classKinds:i,errors:n,warnings:a});e.observability?.enabled!==!0&&a.push('containers are configured but observability is not enabled — container logs will not be captured (add { "observability": { "enabled": true } })')},l=e=>e,v=(e,n,a,s)=>{if(e!==void 0){if(!Array.isArray(e)){s.push(a.arrayMessage);return}for(const[t,i]of l(e).entries()){const o=`${n}[${String(t)}]`;if(!i||typeof i!="object"){s.push(a.objectMessage(o));continue}for(const r of a.fields)d(i[r.field])||s.push(r.message(o))}}},W={arrayMessage:"workflows must be an array of { name, binding, class_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Workflow binding (e.g. MY_WORKFLOW)`},{field:"class_name",message:e=>`${e} must have a non-empty "class_name" naming the exported WorkflowEntrypoint class`},{field:"name",message:e=>`${e} must have a non-empty "name" naming the deployed workflow`}],objectMessage:e=>`${e} must be a { name, binding, class_name } object`},I=(e,n)=>e===void 0||n&&d(e)||Array.isArray(e)&&e.length>0&&e.every(s=>d(s))?void 0:"schedules must be a non-empty array of cron expression strings",R=e=>{if(e!==void 0)return g(e)?e.steps===void 0||Number.isInteger(e.steps)&&e.steps>0?void 0:"limits.steps must be a positive integer":"limits must be an object"},q=e=>e===void 0?[]:g(e)?["success_retention","error_retention"].filter(n=>e[n]!==void 0&&!d(e[n])).map(n=>`default_retention.${n} must be a duration string (e.g. "7 days")`):["default_retention must be an object"],$=(e,n,a,s)=>{const t=[I(e.schedules,a),R(e.limits),...q(e.default_retention)];for(const i of t)i!==void 0&&s.push(`${n}.${i}`)},N=(e,n)=>h.map(({path:a})=>a).filter(a=>{const s=_(e,a),t=_(n,a),i=typeof t=="string"&&a[0]==="schedules"?[t]:t;return s!==void 0&&t!==void 0&&JSON.stringify(s)!==JSON.stringify(i)}).map(a=>a.join(".")),O=(e,n,a,s)=>{const t=`exports["${e}"]`,i=String(n.name);for(const o of a){if(!g(o)||o.name!==n.name)continue;const r=`workflows entry "${String(o.binding)}"`;if(o.script_name!==void 0){s.push(`${r} binds workflow "${i}" in another Worker, but ${t} declares a workflow with that name here — workflow names are unique per account`);continue}o.class_name!==e&&s.push(`${r} and ${t} both declare workflow "${i}" but name different classes ("${String(o.class_name)}" vs "${e}")`);for(const c of N(o,n))s.push(`${r} and ${t} set ${c} to different values for workflow "${i}" — set it in one place`)}},G=(e,n)=>{const a=Array.isArray(e.workflows)?l(e.workflows):[];for(const[t,i]of a.entries())g(i)&&$(i,`workflows[${String(t)}]`,!1,n);const s=g(e.exports)?Object.entries(e.exports):[];for(const[t,i]of s)!g(i)||i.type!=="workflow"||(d(i.name)?($(i,`exports["${t}"]`,!0,n),O(t,i,a,n)):n.push(`exports["${t}"] is a workflow export and must have a non-empty "name" naming the deployed workflow`))},C={arrayMessage:"queues.producers must be an array of { binding, queue } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Queue producer (e.g. QUEUE_EMAIL)`},{field:"queue",message:e=>`${e} must have a non-empty "queue" naming the deployed queue`}],objectMessage:e=>`${e} must be a { binding, queue } object`},T={arrayMessage:"queues.consumers must be an array of { queue } entries",fields:[{field:"queue",message:e=>`${e} must have a non-empty "queue" naming the consumed queue`}],objectMessage:e=>`${e} must be a { queue } object`},K=(e,n)=>{if(e.queues!==void 0){if(typeof e.queues!="object"||Array.isArray(e.queues)){n.push("queues must be a { producers, consumers } object");return}v(e.queues.producers,"queues.producers",C,n),v(e.queues.consumers,"queues.consumers",T,n)}},Q={arrayMessage:"secrets_store_secrets must be an array of { binding, store_id, secret_name } entries",fields:["binding","store_id","secret_name"].map(e=>({field:e,message:n=>`${n} must have a non-empty "${e}"`})),objectMessage:e=>`${e} must be a { binding, store_id, secret_name } object`},V=[{arrayMessage:"kv_namespaces must be an array of { binding, id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the KV namespace binding`,hintField:"id",hintMessage:(e,n)=>`${e} ("${n}") has no "id" — run \`wrangler kv namespace create\` and set the namespace id, or the binding can't resolve`,key:"kv_namespaces"},{arrayMessage:"flagship must be an array of { binding, app_id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Flagship binding`,hintField:"app_id",hintMessage:(e,n)=>`${e} ("${n}") has no "app_id" — create a Flagship app and set its id, or the binding can't resolve`,key:"flagship"},{arrayMessage:"hyperdrive must be an array of { binding, id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Hyperdrive binding`,hintField:"id",hintMessage:(e,n)=>`${e} ("${n}") has no "id" — run \`wrangler hyperdrive create\` and set the id, or the binding can't connect`,key:"hyperdrive"},{arrayMessage:"pipelines must be an array of { binding, stream } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Pipelines binding`,hintField:["stream","pipeline"],hintMessage:(e,n)=>`${e} ("${n}") has no "stream" — run \`wrangler pipelines create <name>\` and set the stream name, or the binding can't resolve`,key:"pipelines"},{arrayMessage:"analytics_engine_datasets must be an array of { binding, dataset } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Analytics Engine binding`,hintField:"dataset",hintMessage:(e,n)=>`${e} ("${n}") has no "dataset" — it defaults to the binding name; set it explicitly to avoid drift`,key:"analytics_engine_datasets"}],Y=(e,n,a,s)=>{const t=e[n.key];if(t!==void 0){if(!Array.isArray(t)){a.push(n.arrayMessage);return}for(const[i,o]of l(t).entries()){const r=`${n.key}[${String(i)}]`;if(!o||typeof o!="object"||!d(o.binding)){a.push(n.bindingMessage(r));continue}(typeof n.hintField=="string"?[n.hintField]:n.hintField).some(u=>d(o[u]))||s.push(n.hintMessage(r,o.binding))}}},z=[{key:"analytics",message:'analytics must be an object with a non-empty "binding" (e.g. { "binding": "ANALYTICS_SQL" })'},{key:"browser",message:'browser must be an object with a non-empty "binding" (e.g. { "binding": "BROWSER" })'},{key:"images",message:'images must be an object with a non-empty "binding" (e.g. { "binding": "IMAGES" })'},{key:"media",message:'media must be an object with a non-empty "binding" (e.g. { "binding": "MEDIA" })'},{key:"stream",message:'stream must be an object with a non-empty "binding" (e.g. { "binding": "STREAM" })'}],H=(e,n,a)=>{const s=e[n.key];s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)||!d(s.binding))&&a.push(n.message)},J=[{arrayMessage:"ai_search_namespaces must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the AI Search binding`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the AI Search namespace (every account has "default")`}],key:"ai_search_namespaces",objectMessage:e=>`${e} must be a { binding, namespace } object`},{arrayMessage:"ai_search must be an array of { binding, instance_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the AI Search binding`},{field:"instance_name",message:e=>`${e} must have a non-empty "instance_name" naming an existing AI Search instance`}],key:"ai_search",objectMessage:e=>`${e} must be a { binding, instance_name } object`},{arrayMessage:"services must be an array of { binding, service, entrypoint? } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the service binding`},{field:"service",message:e=>`${e} must have a non-empty "service" naming the target Worker`}],key:"services",objectMessage:e=>`${e} must be a { binding, service, entrypoint? } object`},{arrayMessage:"dispatch_namespaces must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding"`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the dispatch namespace`}],key:"dispatch_namespaces",objectMessage:e=>`${e} must be a { binding, namespace } object`},{arrayMessage:"mtls_certificates must be an array of { binding, certificate_id } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding"`},{field:"certificate_id",message:e=>`${e} must have a non-empty "certificate_id" (upload via \`wrangler mtls-certificate upload\`)`}],key:"mtls_certificates",objectMessage:e=>`${e} must be a { binding, certificate_id } object`},{arrayMessage:"r2_buckets must be an array of { binding, bucket_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the R2 bucket binding`},{field:"bucket_name",message:e=>`${e} must have a non-empty "bucket_name" naming the deployed bucket`}],key:"r2_buckets",objectMessage:e=>`${e} must be a { binding, bucket_name } object`},{arrayMessage:"vpc_services must be an array of { binding, service_id } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the VPC Service binding`},{field:"service_id",message:e=>`${e} must have a non-empty "service_id" (create one with \`wrangler vpc service create\`)`}],key:"vpc_services",objectMessage:e=>`${e} must be a { binding, service_id } object`},{arrayMessage:"artifacts must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Artifacts binding`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the Artifacts namespace`}],key:"artifacts",objectMessage:e=>`${e} must be a { binding, namespace } object`}],X=(e,n,a)=>{n?.hasD1GlobalTable&&!b(e.d1_databases).some(s=>s.binding==="DB")&&a.push('schema declares .global() tables; d1_databases must include a binding named "DB" — your dev server auto-reconciles this on startup, or add the binding manually'),n?.hasHyperdriveGlobalTable&&b(e.hyperdrive).length===0&&a.push('schema declares .global({ backend: "hyperdrive" }) tables; wrangler must declare a hyperdrive binding for `.hyperdriveGlobal({ exec })` to read — run `wrangler hyperdrive create <name> --connection-string=...` and add `"hyperdrive": [{ "binding": "HYPERDRIVE", "id": "<id>" }]` (any binding name works; your `exec` selector picks it)')},Z=(e,n)=>{const{d1_databases:a}=e;if(a!==void 0){if(!Array.isArray(a)){n.push("d1_databases must be an array of { binding, database_id | database_name } entries");return}for(const[s,t]of l(a).entries()){const i=`d1_databases[${String(s)}]`;if(!t||typeof t!="object"){n.push(`${i} must be a { binding, database_id | database_name } object`);continue}d(t.binding)||n.push(`${i} must have a non-empty "binding" naming the D1 binding`),!d(t.database_id)&&!d(t.database_name)&&n.push(`${i} must have a "database_id" or a "database_name" — run \`wrangler d1 create\` and set one, or the binding can't resolve`)}}},ee=(e,n)=>{const{vpc_networks:a}=e;if(a!==void 0){if(!Array.isArray(a)){n.push("vpc_networks must be an array of { binding, tunnel_id | network_id } entries");return}for(const[s,t]of l(a).entries()){const i=`vpc_networks[${String(s)}]`;if(!t||typeof t!="object"){n.push(`${i} must be a { binding, tunnel_id | network_id } object`);continue}d(t.binding)||n.push(`${i} must have a non-empty "binding" naming the VPC Network binding`),d(t.tunnel_id)===d(t.network_id)&&n.push(`${i} must set exactly one of "tunnel_id" (a Cloudflare Tunnel) or "network_id" ("cf1:network" for Cloudflare Mesh)`)}}};export{V as H,J as R,z as S,W,X as a,Z as b,L as c,P as d,v as e,x as f,G as g,K as h,Y as i,H as j,ee as k,Q as l,g as m,d as n,b as o,U as p,p as q,h as r,_ as s,F as v,B as w};
@@ -1 +1 @@
1
- import{l as u,m as f,o as v}from"./validate-bindings-DFAcr5wA.mjs";const _=new Set(["1","enabled","on","true","yes"]),A=s=>typeof s=="string"&&_.has(s.trim().toLowerCase()),b=(s,t,e,n)=>{s!==void 0&&typeof s!="boolean"&&e.push(`${t} must be a boolean${n===void 0?"":` (${n})`}`)},O=(s,t,e)=>{s!==void 0&&(typeof s!="number"||Number.isNaN(s)||s<0||s>1)&&e.push(`${t} must be a number in [0, 1] (the fraction of requests sampled)`)},$=(s,t,e)=>{const n=s.send_email;if(n===void 0)return;if(!Array.isArray(n)){t.push("send_email must be an array of { name, destination_address? } entries");return}const i=n;for(const[o,a]of i.entries())(!a||typeof a!="object"||typeof a.name!="string"||a.name.length===0)&&e.push(`send_email[${String(o)}] has no non-empty "name" naming the send-email binding — set one before deploying`)},N=(s,t)=>{b(s.logpush,"logpush",t,'set "logpush": true to enable Cloudflare Logpush')},k=(s,t)=>{const e=s.secrets;if(e===void 0)return;const n=typeof e=="object"&&e!==null&&!Array.isArray(e)?e.required:void 0;(!Array.isArray(n)||n.some(i=>typeof i!="string"||i===""))&&t.push('secrets must be an object whose "required" is an array of secret names (e.g. { "required": ["API_KEY"] })')},m=3e5,I=(s,t)=>{const{limits:e}=s;if(e===void 0)return;if(typeof e!="object"||Array.isArray(e)){t.push('limits must be an object (e.g. { "cpu_ms": 30000 })');return}const n=e.cpu_ms;if(n!==void 0){if(typeof n!="number"||!Number.isFinite(n)||!Number.isInteger(n)||n<=0){t.push("limits.cpu_ms must be a positive integer number of milliseconds");return}n>m&&t.push(`limits.cpu_ms must be at most ${String(m)} (Cloudflare's per-invocation ceiling)`)}},p=new Set(["off","smart","targeted"]),C=(s,t)=>{const{placement:e}=s;if(e===void 0)return;if(typeof e!="object"||e===null||Array.isArray(e)){t.push('placement must be an object (e.g. { "mode": "smart" })');return}const{mode:n}=e;n!==void 0&&(typeof n!="string"||!p.has(n))&&t.push(`placement.mode must be one of ${[...p].map(i=>`"${i}"`).join(", ")}`)},c={kind:"boolean"},h={kind:"samplingRate"},y={destinations:{kind:"destinations"},enabled:c,head_sampling_rate:h,persist:c},S={...y,invocation_logs:{hint:'set "invocation_logs": true to keep per-invocation summaries',kind:"boolean"}},L={enabled:c,head_sampling_rate:h,issues:{kind:"level",level:{enabled:c}},logs:{kind:"level",level:S},redact_query_string:c,traces:{kind:"level",level:y}},E=(s,t,e,n)=>{switch(s.kind){case"boolean":{b(t,e,n,s.hint);break}case"destinations":{t!==void 0&&(!Array.isArray(t)||t.some(i=>!f(i)))&&n.push(`${e} must be an array of destination names configured in the Cloudflare dashboard`);break}case"samplingRate":{O(t,e,n);break}}},g=(s,t,e,n,i)=>{for(const[o,a]of Object.entries(s)){const r=Object.hasOwn(t,o)?t[o]:void 0,l=`${e}.${o}`;r===void 0?i.push(`${l} is not a documented wrangler key (expected one of ${Object.keys(t).join(", ")}) — a typo is silently ignored by wrangler`):r.kind!=="level"?E(r,a,l,n):u(a)?g(a,r.level,l,n,i):a!==void 0&&n.push(`${l} must be an object`)}},w=(s,t,e)=>{const{observability:n}=s;if(n!==void 0){if(!u(n)){t.push('observability must be an object (e.g. { "enabled": true, "head_sampling_rate": 1 })');return}g(n,L,"observability",t,e)}},x=(s,t)=>{const{cache:e}=s;if(e!==void 0){if(!u(e)){t.push('cache must be an object (e.g. { "enabled": true })');return}b(e.enabled,"cache.enabled",t)}},D=(s,t)=>{const{exports:e}=s;if(e!==void 0){if(typeof e!="object"||e===null||Array.isArray(e)){t.push("exports must be an object keyed by entrypoint name");return}for(const[n,i]of Object.entries(e)){if(typeof i!="object"||i===null){t.push(`exports["${n}"] must be an object`);continue}i.type!==void 0&&typeof i.type!="string"&&t.push(`exports["${n}"].type must be a string`),i.cache!==void 0&&(typeof i.cache!="object"||i.cache===null||Array.isArray(i.cache)?t.push(`exports["${n}"].cache must be an object`):i.cache.enabled!==void 0&&typeof i.cache.enabled!="boolean"&&t.push(`exports["${n}"].cache.enabled must be a boolean`))}}},T=(s,t)=>{const{assets:e}=s;if(e!==void 0){if(typeof e!="object"||Array.isArray(e)){t.push('assets must be an object (e.g. { "directory": "./dist/client", "binding": "ASSETS" })');return}(typeof e.directory!="string"||e.directory.length===0)&&t.push('assets must declare a non-empty "directory" pointing at the built client output (e.g. "./dist/client")'),e.binding!==void 0&&(typeof e.binding!="string"||e.binding.length===0)&&t.push('assets.binding must be a non-empty string (e.g. "ASSETS")'),e.html_handling!==void 0&&typeof e.html_handling!="string"&&t.push("assets.html_handling must be a string"),e.not_found_handling!==void 0&&typeof e.not_found_handling!="string"&&t.push("assets.not_found_handling must be a string")}},B=(s,t)=>{const e=s.tail_consumers;if(e===void 0)return;if(!Array.isArray(e)){t.push("tail_consumers must be an array of { service, environment? } entries");return}const n=e;for(const[i,o]of n.entries())(!o||typeof o!="object"||typeof o.service!="string"||o.service.length===0)&&t.push(`tail_consumers[${String(i)}] must have a non-empty "service" naming the consumer Worker`)},U=(s,t)=>{const e=s.tail_consumers??[];return e.some(i=>!!i&&i?.service===t.service&&i?.environment===t.environment)?s:{...s,tail_consumers:[...e,t]}},G=(s,t)=>{const{vars:e}=s;if(!e||typeof e!="object")return;const n=e.LUNORA_ALLOWED_ORIGINS,i=e.LUNORA_CORS_ALLOW_CREDENTIALS,o=typeof n=="string"&&n.split(",").some(r=>r.trim()==="*"),a=A(i);o&&a&&t.push('vars.LUNORA_ALLOWED_ORIGINS includes a "*" wildcard while vars.LUNORA_CORS_ALLOW_CREDENTIALS is on — browsers reject this combination and it defeats the allowlist; name explicit origins or drop credentials')},j=s=>v(s.durable_objects?.bindings).some(t=>t.class_name==="SchedulerDO"&&t.script_name===void 0),d="LUNORA_ORIGIN_URL",P=(s,t,e)=>{if(!j(s)||f(s.vars?.[d]))return;const n=t===void 0?"vars":`env.${t}.vars`,i=t===void 0?"":` --env ${t}`;e.push(`durable_objects.bindings declares the SchedulerDO but ${n}.${d} is unset — the DO reads its dispatch origin from its own env and refuses to schedule without it, so every ctx.scheduler.runAfter/runAt fails with ORIGIN_NOT_CONFIGURED. Set ${n}.${d} to the worker's public URL, or \`wrangler secret put ${d}${i}\` (ignore this if it is already set as a secret or in the dashboard).`)};export{T as validateAssets,x as validateCache,G as validateCorsVariables,D as validateExports,I as validateLimits,N as validateLogpush,w as validateObservability,C as validatePlacement,P as validateSchedulerOrigin,k as validateSecretsRequired,$ as validateSendEmail,B as validateTailConsumers,U as withTailConsumer};
1
+ import{m as u,n as f,o as v}from"./validate-bindings-DKlB-1sF.mjs";const _=new Set(["1","enabled","on","true","yes"]),A=s=>typeof s=="string"&&_.has(s.trim().toLowerCase()),b=(s,t,e,n)=>{s!==void 0&&typeof s!="boolean"&&e.push(`${t} must be a boolean${n===void 0?"":` (${n})`}`)},O=(s,t,e)=>{s!==void 0&&(typeof s!="number"||Number.isNaN(s)||s<0||s>1)&&e.push(`${t} must be a number in [0, 1] (the fraction of requests sampled)`)},$=(s,t,e)=>{const n=s.send_email;if(n===void 0)return;if(!Array.isArray(n)){t.push("send_email must be an array of { name, destination_address? } entries");return}const i=n;for(const[o,a]of i.entries())(!a||typeof a!="object"||typeof a.name!="string"||a.name.length===0)&&e.push(`send_email[${String(o)}] has no non-empty "name" naming the send-email binding — set one before deploying`)},N=(s,t)=>{b(s.logpush,"logpush",t,'set "logpush": true to enable Cloudflare Logpush')},k=(s,t)=>{const e=s.secrets;if(e===void 0)return;const n=typeof e=="object"&&e!==null&&!Array.isArray(e)?e.required:void 0;(!Array.isArray(n)||n.some(i=>typeof i!="string"||i===""))&&t.push('secrets must be an object whose "required" is an array of secret names (e.g. { "required": ["API_KEY"] })')},m=3e5,I=(s,t)=>{const{limits:e}=s;if(e===void 0)return;if(typeof e!="object"||Array.isArray(e)){t.push('limits must be an object (e.g. { "cpu_ms": 30000 })');return}const n=e.cpu_ms;if(n!==void 0){if(typeof n!="number"||!Number.isFinite(n)||!Number.isInteger(n)||n<=0){t.push("limits.cpu_ms must be a positive integer number of milliseconds");return}n>m&&t.push(`limits.cpu_ms must be at most ${String(m)} (Cloudflare's per-invocation ceiling)`)}},p=new Set(["off","smart","targeted"]),C=(s,t)=>{const{placement:e}=s;if(e===void 0)return;if(typeof e!="object"||e===null||Array.isArray(e)){t.push('placement must be an object (e.g. { "mode": "smart" })');return}const{mode:n}=e;n!==void 0&&(typeof n!="string"||!p.has(n))&&t.push(`placement.mode must be one of ${[...p].map(i=>`"${i}"`).join(", ")}`)},c={kind:"boolean"},h={kind:"samplingRate"},y={destinations:{kind:"destinations"},enabled:c,head_sampling_rate:h,persist:c},S={...y,invocation_logs:{hint:'set "invocation_logs": true to keep per-invocation summaries',kind:"boolean"}},L={enabled:c,head_sampling_rate:h,issues:{kind:"level",level:{enabled:c}},logs:{kind:"level",level:S},redact_query_string:c,traces:{kind:"level",level:y}},E=(s,t,e,n)=>{switch(s.kind){case"boolean":{b(t,e,n,s.hint);break}case"destinations":{t!==void 0&&(!Array.isArray(t)||t.some(i=>!f(i)))&&n.push(`${e} must be an array of destination names configured in the Cloudflare dashboard`);break}case"samplingRate":{O(t,e,n);break}}},g=(s,t,e,n,i)=>{for(const[o,a]of Object.entries(s)){const r=Object.hasOwn(t,o)?t[o]:void 0,l=`${e}.${o}`;r===void 0?i.push(`${l} is not a documented wrangler key (expected one of ${Object.keys(t).join(", ")}) — a typo is silently ignored by wrangler`):r.kind!=="level"?E(r,a,l,n):u(a)?g(a,r.level,l,n,i):a!==void 0&&n.push(`${l} must be an object`)}},w=(s,t,e)=>{const{observability:n}=s;if(n!==void 0){if(!u(n)){t.push('observability must be an object (e.g. { "enabled": true, "head_sampling_rate": 1 })');return}g(n,L,"observability",t,e)}},x=(s,t)=>{const{cache:e}=s;if(e!==void 0){if(!u(e)){t.push('cache must be an object (e.g. { "enabled": true })');return}b(e.enabled,"cache.enabled",t)}},D=(s,t)=>{const{exports:e}=s;if(e!==void 0){if(typeof e!="object"||e===null||Array.isArray(e)){t.push("exports must be an object keyed by entrypoint name");return}for(const[n,i]of Object.entries(e)){if(typeof i!="object"||i===null){t.push(`exports["${n}"] must be an object`);continue}i.type!==void 0&&typeof i.type!="string"&&t.push(`exports["${n}"].type must be a string`),i.cache!==void 0&&(typeof i.cache!="object"||i.cache===null||Array.isArray(i.cache)?t.push(`exports["${n}"].cache must be an object`):i.cache.enabled!==void 0&&typeof i.cache.enabled!="boolean"&&t.push(`exports["${n}"].cache.enabled must be a boolean`))}}},T=(s,t)=>{const{assets:e}=s;if(e!==void 0){if(typeof e!="object"||Array.isArray(e)){t.push('assets must be an object (e.g. { "directory": "./dist/client", "binding": "ASSETS" })');return}(typeof e.directory!="string"||e.directory.length===0)&&t.push('assets must declare a non-empty "directory" pointing at the built client output (e.g. "./dist/client")'),e.binding!==void 0&&(typeof e.binding!="string"||e.binding.length===0)&&t.push('assets.binding must be a non-empty string (e.g. "ASSETS")'),e.html_handling!==void 0&&typeof e.html_handling!="string"&&t.push("assets.html_handling must be a string"),e.not_found_handling!==void 0&&typeof e.not_found_handling!="string"&&t.push("assets.not_found_handling must be a string")}},B=(s,t)=>{const e=s.tail_consumers;if(e===void 0)return;if(!Array.isArray(e)){t.push("tail_consumers must be an array of { service, environment? } entries");return}const n=e;for(const[i,o]of n.entries())(!o||typeof o!="object"||typeof o.service!="string"||o.service.length===0)&&t.push(`tail_consumers[${String(i)}] must have a non-empty "service" naming the consumer Worker`)},U=(s,t)=>{const e=s.tail_consumers??[];return e.some(i=>!!i&&i?.service===t.service&&i?.environment===t.environment)?s:{...s,tail_consumers:[...e,t]}},G=(s,t)=>{const{vars:e}=s;if(!e||typeof e!="object")return;const n=e.LUNORA_ALLOWED_ORIGINS,i=e.LUNORA_CORS_ALLOW_CREDENTIALS,o=typeof n=="string"&&n.split(",").some(r=>r.trim()==="*"),a=A(i);o&&a&&t.push('vars.LUNORA_ALLOWED_ORIGINS includes a "*" wildcard while vars.LUNORA_CORS_ALLOW_CREDENTIALS is on — browsers reject this combination and it defeats the allowlist; name explicit origins or drop credentials')},j=s=>v(s.durable_objects?.bindings).some(t=>t.class_name==="SchedulerDO"&&t.script_name===void 0),d="LUNORA_ORIGIN_URL",P=(s,t,e,n=j(s)?"durable_objects.bindings declares the SchedulerDO":void 0)=>{if(n===void 0||f(s.vars?.[d]))return;const i=t===void 0?"vars":`env.${t}.vars`,o=t===void 0?"":` --env ${t}`;e.push(`${n} but ${i}.${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 ${i}.${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{T as validateAssets,x as validateCache,G as validateCorsVariables,D as validateExports,I as validateLimits,N as validateLogpush,w as validateObservability,C as validatePlacement,P as validateSchedulerOrigin,k as validateSecretsRequired,$ as validateSendEmail,B as validateTailConsumers,U as withTailConsumer};
@@ -0,0 +1 @@
1
+ import{existsSync as f,readFileSync as N,readdirSync as I}from"node:fs";import{join as p,dirname as v,extname as h,basename as x}from"node:path";import{Project as b,Node as d}from"ts-morph";import{COMPOSED_WORKER_ENTRY as w,LUNORA_WORKER_VIRTUAL_ID as u,isGeneratedOutput as L,WORKER_ENTRY_FALLBACKS as M,GENERATED_DIRECTORY as j,isMergedProject as F,MERGED_DURABLE_OBJECT as P,COMPOSED_ENTRY_DURABLE_OBJECTS as k,GENERATED_CLASS_MODULES as U,isMergedRoleModule as W,SOURCE_DOT_DIRECTORIES as B,NON_SOURCE_DIRECTORIES as K}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";const E=[".ts",".tsx",".mts",".cts"],g=new Set(E),X=new Set([".cjs",".js",".mjs"]),m="default",S={".cjs":[".cts"],".js":[".ts",".tsx"],".mjs":[".mts"]},Y=250,ae=(e,o,t)=>{const s=p(o,w);if(f(s))return{origin:"declared",path:s};if(e===u)return{origin:"composed"};const n=()=>{const i=M.map(a=>p(o,a)).find(a=>f(a));return i===void 0?void 0:{origin:"probed",path:i}};if(typeof e!="string"||e.length===0||L(e))return n();const r=p(v(t),e),c=h(r);if(!(!g.has(c)&&!X.has(c)))return f(r)?{origin:"declared",path:r}:{origin:"absent",path:r}},_=(e,o)=>{if(d.isIdentifier(e)){o.add(e.getText());return}if(d.isObjectBindingPattern(e)||d.isArrayBindingPattern(e))for(const t of e.getElements())d.isBindingElement(t)&&_(t.getNameNode(),o)},G=(e,o)=>{const t=[];for(const s of e.getExportDeclarations())if(!s.isTypeOnly()){if(s.isNamespaceExport()){const n=s.getNamespaceExport();n===void 0?t.push(s.getModuleSpecifierValue()??""):o.add(n.getName());continue}for(const n of s.getNamedExports())n.isTypeOnly()||o.add(n.getAliasNode()?.getText()??n.getName())}return t},$=(e,o)=>{for(const t of e.getVariableStatements().filter(s=>s.getExportKeyword()!==void 0))for(const s of t.getDeclarations())_(s.getNameNode(),o);for(const t of[...e.getClasses(),...e.getFunctions(),...e.getEnums()]){if(t.getExportKeyword()===void 0)continue;const s=t.isDefaultExport()?m:t.getName();s!==void 0&&o.add(s)}e.getExportAssignments().length>0&&o.add(m)},y=(e,o)=>{const t=new b({compilerOptions:{allowJs:!0},skipFileDependencyResolution:!0,skipLoadingLibFiles:!0,useInMemoryFileSystem:!0}),s=t.createSourceFile(e,o,{overwrite:!0});return t.getProgram().compilerObject.getSyntacticDiagnostics(s.compilerNode).length>0?void 0:s},J=(e,o)=>{if(!o.startsWith("./")&&!o.startsWith("../"))return;const t=p(v(e),o),s=h(t),n=g.has(s)||S[s]!==void 0,r=n?t.slice(0,-s.length):t;return[...g.has(s)?[t]:[],...(S[s]??[]).map(i=>`${r}${i}`),...n?[]:E.map(i=>`${t}${i}`),...n||s.length===0?E.map(i=>p(r,`index${i}`)):[]].find(i=>f(i))},T=e=>{const o=new Set,t=new Set([e]),s=[e];for(;s.length>0;){if(t.size-1>Y)return;const n=s.pop();let r;try{r=N(n,"utf8")}catch{return}const c=y(x(n),r);if(c===void 0)return;const i=G(c,o);$(c,o);for(const a of i){const l=J(n,a);if(l===void 0)return;t.has(l)||(t.add(l),s.push(l))}}return o},z=(e,o)=>{const t={exports:void 0,kind:"composed",path:u},s=p(e,o,j);if(!f(s))return t;const n=F(s),r=new Set(n?[P]:k);for(const c of U){const i=p(s,`${c}.ts`);if(!f(i)||n&&W(c))continue;const a=T(i);if(a===void 0)return t;for(const l of a)r.add(l)}return{exports:r,kind:"composed",path:u}},de=(e,o,t)=>{if(e===void 0||e.origin==="absent")return;if(e.origin==="composed")return z(o,t);const s=T(e.path);if(!(e.origin==="probed"&&s!==void 0&&!s.has(m)))return{exports:s,kind:"authored",path:e.path}},q=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),V=2e3,O="defineTable",R="defineApp",H=e=>{const o=[],t=[];let s;try{s=I(e,{withFileTypes:!0})}catch{return{files:o,subdirectories:t}}for(const n of s)n.isDirectory()?n.name.startsWith(".")&&!B.has(n.name)||K.has(n.name)||t.push(p(e,n.name)):q.has(h(n.name))&&o.push(p(e,n.name));return{files:o,subdirectories:t}},D=(e,o)=>{const t=new Set;for(const s of e.getImportDeclarations())for(const n of s.getNamedImports())!n.isTypeOnly()&&n.getName()===o&&t.add(n.getAliasNode()?.getText()??n.getName());return t},Q=(e,o)=>{let t=!1;return e.forEachDescendant((s,n)=>{if(!d.isCallExpression(s))return;const r=s.getExpression();d.isIdentifier(r)&&o.has(r.getText())&&(t=!0,n.stop())}),t},Z=e=>{let o=e;for(;d.isCallExpression(o)||d.isPropertyAccessExpression(o);)o=o.getExpression();return o},ee=(e,o)=>{const t=Z(e);return d.isIdentifier(t)&&o.has(t.getText())},A={analyticsSql:/\.\s*analyticsSql\s*\(/u,global:/\.\s*global\s*\(/u,hyperdriveGlobal:/\.\s*hyperdriveGlobal\s*\(/u,vectors:/\.\s*vectors\s*\(/u},te=e=>Object.hasOwn(A,e),se=(e,o)=>{const t=new Set,s=new Set([O,...D(e,O)]);return e.forEachDescendant(n=>{if(!d.isCallExpression(n))return;const r=n.getExpression();if(!d.isPropertyAccessExpression(r)||ee(r,s))return;const c=r.getName();te(c)&&o.has(c)&&t.add(c)}),t},oe=(e,o)=>{let t;try{t=N(e,"utf8")}catch{return}const s=new Set([...o].filter(r=>A[r].test(t)));if(s.size===0&&!t.includes(R))return;const n=y(x(e),t);return n===void 0?{chained:s,composes:!1}:{chained:se(n,s),composes:Q(n,D(n,R))}},le=(e,o)=>{const t=[e],s=new Set;let n=0,r;const c=i=>{if(n+=1,n>V)return!1;const a=oe(i,o);for(const l of a?.chained??[])s.add(l);return a?.composes&&(r??=i),!0};for(;t.length>0;){const i=t.pop(),{files:a,subdirectories:l}=H(i);t.push(...l);for(const C of a){if(!c(C))return;if(r!==void 0&&s.size===o.size)return{chained:s,site:r}}}return r===void 0?void 0:{chained:s,site:r}};export{ae as l,de as r,le as s};
@@ -1 +1 @@
1
- import{parseDevVariable as t,resolveAdminToken as r}from"../packem_shared/parseDevVariable-teAAahVD.mjs";import{applyStudioAssetCache as s,sendStudioDocument as d}from"../packem_shared/applyStudioAssetCache-DHQEJuuv.mjs";import{assetContentType as S,isStandaloneModulePath as l,loadStudioAssets as p,readStandaloneAsset as i,resolveStandaloneDirectory as m,studioAssetsStamp as u}from"../packem_shared/assetContentType-CUb5bpbI.mjs";import{STUDIO_PATH as T,STUDIO_SCRIPT_PATH as f,STUDIO_STYLE_PATH as A,createStudioMiddleware as P,isNonLoopbackHost as _,requestPathname as E,studioMountPath as c}from"../packem_shared/STUDIO_PATH-CX_2bua3.mjs";import{POLICY_SCAFFOLD_ENDPOINT as O,handlePolicyScaffoldRequest as h}from"../packem_shared/POLICY_SCAFFOLD_ENDPOINT-0QiGKazX.mjs";import{default as N}from"../packem_shared/renderStudioHtml-ByowDtMl.mjs";import{SCHEMA_EDIT_ENDPOINT as H,handleSchemaEditRequest as L}from"../packem_shared/SCHEMA_EDIT_ENDPOINT-Dbt0faMd.mjs";import{SEED_ENDPOINT as q,handleSeedRequest as v}from"../packem_shared/SEED_ENDPOINT-2B56PN_H.mjs";import{serveJsonHandler as M}from"../packem_shared/serveJsonHandler-Dv0EdCb9.mjs";import{ALLOW_FORWARDED_ENV as k,headerValue as F,isLoopbackAddress as U,transportRejectionReason as V}from"../packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs";export{k as ALLOW_FORWARDED_ENV,O as POLICY_SCAFFOLD_ENDPOINT,H as SCHEMA_EDIT_ENDPOINT,q as SEED_ENDPOINT,T as STUDIO_PATH,f as STUDIO_SCRIPT_PATH,A as STUDIO_STYLE_PATH,s as applyStudioAssetCache,S as assetContentType,P as createStudioMiddleware,h as handlePolicyScaffoldRequest,L as handleSchemaEditRequest,v as handleSeedRequest,F as headerValue,U as isLoopbackAddress,_ as isNonLoopbackHost,l as isStandaloneModulePath,p as loadStudioAssets,t as parseDevVariable,i as readStandaloneAsset,N as renderStudioHtml,E as requestPathname,r as resolveAdminToken,m as resolveStandaloneDirectory,d as sendStudioDocument,M as serveJsonHandler,u as studioAssetsStamp,c as studioMountPath,V as transportRejectionReason};
1
+ import{parseDevVariable as t,resolveAdminToken as r}from"../packem_shared/parseDevVariable-teAAahVD.mjs";import{applyStudioAssetCache as s,sendStudioDocument as d}from"../packem_shared/applyStudioAssetCache-DHQEJuuv.mjs";import{assetContentType as S,isStandaloneModulePath as l,loadStudioAssets as p,readStandaloneAsset as i,resolveStandaloneDirectory as m,studioAssetsStamp as u}from"../packem_shared/assetContentType-CUb5bpbI.mjs";import{STUDIO_PATH as T,STUDIO_SCRIPT_PATH as f,STUDIO_STYLE_PATH as A,createStudioMiddleware as P,isNonLoopbackHost as _,requestPathname as E,studioMountPath as c}from"../packem_shared/STUDIO_PATH-CysOklfX.mjs";import{POLICY_SCAFFOLD_ENDPOINT as O,handlePolicyScaffoldRequest as h}from"../packem_shared/POLICY_SCAFFOLD_ENDPOINT-B8xEUSap.mjs";import{default as N}from"../packem_shared/renderStudioHtml-ByowDtMl.mjs";import{SCHEMA_EDIT_ENDPOINT as H,handleSchemaEditRequest as L}from"../packem_shared/SCHEMA_EDIT_ENDPOINT-Dbt0faMd.mjs";import{SEED_ENDPOINT as q,handleSeedRequest as v}from"../packem_shared/SEED_ENDPOINT-2B56PN_H.mjs";import{serveJsonHandler as M}from"../packem_shared/serveJsonHandler-Dv0EdCb9.mjs";import{ALLOW_FORWARDED_ENV as k,headerValue as F,isLoopbackAddress as U,transportRejectionReason as V}from"../packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs";export{k as ALLOW_FORWARDED_ENV,O as POLICY_SCAFFOLD_ENDPOINT,H as SCHEMA_EDIT_ENDPOINT,q as SEED_ENDPOINT,T as STUDIO_PATH,f as STUDIO_SCRIPT_PATH,A as STUDIO_STYLE_PATH,s as applyStudioAssetCache,S as assetContentType,P as createStudioMiddleware,h as handlePolicyScaffoldRequest,L as handleSchemaEditRequest,v as handleSeedRequest,F as headerValue,U as isLoopbackAddress,_ as isNonLoopbackHost,l as isStandaloneModulePath,p as loadStudioAssets,t as parseDevVariable,i as readStandaloneAsset,N as renderStudioHtml,E as requestPathname,r as resolveAdminToken,m as resolveStandaloneDirectory,d as sendStudioDocument,M as serveJsonHandler,u as studioAssetsStamp,c as studioMountPath,V as transportRejectionReason};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/config",
3
- "version": "1.0.0-alpha.310",
3
+ "version": "1.0.0-alpha.311",
4
4
  "description": "Internal shared CLI + Vite config layer for Lunora: wrangler.jsonc validation, binding inference, and .dev.vars scaffolding",
5
5
  "keywords": [
6
6
  "bindings",
@@ -54,12 +54,13 @@
54
54
  "access": "public"
55
55
  },
56
56
  "dependencies": {
57
- "@lunora/codegen": "1.0.0-alpha.266",
57
+ "@lunora/codegen": "1.0.0-alpha.267",
58
58
  "@lunora/container": "1.0.0-alpha.69",
59
59
  "@lunora/errors": "1.0.0-alpha.50",
60
60
  "@lunora/seed": "1.0.0-alpha.193",
61
61
  "@visulima/colorize": "2.1.1",
62
62
  "@visulima/find-ai-runner": "1.0.2",
63
+ "@visulima/fs": "6.0.28",
63
64
  "@visulima/package": "5.0.41",
64
65
  "dockerode": "^5.0.1",
65
66
  "dotenv": "18.0.5",
@@ -1 +0,0 @@
1
- import{readFileSync as i,existsSync as E}from"node:fs";import{parse as u}from"es-module-lexer";import{WRANGLER_FILES as m,readWranglerJsonc as f}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{escapeRegExp as R}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{join as p}from"node:path";const x="_generated",_=["src/server.ts","src/server/index.ts","src/server/index.tsx","src/index.ts","src/worker.ts"],g=new Set(["build","coverage","dist",x,"node_modules","out","target"]),h=new Set([".client",".server"]),D=/[/\\]/u,b=t=>{const e=[];for(const r of t.split(D))r===""||r==="."||(r===".."&&e.length>0&&e.at(-1)!==".."?e.pop():e.push(r));return e},w=t=>b(t).slice(0,-1).some(e=>g.has(e)||e.startsWith(".")&&!h.has(e)),l={SchedulerDO:"SCHEDULER",SessionDO:"SESSION",ShardDO:"SHARD",ShardRegistryDO:"SHARD_REGISTRY"},S=Object.keys(l),k=t=>Object.hasOwn(l,t),T="virtual:lunora/worker",B=["ShardDO"],v=["agents","containers","scheduler","shardRegistry","workflows"],P={scheduler:"SchedulerDO",shardRegistry:"ShardRegistryDO"},A="src/worker.ts",G=t=>{for(const e of m){const r=p(t,e);if(!E(r))continue;const{parsed:s}=f(r),o=s?.main;if(o===T)return{composed:!0};const a=p(t,A);if(E(a))return{composed:!1,path:a};if(typeof o=="string"&&!w(o)&&E(p(t,o)))return{composed:!1,path:p(t,o)};break}for(const e of _){const r=p(t,e);if(E(r))return{composed:!1,path:r}}return{composed:!1}},L=/(?:^|[\s,{])type$/u,d=(t,e)=>{const r=e.ls>=0?e.ls:e.s;return L.test(t.slice(0,r).trimEnd())},O=(t,e)=>{const r=R(e);return new RegExp(String.raw`\bexport\s+type\s+${r}\b`,"u").test(t)||new RegExp(String.raw`\bexport\s+type\s*\{[^}]*\b${r}\b`,"u").test(t)||new RegExp(String.raw`\bexport\s+\{[^}]*\btype\s+${r}\b`,"u").test(t)},W=t=>{const e=i(t,"utf8");let r;try{const[,s]=u(e);r=new Set(s.filter(o=>!d(e,o)).map(o=>o.n))}catch{r=new Set(S.filter(s=>new RegExp(String.raw`\bexport\b[^\n;]*\b${s}\b`,"u").test(e)&&!O(e,s)))}return S.filter(s=>r.has(s)).map(s=>({binding:l[s],className:s}))},$=(t,e,r)=>{if(e.length===0)return[];if(t.composed)return e.map(n=>({...n,exported:!0}));if(t.path===void 0)return e.map(n=>({...n,exported:!1}));const s=i(t.path,"utf8"),o=new RegExp(String.raw`\bexport\s*\*\s*from\s*["'][^"']*_generated\/${r}(?:\.js)?["']`).test(s);let a;try{const[,n]=u(s);a=new Set(n.filter(c=>!d(s,c)).map(c=>c.n))}catch{a=new Set(e.map(n=>n.className).filter(n=>new RegExp(String.raw`\bexport\b[^\n;]*\b${R(n)}\b`,"u").test(s)&&!O(s,n)))}return e.map(n=>{const c=o||a.has(n.className);return{...n,exported:c}})};export{B as COMPOSED_ENTRY_DURABLE_OBJECTS,A as COMPOSED_WORKER_ENTRY,l as DURABLE_OBJECT_BINDINGS,v as GENERATED_CLASS_MODULES,x as GENERATED_DIRECTORY,P as GENERATED_MODULE_DURABLE_OBJECTS,T as LUNORA_WORKER_VIRTUAL_ID,g as NON_SOURCE_DIRECTORIES,h as SOURCE_DOT_DIRECTORIES,_ as WORKER_ENTRY_FALLBACKS,$ as detectClassExports,W as detectExportedDurableObjects,k as isFrameworkDurableObject,w as isGeneratedOutput,G as resolveWorkerEntry};
@@ -1 +0,0 @@
1
- const f=r=>{if(typeof r=="string")return r;try{return JSON.stringify(r)??String(r)}catch{return String(r)}},d=r=>typeof r!="object"||r===null||Array.isArray(r)?"":Object.entries(r).map(([t,n])=>`${t}=${f(n)}`).join(" "),p="lunora",l="__root__",e=r=>typeof r=="string"?r:"",a=r=>Array.isArray(r)?r.filter(t=>typeof t=="string"):[],g=r=>typeof r=="number"&&Number.isFinite(r)?`${String(Math.round(r))}ms`:"?ms",h=r=>r==="error"||r==="fatal"?"error":r==="warn"?"warn":"info",m=r=>{const t=r.trim();if(!t.startsWith("{")||!t.endsWith("}"))return;let n;try{n=JSON.parse(t)}catch{return}if(typeof n!="object"||n===null)return;const o=n;return o.source===p?o:void 0},u=(r,t)=>{const n=e(t.shard);return n===""||n===l?r:`${r}@${n}`},y=(r,t)=>{const n=r.outcome==="error",o=[u(t,r),n?"error":"ok",g(r.durationMs)],i=a(r.tablesRead),s=a(r.tablesWritten);i.length>0&&o.push(`read[${i.join(",")}]`),s.length>0&&o.push(`write[${s.join(",")}]`),r.cacheHit===!0&&o.push("cached");const c=e(r.error);return n&&c!==""&&o.push(c),{kind:"rpc",level:n?"error":"info",text:o.join(" ")}},$=r=>{const t=e(r.container)||"<unknown>",n=e(r.instance),o=e(r.event)||"event",i=n===""||n==="unknown"?"":`#${n.slice(0,8)}`,s=e(r.message),c=[`container:${t}${i}`,o];return s!==""&&c.push(s),{kind:"log",level:r.event==="error"?"error":"info",text:c.join(" ")}},j=r=>{const t=m(r);if(!t)return;const n=e(t.function)||"<unknown>";if(t.type==="log"){const o=[`${u(n,t)} ${e(t.message)}`.trimEnd()],i=d(t.fields);i!==""&&o.push(i);const s=e(t.traceId);return s!==""&&o.push(`trace=${s.slice(0,8)}`),{kind:"log",level:h(e(t.level)),text:o.join(" ")}}if(t.type==="request")return y(t,n);if(t.type==="container")return $(t)};export{p as LUNORA_EVENT_SOURCE,j as formatLunoraEvent};
@@ -1,19 +0,0 @@
1
- import{existsSync as g,readFileSync as m,writeFileSync as d}from"node:fs";import{join as l,dirname as x}from"node:path";import{parse as v}from"jsonc-parser";import{readProjectDependencyNames as F}from"./detectFramework-CUiVEHDQ.mjs";import{applyModify as $}from"./applyModify-DKP2l6S9.mjs";const c=["lunora/_generated/","lunora/.lunora-schema.json","lunora.advisor.map.json",".lunora/",".wrangler/"],f={biome:{configFiles:["biome.json","biome.jsonc"],packages:["@biomejs/biome"],shadowable:!0},eslint:{configFiles:["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],packages:["eslint"],shadowable:!0},oxlint:{configFiles:[".oxlintrc.json"],packages:["oxlint"],shadowable:!0},prettier:{configFiles:[".prettierrc",".prettierrc.json",".prettierrc.js",".prettierrc.mjs",".prettierrc.cjs","prettier.config.js","prettier.config.mjs","prettier.config.cjs"],packages:["prettier"],shadowable:!1}},k=Object.keys(f),y=(e,n)=>f[n].configFiles.map(t=>l(e,t)).find(t=>g(t)),w=(e,n)=>{let t=e;for(;;){const s=y(t,n);if(s!==void 0)return s;if(g(l(t,".git")))return;const i=x(t);if(i===t)return;t=i}},j=(e,n)=>{const t=y(e,n);if(t!==void 0)return{action:"extend",path:t};const s=g(l(e,".git")),i=f[n].shadowable&&!s?w(x(e),n):void 0,[a=""]=f[n].configFiles;return i===void 0?{action:"create",path:l(e,a)}:{action:"report",path:i}},J=e=>{const n=F(e),t=()=>{try{return JSON.parse(m(l(e,"package.json"),"utf8")).prettier!==void 0}catch{return!1}};return k.filter(s=>f[s].packages.some(i=>n.has(i))||y(e,s)!==void 0||s==="prettier"&&t())},L="# Lunora generated + derived artifacts",O=e=>{const n=l(e,".prettierignore"),t=g(n)?m(n,"utf8"):void 0,s=t===void 0?[]:t.split(`
2
- `).map(o=>o.trim()),i=c.filter(o=>!s.includes(o));if(i.length===0)return{path:n,status:t===void 0?"created":"unchanged",tool:"prettier"};const a=`${L}
3
- ${i.join(`
4
- `)}
5
- `;return t===void 0?(d(n,a,"utf8"),{path:n,status:"created",tool:"prettier"}):(d(n,`${t.endsWith(`
6
- `)?t:`${t}
7
- `}
8
- ${a}`,"utf8"),{path:n,status:"updated",tool:"prettier"})},A=(e,n,t,s)=>{const i=g(e),a=i?m(e,"utf8"):`{}
9
- `;let r=v(a)??{};for(const u of n)r=r!==null&&typeof r=="object"?r[u]:void 0;const h=Array.isArray(r)?r:[],b=t.filter(u=>!h.includes(u));return b.length===0&&i?{path:e,status:"unchanged",tool:s}:(d(e,$(a,n,[...h,...b]),"utf8"),{path:e,status:i?"updated":"created",tool:s})},S=(e,n)=>`"${e}": [${n.map(t=>`"${t}"`).join(", ")}]`,I=()=>S("files.includes",c.map(e=>`!${e.endsWith("/")?`${e}**`:e}`)),P=e=>{const{action:n,path:t}=j(e,"oxlint");return n==="report"?{path:t,snippet:S("ignorePatterns",c),status:"manual",tool:"oxlint"}:A(t,["ignorePatterns"],c,"oxlint")},E=e=>{const{action:n,path:t}=j(e,"biome");if(n==="report")return{path:t,snippet:I(),status:"manual",tool:"biome"};const s=n==="extend",i=s?m(t,"utf8"):`{}
10
- `,o=(v(i)??{}).files??{};if(Array.isArray(o.ignore))return A(t,["files","ignore"],c,"biome");const r=Array.isArray(o.includes)?o.includes:[],h=r.length===0?["**"]:r,u=c.map(p=>`!${p.endsWith("/")?`${p}**`:p}`).filter(p=>!r.includes(p));return u.length===0&&s?{path:t,status:"unchanged",tool:"biome"}:(d(t,$(i,["files","includes"],[...h,...u]),"utf8"),{path:t,status:s?"updated":"created",tool:"biome"})},T=()=>`{
11
- // Lunora generated + derived artifacts.
12
- ignores: [${c.map(e=>`"${e.endsWith("/")?`${e}**`:e}"`).join(", ")}],
13
- }`,W=e=>{const{action:n,path:t}=j(e,"eslint"),s=T();if(n!=="create"){const a=m(t,"utf8"),o=c.every(r=>a.includes(r))?"unchanged":"manual";return{path:t,...o==="manual"?{snippet:s}:{},status:o,tool:"eslint"}}const i=l(e,"eslint.config.mjs");return d(i,`// Flat config. Add your own entries alongside the ignores below.
14
- export default [
15
- ${s.replaceAll(`
16
- `,`
17
- `)},
18
- ];
19
- `,"utf8"),{path:i,status:"created",tool:"eslint"}},_={biome:E,eslint:W,oxlint:P,prettier:O},M=(e,n)=>n.map(t=>{try{return _[t](e)}catch(s){return{message:s instanceof Error?s.message:String(s),path:e,status:"failed",tool:t}}});export{c as LUNORA_IGNORED_PATHS,M as applyLintIgnores,J as detectLintTools};
@@ -1 +0,0 @@
1
- import{o as m,v as h,a as E,b as p,c as D,d as y,e as l,f as I,g as O,H as R,h as S,R as $,S as j,i as A,j as k,W as L,k as w}from"./validate-bindings-DFAcr5wA.mjs";import{validateTailConsumers as B,validateSendEmail as T,validateSecretsRequired as N,validateLogpush as C,validateLimits as U,validatePlacement as P,validateObservability as G,validateAssets as K,validateCache as V,validateExports as W,validateCorsVariables as x,validateSchedulerOrigin as F}from"./withTailConsumer-BZqzeKYh.mjs";import{isCacheEnabled as H,WORKERS_CACHE_MIN_DATE as _}from"./WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{mergeWranglerEnvironment as M}from"./mergeWranglerEnvironment-DXiB-HcS.mjs";const Y=i=>typeof i=="object"&&i!==null&&!Array.isArray(i),f=i=>Array.isArray(i)?i.flatMap((a,n)=>Y(a)?[[n,a]]:[]):[],g=i=>typeof i.binding=="string"?i.binding:"",q=(i,a,n)=>{for(const[e,s]of f(i.kv_namespaces))typeof s.id=="string"&&s.id!==""||n.push(`kv_namespaces[${String(e)}] ("${g(s)}") is not created yet and the schema pins data to "${a}" — create it with \`wrangler kv namespace create <name> --jurisdiction=${a}\`; a namespace's jurisdiction cannot be changed afterwards`)},Q=(i,a,n)=>{for(const[e,s]of f(i.r2_buckets)){const r=s.jurisdiction;if(r===a)continue;const t=typeof r=="string"?`names the "${r}" jurisdiction`:"names no jurisdiction";n.push(`r2_buckets[${String(e)}] ("${g(s)}") ${t}, but the schema pins data to "${a}" — create the bucket with \`wrangler r2 bucket create <name> --jurisdiction=${a}\` and set "jurisdiction": "${a}" on the binding`)}},J=(i,a,n)=>{const e=a?.jurisdiction;e!==void 0&&(q(i,e,n),Q(i,e,n))},b="2026-04-07",de="web_socket_auto_reply_to_close",u="2026-10-01",v="durable_object_io_tasks_prevent_eviction",z="durable_object_io_tasks_do_not_prevent_eviction",X=/^\d{4}-\d{2}-\d{2}$/,Z=(i,a,n)=>{i>=u||a.includes(v)||a.includes(z)||n.push(`compatibility_date "${i}" predates "${u}", so pending I/O (waitUntil, cross-Durable-Object RPC, service-binding calls, timers) does not keep a Durable Object alive once its last client disconnects — live-query refreshes and durable streams can be cut off mid-flight. Set compatibility_date >= "${u}" or add the "${v}" compatibility flag`)},ee=(i,a,n)=>{const{error:e,merged:s,unverifiedKeys:r}=M(i,a);return e!==void 0?{error:e,wrangler:s}:(r.length>0&&n.push(`env.${String(a)} overrides ${r.join(", ")}, which this validator doesn't have a verified inheritance rule for — validated against the TOP-LEVEL value only. Double-check ${r.length===1?"it":"them"} by hand for "${String(a)}".`),{wrangler:s})},te=(i,a,n)=>{const e=[],s=[];if(!i||typeof i!="object")return e.push("wrangler config is not a valid object"),{errors:e,valid:!1,warnings:s};const{error:r,wrangler:t}=ee(i,n,s);if(r!==void 0)return e.push(r),{errors:e,valid:!1,warnings:s};m(t.durable_objects?.bindings).find(o=>o.name==="SHARD"&&o.class_name==="ShardDO")||e.push('durable_objects.bindings must include { "name": "SHARD", "class_name": "ShardDO" } — your dev server auto-reconciles this on startup, or add the binding manually'),h(t,e);const d=t.compatibility_date??"",c=X.test(d);d&&!c?e.push(`compatibility_date must be in YYYY-MM-DD format (got "${d}")`):d<b&&e.push(`compatibility_date must be >= "${b}" (got "${d||"<missing>"}")`),H(t)&&c&&d<_&&e.push(`cache.enabled requires compatibility_date >= "${_}" (got "${d||"<missing>"}")`),c&&Z(d,t.compatibility_flags??[],s),E(t,a,e),J(t,a,s),p(t,e),D(t,a?.vectorIndexNames??[],e),B(t,e),y(t,e,s),l(t.workflows,"workflows",L,e),I(t,e),O(t,e),l(t.secrets_store_secrets,"secrets_store_secrets",w,e);for(const o of R)S(t,o,e,s);for(const o of $)l(t[o.key],o.key,o,e);for(const o of j)A(t,o,e);return k(t,e),T(t,e,s),N(t,e),C(t,e),U(t,e),P(t,e),G(t,e,s),K(t,e),V(t,e),W(t,e),x(t,e),F(t,n,s),{errors:e,valid:e.length===0,warnings:s}},ce=te;export{b as REQUIRED_COMPATIBILITY_DATE,de as REQUIRED_FLAG,ce as validateWrangler,te as validateWranglerConfig};
@@ -1 +0,0 @@
1
- import{existsSync as d}from"node:fs";import{dirname as u,join as h}from"node:path";import{discoverSchemaInfo as v}from"./discoverSchemaInfo-BguahM6z.mjs";import{COMPOSED_ENTRY_DURABLE_OBJECTS as y,GENERATED_CLASS_MODULES as w,isFrameworkDurableObject as E}from"./COMPOSED_WORKER_ENTRY-C69wqbSP.mjs";import{o as $}from"./validate-bindings-DFAcr5wA.mjs";import{l as k,r as x,s as j}from"./worker-entry-checks-9Vdz4d2f.mjs";import{mergeWranglerEnvironment as D}from"./mergeWranglerEnvironment-DXiB-HcS.mjs";import{findWranglerFile as A,readWranglerJsonc as R}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{validateWranglerConfig as W}from"./REQUIRED_COMPATIBILITY_DATE-Bv07Q3v8.mjs";const b=r=>Array.isArray(r)?r:[],_=(r,s,o)=>Object.entries(r?.images??{}).flatMap(([t,n])=>{const e=n?.dockerfile;return typeof e!="string"||d(e.startsWith("/")?e:h(s,e))?[]:[`containers images["${t}"] dockerfile "${e}" does not exist (resolved relative to ${o}); create the Dockerfile`]}),S=(r,s,o)=>{const t=[];for(const n of b(r)){const e=n?.image;typeof e=="string"&&(e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.includes("Dockerfile"))&&!d(e.startsWith("/")?e:h(s,e))&&t.push(`containers image "${e}" does not exist (resolved relative to ${o}); create the Dockerfile or point image at a registry reference`),t.push(..._(n,s,o))}return t},N=(r,s)=>{const o=r?.vectorIndexNames??[],t=[];if(o.length>0&&t.push({message:e=>`schema declares vector index(es) ${o.map(i=>`"${i}"`).join(", ")} but nothing chains .vectors(...) onto defineApp() (composed in: ${e}) — \`ctx.vectors\` is then a throwing stub and buildWorkerOptions rejects EVERY request, /_lunora/health included. Add \`.vectors((env) => ({ ${String(o[0])}: env.<BINDING> }))\` to the chain.`,method:"vectors"}),r?.hasD1GlobalTable&&t.push({message:e=>`schema declares .global() table(s) but nothing chains .global(...) onto defineApp() (composed in: ${e}) — the shard then has no global writer, so every read or write of a global table throws INTERNAL ("requires a globalDb writer"). Add \`.global({ d1: (env) => env.DB })\` to the chain.`,method:"global"}),r?.hasHyperdriveGlobalTable&&t.push({message:e=>`schema declares .global({ backend: "hyperdrive" }) table(s) but nothing chains .hyperdriveGlobal(...) onto defineApp() (composed in: ${e}) — the shard then has no global writer, so every read or write of those tables throws INTERNAL. Add \`.hyperdriveGlobal({ engine: "postgres", exec: (env) => buildPgExec(fromPostgresJs(postgres(env.HYPERDRIVE.connectionString))) })\` to the chain (\`buildPgExec\` from \`@lunora/hyperdrive/global\`, \`fromPostgresJs\` from \`@lunora/hyperdrive\`).`,method:"hyperdriveGlobal"}),t.length===0)return[];const n=j(s,new Set(t.map(e=>e.method)));return n===void 0?[]:t.filter(e=>!n.chained.has(e.method)).map(e=>e.message(n.site))},O="does not export it",P=(r,s)=>{if(s!=="composed")return`Re-export it from the module that defines it (\`export { ${r} } from "./…";\`), or add it to the app builder's own export (\`export const { ${r} } = app;\`).`;const o=`it exports ${y.join(", ")}, SchedulerDO when its binding is declared, and every class codegen emits from your ${w.map(t=>`${t}.ts`).join(" / ")} declarations`;return E(r)?`\`@lunora/vite\` generates that entry — ${o}, and ${r} is not among them. Class-A composition does not carry ${r}, so drop the binding; a project that needs it has to own its worker entry (add \`src/worker.ts\`, which \`lunora deploy\` bundles in place of \`main\`, and compose \`defineApp()\` there).`:`\`@lunora/vite\` generates that entry, so there is no file to add a re-export to: ${o}. Declare "${r}" in one of those and re-run \`lunora codegen\`, or drop the binding.`},C=(r,s)=>{const o=s.exports;if(o===void 0)return[];const t=[];for(const e of $(r.durable_objects?.bindings))typeof e.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&t.push({className:e.class_name,label:"durable_objects.bindings"});for(const e of b(r.workflows))typeof e?.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&t.push({className:e.class_name,label:"workflows"});for(const[e,i]of Object.entries(r.exports??{}))i?.type==="workflow"&&t.push({className:e,label:"workflows"});return t.filter(e=>!o.has(e.className)).map(e=>`${e.label} declares class "${e.className}" but the ${s.kind==="composed"?"composed class-A worker entry":"worker entry"} (${s.path}) ${O} — wrangler refuses to bundle a Worker whose ${e.label==="workflows"?"Workflow":"Durable Object"} classes are not exported. ${P(e.className,s.kind)}`)},I=r=>r?.origin!=="absent"?[]:[`main is set but no readable file is there (looked in ${r.path}) — wrangler cannot resolve the worker entry, so a deploy will fail there. Point main at the entry that composes your app, or remove it to fall back to the conventional locations.`],H=r=>{const s=r.schemaDir??"lunora",o=A(r.projectRoot);if(!o){const l=`wrangler.jsonc not found in ${r.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[l],report:{errors:[l],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:t}=R(o);if(t===void 0){const l=`failed to parse ${o} as JSONC.`;return{problems:[l],report:{errors:[l],valid:!1,warnings:[]},wranglerPath:o}}const{error:n,merged:e}=D(t,r.environment);if(n!==void 0)return{problems:[n],report:{errors:[n],valid:!1,warnings:[]},wranglerPath:o};const{error:i,info:p}=v(r.projectRoot,s),a=W(t,p,r.environment);i!==void 0&&a.warnings.push(`schema parse failed in ${s}/schema.ts: ${i}`);const m=u(o),f=k(e.main,r.projectRoot,o),g=x(f,r.projectRoot,s);a.errors.push(...S(e.containers??[],m,o)),a.warnings.push(...I(f)),g!==void 0&&a.errors.push(...C(e,g)),a.errors.push(...N(p,r.projectRoot));const c=e.assets?.directory;if(typeof c=="string"&&c.length>0){const l=c.startsWith("/")?c:h(m,c);d(l)||a.warnings.push(`assets.directory "${c}" does not exist yet — it is created by the client build; run the build before deploy`)}return a.valid=a.errors.length===0,{problems:a.errors,report:a,wranglerPath:o}};export{O as UNEXPORTED_CLASS_MARKER,H as validateWranglerProject};
@@ -1,2 +0,0 @@
1
- import{readFileSync as F,writeFileSync as X}from"node:fs";import{createRequire as z}from"node:module";import{join as Q}from"node:path";import{containerBuildTag as Z}from"@lunora/container";import{applyModify as S}from"./applyModify-DKP2l6S9.mjs";import{a as ee,r as M}from"./lunora-manifest-v90ZUbVp.mjs";import{parseTree as ne,findNodeAtLocation as se}from"jsonc-parser";import{r as te,a as oe,b as ie,c as re}from"./reconcile-services-3dn35zgy.mjs";import{a as ae,p as de}from"./infer-bindings-B-BFynp2.mjs";import{DEV_VARS_FILE as ce,parseDevVariableEntries as le}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{requiredSecrets as ue}from"./buildPackageSecretsBlock-yv9mjKEW.mjs";import{w as ge,n as me,s as Y,o as B,p as j,q as pe}from"./validate-bindings-DFAcr5wA.mjs";import{s as fe}from"./worker-entry-checks-9Vdz4d2f.mjs";import{DEFAULT_OBSERVABILITY as be}from"./DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import{findWranglerFile as he,readWranglerJsonc as we}from"./WRANGLER_FILES-UNW-xY5u.mjs";const ve=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],R=e=>Object.fromEntries(ve.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),P="queueTuning",_e=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,ye=/^[\t ]*,/u,Se=(e,n)=>{const s=ne(e),t=s===void 0?void 0:se(s,[...n])?.parent;if(t?.type==="property"){const i=t.offset+t.length,o=e.lastIndexOf(`
2
- `,t.offset-1)+1,d=_e.exec(e.slice(i));if(d!==null&&e.slice(o,t.offset).trim()===""){const a=t.parent?.children??[],b=a.indexOf(t),c=b===a.length-1&&b>0?a[b-1]:void 0,l=c===void 0?void 0:ye.exec(e.slice(c.offset+c.length))??void 0;return(l===void 0||c===void 0?e.slice(0,o):e.slice(0,c.offset+c.length)+e.slice(c.offset+c.length+l[0].length,o))+e.slice(i+d[0].length)}}return S(e,n,void 0)},G=(e,n,s,t,i,o=new Set)=>{const d=s.join("."),a={},b=[],c=[];let l=e;return{entries:n.map((u,w)=>{const g=t(u);if(g===void 0||u.queue===void 0)return u;const p=Object.fromEntries(Object.entries(R(g)).filter(([f])=>!o.has(f))),h=Object.entries(i[u.queue]??{}).filter(([f])=>!Object.hasOwn(p,f)),v=Object.entries(p).filter(([f,y])=>u[f]!==y),x=h.filter(([f,y])=>u[f]===y).map(([f])=>f),N=Object.fromEntries(Object.entries({...u,...p}).filter(([f])=>!x.includes(f)));for(const[f,y]of v)l=S(l,[...s,w,f],y);for(const f of x)l=Se(l,[...s,w,f]);for(const[f,y]of h){const E=u[f];E!==void 0&&E!==y&&c.push(`${d}/${u.queue}: ${f} is no longer declared by defineQueue, but it was changed by hand to ${JSON.stringify(E)} from the declared ${JSON.stringify(y)}, so it was kept. Delete it from wrangler.jsonc if it should go.`)}return(v.length>0||x.length>0)&&b.push(`${d}/${u.queue} (${[...v.map(([f])=>f),...x.map(f=>`removed ${f}`)].join(", ")})`),Object.keys(p).length>0&&(a[u.queue]=p),N}),owned:a,text:l,updated:b,warnings:c}},xe=(e,n,s,t)=>{const i=n.queues??{},o=i.producers??[],d=i.consumers??[],a=new Set(o.map(g=>g.binding)),b=new Set(d.map(g=>g.queue)),c=s.filter(g=>!a.has(g.bindingName)),l=s.filter(g=>!b.has(g.name)),m=G(e,d,["queues","consumers"],g=>s.find(p=>p.name===g.queue),t);let u=m.text;const w={...m.owned};if(c.length>0||l.length>0){const g=[...o,...c.map(h=>({binding:h.bindingName,queue:h.name}))],p=[...m.entries,...l.map(h=>({queue:h.name,...h.mode==="pull"?{type:"http_pull"}:{},...R(h)}))];for(const h of l){const v=R(h);Object.keys(v).length>0&&(w[h.name]=v)}u=S(u,["queues"],{consumers:p,producers:g})}return{added:[...c.map(g=>`queues.producers/${g.bindingName}`),...l.map(g=>`queues.consumers/${g.name}`)],owned:w,text:u,updated:m.updated,warnings:m.warnings}},Ne=(e,n,s,t,i)=>{const o=n.env?.[t],d=o?.queues?.consumers??[],a=o?.queues?.producers??[],b=u=>{const w=a.find(g=>g.queue===u.queue)?.binding;return w!==void 0?s.find(g=>g.bindingName===w):s.find(g=>g.name===u.queue&&!a.some(p=>p.binding===g.bindingName))},c=G(e,d,["env",t,"queues","consumers"],b,i,new Set(["dead_letter_queue"])),l=d.filter(u=>u.queue!==void 0&&b(u)===void 0).map(u=>`env.${t}.queues.consumers/${String(u.queue)}: no defineQueue export matches it — this block declares no producer mapping one of their bindings to "${String(u.queue)}", and no export is named that — so it was not retuned. A consumer for a queue another worker produces is skipped the same way.`),m=d.flatMap(u=>{const w=b(u)?.tuning.deadLetterQueue;return w===void 0||u.dead_letter_queue!==void 0?[]:[`env.${t}.queues.consumers/${String(u.queue)}: defineQueue declares deadLetterQueue "${w}", but this consumer has no dead_letter_queue, so its exhausted messages are dropped. Queue names differ per environment, so reconcile does not write it here; add it by hand.`]});return{added:[],owned:c.owned,text:c.text,updated:c.updated,warnings:[...c.warnings,...m,...l]}},Oe=(e,n)=>{if(e?.lunoraIsForeign===!0)return n.push(`${e.path}: \`lunora\` is not an object, so the queue tuning ownership record cannot be read or written — an option removed from defineQueue stays deployed.`),{};const s=e?.lunora?.[P],t=i=>typeof i=="object"&&i!==null&&!Array.isArray(i);return s===void 0?{}:!t(s)||!Object.values(s).every(i=>t(i)&&Object.values(i).every(o=>t(o)))?(n.push(`${e?.path??"package.json"}: \`lunora.${P}\` is not a map of scope → queue → fields, so it is ignored — an option removed from defineQueue stays deployed until the next pass records it again.`),{}):s},Ee=(e,n,s)=>{const t=Object.fromEntries(Object.entries({...n,...s}).filter(([,i])=>Object.keys(i).length>0));ee(e,P,Object.keys(t).length===0?void 0:t)},C="PIPELINES",I="ARTIFACTS",ke=(e,n)=>{const s=e.flagshipBinding!==void 0&&!(n?.flagship??[]).some(a=>a.binding===e.flagshipBinding),t=e.usesPipelines&&!(n?.pipelines??[]).some(a=>a.binding===C),i=e.usesArtifacts?n?.artifacts??[]:[],o=i.some(a=>a.binding===I)?[]:i.flatMap(a=>a.binding===void 0?[]:[a.binding]);return[[e.usesKv&&(n?.kv_namespaces?.length??0)===0,"@lunora/bindings/kv is used but no kv_namespaces binding exists; add a kv_namespaces entry ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned."],[e.usesHyperdrive&&(n?.hyperdrive?.length??0)===0,"@lunora/hyperdrive is used but no hyperdrive binding exists; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned."],[t,`ctx.pipelines is used but no "${C}" pipelines binding exists; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding: "${C}", stream }) — codegen resolves this one name, and the pipeline resource can't be auto-provisioned.`],[e.usesArtifacts&&i.length===0,ae(e.jurisdiction)],[o.length>0,`ctx.artifacts is used and ${o.map(a=>`"${a}"`).join(", ")} ${o.length===1?"is":"are"} bound, but none is named "${I}"; make sure \`.artifacts()\` on defineApp points ctx.artifacts at it — otherwise it reads env.${I} and throws.`],[s,`lunora/flags.ts uses Flagship in binding mode but no flagship binding "${e.flagshipBinding??""}" exists; add a flagship entry ({ binding: "${e.flagshipBinding??""}", app_id }) — the app_id can't be auto-provisioned.`]].filter(([a])=>a).map(([,a])=>a)},$e=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.`),Ae=(e,n)=>{const s=new Set([...e.workflows,...e.agents].map(o=>o.className));if(s.size===0)return[];const t=Object.entries(n.exports??{}).flatMap(([o,d])=>d?.type==="workflow"?[o]:[]),i=(n.workflows??[]).flatMap(o=>o.class_name===void 0||o.script_name!==void 0?[]:[o.class_name]);return[...new Set([...t,...i])].filter(o=>!s.has(o)).map(o=>`wrangler.jsonc declares workflow "${o}" but no defineWorkflow/defineAgent export generates that class — a leftover from a rename will fail the deploy (wrangler rejects a class the worker does not export). Remove it if it is not hand-wired.`)},qe=(e,n)=>{if(e.queues.length===0)return[];const s=new Set(e.queues.map(i=>i.name)),t=new Set(e.queues.map(i=>i.bindingName));return[...(n.queues?.consumers??[]).flatMap(i=>{const{queue:o}=i;return o===void 0||s.has(o)?[]:[`wrangler.jsonc subscribes queues.consumers[] to "${o}" but no defineQueue export declares that queue — a leftover from a rename keeps delivering batches this worker has no handler for (they retry to exhaustion, then drop or dead-letter). Remove it if it is not hand-wired.`]}),...(n.queues?.producers??[]).flatMap(i=>{const{binding:o}=i;return o===void 0||t.has(o)?[]:[`wrangler.jsonc declares queues.producers[] binding "${o}" but no defineQueue export declares it — a leftover from a rename. Remove it if it is not hand-wired.`]})]},je=(e,n)=>[...Ae(e,n),...qe(e,n)],U=[{keys:["STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET"],label:"Stripe"},{keys:["POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"],label:"Polar"},{keys:["CREEM_API_KEY","CREEM_WEBHOOK_SECRET"],label:"Creem"},{keys:["AUTUMN_SECRET_KEY","AUTUMN_WEBHOOK_SECRET"],label:"Autumn"},{keys:["DODO_PAYMENTS_API_KEY","DODO_PAYMENTS_WEBHOOK_KEY"],label:"Dodo Payments"}],Ce=()=>U.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),Ie=e=>{let n;try{n=F(Q(e,ce),"utf8")}catch{return!1}const s=new Map(le(n).map(t=>[t.key,t.value]));return U.some(({keys:t})=>t.every(i=>(s.get(i)??"")!==""))},De=(e,n)=>{const s=n?.secrets?.required;if(!Array.isArray(s))return[];const t=new Set(s),i=ue(de(e)).map(o=>o.key).filter(o=>!t.has(o));return i.length===0?[]:[`wrangler.jsonc declares secrets.required without ${i.join(", ")}, which this app needs — wrangler dev loads only the listed keys from .dev.vars, so add ${i.length===1?"it":"them"} to secrets.required.`]},T=(e,n,s)=>{const t=new Set(e.durableObjects.map(a=>a.className)),i=[],o=(s?.r2_buckets?.length??0)>0,d=(s?.d1_databases?.some(a=>a.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!o&&i.push("@lunora/storage is used but R2 bucket bindings have user-defined names; add an r2_buckets entry and pass env.<BINDING> to createStorage()."),e.usesAuth&&!t.has("SessionDO")&&!d&&i.push("@lunora/auth is used but the worker entry exports no SessionDO; sessions are D1-backed, or export SessionDO to enable DO-backed sessions."),e.usesScheduler&&!t.has("SchedulerDO")&&i.push("@lunora/scheduler is used but the worker entry exports no SchedulerDO; export it so the SCHEDULER binding can be provisioned."),i.push(...D("container","containers",e.containers),...D("workflow","workflows",e.workflows),...D("agent","agents",e.agents)),e.containers.length>0&&s?.observability?.enabled===!1&&i.push("containers are declared but observability is explicitly disabled in wrangler.jsonc — container logs will not be captured."),e.usesPayments&&!Ie(n)&&i.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${Ce()}.`),i.push(...$e(e),...ke(e,s),...De(e,s)),s!==void 0&&i.push(...je(e,s)),i},H="<replace-with-d1-create-id>",Te=e=>[["container","containers",e.containers],["workflow","workflows",e.workflows],["agent","agents",e.agents]].flatMap(([s,t,i])=>i.filter(o=>!o.exported).map(({className:o,exportName:d})=>({className:o,exportName:d,kind:s,module:t}))),Be=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)}`},Re=e=>{const n=new Set;for(const s of B(e)){for(const t of j(s.deleted_classes))n.delete(t);for(const{from:t,to:i}of B(s.renamed_classes))t!==void 0&&n.delete(t),i!==void 0&&n.add(i);for(const t of[...j(s.new_classes),...j(s.new_sqlite_classes)])n.add(t)}return n},Pe=(e,n,s)=>{const t=n.durable_objects?.bindings??[],i=new Set(t.map(l=>l.name)),o=s.filter(l=>!i.has(l.binding));let d=e;const a=[];if(o.length>0){const l=[...t,...o.map(m=>({class_name:m.className,name:m.binding}))];d=S(d,["durable_objects","bindings"],l),a.push(...o.map(m=>`${m.binding}/${m.className}`))}const b=n.migrations??[],c=s.map(l=>l.className).filter(l=>!Re(b).has(l));if(c.length>0){const l=[...b,{new_sqlite_classes:c,tag:Be(b)}];d=S(d,["migrations"],l)}return{added:a,text:d}},Le=(e,n)=>{const s=n.d1_databases??[];if(s.some(o=>o.binding==="DB"))return{added:[],text:e};const t=typeof n.name=="string"&&n.name.length>0?n.name:"lunora",i=[...s,{binding:"DB",database_id:H,database_name:t}];return{added:["DB (D1)"],text:S(e,["d1_databases"],i)}},We={ai:{binding:"AI",label:"AI (Workers AI)"},analytics:{binding:"ANALYTICS_SQL",label:"ANALYTICS_SQL (Analytics SQL)"},browser:{binding:"BROWSER",label:"BROWSER (Browser Rendering)"},images:{binding:"IMAGES",label:"IMAGES (Cloudflare Images)"}},$=(e,n,s)=>{const{binding:t,label:i}=We[s],o=n[s]?.binding;return typeof o=="string"&&o.length>0?{added:[],text:e}:{added:[i],text:S(e,[s],{binding:t})}},Me=(e,n)=>e.usesAnalyticsSql&&fe(n,new Set(["analyticsSql"]))?.chained.has("analyticsSql")!==!0,Ke=new Set(["ratelimits","send_email"]),Fe=["durable_objects","logfwdr","unsafe"],Qe=new Set(["data_blobs","text_blobs","vars","wasm_modules"]),W=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),L=(e,n,s)=>W(e)&&e[n]===s,Ye=(e,n,s)=>{if(Qe.has(e))return W(n)&&Object.hasOwn(n,s);const t=Ke.has(e)?"name":"binding";return Array.isArray(n)?n.some(i=>L(i,t,s)):L(n,"binding",s)},Ge=(e,n)=>{const s=e,t=Object.entries(s).find(([o,d])=>o!=="env"&&Ye(o,d,n));if(t!==void 0)return t[0];for(const o of Fe){const d=s[o];if(W(d)&&Array.isArray(d.bindings)&&d.bindings.some(a=>L(a,"name",n)))return`${o}.bindings`}if(e.queues?.producers?.some(o=>o.binding===n)===!0)return"queues.producers";const i=e.secrets?.required;if(Array.isArray(i)&&i.includes(n))return"secrets.required"},K=(e,n,s,t,i)=>{if((n[s]?.length??0)>0)return{added:[],text:e};const o=Ge(n,t.binding);return o!==void 0?{added:[],text:e,warnings:[`${s}: not adding ${JSON.stringify(t)} — the name "${t.binding}" is already bound by \`${o}\` in wrangler.jsonc. Add a ${s} entry under another binding name and point the matching \`defineApp()\` override at it.`]}:{added:[i],text:S(e,[s],[t])}},Ue=(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"}])}},He=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},Je=e=>{const{image:n}=e;return n.kind==="dockerfile"?n.dockerfilePath:n.kind==="registry"?n.reference:Z(e.exportName)},J=e=>{const n={};for(const[s,t]of Object.entries(e.images??{}))n[s]=t.kind==="registry"?{image:t.reference}:{build_context:t.buildContext,dockerfile:t.dockerfilePath,...e.buildArgs===void 0?{}:{build_vars:e.buildArgs}};return{class_name:e.className,scheduling_policy:"durable_object",...Object.keys(n).length>0?{images:n}:{},...e.name===void 0?{}:{name:e.name}}},Ve=e=>{if(e.schedulingPolicy==="durable_object")return J(e);const{image:n}=e,s={class_name:e.className,image:Je(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=He(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},Xe=(e,n,s)=>{const t=n.containers??[],i=new Set(t.map(c=>c.class_name)),o=s.filter(c=>!i.has(c.className));let d=o.length===0?e:S(e,["containers"],[...t,...o.map(c=>Ve(c))]);const a=[],b=[];for(const[c,l]of t.entries()){const m=s.find(g=>g.className===l.class_name);if(m===void 0)continue;const u=m.schedulingPolicy??"default";if((l.scheduling_policy??"default")!==u){b.push(`containers/${m.className} has scheduling_policy "${l.scheduling_policy??"default"}" in wrangler.jsonc but defineContainer "${m.exportName}" declares "${u}" — the policy is immutable, so replace the entry (and its container application) by hand.`);continue}const w=m.schedulingPolicy==="durable_object"?J(m).images:void 0;w!==void 0&&JSON.stringify(l.images)!==JSON.stringify(w)&&(d=S(d,["containers",c,"images"],w),a.push(`containers/${m.className}.images`))}return{added:o.map(c=>`containers/${c.className}`),text:d,updated:a,warnings:b}},ze=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=S(e,["observability"],{...be});return{added:["observability"],text:s}},V=[{minimum:[4,142],name:"wrangler"},{minimum:[1,61],name:"@cloudflare/vite-plugin"}],Ze=V.map(({minimum:e,name:n})=>`${n}@^${e.join(".")}.0`).join(" "),en=(e,n)=>{try{const s=z(Q(e,"package.json")).resolve(`${n}/package.json`),[t=0,i=0]=String(JSON.parse(F(s,"utf8")).version).split(".").map(Number);return[t,i]}catch{return}},nn=e=>{const n=V.flatMap(({minimum:s,name:t})=>{const i=en(e,t);return i!==void 0&&(i[0]<s[0]||i[0]===s[0]&&i[1]<s[1])?[`${t} ${i.join(".")} (needs >= ${s.join(".")})`]:[]});return n.length===0?void 0:`workflows are declared in wrangler \`exports\`, which ${n.join(" and ")} cannot run — reconcile left workflows[] untouched. Upgrade (\`pnpm add -D ${Ze}\`) and re-run.`},sn=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.`]:[]),tn=(e,n,s)=>{let t=e;const i=[],o=[];for(const d of s){const a=n[d.className];if(a?.type==="workflow")for(const{of:b,path:c}of pe){const l=b(d),m=Y(a,c),u=`exports/${d.className}.${c.join(".")}`;if(l===void 0){m!==void 0&&o.push(`${u} is set in wrangler.jsonc but defineWorkflow "${d.exportName}" does not declare it — reconcile leaves it in place. Remove it by hand if it was dropped from the definition.`);continue}JSON.stringify(m)!==JSON.stringify(l)&&(t=S(t,["exports",d.className,...c],l),i.push(u))}}return{text:t,updated:i,warnings:o}},on=(e,n,s,t,i)=>{if(i!==void 0)return{added:[],text:e,warnings:[i]};const o=[...s.map(p=>({settings:ge(p),workflow:p})),...t.map(p=>({settings:{},workflow:p}))],d=new Set(o.map(({workflow:p})=>p.className)),a=n.workflows??[],b=a.filter(p=>p.script_name===void 0&&p.class_name!==void 0&&d.has(p.class_name)),c=n.exports??{},l=[],m=[],u=[];let w=e;for(const{settings:p,workflow:h}of o){if(c[h.className]!==void 0&&c[h.className]!==null)continue;const v=b.find(f=>f.class_name===h.className),x=Object.fromEntries(me.flatMap(f=>{const y=Y(v,[f]);return y===void 0?[]:[[f,y]]})),N=v?.name??h.name;v?.name!==void 0&&v.name!==h.name&&u.push(`workflows/${h.className} is deployed as "${v.name}" but declared as "${h.name}" — its export keeps "${v.name}" so running instances survive. Change the declaration to match, or rename deliberately (it starts a new, empty workflow).`),w=S(w,["exports",h.className],{type:"workflow",...x,...p,name:N}),(v===void 0?l:m).push(`exports/${h.className}`)}if(b.length>0){const p=a.filter(h=>!b.includes(h));w=S(w,["workflows"],p.length===0?void 0:p),m.push(...b.map(h=>`workflows/${String(h.class_name)} → exports`))}u.push(...sn(n));const g=tn(w,c,s);return{added:l,text:g.text,updated:[...m,...g.updated],warnings:[...u,...g.warnings]}},yn=(e,n,s)=>{const t=he(e),i=Te(n);if(!t)return{added:[],changed:!1,exportGaps:i,reason:"wrangler.jsonc not found",updated:[],warnings:T(n,e)};const{parsed:o,text:d}=we(t);if(o===void 0)return{added:[],changed:!1,exportGaps:i,reason:`failed to parse ${t} as JSONC`,updated:[],warnings:T(n,e),wranglerPath:t};const a=T(n,e,o);if(s!==void 0){const r=o.env?.[s]!==void 0;a.push(r?`auto-provisioned bindings are written to the top level of wrangler.jsonc only (queue consumers "env.${s}" already declares are retuned, nothing is added) — "env.${s}" has its own (non-inheritable) bindings and must be reconciled by hand; \`lunora deploy --env ${s}\` now validates them, so a gap here will be reported at deploy time.`:`--env "${s}" was requested but wrangler.jsonc declares no "env.${s}" block — auto-provisioned bindings are written to the top level only and will not apply to that environment.`)}const b=n.containers.filter(r=>r.exported),c=n.agents.filter(r=>r.exported&&r.voice===!0&&r.voiceBindingName!==void 0&&r.voiceClassName!==void 0),l=[...n.durableObjects,...b.map(r=>({binding:r.bindingName,className:r.className})),...c.map(r=>({binding:r.voiceBindingName,className:r.voiceClassName}))],m=n.workflows.filter(r=>r.exported),u=n.agents.filter(r=>r.exported),w=M(e),g=Oe(w,a),p={},h=te(w);let v;const x=[{enabled:!0,run:r=>Pe(r,o,l)},{enabled:n.needsD1,run:r=>Le(r,o)},{enabled:n.usesAi,run:r=>$(r,o,"ai")},{enabled:n.usesAiSearch,run:r=>K(r,o,"ai_search_namespaces",{binding:"AI_SEARCH",namespace:"default"},"AI_SEARCH (AI Search namespace)")},{enabled:Me(n,e),run:r=>$(r,o,"analytics")},{enabled:n.usesBrowser,run:r=>$(r,o,"browser")},{enabled:n.usesImages,run:r=>$(r,o,"images")},{enabled:n.usesAnalytics,run:r=>K(r,o,"analytics_engine_datasets",{binding:"ANALYTICS",dataset:"ANALYTICS"},"ANALYTICS (Analytics Engine)")},{enabled:n.usesWorkerLoader,run:r=>Ue(r,o)},{enabled:!0,run:r=>ze(r,o)},{enabled:b.length>0,run:r=>Xe(r,o,b)},{enabled:m.length>0||u.length>0,run:r=>on(r,o,m,u,nn(e))},{enabled:n.queues.length>0,run:r=>{const _=xe(r,o,n.queues,g.queues??{});return p.queues=_.owned,_}},{enabled:n.services!==void 0&&(n.services.length>0||Object.keys(h).length>0),run:r=>{const _=oe(r,o,n.services??[],h);return v=_.owned,_}},...s===void 0||o.env?.[s]===void 0?[]:[{enabled:n.queues.length>0,run:r=>{const _=`env.${s}.queues`,k=Ne(r,o,n.queues,s,g[_]??{});return p[_]=k.owned,k}}]];let N=d;const f=[],y=[];for(const r of x){if(!r.enabled)continue;const _=r.run(N);N=_.text,f.push(..._.added),y.push(..._.updated??[]),a.push(..._.warnings??[])}const E=r=>{if(w===void 0)return;const _=v,k=[...Object.keys(p).length>0?[{consequence:"an option removed from defineQueue stays deployed",key:"queueTuning",label:"queue tuning",write:O=>{Ee(O,g,p)}}]:[],..._===void 0?[]:[{consequence:"a service removed from lunora.config stays bound",key:"services",label:"service bindings",write:O=>{re(O,_)}}]];for(const O of k)try{O.write(M(e)??w)}catch(q){a.push(`${r?"wrangler.jsonc was updated, but ":""}recording the ${O.label} reconcile owns in ${w.path} (lunora.${O.key}) failed: ${q instanceof Error?q.message:String(q)}. Until it is recorded, ${O.consequence}.`)}};let A;if(n.services!==void 0){const r=ie(e,n.services,h);a.push(...r.warnings),v={...v,...r.owned},A=r.added.length>0||r.updated.length>0?{added:r.added,path:r.path,updated:r.updated}:void 0}return f.includes("DB (D1)")&&a.push(`wrote a DB binding with a placeholder database_id ("${H}") — run \`wrangler d1 create <name>\` and replace it before deploying.`),N===d?(E(!1),{added:f,changed:!1,devConfig:A,exportGaps:i,reason:"bindings already in sync",updated:y,warnings:a,wranglerPath:t}):(X(t,N,"utf8"),E(!0),{added:f,changed:!0,devConfig:A,exportGaps:i,updated:y,warnings:a,wranglerPath:t})};export{Te as collectExportGaps,yn as reconcileWranglerBindings};
@@ -1 +0,0 @@
1
- import{existsSync as c,readFileSync as o}from"node:fs";import{join as d}from"node:path";const l=[{class:"A",dependency:"@tanstack/react-start",framework:"tanstack-start"},{class:"A",dependency:"@tanstack/solid-start",framework:"tanstack-start-solid"},{class:"A",dependency:"@react-router/dev",framework:"react-router"},{class:"A",dependency:"vinext",framework:"vinext"},{class:"A",dependency:"@solidjs/start",framework:"solid-start"},{class:"A",dependency:"solid-start",framework:"solid-start"},{class:"B",dependency:"@sveltejs/kit",framework:"sveltekit"},{class:"B",dependency:"nuxt",framework:"nuxt"},{class:"B",dependency:"astro",framework:"astro"}],n={class:"C",framework:"none"},a=e=>{const s=d(e,"package.json");if(!c(s))return new Set;try{const t=o(s,"utf8"),r=JSON.parse(t);return new Set([...Object.keys(r.dependencies??{}),...Object.keys(r.devDependencies??{})])}catch{return new Set}},p=e=>a(e).has("lunorash"),f=e=>{const s=a(e);if(s.size===0)return n;for(const t of l)if(s.has(t.dependency))return{class:t.class,framework:t.framework};return n};export{f as detectFramework,p as projectUsesUmbrella,a as readProjectDependencyNames};
@@ -1 +0,0 @@
1
- import{existsSync as _,statSync as w,readFileSync as j,readdirSync as B}from"node:fs";import{discoverFlags as P,FLAGS_FILENAME as F,discoverQueues as L,QUEUES_FILENAME as k,CAPABILITY_PROBES as I,readServiceBindings as G,mayReadCapabilityContext as U,foldCapabilitySignals as x,capabilitiesUsedBy as K,sourceCapabilitySignals as W}from"@lunora/codegen";import{init as Y}from"es-module-lexer";import{Project as q}from"ts-morph";import{discoverAgentInfo as M}from"./discoverAgentInfo-CTdCSfYM.mjs";import{discoverContainerInfo as H}from"./discoverContainerInfo-EhZtEBQs.mjs";import{escapeRegExp as X}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{d as R}from"./discover-info-Vj9d4qYt.mjs";import{relative as J,sep as Q,isAbsolute as V,join as S}from"node:path";import{discoverSchemaInfo as z}from"./discoverSchemaInfo-BguahM6z.mjs";import{resolveWorkerEntry as Z,COMPOSED_ENTRY_DURABLE_OBJECTS as ee,GENERATED_MODULE_DURABLE_OBJECTS as se,GENERATED_DIRECTORY as C,DURABLE_OBJECT_BINDINGS as te,detectExportedDurableObjects as re,detectClassExports as A}from"./COMPOSED_WORKER_ENTRY-C69wqbSP.mjs";import{discoverWorkflowInfo as ne}from"./discoverWorkflowInfo-BsPvlo6O.mjs";const oe="https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/artifacts/namespaces",ae=e=>{const s='add an "artifacts" binding ({ binding: "ARTIFACTS", namespace }) — codegen reads env.ARTIFACTS unless `.artifacts()` on defineApp points ctx.artifacts at another binding';return e===void 0?`ctx.artifacts is used; ${s}. The namespace is created by the first repo create() if it does not exist yet.`:e==="fedramp"?'ctx.artifacts is used, but the schema pins data to "fedramp" and Artifacts namespaces exist only in "eu" or "us" — codegen refuses this combination.':`ctx.artifacts is used and the schema pins data to "${e}"; create the namespace in that jurisdiction BEFORE the first repo, with POST ${oe} and body { "namespace": "<name>", "jurisdiction": "${e}" }, then ${s}. A namespace's jurisdiction cannot be changed, and one created implicitly by the first repo create() is unrestricted.`},ie=(e,s)=>{const{error:r,value:t}=R(e,s,F,P);return r===void 0?{flags:t}:{error:r}},ce=(e,s)=>{const r=J(s,e);return r!==""&&r!==".."&&!r.startsWith(`..${Q}`)&&!V(r)},de=(e,s)=>{const{error:r,value:t}=R(e,s,k,L);return r===void 0?{queues:t??[]}:{error:r,queues:[]}},le=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),ue=new Set([".git",".lunora-cache",".wrangler","dist",C,"node_modules"]),pe=["lunora","src"],me=/\benv\s*\.\s*DB\b/,he=/\benv\s*\.\s*AI\b/,D=["ai","aiSearch","analytics","analyticsSql","artifacts","browser","hyperdrive","images","kv","mail","notify","payments","pipelines","r2sql","scheduler","storage","x402"],$=e=>`uses${e.charAt(0).toUpperCase()}${e.slice(1)}`,N=[["usesAuth","@lunora/auth"],["usesCimdWorkers","@lunora/auth/cimd/workers"],["usesX402Charge","@lunora/x402/charge"]],T=[...D.map(e=>[$(e),I[e].moduleSpecifier]),...N].toSorted(([e],[s])=>e.localeCompare(s)),fe=["@lunora/agent","@lunora/agent/sandbox"],ge=new RegExp(String.raw`["'\x60](?:${[...T.map(([,e])=>e),...fe].map(e=>X(e)).join("|")})["'\x60]`,"u"),o=e=>{const{contextProperty:s,moduleSpecifier:r}=I[e];return s===void 0?`${r} is imported`:`${r} is imported or ctx.${s} is read`},Se="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",Ee=()=>{let e;return()=>(e??=new q({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}),e)},be=(e,s,r)=>{const t=r(),n=t.createSourceFile(`/scan/${s.slice(s.lastIndexOf("/")+1)}`,e,{overwrite:!0}),i=W(n);return t.removeSourceFile(n),i},O=(e,s)=>{let r;try{r=B(e,{withFileTypes:!0})}catch{return}for(const t of r){if(t.isDirectory()){ue.has(t.name)||O(S(e,t.name),s);continue}const n=t.name.lastIndexOf(".");n!==-1&&le.has(t.name.slice(n))&&s.push(S(e,t.name))}},ve=(e,s)=>{const{info:r}=z(e,s);return{jurisdiction:r?.jurisdiction,needsD1:r?.hasD1GlobalTable??!1}},Ae=(e,s,r)=>{const t=Ee(),n=S(e,r),i=[],h=[];let c=!1,u=!1;for(const d of s){const l=S(e,d);if(!_(l)||!w(l).isDirectory())continue;const v=[];O(l,v);for(const m of v){const a=j(m,"utf8"),y=ce(m,n);c||=he.test(a),u||=me.test(a),(ge.test(a)||y&&U(a))&&(y?i:h).push(be(a,m,t))}}const f=x(i),g=x([f,...h]),E=new Set([...g.valueImports,...g.dynamicImports]),p=K({contextReads:f.contextReads,valueImports:E});return{...Object.fromEntries([...D.map(d=>[$(d),p.has(d)]),...N.map(([d,l])=>[d,E.has(l)])]),needsD1:u,usesAi:p.has("ai")||c,usesBrowser:p.has("browser")||f.sandboxTools.usesSandboxBrowser,usesWorkerLoader:f.sandboxTools.usesSandboxLoader}},ye=(e,s,r)=>[...e.map(t=>t.exported?`${t.bindingName}/${t.className} (container "${t.exportName}" declared and exported)`:`hint: container "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...s.map(t=>t.exported?`exports.${t.className} (workflow "${t.exportName}" declared and exported)`:`hint: workflow "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...r.map(t=>t.exported?`exports.${t.className} (agent "${t.exportName}" declared and exported)`:`hint: agent "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],xe=(e,s,r)=>[[e.usesAi,`AI (${o("ai")}, or env.AI is used)`],[e.usesAuth&&!s.has("SessionDO"),"hint: @lunora/auth is imported; its tables are D1-backed by default. For DO-backed auth (what @better-auth/scim needs), pass `namespace` to .auth() and export the generated auth DO class"],[e.usesScheduler&&!s.has("SchedulerDO"),`hint: ${o("scheduler")}, but no SchedulerDO is exported by the worker entry`],[e.usesStorage,`hint: ${o("storage")}; add an r2_buckets binding (bucket binding names are user-defined)`],[e.usesMail,`hint: ${o("mail")}; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)`],[e.usesPayments,`hint: ${o("payments")}; set the provider secrets in .dev.vars — ${Se}`],[e.usesBrowser,`browser (${o("browser")}, or a sandbox browserTool imported in lunora/) — self-describing { binding: BROWSER }`],[e.usesImages,`images (${o("images")}) — self-describing { binding: IMAGES }`],[e.usesAnalytics,`analytics_engine_datasets (${o("analytics")}) — self-describing { binding: ANALYTICS, dataset }`],[e.usesWorkerLoader,"worker_loaders (jsCodeTool imported in lunora/) — self-describing { binding: LOADER }"],[e.usesAiSearch,`ai_search_namespaces (${o("aiSearch")}) — self-describing { binding: AI_SEARCH, namespace: "default" }; remote-only, so \`lunora dev\` reaches the deployed AI Search service`],[e.usesAnalyticsSql,`analytics (${o("analyticsSql")}) — self-describing { binding: ANALYTICS_SQL }; needs wrangler >= 4.145.0, and is remote-only, so \`lunora dev\` queries the account's live analytics`],[e.usesKv,`hint: ${o("kv")}; add a kv_namespaces binding ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned`],[e.usesHyperdrive,`hint: ${o("hyperdrive")}; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned`],[e.usesPipelines,`hint: ${o("pipelines")}; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, stream }) — the pipeline resource can't be auto-provisioned`],[e.usesArtifacts,`hint: ${ae(r.jurisdiction)}`],[e.usesX402Charge,"hint: @lunora/x402/charge is imported; set the recipient wallet address as a [vars] entry (the var name is yours to choose) and pass it to the charge config — the x402 facilitator settles USDC to that address"],[e.usesX402,`hint: ${o("x402")} (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding for the agent wallet key (name it to match signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars, so the key can't be auto-provisioned`]].filter(([n])=>n).map(([,n])=>n),_e=(e,s,r,t=[],n=[],i=[])=>{const h=new Set(e.map(u=>u.className)),c=e.map(u=>`${u.binding}/${u.className} (exported by worker entry)`);return s.needsD1&&c.push("DB (.global() table declared)"),c.push(...ye(t,n,i),...xe(r,h,s)),c},Fe=async e=>{await Y;const s=e.schemaDir??"lunora",r=e.scanDirs??pe,t=Ae(e.projectRoot,r,s),n=Z(e.projectRoot);let i;n.composed?i=[...ee,...Object.entries(se).filter(([a])=>_(S(e.projectRoot,s,C,`${a}.ts`))).map(([,a])=>a)].map(a=>({binding:te[a],className:a})):i=n.path===void 0?[]:re(n.path);const h=ve(e.projectRoot,s),c={...h,needsD1:t.needsD1||h.needsD1},u=A(n,H(e.projectRoot,s).containers,"containers"),f=A(n,ne(e.projectRoot,s).workflows,"workflows"),g=A(n,M(e.projectRoot,s).agents,"agents"),E=[...de(e.projectRoot,s).queues],{flags:p}=ie(e.projectRoot,s),b=p?.provider==="flagship"&&p.mode==="binding"?p.bindingName:void 0,d=_e(i,c,t,u,f,g);b!==void 0&&d.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${b}", app_id }) — the app_id can't be auto-provisioned`);const l=G(e.projectRoot),v=l.error===void 0?l.services:void 0;return l.error!==void 0&&d.push(`hint: lunora.config \`services\` not reconciled — ${l.error}`),d.push(...l.services.map(m=>`${m.binding} → ${m.worker} (lunora.config services.${m.name})`)),{...t,agents:g,containers:u,durableObjects:i,flagshipBinding:b,...c.jurisdiction===void 0?{}:{jurisdiction:c.jurisdiction},needsD1:c.needsD1,queues:E,services:v,signals:d,usesFlags:p!==void 0,workflows:f}},Le=e=>T.filter(([s])=>e[s]).map(([,s])=>s);export{ae as a,Fe as i,Le as p};
@@ -1,6 +0,0 @@
1
- import{existsSync as O,readFileSync as b,writeFileSync as N}from"node:fs";import{applyEdits as $,modify as S,parseTree as h,findNodeAtLocation as g}from"jsonc-parser";import{join as A}from"node:path";const F=/^([\t ]+)"/mu,J=n=>{const o=F.exec(n)?.[1]??" ";return{eol:n.includes(`\r
2
- `)?`\r
3
- `:`
4
- `,insertSpaces:!o.startsWith(" "),tabSize:o.length}},K=n=>{const o=A(n,"package.json");if(O(o))try{const t=b(o,"utf8"),{lunora:r}=JSON.parse(t),e=typeof r=="object"&&r!==null&&!Array.isArray(r);return{lunora:e?r:void 0,lunoraIsForeign:r!==void 0&&!e,path:o,text:t}}catch{return}},p=n=>JSON.stringify(n,(o,t)=>typeof t=="object"&&t!==null&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).toSorted(([r],[e])=>r.localeCompare(e))):t),j=(n,o,t)=>{const r=J(n),e=r.insertSpaces===!1?" ":" ".repeat(r.tabSize??4),i=r.eol??`
5
- `,c=e.repeat(o.length),f=JSON.stringify(t,void 0,e).split(`
6
- `).join(i+c),l=h(n),a=l===void 0?void 0:g(l,[...o]);if(a!==void 0)return n.slice(0,a.offset)+f+n.slice(a.offset+a.length);let s=l;l!==void 0&&o.length>1&&(s=g(l,o.slice(0,-1)));const y=JSON.stringify(o.at(-1));if(s===void 0&&o.length>1)return j(n,o.slice(0,-1),{[o.at(-1)]:t});if(s?.type!=="object")return $(n,S(n,[...o],t,{formattingOptions:r}));const d=s.children?.at(-1);if(d===void 0){const v=`${i}${c}${y}: ${f}${i}${e.repeat(o.length-1)}`;return`${n.slice(0,s.offset+1)}${v}${n.slice(s.offset+s.length-1)}`}const u=d.offset+d.length;return`${n.slice(0,u)},${i}${c}${y}: ${f}${n.slice(u)}`},k=(n,o,t)=>{const r=Object.keys(n.lunora??{}).every(c=>c===o);if(n.lunoraIsForeign||p(n.lunora?.[o])===p(t))return;const e=t===void 0&&r?["lunora"]:["lunora",o],i=t===void 0?$(n.text,S(n.text,e,void 0,{})):j(n.text,e,t);i!==n.text&&N(n.path,i,"utf8")};export{k as a,p as c,J as f,K as r};
@@ -1 +0,0 @@
1
- import{spawn as i}from"node:child_process";import{existsSync as d,readFileSync as u}from"node:fs";import{join as f}from"node:path";import{runScriptArgsFor as g,detectPackageManager as m}from"./addArgsFor-CYZKhNIo.mjs";const o="postcodegen",l=r=>new Promise((n,s)=>{const e=i(r.command,[...r.args],{cwd:r.cwd??process.cwd(),shell:process.platform==="win32",stdio:["inherit",r.stdoutToStderr===!0?2:"inherit","inherit"]});e.on("error",s),e.on("close",a=>{n({code:a??1})})}),p=r=>{const n=f(r,"package.json");if(!d(n))return!1;try{const e=JSON.parse(u(n,"utf8"))?.scripts;return typeof e?.[o]=="string"&&e[o]!==""}catch{return!1}},P=async r=>{const{cwd:n,logger:s}=r;if(!p(n))return{ran:!1};const e=t=>(s.error(t),{error:t,ran:!0});let a;try{a=g(m(n),o)}catch(t){return e(`cannot run \`${o}\`: ${t instanceof Error?t.message:String(t)}`)}s.info(`running \`${o}\``);let c;try{c=await(r.spawner??l)({args:a.args,command:a.command,cwd:n,stdoutToStderr:r.stdoutToStderr})}catch(t){return e(`\`${o}\` failed to start: ${t instanceof Error?t.message:String(t)}`)}return c.code!==0?e(`\`${o}\` exited ${String(c.code)}`):{ran:!0}};export{P as runPostCodegenHook};
@@ -1 +0,0 @@
1
- import{existsSync as f,readFileSync as N,readdirSync as I}from"node:fs";import{join as l,dirname as v,extname as h,basename as x}from"node:path";import{Project as b,Node as d}from"ts-morph";import{COMPOSED_WORKER_ENTRY as w,LUNORA_WORKER_VIRTUAL_ID as u,isGeneratedOutput as F,WORKER_ENTRY_FALLBACKS as L,GENERATED_DIRECTORY as j,COMPOSED_ENTRY_DURABLE_OBJECTS as M,GENERATED_CLASS_MODULES as P,SOURCE_DOT_DIRECTORIES as k,NON_SOURCE_DIRECTORIES as U}from"./COMPOSED_WORKER_ENTRY-C69wqbSP.mjs";const E=[".ts",".tsx",".mts",".cts"],m=new Set(E),W=new Set([".cjs",".js",".mjs"]),g="default",S={".cjs":[".cts"],".js":[".ts",".tsx"],".mjs":[".mts"]},B=250,re=(e,o,t)=>{const s=l(o,w);if(f(s))return{origin:"declared",path:s};if(e===u)return{origin:"composed"};const n=()=>{const i=L.map(a=>l(o,a)).find(a=>f(a));return i===void 0?void 0:{origin:"probed",path:i}};if(typeof e!="string"||e.length===0||F(e))return n();const r=l(v(t),e),c=h(r);if(!(!m.has(c)&&!W.has(c)))return f(r)?{origin:"declared",path:r}:{origin:"absent",path:r}},y=(e,o)=>{if(d.isIdentifier(e)){o.add(e.getText());return}if(d.isObjectBindingPattern(e)||d.isArrayBindingPattern(e))for(const t of e.getElements())d.isBindingElement(t)&&y(t.getNameNode(),o)},K=(e,o)=>{const t=[];for(const s of e.getExportDeclarations())if(!s.isTypeOnly()){if(s.isNamespaceExport()){const n=s.getNamespaceExport();n===void 0?t.push(s.getModuleSpecifierValue()??""):o.add(n.getName());continue}for(const n of s.getNamedExports())n.isTypeOnly()||o.add(n.getAliasNode()?.getText()??n.getName())}return t},X=(e,o)=>{for(const t of e.getVariableStatements().filter(s=>s.getExportKeyword()!==void 0))for(const s of t.getDeclarations())y(s.getNameNode(),o);for(const t of[...e.getClasses(),...e.getFunctions(),...e.getEnums()]){if(t.getExportKeyword()===void 0)continue;const s=t.isDefaultExport()?g:t.getName();s!==void 0&&o.add(s)}e.getExportAssignments().length>0&&o.add(g)},_=(e,o)=>{const t=new b({compilerOptions:{allowJs:!0},skipFileDependencyResolution:!0,skipLoadingLibFiles:!0,useInMemoryFileSystem:!0}),s=t.createSourceFile(e,o,{overwrite:!0});return t.getProgram().compilerObject.getSyntacticDiagnostics(s.compilerNode).length>0?void 0:s},Y=(e,o)=>{if(!o.startsWith("./")&&!o.startsWith("../"))return;const t=l(v(e),o),s=h(t),n=m.has(s)||S[s]!==void 0,r=n?t.slice(0,-s.length):t;return[...m.has(s)?[t]:[],...(S[s]??[]).map(i=>`${r}${i}`),...n?[]:E.map(i=>`${t}${i}`),...n||s.length===0?E.map(i=>l(r,`index${i}`)):[]].find(i=>f(i))},T=e=>{const o=new Set,t=new Set([e]),s=[e];for(;s.length>0;){if(t.size-1>B)return;const n=s.pop();let r;try{r=N(n,"utf8")}catch{return}const c=_(x(n),r);if(c===void 0)return;const i=K(c,o);X(c,o);for(const a of i){const p=Y(n,a);if(p===void 0)return;t.has(p)||(t.add(p),s.push(p))}}return o},$=(e,o)=>{const t={exports:void 0,kind:"composed",path:u},s=l(e,o,j);if(!f(s))return t;const n=new Set(M);for(const r of P){const c=l(s,`${r}.ts`);if(!f(c))continue;const i=T(c);if(i===void 0)return t;for(const a of i)n.add(a)}return{exports:n,kind:"composed",path:u}},ie=(e,o,t)=>{if(e===void 0||e.origin==="absent")return;if(e.origin==="composed")return $(o,t);const s=T(e.path);if(!(e.origin==="probed"&&s!==void 0&&!s.has(g)))return{exports:s,kind:"authored",path:e.path}},G=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),z=2e3,O="defineTable",R="defineApp",J=e=>{const o=[],t=[];let s;try{s=I(e,{withFileTypes:!0})}catch{return{files:o,subdirectories:t}}for(const n of s)n.isDirectory()?n.name.startsWith(".")&&!k.has(n.name)||U.has(n.name)||t.push(l(e,n.name)):G.has(h(n.name))&&o.push(l(e,n.name));return{files:o,subdirectories:t}},D=(e,o)=>{const t=new Set;for(const s of e.getImportDeclarations())for(const n of s.getNamedImports())!n.isTypeOnly()&&n.getName()===o&&t.add(n.getAliasNode()?.getText()??n.getName());return t},q=(e,o)=>{let t=!1;return e.forEachDescendant((s,n)=>{if(!d.isCallExpression(s))return;const r=s.getExpression();d.isIdentifier(r)&&o.has(r.getText())&&(t=!0,n.stop())}),t},V=e=>{let o=e;for(;d.isCallExpression(o)||d.isPropertyAccessExpression(o);)o=o.getExpression();return o},H=(e,o)=>{const t=V(e);return d.isIdentifier(t)&&o.has(t.getText())},A={analyticsSql:/\.\s*analyticsSql\s*\(/u,global:/\.\s*global\s*\(/u,hyperdriveGlobal:/\.\s*hyperdriveGlobal\s*\(/u,vectors:/\.\s*vectors\s*\(/u},Q=e=>Object.hasOwn(A,e),Z=(e,o)=>{const t=new Set,s=new Set([O,...D(e,O)]);return e.forEachDescendant(n=>{if(!d.isCallExpression(n))return;const r=n.getExpression();if(!d.isPropertyAccessExpression(r)||H(r,s))return;const c=r.getName();Q(c)&&o.has(c)&&t.add(c)}),t},ee=(e,o)=>{let t;try{t=N(e,"utf8")}catch{return}const s=new Set([...o].filter(r=>A[r].test(t)));if(s.size===0&&!t.includes(R))return;const n=_(x(e),t);return n===void 0?{chained:s,composes:!1}:{chained:Z(n,s),composes:q(n,D(n,R))}},ce=(e,o)=>{const t=[e],s=new Set;let n=0,r;const c=i=>{if(n+=1,n>z)return!1;const a=ee(i,o);for(const p of a?.chained??[])s.add(p);return a?.composes&&(r??=i),!0};for(;t.length>0;){const i=t.pop(),{files:a,subdirectories:p}=J(i);t.push(...p);for(const C of a){if(!c(C))return;if(r!==void 0&&s.size===o.size)return{chained:s,site:r}}}return r===void 0?void 0:{chained:s,site:r}};export{re as l,ie as r,ce as s};