@lunora/config 1.0.0-alpha.453 → 1.0.0-alpha.455

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/cloudflare/index.d.mts +2 -2
  2. package/dist/cloudflare/index.d.ts +2 -2
  3. package/dist/cloudflare/index.mjs +1 -1
  4. package/dist/index.d.mts +2 -2
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.mjs +1 -1
  7. package/dist/packem_shared/ADVISOR_PROCEDURES_ENDPOINT-BPnqzAgT.mjs +1 -0
  8. package/dist/packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DWyZ_2QM.mjs +1 -0
  9. package/dist/packem_shared/STUDIO_PATH-DklEpux6.mjs +1 -0
  10. package/dist/packem_shared/{collectExportGaps-CO1Se31Y.mjs → collectExportGaps-CTrrntcK.mjs} +1 -1
  11. package/dist/packem_shared/{infer-bindings.d-BKaqvxUQ.d.ts → infer-bindings.d-DtKuba3D.d.mts} +2 -0
  12. package/dist/packem_shared/{infer-bindings.d-BKaqvxUQ.d.mts → infer-bindings.d-DtKuba3D.d.ts} +2 -0
  13. package/dist/packem_shared/inferLunoraBindings-whOZv00U.mjs +1 -0
  14. package/dist/packem_shared/{reconcileBindingsSafely-BodqgI8_.mjs → reconcileBindingsSafely-5SSwR3rK.mjs} +1 -1
  15. package/dist/packem_shared/renderStudioHtml-CRDTNivi.mjs +15 -0
  16. package/dist/packem_shared/startCelldDevSession-Bg_RN5uf.mjs +1 -0
  17. package/dist/studio-host/index.d.mts +57 -44
  18. package/dist/studio-host/index.d.ts +57 -44
  19. package/dist/studio-host/index.mjs +1 -1
  20. package/package.json +2 -2
  21. package/dist/packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DV5E_f_q.mjs +0 -1
  22. package/dist/packem_shared/STUDIO_PATH-B9K66C50.mjs +0 -1
  23. package/dist/packem_shared/inferLunoraBindings-CGy-uHu6.mjs +0 -1
  24. package/dist/packem_shared/renderStudioHtml-ByowDtMl.mjs +0 -15
  25. package/dist/packem_shared/startCelldDevSession-BKRiLvt-.mjs +0 -1
@@ -1,5 +1,5 @@
1
- import { D as DiscoveryCache, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-BKaqvxUQ.mjs";
2
- export { H as HYPERDRIVE_PLACEHOLDER_ID } from "../packem_shared/infer-bindings.d-BKaqvxUQ.mjs";
1
+ import { D as DiscoveryCache, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-DtKuba3D.mjs";
2
+ export { H as HYPERDRIVE_PLACEHOLDER_ID } from "../packem_shared/infer-bindings.d-DtKuba3D.mjs";
3
3
  import { D as DeployDriver } from "../packem_shared/deploy-driver.d-CHVNQFV2.mjs";
4
4
  import { WranglerQueueProducerIR, WranglerVariableIR } from '@lunora/codegen';
5
5
  /** Apply one structural jsonc edit and return the rewritten text (a no-op edit returns the input). */
@@ -1,5 +1,5 @@
1
- import { D as DiscoveryCache, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-BKaqvxUQ.js";
2
- export { H as HYPERDRIVE_PLACEHOLDER_ID } from "../packem_shared/infer-bindings.d-BKaqvxUQ.js";
1
+ import { D as DiscoveryCache, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-DtKuba3D.js";
2
+ export { H as HYPERDRIVE_PLACEHOLDER_ID } from "../packem_shared/infer-bindings.d-DtKuba3D.js";
3
3
  import { D as DeployDriver } from "../packem_shared/deploy-driver.d-CHVNQFV2.js";
4
4
  import { WranglerQueueProducerIR, WranglerVariableIR } from '@lunora/codegen';
5
5
  /** Apply one structural jsonc edit and return the rewritten text (a no-op edit returns the input). */
@@ -1 +1 @@
1
- import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{assertWranglerSatisfiesSchema as t}from"../packem_shared/assertWranglerSatisfiesSchema-DmkdB-OW.mjs";import{BINDING_MANIFEST_VERSION as i,buildBindingManifest as l}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 d}from"../packem_shared/CLOUDFLARE_DRIVER-DbmpoIcg.mjs";import{default as C}from"../packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs";import{hasCloudflareCredentials as R}from"../packem_shared/hasCloudflareCredentials-Bak5w1_6.mjs";import{describeWithheld as _,withheldBindings as I}from"../packem_shared/describeWithheld-CbyzZjZF.mjs";import{bindingsNeedingDatabase as A,startLocalHyperdrive as D}from"../packem_shared/bindingsNeedingDatabase-6eD6Qtqf.mjs";import{readManifest as S,recordManifestKey as W}from"../packem_shared/readManifest-Cighz3WC.mjs";import{HYPERDRIVE_PLACEHOLDER_ID as N}from"../packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{collectExportGaps as F,reconcileWranglerBindings as b}from"../packem_shared/collectExportGaps-CO1Se31Y.mjs";import{reconcileWranglerCompatibilityDate as h}from"../packem_shared/reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{describePreservedCrons as G,reconcileWranglerCrons as M}from"../packem_shared/describePreservedCrons-Bt2rPPeY.mjs";import{reconcileBindingsSafely as U,reconcileWranglerExtras as P}from"../packem_shared/reconcileBindingsSafely-BodqgI8_.mjs";import{REMOTE_ELIGIBLE_KEYS as H,injectRemoteFlags as w,isRemoteEnvEnabled as Y,materializeDevWranglerConfig as K,planRemoteBindings as j,resolveRemoteEnabled as z}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-DooK0pzs.mjs";import{materializeServiceDevConfigs as J}from"../packem_shared/materializeServiceDevConfigs-qUY4_iu1.mjs";import{default as k}from"../packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DV5E_f_q.mjs";import{withTailConsumer as Z}from"../packem_shared/withTailConsumer-CF3pk_Ov.mjs";import{WORKERS_CACHE_MIN_DATE as ee,isCacheEnabled as re}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{wranglerCodegenInputs as ae}from"../packem_shared/wranglerCodegenInputs-BZamZrPz.mjs";import{DEFAULT_OBSERVABILITY as ne,resolveObservabilitySampling as ie}from"../packem_shared/DEFAULT_OBSERVABILITY-CPLADr5u.mjs";import{mergeWranglerEnvironment as fe}from"../packem_shared/mergeWranglerEnvironment-D5ekKj5x.mjs";import{WRANGLER_FILES as Ee,findWranglerFile as se,readWranglerJsonc as pe}from"../packem_shared/WRANGLER_FILES-UNW-xY5u.mjs";import{UNEXPORTED_CLASS_MARKER as ge,validateWranglerProject as Ce}from"../packem_shared/UNEXPORTED_CLASS_MARKER-07SNQ0rP.mjs";import{scanWranglerVariablesForSecrets as Re}from"../packem_shared/scanWranglerVariablesForSecrets-DRBYlMYb.mjs";import{wranglerToAlchemy as _e}from"../packem_shared/wranglerToAlchemy-CBO2ucRm.mjs";import{REQUIRED_COMPATIBILITY_DATE as Le,REQUIRED_FLAG as Ae,validateWrangler as De,validateWranglerConfig as Oe}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-C8qfwbaA.mjs";export{i as BINDING_MANIFEST_VERSION,m as CLOUDFLARE_CLI_CONFIG_WARNING_ENV,d as CLOUDFLARE_DRIVER,k as CLOUDFLARE_TOOLCHAIN_VERSIONS,ne as DEFAULT_OBSERVABILITY,C as GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG,N as HYPERDRIVE_PLACEHOLDER_ID,H as REMOTE_ELIGIBLE_KEYS,Le as REQUIRED_COMPATIBILITY_DATE,Ae as REQUIRED_FLAG,ge as UNEXPORTED_CLASS_MARKER,ee as WORKERS_CACHE_MIN_DATE,Ee as WRANGLER_FILES,o as applyModify,t as assertWranglerSatisfiesSchema,A as bindingsNeedingDatabase,l as buildBindingManifest,F as collectExportGaps,G as describePreservedCrons,_ as describeWithheld,E as detectCloudflareCliConfig,se as findWranglerFile,R as hasCloudflareCredentials,w as injectRemoteFlags,re as isCacheEnabled,Y as isRemoteEnvEnabled,K as materializeDevWranglerConfig,J as materializeServiceDevConfigs,fe as mergeWranglerEnvironment,j as planRemoteBindings,S as readManifest,pe as readWranglerJsonc,U as reconcileBindingsSafely,b as reconcileWranglerBindings,h as reconcileWranglerCompatibilityDate,M as reconcileWranglerCrons,P as reconcileWranglerExtras,W as recordManifestKey,ie as resolveObservabilitySampling,z as resolveRemoteEnabled,Re as scanWranglerVariablesForSecrets,D as startLocalHyperdrive,De as validateWrangler,Oe as validateWranglerConfig,Ce as validateWranglerProject,s as warnCloudflareCliConfigOnce,Z as withTailConsumer,I as withheldBindings,ae as wranglerCodegenInputs,_e as wranglerToAlchemy};
1
+ import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{assertWranglerSatisfiesSchema as t}from"../packem_shared/assertWranglerSatisfiesSchema-DmkdB-OW.mjs";import{BINDING_MANIFEST_VERSION as i,buildBindingManifest as l}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 d}from"../packem_shared/CLOUDFLARE_DRIVER-DbmpoIcg.mjs";import{default as C}from"../packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs";import{hasCloudflareCredentials as R}from"../packem_shared/hasCloudflareCredentials-Bak5w1_6.mjs";import{describeWithheld as _,withheldBindings as I}from"../packem_shared/describeWithheld-CbyzZjZF.mjs";import{bindingsNeedingDatabase as A,startLocalHyperdrive as D}from"../packem_shared/bindingsNeedingDatabase-6eD6Qtqf.mjs";import{readManifest as S,recordManifestKey as W}from"../packem_shared/readManifest-Cighz3WC.mjs";import{HYPERDRIVE_PLACEHOLDER_ID as N}from"../packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{collectExportGaps as F,reconcileWranglerBindings as b}from"../packem_shared/collectExportGaps-CTrrntcK.mjs";import{reconcileWranglerCompatibilityDate as h}from"../packem_shared/reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{describePreservedCrons as G,reconcileWranglerCrons as M}from"../packem_shared/describePreservedCrons-Bt2rPPeY.mjs";import{reconcileBindingsSafely as U,reconcileWranglerExtras as P}from"../packem_shared/reconcileBindingsSafely-5SSwR3rK.mjs";import{REMOTE_ELIGIBLE_KEYS as H,injectRemoteFlags as w,isRemoteEnvEnabled as Y,materializeDevWranglerConfig as K,planRemoteBindings as j,resolveRemoteEnabled as z}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-DooK0pzs.mjs";import{materializeServiceDevConfigs as J}from"../packem_shared/materializeServiceDevConfigs-qUY4_iu1.mjs";import{default as k}from"../packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DWyZ_2QM.mjs";import{withTailConsumer as Z}from"../packem_shared/withTailConsumer-CF3pk_Ov.mjs";import{WORKERS_CACHE_MIN_DATE as ee,isCacheEnabled as re}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{wranglerCodegenInputs as ae}from"../packem_shared/wranglerCodegenInputs-BZamZrPz.mjs";import{DEFAULT_OBSERVABILITY as ne,resolveObservabilitySampling as ie}from"../packem_shared/DEFAULT_OBSERVABILITY-CPLADr5u.mjs";import{mergeWranglerEnvironment as fe}from"../packem_shared/mergeWranglerEnvironment-D5ekKj5x.mjs";import{WRANGLER_FILES as Ee,findWranglerFile as se,readWranglerJsonc as pe}from"../packem_shared/WRANGLER_FILES-UNW-xY5u.mjs";import{UNEXPORTED_CLASS_MARKER as ge,validateWranglerProject as Ce}from"../packem_shared/UNEXPORTED_CLASS_MARKER-07SNQ0rP.mjs";import{scanWranglerVariablesForSecrets as Re}from"../packem_shared/scanWranglerVariablesForSecrets-DRBYlMYb.mjs";import{wranglerToAlchemy as _e}from"../packem_shared/wranglerToAlchemy-CBO2ucRm.mjs";import{REQUIRED_COMPATIBILITY_DATE as Le,REQUIRED_FLAG as Ae,validateWrangler as De,validateWranglerConfig as Oe}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-C8qfwbaA.mjs";export{i as BINDING_MANIFEST_VERSION,m as CLOUDFLARE_CLI_CONFIG_WARNING_ENV,d as CLOUDFLARE_DRIVER,k as CLOUDFLARE_TOOLCHAIN_VERSIONS,ne as DEFAULT_OBSERVABILITY,C as GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG,N as HYPERDRIVE_PLACEHOLDER_ID,H as REMOTE_ELIGIBLE_KEYS,Le as REQUIRED_COMPATIBILITY_DATE,Ae as REQUIRED_FLAG,ge as UNEXPORTED_CLASS_MARKER,ee as WORKERS_CACHE_MIN_DATE,Ee as WRANGLER_FILES,o as applyModify,t as assertWranglerSatisfiesSchema,A as bindingsNeedingDatabase,l as buildBindingManifest,F as collectExportGaps,G as describePreservedCrons,_ as describeWithheld,E as detectCloudflareCliConfig,se as findWranglerFile,R as hasCloudflareCredentials,w as injectRemoteFlags,re as isCacheEnabled,Y as isRemoteEnvEnabled,K as materializeDevWranglerConfig,J as materializeServiceDevConfigs,fe as mergeWranglerEnvironment,j as planRemoteBindings,S as readManifest,pe as readWranglerJsonc,U as reconcileBindingsSafely,b as reconcileWranglerBindings,h as reconcileWranglerCompatibilityDate,M as reconcileWranglerCrons,P as reconcileWranglerExtras,W as recordManifestKey,ie as resolveObservabilitySampling,z as resolveRemoteEnabled,Re as scanWranglerVariablesForSecrets,D as startLocalHyperdrive,De as validateWrangler,Oe as validateWranglerConfig,Ce as validateWranglerProject,s as warnCloudflareCliConfigOnce,Z as withTailConsumer,I as withheldBindings,ae as wranglerCodegenInputs,_e as wranglerToAlchemy};
package/dist/index.d.mts CHANGED
@@ -2,8 +2,8 @@ import { AgentIR, ContainerIR, WorkflowIR, CodegenResult } from '@lunora/codegen
2
2
  export type { AgentIR, ContainerIR, WorkflowIR } from '@lunora/codegen';
3
3
  export { A as ACCENT, a as AGENT_RULES_DIR, b as AGENT_RULES_HINT, c as AGENT_RULES_HINT_ENV, type d as AgentRulesStatus, B as BADGES, e as BADGE_COLUMN_WIDTH, type f as BadgeName, type g as BadgeSpec, D as DEFAULT_DEPLOY_TARGET, L as LUNA_ART, h as LUNA_BUNNY, i as LUNA_NAME, j as LUNA_SIGNOFF, k as LUNORA_SKILL_NAMES, l as LUNORA_TAG, type m as LevelBadgeName, n as LunoraReporter, type P as PackageManager, type o as PackageManagerProbe, R as ROOT_SKILL_NAME, S as STEP_BADGE_NAMES, type p as StepBadgeName, type T as ToolchainInvocation, q as addArgsFor, r as advisoryLine, s as badgeLead, t as badgeWidth, u as claimAgentRulesHint, v as deployTargetIds, w as detectAgentRules, x as detectInstalledManagers, y as detectPackageManager, z as execArgsFor, C as installArgsFor, E as isRunnableTarget, F as lunoraLine, G as padBadge, H as paintAnswer, I as paintBadge, J as planToolchainInvocation, K as readProjectDependencies, M as readProjectDependencyNames, N as readProjectManifest, O as resolveDeployDriver, Q as runScriptArgsFor, U as runScriptCommand, V as runnableTargetIds, W as targetRunsOwnDevServer, X as toolchainExecArgs } from "./packem_shared/index.d-BoUSSRrk.mjs";
4
4
  import { ChildProcess } from 'node:child_process';
5
- import { D as DiscoveryCache } from "./packem_shared/infer-bindings.d-BKaqvxUQ.mjs";
6
- export { C as COMPOSED_WORKER_ENTRY, a as D1_PLACEHOLDER_ID, b as DURABLE_OBJECT_BINDINGS, type c as DiscoverSchemaInfoResult, d as GENERATED_CLASS_MODULES, e as GENERATED_MODULE_DURABLE_OBJECTS, type G as GeneratedClassModule, type f as InferOptions, type g as InferredAgent, type I as InferredBindings, type h as InferredContainer, type i as InferredWorkflow, M as MERGED_DURABLE_OBJECTS_MODULE, type S as SchemaInfo, j as createDiscoveryCache, k as discoverSchemaInfo, l as inferLunoraBindings, m as isMergedProject, n as isMergedRoleModule, s as secretSourcesFromBindings } from "./packem_shared/infer-bindings.d-BKaqvxUQ.mjs";
5
+ import { D as DiscoveryCache } from "./packem_shared/infer-bindings.d-DtKuba3D.mjs";
6
+ export { C as COMPOSED_WORKER_ENTRY, a as D1_PLACEHOLDER_ID, b as DURABLE_OBJECT_BINDINGS, type c as DiscoverSchemaInfoResult, d as GENERATED_CLASS_MODULES, e as GENERATED_MODULE_DURABLE_OBJECTS, type G as GeneratedClassModule, type f as InferOptions, type g as InferredAgent, type I as InferredBindings, type h as InferredContainer, type i as InferredWorkflow, M as MERGED_DURABLE_OBJECTS_MODULE, type S as SchemaInfo, j as createDiscoveryCache, k as discoverSchemaInfo, l as inferLunoraBindings, m as isMergedProject, n as isMergedRoleModule, s as secretSourcesFromBindings } from "./packem_shared/infer-bindings.d-DtKuba3D.mjs";
7
7
  import { Writable } from 'node:stream';
8
8
  export type { D as DeployDriver, a as DeployRequest, b as DevRequest, c as DriverToolchain, P as ProjectedConfig, d as ProjectionPurpose, S as SecretRequest, T as TailRequest, e as ToolchainCommand } from "./packem_shared/deploy-driver.d-CHVNQFV2.mjs";
9
9
  export { type A as AdditivePolicyEdit, type D as DestructivePolicyEdit, type P as PolicyEdit, type a as PolicyScaffoldFailureReason, type b as ScaffoldFileResult, type S as ScaffoldPolicyEdit, type c as WireResult, type W as WireRlsEdit, d as classifyPolicyEdit, r as resolveServerModule, s as scaffoldPolicyFile, w as wireRlsIntoProcedure } from "./packem_shared/policy-scaffold.d-D2H4_G01.mjs";
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import { AgentIR, ContainerIR, WorkflowIR, CodegenResult } from '@lunora/codegen
2
2
  export type { AgentIR, ContainerIR, WorkflowIR } from '@lunora/codegen';
3
3
  export { A as ACCENT, a as AGENT_RULES_DIR, b as AGENT_RULES_HINT, c as AGENT_RULES_HINT_ENV, type d as AgentRulesStatus, B as BADGES, e as BADGE_COLUMN_WIDTH, type f as BadgeName, type g as BadgeSpec, D as DEFAULT_DEPLOY_TARGET, L as LUNA_ART, h as LUNA_BUNNY, i as LUNA_NAME, j as LUNA_SIGNOFF, k as LUNORA_SKILL_NAMES, l as LUNORA_TAG, type m as LevelBadgeName, n as LunoraReporter, type P as PackageManager, type o as PackageManagerProbe, R as ROOT_SKILL_NAME, S as STEP_BADGE_NAMES, type p as StepBadgeName, type T as ToolchainInvocation, q as addArgsFor, r as advisoryLine, s as badgeLead, t as badgeWidth, u as claimAgentRulesHint, v as deployTargetIds, w as detectAgentRules, x as detectInstalledManagers, y as detectPackageManager, z as execArgsFor, C as installArgsFor, E as isRunnableTarget, F as lunoraLine, G as padBadge, H as paintAnswer, I as paintBadge, J as planToolchainInvocation, K as readProjectDependencies, M as readProjectDependencyNames, N as readProjectManifest, O as resolveDeployDriver, Q as runScriptArgsFor, U as runScriptCommand, V as runnableTargetIds, W as targetRunsOwnDevServer, X as toolchainExecArgs } from "./packem_shared/index.d-C1nVDcie.js";
4
4
  import { ChildProcess } from 'node:child_process';
5
- import { D as DiscoveryCache } from "./packem_shared/infer-bindings.d-BKaqvxUQ.js";
6
- export { C as COMPOSED_WORKER_ENTRY, a as D1_PLACEHOLDER_ID, b as DURABLE_OBJECT_BINDINGS, type c as DiscoverSchemaInfoResult, d as GENERATED_CLASS_MODULES, e as GENERATED_MODULE_DURABLE_OBJECTS, type G as GeneratedClassModule, type f as InferOptions, type g as InferredAgent, type I as InferredBindings, type h as InferredContainer, type i as InferredWorkflow, M as MERGED_DURABLE_OBJECTS_MODULE, type S as SchemaInfo, j as createDiscoveryCache, k as discoverSchemaInfo, l as inferLunoraBindings, m as isMergedProject, n as isMergedRoleModule, s as secretSourcesFromBindings } from "./packem_shared/infer-bindings.d-BKaqvxUQ.js";
5
+ import { D as DiscoveryCache } from "./packem_shared/infer-bindings.d-DtKuba3D.js";
6
+ export { C as COMPOSED_WORKER_ENTRY, a as D1_PLACEHOLDER_ID, b as DURABLE_OBJECT_BINDINGS, type c as DiscoverSchemaInfoResult, d as GENERATED_CLASS_MODULES, e as GENERATED_MODULE_DURABLE_OBJECTS, type G as GeneratedClassModule, type f as InferOptions, type g as InferredAgent, type I as InferredBindings, type h as InferredContainer, type i as InferredWorkflow, M as MERGED_DURABLE_OBJECTS_MODULE, type S as SchemaInfo, j as createDiscoveryCache, k as discoverSchemaInfo, l as inferLunoraBindings, m as isMergedProject, n as isMergedRoleModule, s as secretSourcesFromBindings } from "./packem_shared/infer-bindings.d-DtKuba3D.js";
7
7
  import { Writable } from 'node:stream';
8
8
  export type { D as DeployDriver, a as DeployRequest, b as DevRequest, c as DriverToolchain, P as ProjectedConfig, d as ProjectionPurpose, S as SecretRequest, T as TailRequest, e as ToolchainCommand } from "./packem_shared/deploy-driver.d-CHVNQFV2.js";
9
9
  export { type A as AdditivePolicyEdit, type D as DestructivePolicyEdit, type P as PolicyEdit, type a as PolicyScaffoldFailureReason, type b as ScaffoldFileResult, type S as ScaffoldPolicyEdit, type c as WireResult, type W as WireRlsEdit, d as classifyPolicyEdit, r as resolveServerModule, s as scaffoldPolicyFile, w as wireRlsIntoProcedure } from "./packem_shared/policy-scaffold.d-D2H4_G01.js";
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as 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 c,claimAgentRulesHint as p,detectAgentRules as D}from"./packem_shared/AGENT_RULES_DIR-Bd6JPtNa.mjs";import{clearApiSpecMarker as A,readApiSpecMarker as m,writeApiSpecMarker as S}from"./packem_shared/clearApiSpecMarker-DMGpP41V.mjs";import{MissingBuildOutputError as L}from"./packem_shared/MissingBuildOutputError-BAyekzof.mjs";import{default as T}from"./packem_shared/canonicalPath-DrfMiT3U.mjs";import{probeCelldToolchain as v}from"./packem_shared/probeCelldToolchain-DxDttfHy.mjs";import{startCelldDevSession as g,writeCelldDevProjection as I}from"./packem_shared/startCelldDevSession-BKRiLvt-.mjs";import{D1_PLACEHOLDER_ID as u}from"./packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{BUILD_ROOT_ENV as P,BUILD_TARGET_ENV as C,BUNDLE_META_PATH_ENV as M,CODEGEN_ENV as U,DEFAULT_BUNDLE_META_PATH as F,LAZY_FUNCTIONS_ENV as B,STRICT_ADVISORIES_ENV as G,isCodegenDisabled as b,isLazyFunctionsEnabled as y,resolveLazyFunctions as k}from"./packem_shared/BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{discoverContainerInfo as j}from"./packem_shared/discoverContainerInfo-DzXr7Vm3.mjs";import{streamContainerLogs as K}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as W,projectUsesUmbrella as Y}from"./packem_shared/detectFramework-Dfpvu6rD.mjs";import{acceptsConnection as z,startDevProcess as q}from"./packem_shared/acceptsConnection-DHhUYGjT.mjs";import{DEV_BINDINGS_FILE as Z,DEV_DAEMON_ENV as Q,DEV_HANDOFF_ENV as $,DEV_LOG_FILE as ee,DEV_LOG_FILE_ENV as re,DEV_STATE_DIR as oe,DEV_STATE_FILE as te,claimDevServerState as ae,clearDevServerState as Ee,isDevServerReady as se,isProcessAlive as ie,isRecordedProcessCurrent as ne,readDevServerState as _e,readLiveDevServerState as le,updateDevServerState as ce,writeDevServerState as pe}from"./packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs";import{DEV_VARS_EXAMPLE_FILE as de,DEV_VARS_FILE as Ae,DEV_VARS_KEY_PATTERN as me,escapeRegExp as Se,parseDevVariableEntries as fe,removeDevVariableLine as Le,upsertDevVariableLine as Ne}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEV_WORKER_ENV_VALUE as Re,DEV_WORKER_ENV_VAR as ve,ensureDevWorkerEnv as xe}from"./packem_shared/DEV_WORKER_ENV_VALUE-CgozgOxh.mjs";import{createDiscoveryCache as Ie}from"./packem_shared/createDiscoveryCache-npJI4uej.mjs";import{DEFAULT_DEPLOY_TARGET as ue,deployTargetIds as Oe,isRunnableTarget as Pe,planToolchainInvocation as Ce,resolveDeployDriver as Me,runnableTargetIds as Ue,targetRunsOwnDevServer as Fe}from"./packem_shared/DEFAULT_DEPLOY_TARGET-DllYb7Tj.mjs";import{default as Ge}from"./packem_shared/ensureGitignoreEntries-Tsk8Qkw7.mjs";import{inferLunoraBindings as ye,secretSourcesFromBindings as ke}from"./packem_shared/inferLunoraBindings-CGy-uHu6.mjs";import{LINKED_PROJECT_DIR as je,LINKED_PROJECT_FILE as we,readLinkedProject as Ke,writeLinkedProject as He}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as Ye,applyLintIgnores as Je,detectLintTools as ze}from"./packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs";import{blockingFindingsMessage as Xe,reportCodegenFindings as Ze}from"./packem_shared/blockingFindingsMessage-CRbg1sla.mjs";import{LUNORA_EVENT_SOURCE as $e,formatLunoraEvent as er}from"./packem_shared/LUNORA_EVENT_SOURCE-B9ZVohjO.mjs";import{LUNORA_TAG as or,advisoryLine as tr,lunoraLine as ar}from"./packem_shared/LUNORA_TAG-DQTGPqcJ.mjs";import{default as sr}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as nr,detectInstalledManagers as _r,detectPackageManager as lr,execArgsFor as cr,installArgsFor as pr,runScriptArgsFor as Dr,runScriptCommand as dr,toolchainExecArgs as Ar}from"./packem_shared/addArgsFor-CYZKhNIo.mjs";import{P as Sr,m as fr,s as Lr}from"./packem_shared/package-secrets-registry-UQ_uEAB_.mjs";import{runPostCodegenHook as Tr}from"./packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs";import{assertBuildTargetMatches as vr,interpretRemote as xr,readProjectRemotePreference as gr,readProjectTarget as Ir,resolveProjectTarget as Vr,resolveTargetOrThrow as ur}from"./packem_shared/assertBuildTargetMatches-CqrrwiQ-.mjs";import{readProjectDependencies as Pr,readProjectDependencyNames as Cr,readProjectManifest as Mr}from"./packem_shared/readProjectDependencies-l3uhUKjo.mjs";import{createConfirm as Fr,isInteractive as Br,promptMultiSelect as Gr,promptSelect as br,promptText as yr,promptYesNo as kr}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{default as jr}from"./packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs";import{buildPackageSecretsBlock as Kr,ensureDevVariables as Hr,ensureDevVarsExample as Wr,fillDevSecrets as Yr,generateSecretValue as Jr,isMintableSecretKey as zr,isPlaceholderValue as qr,planDevSecretsFill as Xr,planDevVariablesAugment as Zr,planDevVariablesScaffold as Qr,requiredSecrets as $r,writeDevVariablesFileAtomically as eo}from"./packem_shared/buildPackageSecretsBlock-GvaLgvFN.mjs";import{applyAdditiveEdit as oo,classifyEdit as to}from"./packem_shared/applyAdditiveEdit-DEwPKcJg.mjs";import{parseSchema as Eo}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as io,resolveServerModule as no,scaffoldPolicyFile as _o,wireRlsIntoProcedure as lo}from"./packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs";import{discoverSchemaInfo as po}from"./packem_shared/discoverSchemaInfo-DRPnqgif.mjs";import{ACCENT as Ao,BADGES as mo,BADGE_COLUMN_WIDTH as So,LUNA_ART as fo,LUNA_BUNNY as Lo,LUNA_NAME as No,LUNA_SIGNOFF as To,STEP_BADGE_NAMES as Ro,badgeLead as vo,badgeWidth as xo,padBadge as go,paintAnswer as Io,paintBadge as Vo}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{COMPOSED_WORKER_ENTRY as Oo,DURABLE_OBJECT_BINDINGS as Po,GENERATED_CLASS_MODULES as Co,GENERATED_MODULE_DURABLE_OBJECTS as Mo,MERGED_DURABLE_OBJECTS_MODULE as Uo,isMergedProject as Fo,isMergedRoleModule as Bo}from"./packem_shared/COMPOSED_WORKER_ENTRY-BcFt6ts5.mjs";import{discoverWorkflowInfo as bo}from"./packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs";export{Ao as ACCENT,o as AGENT_MODE_ENV,i as AGENT_RULES_DIR,n as AGENT_RULES_HINT,_ as AGENT_RULES_HINT_ENV,mo as BADGES,So as BADGE_COLUMN_WIDTH,P as BUILD_ROOT_ENV,C as BUILD_TARGET_ENV,M as BUNDLE_META_PATH_ENV,U as CODEGEN_ENV,Oo as COMPOSED_WORKER_ENTRY,u as D1_PLACEHOLDER_ID,F as DEFAULT_BUNDLE_META_PATH,ue as DEFAULT_DEPLOY_TARGET,Z as DEV_BINDINGS_FILE,Q as DEV_DAEMON_ENV,$ as DEV_HANDOFF_ENV,ee as DEV_LOG_FILE,re as DEV_LOG_FILE_ENV,oe as DEV_STATE_DIR,te as DEV_STATE_FILE,de as DEV_VARS_EXAMPLE_FILE,Ae as DEV_VARS_FILE,me as DEV_VARS_KEY_PATTERN,Re as DEV_WORKER_ENV_VALUE,ve as DEV_WORKER_ENV_VAR,Po as DURABLE_OBJECT_BINDINGS,Co as GENERATED_CLASS_MODULES,Mo as GENERATED_MODULE_DURABLE_OBJECTS,B as LAZY_FUNCTIONS_ENV,je as LINKED_PROJECT_DIR,we as LINKED_PROJECT_FILE,fo as LUNA_ART,Lo as LUNA_BUNNY,No as LUNA_NAME,To as LUNA_SIGNOFF,$e as LUNORA_EVENT_SOURCE,Ye as LUNORA_IGNORED_PATHS,l as LUNORA_SKILL_NAMES,or as LUNORA_TAG,sr as LunoraReporter,Uo as MERGED_DURABLE_OBJECTS_MODULE,L as MissingBuildOutputError,Sr as PACKAGE_SECRETS_REGISTRY,c as ROOT_SKILL_NAME,Ro as STEP_BADGE_NAMES,G as STRICT_ADVISORIES_ENV,z as acceptsConnection,nr as addArgsFor,tr as advisoryLine,oo as applyAdditiveEdit,Je as applyLintIgnores,vr as assertBuildTargetMatches,vo as badgeLead,xo as badgeWidth,Xe as blockingFindingsMessage,Kr as buildPackageSecretsBlock,T as canonicalPath,p as claimAgentRulesHint,ae as claimDevServerState,to as classifyEdit,io as classifyPolicyEdit,A as clearApiSpecMarker,Ee as clearDevServerState,Fr as createConfirm,Ie as createDiscoveryCache,Oe as deployTargetIds,D as detectAgentRules,t as detectAiAgent,W as detectFramework,_r as detectInstalledManagers,ze as detectLintTools,lr as detectPackageManager,E as discoverAgentInfo,j as discoverContainerInfo,po as discoverSchemaInfo,bo as discoverWorkflowInfo,Hr as ensureDevVariables,Wr as ensureDevVarsExample,xe as ensureDevWorkerEnv,Ge as ensureGitignoreEntries,Se as escapeRegExp,cr as execArgsFor,Yr as fillDevSecrets,er as formatLunoraEvent,Jr as generateSecretValue,ye as inferLunoraBindings,pr as installArgsFor,xr as interpretRemote,b as isCodegenDisabled,se as isDevServerReady,Br as isInteractive,y as isLazyFunctionsEnabled,Fo as isMergedProject,Bo as isMergedRoleModule,zr as isMintableSecretKey,qr as isPlaceholderValue,ie as isProcessAlive,ne as isRecordedProcessCurrent,Pe as isRunnableTarget,ar as lunoraLine,fr as mintableSecretKeysFor,go as padBadge,Io as paintAnswer,Vo as paintBadge,fe as parseDevVariableEntries,Eo as parseSchema,Xr as planDevSecretsFill,Zr as planDevVariablesAugment,Qr as planDevVariablesScaffold,Ce as planToolchainInvocation,v as probeCelldToolchain,Y as projectUsesUmbrella,Gr as promptMultiSelect,br as promptSelect,yr as promptText,kr as promptYesNo,m as readApiSpecMarker,_e as readDevServerState,Ke as readLinkedProject,le as readLiveDevServerState,Pr as readProjectDependencies,Cr as readProjectDependencyNames,Mr as readProjectManifest,gr as readProjectRemotePreference,Ir as readProjectTarget,Le as removeDevVariableLine,Ze as reportCodegenFindings,$r as requiredSecrets,Me as resolveDeployDriver,k as resolveLazyFunctions,Vr as resolveProjectTarget,jr as resolveSchemaDirectory,no as resolveServerModule,ur as resolveTargetOrThrow,Tr as runPostCodegenHook,Dr as runScriptArgsFor,dr as runScriptCommand,Ue as runnableTargetIds,_o as scaffoldPolicyFile,ke as secretSourcesFromBindings,Lr as secretsForPackages,g as startCelldDevSession,q as startDevProcess,K as streamContainerLogs,Fe as targetRunsOwnDevServer,Ar as toolchainExecArgs,ce as updateDevServerState,Ne as upsertDevVariableLine,lo as wireRlsIntoProcedure,S as writeApiSpecMarker,I as writeCelldDevProjection,pe as writeDevServerState,eo as writeDevVariablesFileAtomically,He 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 c,claimAgentRulesHint as p,detectAgentRules as D}from"./packem_shared/AGENT_RULES_DIR-Bd6JPtNa.mjs";import{clearApiSpecMarker as A,readApiSpecMarker as m,writeApiSpecMarker as S}from"./packem_shared/clearApiSpecMarker-DMGpP41V.mjs";import{MissingBuildOutputError as L}from"./packem_shared/MissingBuildOutputError-BAyekzof.mjs";import{default as T}from"./packem_shared/canonicalPath-DrfMiT3U.mjs";import{probeCelldToolchain as v}from"./packem_shared/probeCelldToolchain-DxDttfHy.mjs";import{startCelldDevSession as g,writeCelldDevProjection as I}from"./packem_shared/startCelldDevSession-Bg_RN5uf.mjs";import{D1_PLACEHOLDER_ID as u}from"./packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{BUILD_ROOT_ENV as P,BUILD_TARGET_ENV as C,BUNDLE_META_PATH_ENV as M,CODEGEN_ENV as U,DEFAULT_BUNDLE_META_PATH as F,LAZY_FUNCTIONS_ENV as B,STRICT_ADVISORIES_ENV as G,isCodegenDisabled as b,isLazyFunctionsEnabled as y,resolveLazyFunctions as k}from"./packem_shared/BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{discoverContainerInfo as j}from"./packem_shared/discoverContainerInfo-DzXr7Vm3.mjs";import{streamContainerLogs as K}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as W,projectUsesUmbrella as Y}from"./packem_shared/detectFramework-Dfpvu6rD.mjs";import{acceptsConnection as z,startDevProcess as q}from"./packem_shared/acceptsConnection-DHhUYGjT.mjs";import{DEV_BINDINGS_FILE as Z,DEV_DAEMON_ENV as Q,DEV_HANDOFF_ENV as $,DEV_LOG_FILE as ee,DEV_LOG_FILE_ENV as re,DEV_STATE_DIR as oe,DEV_STATE_FILE as te,claimDevServerState as ae,clearDevServerState as Ee,isDevServerReady as se,isProcessAlive as ie,isRecordedProcessCurrent as ne,readDevServerState as _e,readLiveDevServerState as le,updateDevServerState as ce,writeDevServerState as pe}from"./packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs";import{DEV_VARS_EXAMPLE_FILE as de,DEV_VARS_FILE as Ae,DEV_VARS_KEY_PATTERN as me,escapeRegExp as Se,parseDevVariableEntries as fe,removeDevVariableLine as Le,upsertDevVariableLine as Ne}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEV_WORKER_ENV_VALUE as Re,DEV_WORKER_ENV_VAR as ve,ensureDevWorkerEnv as xe}from"./packem_shared/DEV_WORKER_ENV_VALUE-CgozgOxh.mjs";import{createDiscoveryCache as Ie}from"./packem_shared/createDiscoveryCache-npJI4uej.mjs";import{DEFAULT_DEPLOY_TARGET as ue,deployTargetIds as Oe,isRunnableTarget as Pe,planToolchainInvocation as Ce,resolveDeployDriver as Me,runnableTargetIds as Ue,targetRunsOwnDevServer as Fe}from"./packem_shared/DEFAULT_DEPLOY_TARGET-DllYb7Tj.mjs";import{default as Ge}from"./packem_shared/ensureGitignoreEntries-Tsk8Qkw7.mjs";import{inferLunoraBindings as ye,secretSourcesFromBindings as ke}from"./packem_shared/inferLunoraBindings-whOZv00U.mjs";import{LINKED_PROJECT_DIR as je,LINKED_PROJECT_FILE as we,readLinkedProject as Ke,writeLinkedProject as He}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as Ye,applyLintIgnores as Je,detectLintTools as ze}from"./packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs";import{blockingFindingsMessage as Xe,reportCodegenFindings as Ze}from"./packem_shared/blockingFindingsMessage-CRbg1sla.mjs";import{LUNORA_EVENT_SOURCE as $e,formatLunoraEvent as er}from"./packem_shared/LUNORA_EVENT_SOURCE-B9ZVohjO.mjs";import{LUNORA_TAG as or,advisoryLine as tr,lunoraLine as ar}from"./packem_shared/LUNORA_TAG-DQTGPqcJ.mjs";import{default as sr}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as nr,detectInstalledManagers as _r,detectPackageManager as lr,execArgsFor as cr,installArgsFor as pr,runScriptArgsFor as Dr,runScriptCommand as dr,toolchainExecArgs as Ar}from"./packem_shared/addArgsFor-CYZKhNIo.mjs";import{P as Sr,m as fr,s as Lr}from"./packem_shared/package-secrets-registry-UQ_uEAB_.mjs";import{runPostCodegenHook as Tr}from"./packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs";import{assertBuildTargetMatches as vr,interpretRemote as xr,readProjectRemotePreference as gr,readProjectTarget as Ir,resolveProjectTarget as Vr,resolveTargetOrThrow as ur}from"./packem_shared/assertBuildTargetMatches-CqrrwiQ-.mjs";import{readProjectDependencies as Pr,readProjectDependencyNames as Cr,readProjectManifest as Mr}from"./packem_shared/readProjectDependencies-l3uhUKjo.mjs";import{createConfirm as Fr,isInteractive as Br,promptMultiSelect as Gr,promptSelect as br,promptText as yr,promptYesNo as kr}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{default as jr}from"./packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs";import{buildPackageSecretsBlock as Kr,ensureDevVariables as Hr,ensureDevVarsExample as Wr,fillDevSecrets as Yr,generateSecretValue as Jr,isMintableSecretKey as zr,isPlaceholderValue as qr,planDevSecretsFill as Xr,planDevVariablesAugment as Zr,planDevVariablesScaffold as Qr,requiredSecrets as $r,writeDevVariablesFileAtomically as eo}from"./packem_shared/buildPackageSecretsBlock-GvaLgvFN.mjs";import{applyAdditiveEdit as oo,classifyEdit as to}from"./packem_shared/applyAdditiveEdit-DEwPKcJg.mjs";import{parseSchema as Eo}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as io,resolveServerModule as no,scaffoldPolicyFile as _o,wireRlsIntoProcedure as lo}from"./packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs";import{discoverSchemaInfo as po}from"./packem_shared/discoverSchemaInfo-DRPnqgif.mjs";import{ACCENT as Ao,BADGES as mo,BADGE_COLUMN_WIDTH as So,LUNA_ART as fo,LUNA_BUNNY as Lo,LUNA_NAME as No,LUNA_SIGNOFF as To,STEP_BADGE_NAMES as Ro,badgeLead as vo,badgeWidth as xo,padBadge as go,paintAnswer as Io,paintBadge as Vo}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{COMPOSED_WORKER_ENTRY as Oo,DURABLE_OBJECT_BINDINGS as Po,GENERATED_CLASS_MODULES as Co,GENERATED_MODULE_DURABLE_OBJECTS as Mo,MERGED_DURABLE_OBJECTS_MODULE as Uo,isMergedProject as Fo,isMergedRoleModule as Bo}from"./packem_shared/COMPOSED_WORKER_ENTRY-BcFt6ts5.mjs";import{discoverWorkflowInfo as bo}from"./packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs";export{Ao as ACCENT,o as AGENT_MODE_ENV,i as AGENT_RULES_DIR,n as AGENT_RULES_HINT,_ as AGENT_RULES_HINT_ENV,mo as BADGES,So as BADGE_COLUMN_WIDTH,P as BUILD_ROOT_ENV,C as BUILD_TARGET_ENV,M as BUNDLE_META_PATH_ENV,U as CODEGEN_ENV,Oo as COMPOSED_WORKER_ENTRY,u as D1_PLACEHOLDER_ID,F as DEFAULT_BUNDLE_META_PATH,ue as DEFAULT_DEPLOY_TARGET,Z as DEV_BINDINGS_FILE,Q as DEV_DAEMON_ENV,$ as DEV_HANDOFF_ENV,ee as DEV_LOG_FILE,re as DEV_LOG_FILE_ENV,oe as DEV_STATE_DIR,te as DEV_STATE_FILE,de as DEV_VARS_EXAMPLE_FILE,Ae as DEV_VARS_FILE,me as DEV_VARS_KEY_PATTERN,Re as DEV_WORKER_ENV_VALUE,ve as DEV_WORKER_ENV_VAR,Po as DURABLE_OBJECT_BINDINGS,Co as GENERATED_CLASS_MODULES,Mo as GENERATED_MODULE_DURABLE_OBJECTS,B as LAZY_FUNCTIONS_ENV,je as LINKED_PROJECT_DIR,we as LINKED_PROJECT_FILE,fo as LUNA_ART,Lo as LUNA_BUNNY,No as LUNA_NAME,To as LUNA_SIGNOFF,$e as LUNORA_EVENT_SOURCE,Ye as LUNORA_IGNORED_PATHS,l as LUNORA_SKILL_NAMES,or as LUNORA_TAG,sr as LunoraReporter,Uo as MERGED_DURABLE_OBJECTS_MODULE,L as MissingBuildOutputError,Sr as PACKAGE_SECRETS_REGISTRY,c as ROOT_SKILL_NAME,Ro as STEP_BADGE_NAMES,G as STRICT_ADVISORIES_ENV,z as acceptsConnection,nr as addArgsFor,tr as advisoryLine,oo as applyAdditiveEdit,Je as applyLintIgnores,vr as assertBuildTargetMatches,vo as badgeLead,xo as badgeWidth,Xe as blockingFindingsMessage,Kr as buildPackageSecretsBlock,T as canonicalPath,p as claimAgentRulesHint,ae as claimDevServerState,to as classifyEdit,io as classifyPolicyEdit,A as clearApiSpecMarker,Ee as clearDevServerState,Fr as createConfirm,Ie as createDiscoveryCache,Oe as deployTargetIds,D as detectAgentRules,t as detectAiAgent,W as detectFramework,_r as detectInstalledManagers,ze as detectLintTools,lr as detectPackageManager,E as discoverAgentInfo,j as discoverContainerInfo,po as discoverSchemaInfo,bo as discoverWorkflowInfo,Hr as ensureDevVariables,Wr as ensureDevVarsExample,xe as ensureDevWorkerEnv,Ge as ensureGitignoreEntries,Se as escapeRegExp,cr as execArgsFor,Yr as fillDevSecrets,er as formatLunoraEvent,Jr as generateSecretValue,ye as inferLunoraBindings,pr as installArgsFor,xr as interpretRemote,b as isCodegenDisabled,se as isDevServerReady,Br as isInteractive,y as isLazyFunctionsEnabled,Fo as isMergedProject,Bo as isMergedRoleModule,zr as isMintableSecretKey,qr as isPlaceholderValue,ie as isProcessAlive,ne as isRecordedProcessCurrent,Pe as isRunnableTarget,ar as lunoraLine,fr as mintableSecretKeysFor,go as padBadge,Io as paintAnswer,Vo as paintBadge,fe as parseDevVariableEntries,Eo as parseSchema,Xr as planDevSecretsFill,Zr as planDevVariablesAugment,Qr as planDevVariablesScaffold,Ce as planToolchainInvocation,v as probeCelldToolchain,Y as projectUsesUmbrella,Gr as promptMultiSelect,br as promptSelect,yr as promptText,kr as promptYesNo,m as readApiSpecMarker,_e as readDevServerState,Ke as readLinkedProject,le as readLiveDevServerState,Pr as readProjectDependencies,Cr as readProjectDependencyNames,Mr as readProjectManifest,gr as readProjectRemotePreference,Ir as readProjectTarget,Le as removeDevVariableLine,Ze as reportCodegenFindings,$r as requiredSecrets,Me as resolveDeployDriver,k as resolveLazyFunctions,Vr as resolveProjectTarget,jr as resolveSchemaDirectory,no as resolveServerModule,ur as resolveTargetOrThrow,Tr as runPostCodegenHook,Dr as runScriptArgsFor,dr as runScriptCommand,Ue as runnableTargetIds,_o as scaffoldPolicyFile,ke as secretSourcesFromBindings,Lr as secretsForPackages,g as startCelldDevSession,q as startDevProcess,K as streamContainerLogs,Fe as targetRunsOwnDevServer,Ar as toolchainExecArgs,ce as updateDevServerState,Ne as upsertDevVariableLine,lo as wireRlsIntoProcedure,S as writeApiSpecMarker,I as writeCelldDevProjection,pe as writeDevServerState,eo as writeDevVariablesFileAtomically,He as writeLinkedProject};
@@ -0,0 +1 @@
1
+ import{readFile as a}from"node:fs/promises";import{join as u}from"node:path";const f="/__lunora/advisor-procedures",d="advisor-procedures.json",c=new Set(["action","mutation","query"]),i=new Set(["internal","public"]),l=e=>{if(typeof e!="object"||e===null)return!1;const r=e;return typeof r.exportName=="string"&&typeof r.file=="string"&&c.has(r.kind)&&i.has(r.visibility)&&["usesCaptcha","usesEmailGate","usesMask","usesRateLimit","usesRls"].every(s=>typeof r[s]=="boolean")},E=async e=>{if(e.method!=="GET")return{body:{error:"GET only"},status:405};const r=u(e.projectRoot,e.schemaDirectory??"lunora","_generated",d);let s;try{s=await a(r,"utf8")}catch(t){return t.code==="ENOENT"?{body:{error:"advisor-procedures.json is not generated yet; run `lunora codegen`."},status:404}:(console.error(`@lunora/config: could not read ${r}`,t),{body:{error:"advisor-procedures.json could not be read; see the dev server log."},status:500})}let o;try{o=JSON.parse(s)}catch{return{body:{error:"advisor-procedures.json is not valid JSON; re-run `lunora codegen`."},status:500}}const n=typeof o=="object"&&o!==null?o.procedures:void 0;return Array.isArray(n)?n.every(t=>l(t))?{body:o,status:200}:{body:{error:"advisor-procedures.json has a malformed procedure entry; re-run `lunora codegen`."},status:500}:{body:{error:"advisor-procedures.json has no procedures array; re-run `lunora codegen`."},status:500}};export{f as ADVISOR_PROCEDURES_ENDPOINT,E as handleAdvisorProceduresRequest};
@@ -0,0 +1 @@
1
+ const e={"@cloudflare/vite-plugin":"^1.63.1","@cloudflare/workers-types":"^5.20261004.1",wrangler:"^4.156.1"};export{e as default};
@@ -0,0 +1 @@
1
+ import{resolveAdminToken as A}from"./devVariablesStamp-Cetr3qFz.mjs";import{handleAdvisorProceduresRequest as I,ADVISOR_PROCEDURES_ENDPOINT as O}from"./ADVISOR_PROCEDURES_ENDPOINT-BPnqzAgT.mjs";import{sendStudioDocument as _,sendStudioAsset as h}from"./sendStudioAsset-B81Pex91.mjs";import{isStandaloneModulePath as y,studioAssetsStamp as N,loadStudioAssets as E,readStandaloneAsset as H,assetContentType as R}from"./assetContentType-CUb5bpbI.mjs";import v from"./createStudioDocumentCache-B3Sf1bIl.mjs";import{detectAgentRules as C}from"./AGENT_RULES_DIR-Bd6JPtNa.mjs";import{handlePolicyScaffoldRequest as L,POLICY_SCAFFOLD_ENDPOINT as b}from"./POLICY_SCAFFOLD_ENDPOINT-D5PpQPkf.mjs";import x from"./renderStudioHtml-CRDTNivi.mjs";import{handleSchemaEditRequest as $,SCHEMA_EDIT_ENDPOINT as k}from"./SCHEMA_EDIT_ENDPOINT-CtxWqfDe.mjs";import{handleSeedRequest as U,SEED_ENDPOINT as g}from"./SEED_ENDPOINT-C1fhrehH.mjs";import{serveJsonHandler as j}from"./serveJsonHandler-B8_GE6QC.mjs";import{transportRejectionReason as F}from"./ALLOW_FORWARDED_ENV-BUndghJx.mjs";import"./STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs";const i="/__lunora",M=`${i}/studio.js`,m=`${i}/styles.css`,P=/\/$/,q={[b]:L,[k]:$,[g]:U,[O]:I},w=new Set(["127.0.0.1","::1","localhost"]),st=t=>t!==void 0&&t!==!1&&!w.has(t),T=t=>t===void 0||t==="/"?"":t.replace(P,""),nt=t=>`${T(t)}${i}`,B=t=>{try{return new URL(t,"http://localhost").pathname}catch{const d=t.indexOf("?");return d===-1?t:t.slice(0,d)}},at=t=>{const{logger:d,projectRoot:c}=t,u=T(t.base);let l,S;const p=v(c,()=>x({adminToken:A(c),advisorProcedures:!0,basePath:i,dataEditable:!0,rulesInstalled:C(c).installed,runAsIdentity:!0,schemaEditable:!0,scriptSrc:M,styleHref:m})),D=(s,o,e)=>{const n=N();if((l===void 0||n!==S)&&(l=E(d),S=n),l===void 0){e.statusCode=501,e.setHeader("Content-Type","text/plain"),e.end("Lunora studio assets not found — install and build @lunora/studio.");return}const a=s===m,r=s.slice(s.lastIndexOf("/")+1);if(a){h(o,e,l.styles,"text/css; charset=utf-8",r,n);return}const f=H(r);if(f===void 0){e.statusCode=404,e.setHeader("Content-Type","text/plain"),e.end("Not found");return}h(o,e,f,R(r),r,n)};return(s,o,e)=>{const n=B(s.url??"").replace(P,""),a=u!==""&&n.startsWith(u)?n.slice(u.length):n;if(a!==i&&!a.startsWith(`${i}/`)){e();return}if(t.isNonLoopbackBind||F(s,d)!==void 0){o.statusCode=403,o.setHeader("Content-Type","text/plain"),o.end("Lunora studio is only available on loopback hosts in dev.");return}const r=q[a];if(r!==void 0){j(s,o,r,c,{apiSpec:t.apiSpec,lazyFunctions:t.lazyFunctions,schemaDirectory:t.schemaDirectory});return}if(a===m||y(a)){D(a,s,o);return}_(o,p())}};export{i as STUDIO_PATH,M as STUDIO_SCRIPT_PATH,m as STUDIO_STYLE_PATH,at as createStudioMiddleware,st as isNonLoopbackHost,B as requestPathname,nt as studioMountPath};
@@ -1,2 +1,2 @@
1
- import{readFileSync as ee,writeFileSync as ne}from"node:fs";import{createRequire as se}from"node:module";import{join as Q}from"node:path";import{containerBuildTag as te}from"@lunora/container";import{readJsonSync as ie}from"@visulima/fs";import{c as oe}from"./celld-binding-id-9MiUoteo.mjs";import{applyModify as w}from"./applyModify-DKP2l6S9.mjs";import{recordManifestKey as ae,readManifest as Y}from"./readManifest-Cighz3WC.mjs";import{D1_PLACEHOLDER_ID as U,HYPERDRIVE_PLACEHOLDER_ID as re}from"./D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{parseTree as de,findNodeAtLocation as ce}from"jsonc-parser";import{r as le,a as ue,b as ge,c as me}from"./reconcile-services-C4TwY8YH.mjs";import{DEV_VARS_FILE as pe,parseDevVariableEntries as fe}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{secretSourcesFromBindings as be}from"./inferLunoraBindings-CGy-uHu6.mjs";import{requiredSecrets as he}from"./buildPackageSecretsBlock-GvaLgvFN.mjs";import{w as ve,m as we,s as G,o as P,n as I,p as _e}from"./validate-bindings-PVHSAU6M.mjs";import{s as ye}from"./worker-entry-checks-CHrum2AN.mjs";import{DEFAULT_OBSERVABILITY as Se}from"./DEFAULT_OBSERVABILITY-CPLADr5u.mjs";import{findWranglerFile as Ee,readWranglerJsonc as xe}from"./WRANGLER_FILES-UNW-xY5u.mjs";const Ae=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxConcurrency","max_concurrency"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],B=e=>Object.fromEntries(Ae.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),L="queueTuning",Oe=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,$e=/^[\t ]*,/u,Ne=(e,n)=>{const s=de(e),t=s===void 0?void 0:ce(s,[...n])?.parent;if(t?.type==="property"){const o=t.offset+t.length,i=e.lastIndexOf(`
1
+ import{readFileSync as ee,writeFileSync as ne}from"node:fs";import{createRequire as se}from"node:module";import{join as Q}from"node:path";import{containerBuildTag as te}from"@lunora/container";import{readJsonSync as ie}from"@visulima/fs";import{c as oe}from"./celld-binding-id-9MiUoteo.mjs";import{applyModify as w}from"./applyModify-DKP2l6S9.mjs";import{recordManifestKey as ae,readManifest as Y}from"./readManifest-Cighz3WC.mjs";import{D1_PLACEHOLDER_ID as U,HYPERDRIVE_PLACEHOLDER_ID as re}from"./D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{parseTree as de,findNodeAtLocation as ce}from"jsonc-parser";import{r as le,a as ue,b as ge,c as me}from"./reconcile-services-C4TwY8YH.mjs";import{DEV_VARS_FILE as pe,parseDevVariableEntries as fe}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{secretSourcesFromBindings as be}from"./inferLunoraBindings-whOZv00U.mjs";import{requiredSecrets as he}from"./buildPackageSecretsBlock-GvaLgvFN.mjs";import{w as ve,m as we,s as G,o as P,n as I,p as _e}from"./validate-bindings-PVHSAU6M.mjs";import{s as ye}from"./worker-entry-checks-CHrum2AN.mjs";import{DEFAULT_OBSERVABILITY as Se}from"./DEFAULT_OBSERVABILITY-CPLADr5u.mjs";import{findWranglerFile as Ee,readWranglerJsonc as xe}from"./WRANGLER_FILES-UNW-xY5u.mjs";const Ae=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxConcurrency","max_concurrency"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],B=e=>Object.fromEntries(Ae.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),L="queueTuning",Oe=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,$e=/^[\t ]*,/u,Ne=(e,n)=>{const s=de(e),t=s===void 0?void 0:ce(s,[...n])?.parent;if(t?.type==="property"){const o=t.offset+t.length,i=e.lastIndexOf(`
2
2
  `,t.offset-1)+1,a=Oe.exec(e.slice(o));if(a!==null&&e.slice(i,t.offset).trim()===""){const m=t.parent?.children??[],u=m.indexOf(t),d=u===m.length-1&&u>0?m[u-1]:void 0,c=d===void 0?void 0:$e.exec(e.slice(d.offset+d.length))??void 0;return(c===void 0||d===void 0?e.slice(0,i):e.slice(0,d.offset+d.length)+e.slice(d.offset+d.length+c[0].length,i))+e.slice(o+a[0].length)}}return w(e,n,void 0)},J=(e,n,s,t,o,i=new Set)=>{const a=s.join("."),m={},u=[],d=[];let c=e;return{entries:n.map((l,v)=>{const g=t(l);if(g===void 0||l.queue===void 0)return l;const b=Object.fromEntries(Object.entries(B(g)).filter(([f])=>!i.has(f))),h=Object.entries(o[l.queue]??{}).filter(([f])=>!Object.hasOwn(b,f)),_=Object.entries(b).filter(([f,y])=>l[f]!==y),E=h.filter(([f,y])=>l[f]===y).map(([f])=>f),O=Object.fromEntries(Object.entries({...l,...b}).filter(([f])=>!E.includes(f)));for(const[f,y]of _)c=w(c,[...s,v,f],y);for(const f of E)c=Ne(c,[...s,v,f]);for(const[f,y]of h){const A=l[f];A!==void 0&&A!==y&&d.push(`${a}/${l.queue}: ${f} is no longer declared by defineQueue, but it was changed by hand to ${JSON.stringify(A)} from the declared ${JSON.stringify(y)}, so it was kept. Delete it from wrangler.jsonc if it should go.`)}return(_.length>0||E.length>0)&&u.push(`${a}/${l.queue} (${[..._.map(([f])=>f),...E.map(f=>`removed ${f}`)].join(", ")})`),Object.keys(b).length>0&&(m[l.queue]=b),O}),owned:m,text:c,updated:u,warnings:d}},ke=(e,n,s,t)=>{const o=n.queues??{},i=o.producers??[],a=o.consumers??[],m=new Set(i.map(g=>g?.binding)),u=new Set(a.map(g=>g.queue)),d=s.filter(g=>!m.has(g.bindingName)),c=s.filter(g=>!u.has(g.name)),p=J(e,a,["queues","consumers"],g=>s.find(b=>b.name===g.queue),t);let l=p.text;const v={...p.owned};if(d.length>0||c.length>0){const g=[...i,...d.map(h=>({binding:h.bindingName,queue:h.name}))],b=[...p.entries,...c.map(h=>({queue:h.name,...h.mode==="pull"?{type:"http_pull"}:{},...B(h)}))];for(const h of c){const _=B(h);Object.keys(_).length>0&&(v[h.name]=_)}l=w(l,["queues"],{consumers:b,producers:g})}return{added:[...d.map(g=>`queues.producers/${g.bindingName}`),...c.map(g=>`queues.consumers/${g.name}`)],owned:v,text:l,updated:p.updated,warnings:p.warnings}},Ce=(e,n,s,t,o)=>{const i=n.env?.[t],a=i?.queues?.consumers??[],m=i?.queues?.producers??[],u=l=>{const v=m.find(g=>g?.queue===l.queue)?.binding;return v!==void 0?s.find(g=>g.bindingName===v):s.find(g=>g.name===l.queue&&!m.some(b=>b?.binding===g.bindingName))},d=J(e,a,["env",t,"queues","consumers"],u,o,new Set(["dead_letter_queue"])),c=a.filter(l=>l.queue!==void 0&&u(l)===void 0).map(l=>`env.${t}.queues.consumers/${String(l.queue)}: no defineQueue export matches it — this block declares no producer mapping one of their bindings to "${String(l.queue)}", and no export is named that — so it was not retuned. A consumer for a queue another worker produces is skipped the same way.`),p=a.flatMap(l=>{const v=u(l)?.tuning.deadLetterQueue;return v===void 0||l.dead_letter_queue!==void 0?[]:[`env.${t}.queues.consumers/${String(l.queue)}: defineQueue declares deadLetterQueue "${v}", but this consumer has no dead_letter_queue, so its exhausted messages are dropped. Queue names differ per environment, so reconcile does not write it here; add it by hand.`]});return{added:[],owned:d.owned,text:d.text,updated:d.updated,warnings:[...d.warnings,...p,...c]}},Te=(e,n)=>{if(e?.lunoraIsForeign===!0)return n.push(`${e.path}: \`lunora\` is not an object, so the queue tuning ownership record cannot be read or written — an option removed from defineQueue stays deployed.`),{};const s=e?.lunora?.[L],t=o=>typeof o=="object"&&o!==null&&!Array.isArray(o);return s===void 0?{}:!t(s)||!Object.values(s).every(o=>t(o)&&Object.values(o).every(i=>t(i)))?(n.push(`${e?.path??"package.json"}: \`lunora.${L}\` is not a map of scope → queue → fields, so it is ignored — an option removed from defineQueue stays deployed until the next pass records it again.`),{}):s},Ie=(e,n,s)=>{const t=Object.fromEntries(Object.entries({...n,...s}).filter(([,o])=>Object.keys(o).length>0));ae(e,L,Object.keys(t).length===0?void 0:t)},je="https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/artifacts/namespaces",Re=e=>{const n='add an "artifacts" binding ({ binding: "ARTIFACTS", namespace }) — codegen reads env.ARTIFACTS unless `.artifacts()` on defineApp points ctx.artifacts at another binding';return e===void 0?`ctx.artifacts is used; ${n}. The namespace is created by the first repo create() if it does not exist yet.`:`ctx.artifacts is used and the schema pins data to "${e}"; create the namespace in that jurisdiction BEFORE the first repo, with POST ${je} and body { "namespace": "<name>", "jurisdiction": "${e}" }, then ${n}. A namespace's jurisdiction cannot be changed, and one created implicitly by the first repo create() is unrestricted. With CLOUDFLARE_API_TOKEN set, \`lunora deploy\` creates a missing namespace in that jurisdiction for a binding you have added.`},j="PIPELINES",R="ARTIFACTS",qe=(e,n,s)=>{const t=n!==void 0&&(s===void 0||s==="cloudflare"),o=e.flagshipBinding!==void 0&&!(n?.flagship??[]).some(d=>d.binding===e.flagshipBinding),i=e.usesPipelines&&!(n?.pipelines??[]).some(d=>d.binding===j),a=e.usesArtifacts?n?.artifacts??[]:[],m=a.some(d=>d.binding===R)?[]:a.flatMap(d=>d.binding===void 0?[]:[d.binding]);return[[e.usesKv&&(n?.kv_namespaces?.length??0)===0&&(!t||e.jurisdiction!==void 0),e.jurisdiction===void 0?'ctx.kv is used but no kv_namespaces binding exists; add one ({ binding: "KV" }) — wrangler creates the namespace on the first deploy.':`ctx.kv is used and the schema pins data to "${e.jurisdiction}"; run \`wrangler kv namespace create <name> --jurisdiction ${e.jurisdiction}\` and add a kv_namespaces entry ({ binding: "KV", id }) — a namespace wrangler creates on deploy is unrestricted.`],[e.usesHyperdrive&&(n?.hyperdrive?.length??0)===0&&!t,'@lunora/hyperdrive is used but no hyperdrive binding exists; add one ({ binding: "HYPERDRIVE", id }) — on a Cloudflare target `lunora deploy` creates the Hyperdrive config from a connection string.'],[e.usesArtifacts&&a.length===0&&(!t||e.jurisdiction!==void 0),Re(e.jurisdiction)],[i,`ctx.pipelines is used but no "${j}" pipelines binding exists; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding: "${j}", stream }) — codegen resolves this one name, and the pipeline resource can't be auto-provisioned.`],[m.length>0,`ctx.artifacts is used and ${m.map(d=>`"${d}"`).join(", ")} ${m.length===1?"is":"are"} bound, but none is named "${R}"; make sure \`.artifacts()\` on defineApp points ctx.artifacts at it — otherwise it reads env.${R} and throws.`],[o,`lunora/flags.ts uses Flagship in binding mode but no flagship binding "${e.flagshipBinding??""}" exists; add a flagship entry ({ binding: "${e.flagshipBinding??""}", app_id }) — the app_id can't be auto-provisioned.`]].filter(([d])=>d).map(([,d])=>d)},De=e=>[[e.usesX402Charge,"@lunora/x402/charge is used; set the recipient wallet address as a [vars] entry (the var name is your choice) and pass it to the charge config — the x402 facilitator settles USDC to that address."],[e.usesX402,"@lunora/x402/pay is used (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding holding the agent wallet key (binding name == signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars."]].filter(([s])=>s).map(([,s])=>s),q=(e,n,s)=>s.filter(t=>!t.exported).map(t=>`${e} "${t.exportName}" is declared but ${t.className} is not exported by the worker entry; add \`export * from "./lunora/_generated/${n}"\` so its binding can be provisioned.`),Pe=(e,n)=>{const s=new Set([...e.workflows,...e.agents].map(i=>i.className));if(s.size===0)return[];const t=Object.entries(n.exports??{}).flatMap(([i,a])=>a?.type==="workflow"?[i]:[]),o=(n.workflows??[]).flatMap(i=>i.class_name===void 0||i.script_name!==void 0?[]:[i.class_name]);return[...new Set([...t,...o])].filter(i=>!s.has(i)).map(i=>`wrangler.jsonc declares workflow "${i}" but no defineWorkflow/defineAgent export generates that class — a leftover from a rename will fail the deploy (wrangler rejects a class the worker does not export). Remove it if it is not hand-wired.`)},Be=(e,n)=>{if(e.queues.length===0)return[];const s=new Set(e.queues.map(o=>o.name)),t=new Set(e.queues.map(o=>o.bindingName));return[...(n.queues?.consumers??[]).flatMap(o=>{const{queue:i}=o;return i===void 0||s.has(i)?[]:[`wrangler.jsonc subscribes queues.consumers[] to "${i}" but no defineQueue export declares that queue — a leftover from a rename keeps delivering batches this worker has no handler for (they retry to exhaustion, then drop or dead-letter). Remove it if it is not hand-wired.`]}),...(n.queues?.producers??[]).flatMap(o=>{const i=o?.binding;return i===void 0||t.has(i)?[]:[`wrangler.jsonc declares queues.producers[] binding "${i}" but no defineQueue export declares it — a leftover from a rename. Remove it if it is not hand-wired.`]})]},Le=(e,n)=>[...Pe(e,n),...Be(e,n)],X=[{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"}],We=()=>X.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),Me=e=>{let n;try{n=ee(Q(e,pe),"utf8")}catch{return!1}const s=new Map(fe(n).map(t=>[t.key,t.value]));return X.some(({keys:t})=>t.every(o=>(s.get(o)??"")!==""))},Ke=(e,n)=>{const s=n?.secrets?.required;if(!Array.isArray(s))return[];const t=new Set(s),o=he(be(e)).map(i=>i.key).filter(i=>!t.has(i));return o.length===0?[]:[`wrangler.jsonc declares secrets.required without ${o.join(", ")}, which this app needs — wrangler dev loads only the listed keys from .dev.vars, so add ${o.length===1?"it":"them"} to secrets.required.`]},D=(e,n,s,t)=>{const o=new Set(e.durableObjects.map(u=>u.className)),i=[],a=(s?.r2_buckets?.length??0)>0,m=(s?.d1_databases?.some(u=>u.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!a&&i.push("@lunora/storage is used but R2 bucket bindings have user-defined names; add an r2_buckets entry and pass env.<BINDING> to createStorage()."),e.usesAuth&&!o.has("SessionDO")&&!m&&i.push("@lunora/auth is used but the worker entry exports no SessionDO; sessions are D1-backed, or export SessionDO to enable DO-backed sessions."),e.usesScheduler&&!o.has("SchedulerDO")&&i.push("@lunora/scheduler is used but the worker entry exports no SchedulerDO; export it so the SCHEDULER binding can be provisioned."),i.push(...q("container","containers",e.containers),...q("workflow","workflows",e.workflows),...q("agent","agents",e.agents)),e.containers.length>0&&s?.observability?.enabled===!1&&i.push("containers are declared but observability is explicitly disabled in wrangler.jsonc — container logs will not be captured."),e.usesPayments&&!Me(n)&&i.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${We()}.`),i.push(...De(e),...qe(e,s,t),...Ke(e,s)),s!==void 0&&i.push(...Le(e,s)),i},Fe=e=>[["container","containers",e.containers],["workflow","workflows",e.workflows],["agent","agents",e.agents]].flatMap(([s,t,o])=>o.filter(i=>!i.exported).map(({className:i,exportName:a})=>({className:i,exportName:a,kind:s,module:t}))),He=e=>{const n=new Set(P(e).map(t=>t.tag));let s=1;for(;n.has(`v${String(s)}`);)s+=1;return`v${String(s)}`},Ye=e=>{const n=new Set;for(const s of P(e)){for(const t of I(s.deleted_classes))n.delete(t);for(const{from:t,to:o}of P(s.renamed_classes))t!==void 0&&n.delete(t),o!==void 0&&n.add(o);for(const t of[...I(s.new_classes),...I(s.new_sqlite_classes)])n.add(t)}return n},Ve=(e,n,s)=>{const t=n.durable_objects?.bindings??[],o=new Set(t.map(c=>c.name)),i=s.filter(c=>!o.has(c.binding));let a=e;const m=[];if(i.length>0){const c=[...t,...i.map(p=>({class_name:p.className,name:p.binding}))];a=w(a,["durable_objects","bindings"],c),m.push(...i.map(p=>`${p.binding}/${p.className}`))}const u=n.migrations??[],d=s.map(c=>c.className).filter(c=>!Ye(u).has(c));if(d.length>0){const c=[...u,{new_sqlite_classes:d,tag:He(u)}];a=w(a,["migrations"],c)}return{added:m,text:a}},M=e=>e===void 0||e==="cloudflare",Qe=(e,n)=>e.includes("DB (D1)")&&M(n)?[`wrote a DB binding with a placeholder database_id ("${U}") — run \`wrangler d1 create <name>\` and replace it before deploying.`]:[],Ue=(e,n)=>{const s=n.d1_databases??[];if(s.some(i=>i.binding==="DB"))return{added:[],text:e};const t=typeof n.name=="string"&&n.name.length>0?n.name:"lunora",o=[...s,{binding:"DB",database_id:U,database_name:t}];return{added:["DB (D1)"],text:w(e,["d1_databases"],o)}},Ge={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)"}},Je=(e,n)=>e.usesAnalyticsSql&&ye(n,new Set(["analyticsSql"]))?.chained.has("analyticsSql")!==!0,Xe=new Set(["ratelimits","send_email"]),ze=["durable_objects","logfwdr","unsafe"],Ze=new Set(["data_blobs","text_blobs","vars","wasm_modules"]),K=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),W=(e,n,s)=>K(e)&&e[n]===s,en=(e,n,s)=>{if(Ze.has(e))return K(n)&&Object.hasOwn(n,s);const t=Xe.has(e)?"name":"binding";return Array.isArray(n)?n.some(o=>W(o,t,s)):W(n,"binding",s)},$=(e,n)=>{const s=e,t=Object.entries(s).find(([i,a])=>i!=="env"&&en(i,a,n));if(t!==void 0)return t[0];for(const i of ze){const a=s[i];if(K(a)&&Array.isArray(a.bindings)&&a.bindings.some(m=>W(m,"name",n)))return`${i}.bindings`}if(e.queues?.producers?.some(i=>i?.binding===n)===!0)return"queues.producers";const o=e.secrets?.required;if(Array.isArray(o)&&o.includes(n))return"secrets.required"},k=(e,n,s)=>{const{binding:t,label:o}=Ge[s],i=n[s]?.binding;if(typeof i=="string"&&i.length>0)return{added:[],text:e};const a=$(n,t);return a!==void 0?{added:[],text:e,warnings:[`${s}: not adding the ${o} binding — the name "${t}" is already bound by \`${a}\` in wrangler.jsonc. Rename that binding, then set ${s}.binding by hand.`]}:{added:[o],text:w(e,[s],{binding:t})}},F=(e,n,s)=>`${e}: not adding "${n}" — the name is already bound by \`${s}\` in wrangler.jsonc. Add a ${e} entry under another binding name and point the matching \`defineApp()\` override at it.`,nn=(e,n,s)=>{if(!M(s)||(n.hyperdrive?.length??0)>0)return{added:[],text:e};const t=$(n,"HYPERDRIVE");return t!==void 0?{added:[],text:e,warnings:[F("hyperdrive","HYPERDRIVE",t)]}:{added:["HYPERDRIVE (Hyperdrive, created on deploy)"],text:w(e,["hyperdrive"],[{binding:"HYPERDRIVE",id:re}])}},sn=new Set(["celld","cloudflare"]),tn=(e,n,s,t)=>{if(t!==void 0&&!sn.has(t)||s!==void 0||(n.kv_namespaces?.length??0)>0)return{added:[],text:e};const o=$(n,"KV");return o!==void 0?{added:[],text:e,warnings:[F("kv_namespaces","KV",o)]}:{added:[t==="celld"?`KV (Workers KV, celld namespace ${oe(n.name,"KV")})`:"KV (Workers KV, created on deploy)"],text:w(e,["kv_namespaces"],[{binding:"KV"}])}},on=(e,n,s,t)=>{if(!M(t)||s!==void 0||(n.artifacts?.length??0)>0)return{added:[],text:e};const o=$(n,"ARTIFACTS");if(o!==void 0)return{added:[],text:e,warnings:[F("artifacts","ARTIFACTS",o)]};const i=typeof n.name=="string"&&n.name.length>0?n.name:"lunora";return{added:["ARTIFACTS (Cloudflare Artifacts)"],text:w(e,["artifacts"],[{binding:"ARTIFACTS",namespace:i}])}},V=(e,n,s,t,o)=>{if((n[s]?.length??0)>0)return{added:[],text:e};const i=$(n,t.binding);return i!==void 0?{added:[],text:e,warnings:[`${s}: not adding ${JSON.stringify(t)} — the name "${t.binding}" is already bound by \`${i}\` in wrangler.jsonc. Add a ${s} entry under another binding name and point the matching \`defineApp()\` override at it.`]}:{added:[o],text:w(e,[s],[t])}},an=(e,n)=>{const s=n.worker_loaders??[];return s.some(t=>t.binding==="LOADER")?{added:[],text:e}:{added:["LOADER (Worker Loader)"],text:w(e,["worker_loaders"],[...s,{binding:"LOADER"}])}},rn=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},dn=e=>{const{image:n}=e;return n.kind==="dockerfile"?n.dockerfilePath:n.kind==="registry"?n.reference:te(e.exportName)},z=e=>{const n={};for(const[s,t]of Object.entries(e.images??{}))n[s]=t.kind==="registry"?{image:t.reference}:{build_context:t.buildContext,dockerfile:t.dockerfilePath,...e.buildArgs===void 0?{}:{build_vars:e.buildArgs}};return{class_name:e.className,scheduling_policy:"durable_object",...Object.keys(n).length>0?{images:n}:{},...e.name===void 0?{}:{name:e.name}}},cn=e=>{if(e.schedulingPolicy==="durable_object")return z(e);const{image:n}=e,s={class_name:e.className,image:dn(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=rn(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},ln=(e,n,s)=>{const t=n.containers??[],o=new Set(t.map(d=>d.class_name)),i=s.filter(d=>!o.has(d.className));let a=i.length===0?e:w(e,["containers"],[...t,...i.map(d=>cn(d))]);const m=[],u=[];for(const[d,c]of t.entries()){const p=s.find(g=>g.className===c.class_name);if(p===void 0)continue;const l=p.schedulingPolicy??"default";if((c.scheduling_policy??"default")!==l){u.push(`containers/${p.className} has scheduling_policy "${c.scheduling_policy??"default"}" in wrangler.jsonc but defineContainer "${p.exportName}" declares "${l}" — the policy is immutable, so replace the entry (and its container application) by hand.`);continue}const v=p.schedulingPolicy==="durable_object"?z(p).images:void 0;v!==void 0&&JSON.stringify(c.images)!==JSON.stringify(v)&&(a=w(a,["containers",d,"images"],v),m.push(`containers/${p.className}.images`))}return{added:i.map(d=>`containers/${d.className}`),text:a,updated:m,warnings:u}},un=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=w(e,["observability"],{...Se});return{added:["observability"],text:s}},gn=(e,n)=>n.upload_source_maps!==void 0?{added:[],text:e}:{added:["upload_source_maps"],text:w(e,["upload_source_maps"],!0)},Z=[{minimum:[4,142],name:"wrangler"},{minimum:[1,61],name:"@cloudflare/vite-plugin"}],mn=Z.map(({minimum:e,name:n})=>`${n}@^${e.join(".")}.0`).join(" "),pn=(e,n)=>{try{const s=se(Q(e,"package.json")).resolve(`${n}/package.json`),[t=0,o=0]=String(ie(s).version).split(".").map(Number);return[t,o]}catch{return}},fn=e=>{const n=Z.flatMap(({minimum:s,name:t})=>{const o=pn(e,t);return o!==void 0&&(o[0]<s[0]||o[0]===s[0]&&o[1]<s[1])?[`${t} ${o.join(".")} (needs >= ${s.join(".")})`]:[]});return n.length===0?void 0:`workflows are declared in wrangler \`exports\`, which ${n.join(" and ")} cannot run — reconcile left workflows[] untouched. Upgrade (\`pnpm add -D ${mn}\`) and re-run.`},bn=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.`]:[]),hn=(e,n,s)=>{let t=e;const o=[],i=[];for(const a of s){const m=n[a.className];if(m?.type==="workflow")for(const{of:u,path:d}of _e){const c=u(a),p=G(m,d),l=`exports/${a.className}.${d.join(".")}`;if(c===void 0){p!==void 0&&i.push(`${l} is set in wrangler.jsonc but defineWorkflow "${a.exportName}" does not declare it — reconcile leaves it in place. Remove it by hand if it was dropped from the definition.`);continue}JSON.stringify(p)!==JSON.stringify(c)&&(t=w(t,["exports",a.className,...d],c),o.push(l))}}return{text:t,updated:o,warnings:i}},vn=(e,n,s,t,o)=>{if(o!==void 0)return{added:[],text:e,warnings:[o]};const i=[...s.map(b=>({settings:ve(b),workflow:b})),...t.map(b=>({settings:{},workflow:b}))],a=new Set(i.map(({workflow:b})=>b.className)),m=n.workflows??[],u=m.filter(b=>b.script_name===void 0&&b.class_name!==void 0&&a.has(b.class_name)),d=n.exports??{},c=[],p=[],l=[];let v=e;for(const{settings:b,workflow:h}of i){if(d[h.className]!==void 0&&d[h.className]!==null)continue;const _=u.find(f=>f.class_name===h.className),E=Object.fromEntries(we.flatMap(f=>{const y=G(_,[f]);return y===void 0?[]:[[f,y]]})),O=_?.name??h.name;_?.name!==void 0&&_.name!==h.name&&l.push(`workflows/${h.className} is deployed as "${_.name}" but declared as "${h.name}" — its export keeps "${_.name}" so running instances survive. Change the declaration to match, or rename deliberately (it starts a new, empty workflow).`),v=w(v,["exports",h.className],{type:"workflow",...E,...b,name:O}),(_===void 0?c:p).push(`exports/${h.className}`)}if(u.length>0){const b=m.filter(h=>!u.includes(h));v=w(v,["workflows"],b.length===0?void 0:b),p.push(...u.map(h=>`workflows/${String(h.class_name)} → exports`))}l.push(...bn(n));const g=hn(v,d,s);return{added:c,text:g.text,updated:[...p,...g.updated],warnings:[...l,...g.warnings]}},Pn=(e,n,{environment:s,target:t}={})=>{const o=Ee(e),i=Fe(n);if(!o)return{added:[],changed:!1,exportGaps:i,reason:"wrangler.jsonc not found",updated:[],warnings:D(n,e)};const{parsed:a,text:m}=xe(o);if(a===void 0)return{added:[],changed:!1,exportGaps:i,reason:`failed to parse ${o} as JSONC`,updated:[],warnings:D(n,e),wranglerPath:o};const u=D(n,e,a,t);if(s!==void 0){const r=a.env?.[s]!==void 0;u.push(r?`auto-provisioned bindings are written to the top level of wrangler.jsonc only (queue consumers "env.${s}" already declares are retuned, nothing is added) — "env.${s}" has its own (non-inheritable) bindings and must be reconciled by hand; \`lunora deploy --env ${s}\` now validates them, so a gap here will be reported at deploy time.`:`--env "${s}" was requested but wrangler.jsonc declares no "env.${s}" block — auto-provisioned bindings are written to the top level only and will not apply to that environment.`)}const d=n.containers.filter(r=>r.exported),c=n.agents.filter(r=>r.exported&&r.voice===!0&&r.voiceBindingName!==void 0&&r.voiceClassName!==void 0),p=[...n.durableObjects,...d.map(r=>({binding:r.bindingName,className:r.className})),...c.map(r=>({binding:r.voiceBindingName,className:r.voiceClassName}))],l=n.workflows.filter(r=>r.exported),v=n.agents.filter(r=>r.exported),g=Y(e),b=Te(g,u),h={},_=le(g);let E;const O=[{enabled:!0,run:r=>Ve(r,a,p)},{enabled:n.needsD1,run:r=>Ue(r,a)},{enabled:n.usesKv,run:r=>tn(r,a,n.jurisdiction,t)},{enabled:n.usesHyperdrive,run:r=>nn(r,a,t)},{enabled:n.usesArtifacts,run:r=>on(r,a,n.jurisdiction,t)},{enabled:n.usesAi,run:r=>k(r,a,"ai")},{enabled:n.usesAiSearch,run:r=>V(r,a,"ai_search_namespaces",{binding:"AI_SEARCH",namespace:"default"},"AI_SEARCH (AI Search namespace)")},{enabled:Je(n,e),run:r=>k(r,a,"analytics")},{enabled:n.usesBrowser,run:r=>k(r,a,"browser")},{enabled:n.usesImages,run:r=>k(r,a,"images")},{enabled:n.usesAnalytics,run:r=>V(r,a,"analytics_engine_datasets",{binding:"ANALYTICS",dataset:"ANALYTICS"},"ANALYTICS (Analytics Engine)")},{enabled:n.usesWorkerLoader,run:r=>an(r,a)},{enabled:!0,run:r=>un(r,a)},{enabled:t===void 0||t==="cloudflare",run:r=>gn(r,a)},{enabled:d.length>0,run:r=>ln(r,a,d)},{enabled:l.length>0||v.length>0,run:r=>vn(r,a,l,v,fn(e))},{enabled:n.queues.length>0,run:r=>{const S=ke(r,a,n.queues,b.queues??{});return h.queues=S.owned,S}},{enabled:n.services!==void 0&&(n.services.length>0||Object.keys(_).length>0),run:r=>{const S=ue(r,a,n.services??[],_);return E=S.owned,S}},...s===void 0||a.env?.[s]===void 0?[]:[{enabled:n.queues.length>0,run:r=>{const S=`env.${s}.queues`,N=Ce(r,a,n.queues,s,b[S]??{});return h[S]=N.owned,N}}]];let f=m;const y=[],A=[];for(const r of O){if(!r.enabled)continue;const S=r.run(f);f=S.text,y.push(...S.added),A.push(...S.updated??[]),u.push(...S.warnings??[])}const H=r=>{if(g===void 0)return;const S=E,N=[...Object.keys(h).length>0?[{consequence:"an option removed from defineQueue stays deployed",key:"queueTuning",label:"queue tuning",write:x=>{Ie(x,b,h)}}]:[],...S===void 0?[]:[{consequence:"a service removed from lunora.config stays bound",key:"services",label:"service bindings",write:x=>{me(x,S)}}]];for(const x of N)try{x.write(Y(e)??g)}catch(T){u.push(`${r?"wrangler.jsonc was updated, but ":""}recording the ${x.label} reconcile owns in ${g.path} (lunora.${x.key}) failed: ${T instanceof Error?T.message:String(T)}. Until it is recorded, ${x.consequence}.`)}};let C;if(n.services!==void 0){const r=ge(e,n.services,_);u.push(...r.warnings),E={...E,...r.owned},C=r.added.length>0||r.updated.length>0?{added:r.added,path:r.path,updated:r.updated}:void 0}return u.push(...Qe(y,t)),f===m?(H(!1),{added:y,changed:!1,devConfig:C,exportGaps:i,reason:"bindings already in sync",updated:A,warnings:u,wranglerPath:o}):(ne(o,f,"utf8"),H(!0),{added:y,changed:!0,devConfig:C,exportGaps:i,updated:A,warnings:u,wranglerPath:o})};export{Fe as collectExportGaps,Pn as reconcileWranglerBindings};
@@ -302,6 +302,8 @@ interface InferOptions {
302
302
  scanDirs?: ReadonlyArray<string>;
303
303
  /** Lunora source directory holding `schema.ts`. Defaults to `lunora`. */
304
304
  schemaDir?: string;
305
+ /** Leave the `studio.companion` Worker out of the inferred services, for a run that does not deploy it. */
306
+ skipCompanion?: boolean;
305
307
  }
306
308
  /**
307
309
  * Scan a Lunora project and report which Cloudflare bindings its code implies.
@@ -302,6 +302,8 @@ interface InferOptions {
302
302
  scanDirs?: ReadonlyArray<string>;
303
303
  /** Lunora source directory holding `schema.ts`. Defaults to `lunora`. */
304
304
  schemaDir?: string;
305
+ /** Leave the `studio.companion` Worker out of the inferred services, for a run that does not deploy it. */
306
+ skipCompanion?: boolean;
305
307
  }
306
308
  /**
307
309
  * Scan a Lunora project and report which Cloudflare bindings its code implies.
@@ -0,0 +1 @@
1
+ import{statSync as k,readFileSync as Q,existsSync as M,readdirSync as ue}from"node:fs";import{relative as pe,sep as me,isAbsolute as fe,join as x,dirname as j,resolve as ge}from"node:path";import{discoverFlags as he,FLAGS_FILENAME as Se,discoverQueues as xe,CAPABILITY_PROBES as z,COMPANION_BINDING as Z,discoverNotifyChannels as ye,NOTIFY_FILENAME as ve,readBoundServiceBindings as Ee,createTargetScope as be,mayReadCapabilityContext as Ne,sourceCapabilitySignals as Ce,foldCapabilitySignals as Y,capabilitiesUsedBy as Te}from"@lunora/codegen";import{init as Ie}from"es-module-lexer";import{ts as n,Node as m,Project as ee}from"ts-morph";import{discoverAgentInfo as Re}from"./discoverAgentInfo-pqFMJBtJ.mjs";import{discoverContainerInfo as Ae}from"./discoverContainerInfo-DzXr7Vm3.mjs";import{escapeRegExp as Oe}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{d as B}from"./discover-info-DC2MrAIM.mjs";import{P as we}from"./package-secrets-registry-UQ_uEAB_.mjs";import{discoverSchemaInfo as De}from"./discoverSchemaInfo-DRPnqgif.mjs";import{resolveWorkerEntry as _e,composedEntryDurableObjects as Le,GENERATED_DIRECTORY as D,DURABLE_OBJECT_BINDINGS as $e,detectExportedDurableObjects as Pe,detectClassExports as $,isMergedProject as te}from"./COMPOSED_WORKER_ENTRY-BcFt6ts5.mjs";import{discoverWorkflowInfo as je}from"./discoverWorkflowInfo-zW7Tt0Tn.mjs";const Fe=(e,t)=>{const{error:o,value:s}=B(e,t,Se,he);return o===void 0?{flags:s}:{error:o}},se=(e,t)=>{const o=pe(t,e);return o!==""&&o!==".."&&!o.startsWith(`..${me}`)&&!fe(o)},ke=(e,t)=>{const{error:o,value:s}=B(e,t,void 0,xe);return o===void 0?{queues:s??[]}:{error:o,queues:[]}},N="@lunora/replica",S="EventLogDOClient",Me=/\.[cm]?[jt]sx?$/u,U=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"],q=new Map,K=e=>{const{mtimeMs:t}=k(e),o=q.get(e);if(o?.mtimeMs===t)return o.source;const s=n.createSourceFile(e,Q(e,"utf8"),n.ScriptTarget.Latest);return q.set(e,{mtimeMs:t,source:s}),s},H=new WeakMap,Be=e=>{const t=H.get(e);if(t!==void 0&&t[0]?.wasForgotten()!==!0)return t;const o=e.getDescendantsOfKind(n.SyntaxKind.Identifier);return H.set(e,o),o},X=e=>n.sys.fileExists(e)?k(e).mtimeMs:-1,J=new Map,Ke=e=>{const t=n.findConfigFile(j(e),i=>n.sys.fileExists(i));if(t===void 0)return{};const o=J.get(t);if(o!==void 0&&[...o.mtimes].every(([i,c])=>X(i)===c))return o.options;const s=n.readJsonConfigFile(t,i=>n.sys.readFile(i)),{options:r}=n.parseJsonSourceFileConfigFileContent(s,n.sys,j(t)),a=new Map([t,...s.extendedSourceFiles??[]].map(i=>[i,X(i)]));return J.set(t,{mtimes:a,options:r}),r},G=(e,t)=>{if(t===N)return;if(!t.startsWith("./")&&!t.startsWith("../")){const a={moduleResolution:n.ModuleResolutionKind.Bundler,...Ke(e)},i=n.resolveModuleName(t,e,a,n.sys).resolvedModule;return i?.isExternalLibraryImport===!0?void 0:i?.resolvedFileName}const o=x(j(e),t.replace(Me,"")),s=U.map(a=>`${o}${a}`),r=U.map(a=>x(o,`index${a}`));return[...s,...r].find(a=>M(a))},Ge=e=>{const t=new Map;for(const o of e.statements){if(!n.isImportDeclaration(o)||o.importClause?.phaseModifier===n.SyntaxKind.TypeKeyword||!n.isStringLiteral(o.moduleSpecifier))continue;const s=o.importClause?.namedBindings,r=s!==void 0&&n.isNamedImports(s)?s.elements:[];for(const a of r)a.isTypeOnly||t.set(a.name.text,{module:o.moduleSpecifier.text,name:(a.propertyName??a.name).text})}return t},We=e=>{const t=new Map;for(const o of e.statements){if(!n.isImportDeclaration(o)||o.importClause?.phaseModifier===n.SyntaxKind.TypeKeyword||!n.isStringLiteral(o.moduleSpecifier))continue;const s=o.importClause?.namedBindings;s!==void 0&&n.isNamespaceImport(s)&&t.set(s.name.text,o.moduleSpecifier.text)}return t},_=e=>n.canHaveModifiers(e)&&(n.getModifiers(e)??[]).some(t=>t.kind===n.SyntaxKind.ExportKeyword),Ve=e=>n.isVariableStatement(e)?_(e)?e.declarationList.declarations.flatMap(t=>n.isIdentifier(t.name)?[t.name.text]:[]):[]:(n.isClassDeclaration(e)||n.isFunctionDeclaration(e))&&_(e)?e.name===void 0?[]:[e.name.text]:n.isExportDeclaration(e)&&e.moduleSpecifier===void 0&&!e.isTypeOnly&&e.exportClause!==void 0&&n.isNamedExports(e.exportClause)?e.exportClause.elements.map(t=>t.name.text):[],Ye=e=>new Set(e.statements.flatMap(t=>Ve(t))),Ue=(e,t,o)=>{if(n.isIdentifier(e))return t.get(e.text);if(n.isPropertyAccessExpression(e)&&n.isIdentifier(e.expression)){const s=o.get(e.expression.text);return s===void 0?void 0:{module:s,name:e.name.text}}},qe=(e,t,o)=>_(e)?e.declarationList.declarations.flatMap(s=>{if(!n.isIdentifier(s.name)||s.initializer===void 0)return[];const r=Ue(s.initializer,t,o);return r===void 0?[]:[{exported:s.name.text,module:r.module,name:r.name}]}):[],He=(e,t)=>{const o=e.heritageClauses?.find(r=>r.token===n.SyntaxKind.ExtendsKeyword)?.types[0]?.expression;if(!_(e)||e.name===void 0||o===void 0||!n.isIdentifier(o))return[];const s=t.get(o.text);return s===void 0?[]:[{exported:e.name.text,module:s.module,name:s.name}]},Xe=e=>{const t=Ge(e),o=We(e);return e.statements.flatMap(s=>{if(n.isVariableStatement(s))return qe(s,t,o);if(n.isClassDeclaration(s))return He(s,t);if(!n.isExportDeclaration(s)||s.isTypeOnly)return[];const{exportClause:r,moduleSpecifier:a}=s,i=a!==void 0&&n.isStringLiteral(a)?a.text:void 0;return r===void 0?i===void 0?[]:[{exported:void 0,module:i,name:void 0}]:n.isNamedExports(r)?r.elements.flatMap(c=>{if(c.isTypeOnly)return[];const d=c.name.text,l=(c.propertyName??c.name).text;if(i!==void 0)return[{exported:d,module:i,name:l}];const u=t.get(l);return u===void 0?[]:[{exported:d,module:u.module,name:u.name}]}):[]})},W=(e,t,o,s,r=new Set)=>{const a=JSON.stringify([e,o,[...r]]);if(s.has(a))return!1;s.add(a);const i=K(e),c=Xe(i),d=new Set([...r,...Ye(i),...c.flatMap(l=>l.exported===void 0?[]:[l.exported])]);return c.some(l=>{if(o!==void 0&&l.exported!==void 0&&l.exported!==o||l.exported!==void 0&&r.has(l.exported))return!1;if(l.exported===void 0){const g=o??(l.module===N?t:void 0);if(g!==void 0&&d.has(g))return!1}const u=l.exported===void 0?o:l.name;if(l.module===N)return u===void 0||u===t;const E=G(e,l.module);return E!==void 0&&W(E,t,u,s,l.exported===void 0?d:r)})},F=(e,t)=>Be(e).some(o=>{const s=o.getParent();return o.getText()!==t||m.isNamespaceImport(s)||m.isPropertyAccessExpression(s)&&s.getNameNode()===o||m.isQualifiedName(s)&&s.getRight()===o?!1:m.isPropertyAccessExpression(s)?s.getName()===S:m.isQualifiedName(s)?!m.isTypeReference(s.getParent())&&s.getRight().getText()===S:!0}),Je=e=>{const[t]=e.getArguments();return e.getExpression().getKind()===n.SyntaxKind.ImportKeyword&&t!==void 0&&(m.isStringLiteral(t)||m.isNoSubstitutionTemplateLiteral(t))&&t.getLiteralValue()===N},Qe=e=>{const t=e.getPropertyNameNode();if(t===void 0)return e.getNameNode().getText();const o=m.isComputedPropertyName(t)?t.getExpression():t;return m.isStringLiteral(o)||m.isNoSubstitutionTemplateLiteral(o)?o.getLiteralValue():t.getText()},ze=e=>{let t=e,o=!1;for(let r=e.getParent();m.isParenthesizedExpression(r)||m.isAwaitExpression(r);r=t.getParent())o||=m.isAwaitExpression(r),t=r;if(!o)return!0;const s=t.getParent();if(m.isVariableDeclaration(s)){const r=s.getNameNode();return!m.isObjectBindingPattern(r)||r.getElements().some(a=>a.getDotDotDotToken()!==void 0||Qe(a)===S)}return m.isPropertyAccessExpression(s)&&s.getExpression()===t?s.getName()===S:!0},Ze=(e,t)=>K(e).statements.some(o=>n.isExportDeclaration(o)&&o.moduleSpecifier!==void 0&&n.isStringLiteral(o.moduleSpecifier)&&o.moduleSpecifier.text===N&&o.exportClause!==void 0&&n.isNamespaceExport(o.exportClause)&&o.exportClause.name.text===t),et=e=>e.getImportDeclarations().some(t=>{const o=t.getNamespaceImport(),s=t.isTypeOnly()?[]:t.getNamedImports().filter(d=>!d.isTypeOnly()),r=s.some(d=>d.getNameNode().getText()===S),a=s.filter(d=>F(e,(d.getAliasNode()??d.getNameNode()).getText())),i=o!==void 0&&F(e,o.getText());if(!r&&!i&&a.length===0)return!1;const c=G(e.getFilePath(),t.getModuleSpecifierValue());return c===void 0?!1:(r||i)&&W(c,S,S,new Set)||a.some(d=>Ze(c,d.getNameNode().getText()))}),oe=e=>{const t=e.getImportDeclarations().filter(o=>o.getModuleSpecifierValue()===N&&!o.isTypeOnly());return t.some(o=>o.getNamedImports().some(s=>!s.isTypeOnly()&&s.getNameNode().getText()===S))||t.some(o=>{const s=o.getNamespaceImport();return s!==void 0&&F(e,s.getText())})||e.getExportDeclarations().some(o=>o.getModuleSpecifierValue()===N&&!o.isTypeOnly()&&o.getNamedExports().some(s=>!s.isTypeOnly()&&s.getNameNode().getText()===S))||et(e)||e.getDescendantsOfKind(n.SyntaxKind.CallExpression).some(o=>Je(o)&&ze(o))},tt=e=>{const t=[],o=s=>{if(n.isImportDeclaration(s)&&s.importClause?.phaseModifier!==n.SyntaxKind.TypeKeyword&&n.isStringLiteral(s.moduleSpecifier))t.push(s.moduleSpecifier.text);else if(n.isExportDeclaration(s)&&!s.isTypeOnly&&s.moduleSpecifier!==void 0&&n.isStringLiteral(s.moduleSpecifier))t.push(s.moduleSpecifier.text);else if(n.isCallExpression(s)&&s.expression.kind===n.SyntaxKind.ImportKeyword){const[r]=s.arguments;r!==void 0&&(n.isStringLiteral(r)||n.isNoSubstitutionTemplateLiteral(r))&&t.push(r.text)}n.forEachChild(s,o)};return o(e),t},st=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),ot=new Set([".git",".lunora-cache",".wrangler","dist",D,"node_modules"]),rt=["lunora","src"],nt=/\benv\s*\.\s*DB\b/,it=/\benv\s*\.\s*AI\b/,re=["ai","aiSearch","analytics","analyticsSql","artifacts","browser","hyperdrive","images","kv","mail","notify","payments","pipelines","r2sql","scheduler","storage","x402"],ne=e=>`uses${e.charAt(0).toUpperCase()}${e.slice(1)}`,ie=[["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"]],ae=[...re.map(e=>[ne(e),z[e].moduleSpecifier]),...ie].toSorted(([e],[t])=>e.localeCompare(t)),at=[["usesNotifyFcm","@lunora/notify:fcm"],["usesNotifyWebPush","@lunora/notify:webPush"],["hostsShardRegistry","@lunora/do:shardRegistry"],["hostsEventLog","@lunora/replica:eventLog"],["usesEventLogClient","@lunora/replica:eventLogClient"],["usesRequestSecretTool","@lunora/agent:requestSecretTool"]],ct=["@lunora/agent","@lunora/agent/sandbox"],ce=new RegExp(String.raw`["'\x60](?:${[...ae.map(([,e])=>e),...ct,N].map(e=>Oe(e)).join("|")})["'\x60]`,"u"),p=e=>{const{contextProperty:t,moduleSpecifier:o}=z[e];return t===void 0?`${o} is imported`:`${o} is imported or ctx.${t} is read`},dt="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",lt=/\bfrom\s+["']\.{1,2}\//u,de=(e,t)=>{let o;try{o=ue(e,{withFileTypes:!0})}catch{return}for(const s of o){if(s.isDirectory()){ot.has(s.name)||de(x(e,s.name),t);continue}const r=s.name.lastIndexOf(".");r!==-1&&st.has(s.name.slice(r))&&t.push(x(e,s.name))}},ut=(e,t,o)=>{const s=Ee(e,t);return o?{...s,services:s.services.filter(r=>r.binding!==Z)}:s},pt=(e,t,o)=>{const{info:s}=De(e,t,o);return{jurisdiction:s?.jurisdiction,needsD1:s?.hasD1GlobalTable??!1}};let P;const mt=e=>{const t=ge(e);return P?.root!==t&&(P={project:new ee({compilerOptions:{allowJs:!0},skipAddingFilesFromTsConfig:!0}),root:t}),P.project},ft=(e,t,o)=>{e.getSourceFile(t)?.getFullText()!==o&&e.createSourceFile(t,o,{overwrite:!0})},gt=(e,t)=>{for(const o of e.getSourceFiles())t.has(o)||e.removeSourceFile(o)},ht=(e,t,o)=>{const s=x(e,o),r=mt(e),a=[],i=new Set,c=[],d=[],l=be();let u=!1,E=!1;for(const f of t){const h=x(e,f);if(!M(h)||!k(h).isDirectory())continue;const I=[];de(h,I);for(const C of I){i.add(C);const y=Q(C,"utf8"),w=se(C,s);u||=it.test(y),E||=nt.test(y),(ce.test(y)||y.includes(S)||w&&(Ne(y)||lt.test(y)))&&(ft(r,C,y),a.push({file:C,inLunora:w}))}}gt(r,new Set(a.map(({file:f})=>r.getSourceFileOrThrow(f))));for(const{file:f,inLunora:h}of a)(h?c:d).push(Ce(r.getSourceFileOrThrow(f),l));const g=Y(c),T=Y([g,...d]),O=new Set([...T.valueImports,...T.dynamicImports]),b=Te({contextReads:g.contextReads,valueImports:O});return{...Object.fromEntries([...re.map(f=>[ne(f),b.has(f)]),...ie.map(([f,h])=>[f,O.has(h)])]),needsD1:E,usesEventLogClient:a.some(({file:f})=>oe(r.getSourceFileOrThrow(f))),usesRequestSecretTool:g.requestSecretTool,usesAi:b.has("ai")||u,usesBrowser:b.has("browser")||g.sandboxTools.usesSandboxBrowser,usesWorkerLoader:g.sandboxTools.usesSandboxLoader,scannedFiles:i}},St=(e,t,o)=>[...e.map(s=>s.exported?`${s.bindingName}/${s.className} (container "${s.exportName}" declared and exported)`:`hint: container "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...t.map(s=>s.exported?`exports.${s.className} (workflow "${s.exportName}" declared and exported)`:`hint: workflow "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...o.map(s=>s.exported?`exports.${s.className} (agent "${s.exportName}" declared and exported)`:`hint: agent "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],xt=(e,t,o)=>[[e.usesAi,`AI (${p("ai")}, env.AI is used, or an agent is declared)`],[e.usesAuth&&!t.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&&!t.has("SchedulerDO"),`hint: ${p("scheduler")}, but no SchedulerDO is exported by the worker entry`],[e.usesStorage,`hint: ${p("storage")}; add an r2_buckets binding (bucket binding names are user-defined)`],[e.usesMail,`hint: ${p("mail")}; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)`],[e.usesPayments,`hint: ${p("payments")}; set the provider secrets in .dev.vars — ${dt}`],[e.usesBrowser,`browser (${p("browser")}, or a sandbox browserTool imported in lunora/) — self-describing { binding: BROWSER }`],[e.usesImages,`images (${p("images")}) — self-describing { binding: IMAGES }`],[e.usesAnalytics,`analytics_engine_datasets (${p("analytics")}) — self-describing { binding: ANALYTICS, dataset }`],[e.usesWorkerLoader,"worker_loaders (jsCodeTool imported in lunora/) — self-describing { binding: LOADER }"],[e.usesAiSearch,`ai_search_namespaces (${p("aiSearch")}) — self-describing { binding: AI_SEARCH, namespace: "default" }; remote-only, so \`lunora dev\` reaches the deployed AI Search service`],[e.usesAnalyticsSql,`analytics (${p("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,o.jurisdiction===void 0?`kv_namespaces (${p("kv")}) — { binding: KV } with no id; wrangler creates the namespace on the first deploy`:`hint: ${p("kv")} and the schema pins "${o.jurisdiction}"; create the namespace with --jurisdiction ${o.jurisdiction} and add a kv_namespaces binding ({ binding, id })`],[e.usesHyperdrive,`hyperdrive (${p("hyperdrive")}) — { binding: HYPERDRIVE } with a placeholder id; dev uses an embedded Postgres and \`lunora deploy\` creates the config`],[e.usesPipelines,`hint: ${p("pipelines")}; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, stream }) — the pipeline resource can't be auto-provisioned`],[e.usesArtifacts,o.jurisdiction===void 0?`artifacts (${p("artifacts")}) — { binding: ARTIFACTS, namespace }`:`hint: ${p("artifacts")}; the schema pins data to "${o.jurisdiction}", so create the namespace in that jurisdiction first and add { binding: ARTIFACTS, namespace } yourself — \`lunora deploy\` then checks it (a first create() in dev would make it unrestricted)`],[e.usesX402Charge,"hint: @lunora/x402/charge is imported; set the recipient wallet address as a [vars] entry (the var name is yours to choose) and pass it to the charge config — the x402 facilitator settles USDC to that address"],[e.usesX402,`hint: ${p("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(([r])=>r).map(([,r])=>r),yt=(e,t,o,s=[],r=[],a=[])=>{const i=new Set(e.map(d=>d.className)),c=e.map(d=>`${d.binding}/${d.className} (exported by worker entry)`);return t.needsD1&&c.push("DB (.global() table declared)"),c.push(...St(s,r,a),...xt(o,i,t)),c},vt=(e,t)=>e.some(o=>o.binding==="SHARD_REGISTRY")||te(t)&&M(x(t,"shardRegistry.ts")),Et=(e,t,o)=>{const s=new ee({compilerOptions:{allowJs:!0},skipAddingFilesFromTsConfig:!0}),r=[e],a=new Set;for(let i=r.pop();i!==void 0;i=r.pop()){if(a.has(i))continue;a.add(i);const c=K(i),d=c.text;if((ce.test(d)||d.includes(S))&&oe(s.createSourceFile(i,d,{overwrite:!0})))return!0;for(const l of tt(c)){const u=G(i,l);u!==void 0&&!t.has(u)&&!se(u,o)&&r.push(u)}}return!1},bt=e=>!e.composed&&e.path!==void 0&&W(e.path,"EventLogDO",void 0,new Set),jt=async e=>{await Ie;const t=e.schemaDir??"lunora",o=e.scanDirs??rt,s=()=>ht(e.projectRoot,o,t),{scannedFiles:r,...a}=e.cache===void 0?s():e.cache.memo(`capabilities:${e.projectRoot}:${t}:${o.join(",")}`,s),i=_e(e.projectRoot);let c;i.composed?c=Le(x(e.projectRoot,t,D)).map(V=>({binding:$e[V],className:V})):c=i.path===void 0?[]:Pe(i.path);const d=pt(e.projectRoot,t,e.cache),l={...d,needsD1:a.needsD1||d.needsD1},u=$(i,Ae(e.projectRoot,t,e.cache).containers,"containers"),E=$(i,je(e.projectRoot,t).workflows,"workflows"),g=$(i,Re(e.projectRoot,t).agents,"agents"),T={...a,usesAi:a.usesAi||g.length>0},O=[...ke(e.projectRoot,t).queues],{flags:b}=Fe(e.projectRoot,t),L=B(e.projectRoot,t,ve,ye),f=L.error===void 0?L.value:{hasFcm:!0,hasWebPush:!0},h=b?.provider==="flagship"&&b.mode==="binding"?b.bindingName:void 0,I=x(e.projectRoot,t,D),C=vt(c,I),y=bt(i),w=!i.composed&&i.path!==void 0&&Et(i.path,r,I),R=yt(c,l,T,u,E,g);!i.composed&&te(x(e.projectRoot,t,D))&&!c.some(v=>v.className==="LunoraDO")&&R.push("hint: durableObjects.merge is set, but the worker entry exports no LunoraDO — export one built with mergeDurableObjects, or the classes stay separate"),h!==void 0&&R.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${h}", app_id }) — the app_id can't be auto-provisioned`);const A=ut(e.projectRoot,t,e.skipCompanion===!0),le=A.error===void 0?A.services:void 0;return A.error!==void 0&&R.push(`hint: lunora.config \`services\` not reconciled — ${A.error}`),R.push(...A.services.map(v=>v.binding===Z?`${v.binding} → ${v.worker} (studio.companion)`:`${v.binding} → ${v.worker} (lunora.config services.${v.name})`)),{...T,usesEventLogClient:T.usesEventLogClient||w,agents:g,containers:u,durableObjects:c,flagshipBinding:h,...l.jurisdiction===void 0?{}:{jurisdiction:l.jurisdiction},needsD1:l.needsD1,queues:O,services:le,signals:R,usesFlags:b!==void 0,usesNotifyFcm:f?.hasFcm??!1,usesNotifyWebPush:f?.hasWebPush??!1,hostsEventLog:y,hostsShardRegistry:C,workflows:E}},Ft=e=>[...ae,...at].filter(([t,o])=>e[t]&&we[o]!==void 0).map(([,t])=>t);export{jt as inferLunoraBindings,Ft as secretSourcesFromBindings};
@@ -1 +1 @@
1
- import{inferLunoraBindings as g}from"./inferLunoraBindings-CGy-uHu6.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-DQTGPqcJ.mjs";import{reconcileWranglerBindings as $}from"./collectExportGaps-CO1Se31Y.mjs";import{reconcileWranglerCompatibilityDate as p}from"./reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{reconcileWranglerCrons as m,describePreservedCrons as w}from"./describePreservedCrons-Bt2rPPeY.mjs";const j=async(i,t,a)=>{try{const n=await g({cache:i.cache,projectRoot:i.projectRoot,schemaDir:i.schemaDir}),e=$(i.projectRoot,n,{target:i.target}),o=e.wranglerPath??"wrangler.jsonc";if(e.added.length>0&&t.info?.(`${r} inferred bindings → ${e.added.join(", ")} (written to ${o})`),e.updated.length>0&&t.info?.(`${r} updated bindings → ${e.updated.join(", ")} (written to ${o})`),e.devConfig!==void 0){const{added:c,path:d,updated:f}=e.devConfig;t.info?.(`${r} dev sidecar bindings → ${[...c,...f].join(", ")} (written to ${d})`)}for(const c of e.warnings)t.warn(`${r} ${c}`);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}`)}},s=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 c of n.warnings)a.warn(`${r} ${c}`);const e=n.preserved.join("\0"),o=w(n.preserved);o!==void 0&&(n.changed||s.get(i)!==e)&&a.info?.(`${r} ${o}`),s.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=p(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{inferLunoraBindings as g}from"./inferLunoraBindings-whOZv00U.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-DQTGPqcJ.mjs";import{reconcileWranglerBindings as $}from"./collectExportGaps-CTrrntcK.mjs";import{reconcileWranglerCompatibilityDate as p}from"./reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{reconcileWranglerCrons as m,describePreservedCrons as w}from"./describePreservedCrons-Bt2rPPeY.mjs";const j=async(i,t,a)=>{try{const n=await g({cache:i.cache,projectRoot:i.projectRoot,schemaDir:i.schemaDir}),e=$(i.projectRoot,n,{target:i.target}),o=e.wranglerPath??"wrangler.jsonc";if(e.added.length>0&&t.info?.(`${r} inferred bindings → ${e.added.join(", ")} (written to ${o})`),e.updated.length>0&&t.info?.(`${r} updated bindings → ${e.updated.join(", ")} (written to ${o})`),e.devConfig!==void 0){const{added:c,path:d,updated:f}=e.devConfig;t.info?.(`${r} dev sidecar bindings → ${[...c,...f].join(", ")} (written to ${d})`)}for(const c of e.warnings)t.warn(`${r} ${c}`);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}`)}},s=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 c of n.warnings)a.warn(`${r} ${c}`);const e=n.preserved.join("\0"),o=w(n.preserved);o!==void 0&&(n.changed||s.get(i)!==e)&&a.info?.(`${r} ${o}`),s.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=p(i);n.changed&&a.info?.(`${r} bumped compatibility_date to ${n.date??"unknown"} (Workers Cache enabled) → ${n.wranglerPath??"wrangler.jsonc"}`)}catch(n){const e=n instanceof Error?n.message:String(n);a.warn(`${r} compatibility date sync skipped: ${e}`)}};export{j as reconcileBindingsSafely,u as reconcileWranglerExtras};
@@ -0,0 +1,15 @@
1
+ const r=e=>JSON.stringify(e).replaceAll("<",String.raw`\u003c`),_=e=>e.replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;"),i=e=>{const t=[`window.__LUNORA_BASE_PATH__=${r(e.basePath)};`];return e.adminToken!==void 0&&e.adminToken!==""&&t.push(`window.__LUNORA_ADMIN_TOKEN__=${r(e.adminToken)};`),e.dataEditable===!0&&t.push("window.__LUNORA_DATA_EDITABLE__=true;"),e.runAsIdentity===!0&&t.push("window.__LUNORA_RUN_AS_IDENTITY__=true;"),e.schemaEditable===!0&&t.push("window.__LUNORA_SCHEMA_EDITABLE__=true;"),e.advisorProcedures===!0&&t.push("window.__LUNORA_ADVISOR_PROCEDURES__=true;"),e.rulesInstalled===!1&&t.push("window.__LUNORA_RULES_INSTALLED__=false;"),`<!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Lunora Studio</title>
7
+ <script>${t.join("")}<\/script>
8
+ <link rel="stylesheet" href="${_(e.styleHref)}" />
9
+ </head>
10
+ <body>
11
+ <div id="root"></div>
12
+ <script type="module" src="${_(e.scriptSrc)}"><\/script>
13
+ </body>
14
+ </html>
15
+ `};export{i as default};
@@ -0,0 +1 @@
1
+ import{watch as R}from"node:fs";import{createServer as _}from"node:net";import{dirname as C}from"node:path";import{readDevServiceBindings as j}from"@lunora/codegen";import{acceptsConnection as M,startDevProcess as x}from"./acceptsConnection-DHhUYGjT.mjs";import N from"./resolveSchemaDirectory-Ca5P6KuP.mjs";import{p as b,a as O}from"./celld-config-DoBVipuN.mjs";import{probeCelldToolchain as F}from"./probeCelldToolchain-DxDttfHy.mjs";const I=6e4,B=200,G=new Set([".celld",".wrangler","node_modules"]),H=/[/\\]/u,U=async()=>new Promise((e,o)=>{const s=_();s.once("error",o),s.listen(0,"127.0.0.1",()=>{const n=s.address();s.close(()=>{e(typeof n=="object"&&n!==null?n.port:0)})})}),q=e=>e?.split(H).some(o=>G.has(o))===!0,L=(e,o,s)=>{let n;const c=R(e,{recursive:!0},(l,d)=>{q(d)||(clearTimeout(n),n=setTimeout(o,B))}),i=()=>{clearTimeout(n),c.close()};return c.once("error",l=>{i(),s(l)}),{close:i}},W=e=>e instanceof Error?e.message:String(e),D=async()=>F({env:process.env,purpose:"dev"}),rr=async e=>{const o=await(e.probe??D)();if(o.errors.length>0)throw new Error(o.errors.join("; "));return b(e.projectRoot,"dev").write(),o.warnings},er=async e=>{const{log:o,port:s,projectRoot:n}=e,c=(r,t="stdout")=>{o(r,{stream:t,tag:"celld"})},i=await(e.probe??D)();for(const r of i.warnings)c(r,"stderr");if(i.errors.length>0)throw new Error(i.errors.join("; "));if(await M(s))throw new Error(`port ${String(s)} is already in use — stop whatever is serving there (another dev server?), or pick another worker port`);const l=j(n,N(n));if(l.error!==void 0)throw new Error(`could not read the lunora.config services: ${l.error}`);const d=b(n,"dev");d.write();const $=C(d.configPath),m=[...new Map(l.services.map(r=>[r.wranglerPath,r])).values()],p=new AbortController,h=()=>p.signal.aborted,u=async(r,t,a)=>x({args:["dev",r,"--port",String(a)],command:"celld",cwd:n,label:"celld dev",notFound:"`celld` was not found on PATH — install it (https://celld.dev) to run the celld target",onLine:T=>{T.trim()!==""&&o(T,{stream:"stdout",tag:t})},port:a,readyTimeoutMs:I,signal:p.signal,spawn:e.spawn}),y=async r=>{const t=O($,r.wranglerPath);t.write(),c(`registering service ${r.worker} in the local dev state`),await(await u(t.configPath,`celld:${r.worker}`,await U())).stop()};for(const r of m)await y(r);let g=()=>{};const E=new Promise(r=>{g=r}),S=async()=>{const r=await u(d.configPath,"celld",s);return r.crashed.then(g).catch(()=>{}),r};let w=await S();const k=async r=>{await w.stop();let t;try{await y(r)}catch(a){t=a instanceof Error?a:new Error(String(a))}if(!h()){try{w=await S()}catch(a){throw h()||g(1),a}if(t!==void 0)throw t}};let f=Promise.resolve();const A=r=>{c(`service ${r.worker} changed — restarting`),f=f.then(async()=>k(r)).catch(t=>{h()||c(`service ${r.worker} failed to restart: ${W(t)}`,"stderr")})},P=[],v=()=>{for(const r of P)r.close()};try{for(const r of m)P.push(L(C(r.wranglerPath),()=>{A(r)},t=>{c(`stopped watching service ${r.worker}: ${t.message} — restart the dev server to pick up its edits`,"stderr")}))}catch(r){throw v(),await w.stop(),r}return E.then(v).catch(()=>{}),{exited:E,stop:async()=>{p.abort(),v(),await f,await w.stop()}}};export{er as startCelldDevSession,rr as writeCelldDevProjection};
@@ -30,6 +30,54 @@ declare const resolveAdminToken: (root: string) => string | undefined;
30
30
  * edited mid-session instead of embedding the one read at startup.
31
31
  */
32
32
  declare const devVariablesStamp: (root: string) => string;
33
+ /**
34
+ * The host's project configuration, forwarded verbatim to the handler. Separate
35
+ * from `projectRoot` (which every host has) because these two come from the
36
+ * host's own Lunora options.
37
+ */
38
+ interface LocalEndpointContext {
39
+ /** API-spec mode the host runs codegen with, so a studio edit regenerates the same spec files. */
40
+ readonly apiSpec?: CodegenOptions["apiSpec"];
41
+ /** Lazy function mode the host runs codegen with, so a studio edit preserves the generated registry. */
42
+ readonly lazyFunctions?: CodegenOptions["lazyFunctions"];
43
+ /** Override the lunora subdirectory name. Defaults to `"lunora"`. */
44
+ readonly schemaDirectory?: string;
45
+ }
46
+ /** A request adapted from a host transport, passed to a local-dev handler. */
47
+ interface LocalEndpointRequest extends LocalEndpointContext {
48
+ /** Parsed JSON body of the request (`undefined` for `GET` / an empty body). */
49
+ readonly body?: unknown;
50
+ /** HTTP method. */
51
+ readonly method: string;
52
+ /** Project root containing the `lunora/` directory. */
53
+ readonly projectRoot: string;
54
+ }
55
+ /** A response a local-dev handler returns, serialised back as JSON with its status. */
56
+ interface LocalEndpointResponse {
57
+ readonly body: unknown;
58
+ readonly status: number;
59
+ }
60
+ /** A transport-agnostic local-dev handler (schema edit, policy scaffold). */
61
+ type LocalEndpointHandler = (request: LocalEndpointRequest) => LocalEndpointResponse | Promise<LocalEndpointResponse>;
62
+ /**
63
+ * Adapt a `node:http` request/response pair to a transport-agnostic local-dev
64
+ * handler. `GET` carries no body (the schema editor uses it to read the parsed
65
+ * schema); every other method has its body read + JSON-parsed first. The
66
+ * handler's `{ status, body }` is serialised back as JSON. A malformed body is a
67
+ * `400`; an unexpected throw (e.g. the body-size guard) is a `500`.
68
+ *
69
+ * `context` carries the host's own Lunora options through to the handler: its
70
+ * `schemaDirectory` (so a custom `schemaDir` targets the right directory instead
71
+ * of defaulting to `"lunora"`) and its `apiSpec`, so a studio edit regenerates
72
+ * with the same options the host's own codegen run uses.
73
+ */
74
+ declare const serveJsonHandler: (request: IncomingMessage, response: ServerResponse, handle: LocalEndpointHandler, projectRoot: string, context?: LocalEndpointContext) => void;
75
+ /**
76
+ * Endpoint path both dev hosts mount the handler at. Sits under the double-underscore
77
+ * prefix, clear of the CLI's `/_lunora/*` worker proxy.
78
+ */
79
+ declare const ADVISOR_PROCEDURES_ENDPOINT = "/__lunora/advisor-procedures";
80
+ declare const handleAdvisorProceduresRequest: (request: LocalEndpointRequest) => Promise<LocalEndpointResponse>;
33
81
  /**
34
82
  * Send a studio static asset (the stylesheet, the `studio.js` entry, a chunk or
35
83
  * a source map): cache headers and `304` via {@link applyStudioAssetCache}, then
@@ -53,6 +101,13 @@ declare const sendStudioDocument: (response: ServerResponse, body: Buffer | stri
53
101
  interface StudioHtmlConfig {
54
102
  /** Admin token sent with admin requests; omitted (and not injected) when unset. */
55
103
  readonly adminToken?: string;
104
+ /**
105
+ * The host mounts `/__lunora/advisor-procedures`, so the Advisors Health tab can
106
+ * score. Injected as `window.__LUNORA_ADVISOR_PROCEDURES__`. A separate flag from
107
+ * {@link StudioHtmlConfig.schemaEditable}: a host can serve the schema editor
108
+ * without this route, and the tab would then fetch a page that is not there.
109
+ */
110
+ readonly advisorProcedures?: boolean;
56
111
  /** Router basepath the studio mounts under (e.g. `/__lunora`, or `/` for a root server). */
57
112
  readonly basePath: string;
58
113
  /**
@@ -163,48 +218,6 @@ declare const assetContentType: (fileName: string) => string;
163
218
  * change on the next call rather than cached under the newer stamp.
164
219
  */
165
220
  declare const createStudioDocumentCache: <T>(root: string, render: () => T) => (() => T);
166
- /**
167
- * The host's project configuration, forwarded verbatim to the handler. Separate
168
- * from `projectRoot` (which every host has) because these two come from the
169
- * host's own Lunora options.
170
- */
171
- interface LocalEndpointContext {
172
- /** API-spec mode the host runs codegen with, so a studio edit regenerates the same spec files. */
173
- readonly apiSpec?: CodegenOptions["apiSpec"];
174
- /** Lazy function mode the host runs codegen with, so a studio edit preserves the generated registry. */
175
- readonly lazyFunctions?: CodegenOptions["lazyFunctions"];
176
- /** Override the lunora subdirectory name. Defaults to `"lunora"`. */
177
- readonly schemaDirectory?: string;
178
- }
179
- /** A request adapted from a host transport, passed to a local-dev handler. */
180
- interface LocalEndpointRequest extends LocalEndpointContext {
181
- /** Parsed JSON body of the request (`undefined` for `GET` / an empty body). */
182
- readonly body?: unknown;
183
- /** HTTP method. */
184
- readonly method: string;
185
- /** Project root containing the `lunora/` directory. */
186
- readonly projectRoot: string;
187
- }
188
- /** A response a local-dev handler returns, serialised back as JSON with its status. */
189
- interface LocalEndpointResponse {
190
- readonly body: unknown;
191
- readonly status: number;
192
- }
193
- /** A transport-agnostic local-dev handler (schema edit, policy scaffold). */
194
- type LocalEndpointHandler = (request: LocalEndpointRequest) => LocalEndpointResponse | Promise<LocalEndpointResponse>;
195
- /**
196
- * Adapt a `node:http` request/response pair to a transport-agnostic local-dev
197
- * handler. `GET` carries no body (the schema editor uses it to read the parsed
198
- * schema); every other method has its body read + JSON-parsed first. The
199
- * handler's `{ status, body }` is serialised back as JSON. A malformed body is a
200
- * `400`; an unexpected throw (e.g. the body-size guard) is a `500`.
201
- *
202
- * `context` carries the host's own Lunora options through to the handler: its
203
- * `schemaDirectory` (so a custom `schemaDir` targets the right directory instead
204
- * of defaulting to `"lunora"`) and its `apiSpec`, so a studio edit regenerates
205
- * with the same options the host's own codegen run uses.
206
- */
207
- declare const serveJsonHandler: (request: IncomingMessage, response: ServerResponse, handle: LocalEndpointHandler, projectRoot: string, context?: LocalEndpointContext) => void;
208
221
  /** Dev-server path the studio SPA is served from. */
209
222
  declare const STUDIO_PATH = "/__lunora";
210
223
  /** Static asset routes the studio document references. */
@@ -430,7 +443,7 @@ declare const ALLOW_FORWARDED_ENV = "LUNORA_STUDIO_ALLOW_FORWARDED";
430
443
  * the dev server, not just as an opaque 403 in the browser.
431
444
  */
432
445
  declare const transportRejectionReason: (request: IncomingMessage, logger?: WarnLogger) => string | undefined;
433
- export { ALLOW_FORWARDED_ENV, type LocalEndpointContext, type LocalEndpointHandler, type LocalEndpointRequest, type LocalEndpointResponse, POLICY_SCAFFOLD_ENDPOINT, type PolicyScaffoldBody, type PolicyScaffoldRequest, type PolicyScaffoldResponse, SCHEMA_EDIT_ENDPOINT, SEED_ENDPOINT, STUDIO_PATH, STUDIO_SCRIPT_PATH, STUDIO_STYLE_PATH, STUDIO_WRITE_TEMP_SUFFIX, type SchemaEditRequest, type SchemaEditResponse, type SeedRequest, type SeedRequestBody, type SeedResponse, type StudioAssets, type StudioHtmlConfig, type StudioMiddlewareOptions, type WarnLogger, type WirePolicyEdit, assetContentType, consumeStudioWrite, createStudioDocumentCache, createStudioMiddleware,
446
+ export { ADVISOR_PROCEDURES_ENDPOINT, ALLOW_FORWARDED_ENV, type LocalEndpointContext, type LocalEndpointHandler, type LocalEndpointRequest, type LocalEndpointResponse, POLICY_SCAFFOLD_ENDPOINT, type PolicyScaffoldBody, type PolicyScaffoldRequest, type PolicyScaffoldResponse, SCHEMA_EDIT_ENDPOINT, SEED_ENDPOINT, STUDIO_PATH, STUDIO_SCRIPT_PATH, STUDIO_STYLE_PATH, STUDIO_WRITE_TEMP_SUFFIX, type SchemaEditRequest, type SchemaEditResponse, type SeedRequest, type SeedRequestBody, type SeedResponse, type StudioAssets, type StudioHtmlConfig, type StudioMiddlewareOptions, type WarnLogger, type WirePolicyEdit, assetContentType, consumeStudioWrite, createStudioDocumentCache, createStudioMiddleware,
434
447
  /**
435
448
  * `@lunora/config/studio-host` — internal, build-time-shared helpers for hosting
436
449
  * the prebuilt `@lunora/studio` SPA during local dev.
@@ -446,7 +459,7 @@ export { ALLOW_FORWARDED_ENV, type LocalEndpointContext, type LocalEndpointHandl
446
459
  * config injected, resolve the admin token the same way the worker does, gate
447
460
  * the transport, and load the prebuilt asset bytes.
448
461
  */
449
- devVariablesStamp, handlePolicyScaffoldRequest, handleSchemaEditRequest, handleSeedRequest, headerValue, isLoopbackAddress, isNonLoopbackHost, isStandaloneModulePath, loadStudioAssets,
462
+ devVariablesStamp, handleAdvisorProceduresRequest, handlePolicyScaffoldRequest, handleSchemaEditRequest, handleSeedRequest, headerValue, isLoopbackAddress, isNonLoopbackHost, isStandaloneModulePath, loadStudioAssets,
450
463
  /**
451
464
  * `@lunora/config/studio-host` — internal, build-time-shared helpers for hosting
452
465
  * the prebuilt `@lunora/studio` SPA during local dev.
@@ -30,6 +30,54 @@ declare const resolveAdminToken: (root: string) => string | undefined;
30
30
  * edited mid-session instead of embedding the one read at startup.
31
31
  */
32
32
  declare const devVariablesStamp: (root: string) => string;
33
+ /**
34
+ * The host's project configuration, forwarded verbatim to the handler. Separate
35
+ * from `projectRoot` (which every host has) because these two come from the
36
+ * host's own Lunora options.
37
+ */
38
+ interface LocalEndpointContext {
39
+ /** API-spec mode the host runs codegen with, so a studio edit regenerates the same spec files. */
40
+ readonly apiSpec?: CodegenOptions["apiSpec"];
41
+ /** Lazy function mode the host runs codegen with, so a studio edit preserves the generated registry. */
42
+ readonly lazyFunctions?: CodegenOptions["lazyFunctions"];
43
+ /** Override the lunora subdirectory name. Defaults to `"lunora"`. */
44
+ readonly schemaDirectory?: string;
45
+ }
46
+ /** A request adapted from a host transport, passed to a local-dev handler. */
47
+ interface LocalEndpointRequest extends LocalEndpointContext {
48
+ /** Parsed JSON body of the request (`undefined` for `GET` / an empty body). */
49
+ readonly body?: unknown;
50
+ /** HTTP method. */
51
+ readonly method: string;
52
+ /** Project root containing the `lunora/` directory. */
53
+ readonly projectRoot: string;
54
+ }
55
+ /** A response a local-dev handler returns, serialised back as JSON with its status. */
56
+ interface LocalEndpointResponse {
57
+ readonly body: unknown;
58
+ readonly status: number;
59
+ }
60
+ /** A transport-agnostic local-dev handler (schema edit, policy scaffold). */
61
+ type LocalEndpointHandler = (request: LocalEndpointRequest) => LocalEndpointResponse | Promise<LocalEndpointResponse>;
62
+ /**
63
+ * Adapt a `node:http` request/response pair to a transport-agnostic local-dev
64
+ * handler. `GET` carries no body (the schema editor uses it to read the parsed
65
+ * schema); every other method has its body read + JSON-parsed first. The
66
+ * handler's `{ status, body }` is serialised back as JSON. A malformed body is a
67
+ * `400`; an unexpected throw (e.g. the body-size guard) is a `500`.
68
+ *
69
+ * `context` carries the host's own Lunora options through to the handler: its
70
+ * `schemaDirectory` (so a custom `schemaDir` targets the right directory instead
71
+ * of defaulting to `"lunora"`) and its `apiSpec`, so a studio edit regenerates
72
+ * with the same options the host's own codegen run uses.
73
+ */
74
+ declare const serveJsonHandler: (request: IncomingMessage, response: ServerResponse, handle: LocalEndpointHandler, projectRoot: string, context?: LocalEndpointContext) => void;
75
+ /**
76
+ * Endpoint path both dev hosts mount the handler at. Sits under the double-underscore
77
+ * prefix, clear of the CLI's `/_lunora/*` worker proxy.
78
+ */
79
+ declare const ADVISOR_PROCEDURES_ENDPOINT = "/__lunora/advisor-procedures";
80
+ declare const handleAdvisorProceduresRequest: (request: LocalEndpointRequest) => Promise<LocalEndpointResponse>;
33
81
  /**
34
82
  * Send a studio static asset (the stylesheet, the `studio.js` entry, a chunk or
35
83
  * a source map): cache headers and `304` via {@link applyStudioAssetCache}, then
@@ -53,6 +101,13 @@ declare const sendStudioDocument: (response: ServerResponse, body: Buffer | stri
53
101
  interface StudioHtmlConfig {
54
102
  /** Admin token sent with admin requests; omitted (and not injected) when unset. */
55
103
  readonly adminToken?: string;
104
+ /**
105
+ * The host mounts `/__lunora/advisor-procedures`, so the Advisors Health tab can
106
+ * score. Injected as `window.__LUNORA_ADVISOR_PROCEDURES__`. A separate flag from
107
+ * {@link StudioHtmlConfig.schemaEditable}: a host can serve the schema editor
108
+ * without this route, and the tab would then fetch a page that is not there.
109
+ */
110
+ readonly advisorProcedures?: boolean;
56
111
  /** Router basepath the studio mounts under (e.g. `/__lunora`, or `/` for a root server). */
57
112
  readonly basePath: string;
58
113
  /**
@@ -163,48 +218,6 @@ declare const assetContentType: (fileName: string) => string;
163
218
  * change on the next call rather than cached under the newer stamp.
164
219
  */
165
220
  declare const createStudioDocumentCache: <T>(root: string, render: () => T) => (() => T);
166
- /**
167
- * The host's project configuration, forwarded verbatim to the handler. Separate
168
- * from `projectRoot` (which every host has) because these two come from the
169
- * host's own Lunora options.
170
- */
171
- interface LocalEndpointContext {
172
- /** API-spec mode the host runs codegen with, so a studio edit regenerates the same spec files. */
173
- readonly apiSpec?: CodegenOptions["apiSpec"];
174
- /** Lazy function mode the host runs codegen with, so a studio edit preserves the generated registry. */
175
- readonly lazyFunctions?: CodegenOptions["lazyFunctions"];
176
- /** Override the lunora subdirectory name. Defaults to `"lunora"`. */
177
- readonly schemaDirectory?: string;
178
- }
179
- /** A request adapted from a host transport, passed to a local-dev handler. */
180
- interface LocalEndpointRequest extends LocalEndpointContext {
181
- /** Parsed JSON body of the request (`undefined` for `GET` / an empty body). */
182
- readonly body?: unknown;
183
- /** HTTP method. */
184
- readonly method: string;
185
- /** Project root containing the `lunora/` directory. */
186
- readonly projectRoot: string;
187
- }
188
- /** A response a local-dev handler returns, serialised back as JSON with its status. */
189
- interface LocalEndpointResponse {
190
- readonly body: unknown;
191
- readonly status: number;
192
- }
193
- /** A transport-agnostic local-dev handler (schema edit, policy scaffold). */
194
- type LocalEndpointHandler = (request: LocalEndpointRequest) => LocalEndpointResponse | Promise<LocalEndpointResponse>;
195
- /**
196
- * Adapt a `node:http` request/response pair to a transport-agnostic local-dev
197
- * handler. `GET` carries no body (the schema editor uses it to read the parsed
198
- * schema); every other method has its body read + JSON-parsed first. The
199
- * handler's `{ status, body }` is serialised back as JSON. A malformed body is a
200
- * `400`; an unexpected throw (e.g. the body-size guard) is a `500`.
201
- *
202
- * `context` carries the host's own Lunora options through to the handler: its
203
- * `schemaDirectory` (so a custom `schemaDir` targets the right directory instead
204
- * of defaulting to `"lunora"`) and its `apiSpec`, so a studio edit regenerates
205
- * with the same options the host's own codegen run uses.
206
- */
207
- declare const serveJsonHandler: (request: IncomingMessage, response: ServerResponse, handle: LocalEndpointHandler, projectRoot: string, context?: LocalEndpointContext) => void;
208
221
  /** Dev-server path the studio SPA is served from. */
209
222
  declare const STUDIO_PATH = "/__lunora";
210
223
  /** Static asset routes the studio document references. */
@@ -430,7 +443,7 @@ declare const ALLOW_FORWARDED_ENV = "LUNORA_STUDIO_ALLOW_FORWARDED";
430
443
  * the dev server, not just as an opaque 403 in the browser.
431
444
  */
432
445
  declare const transportRejectionReason: (request: IncomingMessage, logger?: WarnLogger) => string | undefined;
433
- export { ALLOW_FORWARDED_ENV, type LocalEndpointContext, type LocalEndpointHandler, type LocalEndpointRequest, type LocalEndpointResponse, POLICY_SCAFFOLD_ENDPOINT, type PolicyScaffoldBody, type PolicyScaffoldRequest, type PolicyScaffoldResponse, SCHEMA_EDIT_ENDPOINT, SEED_ENDPOINT, STUDIO_PATH, STUDIO_SCRIPT_PATH, STUDIO_STYLE_PATH, STUDIO_WRITE_TEMP_SUFFIX, type SchemaEditRequest, type SchemaEditResponse, type SeedRequest, type SeedRequestBody, type SeedResponse, type StudioAssets, type StudioHtmlConfig, type StudioMiddlewareOptions, type WarnLogger, type WirePolicyEdit, assetContentType, consumeStudioWrite, createStudioDocumentCache, createStudioMiddleware,
446
+ export { ADVISOR_PROCEDURES_ENDPOINT, ALLOW_FORWARDED_ENV, type LocalEndpointContext, type LocalEndpointHandler, type LocalEndpointRequest, type LocalEndpointResponse, POLICY_SCAFFOLD_ENDPOINT, type PolicyScaffoldBody, type PolicyScaffoldRequest, type PolicyScaffoldResponse, SCHEMA_EDIT_ENDPOINT, SEED_ENDPOINT, STUDIO_PATH, STUDIO_SCRIPT_PATH, STUDIO_STYLE_PATH, STUDIO_WRITE_TEMP_SUFFIX, type SchemaEditRequest, type SchemaEditResponse, type SeedRequest, type SeedRequestBody, type SeedResponse, type StudioAssets, type StudioHtmlConfig, type StudioMiddlewareOptions, type WarnLogger, type WirePolicyEdit, assetContentType, consumeStudioWrite, createStudioDocumentCache, createStudioMiddleware,
434
447
  /**
435
448
  * `@lunora/config/studio-host` — internal, build-time-shared helpers for hosting
436
449
  * the prebuilt `@lunora/studio` SPA during local dev.
@@ -446,7 +459,7 @@ export { ALLOW_FORWARDED_ENV, type LocalEndpointContext, type LocalEndpointHandl
446
459
  * config injected, resolve the admin token the same way the worker does, gate
447
460
  * the transport, and load the prebuilt asset bytes.
448
461
  */
449
- devVariablesStamp, handlePolicyScaffoldRequest, handleSchemaEditRequest, handleSeedRequest, headerValue, isLoopbackAddress, isNonLoopbackHost, isStandaloneModulePath, loadStudioAssets,
462
+ devVariablesStamp, handleAdvisorProceduresRequest, handlePolicyScaffoldRequest, handleSchemaEditRequest, handleSeedRequest, headerValue, isLoopbackAddress, isNonLoopbackHost, isStandaloneModulePath, loadStudioAssets,
450
463
  /**
451
464
  * `@lunora/config/studio-host` — internal, build-time-shared helpers for hosting
452
465
  * the prebuilt `@lunora/studio` SPA during local dev.
@@ -1 +1 @@
1
- import{devVariablesStamp as t,parseDevVariable as r,resolveAdminToken as a}from"../packem_shared/devVariablesStamp-Cetr3qFz.mjs";import{sendStudioAsset as d,sendStudioDocument as n}from"../packem_shared/sendStudioAsset-B81Pex91.mjs";import{assetContentType as i,isStandaloneModulePath as m,loadStudioAssets as u,readStandaloneAsset as l,resolveStandaloneDirectory as p,studioAssetsStamp as T}from"../packem_shared/assetContentType-CUb5bpbI.mjs";import{default as D}from"../packem_shared/createStudioDocumentCache-B3Sf1bIl.mjs";import{STUDIO_PATH as c,STUDIO_SCRIPT_PATH as A,STUDIO_STYLE_PATH as E,createStudioMiddleware as P,isNonLoopbackHost as x,requestPathname as I,studioMountPath as O}from"../packem_shared/STUDIO_PATH-B9K66C50.mjs";import{POLICY_SCAFFOLD_ENDPOINT as R,handlePolicyScaffoldRequest as N}from"../packem_shared/POLICY_SCAFFOLD_ENDPOINT-D5PpQPkf.mjs";import{default as L}from"../packem_shared/renderStudioHtml-ByowDtMl.mjs";import{SCHEMA_EDIT_ENDPOINT as v,handleSchemaEditRequest as F}from"../packem_shared/SCHEMA_EDIT_ENDPOINT-CtxWqfDe.mjs";import{SEED_ENDPOINT as U,handleSeedRequest as b}from"../packem_shared/SEED_ENDPOINT-C1fhrehH.mjs";import{serveJsonHandler as V}from"../packem_shared/serveJsonHandler-B8_GE6QC.mjs";import{STUDIO_WRITE_TEMP_SUFFIX as k,consumeStudioWrite as y}from"../packem_shared/STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs";import{ALLOW_FORWARDED_ENV as j,headerValue as w,isLoopbackAddress as J,transportRejectionReason as X}from"../packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs";export{j as ALLOW_FORWARDED_ENV,R as POLICY_SCAFFOLD_ENDPOINT,v as SCHEMA_EDIT_ENDPOINT,U as SEED_ENDPOINT,c as STUDIO_PATH,A as STUDIO_SCRIPT_PATH,E as STUDIO_STYLE_PATH,k as STUDIO_WRITE_TEMP_SUFFIX,i as assetContentType,y as consumeStudioWrite,D as createStudioDocumentCache,P as createStudioMiddleware,t as devVariablesStamp,N as handlePolicyScaffoldRequest,F as handleSchemaEditRequest,b as handleSeedRequest,w as headerValue,J as isLoopbackAddress,x as isNonLoopbackHost,m as isStandaloneModulePath,u as loadStudioAssets,r as parseDevVariable,l as readStandaloneAsset,L as renderStudioHtml,I as requestPathname,a as resolveAdminToken,p as resolveStandaloneDirectory,d as sendStudioAsset,n as sendStudioDocument,V as serveJsonHandler,T as studioAssetsStamp,O as studioMountPath,X as transportRejectionReason};
1
+ import{devVariablesStamp as t,parseDevVariable as r,resolveAdminToken as a}from"../packem_shared/devVariablesStamp-Cetr3qFz.mjs";import{ADVISOR_PROCEDURES_ENDPOINT as d,handleAdvisorProceduresRequest as n}from"../packem_shared/ADVISOR_PROCEDURES_ENDPOINT-BPnqzAgT.mjs";import{sendStudioAsset as u,sendStudioDocument as i}from"../packem_shared/sendStudioAsset-B81Pex91.mjs";import{assetContentType as l,isStandaloneModulePath as p,loadStudioAssets as D,readStandaloneAsset as T,resolveStandaloneDirectory as f,studioAssetsStamp as _}from"../packem_shared/assetContentType-CUb5bpbI.mjs";import{default as P}from"../packem_shared/createStudioDocumentCache-B3Sf1bIl.mjs";import{STUDIO_PATH as c,STUDIO_SCRIPT_PATH as I,STUDIO_STYLE_PATH as O,createStudioMiddleware as x,isNonLoopbackHost as R,requestPathname as h,studioMountPath as N}from"../packem_shared/STUDIO_PATH-DklEpux6.mjs";import{POLICY_SCAFFOLD_ENDPOINT as H,handlePolicyScaffoldRequest as L}from"../packem_shared/POLICY_SCAFFOLD_ENDPOINT-D5PpQPkf.mjs";import{default as U}from"../packem_shared/renderStudioHtml-CRDTNivi.mjs";import{SCHEMA_EDIT_ENDPOINT as F,handleSchemaEditRequest as M}from"../packem_shared/SCHEMA_EDIT_ENDPOINT-CtxWqfDe.mjs";import{SEED_ENDPOINT as b,handleSeedRequest as W}from"../packem_shared/SEED_ENDPOINT-C1fhrehH.mjs";import{serveJsonHandler as y}from"../packem_shared/serveJsonHandler-B8_GE6QC.mjs";import{STUDIO_WRITE_TEMP_SUFFIX as j,consumeStudioWrite as w}from"../packem_shared/STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs";import{ALLOW_FORWARDED_ENV as X,headerValue as g,isLoopbackAddress as z,transportRejectionReason as B}from"../packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs";export{d as ADVISOR_PROCEDURES_ENDPOINT,X as ALLOW_FORWARDED_ENV,H as POLICY_SCAFFOLD_ENDPOINT,F as SCHEMA_EDIT_ENDPOINT,b as SEED_ENDPOINT,c as STUDIO_PATH,I as STUDIO_SCRIPT_PATH,O as STUDIO_STYLE_PATH,j as STUDIO_WRITE_TEMP_SUFFIX,l as assetContentType,w as consumeStudioWrite,P as createStudioDocumentCache,x as createStudioMiddleware,t as devVariablesStamp,n as handleAdvisorProceduresRequest,L as handlePolicyScaffoldRequest,M as handleSchemaEditRequest,W as handleSeedRequest,g as headerValue,z as isLoopbackAddress,R as isNonLoopbackHost,p as isStandaloneModulePath,D as loadStudioAssets,r as parseDevVariable,T as readStandaloneAsset,U as renderStudioHtml,h as requestPathname,a as resolveAdminToken,f as resolveStandaloneDirectory,u as sendStudioAsset,i as sendStudioDocument,y as serveJsonHandler,_ as studioAssetsStamp,N as studioMountPath,B as transportRejectionReason};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/config",
3
- "version": "1.0.0-alpha.453",
3
+ "version": "1.0.0-alpha.455",
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",
@@ -58,7 +58,7 @@
58
58
  "access": "public"
59
59
  },
60
60
  "dependencies": {
61
- "@lunora/codegen": "^1.0.0-alpha.397",
61
+ "@lunora/codegen": "^1.0.0-alpha.398",
62
62
  "@lunora/container": "1.0.0-alpha.108",
63
63
  "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
64
64
  "@lunora/seed": "^1.0.0-alpha.282",
@@ -1 +0,0 @@
1
- const e={"@cloudflare/vite-plugin":"^1.62.5","@cloudflare/workers-types":"^5.20261004.1",wrangler:"^4.147.0"};export{e as default};
@@ -1 +0,0 @@
1
- import{resolveAdminToken as A}from"./devVariablesStamp-Cetr3qFz.mjs";import{sendStudioDocument as D,sendStudioAsset as h}from"./sendStudioAsset-B81Pex91.mjs";import{isStandaloneModulePath as I,studioAssetsStamp as _,loadStudioAssets as N,readStandaloneAsset as O,assetContentType as H}from"./assetContentType-CUb5bpbI.mjs";import C from"./createStudioDocumentCache-B3Sf1bIl.mjs";import{detectAgentRules as E}from"./AGENT_RULES_DIR-Bd6JPtNa.mjs";import{handlePolicyScaffoldRequest as v,POLICY_SCAFFOLD_ENDPOINT as L}from"./POLICY_SCAFFOLD_ENDPOINT-D5PpQPkf.mjs";import R from"./renderStudioHtml-ByowDtMl.mjs";import{handleSchemaEditRequest as b,SCHEMA_EDIT_ENDPOINT as x}from"./SCHEMA_EDIT_ENDPOINT-CtxWqfDe.mjs";import{handleSeedRequest as $,SEED_ENDPOINT as k}from"./SEED_ENDPOINT-C1fhrehH.mjs";import{serveJsonHandler as g}from"./serveJsonHandler-B8_GE6QC.mjs";import{transportRejectionReason as j}from"./ALLOW_FORWARDED_ENV-BUndghJx.mjs";import"./STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs";const r="/__lunora",F=`${r}/studio.js`,m=`${r}/styles.css`,T=/\/$/,M={[L]:v,[x]:b,[k]:$},U=new Set(["127.0.0.1","::1","localhost"]),tt=t=>t!==void 0&&t!==!1&&!U.has(t),p=t=>t===void 0||t==="/"?"":t.replace(T,""),et=t=>`${p(t)}${r}`,w=t=>{try{return new URL(t,"http://localhost").pathname}catch{const d=t.indexOf("?");return d===-1?t:t.slice(0,d)}},ot=t=>{const{logger:d,projectRoot:c}=t,u=p(t.base);let l,S;const y=C(c,()=>R({adminToken:A(c),basePath:r,dataEditable:!0,rulesInstalled:E(c).installed,runAsIdentity:!0,schemaEditable:!0,scriptSrc:F,styleHref:m})),P=(n,o,e)=>{const s=_();if((l===void 0||s!==S)&&(l=N(d),S=s),l===void 0){e.statusCode=501,e.setHeader("Content-Type","text/plain"),e.end("Lunora studio assets not found — install and build @lunora/studio.");return}const a=n===m,i=n.slice(n.lastIndexOf("/")+1);if(a){h(o,e,l.styles,"text/css; charset=utf-8",i,s);return}const f=O(i);if(f===void 0){e.statusCode=404,e.setHeader("Content-Type","text/plain"),e.end("Not found");return}h(o,e,f,H(i),i,s)};return(n,o,e)=>{const s=w(n.url??"").replace(T,""),a=u!==""&&s.startsWith(u)?s.slice(u.length):s;if(a!==r&&!a.startsWith(`${r}/`)){e();return}if(t.isNonLoopbackBind||j(n,d)!==void 0){o.statusCode=403,o.setHeader("Content-Type","text/plain"),o.end("Lunora studio is only available on loopback hosts in dev.");return}const i=M[a];if(i!==void 0){g(n,o,i,c,{apiSpec:t.apiSpec,lazyFunctions:t.lazyFunctions,schemaDirectory:t.schemaDirectory});return}if(a===m||I(a)){P(a,n,o);return}D(o,y())}};export{r as STUDIO_PATH,F as STUDIO_SCRIPT_PATH,m as STUDIO_STYLE_PATH,ot as createStudioMiddleware,tt as isNonLoopbackHost,w as requestPathname,et as studioMountPath};
@@ -1 +0,0 @@
1
- import{statSync as k,readFileSync as Q,existsSync as M,readdirSync as le}from"node:fs";import{relative as ue,sep as pe,isAbsolute as me,join as S,dirname as j,resolve as fe}from"node:path";import{discoverFlags as ge,FLAGS_FILENAME as he,discoverQueues as xe,CAPABILITY_PROBES as z,readServiceBindings as Se,discoverNotifyChannels as ye,NOTIFY_FILENAME as ve,createTargetScope as Ee,mayReadCapabilityContext as be,sourceCapabilitySignals as Ne,foldCapabilitySignals as Y,capabilitiesUsedBy as Ce}from"@lunora/codegen";import{init as Te}from"es-module-lexer";import{ts as n,Node as m,Project as Z}from"ts-morph";import{discoverAgentInfo as Ie}from"./discoverAgentInfo-pqFMJBtJ.mjs";import{discoverContainerInfo as Re}from"./discoverContainerInfo-DzXr7Vm3.mjs";import{escapeRegExp as Ae}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{d as K}from"./discover-info-DC2MrAIM.mjs";import{P as Oe}from"./package-secrets-registry-UQ_uEAB_.mjs";import{discoverSchemaInfo as we}from"./discoverSchemaInfo-DRPnqgif.mjs";import{resolveWorkerEntry as De,composedEntryDurableObjects as _e,GENERATED_DIRECTORY as D,DURABLE_OBJECT_BINDINGS as Le,detectExportedDurableObjects as $e,detectClassExports as $,isMergedProject as ee}from"./COMPOSED_WORKER_ENTRY-BcFt6ts5.mjs";import{discoverWorkflowInfo as Pe}from"./discoverWorkflowInfo-zW7Tt0Tn.mjs";const je=(e,t)=>{const{error:s,value:o}=K(e,t,he,ge);return s===void 0?{flags:o}:{error:s}},te=(e,t)=>{const s=ue(t,e);return s!==""&&s!==".."&&!s.startsWith(`..${pe}`)&&!me(s)},Fe=(e,t)=>{const{error:s,value:o}=K(e,t,void 0,xe);return s===void 0?{queues:o??[]}:{error:s,queues:[]}},b="@lunora/replica",x="EventLogDOClient",ke=/\.[cm]?[jt]sx?$/u,U=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"],q=new Map,B=e=>{const{mtimeMs:t}=k(e),s=q.get(e);if(s?.mtimeMs===t)return s.source;const o=n.createSourceFile(e,Q(e,"utf8"),n.ScriptTarget.Latest);return q.set(e,{mtimeMs:t,source:o}),o},H=new WeakMap,Me=e=>{const t=H.get(e);if(t!==void 0&&t[0]?.wasForgotten()!==!0)return t;const s=e.getDescendantsOfKind(n.SyntaxKind.Identifier);return H.set(e,s),s},X=e=>n.sys.fileExists(e)?k(e).mtimeMs:-1,J=new Map,Ke=e=>{const t=n.findConfigFile(j(e),i=>n.sys.fileExists(i));if(t===void 0)return{};const s=J.get(t);if(s!==void 0&&[...s.mtimes].every(([i,c])=>X(i)===c))return s.options;const o=n.readJsonConfigFile(t,i=>n.sys.readFile(i)),{options:r}=n.parseJsonSourceFileConfigFileContent(o,n.sys,j(t)),a=new Map([t,...o.extendedSourceFiles??[]].map(i=>[i,X(i)]));return J.set(t,{mtimes:a,options:r}),r},G=(e,t)=>{if(t===b)return;if(!t.startsWith("./")&&!t.startsWith("../")){const a={moduleResolution:n.ModuleResolutionKind.Bundler,...Ke(e)},i=n.resolveModuleName(t,e,a,n.sys).resolvedModule;return i?.isExternalLibraryImport===!0?void 0:i?.resolvedFileName}const s=S(j(e),t.replace(ke,"")),o=U.map(a=>`${s}${a}`),r=U.map(a=>S(s,`index${a}`));return[...o,...r].find(a=>M(a))},Be=e=>{const t=new Map;for(const s of e.statements){if(!n.isImportDeclaration(s)||s.importClause?.phaseModifier===n.SyntaxKind.TypeKeyword||!n.isStringLiteral(s.moduleSpecifier))continue;const o=s.importClause?.namedBindings,r=o!==void 0&&n.isNamedImports(o)?o.elements:[];for(const a of r)a.isTypeOnly||t.set(a.name.text,{module:s.moduleSpecifier.text,name:(a.propertyName??a.name).text})}return t},Ge=e=>{const t=new Map;for(const s of e.statements){if(!n.isImportDeclaration(s)||s.importClause?.phaseModifier===n.SyntaxKind.TypeKeyword||!n.isStringLiteral(s.moduleSpecifier))continue;const o=s.importClause?.namedBindings;o!==void 0&&n.isNamespaceImport(o)&&t.set(o.name.text,s.moduleSpecifier.text)}return t},_=e=>n.canHaveModifiers(e)&&(n.getModifiers(e)??[]).some(t=>t.kind===n.SyntaxKind.ExportKeyword),We=e=>n.isVariableStatement(e)?_(e)?e.declarationList.declarations.flatMap(t=>n.isIdentifier(t.name)?[t.name.text]:[]):[]:(n.isClassDeclaration(e)||n.isFunctionDeclaration(e))&&_(e)?e.name===void 0?[]:[e.name.text]:n.isExportDeclaration(e)&&e.moduleSpecifier===void 0&&!e.isTypeOnly&&e.exportClause!==void 0&&n.isNamedExports(e.exportClause)?e.exportClause.elements.map(t=>t.name.text):[],Ve=e=>new Set(e.statements.flatMap(t=>We(t))),Ye=(e,t,s)=>{if(n.isIdentifier(e))return t.get(e.text);if(n.isPropertyAccessExpression(e)&&n.isIdentifier(e.expression)){const o=s.get(e.expression.text);return o===void 0?void 0:{module:o,name:e.name.text}}},Ue=(e,t,s)=>_(e)?e.declarationList.declarations.flatMap(o=>{if(!n.isIdentifier(o.name)||o.initializer===void 0)return[];const r=Ye(o.initializer,t,s);return r===void 0?[]:[{exported:o.name.text,module:r.module,name:r.name}]}):[],qe=(e,t)=>{const s=e.heritageClauses?.find(r=>r.token===n.SyntaxKind.ExtendsKeyword)?.types[0]?.expression;if(!_(e)||e.name===void 0||s===void 0||!n.isIdentifier(s))return[];const o=t.get(s.text);return o===void 0?[]:[{exported:e.name.text,module:o.module,name:o.name}]},He=e=>{const t=Be(e),s=Ge(e);return e.statements.flatMap(o=>{if(n.isVariableStatement(o))return Ue(o,t,s);if(n.isClassDeclaration(o))return qe(o,t);if(!n.isExportDeclaration(o)||o.isTypeOnly)return[];const{exportClause:r,moduleSpecifier:a}=o,i=a!==void 0&&n.isStringLiteral(a)?a.text:void 0;return r===void 0?i===void 0?[]:[{exported:void 0,module:i,name:void 0}]:n.isNamedExports(r)?r.elements.flatMap(c=>{if(c.isTypeOnly)return[];const d=c.name.text,l=(c.propertyName??c.name).text;if(i!==void 0)return[{exported:d,module:i,name:l}];const u=t.get(l);return u===void 0?[]:[{exported:d,module:u.module,name:u.name}]}):[]})},W=(e,t,s,o,r=new Set)=>{const a=JSON.stringify([e,s,[...r]]);if(o.has(a))return!1;o.add(a);const i=B(e),c=He(i),d=new Set([...r,...Ve(i),...c.flatMap(l=>l.exported===void 0?[]:[l.exported])]);return c.some(l=>{if(s!==void 0&&l.exported!==void 0&&l.exported!==s||l.exported!==void 0&&r.has(l.exported))return!1;if(l.exported===void 0){const g=s??(l.module===b?t:void 0);if(g!==void 0&&d.has(g))return!1}const u=l.exported===void 0?s:l.name;if(l.module===b)return u===void 0||u===t;const v=G(e,l.module);return v!==void 0&&W(v,t,u,o,l.exported===void 0?d:r)})},F=(e,t)=>Me(e).some(s=>{const o=s.getParent();return s.getText()!==t||m.isNamespaceImport(o)||m.isPropertyAccessExpression(o)&&o.getNameNode()===s||m.isQualifiedName(o)&&o.getRight()===s?!1:m.isPropertyAccessExpression(o)?o.getName()===x:m.isQualifiedName(o)?!m.isTypeReference(o.getParent())&&o.getRight().getText()===x:!0}),Xe=e=>{const[t]=e.getArguments();return e.getExpression().getKind()===n.SyntaxKind.ImportKeyword&&t!==void 0&&(m.isStringLiteral(t)||m.isNoSubstitutionTemplateLiteral(t))&&t.getLiteralValue()===b},Je=e=>{const t=e.getPropertyNameNode();if(t===void 0)return e.getNameNode().getText();const s=m.isComputedPropertyName(t)?t.getExpression():t;return m.isStringLiteral(s)||m.isNoSubstitutionTemplateLiteral(s)?s.getLiteralValue():t.getText()},Qe=e=>{let t=e,s=!1;for(let r=e.getParent();m.isParenthesizedExpression(r)||m.isAwaitExpression(r);r=t.getParent())s||=m.isAwaitExpression(r),t=r;if(!s)return!0;const o=t.getParent();if(m.isVariableDeclaration(o)){const r=o.getNameNode();return!m.isObjectBindingPattern(r)||r.getElements().some(a=>a.getDotDotDotToken()!==void 0||Je(a)===x)}return m.isPropertyAccessExpression(o)&&o.getExpression()===t?o.getName()===x:!0},ze=(e,t)=>B(e).statements.some(s=>n.isExportDeclaration(s)&&s.moduleSpecifier!==void 0&&n.isStringLiteral(s.moduleSpecifier)&&s.moduleSpecifier.text===b&&s.exportClause!==void 0&&n.isNamespaceExport(s.exportClause)&&s.exportClause.name.text===t),Ze=e=>e.getImportDeclarations().some(t=>{const s=t.getNamespaceImport(),o=t.isTypeOnly()?[]:t.getNamedImports().filter(d=>!d.isTypeOnly()),r=o.some(d=>d.getNameNode().getText()===x),a=o.filter(d=>F(e,(d.getAliasNode()??d.getNameNode()).getText())),i=s!==void 0&&F(e,s.getText());if(!r&&!i&&a.length===0)return!1;const c=G(e.getFilePath(),t.getModuleSpecifierValue());return c===void 0?!1:(r||i)&&W(c,x,x,new Set)||a.some(d=>ze(c,d.getNameNode().getText()))}),se=e=>{const t=e.getImportDeclarations().filter(s=>s.getModuleSpecifierValue()===b&&!s.isTypeOnly());return t.some(s=>s.getNamedImports().some(o=>!o.isTypeOnly()&&o.getNameNode().getText()===x))||t.some(s=>{const o=s.getNamespaceImport();return o!==void 0&&F(e,o.getText())})||e.getExportDeclarations().some(s=>s.getModuleSpecifierValue()===b&&!s.isTypeOnly()&&s.getNamedExports().some(o=>!o.isTypeOnly()&&o.getNameNode().getText()===x))||Ze(e)||e.getDescendantsOfKind(n.SyntaxKind.CallExpression).some(s=>Xe(s)&&Qe(s))},et=e=>{const t=[],s=o=>{if(n.isImportDeclaration(o)&&o.importClause?.phaseModifier!==n.SyntaxKind.TypeKeyword&&n.isStringLiteral(o.moduleSpecifier))t.push(o.moduleSpecifier.text);else if(n.isExportDeclaration(o)&&!o.isTypeOnly&&o.moduleSpecifier!==void 0&&n.isStringLiteral(o.moduleSpecifier))t.push(o.moduleSpecifier.text);else if(n.isCallExpression(o)&&o.expression.kind===n.SyntaxKind.ImportKeyword){const[r]=o.arguments;r!==void 0&&(n.isStringLiteral(r)||n.isNoSubstitutionTemplateLiteral(r))&&t.push(r.text)}n.forEachChild(o,s)};return s(e),t},tt=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),st=new Set([".git",".lunora-cache",".wrangler","dist",D,"node_modules"]),ot=["lunora","src"],rt=/\benv\s*\.\s*DB\b/,nt=/\benv\s*\.\s*AI\b/,oe=["ai","aiSearch","analytics","analyticsSql","artifacts","browser","hyperdrive","images","kv","mail","notify","payments","pipelines","r2sql","scheduler","storage","x402"],re=e=>`uses${e.charAt(0).toUpperCase()}${e.slice(1)}`,ne=[["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"]],ie=[...oe.map(e=>[re(e),z[e].moduleSpecifier]),...ne].toSorted(([e],[t])=>e.localeCompare(t)),it=[["usesNotifyFcm","@lunora/notify:fcm"],["usesNotifyWebPush","@lunora/notify:webPush"],["hostsShardRegistry","@lunora/do:shardRegistry"],["hostsEventLog","@lunora/replica:eventLog"],["usesEventLogClient","@lunora/replica:eventLogClient"],["usesRequestSecretTool","@lunora/agent:requestSecretTool"]],at=["@lunora/agent","@lunora/agent/sandbox"],ae=new RegExp(String.raw`["'\x60](?:${[...ie.map(([,e])=>e),...at,b].map(e=>Ae(e)).join("|")})["'\x60]`,"u"),p=e=>{const{contextProperty:t,moduleSpecifier:s}=z[e];return t===void 0?`${s} is imported`:`${s} is imported or ctx.${t} is read`},ct="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",dt=/\bfrom\s+["']\.{1,2}\//u,ce=(e,t)=>{let s;try{s=le(e,{withFileTypes:!0})}catch{return}for(const o of s){if(o.isDirectory()){st.has(o.name)||ce(S(e,o.name),t);continue}const r=o.name.lastIndexOf(".");r!==-1&&tt.has(o.name.slice(r))&&t.push(S(e,o.name))}},lt=(e,t,s)=>{const{info:o}=we(e,t,s);return{jurisdiction:o?.jurisdiction,needsD1:o?.hasD1GlobalTable??!1}};let P;const ut=e=>{const t=fe(e);return P?.root!==t&&(P={project:new Z({compilerOptions:{allowJs:!0},skipAddingFilesFromTsConfig:!0}),root:t}),P.project},pt=(e,t,s)=>{e.getSourceFile(t)?.getFullText()!==s&&e.createSourceFile(t,s,{overwrite:!0})},mt=(e,t)=>{for(const s of e.getSourceFiles())t.has(s)||e.removeSourceFile(s)},ft=(e,t,s)=>{const o=S(e,s),r=ut(e),a=[],i=new Set,c=[],d=[],l=Ee();let u=!1,v=!1;for(const f of t){const h=S(e,f);if(!M(h)||!k(h).isDirectory())continue;const I=[];ce(h,I);for(const N of I){i.add(N);const y=Q(N,"utf8"),w=te(N,o);u||=nt.test(y),v||=rt.test(y),(ae.test(y)||y.includes(x)||w&&(be(y)||dt.test(y)))&&(pt(r,N,y),a.push({file:N,inLunora:w}))}}mt(r,new Set(a.map(({file:f})=>r.getSourceFileOrThrow(f))));for(const{file:f,inLunora:h}of a)(h?c:d).push(Ne(r.getSourceFileOrThrow(f),l));const g=Y(c),C=Y([g,...d]),O=new Set([...C.valueImports,...C.dynamicImports]),E=Ce({contextReads:g.contextReads,valueImports:O});return{...Object.fromEntries([...oe.map(f=>[re(f),E.has(f)]),...ne.map(([f,h])=>[f,O.has(h)])]),needsD1:v,usesEventLogClient:a.some(({file:f})=>se(r.getSourceFileOrThrow(f))),usesRequestSecretTool:g.requestSecretTool,usesAi:E.has("ai")||u,usesBrowser:E.has("browser")||g.sandboxTools.usesSandboxBrowser,usesWorkerLoader:g.sandboxTools.usesSandboxLoader,scannedFiles:i}},gt=(e,t,s)=>[...e.map(o=>o.exported?`${o.bindingName}/${o.className} (container "${o.exportName}" declared and exported)`:`hint: container "${o.exportName}" is declared but ${o.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...t.map(o=>o.exported?`exports.${o.className} (workflow "${o.exportName}" declared and exported)`:`hint: workflow "${o.exportName}" is declared but ${o.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...s.map(o=>o.exported?`exports.${o.className} (agent "${o.exportName}" declared and exported)`:`hint: agent "${o.exportName}" is declared but ${o.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],ht=(e,t,s)=>[[e.usesAi,`AI (${p("ai")}, env.AI is used, or an agent is declared)`],[e.usesAuth&&!t.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&&!t.has("SchedulerDO"),`hint: ${p("scheduler")}, but no SchedulerDO is exported by the worker entry`],[e.usesStorage,`hint: ${p("storage")}; add an r2_buckets binding (bucket binding names are user-defined)`],[e.usesMail,`hint: ${p("mail")}; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)`],[e.usesPayments,`hint: ${p("payments")}; set the provider secrets in .dev.vars — ${ct}`],[e.usesBrowser,`browser (${p("browser")}, or a sandbox browserTool imported in lunora/) — self-describing { binding: BROWSER }`],[e.usesImages,`images (${p("images")}) — self-describing { binding: IMAGES }`],[e.usesAnalytics,`analytics_engine_datasets (${p("analytics")}) — self-describing { binding: ANALYTICS, dataset }`],[e.usesWorkerLoader,"worker_loaders (jsCodeTool imported in lunora/) — self-describing { binding: LOADER }"],[e.usesAiSearch,`ai_search_namespaces (${p("aiSearch")}) — self-describing { binding: AI_SEARCH, namespace: "default" }; remote-only, so \`lunora dev\` reaches the deployed AI Search service`],[e.usesAnalyticsSql,`analytics (${p("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,s.jurisdiction===void 0?`kv_namespaces (${p("kv")}) — { binding: KV } with no id; wrangler creates the namespace on the first deploy`:`hint: ${p("kv")} and the schema pins "${s.jurisdiction}"; create the namespace with --jurisdiction ${s.jurisdiction} and add a kv_namespaces binding ({ binding, id })`],[e.usesHyperdrive,`hyperdrive (${p("hyperdrive")}) — { binding: HYPERDRIVE } with a placeholder id; dev uses an embedded Postgres and \`lunora deploy\` creates the config`],[e.usesPipelines,`hint: ${p("pipelines")}; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, stream }) — the pipeline resource can't be auto-provisioned`],[e.usesArtifacts,s.jurisdiction===void 0?`artifacts (${p("artifacts")}) — { binding: ARTIFACTS, namespace }`:`hint: ${p("artifacts")}; the schema pins data to "${s.jurisdiction}", so create the namespace in that jurisdiction first and add { binding: ARTIFACTS, namespace } yourself — \`lunora deploy\` then checks it (a first create() in dev would make it unrestricted)`],[e.usesX402Charge,"hint: @lunora/x402/charge is imported; set the recipient wallet address as a [vars] entry (the var name is yours to choose) and pass it to the charge config — the x402 facilitator settles USDC to that address"],[e.usesX402,`hint: ${p("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(([r])=>r).map(([,r])=>r),xt=(e,t,s,o=[],r=[],a=[])=>{const i=new Set(e.map(d=>d.className)),c=e.map(d=>`${d.binding}/${d.className} (exported by worker entry)`);return t.needsD1&&c.push("DB (.global() table declared)"),c.push(...gt(o,r,a),...ht(s,i,t)),c},St=(e,t)=>e.some(s=>s.binding==="SHARD_REGISTRY")||ee(t)&&M(S(t,"shardRegistry.ts")),yt=(e,t,s)=>{const o=new Z({compilerOptions:{allowJs:!0},skipAddingFilesFromTsConfig:!0}),r=[e],a=new Set;for(let i=r.pop();i!==void 0;i=r.pop()){if(a.has(i))continue;a.add(i);const c=B(i),d=c.text;if((ae.test(d)||d.includes(x))&&se(o.createSourceFile(i,d,{overwrite:!0})))return!0;for(const l of et(c)){const u=G(i,l);u!==void 0&&!t.has(u)&&!te(u,s)&&r.push(u)}}return!1},vt=e=>!e.composed&&e.path!==void 0&&W(e.path,"EventLogDO",void 0,new Set),$t=async e=>{await Te;const t=e.schemaDir??"lunora",s=e.scanDirs??ot,o=()=>ft(e.projectRoot,s,t),{scannedFiles:r,...a}=e.cache===void 0?o():e.cache.memo(`capabilities:${e.projectRoot}:${t}:${s.join(",")}`,o),i=De(e.projectRoot);let c;i.composed?c=_e(S(e.projectRoot,t,D)).map(V=>({binding:Le[V],className:V})):c=i.path===void 0?[]:$e(i.path);const d=lt(e.projectRoot,t,e.cache),l={...d,needsD1:a.needsD1||d.needsD1},u=$(i,Re(e.projectRoot,t,e.cache).containers,"containers"),v=$(i,Pe(e.projectRoot,t).workflows,"workflows"),g=$(i,Ie(e.projectRoot,t).agents,"agents"),C={...a,usesAi:a.usesAi||g.length>0},O=[...Fe(e.projectRoot,t).queues],{flags:E}=je(e.projectRoot,t),L=K(e.projectRoot,t,ve,ye),f=L.error===void 0?L.value:{hasFcm:!0,hasWebPush:!0},h=E?.provider==="flagship"&&E.mode==="binding"?E.bindingName:void 0,I=S(e.projectRoot,t,D),N=St(c,I),y=vt(i),w=!i.composed&&i.path!==void 0&&yt(i.path,r,I),R=xt(c,l,C,u,v,g);!i.composed&&ee(S(e.projectRoot,t,D))&&!c.some(T=>T.className==="LunoraDO")&&R.push("hint: durableObjects.merge is set, but the worker entry exports no LunoraDO — export one built with mergeDurableObjects, or the classes stay separate"),h!==void 0&&R.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${h}", app_id }) — the app_id can't be auto-provisioned`);const A=Se(e.projectRoot),de=A.error===void 0?A.services:void 0;return A.error!==void 0&&R.push(`hint: lunora.config \`services\` not reconciled — ${A.error}`),R.push(...A.services.map(T=>`${T.binding} → ${T.worker} (lunora.config services.${T.name})`)),{...C,usesEventLogClient:C.usesEventLogClient||w,agents:g,containers:u,durableObjects:c,flagshipBinding:h,...l.jurisdiction===void 0?{}:{jurisdiction:l.jurisdiction},needsD1:l.needsD1,queues:O,services:de,signals:R,usesFlags:E!==void 0,usesNotifyFcm:f?.hasFcm??!1,usesNotifyWebPush:f?.hasWebPush??!1,hostsEventLog:y,hostsShardRegistry:N,workflows:v}},Pt=e=>[...ie,...it].filter(([t,s])=>e[t]&&Oe[s]!==void 0).map(([,t])=>t);export{$t as inferLunoraBindings,Pt as secretSourcesFromBindings};
@@ -1,15 +0,0 @@
1
- const r=t=>JSON.stringify(t).replaceAll("<",String.raw`\u003c`),i=t=>t.replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;"),_=t=>{const e=[`window.__LUNORA_BASE_PATH__=${r(t.basePath)};`];return t.adminToken!==void 0&&t.adminToken!==""&&e.push(`window.__LUNORA_ADMIN_TOKEN__=${r(t.adminToken)};`),t.dataEditable===!0&&e.push("window.__LUNORA_DATA_EDITABLE__=true;"),t.runAsIdentity===!0&&e.push("window.__LUNORA_RUN_AS_IDENTITY__=true;"),t.schemaEditable===!0&&e.push("window.__LUNORA_SCHEMA_EDITABLE__=true;"),t.rulesInstalled===!1&&e.push("window.__LUNORA_RULES_INSTALLED__=false;"),`<!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Lunora Studio</title>
7
- <script>${e.join("")}<\/script>
8
- <link rel="stylesheet" href="${i(t.styleHref)}" />
9
- </head>
10
- <body>
11
- <div id="root"></div>
12
- <script type="module" src="${i(t.scriptSrc)}"><\/script>
13
- </body>
14
- </html>
15
- `};export{_ as default};
@@ -1 +0,0 @@
1
- import{watch as _}from"node:fs";import{createServer as j}from"node:net";import{dirname as C}from"node:path";import{readServiceBindings as D}from"@lunora/codegen";import{acceptsConnection as M,startDevProcess as x}from"./acceptsConnection-DHhUYGjT.mjs";import{p as b,a as N}from"./celld-config-DoBVipuN.mjs";import{probeCelldToolchain as O}from"./probeCelldToolchain-DxDttfHy.mjs";const F=6e4,I=200,B=new Set([".celld",".wrangler","node_modules"]),G=/[/\\]/u,H=async()=>new Promise((e,o)=>{const s=j();s.once("error",o),s.listen(0,"127.0.0.1",()=>{const n=s.address();s.close(()=>{e(typeof n=="object"&&n!==null?n.port:0)})})}),U=e=>e?.split(G).some(o=>B.has(o))===!0,q=(e,o,s)=>{let n;const c=_(e,{recursive:!0},(l,d)=>{U(d)||(clearTimeout(n),n=setTimeout(o,I))}),i=()=>{clearTimeout(n),c.close()};return c.once("error",l=>{i(),s(l)}),{close:i}},L=e=>e instanceof Error?e.message:String(e),$=async()=>O({env:process.env,purpose:"dev"}),X=async e=>{const o=await(e.probe??$)();if(o.errors.length>0)throw new Error(o.errors.join("; "));return b(e.projectRoot,"dev").write(),o.warnings},Z=async e=>{const{log:o,port:s,projectRoot:n}=e,c=(r,t="stdout")=>{o(r,{stream:t,tag:"celld"})},i=await(e.probe??$)();for(const r of i.warnings)c(r,"stderr");if(i.errors.length>0)throw new Error(i.errors.join("; "));if(await M(s))throw new Error(`port ${String(s)} is already in use — stop whatever is serving there (another dev server?), or pick another worker port`);const l=D(n);if(l.error!==void 0)throw new Error(`could not read the lunora.config services: ${l.error}`);const d=b(n,"dev");d.write();const k=C(d.configPath),v=[...new Map(l.services.map(r=>[r.wranglerPath,r])).values()],p=new AbortController,h=()=>p.signal.aborted,m=async(r,t,a)=>x({args:["dev",r,"--port",String(a)],command:"celld",cwd:n,label:"celld dev",notFound:"`celld` was not found on PATH — install it (https://celld.dev) to run the celld target",onLine:T=>{T.trim()!==""&&o(T,{stream:"stdout",tag:t})},port:a,readyTimeoutMs:F,signal:p.signal,spawn:e.spawn}),E=async r=>{const t=N(k,r.wranglerPath);t.write(),c(`registering service ${r.worker} in the local dev state`),await(await m(t.configPath,`celld:${r.worker}`,await H())).stop()};for(const r of v)await E(r);let g=()=>{};const y=new Promise(r=>{g=r}),S=async()=>{const r=await m(d.configPath,"celld",s);return r.crashed.then(g).catch(()=>{}),r};let w=await S();const A=async r=>{await w.stop();let t;try{await E(r)}catch(a){t=a instanceof Error?a:new Error(String(a))}if(!h()){try{w=await S()}catch(a){throw h()||g(1),a}if(t!==void 0)throw t}};let f=Promise.resolve();const R=r=>{c(`service ${r.worker} changed — restarting`),f=f.then(async()=>A(r)).catch(t=>{h()||c(`service ${r.worker} failed to restart: ${L(t)}`,"stderr")})},P=[],u=()=>{for(const r of P)r.close()};try{for(const r of v)P.push(q(C(r.wranglerPath),()=>{R(r)},t=>{c(`stopped watching service ${r.worker}: ${t.message} — restart the dev server to pick up its edits`,"stderr")}))}catch(r){throw u(),await w.stop(),r}return y.then(u).catch(()=>{}),{exited:y,stop:async()=>{p.abort(),u(),await f,await w.stop()}}};export{Z as startCelldDevSession,X as writeCelldDevProjection};