@lunora/config 1.0.0-alpha.411 → 1.0.0-alpha.413

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 (26) hide show
  1. package/dist/cloudflare/index.d.mts +8 -2
  2. package/dist/cloudflare/index.d.ts +8 -2
  3. package/dist/cloudflare/index.mjs +1 -1
  4. package/dist/index.d.mts +2 -2
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.mjs +1 -1
  7. package/dist/packem_shared/SEED_ENDPOINT-C1fhrehH.mjs +1 -0
  8. package/dist/packem_shared/{STUDIO_PATH-Dfr-Fa7B.mjs → STUDIO_PATH-D8Ed88Sq.mjs} +1 -1
  9. package/dist/packem_shared/{UNEXPORTED_CLASS_MARKER-mdcw5KDY.mjs → UNEXPORTED_CLASS_MARKER-BV29zhUp.mjs} +1 -1
  10. package/dist/packem_shared/assertWranglerSatisfiesSchema-A2WCMIRa.mjs +3 -0
  11. package/dist/packem_shared/{collectExportGaps-BIPdSjrC.mjs → collectExportGaps-DNhqKWkA.mjs} +1 -1
  12. package/dist/packem_shared/discoverSchemaInfo-DRPnqgif.mjs +1 -0
  13. package/dist/packem_shared/inferLunoraBindings-de3rGumv.mjs +1 -0
  14. package/dist/packem_shared/reconcileBindingsSafely-ypLpCbLh.mjs +1 -0
  15. package/dist/packem_shared/{serveJsonHandler-Dv0EdCb9.mjs → serveJsonHandler-B8_GE6QC.mjs} +1 -1
  16. package/dist/studio-host/index.d.mts +6 -2
  17. package/dist/studio-host/index.d.ts +6 -2
  18. package/dist/studio-host/index.mjs +1 -1
  19. package/package.json +4 -4
  20. package/dist/packem_shared/SEED_ENDPOINT-BqSqBZuZ.mjs +0 -1
  21. package/dist/packem_shared/assertWranglerSatisfiesSchema-B4DcaiJY.mjs +0 -3
  22. package/dist/packem_shared/discoverSchemaInfo-BBRlXZop.mjs +0 -1
  23. package/dist/packem_shared/inferLunoraBindings-DdtLvzEd.mjs +0 -1
  24. package/dist/packem_shared/reconcileBindingsSafely-0wAgKJpO.mjs +0 -1
  25. package/dist/packem_shared/{infer-bindings.d-CyLHWT50.d.mts → infer-bindings.d-Cx96nMli.d.mts} +14 -14
  26. package/dist/packem_shared/{infer-bindings.d-CyLHWT50.d.ts → infer-bindings.d-Cx96nMli.d.ts} +14 -14
@@ -1,11 +1,13 @@
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
3
  import { D as DeployDriver } from "../packem_shared/deploy-driver.d-DraUd2R2.mjs";
2
- import { G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-CyLHWT50.mjs";
3
- export { H as HYPERDRIVE_PLACEHOLDER_ID } from "../packem_shared/infer-bindings.d-CyLHWT50.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). */
6
6
  declare const applyModify: (text: string, path: ReadonlyArray<number | string>, value: unknown) => string;
7
7
  /** The project coordinates the validator needs. */
8
8
  interface AssertWranglerOptions {
9
+ /** Memoises the schema discovery, shared with binding inference. */
10
+ cache?: DiscoveryCache;
9
11
  /** Absolute path to the project root holding `wrangler.jsonc`. */
10
12
  projectRoot: string;
11
13
  /** The schema directory, relative to `projectRoot` (usually `"lunora"`). */
@@ -583,6 +585,8 @@ declare const reconcileWranglerCrons: (projectRoot: string, cronTriggers: Readon
583
585
  declare const describePreservedCrons: (preserved: ReadonlyArray<string>) => string | undefined;
584
586
  /** The project coordinates every reconciler here needs. */
585
587
  interface ReconcileProject {
588
+ /** Memoises the source scans, so a caller that also validates or reconciles again parses the project once. */
589
+ cache?: DiscoveryCache;
586
590
  /** Absolute path to the project root holding `wrangler.jsonc`. */
587
591
  projectRoot: string;
588
592
  /** The schema directory, relative to `projectRoot` (usually `"lunora"`). */
@@ -1221,6 +1225,8 @@ interface ReadWranglerResult<T> {
1221
1225
  */
1222
1226
  declare const readWranglerJsonc: <T = unknown>(wranglerPath: string) => ReadWranglerResult<T>;
1223
1227
  interface WranglerProjectValidationOptions {
1228
+ /** Memoises the schema discovery, shared with binding inference. */
1229
+ cache?: DiscoveryCache;
1224
1230
  /**
1225
1231
  * Cloudflare environment to validate against `env.<name>` in
1226
1232
  * wrangler.jsonc. See {@link mergeWranglerEnvironment} for which keys
@@ -1,11 +1,13 @@
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
3
  import { D as DeployDriver } from "../packem_shared/deploy-driver.d-DraUd2R2.js";
2
- import { G as GeneratedClassModule, I as InferredBindings, S as SchemaInfo } from "../packem_shared/infer-bindings.d-CyLHWT50.js";
3
- export { H as HYPERDRIVE_PLACEHOLDER_ID } from "../packem_shared/infer-bindings.d-CyLHWT50.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). */
6
6
  declare const applyModify: (text: string, path: ReadonlyArray<number | string>, value: unknown) => string;
7
7
  /** The project coordinates the validator needs. */
8
8
  interface AssertWranglerOptions {
9
+ /** Memoises the schema discovery, shared with binding inference. */
10
+ cache?: DiscoveryCache;
9
11
  /** Absolute path to the project root holding `wrangler.jsonc`. */
10
12
  projectRoot: string;
11
13
  /** The schema directory, relative to `projectRoot` (usually `"lunora"`). */
@@ -583,6 +585,8 @@ declare const reconcileWranglerCrons: (projectRoot: string, cronTriggers: Readon
583
585
  declare const describePreservedCrons: (preserved: ReadonlyArray<string>) => string | undefined;
584
586
  /** The project coordinates every reconciler here needs. */
585
587
  interface ReconcileProject {
588
+ /** Memoises the source scans, so a caller that also validates or reconciles again parses the project once. */
589
+ cache?: DiscoveryCache;
586
590
  /** Absolute path to the project root holding `wrangler.jsonc`. */
587
591
  projectRoot: string;
588
592
  /** The schema directory, relative to `projectRoot` (usually `"lunora"`). */
@@ -1221,6 +1225,8 @@ interface ReadWranglerResult<T> {
1221
1225
  */
1222
1226
  declare const readWranglerJsonc: <T = unknown>(wranglerPath: string) => ReadWranglerResult<T>;
1223
1227
  interface WranglerProjectValidationOptions {
1228
+ /** Memoises the schema discovery, shared with binding inference. */
1229
+ cache?: DiscoveryCache;
1224
1230
  /**
1225
1231
  * Cloudflare environment to validate against `env.<name>` in
1226
1232
  * wrangler.jsonc. See {@link mergeWranglerEnvironment} for which keys
@@ -1 +1 @@
1
- import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{assertWranglerSatisfiesSchema as t}from"../packem_shared/assertWranglerSatisfiesSchema-B4DcaiJY.mjs";import{BINDING_MANIFEST_VERSION as 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-BIPdSjrC.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-0wAgKJpO.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-mdcw5KDY.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-DNhqKWkA.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-ypLpCbLh.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-BV29zhUp.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};
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-CyLHWT50.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-CyLHWT50.mjs";
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";
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";
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-CyLHWT50.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-CyLHWT50.js";
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";
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";
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-DdtLvzEd.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-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-de3rGumv.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-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};
@@ -0,0 +1 @@
1
+ import{existsSync as p}from"node:fs";import{discoverSchema as h,schemaFromIr as g}from"@lunora/codegen";import{LunoraError as k}from"@lunora/errors";import{Project as S}from"ts-morph";import{join as w}from"node:path";const P="/__lunora/seed",j=1e3,E=(r,t)=>typeof t=="bigint"?Number(t):t instanceof ArrayBuffer?[...new Uint8Array(t)]:t,R=r=>typeof r!="number"||!Number.isFinite(r)?10:Math.min(Math.max(1,Math.floor(r)),j),F=async r=>{if(r.method!=="POST")return{body:{error:"method-not-allowed",ok:!1},status:405};const{body:t}=r;if(t==null||typeof t!="object")return{body:{error:"invalid-request",ok:!1},status:400};const{count:f,existingIds:c,seed:m,table:o}=t;if(typeof o!="string"||o.length===0)return{body:{error:"missing-table",ok:!1},status:400};const d=r.schemaDirectory??"lunora",n=w(r.projectRoot,d,"schema.ts");if(!p(n))return{body:{error:"schema-not-found",ok:!1},status:404};const l=new S({skipAddingFilesFromTsConfig:!0}),a=h(l,n);if(!a.tables.some(e=>e.name===o))return{body:{error:"unknown-table",ok:!1,table:o},status:404};const u=g(a),{seedPlan:y}=await import("@lunora/seed");let s;try{s=y(u,{existingIds:c??{},defaultCount:R(f),only:[o],seed:m??0})}catch(e){if(e instanceof k&&e.code==="BAD_REQUEST")return{body:{error:"seed-refused",message:e.message,ok:!1},status:409};throw e}const i=s.filter(e=>e.table!==o).map(e=>e.table);if(i.length>0)return{body:{error:"fk-parents-empty",ok:!1,tables:i},status:409};const b=s.find(e=>e.table===o)?.rows??[];return{body:{ok:!0,rows:JSON.parse(JSON.stringify(b,E))},status:200}};export{P as SEED_ENDPOINT,F as handleSeedRequest};
@@ -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-BqSqBZuZ.mjs";import{serveJsonHandler as j}from"./serveJsonHandler-Dv0EdCb9.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-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 +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),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};
@@ -0,0 +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-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
+ `));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
+ `))};export{m as assertWranglerSatisfiesSchema};
@@ -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-DdtLvzEd.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-de3rGumv.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(`
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};
@@ -0,0 +1 @@
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-DRPnqgif.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};
@@ -0,0 +1 @@
1
+ import{inferLunoraBindings as g}from"./inferLunoraBindings-de3rGumv.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-DQTGPqcJ.mjs";import{reconcileWranglerBindings as $}from"./collectExportGaps-DNhqKWkA.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{headerValue as a}from"./ALLOW_FORWARDED_ENV-BUndghJx.mjs";const l=1e6,g=async t=>await new Promise((o,e)=>{const n=[];let i=0;t.on("data",c=>{if(i+=c.length,i>l){e(new Error("request body too large"));return}n.push(c)}),t.on("end",()=>{o(Buffer.concat(n).toString("utf8"))}),t.on("error",e)}),s=(t,o,e)=>{t.statusCode=o,t.setHeader("Content-Type","application/json; charset=utf-8"),t.end(JSON.stringify(e))},u=new Set(["none","same-origin","same-site"]),y=t=>{const o=a(t.headers["sec-fetch-site"]);if(o!==void 0)return u.has(o)?void 0:"cross-origin request rejected";const e=a(t.headers.origin);if(e===void 0||e==="null")return;let n;try{n=new URL(e).host.toLowerCase()}catch{return"invalid origin header"}return n===a(t.headers.host)?void 0:"cross-origin request rejected"},p=t=>{const o=(t.method??"GET").toUpperCase(),e=o!=="GET"&&o!=="HEAD",n=y(t);if(n!==void 0)return n;if(e&&!a(t.headers["content-type"])?.startsWith("application/json"))return"content-type must be application/json"},v=(t,o,e,n,i={})=>{(async()=>{try{const r=p(t);if(r!==void 0){s(o,403,{error:r,ok:!1});return}const d=t.method==="GET"?"":await g(t);let h;try{h=d===""?void 0:JSON.parse(d)}catch{s(o,400,{error:"invalid-json",ok:!1});return}const f=e({...i,body:h,method:t.method??"POST",projectRoot:n});s(o,f.status,f.body)}catch(r){s(o,500,{error:r instanceof Error?r.message:String(r),ok:!1})}})().catch(()=>{})};export{v as serveJsonHandler};
1
+ import{headerValue as a}from"./ALLOW_FORWARDED_ENV-BUndghJx.mjs";const l=1e6,g=async t=>await new Promise((o,e)=>{const n=[];let i=0;t.on("data",c=>{if(i+=c.length,i>l){e(new Error("request body too large"));return}n.push(c)}),t.on("end",()=>{o(Buffer.concat(n).toString("utf8"))}),t.on("error",e)}),s=(t,o,e)=>{t.statusCode=o,t.setHeader("Content-Type","application/json; charset=utf-8"),t.end(JSON.stringify(e))},u=new Set(["none","same-origin","same-site"]),y=t=>{const o=a(t.headers["sec-fetch-site"]);if(o!==void 0)return u.has(o)?void 0:"cross-origin request rejected";const e=a(t.headers.origin);if(e===void 0||e==="null")return;let n;try{n=new URL(e).host.toLowerCase()}catch{return"invalid origin header"}return n===a(t.headers.host)?void 0:"cross-origin request rejected"},p=t=>{const o=(t.method??"GET").toUpperCase(),e=o!=="GET"&&o!=="HEAD",n=y(t);if(n!==void 0)return n;if(e&&!a(t.headers["content-type"])?.startsWith("application/json"))return"content-type must be application/json"},v=(t,o,e,n,i={})=>{(async()=>{try{const r=p(t);if(r!==void 0){s(o,403,{error:r,ok:!1});return}const d=t.method==="GET"?"":await g(t);let h;try{h=d===""?void 0:JSON.parse(d)}catch{s(o,400,{error:"invalid-json",ok:!1});return}const f=await e({...i,body:h,method:t.method??"POST",projectRoot:n});s(o,f.status,f.body)}catch(r){s(o,500,{error:r instanceof Error?r.message:String(r),ok:!1})}})().catch(()=>{})};export{v as serveJsonHandler};
@@ -196,7 +196,7 @@ interface LocalEndpointResponse {
196
196
  readonly status: number;
197
197
  }
198
198
  /** A transport-agnostic local-dev handler (schema edit, policy scaffold). */
199
- type LocalEndpointHandler = (request: LocalEndpointRequest) => LocalEndpointResponse;
199
+ type LocalEndpointHandler = (request: LocalEndpointRequest) => LocalEndpointResponse | Promise<LocalEndpointResponse>;
200
200
  /**
201
201
  * Adapt a `node:http` request/response pair to a transport-agnostic local-dev
202
202
  * handler. `GET` carries no body (the schema editor uses it to read the parsed
@@ -386,8 +386,12 @@ interface SeedResponse {
386
386
  * `existingIds` to resolve against is answered with `409
387
387
  * fk-parents-empty` naming the parent tables — the endpoint refuses
388
388
  * rather than hand back children whose parents it just dropped.
389
+ *
390
+ * `@lunora/seed` is imported here, on the first request, not at module scope:
391
+ * it pulls in faker, which every dev server paid at startup for a button most
392
+ * sessions never press.
389
393
  */
390
- declare const handleSeedRequest: (request: SeedRequest) => SeedResponse;
394
+ declare const handleSeedRequest: (request: SeedRequest) => Promise<SeedResponse>;
391
395
  /**
392
396
  * Suffix of the temporary file a studio handler writes and renames over its
393
397
  * target. A watcher that sees every file has to ignore it: its events are part
@@ -196,7 +196,7 @@ interface LocalEndpointResponse {
196
196
  readonly status: number;
197
197
  }
198
198
  /** A transport-agnostic local-dev handler (schema edit, policy scaffold). */
199
- type LocalEndpointHandler = (request: LocalEndpointRequest) => LocalEndpointResponse;
199
+ type LocalEndpointHandler = (request: LocalEndpointRequest) => LocalEndpointResponse | Promise<LocalEndpointResponse>;
200
200
  /**
201
201
  * Adapt a `node:http` request/response pair to a transport-agnostic local-dev
202
202
  * handler. `GET` carries no body (the schema editor uses it to read the parsed
@@ -386,8 +386,12 @@ interface SeedResponse {
386
386
  * `existingIds` to resolve against is answered with `409
387
387
  * fk-parents-empty` naming the parent tables — the endpoint refuses
388
388
  * rather than hand back children whose parents it just dropped.
389
+ *
390
+ * `@lunora/seed` is imported here, on the first request, not at module scope:
391
+ * it pulls in faker, which every dev server paid at startup for a button most
392
+ * sessions never press.
389
393
  */
390
- declare const handleSeedRequest: (request: SeedRequest) => SeedResponse;
394
+ declare const handleSeedRequest: (request: SeedRequest) => Promise<SeedResponse>;
391
395
  /**
392
396
  * Suffix of the temporary file a studio handler writes and renames over its
393
397
  * target. A watcher that sees every file has to ignore it: its events are part
@@ -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-Dfr-Fa7B.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-BqSqBZuZ.mjs";import{serveJsonHandler as y}from"../packem_shared/serveJsonHandler-Dv0EdCb9.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-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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/config",
3
- "version": "1.0.0-alpha.411",
3
+ "version": "1.0.0-alpha.413",
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,10 +58,10 @@
58
58
  "access": "public"
59
59
  },
60
60
  "dependencies": {
61
- "@lunora/codegen": "1.0.0-alpha.357",
62
- "@lunora/container": "1.0.0-alpha.92",
61
+ "@lunora/codegen": "1.0.0-alpha.359",
62
+ "@lunora/container": "1.0.0-alpha.93",
63
63
  "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
64
- "@lunora/seed": "1.0.0-alpha.257",
64
+ "@lunora/seed": "1.0.0-alpha.258",
65
65
  "@visulima/colorize": "2.1.1",
66
66
  "@visulima/find-ai-runner": "1.0.2",
67
67
  "@visulima/fs": "6.0.29",
@@ -1 +0,0 @@
1
- import{existsSync as y}from"node:fs";import{discoverSchema as p,schemaFromIr as h}from"@lunora/codegen";import{LunoraError as g}from"@lunora/errors";import{seedPlan as k}from"@lunora/seed";import{Project as S}from"ts-morph";import{join as w}from"node:path";const F="/__lunora/seed",j=1e3,E=(t,r)=>typeof r=="bigint"?Number(r):r instanceof ArrayBuffer?[...new Uint8Array(r)]:r,R=t=>typeof t!="number"||!Number.isFinite(t)?10:Math.min(Math.max(1,Math.floor(t)),j),I=t=>{if(t.method!=="POST")return{body:{error:"method-not-allowed",ok:!1},status:405};const{body:r}=t;if(r==null||typeof r!="object")return{body:{error:"invalid-request",ok:!1},status:400};const{count:f,existingIds:c,seed:m,table:o}=r;if(typeof o!="string"||o.length===0)return{body:{error:"missing-table",ok:!1},status:400};const d=t.schemaDirectory??"lunora",n=w(t.projectRoot,d,"schema.ts");if(!y(n))return{body:{error:"schema-not-found",ok:!1},status:404};const l=new S({skipAddingFilesFromTsConfig:!0}),a=p(l,n);if(!a.tables.some(e=>e.name===o))return{body:{error:"unknown-table",ok:!1,table:o},status:404};const u=h(a);let s;try{s=k(u,{existingIds:c??{},defaultCount:R(f),only:[o],seed:m??0})}catch(e){if(e instanceof g&&e.code==="BAD_REQUEST")return{body:{error:"seed-refused",message:e.message,ok:!1},status:409};throw e}const i=s.filter(e=>e.table!==o).map(e=>e.table);if(i.length>0)return{body:{error:"fk-parents-empty",ok:!1,tables:i},status:409};const b=s.find(e=>e.table===o)?.rows??[];return{body:{ok:!0,rows:JSON.parse(JSON.stringify(b,E))},status:200}};export{F as SEED_ENDPOINT,I as handleSeedRequest};
@@ -1,3 +0,0 @@
1
- import{LunoraError as n}from"@lunora/errors";import{lunoraLine as i}from"./LUNORA_TAG-DQTGPqcJ.mjs";import{validateWranglerProject as l}from"./UNEXPORTED_CLASS_MARKER-mdcw5KDY.mjs";const m=(e,a,t)=>{const r=l({projectRoot:e.projectRoot,schemaDir:e.schemaDir});if(!r.wranglerPath)throw new n("INTERNAL",["[lunora] wrangler.jsonc not found.",` searched in: ${e.projectRoot}`," create a wrangler.jsonc declaring at least the SHARD durable object binding."].join(`
2
- `));for(const o of r.report.warnings)a(i(`wrangler validator: ${o}`));if(r.problems.length>0)throw new n("INTERNAL",["[lunora] wrangler configuration is missing bindings required by your schema.",` file: ${r.wranglerPath}`,"",...r.problems.map(o=>` - ${o}`),"",` ${t}`].join(`
3
- `))};export{m as assertWranglerSatisfiesSchema};
@@ -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 k,readFileSync as L,readdirSync as B}from"node:fs";import{discoverFlags as G,FLAGS_FILENAME as W,discoverQueues as q,CAPABILITY_PROBES as w,readServiceBindings as Y,discoverNotifyChannels as K,NOTIFY_FILENAME as U,createTargetScope as M,mayReadCapabilityContext as H,sourceCapabilitySignals as V,foldCapabilitySignals as T,capabilitiesUsedBy as X}from"@lunora/codegen";import{init as Q}from"es-module-lexer";import{Project as J}from"ts-morph";import{discoverAgentInfo as z}from"./discoverAgentInfo-pqFMJBtJ.mjs";import{discoverContainerInfo as Z}from"./discoverContainerInfo-DzXr7Vm3.mjs";import{escapeRegExp as ee}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{d as I}from"./discover-info-DC2MrAIM.mjs";import{relative as se,sep as te,isAbsolute as re,join as y}from"node:path";import{P as oe}from"./package-secrets-registry-CkRQL24p.mjs";import{discoverSchemaInfo as ne}from"./discoverSchemaInfo-BBRlXZop.mjs";import{resolveWorkerEntry as ae,composedEntryDurableObjects as ie,GENERATED_DIRECTORY as A,DURABLE_OBJECT_BINDINGS as ce,detectExportedDurableObjects as de,detectClassExports as x,isMergedProject as D}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{discoverWorkflowInfo as ue}from"./discoverWorkflowInfo-zW7Tt0Tn.mjs";const le=(e,s)=>{const{error:r,value:t}=I(e,s,W,G);return r===void 0?{flags:t}:{error:r}},me=(e,s)=>{const r=se(s,e);return r!==""&&r!==".."&&!r.startsWith(`..${te}`)&&!re(r)},pe=(e,s)=>{const{error:r,value:t}=I(e,s,void 0,q);return r===void 0?{queues:t??[]}:{error:r,queues:[]}},he=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),fe=new Set([".git",".lunora-cache",".wrangler","dist",A,"node_modules"]),ge=["lunora","src"],ye=/\benv\s*\.\s*DB\b/,Se=/\benv\s*\.\s*AI\b/,N=["ai","aiSearch","analytics","analyticsSql","artifacts","browser","hyperdrive","images","kv","mail","notify","payments","pipelines","r2sql","scheduler","storage","x402"],O=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"]],P=[...N.map(e=>[O(e),w[e].moduleSpecifier]),...j].toSorted(([e],[s])=>e.localeCompare(s)),be=[["usesNotifyFcm","@lunora/notify:fcm"],["usesNotifyWebPush","@lunora/notify:webPush"],["hostsShardRegistry","@lunora/do:shardRegistry"],["usesRequestSecretTool","@lunora/agent:requestSecretTool"]],Ee=["@lunora/agent","@lunora/agent/sandbox"],ve=new RegExp(String.raw`["'\x60](?:${[...P.map(([,e])=>e),...Ee].map(e=>ee(e)).join("|")})["'\x60]`,"u"),o=e=>{const{contextProperty:s,moduleSpecifier:r}=w[e];return s===void 0?`${r} is imported`:`${r} is imported or ctx.${s} is read`},Re="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",Ae=/\bfrom\s+["']\.{1,2}\//u,F=(e,s)=>{let r;try{r=B(e,{withFileTypes:!0})}catch{return}for(const t of r){if(t.isDirectory()){fe.has(t.name)||F(y(e,t.name),s);continue}const n=t.name.lastIndexOf(".");n!==-1&&he.has(t.name.slice(n))&&s.push(y(e,t.name))}},_e=(e,s,r)=>{const{info:t}=ne(e,s,r);return{jurisdiction:t?.jurisdiction,needsD1:t?.hasD1GlobalTable??!1}},xe=(e,s,r)=>{const t=y(e,r),n=new J({compilerOptions:{allowJs:!0},skipAddingFilesFromTsConfig:!0}),a=[],c=[],l=[],d=M();let E=!1,v=!1;for(const i of s){const m=y(e,i);if(!$(m)||!k(m).isDirectory())continue;const f=[];F(m,f);for(const u of f){const g=L(u,"utf8"),p=me(u,t);E||=Se.test(g),v||=ye.test(g),(ve.test(g)||p&&(H(g)||Ae.test(g)))&&(n.createSourceFile(u,g,{overwrite:!0}),a.push({file:u,inLunora:p}))}}for(const{file:i,inLunora:m}of a)(m?c:l).push(V(n.getSourceFileOrThrow(i),d));const h=T(c),R=T([h,...l]),S=new Set([...R.valueImports,...R.dynamicImports]),b=X({contextReads:h.contextReads,valueImports:S});return{...Object.fromEntries([...N.map(i=>[O(i),b.has(i)]),...j.map(([i,m])=>[i,S.has(m)])]),needsD1:v,usesRequestSecretTool:h.requestSecretTool,usesAi:b.has("ai")||E,usesBrowser:b.has("browser")||h.sandboxTools.usesSandboxBrowser,usesWorkerLoader:h.sandboxTools.usesSandboxLoader}},Ie=(e,s,r)=>[...e.map(t=>t.exported?`${t.bindingName}/${t.className} (container "${t.exportName}" declared and exported)`:`hint: container "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...s.map(t=>t.exported?`exports.${t.className} (workflow "${t.exportName}" declared and exported)`:`hint: workflow "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...r.map(t=>t.exported?`exports.${t.className} (agent "${t.exportName}" declared and exported)`:`hint: agent "${t.exportName}" is declared but ${t.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],Ce=(e,s,r)=>[[e.usesAi,`AI (${o("ai")}, or env.AI is used)`],[e.usesAuth&&!s.has("SessionDO"),"hint: @lunora/auth is imported; its tables are D1-backed by default. For DO-backed auth (what @better-auth/scim needs), pass `namespace` to .auth() and export the generated auth DO class"],[e.usesScheduler&&!s.has("SchedulerDO"),`hint: ${o("scheduler")}, but no SchedulerDO is exported by the worker entry`],[e.usesStorage,`hint: ${o("storage")}; add an r2_buckets binding (bucket binding names are user-defined)`],[e.usesMail,`hint: ${o("mail")}; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)`],[e.usesPayments,`hint: ${o("payments")}; set the provider secrets in .dev.vars — ${Re}`],[e.usesBrowser,`browser (${o("browser")}, or a sandbox browserTool imported in lunora/) — self-describing { binding: BROWSER }`],[e.usesImages,`images (${o("images")}) — self-describing { binding: IMAGES }`],[e.usesAnalytics,`analytics_engine_datasets (${o("analytics")}) — self-describing { binding: ANALYTICS, dataset }`],[e.usesWorkerLoader,"worker_loaders (jsCodeTool imported in lunora/) — self-describing { binding: LOADER }"],[e.usesAiSearch,`ai_search_namespaces (${o("aiSearch")}) — self-describing { binding: AI_SEARCH, namespace: "default" }; remote-only, so \`lunora dev\` reaches the deployed AI Search service`],[e.usesAnalyticsSql,`analytics (${o("analyticsSql")}) — self-describing { binding: ANALYTICS_SQL }; needs wrangler >= 4.145.0, and is remote-only, so \`lunora dev\` queries the account's live analytics`],[e.usesKv,r.jurisdiction===void 0?`kv_namespaces (${o("kv")}) — { binding: KV } with no id; wrangler creates the namespace on the first deploy`:`hint: ${o("kv")} and the schema pins "${r.jurisdiction}"; create the namespace with --jurisdiction ${r.jurisdiction} and add a kv_namespaces binding ({ binding, id })`],[e.usesHyperdrive,`hyperdrive (${o("hyperdrive")}) — { binding: HYPERDRIVE } with a placeholder id; dev uses an embedded Postgres and \`lunora deploy\` creates the config`],[e.usesPipelines,`hint: ${o("pipelines")}; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, stream }) — the pipeline resource can't be auto-provisioned`],[e.usesArtifacts,r.jurisdiction===void 0?`artifacts (${o("artifacts")}) — { binding: ARTIFACTS, namespace }`:`hint: ${o("artifacts")}; the schema pins data to "${r.jurisdiction}", so create the namespace in that jurisdiction first and add { binding: ARTIFACTS, namespace } yourself — \`lunora deploy\` then checks it (a first create() in dev would make it unrestricted)`],[e.usesX402Charge,"hint: @lunora/x402/charge is imported; set the recipient wallet address as a [vars] entry (the var name is yours to choose) and pass it to the charge config — the x402 facilitator settles USDC to that address"],[e.usesX402,`hint: ${o("x402")} (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding for the agent wallet key (name it to match signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars, so the key can't be auto-provisioned`]].filter(([n])=>n).map(([,n])=>n),Te=(e,s,r,t=[],n=[],a=[])=>{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(...Ie(t,n,a),...Ce(r,c,s)),l},$e=(e,s)=>e.some(r=>r.binding==="SHARD_REGISTRY")||D(s)&&$(y(s,"shardRegistry.ts")),Ye=async e=>{await Q;const s=e.schemaDir??"lunora",r=e.scanDirs??ge,t=()=>xe(e.projectRoot,r,s),n=e.cache===void 0?t():e.cache.memo(`capabilities:${e.projectRoot}:${s}:${r.join(",")}`,t),a=ae(e.projectRoot);let c;a.composed?c=ie(y(e.projectRoot,s,A)).map(C=>({binding:ce[C],className:C})):c=a.path===void 0?[]:de(a.path);const l=_e(e.projectRoot,s,e.cache),d={...l,needsD1:n.needsD1||l.needsD1},E=x(a,Z(e.projectRoot,s,e.cache).containers,"containers"),v=x(a,ue(e.projectRoot,s).workflows,"workflows"),h=x(a,z(e.projectRoot,s).agents,"agents"),R=[...pe(e.projectRoot,s).queues],{flags:S}=le(e.projectRoot,s),b=I(e.projectRoot,s,U,K),_=b.error===void 0?b.value:{hasFcm:!0,hasWebPush:!0},i=S?.provider==="flagship"&&S.mode==="binding"?S.bindingName:void 0,m=$e(c,y(e.projectRoot,s,A)),f=Te(c,d,n,E,v,h);!a.composed&&D(y(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"),i!==void 0&&f.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${i}", app_id }) — the app_id can't be auto-provisioned`);const u=Y(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})`)),{...n,agents:h,containers:E,durableObjects:c,flagshipBinding:i,...d.jurisdiction===void 0?{}:{jurisdiction:d.jurisdiction},needsD1:d.needsD1,queues:R,services:g,signals:f,usesFlags:S!==void 0,usesNotifyFcm:_?.hasFcm??!1,usesNotifyWebPush:_?.hasWebPush??!1,hostsShardRegistry:m,workflows:v}},Ke=e=>[...P,...be].filter(([s,r])=>e[s]&&oe[r]!==void 0).map(([,s])=>s);export{Ye as inferLunoraBindings,Ke as secretSourcesFromBindings};
@@ -1 +0,0 @@
1
- import{inferLunoraBindings as g}from"./inferLunoraBindings-DdtLvzEd.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-DQTGPqcJ.mjs";import{reconcileWranglerBindings as p}from"./collectExportGaps-BIPdSjrC.mjs";import{reconcileWranglerCompatibilityDate as $}from"./reconcileWranglerCompatibilityDate-hocXEuRA.mjs";import{reconcileWranglerCrons as m,describePreservedCrons as w}from"./describePreservedCrons-C5KPuPy3.mjs";const j=async(i,t,a)=>{try{const n=await g({projectRoot:i.projectRoot,schemaDir:i.schemaDir}),e=p(i.projectRoot,n,{target:i.target}),o=e.wranglerPath??"wrangler.jsonc";if(e.added.length>0&&t.info?.(`${r} inferred bindings → ${e.added.join(", ")} (written to ${o})`),e.updated.length>0&&t.info?.(`${r} updated bindings → ${e.updated.join(", ")} (written to ${o})`),e.devConfig!==void 0){const{added:s,path:d,updated:f}=e.devConfig;t.info?.(`${r} dev sidecar bindings → ${[...s,...f].join(", ")} (written to ${d})`)}for(const s of e.warnings)t.warn(`${r} ${s}`);e.exportGaps.length>0&&a?.(e.exportGaps)}catch(n){const e=n instanceof Error?n.message:String(n);t.warn(`${r} binding inference skipped: ${e}`)}},c=new Map,u=(i,t,a)=>{try{const n=m(i,t);n.changed&&a.info?.(`${r} synced ${t.length.toFixed(0)} cron trigger(s) into ${n.wranglerPath??"wrangler.jsonc"}`);for(const s of n.warnings)a.warn(`${r} ${s}`);const e=n.preserved.join("\0"),o=w(n.preserved);o!==void 0&&(n.changed||c.get(i)!==e)&&a.info?.(`${r} ${o}`),c.set(i,e)}catch(n){const e=n instanceof Error?n.message:String(n);a.warn(`${r} cron trigger sync skipped: ${e}`)}try{const n=$(i);n.changed&&a.info?.(`${r} bumped compatibility_date to ${n.date??"unknown"} (Workers Cache enabled) → ${n.wranglerPath??"wrangler.jsonc"}`)}catch(n){const e=n instanceof Error?n.message:String(n);a.warn(`${r} compatibility date sync skipped: ${e}`)}};export{j as reconcileBindingsSafely,u as reconcileWranglerExtras};
@@ -1,4 +1,18 @@
1
1
  import { SchemaIR, AgentIR, ContainerIR, QueueIR, ServiceBindingIR, WorkflowIR } from '@lunora/codegen';
2
+ /**
3
+ * An invocation-scoped memo for project discovery. A CLI command creates one,
4
+ * threads it through every `discover*` / `inferLunoraBindings` call it makes,
5
+ * and clears it after anything rewrites the sources discovery reads (codegen).
6
+ * Deliberately not module-level: tests and long-lived processes never see a
7
+ * stale result.
8
+ */
9
+ interface DiscoveryCache {
10
+ /** Drop every memoised result. */
11
+ clear: () => void;
12
+ /** Return the result memoised under `key`, computing it on first use. */
13
+ memo: <T>(key: string, compute: () => T) => T;
14
+ }
15
+ declare const createDiscoveryCache: () => DiscoveryCache;
2
16
  /**
3
17
  * Placeholder `database_id` written for an auto-provisioned `DB` binding. It is
4
18
  * intentionally not a valid id so a deploy can't silently target the wrong
@@ -16,20 +30,6 @@ declare const D1_PLACEHOLDER_ID = "<replace-with-d1-create-id>";
16
30
  * embedded Postgres whatever it is. `lunora deploy` swaps in a real id.
17
31
  */
18
32
  declare const HYPERDRIVE_PLACEHOLDER_ID = "<replace-with-hyperdrive-create-id>";
19
- /**
20
- * An invocation-scoped memo for project discovery. A CLI command creates one,
21
- * threads it through every `discover*` / `inferLunoraBindings` call it makes,
22
- * and clears it after anything rewrites the sources discovery reads (codegen).
23
- * Deliberately not module-level: tests and long-lived processes never see a
24
- * stale result.
25
- */
26
- interface DiscoveryCache {
27
- /** Drop every memoised result. */
28
- clear: () => void;
29
- /** Return the result memoised under `key`, computing it on first use. */
30
- memo: <T>(key: string, compute: () => T) => T;
31
- }
32
- declare const createDiscoveryCache: () => DiscoveryCache;
33
33
  /** One filterable Vectorize metadata property a schema declares. */
34
34
  interface VectorMetadataDeclaration {
35
35
  /** The vector index the property belongs to. */
@@ -1,4 +1,18 @@
1
1
  import { SchemaIR, AgentIR, ContainerIR, QueueIR, ServiceBindingIR, WorkflowIR } from '@lunora/codegen';
2
+ /**
3
+ * An invocation-scoped memo for project discovery. A CLI command creates one,
4
+ * threads it through every `discover*` / `inferLunoraBindings` call it makes,
5
+ * and clears it after anything rewrites the sources discovery reads (codegen).
6
+ * Deliberately not module-level: tests and long-lived processes never see a
7
+ * stale result.
8
+ */
9
+ interface DiscoveryCache {
10
+ /** Drop every memoised result. */
11
+ clear: () => void;
12
+ /** Return the result memoised under `key`, computing it on first use. */
13
+ memo: <T>(key: string, compute: () => T) => T;
14
+ }
15
+ declare const createDiscoveryCache: () => DiscoveryCache;
2
16
  /**
3
17
  * Placeholder `database_id` written for an auto-provisioned `DB` binding. It is
4
18
  * intentionally not a valid id so a deploy can't silently target the wrong
@@ -16,20 +30,6 @@ declare const D1_PLACEHOLDER_ID = "<replace-with-d1-create-id>";
16
30
  * embedded Postgres whatever it is. `lunora deploy` swaps in a real id.
17
31
  */
18
32
  declare const HYPERDRIVE_PLACEHOLDER_ID = "<replace-with-hyperdrive-create-id>";
19
- /**
20
- * An invocation-scoped memo for project discovery. A CLI command creates one,
21
- * threads it through every `discover*` / `inferLunoraBindings` call it makes,
22
- * and clears it after anything rewrites the sources discovery reads (codegen).
23
- * Deliberately not module-level: tests and long-lived processes never see a
24
- * stale result.
25
- */
26
- interface DiscoveryCache {
27
- /** Drop every memoised result. */
28
- clear: () => void;
29
- /** Return the result memoised under `key`, computing it on first use. */
30
- memo: <T>(key: string, compute: () => T) => T;
31
- }
32
- declare const createDiscoveryCache: () => DiscoveryCache;
33
33
  /** One filterable Vectorize metadata property a schema declares. */
34
34
  interface VectorMetadataDeclaration {
35
35
  /** The vector index the property belongs to. */