@lunora/config 1.0.0-alpha.412 → 1.0.0-alpha.414

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/cloudflare/index.d.mts +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 +12 -6
  5. package/dist/index.d.ts +12 -6
  6. package/dist/index.mjs +1 -1
  7. package/dist/packem_shared/{DEV_WORKER_ENV_VALUE-B34mwSpH.mjs → DEV_WORKER_ENV_VALUE-CgozgOxh.mjs} +1 -1
  8. package/dist/packem_shared/{PACKAGE_SECRETS_REGISTRY-Cc-o-5Z9.mjs → PACKAGE_SECRETS_REGISTRY-ByJhGJMf.mjs} +1 -1
  9. package/dist/packem_shared/{POLICY_SCAFFOLD_ENDPOINT-3Rxi46n7.mjs → POLICY_SCAFFOLD_ENDPOINT-D5PpQPkf.mjs} +1 -1
  10. package/dist/packem_shared/{SCHEMA_EDIT_ENDPOINT-CkMPlCce.mjs → SCHEMA_EDIT_ENDPOINT-CtxWqfDe.mjs} +1 -1
  11. package/dist/packem_shared/{STUDIO_PATH-D8Ed88Sq.mjs → STUDIO_PATH-DbOwZDBM.mjs} +1 -1
  12. package/dist/packem_shared/{UNEXPORTED_CLASS_MARKER-q-hZgyZS.mjs → UNEXPORTED_CLASS_MARKER-BV29zhUp.mjs} +1 -1
  13. package/dist/packem_shared/{assertWranglerSatisfiesSchema-Djo-P0T3.mjs → assertWranglerSatisfiesSchema-A2WCMIRa.mjs} +1 -1
  14. package/dist/packem_shared/buildPackageSecretsBlock-GvaLgvFN.mjs +19 -0
  15. package/dist/packem_shared/{collectExportGaps-B6RMmmY0.mjs → collectExportGaps-BqFUht1A.mjs} +1 -1
  16. package/dist/packem_shared/discoverSchemaInfo-DRPnqgif.mjs +1 -0
  17. package/dist/packem_shared/{infer-bindings.d-Cx96nMli.d.mts → infer-bindings.d-BUdWC3tw.d.mts} +4 -0
  18. package/dist/packem_shared/{infer-bindings.d-Cx96nMli.d.ts → infer-bindings.d-BUdWC3tw.d.ts} +4 -0
  19. package/dist/packem_shared/inferLunoraBindings-CzSFTzZh.mjs +1 -0
  20. package/dist/packem_shared/package-secrets-registry-UQ_uEAB_.mjs +1 -0
  21. package/dist/packem_shared/{reconcileBindingsSafely-DxwVYw90.mjs → reconcileBindingsSafely-BBr-MDCV.mjs} +1 -1
  22. package/dist/packem_shared/{scanWranglerVariablesForSecrets--xUsy1Lq.mjs → scanWranglerVariablesForSecrets-DRBYlMYb.mjs} +1 -1
  23. package/dist/packem_shared/{wranglerCodegenInputs-C02zHFYw.mjs → wranglerCodegenInputs-BZamZrPz.mjs} +1 -1
  24. package/dist/packem_shared/{write-atomic-C_Bu-bIv.mjs → write-atomic-DRRKWKF-.mjs} +1 -1
  25. package/dist/studio-host/index.mjs +1 -1
  26. package/package.json +2 -2
  27. package/dist/packem_shared/buildPackageSecretsBlock-DhsxZhTy.mjs +0 -19
  28. package/dist/packem_shared/discoverSchemaInfo-BBRlXZop.mjs +0 -1
  29. package/dist/packem_shared/inferLunoraBindings-B0-cxqXJ.mjs +0 -1
  30. package/dist/packem_shared/package-secrets-registry-CkRQL24p.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-Cx96nMli.mjs";
2
- export { H as HYPERDRIVE_PLACEHOLDER_ID } from "../packem_shared/infer-bindings.d-Cx96nMli.mjs";
1
+ import { D as DiscoveryCache, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-BUdWC3tw.mjs";
2
+ export { H as HYPERDRIVE_PLACEHOLDER_ID } from "../packem_shared/infer-bindings.d-BUdWC3tw.mjs";
3
3
  import { D as DeployDriver } from "../packem_shared/deploy-driver.d-DraUd2R2.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-Cx96nMli.js";
2
- export { H as HYPERDRIVE_PLACEHOLDER_ID } from "../packem_shared/infer-bindings.d-Cx96nMli.js";
1
+ import { D as DiscoveryCache, G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-BUdWC3tw.js";
2
+ export { H as HYPERDRIVE_PLACEHOLDER_ID } from "../packem_shared/infer-bindings.d-BUdWC3tw.js";
3
3
  import { D as DeployDriver } from "../packem_shared/deploy-driver.d-DraUd2R2.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-Djo-P0T3.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-CULavrYO.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 c,withheldBindings as I}from"../packem_shared/describeWithheld-CbyzZjZF.mjs";import{bindingsNeedingDatabase as A,startLocalHyperdrive as D}from"../packem_shared/bindingsNeedingDatabase-6eD6Qtqf.mjs";import{HYPERDRIVE_PLACEHOLDER_ID as S}from"../packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{collectExportGaps as T,reconcileWranglerBindings as N}from"../packem_shared/collectExportGaps-B6RMmmY0.mjs";import{reconcileWranglerCompatibilityDate as F}from"../packem_shared/reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{describePreservedCrons as B,reconcileWranglerCrons as h}from"../packem_shared/describePreservedCrons-C5KPuPy3.mjs";import{reconcileBindingsSafely as G,reconcileWranglerExtras as U}from"../packem_shared/reconcileBindingsSafely-DxwVYw90.mjs";import{REMOTE_ELIGIBLE_KEYS as M,injectRemoteFlags as P,isRemoteEnvEnabled as V,materializeDevWranglerConfig as H,planRemoteBindings as w,resolveRemoteEnabled as Y}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-CuhB99R2.mjs";import{materializeServiceDevConfigs as j}from"../packem_shared/materializeServiceDevConfigs-qUY4_iu1.mjs";import{default as Q}from"../packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DV5E_f_q.mjs";import{withTailConsumer as X}from"../packem_shared/withTailConsumer-CF3pk_Ov.mjs";import{WORKERS_CACHE_MIN_DATE as q,isCacheEnabled as Z}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{wranglerCodegenInputs as ee}from"../packem_shared/wranglerCodegenInputs-C02zHFYw.mjs";import{DEFAULT_OBSERVABILITY as oe,resolveObservabilitySampling as ae}from"../packem_shared/DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import{mergeWranglerEnvironment as ne}from"../packem_shared/mergeWranglerEnvironment-D5ekKj5x.mjs";import{WRANGLER_FILES as le,findWranglerFile as fe,readWranglerJsonc as me}from"../packem_shared/WRANGLER_FILES-UNW-xY5u.mjs";import{UNEXPORTED_CLASS_MARKER as se,validateWranglerProject as pe}from"../packem_shared/UNEXPORTED_CLASS_MARKER-q-hZgyZS.mjs";import{scanWranglerVariablesForSecrets as ge}from"../packem_shared/scanWranglerVariablesForSecrets--xUsy1Lq.mjs";import{wranglerToAlchemy as xe}from"../packem_shared/wranglerToAlchemy-CBO2ucRm.mjs";import{REQUIRED_COMPATIBILITY_DATE as _e,REQUIRED_FLAG as ce,validateWrangler as Ie,validateWranglerConfig as Le}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-D4UcOP_t.mjs";export{i as BINDING_MANIFEST_VERSION,m as CLOUDFLARE_CLI_CONFIG_WARNING_ENV,d as CLOUDFLARE_DRIVER,Q as CLOUDFLARE_TOOLCHAIN_VERSIONS,oe as DEFAULT_OBSERVABILITY,C as GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG,S as HYPERDRIVE_PLACEHOLDER_ID,M as REMOTE_ELIGIBLE_KEYS,_e as REQUIRED_COMPATIBILITY_DATE,ce as REQUIRED_FLAG,se as UNEXPORTED_CLASS_MARKER,q as WORKERS_CACHE_MIN_DATE,le as WRANGLER_FILES,o as applyModify,t as assertWranglerSatisfiesSchema,A as bindingsNeedingDatabase,l as buildBindingManifest,T as collectExportGaps,B as describePreservedCrons,c as describeWithheld,E as detectCloudflareCliConfig,fe as findWranglerFile,R as hasCloudflareCredentials,P as injectRemoteFlags,Z as isCacheEnabled,V as isRemoteEnvEnabled,H as materializeDevWranglerConfig,j as materializeServiceDevConfigs,ne as mergeWranglerEnvironment,w as planRemoteBindings,me as readWranglerJsonc,G as reconcileBindingsSafely,N as reconcileWranglerBindings,F as reconcileWranglerCompatibilityDate,h as reconcileWranglerCrons,U as reconcileWranglerExtras,ae as resolveObservabilitySampling,Y as resolveRemoteEnabled,ge as scanWranglerVariablesForSecrets,D as startLocalHyperdrive,Ie as validateWrangler,Le as validateWranglerConfig,pe as validateWranglerProject,s as warnCloudflareCliConfigOnce,X as withTailConsumer,I as withheldBindings,ee as wranglerCodegenInputs,xe as wranglerToAlchemy};
1
+ import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{assertWranglerSatisfiesSchema as t}from"../packem_shared/assertWranglerSatisfiesSchema-A2WCMIRa.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-CULavrYO.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 c,withheldBindings as I}from"../packem_shared/describeWithheld-CbyzZjZF.mjs";import{bindingsNeedingDatabase as A,startLocalHyperdrive as D}from"../packem_shared/bindingsNeedingDatabase-6eD6Qtqf.mjs";import{HYPERDRIVE_PLACEHOLDER_ID as S}from"../packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{collectExportGaps as T,reconcileWranglerBindings as N}from"../packem_shared/collectExportGaps-BqFUht1A.mjs";import{reconcileWranglerCompatibilityDate as F}from"../packem_shared/reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{describePreservedCrons as B,reconcileWranglerCrons as h}from"../packem_shared/describePreservedCrons-C5KPuPy3.mjs";import{reconcileBindingsSafely as G,reconcileWranglerExtras as U}from"../packem_shared/reconcileBindingsSafely-BBr-MDCV.mjs";import{REMOTE_ELIGIBLE_KEYS as M,injectRemoteFlags as P,isRemoteEnvEnabled as V,materializeDevWranglerConfig as H,planRemoteBindings as w,resolveRemoteEnabled as Y}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-CuhB99R2.mjs";import{materializeServiceDevConfigs as j}from"../packem_shared/materializeServiceDevConfigs-qUY4_iu1.mjs";import{default as Q}from"../packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DV5E_f_q.mjs";import{withTailConsumer as X}from"../packem_shared/withTailConsumer-CF3pk_Ov.mjs";import{WORKERS_CACHE_MIN_DATE as q,isCacheEnabled as Z}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{wranglerCodegenInputs as ee}from"../packem_shared/wranglerCodegenInputs-BZamZrPz.mjs";import{DEFAULT_OBSERVABILITY as oe,resolveObservabilitySampling as ae}from"../packem_shared/DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import{mergeWranglerEnvironment as ne}from"../packem_shared/mergeWranglerEnvironment-D5ekKj5x.mjs";import{WRANGLER_FILES as le,findWranglerFile as fe,readWranglerJsonc as me}from"../packem_shared/WRANGLER_FILES-UNW-xY5u.mjs";import{UNEXPORTED_CLASS_MARKER as se,validateWranglerProject as pe}from"../packem_shared/UNEXPORTED_CLASS_MARKER-BV29zhUp.mjs";import{scanWranglerVariablesForSecrets as ge}from"../packem_shared/scanWranglerVariablesForSecrets-DRBYlMYb.mjs";import{wranglerToAlchemy as xe}from"../packem_shared/wranglerToAlchemy-CBO2ucRm.mjs";import{REQUIRED_COMPATIBILITY_DATE as _e,REQUIRED_FLAG as ce,validateWrangler as Ie,validateWranglerConfig as Le}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-D4UcOP_t.mjs";export{i as BINDING_MANIFEST_VERSION,m as CLOUDFLARE_CLI_CONFIG_WARNING_ENV,d as CLOUDFLARE_DRIVER,Q as CLOUDFLARE_TOOLCHAIN_VERSIONS,oe as DEFAULT_OBSERVABILITY,C as GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG,S as HYPERDRIVE_PLACEHOLDER_ID,M as REMOTE_ELIGIBLE_KEYS,_e as REQUIRED_COMPATIBILITY_DATE,ce as REQUIRED_FLAG,se as UNEXPORTED_CLASS_MARKER,q as WORKERS_CACHE_MIN_DATE,le as WRANGLER_FILES,o as applyModify,t as assertWranglerSatisfiesSchema,A as bindingsNeedingDatabase,l as buildBindingManifest,T as collectExportGaps,B as describePreservedCrons,c as describeWithheld,E as detectCloudflareCliConfig,fe as findWranglerFile,R as hasCloudflareCredentials,P as injectRemoteFlags,Z as isCacheEnabled,V as isRemoteEnvEnabled,H as materializeDevWranglerConfig,j as materializeServiceDevConfigs,ne as mergeWranglerEnvironment,w as planRemoteBindings,me as readWranglerJsonc,G as reconcileBindingsSafely,N as reconcileWranglerBindings,F as reconcileWranglerCompatibilityDate,h as reconcileWranglerCrons,U as reconcileWranglerExtras,ae as resolveObservabilitySampling,Y as resolveRemoteEnabled,ge as scanWranglerVariablesForSecrets,D as startLocalHyperdrive,Ie as validateWrangler,Le as validateWranglerConfig,pe as validateWranglerProject,s as warnCloudflareCliConfigOnce,X as withTailConsumer,I as withheldBindings,ee as wranglerCodegenInputs,xe 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-DSqsbmlq.mjs";
4
4
  import { ChildProcess } from 'node:child_process';
5
- import { D as DiscoveryCache } from "./packem_shared/infer-bindings.d-Cx96nMli.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-Cx96nMli.mjs";
5
+ import { D as DiscoveryCache } from "./packem_shared/infer-bindings.d-BUdWC3tw.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-BUdWC3tw.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-DraUd2R2.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";
@@ -775,9 +775,9 @@ interface SecretEntry {
775
775
  */
776
776
  declare const PACKAGE_SECRETS_REGISTRY: Readonly<Record<string, ReadonlyArray<SecretEntry>>>;
777
777
  /**
778
- * The keys a project may mint, given its secret sources. The relay key is minted only
779
- * when this project hosts the registry: a worker that calls another worker's registry
780
- * must take the host's value, so a fresh one would only be refused.
778
+ * The keys a project may mint, given its secret sources. The relay key is withheld only from a project that just constructs
779
+ * `EventLogDOClient`: that worker must take its host's value, so a fresh one would only be refused. Every other project mints it,
780
+ * including one with no relay source at all, where a generated value is never read and so does no harm.
781
781
  */
782
782
  declare const mintableSecretKeysFor: (packageNames: ReadonlyArray<string>) => ReadonlySet<string>;
783
783
  declare const secretsForPackages: (packageNames: ReadonlyArray<string>) => SecretEntry[];
@@ -1013,7 +1013,7 @@ declare const isPlaceholderValue: (value: string) => boolean;
1013
1013
  * runtime — over the developer's own half-filled `.dev.vars` — and hide the gap
1014
1014
  * from `lunora env doctor`, whose job is to report it as unfilled.
1015
1015
  */
1016
- declare const isMintableSecretKey: (key: string, value: string) => boolean;
1016
+ declare const isMintableSecretKey: (key: string, value: string, mintable?: ReadonlySet<string>) => boolean;
1017
1017
  /** Mint a fresh strong secret value — 64 hex chars (32 bytes), like `openssl rand -hex 32`. */
1018
1018
  declare const generateSecretValue: (randomHex?: (bytes: number) => string) => string;
1019
1019
  /**
@@ -1156,6 +1156,7 @@ interface DevSecretsFillPlan {
1156
1156
  */
1157
1157
  declare const planDevSecretsFill: (input: {
1158
1158
  existingContent: string;
1159
+ mintable?: ReadonlySet<string>;
1159
1160
  randomHex?: (bytes: number) => string;
1160
1161
  }) => DevSecretsFillPlan;
1161
1162
  interface FillDevSecretsResult {
@@ -1186,6 +1187,11 @@ declare const fillDevSecrets: (deps: {
1186
1187
  cwd: string;
1187
1188
  info?: (message: string) => void;
1188
1189
  randomHex?: (bytes: number) => string;
1190
+ /**
1191
+ * The project's secret sources (`secretSourcesFromBindings`). They narrow what is minted to the keys its role needs. Omit them to mint
1192
+ * every registry key.
1193
+ */
1194
+ secretSources?: ReadonlyArray<string>;
1189
1195
  }) => FillDevSecretsResult;
1190
1196
  /** Storage backends `.global()` accepts. A closed union, so it is never free text. */
1191
1197
  type GlobalBackend = "d1" | "hyperdrive";
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-sZ22Dkwr.js";
4
4
  import { ChildProcess } from 'node:child_process';
5
- import { D as DiscoveryCache } from "./packem_shared/infer-bindings.d-Cx96nMli.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-Cx96nMli.js";
5
+ import { D as DiscoveryCache } from "./packem_shared/infer-bindings.d-BUdWC3tw.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-BUdWC3tw.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-DraUd2R2.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";
@@ -775,9 +775,9 @@ interface SecretEntry {
775
775
  */
776
776
  declare const PACKAGE_SECRETS_REGISTRY: Readonly<Record<string, ReadonlyArray<SecretEntry>>>;
777
777
  /**
778
- * The keys a project may mint, given its secret sources. The relay key is minted only
779
- * when this project hosts the registry: a worker that calls another worker's registry
780
- * must take the host's value, so a fresh one would only be refused.
778
+ * The keys a project may mint, given its secret sources. The relay key is withheld only from a project that just constructs
779
+ * `EventLogDOClient`: that worker must take its host's value, so a fresh one would only be refused. Every other project mints it,
780
+ * including one with no relay source at all, where a generated value is never read and so does no harm.
781
781
  */
782
782
  declare const mintableSecretKeysFor: (packageNames: ReadonlyArray<string>) => ReadonlySet<string>;
783
783
  declare const secretsForPackages: (packageNames: ReadonlyArray<string>) => SecretEntry[];
@@ -1013,7 +1013,7 @@ declare const isPlaceholderValue: (value: string) => boolean;
1013
1013
  * runtime — over the developer's own half-filled `.dev.vars` — and hide the gap
1014
1014
  * from `lunora env doctor`, whose job is to report it as unfilled.
1015
1015
  */
1016
- declare const isMintableSecretKey: (key: string, value: string) => boolean;
1016
+ declare const isMintableSecretKey: (key: string, value: string, mintable?: ReadonlySet<string>) => boolean;
1017
1017
  /** Mint a fresh strong secret value — 64 hex chars (32 bytes), like `openssl rand -hex 32`. */
1018
1018
  declare const generateSecretValue: (randomHex?: (bytes: number) => string) => string;
1019
1019
  /**
@@ -1156,6 +1156,7 @@ interface DevSecretsFillPlan {
1156
1156
  */
1157
1157
  declare const planDevSecretsFill: (input: {
1158
1158
  existingContent: string;
1159
+ mintable?: ReadonlySet<string>;
1159
1160
  randomHex?: (bytes: number) => string;
1160
1161
  }) => DevSecretsFillPlan;
1161
1162
  interface FillDevSecretsResult {
@@ -1186,6 +1187,11 @@ declare const fillDevSecrets: (deps: {
1186
1187
  cwd: string;
1187
1188
  info?: (message: string) => void;
1188
1189
  randomHex?: (bytes: number) => string;
1190
+ /**
1191
+ * The project's secret sources (`secretSourcesFromBindings`). They narrow what is minted to the keys its role needs. Omit them to mint
1192
+ * every registry key.
1193
+ */
1194
+ secretSources?: ReadonlyArray<string>;
1189
1195
  }) => FillDevSecretsResult;
1190
1196
  /** Storage backends `.global()` accepts. A closed union, so it is never free text. */
1191
1197
  type GlobalBackend = "d1" | "hyperdrive";
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-B34mwSpH.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-CuEMuxSY.mjs";import{default as Ge}from"./packem_shared/ensureGitignoreEntries-Tsk8Qkw7.mjs";import{inferLunoraBindings as ye,secretSourcesFromBindings as ke}from"./packem_shared/inferLunoraBindings-B0-cxqXJ.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-CkRQL24p.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-C58Lo9HU.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-DhsxZhTy.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-BBRlXZop.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-Ciiba5g_.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-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-CuEMuxSY.mjs";import{default as Ge}from"./packem_shared/ensureGitignoreEntries-Tsk8Qkw7.mjs";import{inferLunoraBindings as ye,secretSourcesFromBindings as ke}from"./packem_shared/inferLunoraBindings-CzSFTzZh.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-C58Lo9HU.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-Ciiba5g_.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 +1 @@
1
- import{readFileSync as l}from"node:fs";import{findWranglerFile as m,readWranglerJsonc as E}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{DEV_VARS_FILE as i,parseDevVariableEntries as V,upsertDevVariableLine as c}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{writeDevVariablesFileAtomically as p}from"./buildPackageSecretsBlock-DhsxZhTy.mjs";import{join as v}from"node:path";const n="WORKER_ENV",a="development",d=e=>{const r=m(e);return r===void 0?{}:E(r).parsed?.vars??{}},W=(e,r)=>{const o=v(e,i);let t;try{t=l(o,"utf8")}catch{return}V(t).some(s=>s.key===n)||n in d(e)||(p(o,c(t,n,a)),r(`set ${n}=${a} in ${i} so the dev worker runs in development mode`))};export{a as DEV_WORKER_ENV_VALUE,n as DEV_WORKER_ENV_VAR,W as ensureDevWorkerEnv};
1
+ import{readFileSync as l}from"node:fs";import{findWranglerFile as m,readWranglerJsonc as E}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{DEV_VARS_FILE as i,parseDevVariableEntries as V,upsertDevVariableLine as c}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{writeDevVariablesFileAtomically as p}from"./buildPackageSecretsBlock-GvaLgvFN.mjs";import{join as v}from"node:path";const n="WORKER_ENV",a="development",d=e=>{const r=m(e);return r===void 0?{}:E(r).parsed?.vars??{}},W=(e,r)=>{const o=v(e,i);let t;try{t=l(o,"utf8")}catch{return}V(t).some(s=>s.key===n)||n in d(e)||(p(o,c(t,n,a)),r(`set ${n}=${a} in ${i} so the dev worker runs in development mode`))};export{a as DEV_WORKER_ENV_VALUE,n as DEV_WORKER_ENV_VAR,W as ensureDevWorkerEnv};
@@ -1 +1 @@
1
- import{C as s,M as R,P as _,b as a,S as e,m as A,s as C}from"./package-secrets-registry-CkRQL24p.mjs";export{s as CORE_SECRETS,R as MINTABLE_SECRET_KEYS,_ as PACKAGE_SECRETS_REGISTRY,a as SHARD_RELAY_HOST_PLACEHOLDER,e as SHARD_RELAY_SECRET_KEY,A as mintableSecretKeysFor,C as secretsForPackages};
1
+ import{C as s,M as R,P as _,b as a,S as e,m as A,s as C}from"./package-secrets-registry-UQ_uEAB_.mjs";export{s as CORE_SECRETS,R as MINTABLE_SECRET_KEYS,_ as PACKAGE_SECRETS_REGISTRY,a as SHARD_RELAY_HOST_PLACEHOLDER,e as SHARD_RELAY_SECRET_KEY,A as mintableSecretKeysFor,C as secretsForPackages};
@@ -1 +1 @@
1
- import{existsSync as d,readFileSync as y}from"node:fs";import{join as s,isAbsolute as a,relative as m}from"node:path";import{LunoraError as p}from"@lunora/errors";import{classifyPolicyEdit as k,scaffoldPolicyFile as h,resolveServerModule as l,wireRlsIntoProcedure as v}from"./classifyPolicyEdit-DJi9Fk8G.mjs";import{w as c,r as b}from"./write-atomic-C_Bu-bIv.mjs";const D="/__lunora/policy-scaffold",u=r=>r==="unknown-procedure"?404:r==="already-wired"||r==="destructive"?409:422,f=(r,o,e)=>{let t;try{t=b(r,o)}catch(n){return{body:{error:n instanceof Error?n.message:String(n),ok:!1},status:500}}return{body:{...e,diagnostics:t,ok:!0},status:200}},g=r=>({body:{edit:r,message:"Rewriting an existing policy predicate changes evaluation semantics and must be done by hand. The scaffolder only adds new, deny-by-default rules.",needsManualEdit:!0,ok:!1},status:409}),w=(r,o)=>{const e=h(o,l(r.projectRoot));if(!e.ok)return{body:{error:e.reason,ok:!1},status:u(e.reason)};const t=r.schemaDirectory??"lunora",n=s(r.projectRoot,t,e.fileName);return d(n)?{body:{error:"file-exists",fileName:e.fileName,ok:!1},status:409}:(c(n,e.source),f(r,{path:n,text:e.source},{fileName:e.fileName}))},R=(r,o,e)=>{if(typeof e!="string"||e.length===0||a(e)||e.includes("\\"))return;const t=s(r,o),n=s(t,`${e}.ts`),i=m(t,n);if(!(i.startsWith("..")||a(i)))return n},N=(r,o)=>{const e=R(r.projectRoot,r.schemaDirectory??"lunora",o.filePath);if(e===void 0||!d(e))return{body:{error:"unknown-procedure",ok:!1},status:404};const t=v(y(e,"utf8"),o,l(r.projectRoot));return t.ok?(c(e,t.text),f(r,{path:e,text:t.text},{exportName:o.exportName})):{body:{error:t.reason,ok:!1},status:u(t.reason)}},E=r=>{if(r.method!=="POST")return{body:{error:"method-not-allowed",ok:!1},status:405};const{body:o}=r;if(o==null||typeof o!="object"||typeof o.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};const e=o;if(k(e)==="destructive")return g(e);if(e.kind==="scaffoldPolicy")return w(r,e);if(e.kind==="wireRls")return N(r,e);throw new p("INTERNAL",`unhandled additive policy edit kind: ${String(e.kind)}`)};export{D as POLICY_SCAFFOLD_ENDPOINT,E as handlePolicyScaffoldRequest};
1
+ import{existsSync as d,readFileSync as y}from"node:fs";import{join as s,isAbsolute as a,relative as m}from"node:path";import{LunoraError as p}from"@lunora/errors";import{classifyPolicyEdit as k,scaffoldPolicyFile as h,resolveServerModule as l,wireRlsIntoProcedure as v}from"./classifyPolicyEdit-DJi9Fk8G.mjs";import{w as c,r as b}from"./write-atomic-DRRKWKF-.mjs";const D="/__lunora/policy-scaffold",u=r=>r==="unknown-procedure"?404:r==="already-wired"||r==="destructive"?409:422,f=(r,o,e)=>{let t;try{t=b(r,o)}catch(n){return{body:{error:n instanceof Error?n.message:String(n),ok:!1},status:500}}return{body:{...e,diagnostics:t,ok:!0},status:200}},g=r=>({body:{edit:r,message:"Rewriting an existing policy predicate changes evaluation semantics and must be done by hand. The scaffolder only adds new, deny-by-default rules.",needsManualEdit:!0,ok:!1},status:409}),w=(r,o)=>{const e=h(o,l(r.projectRoot));if(!e.ok)return{body:{error:e.reason,ok:!1},status:u(e.reason)};const t=r.schemaDirectory??"lunora",n=s(r.projectRoot,t,e.fileName);return d(n)?{body:{error:"file-exists",fileName:e.fileName,ok:!1},status:409}:(c(n,e.source),f(r,{path:n,text:e.source},{fileName:e.fileName}))},R=(r,o,e)=>{if(typeof e!="string"||e.length===0||a(e)||e.includes("\\"))return;const t=s(r,o),n=s(t,`${e}.ts`),i=m(t,n);if(!(i.startsWith("..")||a(i)))return n},N=(r,o)=>{const e=R(r.projectRoot,r.schemaDirectory??"lunora",o.filePath);if(e===void 0||!d(e))return{body:{error:"unknown-procedure",ok:!1},status:404};const t=v(y(e,"utf8"),o,l(r.projectRoot));return t.ok?(c(e,t.text),f(r,{path:e,text:t.text},{exportName:o.exportName})):{body:{error:t.reason,ok:!1},status:u(t.reason)}},E=r=>{if(r.method!=="POST")return{body:{error:"method-not-allowed",ok:!1},status:405};const{body:o}=r;if(o==null||typeof o!="object"||typeof o.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};const e=o;if(k(e)==="destructive")return g(e);if(e.kind==="scaffoldPolicy")return w(r,e);if(e.kind==="wireRls")return N(r,e);throw new p("INTERNAL",`unhandled additive policy edit kind: ${String(e.kind)}`)};export{D as POLICY_SCAFFOLD_ENDPOINT,E as handlePolicyScaffoldRequest};
@@ -1 +1 @@
1
- import{existsSync as a,readFileSync as d}from"node:fs";import{classifyEdit as l,applyAdditiveEdit as c}from"./applyAdditiveEdit-DEwPKcJg.mjs";import{parseSchema as u}from"./parseSchema-D1Wbr1qv.mjs";import{w as f,r as p}from"./write-atomic-C_Bu-bIv.mjs";import{join as m}from"node:path";const F="/__lunora/schema-edit",b=t=>t==="destructive"||t==="duplicate-table"||t==="duplicate-column"||t==="duplicate-index"?409:t==="unknown-table"?404:t==="invalid-identifier"||t==="invalid-validator"?400:422,y=t=>({body:{error:t.reason,ok:!1},status:422}),k=t=>{if(!a(t))return{response:{body:{error:"no-schema-file",ok:!1},status:404}};const e=u(d(t,"utf8"));return e.ok?{tables:e.tables}:{response:y(e)}},g=t=>({body:{edit:t,message:"This edit changes stored data and must go through a migration. Review the migration before applying.",needsMigration:!0,ok:!1},status:409}),h=(t,e)=>{const r=t.body;if(r==null||typeof r!="object"||typeof r.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};if(l(r)==="destructive")return g(r);if(!a(e))return{body:{error:"no-schema-file",ok:!1},status:404};const o=c(d(e,"utf8"),r);if(!o.ok)return{body:{error:o.reason,ok:!1},status:b(o.reason)};f(e,o.text);let i;try{i=p(t,{path:e,text:o.text})}catch(s){return{body:{error:s instanceof Error?s.message:String(s),ok:!1},status:500}}const n=u(o.text);return{body:{diagnostics:i,ok:!0,tables:n.ok?n.tables:[]},status:200}},R=t=>{const e=m(t.projectRoot,t.schemaDirectory??"lunora","schema.ts");if(t.method==="GET"){const r=k(e);return"response"in r?r.response:{body:{ok:!0,tables:r.tables},status:200}}return t.method==="POST"?h(t,e):{body:{error:"method-not-allowed",ok:!1},status:405}};export{F as SCHEMA_EDIT_ENDPOINT,R as handleSchemaEditRequest};
1
+ import{existsSync as a,readFileSync as d}from"node:fs";import{classifyEdit as l,applyAdditiveEdit as c}from"./applyAdditiveEdit-DEwPKcJg.mjs";import{parseSchema as u}from"./parseSchema-D1Wbr1qv.mjs";import{w as f,r as p}from"./write-atomic-DRRKWKF-.mjs";import{join as m}from"node:path";const F="/__lunora/schema-edit",b=t=>t==="destructive"||t==="duplicate-table"||t==="duplicate-column"||t==="duplicate-index"?409:t==="unknown-table"?404:t==="invalid-identifier"||t==="invalid-validator"?400:422,y=t=>({body:{error:t.reason,ok:!1},status:422}),k=t=>{if(!a(t))return{response:{body:{error:"no-schema-file",ok:!1},status:404}};const e=u(d(t,"utf8"));return e.ok?{tables:e.tables}:{response:y(e)}},g=t=>({body:{edit:t,message:"This edit changes stored data and must go through a migration. Review the migration before applying.",needsMigration:!0,ok:!1},status:409}),h=(t,e)=>{const r=t.body;if(r==null||typeof r!="object"||typeof r.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};if(l(r)==="destructive")return g(r);if(!a(e))return{body:{error:"no-schema-file",ok:!1},status:404};const o=c(d(e,"utf8"),r);if(!o.ok)return{body:{error:o.reason,ok:!1},status:b(o.reason)};f(e,o.text);let i;try{i=p(t,{path:e,text:o.text})}catch(s){return{body:{error:s instanceof Error?s.message:String(s),ok:!1},status:500}}const n=u(o.text);return{body:{diagnostics:i,ok:!0,tables:n.ok?n.tables:[]},status:200}},R=t=>{const e=m(t.projectRoot,t.schemaDirectory??"lunora","schema.ts");if(t.method==="GET"){const r=k(e);return"response"in r?r.response:{body:{ok:!0,tables:r.tables},status:200}}return t.method==="POST"?h(t,e):{body:{error:"method-not-allowed",ok:!1},status:405}};export{F as SCHEMA_EDIT_ENDPOINT,R as handleSchemaEditRequest};
@@ -1 +1 @@
1
- import{resolveAdminToken as A}from"./devVariablesStamp-Cetr3qFz.mjs";import{sendStudioDocument as D,applyStudioAssetCache as I}from"./applyStudioAssetCache-DHQEJuuv.mjs";import{isStandaloneModulePath as O,studioAssetsStamp as _,loadStudioAssets as C,readStandaloneAsset as H,assetContentType as N}from"./assetContentType-CUb5bpbI.mjs";import E from"./createStudioDocumentCache-B3Sf1bIl.mjs";import{detectAgentRules as v}from"./AGENT_RULES_DIR-Bd6JPtNa.mjs";import{handlePolicyScaffoldRequest as L,POLICY_SCAFFOLD_ENDPOINT as R}from"./POLICY_SCAFFOLD_ENDPOINT-3Rxi46n7.mjs";import b from"./renderStudioHtml-ByowDtMl.mjs";import{handleSchemaEditRequest as x,SCHEMA_EDIT_ENDPOINT as k}from"./SCHEMA_EDIT_ENDPOINT-CkMPlCce.mjs";import{handleSeedRequest as $,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 c="/__lunora",M=`${c}/studio.js`,m=`${c}/styles.css`,T=/\/$/,U={[R]:L,[k]:x,[g]:$},q=new Set(["127.0.0.1","::1","localhost"]),et=t=>t!==void 0&&t!==!1&&!q.has(t),y=t=>t===void 0||t==="/"?"":t.replace(T,""),ot=t=>`${y(t)}${c}`,h=(t,s,r)=>{t.statusCode=200,t.setHeader("Content-Type",r),t.end(s)},w=t=>{try{return new URL(t,"http://localhost").pathname}catch{const s=t.indexOf("?");return s===-1?t:t.slice(0,s)}},nt=t=>{const{logger:s,projectRoot:r}=t,u=y(t.base);let l,f;const p=E(r,()=>b({adminToken:A(r),basePath:c,dataEditable:!0,rulesInstalled:v(r).installed,runAsIdentity:!0,schemaEditable:!0,scriptSrc:M,styleHref:m})),P=(o,n,e)=>{const i=_();if((l===void 0||i!==f)&&(l=C(s),f=i),l===void 0){e.statusCode=501,e.setHeader("Content-Type","text/plain"),e.end("Lunora studio assets not found — install and build @lunora/studio.");return}const a=o===m,d=o.slice(o.lastIndexOf("/")+1);if(I(n,e,d,i))return;if(a){h(e,l.styles,"text/css; charset=utf-8");return}const S=H(d);if(S===void 0){e.statusCode=404,e.setHeader("Content-Type","text/plain"),e.end("Not found");return}h(e,S,N(d))};return(o,n,e)=>{const i=w(o.url??"").replace(T,""),a=u!==""&&i.startsWith(u)?i.slice(u.length):i;if(a!==c&&!a.startsWith(`${c}/`)){e();return}if(t.isNonLoopbackBind||F(o,s)!==void 0){n.statusCode=403,n.setHeader("Content-Type","text/plain"),n.end("Lunora studio is only available on loopback hosts in dev.");return}const d=U[a];if(d!==void 0){j(o,n,d,r,{apiSpec:t.apiSpec,lazyFunctions:t.lazyFunctions,schemaDirectory:t.schemaDirectory});return}if(a===m||O(a)){P(a,o,n);return}D(n,p())}};export{c as STUDIO_PATH,M as STUDIO_SCRIPT_PATH,m as STUDIO_STYLE_PATH,nt as createStudioMiddleware,et as isNonLoopbackHost,w as requestPathname,ot as studioMountPath};
1
+ import{resolveAdminToken as A}from"./devVariablesStamp-Cetr3qFz.mjs";import{sendStudioDocument as D,applyStudioAssetCache as I}from"./applyStudioAssetCache-DHQEJuuv.mjs";import{isStandaloneModulePath as O,studioAssetsStamp as _,loadStudioAssets as C,readStandaloneAsset as H,assetContentType as N}from"./assetContentType-CUb5bpbI.mjs";import E from"./createStudioDocumentCache-B3Sf1bIl.mjs";import{detectAgentRules as v}from"./AGENT_RULES_DIR-Bd6JPtNa.mjs";import{handlePolicyScaffoldRequest as L,POLICY_SCAFFOLD_ENDPOINT as R}from"./POLICY_SCAFFOLD_ENDPOINT-D5PpQPkf.mjs";import b from"./renderStudioHtml-ByowDtMl.mjs";import{handleSchemaEditRequest as x,SCHEMA_EDIT_ENDPOINT as k}from"./SCHEMA_EDIT_ENDPOINT-CtxWqfDe.mjs";import{handleSeedRequest as $,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 c="/__lunora",M=`${c}/studio.js`,m=`${c}/styles.css`,T=/\/$/,U={[R]:L,[k]:x,[g]:$},q=new Set(["127.0.0.1","::1","localhost"]),et=t=>t!==void 0&&t!==!1&&!q.has(t),y=t=>t===void 0||t==="/"?"":t.replace(T,""),ot=t=>`${y(t)}${c}`,h=(t,s,r)=>{t.statusCode=200,t.setHeader("Content-Type",r),t.end(s)},w=t=>{try{return new URL(t,"http://localhost").pathname}catch{const s=t.indexOf("?");return s===-1?t:t.slice(0,s)}},nt=t=>{const{logger:s,projectRoot:r}=t,u=y(t.base);let l,f;const p=E(r,()=>b({adminToken:A(r),basePath:c,dataEditable:!0,rulesInstalled:v(r).installed,runAsIdentity:!0,schemaEditable:!0,scriptSrc:M,styleHref:m})),P=(o,n,e)=>{const i=_();if((l===void 0||i!==f)&&(l=C(s),f=i),l===void 0){e.statusCode=501,e.setHeader("Content-Type","text/plain"),e.end("Lunora studio assets not found — install and build @lunora/studio.");return}const a=o===m,d=o.slice(o.lastIndexOf("/")+1);if(I(n,e,d,i))return;if(a){h(e,l.styles,"text/css; charset=utf-8");return}const S=H(d);if(S===void 0){e.statusCode=404,e.setHeader("Content-Type","text/plain"),e.end("Not found");return}h(e,S,N(d))};return(o,n,e)=>{const i=w(o.url??"").replace(T,""),a=u!==""&&i.startsWith(u)?i.slice(u.length):i;if(a!==c&&!a.startsWith(`${c}/`)){e();return}if(t.isNonLoopbackBind||F(o,s)!==void 0){n.statusCode=403,n.setHeader("Content-Type","text/plain"),n.end("Lunora studio is only available on loopback hosts in dev.");return}const d=U[a];if(d!==void 0){j(o,n,d,r,{apiSpec:t.apiSpec,lazyFunctions:t.lazyFunctions,schemaDirectory:t.schemaDirectory});return}if(a===m||O(a)){P(a,o,n);return}D(n,p())}};export{c as STUDIO_PATH,M as STUDIO_SCRIPT_PATH,m as STUDIO_STYLE_PATH,nt as createStudioMiddleware,et as isNonLoopbackHost,w as requestPathname,ot as studioMountPath};
@@ -1 +1 @@
1
- import{existsSync as h}from"node:fs";import{dirname as y,join as p}from"node:path";import{discoverSchemaInfo as E}from"./discoverSchemaInfo-BBRlXZop.mjs";import{MERGED_DURABLE_OBJECT as i,GENERATED_DIRECTORY as w,MERGED_ROLE_DURABLE_OBJECTS as u,COMPOSED_ENTRY_DURABLE_OBJECTS as $,GENERATED_CLASS_MODULES as k,isFrameworkDurableObject as D}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{o as R,f as j}from"./validate-bindings-PVHSAU6M.mjs";import{validateSchedulerOrigin as x}from"./withTailConsumer-CF3pk_Ov.mjs";import{l as O,r as _,s as A}from"./worker-entry-checks-AIASCYl7.mjs";import{mergeWranglerEnvironment as S}from"./mergeWranglerEnvironment-D5ekKj5x.mjs";import{findWranglerFile as W,readWranglerJsonc as C}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{validateWranglerConfig as T}from"./REQUIRED_COMPATIBILITY_DATE-D4UcOP_t.mjs";const v=r=>Array.isArray(r)?r:[],L=(r,o,t)=>Object.entries(r?.images??{}).flatMap(([s,n])=>{const e=n?.dockerfile;return typeof e!="string"||h(e.startsWith("/")?e:p(o,e))?[]:[`containers images["${s}"] dockerfile "${e}" does not exist (resolved relative to ${t}); create the Dockerfile`]}),I=(r,o,t)=>{const s=[];for(const n of v(r)){const e=n?.image;typeof e=="string"&&(e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.includes("Dockerfile"))&&!h(e.startsWith("/")?e:p(o,e))&&s.push(`containers image "${e}" does not exist (resolved relative to ${t}); create the Dockerfile or point image at a registry reference`),s.push(...L(n,o,t))}return s},P=(r,o)=>{const t=r?.vectorIndexNames??[],s=[];if(t.length>0&&s.push({message:e=>`schema declares vector index(es) ${t.map(l=>`"${l}"`).join(", ")} but nothing chains .vectors(...) onto defineApp() (composed in: ${e}) — \`ctx.vectors\` is then a throwing stub and buildWorkerOptions rejects EVERY request, /_lunora/health included. Add \`.vectors((env) => ({ ${String(t[0])}: env.<BINDING> }))\` to the chain.`,method:"vectors"}),r?.hasD1GlobalTable&&s.push({message:e=>`schema declares .global() table(s) but nothing chains .global(...) onto defineApp() (composed in: ${e}) — the shard then has no global writer, so every read or write of a global table throws INTERNAL ("requires a globalDb writer"). Add \`.global({ d1: (env) => env.DB })\` to the chain.`,method:"global"}),r?.hasHyperdriveGlobalTable&&s.push({message:e=>`schema declares .global({ backend: "hyperdrive" }) table(s) but nothing chains .hyperdriveGlobal(...) onto defineApp() (composed in: ${e}) — the shard then has no global writer, so every read or write of those tables throws INTERNAL. Add \`.hyperdriveGlobal({ engine: "postgres", exec: (env) => buildPgExec(fromPostgresJs(postgres(env.HYPERDRIVE.connectionString))) })\` to the chain (\`buildPgExec\` from \`@lunora/hyperdrive/global\`, \`fromPostgresJs\` from \`@lunora/hyperdrive\`).`,method:"hyperdriveGlobal"}),s.length===0)return[];const n=A(o,new Set(s.map(e=>e.method)));return n===void 0?[]:s.filter(e=>!n.chained.has(e.method)).map(e=>e.message(n.site))},G="does not export it",B=(r,o)=>{if(o.exports?.has(i)===!0&&u.has(r))return`This app merges its Durable Objects (\`durableObjects.merge\` in lunora.config), so ${i} hosts ${r}: bind only \`SHARD\` to "${i}" and drop the SCHEDULER / SHARD_REGISTRY bindings. Do that only if this Worker has never been deployed — a deployed ${r} namespace keeps its data, which the merged class cannot reach; turn \`durableObjects.merge\` off to keep it.`;if(r===i)return`${i} is the merged class (\`durableObjects.merge\` in lunora.config), and merging cannot be undone once deployed: the shard data lives in ${i}. Turn \`durableObjects.merge\` back on. Only a Worker that has never been deployed may rebind SHARD to "ShardDO".`;if(o.kind!=="composed")return`Re-export it from the module that defines it (\`export { ${r} } from "./…";\`), or add it to the app builder's own export (\`export const { ${r} } = app;\`).`;const t=`it exports ${$.join(", ")}, SchedulerDO when its binding is declared, and every class codegen emits from your ${k.map(s=>`${s}.ts`).join(" / ")} declarations`;return D(r)?`\`@lunora/vite\` generates that entry — ${t}, and ${r} is not among them. Class-A composition does not carry ${r}, so drop the binding; a project that needs it has to own its worker entry (add \`src/worker.ts\`, which \`lunora deploy\` bundles in place of \`main\`, and compose \`defineApp()\` there).`:`\`@lunora/vite\` generates that entry, so there is no file to add a re-export to: ${t}. Declare "${r}" in one of those and re-run \`lunora codegen\`, or drop the binding.`},M=(r,o)=>{const t=o.exports;if(t===void 0)return[];const s=[];for(const e of R(r.durable_objects?.bindings))typeof e.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&s.push({className:e.class_name,label:"durable_objects.bindings"});for(const e of v(r.workflows))typeof e?.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&s.push({className:e.class_name,label:"workflows"});for(const[e,l]of Object.entries(r.exports??{}))l?.type==="workflow"&&s.push({className:e,label:"workflows"});return s.filter(e=>!t.has(e.className)).map(e=>`${e.label} declares class "${e.className}" but the ${o.kind==="composed"?"composed class-A worker entry":"worker entry"} (${o.path}) ${G} — wrangler refuses to bundle a Worker whose ${e.label==="workflows"?"Workflow":"Durable Object"} classes are not exported. ${B(e.className,o)}`)},N=r=>[...j(r.migrations)].filter(o=>u.has(o)).map(o=>`migrations create class "${o}", which this app hosts in ${i} because it merges its Durable Objects (\`durableObjects.merge\`). Before the first deploy, replace "${o}" with "${i}" in new_sqlite_classes; a Worker already deployed with "${o}" keeps its data there and cannot merge — turn \`durableObjects.merge\` off.`),U=r=>r?.origin!=="absent"?[]:[`main is set but no readable file is there (looked in ${r.path}) — wrangler cannot resolve the worker entry, so a deploy will fail there. Point main at the entry that composes your app, or remove it to fall back to the conventional locations.`],Z=r=>{const o=r.schemaDir??"lunora",t=W(r.projectRoot);if(!t){const c=`wrangler.jsonc not found in ${r.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[c],report:{errors:[c],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:s}=C(t);if(s===void 0){const c=`failed to parse ${t} as JSONC.`;return{problems:[c],report:{errors:[c],valid:!1,warnings:[]},wranglerPath:t}}const{error:n,merged:e}=S(s,r.environment);if(n!==void 0)return{problems:[n],report:{errors:[n],valid:!1,warnings:[]},wranglerPath:t};const{error:l,info:f}=E(r.projectRoot,o,r.cache),a=T(s,f,r.environment);l!==void 0&&a.warnings.push(`schema parse failed in ${o}/schema.ts: ${l}`);const g=y(t),b=O(e.main,r.projectRoot,t),m=_(b,r.projectRoot,o);a.errors.push(...I(e.containers??[],g,t)),a.warnings.push(...U(b)),m!==void 0&&a.errors.push(...M(e,m)),m?.exports?.has(i)===!0&&(a.errors.push(...N(e)),h(p(r.projectRoot,o,w,"scheduler.ts"))&&x(e,r.environment,a.warnings,"the merged LunoraDO hosts the scheduler")),a.errors.push(...P(f,r.projectRoot));const d=e.assets?.directory;if(typeof d=="string"&&d.length>0){const c=d.startsWith("/")?d:p(g,d);h(c)||a.warnings.push(`assets.directory "${d}" does not exist yet — it is created by the client build; run the build before deploy`)}return a.valid=a.errors.length===0,{problems:a.errors,report:a,wranglerPath:t}};export{G as UNEXPORTED_CLASS_MARKER,Z as validateWranglerProject};
1
+ import{existsSync as h}from"node:fs";import{dirname as y,join as p}from"node:path";import{discoverSchemaInfo as E}from"./discoverSchemaInfo-DRPnqgif.mjs";import{MERGED_DURABLE_OBJECT as i,GENERATED_DIRECTORY as w,MERGED_ROLE_DURABLE_OBJECTS as u,COMPOSED_ENTRY_DURABLE_OBJECTS as $,GENERATED_CLASS_MODULES as k,isFrameworkDurableObject as D}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{o as R,f as j}from"./validate-bindings-PVHSAU6M.mjs";import{validateSchedulerOrigin as x}from"./withTailConsumer-CF3pk_Ov.mjs";import{l as O,r as _,s as A}from"./worker-entry-checks-AIASCYl7.mjs";import{mergeWranglerEnvironment as S}from"./mergeWranglerEnvironment-D5ekKj5x.mjs";import{findWranglerFile as W,readWranglerJsonc as C}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{validateWranglerConfig as T}from"./REQUIRED_COMPATIBILITY_DATE-D4UcOP_t.mjs";const v=r=>Array.isArray(r)?r:[],L=(r,o,t)=>Object.entries(r?.images??{}).flatMap(([s,n])=>{const e=n?.dockerfile;return typeof e!="string"||h(e.startsWith("/")?e:p(o,e))?[]:[`containers images["${s}"] dockerfile "${e}" does not exist (resolved relative to ${t}); create the Dockerfile`]}),I=(r,o,t)=>{const s=[];for(const n of v(r)){const e=n?.image;typeof e=="string"&&(e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.includes("Dockerfile"))&&!h(e.startsWith("/")?e:p(o,e))&&s.push(`containers image "${e}" does not exist (resolved relative to ${t}); create the Dockerfile or point image at a registry reference`),s.push(...L(n,o,t))}return s},P=(r,o)=>{const t=r?.vectorIndexNames??[],s=[];if(t.length>0&&s.push({message:e=>`schema declares vector index(es) ${t.map(l=>`"${l}"`).join(", ")} but nothing chains .vectors(...) onto defineApp() (composed in: ${e}) — \`ctx.vectors\` is then a throwing stub and buildWorkerOptions rejects EVERY request, /_lunora/health included. Add \`.vectors((env) => ({ ${String(t[0])}: env.<BINDING> }))\` to the chain.`,method:"vectors"}),r?.hasD1GlobalTable&&s.push({message:e=>`schema declares .global() table(s) but nothing chains .global(...) onto defineApp() (composed in: ${e}) — the shard then has no global writer, so every read or write of a global table throws INTERNAL ("requires a globalDb writer"). Add \`.global({ d1: (env) => env.DB })\` to the chain.`,method:"global"}),r?.hasHyperdriveGlobalTable&&s.push({message:e=>`schema declares .global({ backend: "hyperdrive" }) table(s) but nothing chains .hyperdriveGlobal(...) onto defineApp() (composed in: ${e}) — the shard then has no global writer, so every read or write of those tables throws INTERNAL. Add \`.hyperdriveGlobal({ engine: "postgres", exec: (env) => buildPgExec(fromPostgresJs(postgres(env.HYPERDRIVE.connectionString))) })\` to the chain (\`buildPgExec\` from \`@lunora/hyperdrive/global\`, \`fromPostgresJs\` from \`@lunora/hyperdrive\`).`,method:"hyperdriveGlobal"}),s.length===0)return[];const n=A(o,new Set(s.map(e=>e.method)));return n===void 0?[]:s.filter(e=>!n.chained.has(e.method)).map(e=>e.message(n.site))},G="does not export it",B=(r,o)=>{if(o.exports?.has(i)===!0&&u.has(r))return`This app merges its Durable Objects (\`durableObjects.merge\` in lunora.config), so ${i} hosts ${r}: bind only \`SHARD\` to "${i}" and drop the SCHEDULER / SHARD_REGISTRY bindings. Do that only if this Worker has never been deployed — a deployed ${r} namespace keeps its data, which the merged class cannot reach; turn \`durableObjects.merge\` off to keep it.`;if(r===i)return`${i} is the merged class (\`durableObjects.merge\` in lunora.config), and merging cannot be undone once deployed: the shard data lives in ${i}. Turn \`durableObjects.merge\` back on. Only a Worker that has never been deployed may rebind SHARD to "ShardDO".`;if(o.kind!=="composed")return`Re-export it from the module that defines it (\`export { ${r} } from "./…";\`), or add it to the app builder's own export (\`export const { ${r} } = app;\`).`;const t=`it exports ${$.join(", ")}, SchedulerDO when its binding is declared, and every class codegen emits from your ${k.map(s=>`${s}.ts`).join(" / ")} declarations`;return D(r)?`\`@lunora/vite\` generates that entry — ${t}, and ${r} is not among them. Class-A composition does not carry ${r}, so drop the binding; a project that needs it has to own its worker entry (add \`src/worker.ts\`, which \`lunora deploy\` bundles in place of \`main\`, and compose \`defineApp()\` there).`:`\`@lunora/vite\` generates that entry, so there is no file to add a re-export to: ${t}. Declare "${r}" in one of those and re-run \`lunora codegen\`, or drop the binding.`},M=(r,o)=>{const t=o.exports;if(t===void 0)return[];const s=[];for(const e of R(r.durable_objects?.bindings))typeof e.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&s.push({className:e.class_name,label:"durable_objects.bindings"});for(const e of v(r.workflows))typeof e?.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&s.push({className:e.class_name,label:"workflows"});for(const[e,l]of Object.entries(r.exports??{}))l?.type==="workflow"&&s.push({className:e,label:"workflows"});return s.filter(e=>!t.has(e.className)).map(e=>`${e.label} declares class "${e.className}" but the ${o.kind==="composed"?"composed class-A worker entry":"worker entry"} (${o.path}) ${G} — wrangler refuses to bundle a Worker whose ${e.label==="workflows"?"Workflow":"Durable Object"} classes are not exported. ${B(e.className,o)}`)},N=r=>[...j(r.migrations)].filter(o=>u.has(o)).map(o=>`migrations create class "${o}", which this app hosts in ${i} because it merges its Durable Objects (\`durableObjects.merge\`). Before the first deploy, replace "${o}" with "${i}" in new_sqlite_classes; a Worker already deployed with "${o}" keeps its data there and cannot merge — turn \`durableObjects.merge\` off.`),U=r=>r?.origin!=="absent"?[]:[`main is set but no readable file is there (looked in ${r.path}) — wrangler cannot resolve the worker entry, so a deploy will fail there. Point main at the entry that composes your app, or remove it to fall back to the conventional locations.`],Z=r=>{const o=r.schemaDir??"lunora",t=W(r.projectRoot);if(!t){const c=`wrangler.jsonc not found in ${r.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[c],report:{errors:[c],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:s}=C(t);if(s===void 0){const c=`failed to parse ${t} as JSONC.`;return{problems:[c],report:{errors:[c],valid:!1,warnings:[]},wranglerPath:t}}const{error:n,merged:e}=S(s,r.environment);if(n!==void 0)return{problems:[n],report:{errors:[n],valid:!1,warnings:[]},wranglerPath:t};const{error:l,info:f}=E(r.projectRoot,o,r.cache),a=T(s,f,r.environment);l!==void 0&&a.warnings.push(`schema parse failed in ${o}/schema.ts: ${l}`);const g=y(t),b=O(e.main,r.projectRoot,t),m=_(b,r.projectRoot,o);a.errors.push(...I(e.containers??[],g,t)),a.warnings.push(...U(b)),m!==void 0&&a.errors.push(...M(e,m)),m?.exports?.has(i)===!0&&(a.errors.push(...N(e)),h(p(r.projectRoot,o,w,"scheduler.ts"))&&x(e,r.environment,a.warnings,"the merged LunoraDO hosts the scheduler")),a.errors.push(...P(f,r.projectRoot));const d=e.assets?.directory;if(typeof d=="string"&&d.length>0){const c=d.startsWith("/")?d:p(g,d);h(c)||a.warnings.push(`assets.directory "${d}" does not exist yet — it is created by the client build; run the build before deploy`)}return a.valid=a.errors.length===0,{problems:a.errors,report:a,wranglerPath:t}};export{G as UNEXPORTED_CLASS_MARKER,Z as validateWranglerProject};
@@ -1,3 +1,3 @@
1
- import{LunoraError as n}from"@lunora/errors";import{lunoraLine as i}from"./LUNORA_TAG-DQTGPqcJ.mjs";import{validateWranglerProject as c}from"./UNEXPORTED_CLASS_MARKER-q-hZgyZS.mjs";const m=(e,o,t)=>{const r=c({cache:e.cache,projectRoot:e.projectRoot,schemaDir:e.schemaDir});if(!r.wranglerPath)throw new n("INTERNAL",["[lunora] wrangler.jsonc not found.",` searched in: ${e.projectRoot}`," create a wrangler.jsonc declaring at least the SHARD durable object binding."].join(`
1
+ import{LunoraError as n}from"@lunora/errors";import{lunoraLine as i}from"./LUNORA_TAG-DQTGPqcJ.mjs";import{validateWranglerProject as c}from"./UNEXPORTED_CLASS_MARKER-BV29zhUp.mjs";const m=(e,o,t)=>{const r=c({cache:e.cache,projectRoot:e.projectRoot,schemaDir:e.schemaDir});if(!r.wranglerPath)throw new n("INTERNAL",["[lunora] wrangler.jsonc not found.",` searched in: ${e.projectRoot}`," create a wrangler.jsonc declaring at least the SHARD durable object binding."].join(`
2
2
  `));for(const a of r.report.warnings)o(i(`wrangler validator: ${a}`));if(r.problems.length>0)throw new n("INTERNAL",["[lunora] wrangler configuration is missing bindings required by your schema.",` file: ${r.wranglerPath}`,"",...r.problems.map(a=>` - ${a}`),"",` ${t}`].join(`
3
3
  `))};export{m as assertWranglerSatisfiesSchema};
@@ -0,0 +1,19 @@
1
+ import{randomBytes as D}from"node:crypto";import{existsSync as g,readFileSync as m,writeFileSync as E,linkSync as j,rmSync as h,renameSync as V,statSync as I}from"node:fs";import{join as p}from"node:path";import{LunoraError as N}from"@lunora/errors";import{DEV_VARS_FILE as u,DEV_VARS_EXAMPLE_FILE as y,parseDevVariableLine as $,parseDevVariableEntries as S,DEV_VARS_NEWLINE as C}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{M as z,S as f,C as P,m as B,b as O,s as W}from"./package-secrets-registry-UQ_uEAB_.mjs";const H=e=>[...P,...W(e)],K=32,Y=["replace","openssl","changeme","change-me","change_me","change-this","change_this","your-","your_","example","placeholder","todo","fill-me","fill_me","fill-in","fill_in","xxx"],U=/[.*+?^${}()|[\]\\]/gu,X=/[a-z0-9]$/u,L=e=>{const t=e.trim().toLowerCase();return t===""||t.startsWith("<")&&t.endsWith(">")?!0:Y.some(n=>{const r=n.replaceAll(U,String.raw`\$&`),s=X.test(n)?`(^|[^a-z0-9])${r}([^a-z0-9]|$)`:`(^|[^a-z0-9])${r}`;return new RegExp(s,"u").test(t)})},x=e=>D(e).toString("hex"),w=new Set([...z,f]),G=(e,t,n=w)=>e===f?n.has(e)&&(t.trim()===""||t===O):n.has(e),T=(e,t,n,r)=>G(e,t,r)&&L(t)?n(K):void 0,ue=(e=x)=>e(K),b=(e,t,n,r=w)=>e.split(C).map(o=>{const s=$(o),a=s?T(s.key,s.value,t,r):void 0;return!s||a===void 0?o:(n.push(s.key),`${s.key}="${a}"`)}),q=e=>{if(e.devVarsExists)return{status:"exists"};if(e.exampleContent===void 0)return{status:"no-example"};const t=[];return{content:b(e.exampleContent,e.randomHex??x,t).join(`
2
+ `),generatedKeys:t,status:"generate"}},J=e=>e.includes('"')||e.includes("\\")?"":e.replaceAll("\r",String.raw`\r`).replaceAll(`
3
+ `,String.raw`\n`),_=e=>{const t=e.randomHex??x,n=new Set(S(e.existingContent).map(a=>a.key)),r=[],o=[],s=[];for(const a of e.exampleContent.split(C)){const i=$(a);if(!i||n.has(i.key))continue;const c=T(i.key,i.value,t,w);s.push(i.key),c===void 0?r.push(`${i.key}="${J(i.value)}"`):(o.push(i.key),r.push(`${i.key}="${c}"`))}return{additions:r,generatedKeys:o,missingKeys:s}},k=e=>e.length>0?` (generated ${e.join(", ")})`:"",F=e=>`${e}.tmp-${String(process.pid)}`,v=(e,t,n={})=>{const r=F(e);try{E(r,t,{encoding:"utf8",...n}),V(r,e)}catch(o){throw h(r,{force:!0}),o}},Q=(e,t)=>{try{return E(e,t,{encoding:"utf8",flag:"wx",mode:384}),!0}catch(n){if(n.code==="EEXIST")return!1;throw n}},M=(e,t)=>{const n=F(e);try{E(n,t,{encoding:"utf8",flag:"wx",mode:384});try{return j(n,e),!0}catch(r){const{code:o}=r;if(o==="EEXIST")return!1;if(o==="EPERM"||o==="ENOTSUP")return Q(e,t);throw r}}finally{h(n,{force:!0})}},fe=(e,t)=>{v(e,t,{mode:384})},A=5,R=e=>{try{const t=I(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}},Z=(e,t)=>e===void 0||t===void 0?!1:e.mtimeMs===t.mtimeMs&&e.size===t.size,ee=(e,t)=>{for(let n=0;n<A;n+=1){const r=R(e),o=m(e,"utf8"),s=t(o);if(s.length===0)return[];const a=o.length>0&&!o.endsWith(`
4
+ `)?`
5
+ `:"",i=`${o}${a}${s.join(`
6
+ `)}
7
+ `,c=`${e}.tmp-${String(process.pid)}-${D(6).toString("hex")}`;try{E(c,i,{encoding:"utf8",mode:384});const d=R(e);if(!Z(r,d)){h(c,{force:!0});continue}return V(c,e),s}catch(d){throw h(c,{force:!0}),d}}throw new N("INTERNAL",`Failed to append to ${e} after ${String(A)} attempts — a concurrent writer kept winning the race.`)},ye=async e=>{const t=p(e.cwd,u),n=p(e.cwd,y);if(!g(n))return{addedKeys:[],generatedKeys:[],status:"no-example"};const r=m(n,"utf8");if(!g(t)){const l=q({devVarsExists:!1,exampleContent:r,randomHex:e.randomHex});return l.status!=="generate"?{addedKeys:[],generatedKeys:[],status:"no-example"}:e.yes===!0||await e.confirm(`No ${u} found. Generate it from ${y} (secrets auto-filled)?`)?M(t,l.content)?(e.info(`Created ${u}${k(l.generatedKeys)}.`),{addedKeys:[],generatedKeys:l.generatedKeys,status:"generated"}):{addedKeys:[],generatedKeys:[],status:"skipped-exists"}:(e.info(`Skipped — copy ${y} to ${u} and fill it in when you're ready.`),{addedKeys:[],generatedKeys:[],status:"declined"})}const o=_({existingContent:m(t,"utf8"),exampleContent:r,randomHex:e.randomHex});if(o.missingKeys.length===0)return{addedKeys:[],generatedKeys:[],status:"exists"};const s=o.missingKeys.join(", ");if(!(e.yes===!0||await e.confirm(`${u} is missing ${String(o.missingKeys.length)} key(s) from ${y} (${s}). Add them?`)))return e.info(`Skipped — add ${s} to ${u} when you're ready.`),{addedKeys:[],generatedKeys:[],status:"declined"};const c=ee(t,l=>_({existingContent:l,exampleContent:r,randomHex:e.randomHex}).additions).map(l=>$(l)?.key).filter(l=>l!==void 0);if(c.length===0)return{addedKeys:[],generatedKeys:[],status:"exists"};const d=o.generatedKeys.filter(l=>c.includes(l));return e.info(`Updated ${u} — added ${c.join(", ")}${k(d)}.`),{addedKeys:c,generatedKeys:d,status:"augmented"}},te=e=>[`# ${e.description}`,`# Docs: ${e.docsUrl}`,`${e.key}="${e.placeholderValue}"`].join(`
8
+ `),ne=(e,t)=>{const n=H(e).filter(r=>!t.has(r.key));return n.length===0?"":n.map(r=>te(r)).join(`
9
+
10
+ `)},me=(e,t)=>{const n=p(e,y),r=g(n)?m(n,"utf8"):"",o=new Set(S(r).map(i=>i.key)),s=ne(t,o);if(s==="")return[];const a=r.length>0&&!r.endsWith(`
11
+ `)?`
12
+ `:"";return v(n,`${r}${a}
13
+ ${s}
14
+ `),H(t).filter(i=>!o.has(i.key)).map(i=>i.key)},re=e=>{const t=e.randomHex??x,n=[],r=b(e.existingContent,t,n,e.mintable),o=new Set(S(e.existingContent).map(d=>d.key)),s=[],a=[];for(const d of P)o.has(d.key)||(s.push(d.key),a.push(`# ${d.description}`,`${d.key}="${t(K)}"`));const i=r.join(`
15
+ `);if(a.length===0)return{addedKeys:s,content:i,filledKeys:n};const c=i===""||i.endsWith(`
16
+ `)?"":`
17
+ `;return{addedKeys:s,content:`${i}${c}${a.join(`
18
+ `)}
19
+ `,filledKeys:n}},ge=e=>{const t=p(e.cwd,u),n=g(t),r=n?m(t,"utf8"):"",o=e.secretSources===void 0?void 0:B(e.secretSources),s=re({existingContent:r,mintable:o,randomHex:e.randomHex}),a=S(s.content).find(c=>c.key===f)?.value;if(o!==void 0&&!o.has(f)&&a!==void 0&&L(a)&&e.info?.(`${f} is still a placeholder. This worker only calls an event log hosted elsewhere, so set it to the ${f} of the worker that hosts EventLogDO.`),s.filledKeys.length===0&&s.addedKeys.length===0)return{addedKeys:[],filledKeys:[],status:"unchanged"};if(n)v(t,s.content,{mode:384});else if(!M(t,s.content))return{addedKeys:[],filledKeys:[],status:"unchanged"};const i=[...s.filledKeys,...s.addedKeys];return e.info?.(`Generated ${String(i.length)} dev secret(s) in ${u}: ${i.join(", ")}`),{addedKeys:s.addedKeys,filledKeys:s.filledKeys,status:n?"filled":"created"}};export{ne as buildPackageSecretsBlock,ye as ensureDevVariables,me as ensureDevVarsExample,ge as fillDevSecrets,ue as generateSecretValue,G as isMintableSecretKey,L as isPlaceholderValue,re as planDevSecretsFill,_ as planDevVariablesAugment,q as planDevVariablesScaffold,H as requiredSecrets,fe as writeDevVariablesFileAtomically};
@@ -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{a as ae,r as Y}from"./lunora-manifest-DuH_Cmyu.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-DFqH4eMQ.mjs";import{DEV_VARS_FILE as pe,parseDevVariableEntries as fe}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{secretSourcesFromBindings as be}from"./inferLunoraBindings-B0-cxqXJ.mjs";import{requiredSecrets as he}from"./buildPackageSecretsBlock-DhsxZhTy.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-AIASCYl7.mjs";import{DEFAULT_OBSERVABILITY as Se}from"./DEFAULT_OBSERVABILITY-bN6UkTMx.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,Ne=/^[\t ]*,/u,ke=(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{a as ae,r as Y}from"./lunora-manifest-DuH_Cmyu.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-DFqH4eMQ.mjs";import{DEV_VARS_FILE as pe,parseDevVariableEntries as fe}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{secretSourcesFromBindings as be}from"./inferLunoraBindings-CzSFTzZh.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-AIASCYl7.mjs";import{DEFAULT_OBSERVABILITY as Se}from"./DEFAULT_OBSERVABILITY-bN6UkTMx.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,Ne=/^[\t ]*,/u,ke=(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:Ne.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=ke(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}},$e=(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)"}},k=(e,n,s)=>{const{binding:t,label:o}=Ge[s],i=n[s]?.binding;return typeof i=="string"&&i.length>0?{added:[],text:e}:{added:[o],text:w(e,[s],{binding:t})}},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"},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=$e(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};
@@ -0,0 +1 @@
1
+ import{existsSync as l}from"node:fs";import{discoverSchema as d,isHyperdriveGlobalTable as f,isD1GlobalTable as b}from"@lunora/codegen";import{Project as u}from"ts-morph";import{join as p}from"node:path";const a=e=>{if(e?.kind==="optional")return a(e.inner);if(e?.kind==="union"){const s=new Set((e.members??[]).filter(i=>i.kind!=="null").map(i=>a(i)));return s.size===1?[...s][0]:e.kind}return e?.kind},m=(e,s)=>{const i=p(e,s,"schema.ts");if(!l(i))return{info:void 0};try{const o=new u({compilerOptions:{noLib:!0},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!1}),r=d(o,i,e),c=n=>r.tables.find(t=>t.name===n)?.shape??{};return{info:{hasD1GlobalTable:r.tables.some(n=>b(n)),hasHyperdriveGlobalTable:r.tables.some(n=>f(n)),...r.jurisdiction===void 0?{}:{jurisdiction:r.jurisdiction},vectorIndexNames:r.vectorIndexes.map(n=>n.name),vectorMetadata:r.vectorIndexes.flatMap(n=>(n.metadata??[]).map(t=>({index:n.name,kind:a(c(n.table)[t]),property:t})))}}}catch(o){return{error:o instanceof Error?o.message:String(o),info:void 0}}},I=(e,s,i)=>i===void 0?m(e,s):i.memo(`schema:${e}:${s}`,()=>m(e,s));export{I as discoverSchemaInfo};
@@ -200,6 +200,8 @@ interface InferredBindings {
200
200
  * un-mintable `app_id`, so it is reconciled as a hint, not auto-written.
201
201
  */
202
202
  flagshipBinding?: string;
203
+ /** The worker entry exports `EventLogDO`, so the app mints the `LUNORA_RELAY_SECRET` the event log checks on every request. */
204
+ hostsEventLog: boolean;
203
205
  /** The app hosts the registry (exports or binds `ShardRegistryDO`, or is merged with its module), so it mints the `LUNORA_RELAY_SECRET` its registry checks. */
204
206
  hostsShardRegistry: boolean;
205
207
  /**
@@ -242,6 +244,8 @@ interface InferredBindings {
242
244
  usesBrowser: boolean;
243
245
  /** `@lunora/auth/cimd/workers` is imported → needs the `global_fetch_strictly_public` compatibility flag (no binding; `lunora doctor` checks it). */
244
246
  usesCimdWorkers: boolean;
247
+ /** The app constructs an `EventLogDOClient`, so it needs the `LUNORA_RELAY_SECRET` its host minted, hosting the log or not. */
248
+ usesEventLogClient: boolean;
245
249
  /** `lunora/flags.ts` declares a feature-flag provider (any OpenFeature provider — Flagship or custom). */
246
250
  usesFlags: boolean;
247
251
  /** `@lunora/hyperdrive` is imported or `ctx.sql` read (reconcile writes `{ binding: "HYPERDRIVE" }` with a placeholder `id`; `lunora deploy` swaps in the created config's). */
@@ -200,6 +200,8 @@ interface InferredBindings {
200
200
  * un-mintable `app_id`, so it is reconciled as a hint, not auto-written.
201
201
  */
202
202
  flagshipBinding?: string;
203
+ /** The worker entry exports `EventLogDO`, so the app mints the `LUNORA_RELAY_SECRET` the event log checks on every request. */
204
+ hostsEventLog: boolean;
203
205
  /** The app hosts the registry (exports or binds `ShardRegistryDO`, or is merged with its module), so it mints the `LUNORA_RELAY_SECRET` its registry checks. */
204
206
  hostsShardRegistry: boolean;
205
207
  /**
@@ -242,6 +244,8 @@ interface InferredBindings {
242
244
  usesBrowser: boolean;
243
245
  /** `@lunora/auth/cimd/workers` is imported → needs the `global_fetch_strictly_public` compatibility flag (no binding; `lunora doctor` checks it). */
244
246
  usesCimdWorkers: boolean;
247
+ /** The app constructs an `EventLogDOClient`, so it needs the `LUNORA_RELAY_SECRET` its host minted, hosting the log or not. */
248
+ usesEventLogClient: boolean;
245
249
  /** `lunora/flags.ts` declares a feature-flag provider (any OpenFeature provider — Flagship or custom). */
246
250
  usesFlags: boolean;
247
251
  /** `@lunora/hyperdrive` is imported or `ctx.sql` read (reconcile writes `{ binding: "HYPERDRIVE" }` with a placeholder `id`; `lunora deploy` swaps in the created config's). */
@@ -0,0 +1 @@
1
+ import{existsSync as F,statSync as k,readFileSync as J,readdirSync as de}from"node:fs";import{relative as le,sep as ue,isAbsolute as pe,join as S,dirname as P,resolve as me}from"node:path";import{discoverFlags as fe,FLAGS_FILENAME as ge,discoverQueues as he,CAPABILITY_PROBES as Q,readServiceBindings as xe,discoverNotifyChannels as Se,NOTIFY_FILENAME as ye,createTargetScope as ve,mayReadCapabilityContext as Ee,sourceCapabilitySignals as be,foldCapabilitySignals as V,capabilitiesUsedBy as Ne}from"@lunora/codegen";import{init as Ce}from"es-module-lexer";import{Project as z,ts as n,Node as m}from"ts-morph";import{discoverAgentInfo as Te}from"./discoverAgentInfo-pqFMJBtJ.mjs";import{discoverContainerInfo as Ie}from"./discoverContainerInfo-DzXr7Vm3.mjs";import{escapeRegExp as Re}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{d as M}from"./discover-info-DC2MrAIM.mjs";import{P as Ae}from"./package-secrets-registry-UQ_uEAB_.mjs";import{discoverSchemaInfo as Oe}from"./discoverSchemaInfo-DRPnqgif.mjs";import{resolveWorkerEntry as we,composedEntryDurableObjects as De,GENERATED_DIRECTORY as w,DURABLE_OBJECT_BINDINGS as _e,detectExportedDurableObjects as Le,detectClassExports as L,isMergedProject as Z}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{discoverWorkflowInfo as $e}from"./discoverWorkflowInfo-zW7Tt0Tn.mjs";const Pe=(e,t)=>{const{error:s,value:o}=M(e,t,ge,fe);return s===void 0?{flags:o}:{error:s}},ee=(e,t)=>{const s=le(t,e);return s!==""&&s!==".."&&!s.startsWith(`..${ue}`)&&!pe(s)},je=(e,t)=>{const{error:s,value:o}=M(e,t,void 0,he);return s===void 0?{queues:o??[]}:{error:s,queues:[]}},Fe=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),ke=new Set([".git",".lunora-cache",".wrangler","dist",w,"node_modules"]),Me=["lunora","src"],Ke=/\benv\s*\.\s*DB\b/,Be=/\benv\s*\.\s*AI\b/,te=["ai","aiSearch","analytics","analyticsSql","artifacts","browser","hyperdrive","images","kv","mail","notify","payments","pipelines","r2sql","scheduler","storage","x402"],se=e=>`uses${e.charAt(0).toUpperCase()}${e.slice(1)}`,oe=[["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"]],re=[...te.map(e=>[se(e),Q[e].moduleSpecifier]),...oe].toSorted(([e],[t])=>e.localeCompare(t)),Ge=[["usesNotifyFcm","@lunora/notify:fcm"],["usesNotifyWebPush","@lunora/notify:webPush"],["hostsShardRegistry","@lunora/do:shardRegistry"],["hostsEventLog","@lunora/replica:eventLog"],["usesEventLogClient","@lunora/replica:eventLogClient"],["usesRequestSecretTool","@lunora/agent:requestSecretTool"]],We=["@lunora/agent","@lunora/agent/sandbox"],b="@lunora/replica",h="EventLogDOClient",Ve=/\.[cm]?[jt]sx?$/u,Y=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"],U=new Map,K=e=>{const{mtimeMs:t}=k(e),s=U.get(e);if(s?.mtimeMs===t)return s.source;const o=n.createSourceFile(e,J(e,"utf8"),n.ScriptTarget.Latest);return U.set(e,{mtimeMs:t,source:o}),o},q=new WeakMap,Ye=e=>{const t=q.get(e);if(t!==void 0&&t[0]?.wasForgotten()!==!0)return t;const s=e.getDescendantsOfKind(n.SyntaxKind.Identifier);return q.set(e,s),s},H=e=>n.sys.fileExists(e)?k(e).mtimeMs:-1,X=new Map,Ue=e=>{const t=n.findConfigFile(P(e),i=>n.sys.fileExists(i));if(t===void 0)return{};const s=X.get(t);if(s!==void 0&&[...s.mtimes].every(([i,c])=>H(i)===c))return s.options;const o=n.readJsonConfigFile(t,i=>n.sys.readFile(i)),{options:r}=n.parseJsonSourceFileConfigFileContent(o,n.sys,P(t)),a=new Map([t,...o.extendedSourceFiles??[]].map(i=>[i,H(i)]));return X.set(t,{mtimes:a,options:r}),r},B=(e,t)=>{if(t===b)return;if(!t.startsWith("./")&&!t.startsWith("../")){const a={moduleResolution:n.ModuleResolutionKind.Bundler,...Ue(e)},i=n.resolveModuleName(t,e,a,n.sys).resolvedModule;return i?.isExternalLibraryImport===!0?void 0:i?.resolvedFileName}const s=S(P(e),t.replace(Ve,"")),o=Y.map(a=>`${s}${a}`),r=Y.map(a=>S(s,`index${a}`));return[...o,...r].find(a=>F(a))},qe=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},He=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},D=e=>n.canHaveModifiers(e)&&(n.getModifiers(e)??[]).some(t=>t.kind===n.SyntaxKind.ExportKeyword),Xe=e=>n.isVariableStatement(e)?D(e)?e.declarationList.declarations.flatMap(t=>n.isIdentifier(t.name)?[t.name.text]:[]):[]:(n.isClassDeclaration(e)||n.isFunctionDeclaration(e))&&D(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):[],Je=e=>new Set(e.statements.flatMap(t=>Xe(t))),Qe=(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}}},ze=(e,t,s)=>D(e)?e.declarationList.declarations.flatMap(o=>{if(!n.isIdentifier(o.name)||o.initializer===void 0)return[];const r=Qe(o.initializer,t,s);return r===void 0?[]:[{exported:o.name.text,module:r.module,name:r.name}]}):[],Ze=(e,t)=>{const s=e.heritageClauses?.find(r=>r.token===n.SyntaxKind.ExtendsKeyword)?.types[0]?.expression;if(!D(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}]},et=e=>{const t=qe(e),s=He(e);return e.statements.flatMap(o=>{if(n.isVariableStatement(o))return ze(o,t,s);if(n.isClassDeclaration(o))return Ze(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}]}):[]})},G=(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=K(e),c=et(i),d=new Set([...r,...Je(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=B(e,l.module);return v!==void 0&&G(v,t,u,o,l.exported===void 0?d:r)})},j=(e,t)=>Ye(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()===h:m.isQualifiedName(o)?!m.isTypeReference(o.getParent())&&o.getRight().getText()===h:!0}),tt=e=>{const[t]=e.getArguments();return e.getExpression().getKind()===n.SyntaxKind.ImportKeyword&&t!==void 0&&(m.isStringLiteral(t)||m.isNoSubstitutionTemplateLiteral(t))&&t.getLiteralValue()===b},st=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()},ot=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||st(a)===h)}return m.isPropertyAccessExpression(o)&&o.getExpression()===t?o.getName()===h:!0},rt=(e,t)=>K(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),nt=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()===h),a=o.filter(d=>j(e,(d.getAliasNode()??d.getNameNode()).getText())),i=s!==void 0&&j(e,s.getText());if(!r&&!i&&a.length===0)return!1;const c=B(e.getFilePath(),t.getModuleSpecifierValue());return c===void 0?!1:(r||i)&&G(c,h,h,new Set)||a.some(d=>rt(c,d.getNameNode().getText()))}),ne=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()===h))||t.some(s=>{const o=s.getNamespaceImport();return o!==void 0&&j(e,o.getText())})||e.getExportDeclarations().some(s=>s.getModuleSpecifierValue()===b&&!s.isTypeOnly()&&s.getNamedExports().some(o=>!o.isTypeOnly()&&o.getNameNode().getText()===h))||nt(e)||e.getDescendantsOfKind(n.SyntaxKind.CallExpression).some(s=>tt(s)&&ot(s))},ie=new RegExp(String.raw`["'\x60](?:${[...re.map(([,e])=>e),...We,b].map(e=>Re(e)).join("|")})["'\x60]`,"u"),p=e=>{const{contextProperty:t,moduleSpecifier:s}=Q[e];return t===void 0?`${s} is imported`:`${s} is imported or ctx.${t} is read`},it="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",at=/\bfrom\s+["']\.{1,2}\//u,ae=(e,t)=>{let s;try{s=de(e,{withFileTypes:!0})}catch{return}for(const o of s){if(o.isDirectory()){ke.has(o.name)||ae(S(e,o.name),t);continue}const r=o.name.lastIndexOf(".");r!==-1&&Fe.has(o.name.slice(r))&&t.push(S(e,o.name))}},ct=(e,t,s)=>{const{info:o}=Oe(e,t,s);return{jurisdiction:o?.jurisdiction,needsD1:o?.hasD1GlobalTable??!1}};let $;const dt=e=>{const t=me(e);return $?.root!==t&&($={project:new z({compilerOptions:{allowJs:!0},skipAddingFilesFromTsConfig:!0}),root:t}),$.project},lt=(e,t,s)=>{e.getSourceFile(t)?.getFullText()!==s&&e.createSourceFile(t,s,{overwrite:!0})},ut=(e,t)=>{for(const s of e.getSourceFiles())t.has(s)||e.removeSourceFile(s)},pt=(e,t,s)=>{const o=S(e,s),r=dt(e),a=[],i=new Set,c=[],d=[],l=ve();let u=!1,v=!1;for(const f of t){const x=S(e,f);if(!F(x)||!k(x).isDirectory())continue;const O=[];ae(x,O);for(const C of O){i.add(C);const y=J(C,"utf8"),E=ee(C,o);u||=Be.test(y),v||=Ke.test(y),(ie.test(y)||y.includes(h)||E&&(Ee(y)||at.test(y)))&&(lt(r,C,y),a.push({file:C,inLunora:E}))}}ut(r,new Set(a.map(({file:f})=>r.getSourceFileOrThrow(f))));for(const{file:f,inLunora:x}of a)(x?c:d).push(be(r.getSourceFileOrThrow(f),l));const g=V(c),A=V([g,...d]),N=new Set([...A.valueImports,...A.dynamicImports]),T=Ne({contextReads:g.contextReads,valueImports:N});return{...Object.fromEntries([...te.map(f=>[se(f),T.has(f)]),...oe.map(([f,x])=>[f,N.has(x)])]),needsD1:v,usesEventLogClient:a.some(({file:f})=>ne(r.getSourceFileOrThrow(f))),usesRequestSecretTool:g.requestSecretTool,usesAi:T.has("ai")||u,usesBrowser:T.has("browser")||g.sandboxTools.usesSandboxBrowser,usesWorkerLoader:g.sandboxTools.usesSandboxLoader,scannedFiles:i}},mt=(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"\``)],ft=(e,t,s)=>[[e.usesAi,`AI (${p("ai")}, or env.AI is used)`],[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 — ${it}`],[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),gt=(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(...mt(o,r,a),...ft(s,i,t)),c},ht=(e,t)=>e.some(s=>s.binding==="SHARD_REGISTRY")||Z(t)&&F(S(t,"shardRegistry.ts")),xt=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},St=(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=K(i),d=c.text;if((ie.test(d)||d.includes(h))&&ne(o.createSourceFile(i,d,{overwrite:!0})))return!0;for(const l of xt(c)){const u=B(i,l);u!==void 0&&!t.has(u)&&!ee(u,s)&&r.push(u)}}return!1},yt=e=>!e.composed&&e.path!==void 0&&G(e.path,"EventLogDO",void 0,new Set),Lt=async e=>{await Ce;const t=e.schemaDir??"lunora",s=e.scanDirs??Me,o=()=>pt(e.projectRoot,s,t),{scannedFiles:r,...a}=e.cache===void 0?o():e.cache.memo(`capabilities:${e.projectRoot}:${t}:${s.join(",")}`,o),i=we(e.projectRoot);let c;i.composed?c=De(S(e.projectRoot,t,w)).map(W=>({binding:_e[W],className:W})):c=i.path===void 0?[]:Le(i.path);const d=ct(e.projectRoot,t,e.cache),l={...d,needsD1:a.needsD1||d.needsD1},u=L(i,Ie(e.projectRoot,t,e.cache).containers,"containers"),v=L(i,$e(e.projectRoot,t).workflows,"workflows"),g=L(i,Te(e.projectRoot,t).agents,"agents"),A=[...je(e.projectRoot,t).queues],{flags:N}=Pe(e.projectRoot,t),T=M(e.projectRoot,t,ye,Se),_=T.error===void 0?T.value:{hasFcm:!0,hasWebPush:!0},f=N?.provider==="flagship"&&N.mode==="binding"?N.bindingName:void 0,x=S(e.projectRoot,t,w),O=ht(c,x),C=yt(i),y=!i.composed&&i.path!==void 0&&St(i.path,r,x),E=gt(c,l,a,u,v,g);!i.composed&&Z(S(e.projectRoot,t,w))&&!c.some(I=>I.className==="LunoraDO")&&E.push("hint: durableObjects.merge is set, but the worker entry exports no LunoraDO — export one built with mergeDurableObjects, or the classes stay separate"),f!==void 0&&E.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${f}", app_id }) — the app_id can't be auto-provisioned`);const R=xe(e.projectRoot),ce=R.error===void 0?R.services:void 0;return R.error!==void 0&&E.push(`hint: lunora.config \`services\` not reconciled — ${R.error}`),E.push(...R.services.map(I=>`${I.binding} → ${I.worker} (lunora.config services.${I.name})`)),{...a,usesEventLogClient:a.usesEventLogClient||y,agents:g,containers:u,durableObjects:c,flagshipBinding:f,...l.jurisdiction===void 0?{}:{jurisdiction:l.jurisdiction},needsD1:l.needsD1,queues:A,services:ce,signals:E,usesFlags:N!==void 0,usesNotifyFcm:_?.hasFcm??!1,usesNotifyWebPush:_?.hasWebPush??!1,hostsEventLog:C,hostsShardRegistry:O,workflows:v}},$t=e=>[...re,...Ge].filter(([t,s])=>e[t]&&Ae[s]!==void 0).map(([,t])=>t);export{Lt as inferLunoraBindings,$t as secretSourcesFromBindings};
@@ -0,0 +1 @@
1
+ const r=e=>e.endsWith("S")?e.slice(0,-1):e,c=e=>e.replaceAll(/([a-z\d])([A-Z])/gu,"$1_$2").toUpperCase().split(/[_-]+/u).filter(s=>s.length>0),i=new Set(["CREDENTIAL","DSN","PASSPHRASE","PASSWD","PASSWORD","SECRET","TOKEN"]),p=["ACCESS_KEY","API_KEY","ENCRYPTION_KEY","PRIVATE_KEY","SIGNING_KEY"],u=new RegExp(`(?:${[...i,...p.map(e=>e.replaceAll("_",""))].join("|")})S?$`,"iu"),y=e=>c(e).some(s=>s==="PUBLIC"||s==="PUBLISHABLE"),E=e=>{if(y(e))return!1;const s=c(e);if(s.some(o=>i.has(r(o))))return!0;const t=r(s.join("_"));return p.some(o=>t===o||t.endsWith(`_${o}`))||u.test(e)},k=[{description:"Bearer token the local Lunora Studio uses to call the worker's admin endpoints (data browser, schema edits) in dev. Generate with: openssl rand -hex 32",docsUrl:"https://lunora.sh/docs/packages/studio",key:"LUNORA_ADMIN_TOKEN",placeholderValue:"replace-with-openssl-rand-hex-32"}],a="LUNORA_RELAY_SECRET",n="replace-with-openssl-rand-hex-32",_=new Set(["@lunora/do:shardRegistry","@lunora/replica:eventLog"]),m="@lunora/replica:eventLogClient",g=["BETTER_AUTH_SECRET","STORAGE_SIGNING_SECRET"],d={"@lunora/auth":[{description:"32-byte random secret used to sign sessions and tokens. Generate with: openssl rand -hex 32",docsUrl:"https://lunora.sh/docs/packages/auth#secrets",key:"AUTH_SECRET",placeholderValue:"replace-with-openssl-rand-hex-32"},{description:"Public base URL of your worker (used by better-auth for redirects and cookie domain). For local dev this is typically http://localhost:8787",docsUrl:"https://lunora.sh/docs/packages/auth#secrets",key:"AUTH_URL",placeholderValue:"http://localhost:8787"}],"@lunora/agent:requestSecretTool":[{description:"AES-256 key that seals secret values held for one agent step, base64 of 32 bytes. Generate with: openssl rand -base64 32. Rotate by moving the old value to LUNORA_SECRET_VALUE_KEY_PREVIOUS first.",docsUrl:"https://lunora.sh/docs/packages/agent#secret-values",key:"LUNORA_SECRET_VALUE_KEY",placeholderValue:"<your-base64-32-byte-key>"}],"@lunora/do:shardRegistry":[{description:"Signs every request to ShardRegistryDO, which refuses unsigned ones, and the shard-to-shard control channel. Set the same value on the worker and every Durable Object. Generate with: openssl rand -hex 32",docsUrl:"https://lunora.sh/docs/concepts/sharding#the-shard-registry",key:a,placeholderValue:n}],"@lunora/bindings/r2sql":[{description:"Cloudflare API token with R2 SQL read access, for `ctx.r2sql`. Create at https://dash.cloudflare.com/profile/api-tokens with the R2 SQL permission.",docsUrl:"https://lunora.sh/docs/packages/bindings#r2-sql",key:"R2_SQL_TOKEN",placeholderValue:"<your-r2-sql-api-token>"},{description:"Cloudflare account id the R2 SQL queries run against. Falls back to CLOUDFLARE_ACCOUNT_ID when unset.",docsUrl:"https://lunora.sh/docs/packages/bindings#r2-sql",key:"R2_SQL_ACCOUNT_ID",placeholderValue:"<your-cloudflare-account-id>"},{description:"Name of the R2 bucket holding the Iceberg tables `ctx.r2sql` queries.",docsUrl:"https://lunora.sh/docs/packages/bindings#r2-sql",key:"R2_SQL_BUCKET",placeholderValue:"<your-r2-sql-bucket>"}],"@lunora/mail":[{description:"Resend API key for sending transactional email via @lunora/mail. Obtain at https://resend.com/api-keys",docsUrl:"https://lunora.sh/docs/packages/mail#secrets",key:"RESEND_API_KEY",placeholderValue:"<your-resend-api-key>"}],"@lunora/replica:eventLog":[{description:"Signs every request to EventLogDO, which refuses unsigned ones, and the calls from the worker that reads or appends the log. Set the same value on the worker and every Durable Object. Generate with: openssl rand -hex 32",docsUrl:"https://lunora.sh/docs/packages/replica#eventlogdo",key:a,placeholderValue:n}],"@lunora/replica:eventLogClient":[{description:"The LUNORA_RELAY_SECRET of the worker that hosts EventLogDO. EventLogDOClient throws at construction without it, and the log refuses every request signed with another value.",docsUrl:"https://lunora.sh/docs/packages/replica#eventlogdo",key:a,placeholderValue:"<your-eventlogdo-host-relay-secret>"}],"@lunora/notify:fcm":[{description:"Firebase project id for FCM (HTTP v1) push. Found in the Firebase console project settings.",docsUrl:"https://lunora.sh/docs/packages/notify#fcm",key:"FCM_PROJECT_ID",placeholderValue:"<your-firebase-project-id>"},{description:"OAuth2 access token for FCM (HTTP v1). Convenient for dev but expires — in production supply a getAccessToken() in defineNotify instead. Obtain via the Google Cloud SDK / a service account.",docsUrl:"https://lunora.sh/docs/packages/notify#fcm",key:"FCM_ACCESS_TOKEN",placeholderValue:"<your-fcm-access-token>"}],"@lunora/notify:webPush":[{description:"Public VAPID key (base64url) for Web Push. Generate a keypair once with: npx web-push generate-vapid-keys — the public key is also shipped to the browser to subscribe.",docsUrl:"https://lunora.sh/docs/packages/notify#web-push",key:"VAPID_PUBLIC_KEY",placeholderValue:"<your-vapid-public-key>"},{description:"Private VAPID key (base64url) for Web Push — the application-server signing key. Generate with: npx web-push generate-vapid-keys",docsUrl:"https://lunora.sh/docs/packages/notify#web-push",key:"VAPID_PRIVATE_KEY",placeholderValue:"<your-vapid-private-key>"},{description:"VAPID `sub` contact — a mailto: or https: URL identifying the application server (e.g. mailto:you@example.com).",docsUrl:"https://lunora.sh/docs/packages/notify#web-push",key:"VAPID_SUBJECT",placeholderValue:"mailto:you@example.com"}],"@lunora/payment/autumn":[{description:"Autumn secret key (am_sk_…) for the Autumn payment adapter. Obtain at https://app.useautumn.com/dev",docsUrl:"https://lunora.sh/docs/packages/payment#autumn",key:"AUTUMN_SECRET_KEY",placeholderValue:"<your-autumn-secret-key>"},{description:"Autumn webhook signing secret for verifying Standard Webhooks event payloads. Obtain from your Autumn dashboard webhook settings.",docsUrl:"https://lunora.sh/docs/packages/payment#autumn",key:"AUTUMN_WEBHOOK_SECRET",placeholderValue:"<your-autumn-webhook-secret>"}],"@lunora/payment/creem":[{description:"Creem API key for the Creem payment adapter. Obtain at https://www.creem.io/dashboard/developers",docsUrl:"https://lunora.sh/docs/packages/payment#creem",key:"CREEM_API_KEY",placeholderValue:"<your-creem-api-key>"},{description:"Creem webhook signing secret for verifying the creem-signature header. Obtain from your Creem dashboard webhook settings.",docsUrl:"https://lunora.sh/docs/packages/payment#creem",key:"CREEM_WEBHOOK_SECRET",placeholderValue:"<your-creem-webhook-secret>"}],"@lunora/payment/dodopayments":[{description:"Dodo Payments API key (bearer token) for the Dodo Payments adapter. Obtain at https://app.dodopayments.com/developer/api-keys",docsUrl:"https://lunora.sh/docs/packages/payment#dodo-payments",key:"DODO_PAYMENTS_API_KEY",placeholderValue:"<your-dodo-payments-api-key>"},{description:"Dodo Payments webhook signing secret (whsec_…) for verifying event payloads. Obtain at https://app.dodopayments.com/developer/webhooks",docsUrl:"https://lunora.sh/docs/packages/payment#dodo-payments",key:"DODO_PAYMENTS_WEBHOOK_KEY",placeholderValue:"<your-dodo-payments-webhook-secret>"}],"@lunora/payment/polar":[{description:"Polar access token for the Polar payment adapter. Obtain at https://polar.sh/settings/tokens",docsUrl:"https://lunora.sh/docs/packages/payment#polar",key:"POLAR_ACCESS_TOKEN",placeholderValue:"<your-polar-access-token>"},{description:"Polar webhook secret for verifying event payloads from Polar. Obtain at https://polar.sh/settings/webhooks",docsUrl:"https://lunora.sh/docs/packages/payment#polar",key:"POLAR_WEBHOOK_SECRET",placeholderValue:"<your-polar-webhook-secret>"}],"@lunora/payment/stripe":[{description:"Stripe secret key (sk_test_…). Required when using the Stripe adapter. Obtain at https://dashboard.stripe.com/apikeys",docsUrl:"https://lunora.sh/docs/packages/payment#stripe",key:"STRIPE_SECRET_KEY",placeholderValue:"<your-stripe-secret-key>"},{description:"Stripe webhook signing secret (whsec_…) for verifying event payloads. Obtain at https://dashboard.stripe.com/webhooks",docsUrl:"https://lunora.sh/docs/packages/payment#stripe",key:"STRIPE_WEBHOOK_SECRET",placeholderValue:"<your-stripe-webhook-secret>"}]},l=new Set([...g,...[...k,...Object.values(d).flat()].filter(e=>E(e.key)&&!e.placeholderValue.startsWith("<")&&e.key!==a).map(e=>e.key)]),S=e=>e.includes(m)&&!e.some(t=>_.has(t))?l:new Set([...l,a]),b=e=>{const s=[];for(const t of e)for(const o of d[t]??[])s.some(h=>h.key===o.key)||s.push(o);return s};export{k as C,l as M,d as P,a as S,E as a,n as b,y as i,S as m,b as s};
@@ -1 +1 @@
1
- import{inferLunoraBindings as g}from"./inferLunoraBindings-B0-cxqXJ.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-DQTGPqcJ.mjs";import{reconcileWranglerBindings as $}from"./collectExportGaps-B6RMmmY0.mjs";import{reconcileWranglerCompatibilityDate as p}from"./reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{reconcileWranglerCrons as m,describePreservedCrons as w}from"./describePreservedCrons-C5KPuPy3.mjs";const j=async(i,t,a)=>{try{const n=await g({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-CzSFTzZh.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-DQTGPqcJ.mjs";import{reconcileWranglerBindings as $}from"./collectExportGaps-BqFUht1A.mjs";import{reconcileWranglerCompatibilityDate as p}from"./reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{reconcileWranglerCrons as m,describePreservedCrons as w}from"./describePreservedCrons-C5KPuPy3.mjs";const j=async(i,t,a)=>{try{const n=await g({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 +1 @@
1
- import{secretKindOf as s,redact as c}from"@lunora/codegen";import{i as a,a as f}from"./package-secrets-registry-CkRQL24p.mjs";import{isPlaceholderValue as d}from"./buildPackageSecretsBlock-DhsxZhTy.mjs";const u=8,h=(n,o)=>{if(n===void 0)return[];const r=[];for(const[i,e]of Object.entries(n)){if(typeof e!="string"||d(e)||a(i))continue;const t=s(e)??(f(i)&&e.length>=u?"secret_named_var":void 0);t!==void 0&&r.push({file:o,key:i,kind:t,preview:c(e)})}return r};export{h as scanWranglerVariablesForSecrets};
1
+ import{secretKindOf as s,redact as c}from"@lunora/codegen";import{i as a,a as f}from"./package-secrets-registry-UQ_uEAB_.mjs";import{isPlaceholderValue as d}from"./buildPackageSecretsBlock-GvaLgvFN.mjs";const u=8,h=(n,o)=>{if(n===void 0)return[];const r=[];for(const[i,e]of Object.entries(n)){if(typeof e!="string"||d(e)||a(i))continue;const t=s(e)??(f(i)&&e.length>=u?"secret_named_var":void 0);t!==void 0&&r.push({file:o,key:i,kind:t,preview:c(e)})}return r};export{h as scanWranglerVariablesForSecrets};
@@ -1 +1 @@
1
- import{relative as t}from"node:path";import{i as o}from"./guards-Buu_E7mP.mjs";import{findWranglerFile as u,readWranglerJsonc as d}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{scanWranglerVariablesForSecrets as l}from"./scanWranglerVariablesForSecrets--xUsy1Lq.mjs";const n=(s,e)=>{const r=s?.producers;return(Array.isArray(r)?r:[]).flatMap(i=>o(i)&&typeof i.binding=="string"&&typeof i.queue=="string"?[{binding:i.binding,queue:i.queue,...e===void 0?{}:{env:e}}]:[])},v=s=>{const e=u(s),r=e===void 0?void 0:d(e).parsed;return e===void 0||r===void 0?{wranglerQueueProducers:[],wranglerVariables:[]}:{wranglerQueueProducers:[...n(r.queues),...Object.entries(r.env??{}).flatMap(([a,i])=>n(i?.queues,a))],wranglerVariables:l(o(r.vars)?r.vars:void 0,t(s,e))}};export{v as wranglerCodegenInputs};
1
+ import{relative as t}from"node:path";import{i as o}from"./guards-Buu_E7mP.mjs";import{findWranglerFile as u,readWranglerJsonc as d}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{scanWranglerVariablesForSecrets as l}from"./scanWranglerVariablesForSecrets-DRBYlMYb.mjs";const n=(s,e)=>{const r=s?.producers;return(Array.isArray(r)?r:[]).flatMap(i=>o(i)&&typeof i.binding=="string"&&typeof i.queue=="string"?[{binding:i.binding,queue:i.queue,...e===void 0?{}:{env:e}}]:[])},v=s=>{const e=u(s),r=e===void 0?void 0:d(e).parsed;return e===void 0||r===void 0?{wranglerQueueProducers:[],wranglerVariables:[]}:{wranglerQueueProducers:[...n(r.queues),...Object.entries(r.env??{}).flatMap(([a,i])=>n(i?.queues,a))],wranglerVariables:l(o(r.vars)?r.vars:void 0,t(s,e))}};export{v as wranglerCodegenInputs};
@@ -1,3 +1,3 @@
1
- import{existsSync as s,statSync as a,writeFileSync as p,renameSync as d,rmSync as g}from"node:fs";import{join as m}from"node:path";import{runCodegen as f,CodegenDiagnosticError as j,refreshCodegenProject as u,createCodegenProject as y,findTsconfig as S,tsconfigFingerprint as C,projectConfigCandidatePaths as h}from"@lunora/codegen";import{wranglerCodegenInputs as l}from"./wranglerCodegenInputs-C02zHFYw.mjs";import{isCodegenDisabled as w,CODEGEN_ENV as n}from"./BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{recordStudioWrite as P,STUDIO_WRITE_TEMP_SUFFIX as $}from"./STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs";const F=o=>({apiSpec:o.apiSpec,lazyFunctions:o.lazyFunctions,lunoraDirectory:o.schemaDirectory??"lunora",projectRoot:o.projectRoot,...l(o.projectRoot)});let r;const c=o=>{const t=a(o);return`${o}:${String(t.mtimeMs)}:${String(t.size)}`},E=o=>{const t=S(o);return[t===void 0?"":`${c(t)}
1
+ import{existsSync as s,statSync as a,writeFileSync as p,renameSync as d,rmSync as g}from"node:fs";import{join as m}from"node:path";import{runCodegen as f,CodegenDiagnosticError as j,refreshCodegenProject as u,createCodegenProject as y,findTsconfig as S,tsconfigFingerprint as C,projectConfigCandidatePaths as h}from"@lunora/codegen";import{wranglerCodegenInputs as l}from"./wranglerCodegenInputs-BZamZrPz.mjs";import{isCodegenDisabled as w,CODEGEN_ENV as n}from"./BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{recordStudioWrite as P,STUDIO_WRITE_TEMP_SUFFIX as $}from"./STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs";const F=o=>({apiSpec:o.apiSpec,lazyFunctions:o.lazyFunctions,lunoraDirectory:o.schemaDirectory??"lunora",projectRoot:o.projectRoot,...l(o.projectRoot)});let r;const c=o=>{const t=a(o);return`${o}:${String(t.mtimeMs)}:${String(t.size)}`},E=o=>{const t=S(o);return[t===void 0?"":`${c(t)}
2
2
  ${C(t)}`,...h(o).filter(e=>s(e)).map(e=>c(e))].join(`
3
3
  `)},R=o=>{const t=E(o);return r?.lunoraDirectory===o&&r.key===t?(u(r.project,o),r.project):(r={key:t,lunoraDirectory:o,project:y(o)},r.project)},x=(o,t)=>{if(w(process.env[n]))return[`codegen is off (${n}=0 / \`lunora dev --no-codegen\`) — the source was written but \`_generated/\` was NOT regenerated`];try{const e=m(o.projectRoot,o.schemaDirectory??"lunora");f({...F(o),project:R(e)})}catch(e){if(r=void 0,e instanceof j)return[e.message];throw e}return P(t.path,t.text),[]},z=(o,t)=>{const e=`${o}${$}`;try{p(e,t,"utf8"),d(e,o)}catch(i){throw g(e,{force:!0}),i}};export{x as r,z as w};
@@ -1 +1 @@
1
- import{devVariablesStamp as t,parseDevVariable as r,resolveAdminToken as a}from"../packem_shared/devVariablesStamp-Cetr3qFz.mjs";import{applyStudioAssetCache as d,sendStudioDocument as n}from"../packem_shared/applyStudioAssetCache-DHQEJuuv.mjs";import{assetContentType as i,isStandaloneModulePath as l,loadStudioAssets as m,readStandaloneAsset as p,resolveStandaloneDirectory as u,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-D8Ed88Sq.mjs";import{POLICY_SCAFFOLD_ENDPOINT as R,handlePolicyScaffoldRequest as N}from"../packem_shared/POLICY_SCAFFOLD_ENDPOINT-3Rxi46n7.mjs";import{default as H}from"../packem_shared/renderStudioHtml-ByowDtMl.mjs";import{SCHEMA_EDIT_ENDPOINT as v,handleSchemaEditRequest as F}from"../packem_shared/SCHEMA_EDIT_ENDPOINT-CkMPlCce.mjs";import{SEED_ENDPOINT as U,handleSeedRequest as b}from"../packem_shared/SEED_ENDPOINT-C1fhrehH.mjs";import{serveJsonHandler as y}from"../packem_shared/serveJsonHandler-B8_GE6QC.mjs";import{STUDIO_WRITE_TEMP_SUFFIX as W,consumeStudioWrite as k}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,W as STUDIO_WRITE_TEMP_SUFFIX,d as applyStudioAssetCache,i as assetContentType,k 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,l as isStandaloneModulePath,m as loadStudioAssets,r as parseDevVariable,p as readStandaloneAsset,H as renderStudioHtml,I as requestPathname,a as resolveAdminToken,u as resolveStandaloneDirectory,n as sendStudioDocument,y 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{applyStudioAssetCache as d,sendStudioDocument as n}from"../packem_shared/applyStudioAssetCache-DHQEJuuv.mjs";import{assetContentType as i,isStandaloneModulePath as l,loadStudioAssets as m,readStandaloneAsset as p,resolveStandaloneDirectory as u,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-DbOwZDBM.mjs";import{POLICY_SCAFFOLD_ENDPOINT as R,handlePolicyScaffoldRequest as N}from"../packem_shared/POLICY_SCAFFOLD_ENDPOINT-D5PpQPkf.mjs";import{default as H}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 y}from"../packem_shared/serveJsonHandler-B8_GE6QC.mjs";import{STUDIO_WRITE_TEMP_SUFFIX as W,consumeStudioWrite as k}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,W as STUDIO_WRITE_TEMP_SUFFIX,d as applyStudioAssetCache,i as assetContentType,k 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,l as isStandaloneModulePath,m as loadStudioAssets,r as parseDevVariable,p as readStandaloneAsset,H as renderStudioHtml,I as requestPathname,a as resolveAdminToken,u as resolveStandaloneDirectory,n as sendStudioDocument,y as serveJsonHandler,T as studioAssetsStamp,O as studioMountPath,X as transportRejectionReason};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/config",
3
- "version": "1.0.0-alpha.412",
3
+ "version": "1.0.0-alpha.414",
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.358",
61
+ "@lunora/codegen": "1.0.0-alpha.360",
62
62
  "@lunora/container": "1.0.0-alpha.93",
63
63
  "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
64
64
  "@lunora/seed": "1.0.0-alpha.258",
@@ -1,19 +0,0 @@
1
- import{randomBytes as v}from"node:crypto";import{existsSync as m,readFileSync as y,writeFileSync as h,linkSync as b,rmSync as g,renameSync as R,statSync as M}from"node:fs";import{join as p}from"node:path";import{LunoraError as F}from"@lunora/errors";import{DEV_VARS_FILE as u,DEV_VARS_EXAMPLE_FILE as f,parseDevVariableLine as E,parseDevVariableEntries as S,DEV_VARS_NEWLINE as C}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{C as V,S as j,b as I,M as N,s as z}from"./package-secrets-registry-CkRQL24p.mjs";const D=e=>[...V,...z(e)],$=32,B=["replace","openssl","changeme","change-me","change_me","change-this","change_this","your-","your_","example","placeholder","todo","fill-me","fill_me","fill-in","fill_in","xxx"],W=/[.*+?^${}()|[\]\\]/gu,O=/[a-z0-9]$/u,X=e=>{const t=e.trim().toLowerCase();return t===""||t.startsWith("<")&&t.endsWith(">")?!0:B.some(r=>{const s=r.replaceAll(W,String.raw`\$&`),o=O.test(r)?`(^|[^a-z0-9])${s}([^a-z0-9]|$)`:`(^|[^a-z0-9])${s}`;return new RegExp(o,"u").test(t)})},x=e=>v(e).toString("hex"),Y=(e,t)=>e===j?t.trim()===""||t===I:N.has(e),P=(e,t,r)=>Y(e,t)&&X(t)?r($):void 0,de=(e=x)=>e($),H=(e,t,r)=>e.split(C).map(s=>{const n=E(s),o=n?P(n.key,n.value,t):void 0;return!n||o===void 0?s:(r.push(n.key),`${n.key}="${o}"`)}),G=e=>{if(e.devVarsExists)return{status:"exists"};if(e.exampleContent===void 0)return{status:"no-example"};const t=[];return{content:H(e.exampleContent,e.randomHex??x,t).join(`
2
- `),generatedKeys:t,status:"generate"}},U=e=>e.includes('"')||e.includes("\\")?"":e.replaceAll("\r",String.raw`\r`).replaceAll(`
3
- `,String.raw`\n`),w=e=>{const t=e.randomHex??x,r=new Set(S(e.existingContent).map(d=>d.key)),s=[],n=[],o=[];for(const d of e.exampleContent.split(C)){const i=E(d);if(!i||r.has(i.key))continue;const a=P(i.key,i.value,t);o.push(i.key),a===void 0?s.push(`${i.key}="${U(i.value)}"`):(n.push(i.key),s.push(`${i.key}="${a}"`))}return{additions:s,generatedKeys:n,missingKeys:o}},_=e=>e.length>0?` (generated ${e.join(", ")})`:"",L=e=>`${e}.tmp-${String(process.pid)}`,K=(e,t,r={})=>{const s=L(e);try{h(s,t,{encoding:"utf8",...r}),R(s,e)}catch(n){throw g(s,{force:!0}),n}},q=(e,t)=>{try{return h(e,t,{encoding:"utf8",flag:"wx",mode:384}),!0}catch(r){if(r.code==="EEXIST")return!1;throw r}},T=(e,t)=>{const r=L(e);try{h(r,t,{encoding:"utf8",flag:"wx",mode:384});try{return b(r,e),!0}catch(s){const{code:n}=s;if(n==="EEXIST")return!1;if(n==="EPERM"||n==="ENOTSUP")return q(e,t);throw s}}finally{g(r,{force:!0})}},le=(e,t)=>{K(e,t,{mode:384})},k=5,A=e=>{try{const t=M(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}},J=(e,t)=>e===void 0||t===void 0?!1:e.mtimeMs===t.mtimeMs&&e.size===t.size,Q=(e,t)=>{for(let r=0;r<k;r+=1){const s=A(e),n=y(e,"utf8"),o=t(n);if(o.length===0)return[];const d=n.length>0&&!n.endsWith(`
4
- `)?`
5
- `:"",i=`${n}${d}${o.join(`
6
- `)}
7
- `,a=`${e}.tmp-${String(process.pid)}-${v(6).toString("hex")}`;try{h(a,i,{encoding:"utf8",mode:384});const c=A(e);if(!J(s,c)){g(a,{force:!0});continue}return R(a,e),o}catch(c){throw g(a,{force:!0}),c}}throw new F("INTERNAL",`Failed to append to ${e} after ${String(k)} attempts — a concurrent writer kept winning the race.`)},ue=async e=>{const t=p(e.cwd,u),r=p(e.cwd,f);if(!m(r))return{addedKeys:[],generatedKeys:[],status:"no-example"};const s=y(r,"utf8");if(!m(t)){const l=G({devVarsExists:!1,exampleContent:s,randomHex:e.randomHex});return l.status!=="generate"?{addedKeys:[],generatedKeys:[],status:"no-example"}:e.yes===!0||await e.confirm(`No ${u} found. Generate it from ${f} (secrets auto-filled)?`)?T(t,l.content)?(e.info(`Created ${u}${_(l.generatedKeys)}.`),{addedKeys:[],generatedKeys:l.generatedKeys,status:"generated"}):{addedKeys:[],generatedKeys:[],status:"skipped-exists"}:(e.info(`Skipped — copy ${f} to ${u} and fill it in when you're ready.`),{addedKeys:[],generatedKeys:[],status:"declined"})}const n=w({existingContent:y(t,"utf8"),exampleContent:s,randomHex:e.randomHex});if(n.missingKeys.length===0)return{addedKeys:[],generatedKeys:[],status:"exists"};const o=n.missingKeys.join(", ");if(!(e.yes===!0||await e.confirm(`${u} is missing ${String(n.missingKeys.length)} key(s) from ${f} (${o}). Add them?`)))return e.info(`Skipped — add ${o} to ${u} when you're ready.`),{addedKeys:[],generatedKeys:[],status:"declined"};const a=Q(t,l=>w({existingContent:l,exampleContent:s,randomHex:e.randomHex}).additions).map(l=>E(l)?.key).filter(l=>l!==void 0);if(a.length===0)return{addedKeys:[],generatedKeys:[],status:"exists"};const c=n.generatedKeys.filter(l=>a.includes(l));return e.info(`Updated ${u} — added ${a.join(", ")}${_(c)}.`),{addedKeys:a,generatedKeys:c,status:"augmented"}},Z=e=>[`# ${e.description}`,`# Docs: ${e.docsUrl}`,`${e.key}="${e.placeholderValue}"`].join(`
8
- `),ee=(e,t)=>{const r=D(e).filter(s=>!t.has(s.key));return r.length===0?"":r.map(s=>Z(s)).join(`
9
-
10
- `)},fe=(e,t)=>{const r=p(e,f),s=m(r)?y(r,"utf8"):"",n=new Set(S(s).map(i=>i.key)),o=ee(t,n);if(o==="")return[];const d=s.length>0&&!s.endsWith(`
11
- `)?`
12
- `:"";return K(r,`${s}${d}
13
- ${o}
14
- `),D(t).filter(i=>!n.has(i.key)).map(i=>i.key)},te=e=>{const t=e.randomHex??x,r=[],s=H(e.existingContent,t,r),n=new Set(S(e.existingContent).map(c=>c.key)),o=[],d=[];for(const c of V)n.has(c.key)||(o.push(c.key),d.push(`# ${c.description}`,`${c.key}="${t($)}"`));const i=s.join(`
15
- `);if(d.length===0)return{addedKeys:o,content:i,filledKeys:r};const a=i===""||i.endsWith(`
16
- `)?"":`
17
- `;return{addedKeys:o,content:`${i}${a}${d.join(`
18
- `)}
19
- `,filledKeys:r}},ye=e=>{const t=p(e.cwd,u),r=m(t),s=r?y(t,"utf8"):"",n=te({existingContent:s,randomHex:e.randomHex});if(n.filledKeys.length===0&&n.addedKeys.length===0)return{addedKeys:[],filledKeys:[],status:"unchanged"};if(r)K(t,n.content,{mode:384});else if(!T(t,n.content))return{addedKeys:[],filledKeys:[],status:"unchanged"};const o=[...n.filledKeys,...n.addedKeys];return e.info?.(`Generated ${String(o.length)} dev secret(s) in ${u}: ${o.join(", ")}`),{addedKeys:n.addedKeys,filledKeys:n.filledKeys,status:r?"filled":"created"}};export{ee as buildPackageSecretsBlock,ue as ensureDevVariables,fe as ensureDevVarsExample,ye as fillDevSecrets,de as generateSecretValue,Y as isMintableSecretKey,X as isPlaceholderValue,te as planDevSecretsFill,w as planDevVariablesAugment,G as planDevVariablesScaffold,D as requiredSecrets,le as writeDevVariablesFileAtomically};
@@ -1 +0,0 @@
1
- import{existsSync as d}from"node:fs";import{discoverSchema as l,isHyperdriveGlobalTable as f,isD1GlobalTable as b}from"@lunora/codegen";import{Project as u}from"ts-morph";import{join as p}from"node:path";const a=e=>{if(e?.kind==="optional")return a(e.inner);if(e?.kind==="union"){const s=new Set((e.members??[]).filter(i=>i.kind!=="null").map(i=>a(i)));return s.size===1?[...s][0]:e.kind}return e?.kind},m=(e,s)=>{const i=p(e,s,"schema.ts");if(!d(i))return{info:void 0};try{const o=new u({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!1}),r=l(o,i,e),c=n=>r.tables.find(t=>t.name===n)?.shape??{};return{info:{hasD1GlobalTable:r.tables.some(n=>b(n)),hasHyperdriveGlobalTable:r.tables.some(n=>f(n)),...r.jurisdiction===void 0?{}:{jurisdiction:r.jurisdiction},vectorIndexNames:r.vectorIndexes.map(n=>n.name),vectorMetadata:r.vectorIndexes.flatMap(n=>(n.metadata??[]).map(t=>({index:n.name,kind:a(c(n.table)[t]),property:t})))}}}catch(o){return{error:o instanceof Error?o.message:String(o),info:void 0}}},I=(e,s,i)=>i===void 0?m(e,s):i.memo(`schema:${e}:${s}`,()=>m(e,s));export{I as discoverSchemaInfo};
@@ -1 +0,0 @@
1
- import{existsSync as $,statSync as L,readFileSync as B,readdirSync as G}from"node:fs";import{relative as W,sep as q,isAbsolute as Y,join as S,resolve as K}from"node:path";import{discoverFlags as U,FLAGS_FILENAME as M,discoverQueues as H,CAPABILITY_PROBES as D,readServiceBindings as V,discoverNotifyChannels as X,NOTIFY_FILENAME as Q,createTargetScope as J,mayReadCapabilityContext as z,sourceCapabilitySignals as Z,foldCapabilitySignals as w,capabilitiesUsedBy as ee}from"@lunora/codegen";import{init as se}from"es-module-lexer";import{Project as te}from"ts-morph";import{discoverAgentInfo as re}from"./discoverAgentInfo-pqFMJBtJ.mjs";import{discoverContainerInfo as oe}from"./discoverContainerInfo-DzXr7Vm3.mjs";import{escapeRegExp as ne}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{d as T}from"./discover-info-DC2MrAIM.mjs";import{P as ae}from"./package-secrets-registry-CkRQL24p.mjs";import{discoverSchemaInfo as ie}from"./discoverSchemaInfo-BBRlXZop.mjs";import{resolveWorkerEntry as ce,composedEntryDurableObjects as de,GENERATED_DIRECTORY as A,DURABLE_OBJECT_BINDINGS as ue,detectExportedDurableObjects as le,detectClassExports as x,isMergedProject as N}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{discoverWorkflowInfo as me}from"./discoverWorkflowInfo-zW7Tt0Tn.mjs";const pe=(e,s)=>{const{error:t,value:r}=T(e,s,M,U);return t===void 0?{flags:r}:{error:t}},he=(e,s)=>{const t=W(s,e);return t!==""&&t!==".."&&!t.startsWith(`..${q}`)&&!Y(t)},fe=(e,s)=>{const{error:t,value:r}=T(e,s,void 0,H);return t===void 0?{queues:r??[]}:{error:t,queues:[]}},ge=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),Se=new Set([".git",".lunora-cache",".wrangler","dist",A,"node_modules"]),ye=["lunora","src"],be=/\benv\s*\.\s*DB\b/,ve=/\benv\s*\.\s*AI\b/,O=["ai","aiSearch","analytics","analyticsSql","artifacts","browser","hyperdrive","images","kv","mail","notify","payments","pipelines","r2sql","scheduler","storage","x402"],P=e=>`uses${e.charAt(0).toUpperCase()}${e.slice(1)}`,j=[["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"]],F=[...O.map(e=>[P(e),D[e].moduleSpecifier]),...j].toSorted(([e],[s])=>e.localeCompare(s)),Ee=[["usesNotifyFcm","@lunora/notify:fcm"],["usesNotifyWebPush","@lunora/notify:webPush"],["hostsShardRegistry","@lunora/do:shardRegistry"],["usesRequestSecretTool","@lunora/agent:requestSecretTool"]],Re=["@lunora/agent","@lunora/agent/sandbox"],Ae=new RegExp(String.raw`["'\x60](?:${[...F.map(([,e])=>e),...Re].map(e=>ne(e)).join("|")})["'\x60]`,"u"),n=e=>{const{contextProperty:s,moduleSpecifier:t}=D[e];return s===void 0?`${t} is imported`:`${t} is imported or ctx.${s} is read`},_e="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",xe=/\bfrom\s+["']\.{1,2}\//u,k=(e,s)=>{let t;try{t=G(e,{withFileTypes:!0})}catch{return}for(const r of t){if(r.isDirectory()){Se.has(r.name)||k(S(e,r.name),s);continue}const o=r.name.lastIndexOf(".");o!==-1&&ge.has(r.name.slice(o))&&s.push(S(e,r.name))}},Ie=(e,s,t)=>{const{info:r}=ie(e,s,t);return{jurisdiction:r?.jurisdiction,needsD1:r?.hasD1GlobalTable??!1}};let I;const Te=e=>{const s=K(e);return I?.root!==s&&(I={project:new te({compilerOptions:{allowJs:!0},skipAddingFilesFromTsConfig:!0}),root:s}),I.project},Ce=(e,s,t)=>{e.getSourceFile(s)?.getFullText()!==t&&e.createSourceFile(s,t,{overwrite:!0})},we=(e,s)=>{for(const t of e.getSourceFiles())s.has(t)||e.removeSourceFile(t)},$e=(e,s,t)=>{const r=S(e,t),o=Te(e),i=[],c=[],l=[],d=J();let v=!1,E=!1;for(const a of s){const m=S(e,a);if(!$(m)||!L(m).isDirectory())continue;const f=[];k(m,f);for(const u of f){const g=B(u,"utf8"),p=he(u,r);v||=ve.test(g),E||=be.test(g),(Ae.test(g)||p&&(z(g)||xe.test(g)))&&(Ce(o,u,g),i.push({file:u,inLunora:p}))}}we(o,new Set(i.map(({file:a})=>o.getSourceFileOrThrow(a))));for(const{file:a,inLunora:m}of i)(m?c:l).push(Z(o.getSourceFileOrThrow(a),d));const h=w(c),R=w([h,...l]),y=new Set([...R.valueImports,...R.dynamicImports]),b=ee({contextReads:h.contextReads,valueImports:y});return{...Object.fromEntries([...O.map(a=>[P(a),b.has(a)]),...j.map(([a,m])=>[a,y.has(m)])]),needsD1:E,usesRequestSecretTool:h.requestSecretTool,usesAi:b.has("ai")||v,usesBrowser:b.has("browser")||h.sandboxTools.usesSandboxBrowser,usesWorkerLoader:h.sandboxTools.usesSandboxLoader}},De=(e,s,t)=>[...e.map(r=>r.exported?`${r.bindingName}/${r.className} (container "${r.exportName}" declared and exported)`:`hint: container "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...s.map(r=>r.exported?`exports.${r.className} (workflow "${r.exportName}" declared and exported)`:`hint: workflow "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...t.map(r=>r.exported?`exports.${r.className} (agent "${r.exportName}" declared and exported)`:`hint: agent "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],Ne=(e,s,t)=>[[e.usesAi,`AI (${n("ai")}, or env.AI is used)`],[e.usesAuth&&!s.has("SessionDO"),"hint: @lunora/auth is imported; its tables are D1-backed by default. For DO-backed auth (what @better-auth/scim needs), pass `namespace` to .auth() and export the generated auth DO class"],[e.usesScheduler&&!s.has("SchedulerDO"),`hint: ${n("scheduler")}, but no SchedulerDO is exported by the worker entry`],[e.usesStorage,`hint: ${n("storage")}; add an r2_buckets binding (bucket binding names are user-defined)`],[e.usesMail,`hint: ${n("mail")}; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)`],[e.usesPayments,`hint: ${n("payments")}; set the provider secrets in .dev.vars — ${_e}`],[e.usesBrowser,`browser (${n("browser")}, or a sandbox browserTool imported in lunora/) — self-describing { binding: BROWSER }`],[e.usesImages,`images (${n("images")}) — self-describing { binding: IMAGES }`],[e.usesAnalytics,`analytics_engine_datasets (${n("analytics")}) — self-describing { binding: ANALYTICS, dataset }`],[e.usesWorkerLoader,"worker_loaders (jsCodeTool imported in lunora/) — self-describing { binding: LOADER }"],[e.usesAiSearch,`ai_search_namespaces (${n("aiSearch")}) — self-describing { binding: AI_SEARCH, namespace: "default" }; remote-only, so \`lunora dev\` reaches the deployed AI Search service`],[e.usesAnalyticsSql,`analytics (${n("analyticsSql")}) — self-describing { binding: ANALYTICS_SQL }; needs wrangler >= 4.145.0, and is remote-only, so \`lunora dev\` queries the account's live analytics`],[e.usesKv,t.jurisdiction===void 0?`kv_namespaces (${n("kv")}) — { binding: KV } with no id; wrangler creates the namespace on the first deploy`:`hint: ${n("kv")} and the schema pins "${t.jurisdiction}"; create the namespace with --jurisdiction ${t.jurisdiction} and add a kv_namespaces binding ({ binding, id })`],[e.usesHyperdrive,`hyperdrive (${n("hyperdrive")}) — { binding: HYPERDRIVE } with a placeholder id; dev uses an embedded Postgres and \`lunora deploy\` creates the config`],[e.usesPipelines,`hint: ${n("pipelines")}; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, stream }) — the pipeline resource can't be auto-provisioned`],[e.usesArtifacts,t.jurisdiction===void 0?`artifacts (${n("artifacts")}) — { binding: ARTIFACTS, namespace }`:`hint: ${n("artifacts")}; the schema pins data to "${t.jurisdiction}", so create the namespace in that jurisdiction first and add { binding: ARTIFACTS, namespace } yourself — \`lunora deploy\` then checks it (a first create() in dev would make it unrestricted)`],[e.usesX402Charge,"hint: @lunora/x402/charge is imported; set the recipient wallet address as a [vars] entry (the var name is yours to choose) and pass it to the charge config — the x402 facilitator settles USDC to that address"],[e.usesX402,`hint: ${n("x402")} (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding for the agent wallet key (name it to match signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars, so the key can't be auto-provisioned`]].filter(([o])=>o).map(([,o])=>o),Oe=(e,s,t,r=[],o=[],i=[])=>{const c=new Set(e.map(d=>d.className)),l=e.map(d=>`${d.binding}/${d.className} (exported by worker entry)`);return s.needsD1&&l.push("DB (.global() table declared)"),l.push(...De(r,o,i),...Ne(t,c,s)),l},Pe=(e,s)=>e.some(t=>t.binding==="SHARD_REGISTRY")||N(s)&&$(S(s,"shardRegistry.ts")),Ve=async e=>{await se;const s=e.schemaDir??"lunora",t=e.scanDirs??ye,r=()=>$e(e.projectRoot,t,s),o=e.cache===void 0?r():e.cache.memo(`capabilities:${e.projectRoot}:${s}:${t.join(",")}`,r),i=ce(e.projectRoot);let c;i.composed?c=de(S(e.projectRoot,s,A)).map(C=>({binding:ue[C],className:C})):c=i.path===void 0?[]:le(i.path);const l=Ie(e.projectRoot,s,e.cache),d={...l,needsD1:o.needsD1||l.needsD1},v=x(i,oe(e.projectRoot,s,e.cache).containers,"containers"),E=x(i,me(e.projectRoot,s).workflows,"workflows"),h=x(i,re(e.projectRoot,s).agents,"agents"),R=[...fe(e.projectRoot,s).queues],{flags:y}=pe(e.projectRoot,s),b=T(e.projectRoot,s,Q,X),_=b.error===void 0?b.value:{hasFcm:!0,hasWebPush:!0},a=y?.provider==="flagship"&&y.mode==="binding"?y.bindingName:void 0,m=Pe(c,S(e.projectRoot,s,A)),f=Oe(c,d,o,v,E,h);!i.composed&&N(S(e.projectRoot,s,A))&&!c.some(p=>p.className==="LunoraDO")&&f.push("hint: durableObjects.merge is set, but the worker entry exports no LunoraDO — export one built with mergeDurableObjects, or the classes stay separate"),a!==void 0&&f.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${a}", app_id }) — the app_id can't be auto-provisioned`);const u=V(e.projectRoot),g=u.error===void 0?u.services:void 0;return u.error!==void 0&&f.push(`hint: lunora.config \`services\` not reconciled — ${u.error}`),f.push(...u.services.map(p=>`${p.binding} → ${p.worker} (lunora.config services.${p.name})`)),{...o,agents:h,containers:v,durableObjects:c,flagshipBinding:a,...d.jurisdiction===void 0?{}:{jurisdiction:d.jurisdiction},needsD1:d.needsD1,queues:R,services:g,signals:f,usesFlags:y!==void 0,usesNotifyFcm:_?.hasFcm??!1,usesNotifyWebPush:_?.hasWebPush??!1,hostsShardRegistry:m,workflows:E}},Xe=e=>[...F,...Ee].filter(([s,t])=>e[s]&&ae[t]!==void 0).map(([,s])=>s);export{Ve as inferLunoraBindings,Xe as secretSourcesFromBindings};
@@ -1 +0,0 @@
1
- const r=e=>e.endsWith("S")?e.slice(0,-1):e,c=e=>e.replaceAll(/([a-z\d])([A-Z])/gu,"$1_$2").toUpperCase().split(/[_-]+/u).filter(s=>s.length>0),l=new Set(["CREDENTIAL","DSN","PASSPHRASE","PASSWD","PASSWORD","SECRET","TOKEN"]),i=["ACCESS_KEY","API_KEY","ENCRYPTION_KEY","PRIVATE_KEY","SIGNING_KEY"],d=new RegExp(`(?:${[...l,...i.map(e=>e.replaceAll("_",""))].join("|")})S?$`,"iu"),h=e=>c(e).some(s=>s==="PUBLIC"||s==="PUBLISHABLE"),u=e=>{if(h(e))return!1;const s=c(e);if(s.some(o=>l.has(r(o))))return!0;const t=r(s.join("_"));return i.some(o=>t===o||t.endsWith(`_${o}`))||d.test(e)},y=[{description:"Bearer token the local Lunora Studio uses to call the worker's admin endpoints (data browser, schema edits) in dev. Generate with: openssl rand -hex 32",docsUrl:"https://lunora.sh/docs/packages/studio",key:"LUNORA_ADMIN_TOKEN",placeholderValue:"replace-with-openssl-rand-hex-32"}],a="LUNORA_RELAY_SECRET",E="replace-with-openssl-rand-hex-32",k="@lunora/do:shardRegistry",_=["BETTER_AUTH_SECRET","STORAGE_SIGNING_SECRET"],p={"@lunora/auth":[{description:"32-byte random secret used to sign sessions and tokens. Generate with: openssl rand -hex 32",docsUrl:"https://lunora.sh/docs/packages/auth#secrets",key:"AUTH_SECRET",placeholderValue:"replace-with-openssl-rand-hex-32"},{description:"Public base URL of your worker (used by better-auth for redirects and cookie domain). For local dev this is typically http://localhost:8787",docsUrl:"https://lunora.sh/docs/packages/auth#secrets",key:"AUTH_URL",placeholderValue:"http://localhost:8787"}],"@lunora/agent:requestSecretTool":[{description:"AES-256 key that seals secret values held for one agent step, base64 of 32 bytes. Generate with: openssl rand -base64 32. Rotate by moving the old value to LUNORA_SECRET_VALUE_KEY_PREVIOUS first.",docsUrl:"https://lunora.sh/docs/packages/agent#secret-values",key:"LUNORA_SECRET_VALUE_KEY",placeholderValue:"<your-base64-32-byte-key>"}],"@lunora/do:shardRegistry":[{description:"Signs every request to ShardRegistryDO, which refuses unsigned ones, and the shard-to-shard control channel. Set the same value on the worker and every Durable Object. Generate with: openssl rand -hex 32",docsUrl:"https://lunora.sh/docs/concepts/sharding#the-shard-registry",key:a,placeholderValue:E}],"@lunora/bindings/r2sql":[{description:"Cloudflare API token with R2 SQL read access, for `ctx.r2sql`. Create at https://dash.cloudflare.com/profile/api-tokens with the R2 SQL permission.",docsUrl:"https://lunora.sh/docs/packages/bindings#r2-sql",key:"R2_SQL_TOKEN",placeholderValue:"<your-r2-sql-api-token>"},{description:"Cloudflare account id the R2 SQL queries run against. Falls back to CLOUDFLARE_ACCOUNT_ID when unset.",docsUrl:"https://lunora.sh/docs/packages/bindings#r2-sql",key:"R2_SQL_ACCOUNT_ID",placeholderValue:"<your-cloudflare-account-id>"},{description:"Name of the R2 bucket holding the Iceberg tables `ctx.r2sql` queries.",docsUrl:"https://lunora.sh/docs/packages/bindings#r2-sql",key:"R2_SQL_BUCKET",placeholderValue:"<your-r2-sql-bucket>"}],"@lunora/mail":[{description:"Resend API key for sending transactional email via @lunora/mail. Obtain at https://resend.com/api-keys",docsUrl:"https://lunora.sh/docs/packages/mail#secrets",key:"RESEND_API_KEY",placeholderValue:"<your-resend-api-key>"}],"@lunora/notify:fcm":[{description:"Firebase project id for FCM (HTTP v1) push. Found in the Firebase console project settings.",docsUrl:"https://lunora.sh/docs/packages/notify#fcm",key:"FCM_PROJECT_ID",placeholderValue:"<your-firebase-project-id>"},{description:"OAuth2 access token for FCM (HTTP v1). Convenient for dev but expires — in production supply a getAccessToken() in defineNotify instead. Obtain via the Google Cloud SDK / a service account.",docsUrl:"https://lunora.sh/docs/packages/notify#fcm",key:"FCM_ACCESS_TOKEN",placeholderValue:"<your-fcm-access-token>"}],"@lunora/notify:webPush":[{description:"Public VAPID key (base64url) for Web Push. Generate a keypair once with: npx web-push generate-vapid-keys — the public key is also shipped to the browser to subscribe.",docsUrl:"https://lunora.sh/docs/packages/notify#web-push",key:"VAPID_PUBLIC_KEY",placeholderValue:"<your-vapid-public-key>"},{description:"Private VAPID key (base64url) for Web Push — the application-server signing key. Generate with: npx web-push generate-vapid-keys",docsUrl:"https://lunora.sh/docs/packages/notify#web-push",key:"VAPID_PRIVATE_KEY",placeholderValue:"<your-vapid-private-key>"},{description:"VAPID `sub` contact — a mailto: or https: URL identifying the application server (e.g. mailto:you@example.com).",docsUrl:"https://lunora.sh/docs/packages/notify#web-push",key:"VAPID_SUBJECT",placeholderValue:"mailto:you@example.com"}],"@lunora/payment/autumn":[{description:"Autumn secret key (am_sk_…) for the Autumn payment adapter. Obtain at https://app.useautumn.com/dev",docsUrl:"https://lunora.sh/docs/packages/payment#autumn",key:"AUTUMN_SECRET_KEY",placeholderValue:"<your-autumn-secret-key>"},{description:"Autumn webhook signing secret for verifying Standard Webhooks event payloads. Obtain from your Autumn dashboard webhook settings.",docsUrl:"https://lunora.sh/docs/packages/payment#autumn",key:"AUTUMN_WEBHOOK_SECRET",placeholderValue:"<your-autumn-webhook-secret>"}],"@lunora/payment/creem":[{description:"Creem API key for the Creem payment adapter. Obtain at https://www.creem.io/dashboard/developers",docsUrl:"https://lunora.sh/docs/packages/payment#creem",key:"CREEM_API_KEY",placeholderValue:"<your-creem-api-key>"},{description:"Creem webhook signing secret for verifying the creem-signature header. Obtain from your Creem dashboard webhook settings.",docsUrl:"https://lunora.sh/docs/packages/payment#creem",key:"CREEM_WEBHOOK_SECRET",placeholderValue:"<your-creem-webhook-secret>"}],"@lunora/payment/dodopayments":[{description:"Dodo Payments API key (bearer token) for the Dodo Payments adapter. Obtain at https://app.dodopayments.com/developer/api-keys",docsUrl:"https://lunora.sh/docs/packages/payment#dodo-payments",key:"DODO_PAYMENTS_API_KEY",placeholderValue:"<your-dodo-payments-api-key>"},{description:"Dodo Payments webhook signing secret (whsec_…) for verifying event payloads. Obtain at https://app.dodopayments.com/developer/webhooks",docsUrl:"https://lunora.sh/docs/packages/payment#dodo-payments",key:"DODO_PAYMENTS_WEBHOOK_KEY",placeholderValue:"<your-dodo-payments-webhook-secret>"}],"@lunora/payment/polar":[{description:"Polar access token for the Polar payment adapter. Obtain at https://polar.sh/settings/tokens",docsUrl:"https://lunora.sh/docs/packages/payment#polar",key:"POLAR_ACCESS_TOKEN",placeholderValue:"<your-polar-access-token>"},{description:"Polar webhook secret for verifying event payloads from Polar. Obtain at https://polar.sh/settings/webhooks",docsUrl:"https://lunora.sh/docs/packages/payment#polar",key:"POLAR_WEBHOOK_SECRET",placeholderValue:"<your-polar-webhook-secret>"}],"@lunora/payment/stripe":[{description:"Stripe secret key (sk_test_…). Required when using the Stripe adapter. Obtain at https://dashboard.stripe.com/apikeys",docsUrl:"https://lunora.sh/docs/packages/payment#stripe",key:"STRIPE_SECRET_KEY",placeholderValue:"<your-stripe-secret-key>"},{description:"Stripe webhook signing secret (whsec_…) for verifying event payloads. Obtain at https://dashboard.stripe.com/webhooks",docsUrl:"https://lunora.sh/docs/packages/payment#stripe",key:"STRIPE_WEBHOOK_SECRET",placeholderValue:"<your-stripe-webhook-secret>"}]},n=new Set([..._,...[...y,...Object.values(p).flat()].filter(e=>u(e.key)&&!e.placeholderValue.startsWith("<")&&e.key!==a).map(e=>e.key)]),m=e=>e.includes(k)?new Set([...n,a]):n,S=e=>{const s=[];for(const t of e){const o=p[t];o!==void 0&&s.push(...o)}return s};export{y as C,n as M,p as P,a as S,u as a,E as b,h as i,m,S as s};