@lunora/config 1.0.0-alpha.320 → 1.0.0-alpha.322

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-DoAGGYXd.mjs";
1
+ import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-CM5OAyRK.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;
@@ -1,4 +1,4 @@
1
- import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-DoAGGYXd.js";
1
+ import { D as DeployDriver, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-CM5OAyRK.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;
@@ -1 +1 @@
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-CjqyRE9c.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-OHWrJQjn.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-C0xXdbEG.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};
1
+ import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{assertWranglerSatisfiesSchema as l}from"../packem_shared/assertWranglerSatisfiesSchema-CeUFnD5J.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-W1EIDl6z.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-Bdkh3fkB.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-Bqat6Syj.mjs";import{collectWranglerSecretVariables as oe,scanWranglerVariablesForSecrets as ae}from"../packem_shared/collectWranglerSecretVariables-C0xXdbEG.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-DoAGGYXd.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-DoAGGYXd.mjs";
5
+ import { T as ToolchainCommand, D as DeployDriver, P as ProjectionPurpose } from "./packem_shared/infer-bindings.d-CM5OAyRK.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-CM5OAyRK.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. */
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-DoAGGYXd.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-DoAGGYXd.js";
5
+ import { T as ToolchainCommand, D as DeployDriver, P as ProjectionPurpose } from "./packem_shared/infer-bindings.d-CM5OAyRK.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-CM5OAyRK.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. */
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-pqFMJBtJ.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-MI3HIHmJ.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-DzWcopKj.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-YRA6dAIt.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-B5TCpzCh.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-CzfA0OLf.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-zW7Tt0Tn.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};
1
+ import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-pqFMJBtJ.mjs";import{AGENT_RULES_DIR as i,AGENT_RULES_HINT as n,AGENT_RULES_HINT_ENV as _,LUNORA_SKILL_NAMES as 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-MI3HIHmJ.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-DzWcopKj.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-Dp8PN1Vc.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-B5TCpzCh.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-CzfA0OLf.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-BLe1EVI8.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-zW7Tt0Tn.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};
@@ -1 +1 @@
1
- import{existsSync as h}from"node:fs";import{dirname as y,join as p}from"node:path";import{discoverSchemaInfo as E}from"./discoverSchemaInfo-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
+ import{existsSync as h}from"node:fs";import{dirname as y,join as p}from"node:path";import{discoverSchemaInfo as E}from"./discoverSchemaInfo-BLe1EVI8.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-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(`
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-Bqat6Syj.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,2 +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-YRA6dAIt.mjs";import{DEV_VARS_FILE as le,parseDevVariableEntries as ue}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{requiredSecrets as ge}from"./buildPackageSecretsBlock-CzfA0OLf.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(`
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-Dp8PN1Vc.mjs";import{DEV_VARS_FILE as le,parseDevVariableEntries as ue}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{requiredSecrets as ge}from"./buildPackageSecretsBlock-CzfA0OLf.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
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};
@@ -0,0 +1 @@
1
+ import{existsSync as c}from"node:fs";import{discoverSchema as l,isHyperdriveGlobalTable as d,isD1GlobalTable as f}from"@lunora/codegen";import{Project as b}from"ts-morph";import{join as u}from"node:path";const a=n=>{if(n?.kind==="optional")return a(n.inner);if(n?.kind==="union"){const o=new Set((n.members??[]).filter(i=>i.kind!=="null").map(i=>a(i)));return o.size===1?[...o][0]:n.kind}return n?.kind},S=(n,o)=>{const i=u(n,o,"schema.ts");if(!c(i))return{info:void 0};try{const s=new b({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!1}),r=l(s,i,n),m=e=>r.tables.find(t=>t.name===e)?.shape??{};return{info:{hasD1GlobalTable:r.tables.some(e=>f(e)),hasHyperdriveGlobalTable:r.tables.some(e=>d(e)),...r.jurisdiction===void 0?{}:{jurisdiction:r.jurisdiction},vectorIndexNames:r.vectorIndexes.map(e=>e.name),vectorMetadata:r.vectorIndexes.flatMap(e=>(e.metadata??[]).map(t=>({index:e.name,kind:a(m(e.table)[t]),property:t})))}}}catch(s){return{error:s instanceof Error?s.message:String(s),info:void 0}}};export{S as discoverSchemaInfo};
@@ -1 +1 @@
1
- import{existsSync as O,statSync as T,readFileSync as j,readdirSync as P}from"node:fs";import{discoverFlags as B,FLAGS_FILENAME as F,discoverQueues as k,CAPABILITY_PROBES as _,readServiceBindings as L,mayReadCapabilityContext as G,foldCapabilitySignals as I,capabilitiesUsedBy as K,sourceCapabilitySignals as W}from"@lunora/codegen";import{init as q}from"es-module-lexer";import{Project as Y}from"ts-morph";import{discoverAgentInfo as U}from"./discoverAgentInfo-pqFMJBtJ.mjs";import{discoverContainerInfo as M}from"./discoverContainerInfo-MI3HIHmJ.mjs";import{escapeRegExp as H}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{d as D}from"./discover-info-DC2MrAIM.mjs";import{relative as X,sep as Q,isAbsolute as V,join as f}from"node:path";import{discoverSchemaInfo as J}from"./discoverSchemaInfo-BguahM6z.mjs";import{resolveWorkerEntry as z,composedEntryDurableObjects as Z,GENERATED_DIRECTORY as A,DURABLE_OBJECT_BINDINGS as ee,detectExportedDurableObjects as se,detectClassExports as E,isMergedProject as te}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{discoverWorkflowInfo as re}from"./discoverWorkflowInfo-zW7Tt0Tn.mjs";const ne="https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/artifacts/namespaces",oe=e=>{const s='add an "artifacts" binding ({ binding: "ARTIFACTS", namespace }) — codegen reads env.ARTIFACTS unless `.artifacts()` on defineApp points ctx.artifacts at another binding';return e===void 0?`ctx.artifacts is used; ${s}. The namespace is created by the first repo create() if it does not exist yet.`:`ctx.artifacts is used and the schema pins data to "${e}"; create the namespace in that jurisdiction BEFORE the first repo, with POST ${ne} 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.`},ae=(e,s)=>{const{error:r,value:t}=D(e,s,F,B);return r===void 0?{flags:t}:{error:r}},ie=(e,s)=>{const r=X(s,e);return r!==""&&r!==".."&&!r.startsWith(`..${Q}`)&&!V(r)},ce=(e,s)=>{const{error:r,value:t}=D(e,s,void 0,k);return r===void 0?{queues:t??[]}:{error:r,queues:[]}},de=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),le=new Set([".git",".lunora-cache",".wrangler","dist",A,"node_modules"]),ue=["lunora","src"],pe=/\benv\s*\.\s*DB\b/,me=/\benv\s*\.\s*AI\b/,R=["ai","aiSearch","analytics","analyticsSql","artifacts","browser","hyperdrive","images","kv","mail","notify","payments","pipelines","r2sql","scheduler","storage","x402"],C=e=>`uses${e.charAt(0).toUpperCase()}${e.slice(1)}`,$=[["usesAuth","@lunora/auth"],["usesCimdWorkers","@lunora/auth/cimd/workers"],["usesX402Charge","@lunora/x402/charge"],["usesPaymentAutumn","@lunora/payment/autumn"],["usesPaymentCreem","@lunora/payment/creem"],["usesPaymentDodopayments","@lunora/payment/dodopayments"],["usesPaymentPolar","@lunora/payment/polar"],["usesPaymentStripe","@lunora/payment/stripe"]],N=[...R.map(e=>[C(e),_[e].moduleSpecifier]),...$].toSorted(([e],[s])=>e.localeCompare(s)),he=["@lunora/agent","@lunora/agent/sandbox"],ge=new RegExp(String.raw`["'\x60](?:${[...N.map(([,e])=>e),...he].map(e=>H(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`},fe="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",be=()=>{let e;return()=>(e??=new Y({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}),e)},Se=(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()){le.has(t.name)||w(f(e,t.name),s);continue}const n=t.name.lastIndexOf(".");n!==-1&&de.has(t.name.slice(n))&&s.push(f(e,t.name))}},ye=(e,s)=>{const{info:r}=J(e,s);return{jurisdiction:r?.jurisdiction,needsD1:r?.hasD1GlobalTable??!1}},ve=(e,s,r)=>{const t=be(),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 v=[];w(d,v);for(const u of v){const m=j(u,"utf8"),x=ie(u,n);c||=me.test(m),l||=pe.test(m),(ge.test(m)||x&&G(m))&&(x?a:h).push(Se(m,u,t))}}const g=I(a),b=I([g,...h]),S=new Set([...b.valueImports,...b.dynamicImports]),p=K({contextReads:g.contextReads,valueImports:S});return{...Object.fromEntries([...R.map(i=>[C(i),p.has(i)]),...$.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}},Ee=(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"\``)],Ae=(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 — ${fe}`],[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: ${oe(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),xe=(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(...Ee(t,n,a),...Ae(r,h,s)),c},Be=async e=>{await q;const s=e.schemaDir??"lunora",r=e.scanDirs??ue,t=ve(e.projectRoot,r,s),n=z(e.projectRoot);let a;n.composed?a=Z(f(e.projectRoot,s,A)).map(m=>({binding:ee[m],className:m})):a=n.path===void 0?[]:se(n.path);const h=ye(e.projectRoot,s),c={...h,needsD1:t.needsD1||h.needsD1},l=E(n,M(e.projectRoot,s).containers,"containers"),g=E(n,re(e.projectRoot,s).workflows,"workflows"),b=E(n,U(e.projectRoot,s).agents,"agents"),S=[...ce(e.projectRoot,s).queues],{flags:p}=ae(e.projectRoot,s),y=p?.provider==="flagship"&&p.mode==="binding"?p.bindingName:void 0,i=xe(a,c,t,l,g,b);!n.composed&&te(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"),y!==void 0&&i.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${y}", app_id }) — the app_id can't be auto-provisioned`);const d=L(e.projectRoot),v=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:y,...c.jurisdiction===void 0?{}:{jurisdiction:c.jurisdiction},needsD1:c.needsD1,queues:S,services:v,signals:i,usesFlags:p!==void 0,workflows:g}},Fe=e=>N.filter(([s])=>e[s]).map(([,s])=>s);export{oe as a,Be as i,Fe as p};
1
+ import{existsSync as O,statSync as T,readFileSync as j,readdirSync as P}from"node:fs";import{discoverFlags as B,FLAGS_FILENAME as F,discoverQueues as k,CAPABILITY_PROBES as _,readServiceBindings as L,mayReadCapabilityContext as G,foldCapabilitySignals as I,capabilitiesUsedBy as K,sourceCapabilitySignals as W}from"@lunora/codegen";import{init as q}from"es-module-lexer";import{Project as Y}from"ts-morph";import{discoverAgentInfo as U}from"./discoverAgentInfo-pqFMJBtJ.mjs";import{discoverContainerInfo as M}from"./discoverContainerInfo-MI3HIHmJ.mjs";import{escapeRegExp as H}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{d as D}from"./discover-info-DC2MrAIM.mjs";import{relative as X,sep as Q,isAbsolute as V,join as f}from"node:path";import{discoverSchemaInfo as J}from"./discoverSchemaInfo-BLe1EVI8.mjs";import{resolveWorkerEntry as z,composedEntryDurableObjects as Z,GENERATED_DIRECTORY as A,DURABLE_OBJECT_BINDINGS as ee,detectExportedDurableObjects as se,detectClassExports as E,isMergedProject as te}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{discoverWorkflowInfo as re}from"./discoverWorkflowInfo-zW7Tt0Tn.mjs";const ne="https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/artifacts/namespaces",oe=e=>{const s='add an "artifacts" binding ({ binding: "ARTIFACTS", namespace }) — codegen reads env.ARTIFACTS unless `.artifacts()` on defineApp points ctx.artifacts at another binding';return e===void 0?`ctx.artifacts is used; ${s}. The namespace is created by the first repo create() if it does not exist yet.`:`ctx.artifacts is used and the schema pins data to "${e}"; create the namespace in that jurisdiction BEFORE the first repo, with POST ${ne} 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.`},ae=(e,s)=>{const{error:r,value:t}=D(e,s,F,B);return r===void 0?{flags:t}:{error:r}},ie=(e,s)=>{const r=X(s,e);return r!==""&&r!==".."&&!r.startsWith(`..${Q}`)&&!V(r)},ce=(e,s)=>{const{error:r,value:t}=D(e,s,void 0,k);return r===void 0?{queues:t??[]}:{error:r,queues:[]}},de=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),le=new Set([".git",".lunora-cache",".wrangler","dist",A,"node_modules"]),ue=["lunora","src"],pe=/\benv\s*\.\s*DB\b/,me=/\benv\s*\.\s*AI\b/,R=["ai","aiSearch","analytics","analyticsSql","artifacts","browser","hyperdrive","images","kv","mail","notify","payments","pipelines","r2sql","scheduler","storage","x402"],C=e=>`uses${e.charAt(0).toUpperCase()}${e.slice(1)}`,$=[["usesAuth","@lunora/auth"],["usesCimdWorkers","@lunora/auth/cimd/workers"],["usesX402Charge","@lunora/x402/charge"],["usesPaymentAutumn","@lunora/payment/autumn"],["usesPaymentCreem","@lunora/payment/creem"],["usesPaymentDodopayments","@lunora/payment/dodopayments"],["usesPaymentPolar","@lunora/payment/polar"],["usesPaymentStripe","@lunora/payment/stripe"]],N=[...R.map(e=>[C(e),_[e].moduleSpecifier]),...$].toSorted(([e],[s])=>e.localeCompare(s)),he=["@lunora/agent","@lunora/agent/sandbox"],ge=new RegExp(String.raw`["'\x60](?:${[...N.map(([,e])=>e),...he].map(e=>H(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`},fe="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",be=()=>{let e;return()=>(e??=new Y({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}),e)},Se=(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()){le.has(t.name)||w(f(e,t.name),s);continue}const n=t.name.lastIndexOf(".");n!==-1&&de.has(t.name.slice(n))&&s.push(f(e,t.name))}},ye=(e,s)=>{const{info:r}=J(e,s);return{jurisdiction:r?.jurisdiction,needsD1:r?.hasD1GlobalTable??!1}},ve=(e,s,r)=>{const t=be(),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 v=[];w(d,v);for(const u of v){const m=j(u,"utf8"),x=ie(u,n);c||=me.test(m),l||=pe.test(m),(ge.test(m)||x&&G(m))&&(x?a:h).push(Se(m,u,t))}}const g=I(a),b=I([g,...h]),S=new Set([...b.valueImports,...b.dynamicImports]),p=K({contextReads:g.contextReads,valueImports:S});return{...Object.fromEntries([...R.map(i=>[C(i),p.has(i)]),...$.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}},Ee=(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"\``)],Ae=(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 — ${fe}`],[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: ${oe(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),xe=(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(...Ee(t,n,a),...Ae(r,h,s)),c},Be=async e=>{await q;const s=e.schemaDir??"lunora",r=e.scanDirs??ue,t=ve(e.projectRoot,r,s),n=z(e.projectRoot);let a;n.composed?a=Z(f(e.projectRoot,s,A)).map(m=>({binding:ee[m],className:m})):a=n.path===void 0?[]:se(n.path);const h=ye(e.projectRoot,s),c={...h,needsD1:t.needsD1||h.needsD1},l=E(n,M(e.projectRoot,s).containers,"containers"),g=E(n,re(e.projectRoot,s).workflows,"workflows"),b=E(n,U(e.projectRoot,s).agents,"agents"),S=[...ce(e.projectRoot,s).queues],{flags:p}=ae(e.projectRoot,s),y=p?.provider==="flagship"&&p.mode==="binding"?p.bindingName:void 0,i=xe(a,c,t,l,g,b);!n.composed&&te(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"),y!==void 0&&i.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${y}", app_id }) — the app_id can't be auto-provisioned`);const d=L(e.projectRoot),v=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:y,...c.jurisdiction===void 0?{}:{jurisdiction:c.jurisdiction},needsD1:c.needsD1,queues:S,services:v,signals:i,usesFlags:p!==void 0,workflows:g}},Fe=e=>N.filter(([s])=>e[s]).map(([,s])=>s);export{oe as a,Be as i,Fe as p};
@@ -185,8 +185,9 @@ interface VectorMetadataDeclaration {
185
185
  /** The vector index the property belongs to. */
186
186
  index: string;
187
187
  /**
188
- * The validator kind behind the column, or `undefined` when the column
189
- * isn't in the owning table's shape. Callers map it to the Vectorize
188
+ * The validator kind behind the column, with `v.optional(...)` and a
189
+ * nullable union unwrapped (metadata columns are usually optional), or
190
+ * `undefined` when the column isn't in the owning table's shape. Callers map it to the Vectorize
190
191
  * metadata type; a kind that can't be filtered on is reported, not indexed.
191
192
  */
192
193
  kind: string | undefined;
@@ -185,8 +185,9 @@ interface VectorMetadataDeclaration {
185
185
  /** The vector index the property belongs to. */
186
186
  index: string;
187
187
  /**
188
- * The validator kind behind the column, or `undefined` when the column
189
- * isn't in the owning table's shape. Callers map it to the Vectorize
188
+ * The validator kind behind the column, with `v.optional(...)` and a
189
+ * nullable union unwrapped (metadata columns are usually optional), or
190
+ * `undefined` when the column isn't in the owning table's shape. Callers map it to the Vectorize
190
191
  * metadata type; a kind that can't be filtered on is reported, not indexed.
191
192
  */
192
193
  kind: string | undefined;
@@ -1 +1 @@
1
- import"./discoverAgentInfo-pqFMJBtJ.mjs";import{i as s,p as e}from"./infer-bindings-YRA6dAIt.mjs";import"./discoverContainerInfo-MI3HIHmJ.mjs";import"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import"./discoverSchemaInfo-BguahM6z.mjs";import"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import"./discoverWorkflowInfo-zW7Tt0Tn.mjs";export{s as inferLunoraBindings,e as packageNamesFromBindings};
1
+ import"./discoverAgentInfo-pqFMJBtJ.mjs";import{i as s,p as e}from"./infer-bindings-Dp8PN1Vc.mjs";import"./discoverContainerInfo-MI3HIHmJ.mjs";import"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import"./discoverSchemaInfo-BLe1EVI8.mjs";import"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import"./discoverWorkflowInfo-zW7Tt0Tn.mjs";export{s as inferLunoraBindings,e as packageNamesFromBindings};
@@ -1 +1 @@
1
- import{i as p}from"./infer-bindings-YRA6dAIt.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-CiQM3BkI.mjs";import{reconcileWranglerBindings as $}from"./collectExportGaps-CjqyRE9c.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};
1
+ import{i as p}from"./infer-bindings-Dp8PN1Vc.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-CiQM3BkI.mjs";import{reconcileWranglerBindings as $}from"./collectExportGaps-W1EIDl6z.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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/config",
3
- "version": "1.0.0-alpha.320",
3
+ "version": "1.0.0-alpha.322",
4
4
  "description": "Internal shared CLI + Vite config layer for Lunora: wrangler.jsonc validation, binding inference, and .dev.vars scaffolding",
5
5
  "keywords": [
6
6
  "bindings",
@@ -54,10 +54,10 @@
54
54
  "access": "public"
55
55
  },
56
56
  "dependencies": {
57
- "@lunora/codegen": "1.0.0-alpha.276",
57
+ "@lunora/codegen": "1.0.0-alpha.277",
58
58
  "@lunora/container": "1.0.0-alpha.70",
59
59
  "@lunora/errors": "1.0.0-alpha.51",
60
- "@lunora/seed": "1.0.0-alpha.200",
60
+ "@lunora/seed": "1.0.0-alpha.201",
61
61
  "@visulima/colorize": "2.1.1",
62
62
  "@visulima/find-ai-runner": "1.0.2",
63
63
  "@visulima/fs": "6.0.28",
@@ -1 +0,0 @@
1
- import{existsSync as m}from"node:fs";import{discoverSchema as c,isHyperdriveGlobalTable as l,isD1GlobalTable as d}from"@lunora/codegen";import{Project as f}from"ts-morph";import{join as b}from"node:path";const j=(s,i)=>{const t=b(s,i,"schema.ts");if(!m(t))return{info:void 0};try{const o=new f({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!1}),r=c(o,t,s),n=e=>r.tables.find(a=>a.name===e)?.shape??{};return{info:{hasD1GlobalTable:r.tables.some(e=>d(e)),hasHyperdriveGlobalTable:r.tables.some(e=>l(e)),...r.jurisdiction===void 0?{}:{jurisdiction:r.jurisdiction},vectorIndexNames:r.vectorIndexes.map(e=>e.name),vectorMetadata:r.vectorIndexes.flatMap(e=>(e.metadata??[]).map(a=>({index:e.name,kind:n(e.table)[a]?.kind,property:a})))}}}catch(o){return{error:o instanceof Error?o.message:String(o),info:void 0}}};export{j as discoverSchemaInfo};